forked from digital-land/digital-land.info
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage-scripts.js
32 lines (25 loc) · 1.1 KB
/
package-scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const fs = require('fs')
let scripts = {}
function readJsonFile (filePath) {
return JSON.parse(fs.readFileSync(filePath, 'utf8'))
}
let configPaths = require('./default.paths.json')
const optionalConfigPath = 'digital-land-frontend.config.json'
if (fs.existsSync(optionalConfigPath)) {
configPaths = {
...configPaths,
...readJsonFile(optionalConfigPath)
}
}
scripts.build = {
stylesheets: `npx node-sass ${configPaths.scssPath} -o ${configPaths.stylesheetsOutputPath} --include-path ${configPaths.govukFrontendPath} --include-path ${configPaths.digitalLandFrontendPath}`,
}
scripts.copy = {
govukAssets: `npx copyfiles -u 2 "${configPaths.govukFrontendPath}govuk/assets/**" ${configPaths.govukOutputPath}`
}
scripts.watch = {
pages: `npx browser-sync start --proxy ${configPaths.serverURL} --files ${configPaths.templatesPath} ${configPaths.staticFilesPath}`,
assets: `npx chokidar ${configPaths.watchPaths} -c "npm run nps build.javascripts && npm run nps build.stylesheets"`,
stylesheets: `npx chokidar ${configPaths.watchPaths} -c "npm run nps build.stylesheets"`,
}
module.exports = { scripts }