From 7e8734cd9dea8725ca0c1d10c0cf32f22d244013 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 13 Feb 2024 16:34:00 +1100 Subject: [PATCH 1/4] Add notes for getting started I had to make assumptions based on the project files to work out what to do. It's not immediately clear for people like me who aren't familiar with this environment. --- CONTRIBUTING.md | 17 +++++++++++++++++ README.md | 1 + 2 files changed, 18 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..cc777ef --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,17 @@ +## Getting started +### Node +Ensure you have a compatible node version mentioned in `.node-version` + +Note, `nodenv` doesn't recognise a non-specific version, so you'll have to set it manually with env var (or better, .node-version should be updated) +https://github.com/nodenv/nodenv?tab=readme-ov-file#choosing-the-node-version + +### Packages +Using yarn package manager: +`yarn install` + +### Running tests +Optionally specify file or folder for a specific test. +`yarn jest [path]` + +### Dev server +`yarn run dev` diff --git a/README.md b/README.md index e1e8318..2ecf8e3 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ See [stimulus-rails-nested-form documentation](https://www.stimulus-components.c ## 👷‍♂️ Contributing Do not hesitate to contribute to the project by adapting or adding features ! Bug reports or pull requests are welcome. +See [CONTRIBUTING.md] for more details. ## 📝 License From ab60792a34c4cc37374c212ee42232465a2a8e81 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 13 Feb 2024 17:22:22 +1100 Subject: [PATCH 2/4] How to test with local project --- CONTRIBUTING.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cc777ef..02a8504 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,21 @@ Using yarn package manager: ### Running tests Optionally specify file or folder for a specific test. -`yarn jest [path]` +`yarn test [path]` ### Dev server -`yarn run dev` +`yarn dev` + + +### Test with local project + +Generate dist files with: `yarn build` + +Then, in your other project directory: + +Include with local file reference: `yarn add file:/path/to/stimulus-rails-nested-form` + +Update reference to this dir, eg: +```js +import NestedForm from '/path/to/stimulus-rails-nested-form/dist/stimulus-rails-nested-form.umd.js' // the default module entry point is broken for webpacker +``` From ce6a451e3b2e2160b911858449376bffcabc1c4f Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 13 Feb 2024 16:35:12 +1100 Subject: [PATCH 3/4] Specify exact Node version It's safer to ensure the same version is always used. Also it's required by nodenv --- .node-version | 2 +- CONTRIBUTING.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.node-version b/.node-version index 3c03207..e6db45a 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -18 +18.14.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 02a8504..03e9314 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,8 +2,8 @@ ### Node Ensure you have a compatible node version mentioned in `.node-version` -Note, `nodenv` doesn't recognise a non-specific version, so you'll have to set it manually with env var (or better, .node-version should be updated) -https://github.com/nodenv/nodenv?tab=readme-ov-file#choosing-the-node-version +For example, with nodenv: +`nodenv install` ### Packages Using yarn package manager: From 66401b3e4d50dcfec058ab8403ea7dd2b5c98ce3 Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 15 Feb 2024 15:17:42 +1100 Subject: [PATCH 4/4] Update with lint and format --- CONTRIBUTING.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03e9314..3d0a80f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,7 @@ ## Getting started +Create your own fork, and develop changes on a new branch. +It's expected you add tests, and lint and format your code before submitting a PR. + ### Node Ensure you have a compatible node version mentioned in `.node-version` @@ -9,13 +12,12 @@ For example, with nodenv: Using yarn package manager: `yarn install` -### Running tests -Optionally specify file or folder for a specific test. -`yarn test [path]` - ### Dev server `yarn dev` +### Running tests +Optionally specify file or folder for a specific test. +`yarn test [path]` ### Test with local project @@ -29,3 +31,7 @@ Update reference to this dir, eg: ```js import NestedForm from '/path/to/stimulus-rails-nested-form/dist/stimulus-rails-nested-form.umd.js' // the default module entry point is broken for webpacker ``` + +### Linting and formatting +`yarn lint` +`yarn format`