Skip to content

Commit d42aa45

Browse files
Merge pull request #867 from pattern-lab/issue/863-cli-edition-scripts
Adding edition scripts to package.json after installing edition
2 parents 29b8cd0 + 967de56 commit d42aa45

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

packages/cli/bin/install-edition.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
'use strict';
22
const path = require('path');
3-
const checkAndInstallPackage = require('./utils').checkAndInstallPackage;
4-
const copyAsync = require('./utils').copyAsync;
5-
const wrapAsync = require('./utils').wrapAsync;
3+
const pkg = require('../package.json');
4+
const {
5+
checkAndInstallPackage,
6+
copyAsync,
7+
wrapAsync,
8+
writeJsonAsync,
9+
} = require('./utils');
610

711
const installEdition = (edition, config) =>
812
wrapAsync(function*() {
@@ -26,6 +30,17 @@ const installEdition = (edition, config) =>
2630
path.resolve(sourceDir, '../', 'gulpfile.js')
2731
);
2832
}
33+
case '@pattern-lab/edition-node': {
34+
const scriptsJSON = {
35+
'pl:build': 'patternlab build --config ./patternlab-config.json',
36+
'pl:help': 'patternlab --help',
37+
'pl:install': 'patternlab install --config ./patternlab-config.json',
38+
'pl:serve': 'patternlab serve --config ./patternlab-config.json',
39+
'pl:version': 'patternlab --version',
40+
};
41+
pkg.scripts = Object.assign({}, pkg.scripts || {}, scriptsJSON);
42+
yield writeJsonAsync('./package.json', pkg, { spaces: 2 });
43+
}
2944
}
3045
return config;
3146
});

0 commit comments

Comments
 (0)