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

Add default “npm run build” for project (with docs updates) #3725

Merged
merged 3 commits into from
Jun 1, 2023

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented May 31, 2023

Our tasks.md docs talk about serving the review app directly with:

npm run serve --workspace govuk-frontend-review

But we didn't explain that an MVB™ (minimum viable build 😆) was needed first:

  • build GOV.UK Frontend using npm run build:package
  • build Rollup stats YAML using npm run build:stats in #3681
  • build Express.js "Review app" using npm run build:app

This PR adds a convenient npm run build script to solve this problem and was split out from:

@colinrotherham colinrotherham added documentation User requests new documentation or improvements to existing documentation tooling labels May 31, 2023
@colinrotherham colinrotherham requested a review from a team as a code owner May 31, 2023 10:30
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3725 May 31, 2023 10:30 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3725 May 31, 2023 10:36 Inactive
Base automatically changed from get-yaml to main May 31, 2023 11:33
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3725 May 31, 2023 19:20 Inactive
"dev": "concurrently \"npm run dev --workspace govuk-frontend-review\" \"npm run dev --workspace govuk-frontend\" --kill-others --names \"app,pkg\" --prefix-colors \"red.dim,blue.dim\"",
"build": "npm run build --workspace govuk-frontend --workspace govuk-frontend-review",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our default build is to prepare the review app for launch

  1. Build govuk-frontend package
  2. Build govuk-frontend-review assets

But notice that the webpack example isn't included? For GitHub Actions Tests we instead run:

run: npm run build --workspaces --if-present

By adding a new npm run build we can run it before key scripts

E.g. Ensuring we have the govuk-frontend package built before we import it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion Would it be worth invoking build:app and build:package here via concurrently rather than use npm to limit risks of the commands diverging if we update them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romaricpascal Ah we can't I'm afraid, review app relies on govuk-frontend/dist/** things

Any thoughts on using npm run build (default) versus npm run build:package (named)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's narrow it down when we add the stats package (also needs pre-building) in:

@colinrotherham colinrotherham changed the base branch from main to component-libs June 1, 2023 08:55
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3725 June 1, 2023 08:55 Inactive
Or in full the “Express.js review app”
Our default build is to prepare the review app for launch

1. Build `govuk-frontend` package
2. Build `govuk-frontend-review` assets
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3725 June 1, 2023 08:57 Inactive
Base automatically changed from component-libs to main June 1, 2023 13:33
Copy link
Member

@romaricpascal romaricpascal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, especially in anticipation of building the stats. Just a little suggestion to reuse the existing tasks for avoiding future divergence, but I'm fine if it goes as is 😊

"dev": "concurrently \"npm run dev --workspace govuk-frontend-review\" \"npm run dev --workspace govuk-frontend\" --kill-others --names \"app,pkg\" --prefix-colors \"red.dim,blue.dim\"",
"build": "npm run build --workspace govuk-frontend --workspace govuk-frontend-review",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion Would it be worth invoking build:app and build:package here via concurrently rather than use npm to limit risks of the commands diverging if we update them?

@colinrotherham colinrotherham merged commit f98c65b into main Jun 1, 2023
@colinrotherham colinrotherham deleted the build-default branch June 1, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation User requests new documentation or improvements to existing documentation tooling
Projects
Development

Successfully merging this pull request may close these issues.

3 participants