|
2 | 2 | * Post Install Script
|
3 | 3 | * Copies a set of files from the `@hint/artwork` asset repository into this one
|
4 | 4 | */
|
5 |
| -const shell = require('shelljs'); |
6 |
| -const mkdirp = require('mkdirp'); |
| 5 | +try { |
| 6 | + const shell = require('shelljs'); |
| 7 | + const mkdirp = require('mkdirp'); |
7 | 8 |
|
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/'; |
10 | 11 |
|
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 | + }; |
19 | 20 |
|
20 |
| -mkdirp.sync(baseTargetPath); |
| 21 | + mkdirp.sync(baseTargetPath); |
21 | 22 |
|
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]; |
25 | 26 |
|
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 | +} |
0 commit comments