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

Make govuk-prototype-kit install command work with npm #1575

Closed
wants to merge 8 commits into from

Conversation

lfdebrux
Copy link
Member

@lfdebrux lfdebrux commented Sep 2, 2022

We want users to be able to run

npx govuk-prototype-kit install

and have it do the thing they expect; i.e install the kit and create the project for them.

To get this to work I had to make a few changes; see the commits for details.

@lfdebrux lfdebrux mentioned this pull request Sep 2, 2022
3 tasks
@lfdebrux lfdebrux force-pushed the ldeb-npm-pack branch 5 times, most recently from b64fc76 to 3f4279f Compare September 2, 2022 16:05
We want to make sure that the version that the version of the kit the
user has installed at the end of the install process is the same as the
one used to do the install. The easiest and best way to do this is to
have two steps, with the first bootstrapping the second with the latest
version of the kit package, similar to how create-react-app works [[1]].

This commit splits the process in two within the cli script.

[1]: https://github.com/facebook/create-react-app/blob/main/packages/create-react-app/createReactApp.js
You can now run

        govuk-prototype-kit install --package-spec govuk-prototype-kit@13.0.100
        govuk-prototype-kit install --package-spec file:~/Code/govuk-prototype-kit
The code from this was pretty shamelessly taken from Facebook's
create-react-app [[1]], and is covered under their copy of the MIT
Licence [[2]]. As we already use the MIT licence and include it in this
project [[3]], I think that means we are already adhering to the licence
terms.

[1]: https://github.com/facebook/create-react-app/blob/f34d88e30c7d8be7181f728d1abc4fd8d5cd07d3/packages/create-react-app/createReactApp.js#L906
[2]: https://github.com/facebook/create-react-app/blob/f34d88e30c7d8be7181f728d1abc4fd8d5cd07d3/LICENSE
[3]: https://github.com/alphagov/govuk-prototype-kit/blob/9e4a7fd6a4689be14c067c674bdf0f767fd03f1f/LICENCE.txt
Older versions of Node come with npm@6, which doesn't have the npm exec
command (and may or may not have npx). Instead of relying on that
tool just call the binary directly. This also means we can ensure we're
using the same version of node as the caller.
@Izabela-16 Izabela-16 closed this Sep 15, 2022
@lfdebrux lfdebrux reopened this Sep 20, 2022
@lfdebrux
Copy link
Member Author

Closing in favour of #1621

@lfdebrux lfdebrux closed this Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants