Skip to content

Commit 57f9744

Browse files
authored
Update contributing workflow (#180)
* Update contributing workflow * HelloLog for testAllCommands
1 parent 4e21666 commit 57f9744

File tree

12 files changed

+42
-29
lines changed

12 files changed

+42
-29
lines changed

.github/ISSUE_TEMPLATE/recipe-request.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ about: Request a recipe be added this repo
44
title: ''
55
labels: recipe-request
66
assignees: ''
7-
87
---
98

9+
<!---
10+
Before you submit this recipe request, check if there are any duplicate ["Recipe Request" issues](https://github.com/JordanMartinez/purescript-cookbook/issues?q=is%3Aissue+is%3Aopen+label%3Arecipe-request) or [PRs](https://github.com/JordanMartinez/purescript-cookbook/pulls).
11+
12+
If you'd like to work on implementing this recipe, assign yourself and let us know when to check back in to make sure it's not abandoned.
13+
-->
14+
1015
**Recipe Name**
1116

1217
```

CONTRIBUTING.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,29 @@ Follow these instructions for contributing new recipes. The Goal headers indicat
88

99
#### Goal 1: Claim and Start Working on a Recipe Request
1010

11-
1. Search currently open "Recipe Request" issues. If there isn't one for your recipe, open a new "Recipe Request" issue for it. This is where you'll find the "Unique Recipe Name" (i.e. short description of the problem using PascalCase, such as "HelloWorld")
12-
1. State on the issue that you'll be implementing the recipe and how long we should wait before following up with you if you haven't finished it yet. If you do not post this, we will assume that you will have it done within two weeks.
13-
- This helps avoid two issues. First, it prevents two developers from working on the same recipe independently. Second, one developer who wants to implement the recipe may think someone else who has started work on it and then abandoned it is still working on it.
11+
1. Search currently [open "Recipe Request" issues](https://github.com/JordanMartinez/purescript-cookbook/issues?q=is%3Aissue+is%3Aopen+label%3Arecipe-request).
12+
1. If your recipe idea is unique, open a new ["Recipe Request" issue](https://github.com/JordanMartinez/purescript-cookbook/issues/new?assignees=&labels=recipe-request&template=recipe-request.md&title=)
13+
1. Proceed to the next step if you'd like to implement this recipe yourself.
1414

1515
#### Goal 2: Setup a New Recipe's Boilerplate by Copying a Current Similar One
1616

17-
1. Pick an existing recipe to duplicate as a starting point. The `HelloWorld` recipe is the simplest and is set up to work on both Node.js and Browser backends.
18-
- In the examples that follow, we'll assume that you copied the `HelloWorld` recipe and wish to use the "Unique Recipe Name" of `MyNewRecipe`
17+
1. Pick an existing recipe to duplicate as a starting point. The `HelloLog` recipe is the simplest and is set up to work on both Node.js and Browser backends.
18+
- In the examples that follow, we'll assume that you copied the `HelloLog` recipe and wish to use the "Unique Recipe Name" of `MyNewRecipe`
19+
```
20+
cd recipes
21+
cp -r HelloLog MyNewRecipe
22+
```
1923
1. Rename the copied folder to the "Unique Recipe Name" assigned in the original issue.
2024
1. Depending on the backend-compatibility of your recipe, follow the instructions below:
21-
1. If your recipe is incompatible with the browser enviornment, delete the `web` directory.
25+
1. If your recipe is incompatible with the browser environment, delete the `web` directory.
2226
- If your recipe uses `node-*` libraries, it is incompatible with the browser.
2327
- Logging to the console **is** supported in the browser.
2428
1. If your recipe is incompatible with the Node.js backend, delete the `nodeSupported.md` file.
2529
1. If your recipe is compatible with Node.js, but the resulting program should not be run during CI (e.g. a program that parses command-line arguments), then rename `nodeSupported.md` to `nodeSupportedSkipCI.md`.
26-
1. Replace all usages of the original recipe's "Unique Recipe Name" with your recipe's "Unique Recipe Name." To find all instances, `cd` into your recipe folder and run `grep -r <originalUniqueRecipeName>`. For example, `HelloWorld` would be replaced with `MyNewRecipe` in the following files (as of this writing):
27-
- `recipes/MyNewRecipe/spago.dhall`
28-
- `recipes/MyNewRecipe/README.md`
29-
- `recipes/MyNewRecipe/src/Main.purs`
30-
- `recipes/MyNewRecipe/web/index.html`
31-
- `recipes/MyNewRecipe/web/index.js`
30+
1. Replace all usages of the original recipe's name with your new recipe's name. For example:
31+
```
32+
grep -rl 'HelloLog' MyNewRecipe | xargs sed -i 's/HelloLog/MyNewRecipe/g'
33+
```
3234
3335
#### Goal 3: Implement and Submit the Recipe
3436
@@ -38,15 +40,15 @@ Follow these instructions for contributing new recipes. The Goal headers indicat
3840
1. Change directory into your recipe folder: `cd recipes/MyRecipeName`
3941
1. Install dependencies as normal: `spago install <packageName>`
4042
1. Return to the root directory: `cd ../..`
41-
- **Note**: you can only install dependencies that exist in the latest package set release; you cannot add or override packages in `packages.dhall` (see Principles section for more contxt).
43+
- **Note**: you can only install dependencies that exist in the latest package set release; you cannot add or override packages in `packages.dhall` (see Principles section for more context).
4244
1. Install needed `npm` dependencies via `npm i <packageName>`. These will be installed to the root folder's `node_modules` folder, not a corresponding folder in the recipe.
4345
- If you do install `npm` dependencies for your recipe, please state which libraries were installed in the recipe's `README.md` file.
4446
1. Implement your recipe. If you add any new modules, always start the module name with your recipe's "Unique Recipe Name" (e.g. `MyNewRecipe.Foo`, `MyNewRecipe.Module.Path.To.Cool.Types`)
45-
- Run `spago -x recipes/MyNewRecipe/spago.dhall build -w` while in the root folder for faster iteration while developing
47+
- Run `make MyNewRecipe-build-watch` while in the root folder if you'd like to automatically rebuild recipes upon changes.
4648
1. Update your recipe's `README.md` file by doing the following things:
47-
1. Write a full sumary of your recipe on the 3rd line (i.e. don't use any newlines). This is what will appear in the repo's Recipe section's Table of Contents.
49+
1. Write a summary of your recipe on the 3rd line. This is what will appear in the repo's Recipe section's Table of Contents. Don't add newlines unless you're okay with that additional content being omitted from the table.
4850
1. Update the "Expected Behavior" section to describe in more detail what should occur when users run your recipe.
49-
1. Link to any other resources that a reader might find helpful. Do not explain things further.
51+
1. Link to any other resources that a reader might find helpful. No need for detailed explanations of libraries here.
5052
1. List the `npm` dependencies your recipe uses (if any).
5153
1. Regenerate the table of recipes by running `make readme` while in the root folder
5254
1. Submit a PR. The first line should read `Fixes #X` where `X` refers to the original "Recipe Request" issue you claimed.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ Running a web-compatible recipe:
111111
| | :heavy_check_mark: | [GroceriesReactHooks](recipes/GroceriesReactHooks) | A React port of the ["HTML - Groceries" Elm Example](https://elm-lang.org/examples/groceries). |
112112
| | :heavy_check_mark: | [HelloConcur](recipes/HelloConcur) | A Concur port of the ["HTML - Hello" Elm Example](https://elm-lang.org/examples/hello). |
113113
| | :heavy_check_mark: | [HelloHalogenHooks](recipes/HelloHalogenHooks) | A Halogen port of the ["HTML - Hello" Elm Example](https://elm-lang.org/examples/hello). |
114+
| :heavy_check_mark: | :heavy_check_mark: | [HelloLog](recipes/HelloLog) | This recipe shows how to run a simple "Hello world!" program in either the node.js or web browser console. |
114115
| | :heavy_check_mark: | [HelloReactHooks](recipes/HelloReactHooks) | A React port of the ["HTML - Hello" Elm Example](https://elm-lang.org/examples/hello). |
115-
| :heavy_check_mark: | :heavy_check_mark: | [HelloWorldLog](recipes/HelloWorldLog) | This recipe shows how to run a simple "Hello world!" program in either the node.js or web browser console. |
116116
| :heavy_check_mark: | :heavy_check_mark: | [HeterogenousArrayLog](recipes/HeterogenousArrayLog) | This recipe demonstrates how to create a heterogenous array and process its elements. |
117117
| | :heavy_check_mark: | [ImagePreviewsHalogenHooks](recipes/ImagePreviewsHalogenHooks) | A Halogen port of the ["Files - Drag-and-Drop" Elm Example](https://elm-lang.org/examples/drag-and-drop). |
118118
| | :heavy_check_mark: | [InterpretHalogenHooks](recipes/InterpretHalogenHooks) | Demonstrates how to use a custom monad (in this case, using `ReaderT` with `Aff` as the effect type) for a component, and then interpreting that custom monad back down to `Aff`, so it can be run as a normal component. |

makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ prodDistDir = $(call recipeDir,$1)/prod-dist
163163
> @echo === Building $* ===
164164
> spago -x $(call recipeSpago,$*) build
165165

166+
# Watches for changes and rebuilds recipe
167+
.PHONY: %-build-watch
168+
%-build-watch:
169+
> @echo === Watching to Build $* ===
170+
> spago -x $(call recipeSpago,$*) build -w
171+
166172
# Tests whether recipe can be run on web browser backend
167173
recipes/%/web:
168174
> @echo Recipe $* is not compatible with the web browser backend
@@ -222,7 +228,7 @@ testAllCI: $(targetsAllCI)
222228
# recipe actually works.
223229
testAllCommands:
224230
> $(MAKE)
225-
> $(MAKE) HelloWorldLog-node
226-
> $(MAKE) HelloWorldLog-build
227-
> $(MAKE) HelloWorldLog-buildWeb
228-
> $(MAKE) HelloWorldLog-buildProd
231+
> $(MAKE) HelloLog-node
232+
> $(MAKE) HelloLog-build
233+
> $(MAKE) HelloLog-buildWeb
234+
> $(MAKE) HelloLog-buildProd
File renamed without changes.

recipes/HelloWorldLog/README.md renamed to recipes/HelloLog/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# HelloWorldLog
1+
# HelloLog
22

33
This recipe shows how to run a simple "Hello world!" program in either the node.js or web browser console.
44

File renamed without changes.

recipes/HelloWorldLog/spago.dhall renamed to recipes/HelloLog/spago.dhall

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{ name = "HelloWorldLog"
1+
{ name = "HelloLog"
22
, dependencies =
33
[ "console", "effect", "psci-support" ]
44
, packages = ../../packages.dhall
5-
, sources = [ "recipes/HelloWorldLog/src/**/*.purs" ]
5+
, sources = [ "recipes/HelloLog/src/**/*.purs" ]
66
}
77
{-
88
sources does not work with paths relative to this config

recipes/HelloWorldLog/src/Main.purs renamed to recipes/HelloLog/src/Main.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module HelloWorldLog.Main where
1+
module HelloLog.Main where
22

33
import Prelude
44

recipes/HelloWorldLog/web/index.html renamed to recipes/HelloLog/web/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<head>
55
<meta charset="UTF-8">
6-
<title>HelloWorldLog</title>
6+
<title>HelloLog</title>
77
</head>
88

99
<body>

0 commit comments

Comments
 (0)