-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(dev workflow improvements) (#602)
* build(eleventy): change 11ty config to allow reloading of components in development By default the nunjucks environment loads components from the ./package directory. This means changes to a component won't be loaded in development. This PR updates the nunjucks environment to load from the ./src directoy when the ENV var is det to dev * build(husky): update husky config to prevent double prompt When aliasing git commit to git cz alongside the pre-commit-hook would cause the interactive prompt to run twice. This Pr updates the pre-commit-hook to only run if a commit message has not already been provided * build(eleventy): amend 11ty config to allow reloading components from src directory Documentation examples by default load components from the built /package directory. This PR adds the ability to pass an ENV='dev' flag to the eleventy command to enable loading of components direct from the /src directory. This also adds a gulp watcher to rebuild the package css and js files during development. This needs further work! We have three file watchers running in parallel to build/rebuild the docs site in development. (11ty, webpack, and gulp) It would be good if we could use just one! * build(remove webpack): remove webpack and use 11ty and gulp only We were using 3 build tools in combination: 11ty, webpack, and gulp. This was overly complex, a bit unnecessary, and was slow. Webpack was only really being used to copy files - which can very easily eb done by gulp. This PR removes the webpack dependency and pipeline in favour of gulp. the pipeline is now setup such that any changes in dev for a component will trigger a rebuild of the assets and the 11ty docs making working on a component much faster as changes to both nunjucks templates and js/scss files trigger a reload in the browser. * build(gulp): improve dev workflow pipeline with gulp Move more config from 11ty to gulp in order to work better. 11ty now handles anything nunjucks related, and gulp handles anything asset related. 11ty is then set to watch the files output from the gulp build pipeline in order to trigger a reload.
- Loading branch information
Showing
47 changed files
with
15,770 additions
and
18,924 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
exec < /dev/tty && npx cz --hook || true | ||
# Only run commitizen if no commit message was already provided. | ||
if [ -z "${2-}" ]; then | ||
exec < /dev/tty && npx cz --hook || true | ||
fi |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const gulp = require("gulp"); | ||
const sass = require("gulp-sass")(require("sass")); | ||
const {createGulpEsbuild} = require("gulp-esbuild") | ||
const esbuild = createGulpEsbuild({ | ||
incremental: false, // enables the esbuild"s incremental build | ||
piping: true, // enables piping | ||
}) | ||
|
||
// Copy all the govuk-frontend assets across | ||
gulp.task( | ||
"docs:copy-dependencies", () => { | ||
return gulp.src([ | ||
"node_modules/govuk-frontend/dist/govuk/assets/**/*", | ||
"src/moj/assets/**/*" | ||
]) | ||
.pipe(gulp.dest("public/assets")) | ||
} | ||
); | ||
|
||
// Copy package vendor files across | ||
gulp.task( | ||
"docs:copy-vendor", () => { | ||
return gulp.src([ | ||
"src/moj/vendor/**/*.js" | ||
]) | ||
.pipe(gulp.dest("public/assets/javascript")) | ||
} | ||
); | ||
|
||
// Ordering is important here! - Docs > Package > GovUK frontend | ||
gulp.task( | ||
"docs:copy-files", gulp.series( | ||
"docs:copy-dependencies", | ||
"docs:copy-vendor", | ||
) | ||
); | ||
|
||
// Compile the docs site stylesheet | ||
gulp.task( | ||
"docs:styles", () => { | ||
return gulp | ||
.src("docs/assets/stylesheets/application.scss") | ||
.pipe(sass()) | ||
.pipe(gulp.dest("public/assets/stylesheets")); | ||
} | ||
); | ||
|
||
// Bundle the docs site javascript | ||
gulp.task( | ||
"docs:scripts", () => { | ||
return gulp | ||
.src("docs/assets/javascript/all.js") | ||
.pipe(esbuild({ | ||
outfile: "all.js", | ||
target: "es6", | ||
bundle: true, | ||
})) | ||
.pipe(gulp.dest("public/assets/javascript")) | ||
} | ||
); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.