Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create npm package with the correct name under the correct org #393

Closed
plocket opened this issue Dec 3, 2021 · 7 comments
Closed

Create npm package with the correct name under the correct org #393

plocket opened this issue Dec 3, 2021 · 7 comments
Assignees
Labels
priority A combination of urgency and impact
Milestone

Comments

@plocket
Copy link
Collaborator

plocket commented Dec 3, 2021

Right now, it's called docassemble-cucumber. We need alkiln, I think. If Suffolk is interested, we also need to find out if Suffolk has a npm org and put these releases under that.

@plocket plocket added the priority A combination of urgency and impact label Dec 3, 2021
@plocket plocket added this to the v4 milestone Dec 12, 2021
@plocket
Copy link
Collaborator Author

plocket commented Dec 12, 2021

I think creating an npm org needs your participation, @colarusso

@colarusso
Copy link
Member

FWIW, @nonprofittechy is an Owner as well. That being said, what is it exactly that is needed?

@plocket
Copy link
Collaborator Author

plocket commented Dec 17, 2021

Packages use this framework by pulling it from the npm package registry (https://npmjs.com/). Right now, it's owned by me. I think folks from Suffolk should probably have the ability to publish, deprecate, and generally manage this framework. That means that Suffolk needs to have an npmjs organization (https://docs.npmjs.com/organizations) and create a package there, probably with the name alkiln, but it can be whatever you want.

If you can set us up, we can work on migrating to it. Let me know if you need more information.

@colarusso , @nonprofittechy

@plocket plocket self-assigned this Jan 8, 2022
@plocket
Copy link
Collaborator Author

plocket commented Jan 10, 2022

Want to double check scoped package decision. From the docs, another note about scoped repos:

Note: You cannot transfer a scoped package to another user account or organization, because a package's scope is the user account or organization name. You will need to create a new package in the new scope.


Steps to transfer:

Docs for transferring packages: https://docs.npmjs.com/transferring-a-package-from-a-user-account-to-another-user-account

Deprecate the old name and make a new name: See https://docs.npmjs.com/cli/v8/commands/npm-deprecate or https://github.com/tiaanduplessis/pkg-rename/blob/master/index.js. Use @suffolklitlab/alkiln as the new repo name.

@colarusso
Copy link
Member

I think our former call still stands. We'll put it under our org because that seems like the best form so as not to crowd out the namespace for all.

@plocket
Copy link
Collaborator Author

plocket commented Jan 11, 2022

I've created the project and I'm all set with your part in this, colarusso. You can unwatch this issue if you want.

Next steps: we just need to go through and update the projects we're using. It's actually a convenient time. We can convert them to the new action and then they won't have to deal with the name of the package at all. I'd love a hand with this. Make a PR on the relevant repos in order of priority:

Live forms:

Soon to be live:

Deprecated or stable:

Used for testing:

Dependents, but maybe unnecessary:

Not live, so they're done:

What we need to do to each repo is first make sure the tests can pass with version 3 of alkiln:

  • If it's a suffolk repo, ensure the repo isn't using its own secrets, just the org secrets
  • Clone the repo
  • Checkout a new branch. Let's call it alkiln_update to be consistent.
  • In /package.json, edit "docassemble-cucumber": "whatever they have in here", to "docassemble-cucumber": "^3.0.0",. Yes, I'm aware that isn't the right name, but it's equivalent and it does the least to rock the boat at the moment.
  • Run npm install
  • Create the file /.env. Use the /.env_example file to guide what you put in .env from your own docassemble account on the server.
  • See what tests are in the "sources" folder. It may just be the example, and then it won't take much work.
  • If there is an actual test with steps, try to convert v1 tests to v3 using the example below and the kiln documentation.

For v1 story table, this:

    | var | value | checked |
    | a_plaintiff_s_motion_to_modify_qc_v20009 | True | true |
    | signature | users[0].signature |  |
    | trial_court | all_courts[0] | true |

will turn into something like:

    | var | value | trigger |
    | a_plaintiff_s_motion_to_modify_qc_v20009 | True |  |
    | users[0].signature |  | users[0].signature |
    | trial_court.all_courts[0] | True |  |

No guarantees that it'll work.

For v2 story table, most things should work fine.

After doing your best, do

  • Run npm run local
  • If the tests pass, you should be good. If they don't and you can tell why, fiddle with it. If you can't tell, message me.
  • To speed up iteration of testing, you can use npm run setup once, npm run cucumber repeatedly to run the tests themselves, then npm run takedown when you're done.

Once the tests pass, transition the repo to our new action-only flow. Use Appeals Brief Template's PR as an example of the final product. Some of these files will have been added by you when you set up to run the tests, so remember to delete all of them.

Paths you probably just created:

  • If _alkiln_report... file that was created by the setup is still there, you haven't run npm run takedown, so run that now and the file will be deleted
  • Delete /package-lock.json
  • Delete /node_modules
  • Delete /.env
  • Delete all the ignored files and folders created. They should all have timestamps in their names.

Pre-existing ones:

  • Delete /package.json

  • Delete /.env_example

  • Delete /.gitignore

  • Edit their /.github/workflows/run_form_tests.yml to look like this

  • Push that and see if the tests pass.

  • Make a PR. I've used:

Title: Test with alkiln v3 action-controlled workflow only
Body: This uses only the workflow file to trigger ALKiln tests. Removed package.json and other npm files and files for local development as the ALKiln will manage these now. References the ALKiln v3 branch to keep up with updates to that branch.

  • Get a review? Just merge?
  • Celebrate!

plocket added a commit that referenced this issue Feb 17, 2022
I'm thinking this is just going to be for v4. Not bothering with this for v3 unless we absolutely have to since none of the vulnerabilities are severe. My current rationale is that the more work we do to maintain 3, the less work we can do getting v4 ready for release. Ready to hear opinions.

- Close #164, update cucumber to v7
- Prepare for v8 of cucumber because I won't remember it later
- Close #394, update puppeteer
- Update our version of node (and that of our action that we'll run for other people's libs). [Addresses #393 so we can use the suffolk npm org package.]
- Use `npm audit` to fix the remaining vulnerabilities (now 0)
- [Remove package.json as discussed in #489 to align our tests' behaviors with those of our users.]

* Update action.yml node to v17

* Update from cucumber v6 to v7. See details.

See https://github.com/cucumber/cucumber-js/blob/main/docs/migration.md#migrating-to-cucumber-js-7xx

Only use cucumber setDefaultTimeout globally and use a shim that replicates the fix in v8 that lets you do custom timeouts more easily so we can still give enough time for steps that may need more time.

Use all caps for statuses.

Test screenshot step.

Btw, the cucumber test output visually looks a bit different now - when a scenario passes, all the steps pass too.

Sorry about the little comment changes, etc. Tried to remove a lot of those incidental unrelated changes.

* Update puppeteer to latest (13). See details below.

- page.waitFor -> page.waitForTimeout and page.waitForSelector (Got deprication notice. See puppeteer/puppeteer#6214.)
- remove removeEventListener (we'd need to change it to removeListener anyway - v4.0.0 and see https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#eventemitterremovelistenerevent-handler). For now we'll count on page close taking care of it, just in case removing it would prevent multiple-file-downloads.

* Update GitHub worflow node version, tweak changelog item order

* Fix npm audit vulnerabilities and update action.yml cucumber

* Pin the colors lib in action.yml

* Remove package-lock.json #489, use kiln v4 for users, CHANGELOG

* Fix custom timeout, remove duplicate report entry, as per review
plocket added a commit that referenced this issue Mar 2, 2022
Created log.txt and git hub artifact for reports. Closes #466.

* add log.txt for report messages

* create artifact for logs

* Update changelog

* Update our package's dependencies for v4 (#503)

I'm thinking this is just going to be for v4. Not bothering with this for v3 unless we absolutely have to since none of the vulnerabilities are severe. My current rationale is that the more work we do to maintain 3, the less work we can do getting v4 ready for release. Ready to hear opinions.

- Close #164, update cucumber to v7
- Prepare for v8 of cucumber because I won't remember it later
- Close #394, update puppeteer
- Update our version of node (and that of our action that we'll run for other people's libs). [Addresses #393 so we can use the suffolk npm org package.]
- Use `npm audit` to fix the remaining vulnerabilities (now 0)
- [Remove package.json as discussed in #489 to align our tests' behaviors with those of our users.]

* Update action.yml node to v17

* Update from cucumber v6 to v7. See details.

See https://github.com/cucumber/cucumber-js/blob/main/docs/migration.md#migrating-to-cucumber-js-7xx

Only use cucumber setDefaultTimeout globally and use a shim that replicates the fix in v8 that lets you do custom timeouts more easily so we can still give enough time for steps that may need more time.

Use all caps for statuses.

Test screenshot step.

Btw, the cucumber test output visually looks a bit different now - when a scenario passes, all the steps pass too.

Sorry about the little comment changes, etc. Tried to remove a lot of those incidental unrelated changes.

* Update puppeteer to latest (13). See details below.

- page.waitFor -> page.waitForTimeout and page.waitForSelector (Got deprication notice. See puppeteer/puppeteer#6214.)
- remove removeEventListener (we'd need to change it to removeListener anyway - v4.0.0 and see https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#eventemitterremovelistenerevent-handler). For now we'll count on page close taking care of it, just in case removing it would prevent multiple-file-downloads.

* Update GitHub worflow node version, tweak changelog item order

* Fix npm audit vulnerabilities and update action.yml cucumber

* Pin the colors lib in action.yml

* Remove package-lock.json #489, use kiln v4 for users, CHANGELOG

* Fix custom timeout, remove duplicate report entry, as per review

* Allow a developer to wait as a first Step v4. #387. Add test. (#506)

Closes #387.

Also, generally adds safety measures for when page does not exist.

Very similar to PR #459, but moving the responsibility down to a spot that most functions make use of, meaning that it'll be applied to a lot more cases. They mostly won't need it, but it might still be worth being more comprehensive.

* Allow a developer to wait as a first Step v4. #387. Add test.

Will be able to close once we've added this as an establishing
step (in addition to it being a regular step).

Also, generally adds safety measures for when page does not exist.

* Add test

Co-authored-by: Bryce Willey <Bryce.Steven.Willey@gmail.com>

Co-authored-by: Bryce Willey <Bryce.Steven.Willey@gmail.com>

* add log to gitnore and cleanup console.logs and typos

* add empty string to file

Co-authored-by: plocket <52798256+plocket@users.noreply.github.com>
Co-authored-by: Bryce Willey <Bryce.Steven.Willey@gmail.com>
plocket added a commit that referenced this issue Mar 23, 2022
typo in regex branch name parsing.

Close #393 for v4. Will not be addressing v3.
plocket added a commit that referenced this issue Mar 23, 2022
* Switch to suffolklitlab org, allow testing pre-release, fix

typo in regex branch name parsing.

Close #393 for v4. Will not be addressing v3.

* Add flexibility to default alkiln version number

* Create alkiln version env var

* Clarify that package.json overwrite is temporary

Co-authored-by: Jonatan Asketorp <2598631+k3KAW8Pnf7mkmdSMPHz27@users.noreply.github.com>

* Use simpler url for link to docs/"homepage"

Thanks!

Co-authored-by: Bryce Willey <Bryce.Steven.Willey@gmail.com>

Co-authored-by: Jonatan Asketorp <2598631+k3KAW8Pnf7mkmdSMPHz27@users.noreply.github.com>
Co-authored-by: Bryce Willey <Bryce.Steven.Willey@gmail.com>
@plocket
Copy link
Collaborator Author

plocket commented Mar 23, 2022

Closed by #527

@plocket plocket closed this as completed Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority A combination of urgency and impact
Projects
None yet
Development

No branches or pull requests

2 participants