Skip to content

Commit 1e51849

Browse files
Merge branch 'dev' into 1180-deprecate-pattern-parameters
2 parents c10247c + 31891cb commit 1e51849

File tree

15 files changed

+40
-60
lines changed

15 files changed

+40
-60
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { error, info, wrapAsync } = require('../utils');
66
const build = (options) =>
77
wrapAsync(function* () {
88
try {
9-
const config = yield resolveConfig(options.parent.config);
9+
const config = yield resolveConfig(options.config);
1010
yield buildPatterns(config, options);
1111
info(`build: Yay, your Pattern Lab project was successfully built ☺`);
1212
} catch (err) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const enable = (options) =>
3535
}
3636
});
3737
}
38-
yield writeJsonAsync(options.parent.config, config);
38+
yield writeJsonAsync(options.config, config);
3939
spinner.succeed(`⊙ patternlab → Updated config`);
4040
});
4141

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const enable = (options) =>
3333
}
3434
});
3535
}
36-
yield writeJsonAsync(options.parent.config, config);
36+
yield writeJsonAsync(options.config, config);
3737
spinner.succeed(`⊙ patternlab → Updated config`);
3838
});
3939

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const wrapAsync = require('../utils').wrapAsync;
55

66
const _export = (options) =>
77
wrapAsync(function* () {
8-
const config = yield resolveConfig(options.parent.config);
8+
const config = yield resolveConfig(options.config);
99
archive(config);
1010
});
1111

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module.exports = () => {
33
/* eslint-disable */
44
console.log(`
55
Examples:
6-
$ patternlab init # Initialize a Pattern Lab project.');
7-
$ patternlab <cmd> # Builds Pattern Lab from the current dir');
8-
$ patternlab <cmd> --config <path/to/patternlab-config> # Pattern Lab from a config in a specified directory');`);
6+
$ patternlab init # Initialize a Pattern Lab project
7+
$ patternlab <cmd> # Builds Pattern Lab from the current dir
8+
$ patternlab <cmd> --config <path/to/patternlab-config> # Pattern Lab from a config in a specified directory`);
99
/* eslint-enable */
1010
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const writeJsonAsync = require('../utils').writeJsonAsync;
1313
*/
1414
const install = (options) =>
1515
wrapAsync(function* () {
16-
const config = yield resolveConfig(options.parent.config);
16+
const config = yield resolveConfig(options.config);
1717

1818
const spinner = ora(
1919
`⊙ patternlab → Installing additional resources …`
@@ -58,7 +58,7 @@ const install = (options) =>
5858
`⊙ patternlab → Installed following plugins: ${plugins.join(', ')}`
5959
);
6060
}
61-
yield writeJsonAsync(options.parent.config, config);
61+
yield writeJsonAsync(options.config, config);
6262
spinner.succeed(`⊙ patternlab → Updated config`);
6363
});
6464

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const wrapAsync = require('../utils').wrapAsync;
55

66
const serve = (options) =>
77
wrapAsync(function* () {
8-
const config = yield resolveConfig(options.parent.config);
8+
const config = yield resolveConfig(options.config);
99
servePatterns(config, options);
1010
});
1111

packages/cli/bin/patternlab.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env node
22
/* eslint-disable no-unused-vars */
33
'use strict';
4-
const cli = require('commander');
4+
const { Command } = require('commander');
5+
const cli = new Command();
56
const path = require('path');
67
const build = require('./cli-actions/build');
78
const disable = require('./cli-actions/disable');
@@ -38,15 +39,7 @@ const list = (val) => val.split(',');
3839
cli
3940
.version(version(pkg), '-V, --version')
4041
.usage('<cmd> [options]')
41-
.arguments('<cmd> [options]')
42-
.option(
43-
'-c, --config <path>',
44-
'Specify config file. Default looks up the project dir',
45-
(val) => val.trim(),
46-
path.resolve(process.cwd(), 'patternlab-config.json')
47-
)
48-
.option('-v, --verbose', 'Show verbose console logs', verboseLogs)
49-
.option('--silent', 'Turn off console logs', silenceLogs);
42+
.arguments('<cmd> [options]');
5043

5144
/**
5245
* build
@@ -134,6 +127,20 @@ cli
134127
.option('--no-watch', 'Start watching for changes')
135128
.action(serve);
136129

130+
// Common options can be added manually after setting up program and subcommands.
131+
// If the options are unsorted in the help, these will appear last.
132+
cli.commands.forEach((command) => {
133+
command
134+
.option(
135+
'-c, --config <path>',
136+
'Specify config file. Default looks up the project dir',
137+
(val) => val.trim(),
138+
path.resolve(process.cwd(), 'patternlab-config.json')
139+
)
140+
.option('-v, --verbose', 'Show verbose console logs', verboseLogs)
141+
.option('--silent', 'Turn off console logs', silenceLogs);
142+
});
143+
137144
// Show additional help
138145
cli.on('--help', help);
139146

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@pattern-lab/core": "^5.17.0",
1313
"archiver": "5.3.0",
1414
"chalk": "4.1.0",
15-
"commander": "6.2.1",
15+
"commander": "9.4.1",
1616
"deepmerge": "^4.2.2",
1717
"execa": "5.0.0",
1818
"fs-extra": "10.0.0",

packages/edition-node/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This Edition uses [Node](https://nodejs.org) for core processing and [npm](https
2424

2525
## Installing
2626

27-
Pattern Lab Node can be used different ways. Editions lilke this one are **example** pairings of Pattern Lab code and do not always have an upgrade path or simple means to run as a dependency within a larger project. Users wishing to be most current and have the greatest flexibility are encouraged to consume `core` directly. Users wanting to learn more about Pattern Lab and have a tailored default experience are encouraged to start with an Edition. Both methods still expect to interact with other elements of the [Pattern Lab Ecosystem](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core#ecosystem).
27+
The Pattern Lab Node can be used in different ways. Editions like this one are **example** pairings of Pattern Lab code and do not always have an upgrade path or simple means to run as a dependency within a larger project. Users wishing to be most current and have the greatest flexibility are encouraged to consume `core` directly. Users wanting to learn more about Pattern Lab and have a tailored default experience are encouraged to start with an edition. Both methods still expect to interact with other elements of the [Pattern Lab Ecosystem](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core#ecosystem).
2828

2929
Read the [installation instructions](https://github.com/pattern-lab/patternlab-node/tree/master#installation).
3030

0 commit comments

Comments
 (0)