Skip to content

Commit f4bfcbf

Browse files
Merge pull request #939 from pattern-lab/dev
BETA
2 parents cd1d1e0 + 02ba847 commit f4bfcbf

147 files changed

Lines changed: 3890 additions & 12320 deletions

File tree

Some content is hidden

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

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ This ensures that any changes you've made will still result in a clean and funct
4747
4848
## Coding style
4949
50-
Formatting is automated via [Prettier](https://prettier.io/), setup to run on precommit. We suggest [editor integration](https://prettier.io/docs/en/editors.html) for this and for eslint. Prettier is further configured within `.prettierrc`. Eslint validates syntax and usage that Prettier doesn't handle. Configuration for both is found within the `.eslintrc` file.
50+
Formatting is automated via [Prettier](https://prettier.io/), setup to run on precommit. We suggest [editor integration](https://prettier.io/docs/en/editors.html) for this and for eslint. Prettier is further configured within `.prettierrc`. Eslint validates syntax and usage that Prettier doesn't handle. Configuration for both is found within the `.eslintrc.json` file.
5151
5252
The `.editorconfig` controls spaces / tabs within supported editors. Check out their [site](http://editorconfig.org/).
5353

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
packages/core/scripts/api.handlebars
99
packages/core/scripts/events.handlebars
1010
packages/core/test/files/annotations.js
11+
**/uikit-workshop/src/js/**/*

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ before_install:
44
- phantomjs --version
55

66
before_script:
7-
- npm install -g lerna@3.0.0-beta.21
7+
- npm install -g lerna@3.2.1
88
- npm run bootstrap
9-
- lerna add @pattern-lab/engine-mustache
10-
- lerna add @pattern-lab/engine-handlebars
11-
- lerna add @pattern-lab/engine-underscore
12-
- lerna add @pattern-lab/engine-liquid
13-
- lerna add @pattern-lab/engine-twig
14-
- lerna add @pattern-lab/engine-react
9+
- lerna add @pattern-lab/engine-mustache --scope=@pattern-lab/core
10+
- lerna add @pattern-lab/engine-handlebars --scope=@pattern-lab/core
11+
- lerna add @pattern-lab/engine-underscore --scope=@pattern-lab/core
12+
- lerna add @pattern-lab/engine-liquid --scope=@pattern-lab/core
13+
- lerna add @pattern-lab/engine-twig --scope=@pattern-lab/core
14+
- lerna add @pattern-lab/engine-react --scope=@pattern-lab/core
1515

1616
branches:
1717
only:

lerna.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
{
2-
"lerna": "3.0.0-beta.21",
2+
"lerna": "3.2.1",
33
"packages": [
44
"packages/*"
55
],
66
"version": "independent",
77
"command": {
88
"init": {
99
"exact": true
10+
},
11+
"bootstrap": {
12+
"hoist": [
13+
"tap",
14+
"eslin*",
15+
"husky",
16+
"prettier",
17+
"pretty-quick"
18+
]
19+
},
20+
"publish": {
21+
"allowBranch": "master"
1022
}
1123
},
1224
"npmClientArgs": [

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"devDependencies": {
3-
"lerna": "3.0.0-beta.21"
3+
"lerna": "3.2.1"
44
},
5+
"private": true,
56
"scripts": {
6-
"bootstrap": "lerna bootstrap --hoist tap --hoist eslin* --hoist husky --hoist prettier --hoist pretty-quick",
7+
"bootstrap": "lerna bootstrap",
78
"precommit": "pretty-quick --staged",
89
"prettier": "prettier --config .prettierrc --write ./**/*.js",
9-
"test": "lerna run test"
10+
"test": "lerna run test",
11+
"clean": "git clean -dfx"
1012
},
1113
"nyc": {
1214
"exclude": [

packages/cli/CHANGELOG.md

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,114 +4,85 @@ All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

66
<a name="0.0.1-alpha.23"></a>
7-
## [0.0.1-alpha.23](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.22...@pattern-lab/cli@0.0.1-alpha.23) (2018-07-09)
87

8+
## [0.0.1-alpha.23](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.22...@pattern-lab/cli@0.0.1-alpha.23) (2018-07-09)
99

1010
### Bug Fixes
1111

1212
* **install:** copy dependencies ([1acef87](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/1acef87))
1313

14-
15-
16-
17-
1814
<a name="0.0.1-alpha.22"></a>
15+
1916
## [0.0.1-alpha.22](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.21...@pattern-lab/cli@0.0.1-alpha.22) (2018-07-06)
2017

2118
**Note:** Version bump only for package @pattern-lab/cli
2219

23-
24-
25-
26-
2720
<a name="0.0.1-alpha.21"></a>
28-
## [0.0.1-alpha.21](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.20...@pattern-lab/cli@0.0.1-alpha.21) (2018-07-06)
2921

22+
## [0.0.1-alpha.21](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.20...@pattern-lab/cli@0.0.1-alpha.21) (2018-07-06)
3023

3124
### Bug Fixes
3225

3326
* **install:** add break statements to install edition command ([3b1813c](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3b1813c))
3427
* **install:** use process to find package.json ([200c7cb](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/200c7cb))
3528

36-
3729
### Features
3830

3931
* **package:** add npmrc file ([55f5bc2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/55f5bc2))
4032
* **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/415698e))
4133
* **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/5ab3995))
4234

43-
44-
45-
46-
4735
<a name="0.0.1-alpha.20"></a>
48-
## [0.0.1-alpha.20](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.19...@pattern-lab/cli@0.0.1-alpha.20) (2018-07-05)
4936

37+
## [0.0.1-alpha.20](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.19...@pattern-lab/cli@0.0.1-alpha.20) (2018-07-05)
5038

5139
### Bug Fixes
5240

5341
* **cli:** change whitespace to spaces per standard ([4556fc7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/4556fc7))
5442
* **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))
5543

56-
5744
### Features
5845

5946
* **serve:** change calling method ([3b86a0d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3b86a0d))
6047
* **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/38a01b1))
6148

62-
63-
64-
6549
<a name="0.0.1-alpha.19"></a>
66-
## [0.0.1-alpha.19](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.18...@pattern-lab/cli@0.0.1-alpha.19) (2018-05-19)
6750

51+
## [0.0.1-alpha.19](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.18...@pattern-lab/cli@0.0.1-alpha.19) (2018-05-19)
6852

6953
### Bug Fixes
7054

7155
* **cli:** change line-endings of cli entrypoint ([3fc86c2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3fc86c2))
7256
* **wording:** reconcile Pattern Lab vs PatternLab ([f3d1e0d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/f3d1e0d))
7357

74-
75-
76-
7758
<a name="0.0.1-alpha.18"></a>
78-
## [0.0.1-alpha.18](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.17...@pattern-lab/cli@0.0.1-alpha.18) (2018-05-04)
7959

60+
## [0.0.1-alpha.18](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.17...@pattern-lab/cli@0.0.1-alpha.18) (2018-05-04)
8061

8162
### Bug Fixes
8263

8364
* **version:** use static core method getVersion ([f9dcd4d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/f9dcd4d))
8465

85-
86-
87-
8866
<a name="0.0.1-alpha.17"></a>
89-
## [0.0.1-alpha.17](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.16...@pattern-lab/cli@0.0.1-alpha.17) (2018-05-04)
9067

68+
## [0.0.1-alpha.17](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.16...@pattern-lab/cli@0.0.1-alpha.17) (2018-05-04)
9169

9270
### Bug Fixes
9371

9472
* **package:** update publish config and installation target ([27d2c8f](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/27d2c8f))
9573

96-
97-
98-
9974
<a name="0.0.1-alpha.16"></a>
100-
## [0.0.1-alpha.16](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.15...@pattern-lab/cli@0.0.1-alpha.16) (2018-05-04)
10175

76+
## [0.0.1-alpha.16](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.15...@pattern-lab/cli@0.0.1-alpha.16) (2018-05-04)
10277

10378
### Features
10479

10580
* **API:** standardize v() and version() into a single call ([6309e69](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/6309e69))
10681

