Skip to content

Commit ccef0ce

Browse files
Merge pull request #1042 from pattern-lab/edition-install-fix
Edition install fix
2 parents 0c02c73 + 42e5f7b commit ccef0ce

File tree

5 files changed

+15
-75
lines changed

5 files changed

+15
-75
lines changed

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/install-edition.js

Lines changed: 6 additions & 3 deletions
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

@@ -64,11 +67,11 @@ const installEdition = (edition, config, projectDir) => {
6467
);
6568

6669
yield copyAsync(
67-
path.resolve(editionPath, '/helpers/test.js'),
70+
path.join(editionPath, path.sep, 'helpers', path.sep, 'test.js'),
6871
path.resolve(sourceDir, '../', 'helpers/test.js')
6972
);
7073

71-
config = merge(config, editionConfig);
74+
config = merge(config, editionConfig, { arrayMerge: overwriteMerge });
7275
break;
7376
}
7477
// 4.3
@@ -91,7 +94,7 @@ const installEdition = (edition, config, projectDir) => {
9194
path.resolve(sourceDir, '../', 'alter-twig.php')
9295
);
9396

94-
config = merge(config, editionConfig);
97+
config = merge(config, editionConfig, { arrayMerge: overwriteMerge });
9598
break;
9699
}
97100
}

packages/starterkit-handlebars-demo/patternlab-config.json

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)