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

Ensure "clean" target matches --destination flag #2877

Merged
merged 2 commits into from
Oct 5, 2022

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Sep 22, 2022

I noticed when we build to a custom directory via --destination it's not "cleaned"

npx gulp build:package --destination 'custom/location/package'
npx gulp build:dist --destination 'custom/location/dist'

☝️ As those two commands only clean ./package via cleanPackage() and ./dist via cleanDist()

This PR includes:

  1. Automatic destination based on task name build:package or build:dist
  2. Automatic clean target based on destination
  3. Tests for --destination if we want to keep it
  4. Removal of --destination if we want to get rid of it

This comment was really useful: #2243 (comment)

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2877 September 22, 2022 15:37 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2877 September 22, 2022 15:37 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2877 September 26, 2022 13:34 Inactive
Copy link
Contributor

@owenatgov owenatgov left a comment

Choose a reason for hiding this comment

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

One tiny question. This looks great to me!

It's probs worth getting a js squad dev to look over this still as I'm rusty on these build scripts and conventions that we're trying to follow with these tooling updates.

tasks/task-arguments.unit.test.js Show resolved Hide resolved
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2877 September 27, 2022 13:47 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2877 September 27, 2022 13:52 Inactive
@36degrees 36degrees self-requested a review September 28, 2022 09:25
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2877 September 29, 2022 20:53 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2877 September 30, 2022 10:28 Inactive
// Defaults for known tasks
const destinations = [
{
task: 'build:package',
Copy link
Contributor

Choose a reason for hiding this comment

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

Part of me wants to do this by parsing the task name, but this is way less fussy and prone to errors!

Copy link
Contributor

@domoscargin domoscargin left a comment

Choose a reason for hiding this comment

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

I think this looks grand!

Maybe at this stage it makes sense to keep the --destination flag until we've completed work to scope our JavaScript/Browser support changes, in case we make some big changes that require liberal use of it.

I think that's unlikely to happen, but it probably makes sense to keep our options open, and we can always come back and get rid of it down the line.

@colinrotherham
Copy link
Contributor Author

Thanks @domoscargin

Did you see the "remove" commit was 1 of 3?

I'm more than happy to drop that one, keeping the automatic clean() target + new test coverage?

@domoscargin
Copy link
Contributor

@colinrotherham

Yup, sorry, should've been clearer - I think we should do exactly that. Was just holding off approving to see if you were on the same page.

I'll approve now and we can drop that commit.

Copy link
Contributor

@domoscargin domoscargin left a comment

Choose a reason for hiding this comment

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

🏆

@colinrotherham colinrotherham changed the title Remove --destination flag override Ensure "clean" target matches --destination flag Oct 5, 2022
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2877 October 5, 2022 18:46 Inactive
@colinrotherham colinrotherham merged commit 2a6dd30 into main Oct 5, 2022
@colinrotherham colinrotherham deleted the destination-tests branch October 5, 2022 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

4 participants