Skip to content

Commit 257019a

Browse files
authored
Merge branch 'dev' into feature/1045--pseudo-twigphp
2 parents 226aa8b + 83a6ad4 commit 257019a

File tree

84 files changed

+2737
-475
lines changed

Some content is hidden

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

84 files changed

+2737
-475
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Thumbs.db
55
.nyc_output/
66
.vscode/
77
.idea/
8+
.env
89
packages/core/test/public
910
packages/*/public
1011
!packages/core/test/patterns/public/.gitkeep

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
"eslint-plugin-prettier": "^3.1.0",
1111
"lerna": "3.11.0",
1212
"prettier": "^1.14.3",
13-
"pretty-quick": "^1.11.1"
13+
"pretty-quick": "^1.11.1",
14+
"auto": "^7.8.0"
15+
},
16+
"repository": {
17+
"type": "git",
18+
"url": "git+https://github.com/pattern-lab/patternlab-node.git"
1419
},
1520
"private": true,
1621
"scripts": {
@@ -22,7 +27,9 @@
2227
"lint:fix": "npm run lint -- --fix",
2328
"lint": "eslint --max-warnings 0 './packages/{core,cli,uikit-workshop}/**/*.js ' --ignore-path .eslintignore",
2429
"test": "lerna run test",
25-
"clean": "git clean -dfx"
30+
"clean": "git clean -dfx",
31+
"publish": "npx lerna publish -m \"[skip travis] chore(release): publish %s\"",
32+
"postpublish": "auto release"
2633
},
2734
"nyc": {
2835
"exclude": [

packages/cli/CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,42 @@
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+
# [1.0.0](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/[email protected]...@pattern-lab/[email protected]) (2019-08-23)
7+
8+
9+
### Bug Fixes
10+
11+
* **cli:** merge config arrays via overwrite instead of concatenate ([42e5f7b](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/42e5f7b))
12+
* **cli:** proper path resolution to helpers ([a18fe5e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/a18fe5e))
13+
14+
15+
### BREAKING CHANGES
16+
17+
* **cli:** previously, we concatenated arrays, which is unlikely to be intended
18+
19+
20+
21+
22+
23+
# [0.1.0](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/[email protected]...@pattern-lab/[email protected]) (2019-08-23)
24+
25+
26+
### Bug Fixes
27+
28+
* updates to fix eslint / prettier issues; update packages/core to reuse root .eslintrc.js file ([5b7a057](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/5b7a057))
29+
* **cli:** add custom install logic to edition-node ([f04fd26](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/f04fd26))
30+
* **cli:** re-order and clarify engines ([e39e301](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/e39e301))
31+
32+
33+
### Features
34+
35+
* **starterkits:** add starterkit-handlebars-demo ([384d2cf](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/384d2cf))
36+
37+
38+
39+
40+
41+
642
## [0.0.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/@pattern-lab/[email protected]...@pattern-lab/[email protected]) (2019-05-16)
743

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

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const writeJsonAsync = require('../utils').writeJsonAsync;
1313

1414
const defaultPatternlabConfig = patternlab.getDefaultConfig();
1515

16+
// https://github.com/TehShrike/deepmerge#overwrite-array
17+
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;
18+
1619
const init = options =>
1720
wrapAsync(function*() {
1821
const sourceDir = 'source';
@@ -52,7 +55,9 @@ const init = options =>
5255
projectDir
5356
); // 3.1
5457
if (newConf) {
55-
patternlabConfig = merge(patternlabConfig, newConf); // 3.2
58+
patternlabConfig = merge(patternlabConfig, newConf, {
59+
arrayMerge: overwriteMerge,
60+
}); // 3.2
5661
}
5762
spinner.succeed(`⊙ patternlab → Installed edition: ${edition}`);
5863
}
@@ -65,7 +70,9 @@ const init = options =>
6570
);
6671
spinner.succeed(`⊙ patternlab → Installed starterkit: ${starterkit}`);
6772
if (starterkitConfig) {
68-
patternlabConfig = merge(patternlabConfig, starterkitConfig);
73+
patternlabConfig = merge(patternlabConfig, starterkitConfig, {
74+
arrayMerge: overwriteMerge,
75+
});
6976
}
7077
} // 4
7178
yield writeJsonAsync(

packages/cli/bin/inquiries/edition.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,15 @@ const editionSetup = [
1515
message: 'Which edition do you want to use (defaults to edition-node)?',
1616
choices: [
1717
{
18-
name: 'edition-twig (php engine)',
19-
value: '@pattern-lab/edition-twig',
20-
},
21-
{
22-
name: 'edition-node',
18+
name: 'edition-node (handlebars engine)',
2319
value: '@pattern-lab/edition-node',
2420
},
2521
{
26-
name: 'edition-node-grunt',
27-
value: '@pattern-lab/edition-node-grunt',
22+
name: 'edition-twig (php engine)',
23+
value: '@pattern-lab/edition-twig',
2824
},
2925
{
30-
name: 'edition-node-gulp',
26+
name: 'edition-node-gulp (legacy)',
3127
value: '@pattern-lab/edition-node-gulp',
3228
},
3329
new inquirer.Separator(),

packages/cli/bin/inquiries/starterkit.js

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,34 @@ const starterkitSetup = [
1010
message: 'Which starterkit do you want to use?',
1111
choices: [
1212
{
13-
name: 'starterkit-mustache-demo',
14-
value: '@pattern-lab/starterkit-mustache-demo',
13+
name: 'starterkit-handlebars-demo [Recommended]',
14+
value: '@pattern-lab/starterkit-handlebars-demo',
1515
},
16+
{
17+
name: 'starterkit-twig-demo [Recommended]',
18+
value: '@pattern-lab/starterkit-twig-demo',
19+
},
1620
{
1721
name: 'starterkit-mustache-bootstrap',
1822
value: 'starterkit-mustache-bootstrap',
19-
},
23+
},
24+
{
25+
name: 'starterkit-mustache-demo',
26+
value: '@pattern-lab/starterkit-mustache-demo',
27+
},
2028
{
2129
name: 'starterkit-mustache-foundation',
2230
value: 'starterkit-mustache-foundation',
23-
},
24-
// {
25-
// name: 'starterkit-twig-base',
26-
// value: 'starterkit-twig-base',
27-
// },
28-
{
29-
name: 'starterkit-twig-demo',
30-
value: '@pattern-lab/starterkit-twig-demo',
31-
},
31+
},
3232
{
3333
name: 'starterkit-mustache-materialdesign',
3434
value: 'starterkit-mustache-materialdesign',
35-
},
36-
// {
37-
// name: 'starterkit-twig-drupal-demo',
38-
// value: 'starterkit-twig-drupal-demo',
39-
// },
40-
// {
41-
// name: 'starterkit-twig-drupal-minimal',
42-
// value: 'starterkit-twig-drupal-minimal',
43-
// },
44-
{
45-
name: 'starterkit-mustache-webdesignday',
46-
value: 'starterkit-mustache-webdesignday',
47-
},
35+
},
4836
{
4937
name: 'starterkit-mustache-base',
5038
value: '@pattern-lab/starterkit-mustache-base',
5139
},
40+
5241
new inquirer.Separator(),
5342
{
5443
name: 'Custom starterkit',
@@ -61,8 +50,8 @@ const starterkitSetup = [
6150
},
6251
],
6352
default: {
64-
name: 'starterkit-mustache-base',
65-
value: 'starterkit-mustache-base',
53+
name: 'starterkit-handlebars-demo',
54+
value: 'starterkit-handlebars-demo',
6655
},
6756
},
6857
{

packages/cli/bin/install-edition.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const {
1212
getJSONKey,
1313
} = require('./utils');
1414

15+
// https://github.com/TehShrike/deepmerge#overwrite-array
16+
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;
17+
1518
const installEdition = (edition, config, projectDir) => {
1619
const pkg = require(path.resolve(projectDir, 'package.json'));
1720

@@ -49,11 +52,26 @@ const installEdition = (edition, config, projectDir) => {
4952
}
5053
// 4.2
5154
case '@pattern-lab/edition-node': {
55+
const editionPath = path.resolve('./node_modules', edition);
56+
const editionConfigPath = path.resolve(
57+
editionPath,
58+
'patternlab-config.json'
59+
);
60+
61+
const editionConfig = require(editionConfigPath);
62+
5263
pkg.scripts = Object.assign(
5364
{},
5465
pkg.scripts || {},
5566
yield getJSONKey(edition, 'scripts')
5667
);
68+
69+
yield copyAsync(
70+
path.join(editionPath, path.sep, 'helpers', path.sep, 'test.js'),
71+
path.resolve(sourceDir, '../', 'helpers/test.js')
72+
);
73+
74+
config = merge(config, editionConfig, { arrayMerge: overwriteMerge });
5775
break;
5876
}
5977
// 4.3
@@ -76,7 +94,7 @@ const installEdition = (edition, config, projectDir) => {
7694
path.resolve(sourceDir, '../', 'alter-twig.php')
7795
);
7896

79-
config = merge(config, editionConfig);
97+
config = merge(config, editionConfig, { arrayMerge: overwriteMerge });
8098
break;
8199
}
82100
}

packages/cli/bin/install-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const installPlugin = (plugin, config) =>
2222
try {
2323
const pluginConfigJSON = require(pluginPathConfig);
2424
if (!_.has(config.plugins[name].options)) {
25-
_.set(config, `plugins[${name}]['options]`, pluginConfigJSON);
25+
_.set(config, `plugins[${name}][options]`, pluginConfigJSON);
2626
}
2727
} catch (ex) {
2828
//a config.json file is not required at this time

packages/cli/bin/install-starterkit.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const installStarterkit = (starterkit, config) =>
1212
wrapAsync(function*() {
1313
const sourceDir = config.paths.source.root;
1414
const name = starterkit.value || starterkit;
15-
const url = name.startsWith('@pattern-lab/') ? name : `pattern-lab/${name}`;
16-
yield checkAndInstallPackage(name, url);
15+
yield checkAndInstallPackage(name);
1716
const kitPath = path.resolve('./node_modules', name);
1817
yield copyAsync(path.resolve(kitPath, 'dist'), path.resolve(sourceDir));
1918
let kitConfig;

packages/cli/bin/utils.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,15 @@ const copyWithPattern = (cwd, pattern, dest) =>
126126
* @func fetchPackage
127127
* @desc Fetches and saves packages from npm into node_modules and adds a reference in the package.json under dependencies
128128
* @param {string} packageName - The package name
129-
* @param {string} [url] - A URL which will be used to fetch the package from
130129
*/
131-
const fetchPackage = (packageName, url) =>
130+
const fetchPackage = packageName =>
132131
wrapAsync(function*() {
133132
const useYarn = hasYarn();
134133
const pm = useYarn ? 'yarn' : 'npm';
135134
const installCmd = useYarn ? 'add' : 'install';
136135
try {
137-
if (packageName || url) {
138-
const cmd = yield spawn(pm, [installCmd, url || packageName]);
136+
if (packageName) {
137+
const cmd = yield spawn(pm, [installCmd, packageName]);
139138
error(cmd.stderr);
140139
}
141140
} catch (err) {
@@ -150,10 +149,9 @@ const fetchPackage = (packageName, url) =>
150149
* @func checkAndInstallPackage
151150
* Checks whether a package for a given packageName is installed locally. If package cannot be found, fetch and install it
152151
* @param {string} packageName - The package name
153-
* @param {string} [url] - A URL which will be used to fetch the package from
154152
* @return {boolean}
155153
*/
156-
const checkAndInstallPackage = (packageName, url) =>
154+
const checkAndInstallPackage = packageName =>
157155
wrapAsync(function*() {
158156
try {
159157
require.resolve(packageName);
@@ -162,7 +160,7 @@ const checkAndInstallPackage = (packageName, url) =>
162160
debug(
163161
`checkAndInstallPackage: ${packageName} not installed. Fetching it now …`
164162
);
165-
yield fetchPackage(packageName, url);
163+
yield fetchPackage(packageName);
166164
return false;
167165
}
168166
});

0 commit comments

Comments
 (0)