107-
10882
### BREAKING CHANGES
10983

11084
* **API:** change `version()` to return a string representation of the version, removing `v()`
11185

112-
113-
114-
11586
<a name="0.0.1-alpha.15"></a>
11687

11788
## [0.0.1-alpha.15](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/cli@0.0.1-alpha.14...@pattern-lab/cli@0.0.1-alpha.15) (2018-03-21)

packages/cli/bin/install-plugin.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
'use strict';
2+
3+
const path = require('path');
4+
25
const _ = require('lodash');
6+
37
const checkAndInstallPackage = require('./utils').checkAndInstallPackage;
48
const wrapAsync = require('./utils').wrapAsync;
59

@@ -8,7 +12,21 @@ const installPlugin = (plugin, config) =>
812
const name = plugin.name || plugin;
913
yield checkAndInstallPackage(name);
1014
// Put the installed plugin in the patternlab-config.json
11-
_.set(config, `plugins[${name}]['enabled']`, false);
15+
_.set(config, `plugins[${name}]['enabled']`, true);
16+
_.set(config, `plugins[${name}]['initialized']`, false);
17+
18+
// Get the options from the plugin, if any
19+
const pluginPathConfig = path.resolve(
20+
path.join(process.cwd(), 'node_modules', name, 'config.json')
21+
);
22+
try {
23+
const pluginConfigJSON = require(pluginPathConfig);
24+
if (!_.has(config.plugins[name].options)) {
25+
_.set(config, `plugins[${name}]['options]`, pluginConfigJSON);
26+
}
27+
} catch (ex) {
28+
//a config.json file is not required at this time
29+
}
1230
return name;
1331
});
1432

packages/cli/bin/patternlab.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22
'use strict';
33
const cli = require('commander');
4+
const path = require('path');
45
const build = require('./cli-actions/build');
56
const disable = require('./cli-actions/disable');
67
const enable = require('./cli-actions/enable');
@@ -42,7 +43,7 @@ cli
4243
'-c, --config <path>',
4344
'Specify config file. Default looks up the project dir',
4445
val => val.trim(),
45-
'./patternlab-config.json'
46+
path.resolve(process.cwd(), 'patternlab-config.json')
4647
)
4748
.option('-v, --verbose', 'Show verbose console logs', verboseLogs)
4849
.option('--silent', 'Turn off console logs', silenceLogs);

packages/cli/bin/utils.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,21 +175,39 @@ const checkAndInstallPackage = (packageName, url) =>
175175
*/
176176
const noop = () => {};
177177

178+
/**
179+
* @func writeJsonAsync
180+
* Wrapper for fs.writeJsonAsync with consistent spacing
181+
* @param {string} filePath
182+
* @param {object} data
183+
*/
184+
const writeJsonAsync = (filePath, data) =>
185+
wrapAsync(function*() {
186+
yield fs.outputJSON(filePath, data, { spaces: 2 });
187+
});
188+
189+
/**
190+
* @func getJSONKey
191+
* Installs package, then returns the value for the given JSON file's key within
192+
* @param {string} packageName - the node_module to install / load
193+
* @param {object} key - the key to find
194+
* @param {object} fileName - the filePath of the JSON
195+
*/
178196
const getJSONKey = (packageName, key, fileName = 'package.json') =>
179197
wrapAsync(function*() {
180198
yield checkAndInstallPackage(packageName);
181-
const packageJSON = yield fs.readJson(
199+
const jsonData = yield fs.readJson(
182200
path.resolve('node_modules', packageName, fileName)
183201
);
184-
return packageJSON[key];
202+
return jsonData[key];
185203
});
186204

187205
module.exports = {
188206
copyWithPattern,
189207
copyAsync: fs.copy,
190208
mkdirsAsync: fs.mkdirs,
191209
moveAsync: fs.move,
192-
writeJsonAsync: fs.outputJson,
210+
writeJsonAsync: writeJsonAsync,
193211
readJsonAsync: fs.readJson,
194212
error,
195213
info,

0 commit comments

Comments
 (0)