Skip to content

Commit 7bf35d9

Browse files
committed
Build: Stop release if issues are find during deployment
Fix webhintio#717
1 parent ff08781 commit 7bf35d9

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

helpers/postinstall.js

+22-18
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,30 @@
22
* Post Install Script
33
* Copies a set of files from the `@hint/artwork` asset repository into this one
44
*/
5-
const shell = require('shelljs');
6-
const mkdirp = require('mkdirp');
5+
try {
6+
const shell = require('shelljs');
7+
const mkdirp = require('mkdirp');
78

8-
const baseSrcPath = 'node_modules/@hint/artwork/src/';
9-
const baseTargetPath = 'src/webhint-theme/source/images/';
9+
const baseSrcPath = 'node_modules/@hint/artwork/src/';
10+
const baseTargetPath = 'src/webhint-theme/source/images/';
1011

11-
const fileSrcAndTargets = {
12-
'other/confused/confused.svg': 'nellie-confused.svg',
13-
'other/developing/developing.svg': 'developer-nellie.svg',
14-
'other/octocat/octocat_1.svg': 'nellie-octocat.svg',
15-
'other/searching/searching.svg': 'nellie-searching.svg',
16-
'other/sunglasses/sunglasses.svg': 'nellie-customizable.svg',
17-
'other/working/working.svg': 'nellie-construction.svg'
18-
};
12+
const fileSrcAndTargets = {
13+
'other/confused/confused.svg': 'nellie-confused.svg',
14+
'other/developing/developing.svg': 'developer-nellie.svg',
15+
'other/octocat/octocat_1.svg': 'nellie-octocat.svg',
16+
'other/searching/searching.svg': 'nellie-searching.svg',
17+
'other/sunglasses/sunglasses.svg': 'nellie-customizable.svg',
18+
'other/working/working.svg': 'nellie-construction.svg'
19+
};
1920

20-
mkdirp.sync(baseTargetPath);
21+
mkdirp.sync(baseTargetPath);
2122

22-
Object.entries(fileSrcAndTargets).forEach((entry) => {
23-
const srcPath = entry[0];
24-
const targetPath = entry[1];
23+
Object.entries(fileSrcAndTargets).forEach((entry) => {
24+
const srcPath = entry[0];
25+
const targetPath = entry[1];
2526

26-
shell.cp(`${baseSrcPath}${srcPath}`, `${baseTargetPath}${targetPath}`);
27-
});
27+
shell.cp(`${baseSrcPath}${srcPath}`, `${baseTargetPath}${targetPath}`);
28+
});
29+
} catch (e) {
30+
console.log(`Couldn't copy images, probably install in "--production" mode`);
31+
}

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@
88
"globby": "^10.0.1",
99
"highlight.js": "^9.15.10",
1010
"js-yaml": "^3.13.1",
11-
"klaw": "^3.0.0",
1211
"lodash": "^4.17.15",
13-
"mkdirp": "^0.5.1",
1412
"moment": "^2.24.0",
1513
"request": "^2.88.0",
16-
"shelljs": "^0.8.3",
1714
"strip-indent": "^3.0.0",
1815
"xss-filters": "^1.2.7"
1916
},
@@ -52,14 +49,17 @@
5249
"hexo-renderer-handlebars": "^2.0.2",
5350
"hexo-server": "^1.0.0",
5451
"hexo-util": "^1.2.0",
52+
"hint": "^5.3.0",
5553
"json2yaml": "^1.1.0",
5654
"markdownlint-cli": "^0.18.0",
5755
"marked": "^0.7.0",
5856
"md-2-json": "^1.0.6",
57+
"mkdirp": "^0.5.1",
5958
"mktemp": "^1.0.0",
6059
"normalize-path": "^3.0.0",
6160
"npm-run-all": "^4.1.3",
6261
"remove-markdown": "^0.3.0",
62+
"shelljs": "^0.8.3",
6363
"stylelint": "^11.0.0",
6464
"sw-precache": "^5.2.1",
6565
"typescript": "^3.6.3",
@@ -89,7 +89,7 @@
8989
"watch": "gulp watch",
9090
"test": "npm run lint && npm run build",
9191
"test-local": "hint http://localhost:8080 --tracking=off",
92-
"test-staging": "hint https://sonarwhal-staging.azurewebsites.net --tracking=on",
92+
"test-staging": "npx hint https://sonarwhal-staging.azurewebsites.net --tracking=on",
9393
"update-site": "node helpers/update-site.js",
9494
"postinstall": "node helpers/postinstall.js"
9595
}

0 commit comments

Comments
 (0)