Skip to content

Commit be68cff

Browse files
committed
Merge branch 'dev' into plugin-work
2 parents 88cce3f + 2b70ff4 commit be68cff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+566
-47632
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ packages/*/public
1010
!packages/core/test/patterns/public/.gitkeep
1111
!packages/core/test/patterns/testDependencyGraph.json
1212
lerna-debug.log
13+
packages/edition-node-gulp/dependencyGraph.json

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ before_install:
44
- phantomjs --version
55

66
before_script:
7-
- npm install -g lerna@2.9.0
7+
- npm install -g lerna@3.0.0-beta.21
88
- npm run bootstrap
99
- lerna add @pattern-lab/engine-mustache
1010
- lerna add @pattern-lab/engine-handlebars

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ The below assume a new directory and project is required.
3232
```bash
3333
mkdir new-project
3434
cd new-project
35-
npm init -y && npx -p @pattern-lab/cli -c 'patternlab init'
35+
npm init -y && npx @pattern-lab/cli -c patternlab init
3636
```
3737
> If you get an error stating that `npx` is not installed, ensure you are on `npm 5.2.0` or later by running `npm -v` or install it globally with `npm install -g npx`. [Learn more about npx.](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b)
3838
1. Follow the on-screen prompts to choose your Edition and a Starterkit should you want one.
39+
1. Run `npm install` one last time to ensure any transient packages from the CLI are installed.
3940
1. Open `package.json` and add the following to your `scripts` object
4041
```diff
4142
"scripts": {

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lerna": "2.9.0",
2+
"lerna": "3.0.0-beta.21",
33
"packages": [
44
"packages/*"
55
],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"devDependencies": {
3-
"lerna": "2.9.0"
3+
"lerna": "3.0.0-beta.21"
44
},
55
"scripts": {
66
"bootstrap": "lerna bootstrap --hoist tap --hoist eslin* --hoist husky --hoist prettier --hoist pretty-quick",

packages/cli/.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package-lock=false
2+
save-exact=true

packages/cli/CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,41 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
<a name="0.0.1-alpha.22"></a>
7+
8+
## [0.0.1-alpha.22](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/[email protected]...@pattern-lab/[email protected]) (2018-07-06)
9+
10+
**Note:** Version bump only for package @pattern-lab/cli
11+
12+
<a name="0.0.1-alpha.21"></a>
13+
14+
## [0.0.1-alpha.21](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/[email protected]...@pattern-lab/[email protected]) (2018-07-06)
15+
16+
### Bug Fixes
17+
18+
* **install:** add break statements to install edition command ([3b1813c](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3b1813c))
19+
* **install:** use process to find package.json ([200c7cb](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/200c7cb))
20+
21+
### Features
22+
23+
* **package:** add npmrc file ([55f5bc2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/55f5bc2))
24+
* **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/415698e))
25+
* **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/5ab3995))
26+
27+
<a name="0.0.1-alpha.20"></a>
28+
29+
## [0.0.1-alpha.20](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/[email protected]...@pattern-lab/[email protected]) (2018-07-05)
30+
31+
### Bug Fixes
32+
33+
* **cli:** change whitespace to spaces per standard ([4556fc7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/4556fc7))
34+
* **tests:** change test command name similar to live-server until this passes CI ([5c39be1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/5c39be1))
35+
36+
### Features
37+
38+
* **serve:** change calling method ([3b86a0d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3b86a0d))
39+
* **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/38a01b1))
40+
641
<a name="0.0.1-alpha.19"></a>
742

843
## [0.0.1-alpha.19](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/[email protected]...@pattern-lab/[email protected]) (2018-05-19)

packages/cli/bin/cli-actions/init.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ const init = options =>
4545

4646
if (edition) {
4747
spinner.text = `⊙ patternlab → Installing edition: ${edition}`;
48-
const newConf = yield installEdition(edition, patternlabConfig); // 3.1
48+
const newConf = yield installEdition(
49+
edition,
50+
patternlabConfig,
51+
projectDir
52+
); // 3.1
4953
patternlabConfig = Object.assign(patternlabConfig, newConf); // 3.2
5054
spinner.succeed(`⊙ patternlab → Installed edition: ${edition}`);
5155
}

packages/cli/bin/install-edition.js

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,63 @@
11
'use strict';
2+
23
const path = require('path');
3-
const pkg = require('../package.json');
4+
const EOL = require('os').EOL;
45
const {
56
checkAndInstallPackage,
67
copyAsync,
78
wrapAsync,
89
writeJsonAsync,
10+
getJSONKey,
911
} = require('./utils');
1012

11-
const installEdition = (edition, config) =>
12-
wrapAsync(function*() {
13+
const installEdition = (edition, config, projectDir) => {
14+
const pkg = require(path.resolve(projectDir, 'package.json'));
15+
16+
return wrapAsync(function*() {
1317
/**
1418
* 1. Trigger edition install
1519
* 2. Copy over the mandatory edition files to sourceDir
16-
* 3. Do custom post-install procedures for different core editions:
17-
* 3.1 Copy gulpfile.js for edition-node-gulp
20+
* 3. Copy dependencies defined in edition
21+
* 4. Do custom post-install procedures for different core editions:
22+
* 4.1 Copy gulpfile.js for edition-node-gulp
23+
* 4.2 Copy scripts for edition-node
1824
*/
1925
const sourceDir = config.paths.source.root;
2026
yield checkAndInstallPackage(edition); // 1
2127
yield copyAsync(
2228
path.resolve('./node_modules', edition, 'source', '_meta'),
2329
path.resolve(sourceDir, '_meta')
2430
); // 2
25-
switch (edition) { // 3
26-
// 3.1
31+
pkg.dependencies = Object.assign(
32+
{},
33+
pkg.dependencies || {},
34+
yield getJSONKey(edition, 'dependencies')
35+
); // 3
36+
switch (edition) { // 4
37+
// 4.1
2738
case '@pattern-lab/edition-node-gulp': {
2839
yield copyAsync(
2940
path.resolve('./node_modules', edition, 'gulpfile.js'),
3041
path.resolve(sourceDir, '../', 'gulpfile.js')
3142
);
43+
break;
3244
}
45+
// 4.2
3346
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 });
47+
pkg.scripts = Object.assign(
48+
{},
49+
pkg.scripts || {},
50+
yield getJSONKey(edition, 'scripts')
51+
);
52+
break;
4353
}
4454
}
55+
yield writeJsonAsync(path.resolve(projectDir, 'package.json'), pkg, {
56+
spaces: 2,
57+
EOL: EOL,
58+
});
4559
return config;
4660
});
61+
};
4762

4863
module.exports = installEdition;

0 commit comments

Comments
 (0)