Skip to content

Commit

Permalink
Merge pull request #4560 from alphagov/gulp-copy
Browse files Browse the repository at this point in the history
Use Gulp to copy files instead of `cpy`
  • Loading branch information
colinrotherham authored Dec 14, 2023
2 parents 113d1e3 + 50f0515 commit 049d732
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 248 deletions.
192 changes: 0 additions & 192 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions packages/govuk-frontend-review/tasks/watch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export const watch = (options) =>
*/
task.name('lint:scss watch', () =>
gulp.watch(
[join(options.srcPath, '**/*.scss')],
'**/*.scss',
{ cwd: options.srcPath },

// Run Stylelint checks
npm.script('lint:scss:cli', [
Expand All @@ -36,10 +37,8 @@ export const watch = (options) =>
*/
task.name('compile:scss watch', () =>
gulp.watch(
[
join(options.srcPath, '**/*.scss'),
join(paths.package, 'dist/govuk/all.scss')
],
['**/*.scss', join(paths.package, 'dist/govuk/all.scss')],
{ cwd: options.srcPath },

// Run Sass compile
styles(options)
Expand All @@ -51,8 +50,8 @@ export const watch = (options) =>
*/
task.name('lint:js watch', () =>
gulp.watch(
join(options.srcPath, '**/*.{cjs,js,mjs}'),
{ ignored: ['**/*.test.*'] },
'**/*.{cjs,js,mjs}',
{ cwd: options.srcPath, ignored: ['**/*.test.*'] },
gulp.parallel(
// Run TypeScript compiler
npm.script('build:types', ['--incremental', '--pretty'], options),
Expand All @@ -70,7 +69,8 @@ export const watch = (options) =>
*/
task.name('compile:js watch', () =>
gulp.watch(
[join(options.srcPath, 'javascripts/**/*.mjs')],
'javascripts/**/*.mjs',
{ cwd: options.srcPath },

// Run JavaScripts compile
scripts(options)
Expand Down
14 changes: 7 additions & 7 deletions packages/govuk-frontend/tasks/assets.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { join } from 'path'

import { files, task } from '@govuk-frontend/tasks'
import { task } from '@govuk-frontend/tasks'
import gulp from 'gulp'

/**
Expand All @@ -11,9 +9,11 @@ import gulp from 'gulp'
export const assets = (options) =>
gulp.series(
task.name('copy:assets', () =>
files.copy('**/*', {
srcPath: join(options.srcPath, 'govuk/assets'),
destPath: join(options.destPath, 'govuk/assets')
})
gulp
.src('govuk/assets/**/*', {
base: options.srcPath,
cwd: options.srcPath
})
.pipe(gulp.dest(options.destPath))
)
)
14 changes: 7 additions & 7 deletions packages/govuk-frontend/tasks/build/package.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { join } from 'path'

import { paths } from '@govuk-frontend/config'
import { files, npm, task } from '@govuk-frontend/tasks'
import { npm, task } from '@govuk-frontend/tasks'
import gulp from 'gulp'

import { assets, fixtures, scripts, styles, templates } from '../index.mjs'
Expand All @@ -25,9 +23,11 @@ export default (options) =>

// Copy GOV.UK Prototype Kit JavaScript
task.name("copy:files 'govuk-prototype-kit'", () =>
files.copy('**/*.js', {
srcPath: join(options.srcPath, 'govuk-prototype-kit'),
destPath: join(options.destPath, 'govuk-prototype-kit')
})
gulp
.src('govuk-prototype-kit/**/*.js', {
base: options.srcPath,
cwd: options.srcPath
})
.pipe(gulp.dest(options.destPath))
)
)
10 changes: 6 additions & 4 deletions packages/govuk-frontend/tasks/build/release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ export default (options) =>

// Copy GOV.UK Frontend static assets
task.name('copy:assets', () =>
files.copy('**/*', {
srcPath: join(options.srcPath, 'govuk/assets'),
destPath: join(options.destPath, 'assets')
})
gulp
.src('govuk/assets/**/*', {
base: join(options.srcPath, 'govuk'),
cwd: options.srcPath
})
.pipe(gulp.dest(options.destPath))
),

// Compile GOV.UK Frontend JavaScript
Expand Down
14 changes: 7 additions & 7 deletions packages/govuk-frontend/tasks/templates.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { join } from 'path'

import { files, task } from '@govuk-frontend/tasks'
import { task } from '@govuk-frontend/tasks'
import gulp from 'gulp'

/**
Expand All @@ -11,9 +9,11 @@ import gulp from 'gulp'
export const templates = (options) =>
gulp.series(
task.name('copy:templates', () =>
files.copy('**/*.{md,njk}', {
srcPath: join(options.srcPath, 'govuk'),
destPath: join(options.destPath, 'govuk')
})
gulp
.src('govuk/**/*.{md,njk}', {
base: options.srcPath,
cwd: options.srcPath
})
.pipe(gulp.dest(options.destPath))
)
)
Loading

0 comments on commit 049d732

Please sign in to comment.