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

Investigate using the packages folder convention #3490

Closed
wants to merge 28 commits into from

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Apr 4, 2023

Moves govuk-frontend and the Review app packages into “packages”

This follows the npm workspaces default which we see in other tools:

dequelabs/axe-core-npm/packages
babel/babel/packages
cssnano/cssnano/packages
eslint/eslint/packages
facebook/jest/packages
webdriverio/webdriverio/packages

But keeping shared at project root

After

├── bin
├── dist
├── docs
├── packages
│   ├── govuk-frontend
│   │   ├── src
│   │   └── dist
│   └── govuk-frontend-review
│       ├── src
│       └── dist
└── shared
    ├── config
    ├── helpers
    ├── lib
    └── tasks

@colinrotherham colinrotherham requested a review from a team as a code owner April 4, 2023 10:50
@colinrotherham colinrotherham self-assigned this Apr 4, 2023
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 4, 2023 10:50 Inactive
@colinrotherham colinrotherham force-pushed the npm-workspaces branch 2 times, most recently from 53aca35 to e5f9f99 Compare April 6, 2023 08:34
@colinrotherham colinrotherham force-pushed the npm-workspaces-packages branch from 1c4beb8 to 07ddf40 Compare April 6, 2023 08:38
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 6, 2023 08:38 Inactive
@colinrotherham colinrotherham force-pushed the npm-workspaces-packages branch from 07ddf40 to 2901d78 Compare April 6, 2023 10:34
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 6, 2023 10:35 Inactive
@colinrotherham colinrotherham force-pushed the npm-workspaces-packages branch from 2901d78 to 42cbfea Compare April 6, 2023 13:49
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 6, 2023 13:50 Inactive
@colinrotherham colinrotherham force-pushed the npm-workspaces branch 2 times, most recently from d98a34e to 84248f7 Compare April 11, 2023 13:06
@colinrotherham colinrotherham force-pushed the npm-workspaces-packages branch from 42cbfea to 3bf8936 Compare April 11, 2023 13:08
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 11, 2023 13:08 Inactive
@colinrotherham colinrotherham force-pushed the npm-workspaces-packages branch from 3bf8936 to cfe5a88 Compare April 12, 2023 14:34
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 12, 2023 14:34 Inactive
@colinrotherham colinrotherham force-pushed the npm-workspaces-packages branch from cfe5a88 to 30344aa Compare April 12, 2023 15:07
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 12, 2023 15:07 Inactive
In preparation for build artifacts being deleted, package will need utility tasks to run (on watch) during development
But rebuild them during `predev`, `pretest` and `heroku-postbuild`
Ignores the ‘unlink’ (delete) event otherwise Review app watch tasks trigger when `govuk-frontend` “clean” runs. Built code is not available at this point
This breaking change moves the wrapper `package/dist/package.json` to `package/package.json`

Package exports will be updated in another commit
Avoids breaking changes for Node.js (and bundlers that support package exports)

Note: Sass load paths will still need the new `dist/` prefix
We currently ship with Node.js v4.2.0 support in `package.json`

But ESLint is reporting that we need:

* Node.js v14.0.0 for 'fs/promises'
* Node.js v7.6.0 for Async functions

Plus we’d need Node.js v12.19.0+ for wildcard package exports
@colinrotherham colinrotherham force-pushed the npm-workspaces-packages branch from 028a31c to 3523aef Compare April 26, 2023 07:42
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 26, 2023 07:42 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 26, 2023 07:52 Inactive
@colinrotherham colinrotherham force-pushed the npm-workspaces-packages branch from 83241a7 to 10dda9f Compare April 26, 2023 08:01
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 26, 2023 08:01 Inactive
@colinrotherham colinrotherham changed the title [SPIKE] Move packages into npm workspaces structure Move packages into npm workspaces structure Apr 26, 2023
@colinrotherham colinrotherham changed the base branch from main to delete-package-dist April 26, 2023 08:47
@colinrotherham colinrotherham changed the title Move packages into npm workspaces structure Investigate using the packages folder convention Apr 26, 2023
The switch to `packages/*` has caused the review app to build _before_ `govuk-frontend` which threw errors on missing Sass and JavaScript
@colinrotherham colinrotherham force-pushed the npm-workspaces-packages branch from 10dda9f to fe4eac8 Compare April 26, 2023 13:59
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3490 April 26, 2023 13:59 Inactive
@colinrotherham
Copy link
Contributor Author

It's a keeper. I've folded this work into:

@colinrotherham colinrotherham deleted the npm-workspaces-packages branch May 4, 2023 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants