Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzke committed May 17, 2021
2 parents ce0dedd + 4431c5d commit e536cb2
Show file tree
Hide file tree
Showing 239 changed files with 2,349 additions and 2,087 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [5.14.3](https://github.com/pattern-lab/patternlab-node/compare/v5.14.2...v5.14.3) (2021-05-17)


### Bug Fixes

* **pseudopatterns:** use the template instead of the pseudo data file for template rendering [#1308](https://github.com/pattern-lab/patternlab-node/issues/1308) ([#1312](https://github.com/pattern-lab/patternlab-node/issues/1312)) ([7ecca69](https://github.com/pattern-lab/patternlab-node/commit/7ecca69bcfed4060d17390b76562e5f468b4a897))





## [5.14.2](https://github.com/pattern-lab/patternlab-node/compare/v5.14.1...v5.14.2) (2021-03-28)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "3.11.0",
"version": "5.14.2",
"version": "5.14.3",
"packages": [
"packages/*"
],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
]
},
"dependencies": {
"@auto-it/released": "^9.40.5",
"@babel/plugin-proposal-decorators": "^7.13.5",
"@babel/plugin-syntax-jsx": "^7.12.13",
"auto": "^9.40.5",
"babel-eslint": "^10.0.2",
"eslint": "^6.1.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-prettier": "^3.1.0",
"lerna": "3.17.0",
"auto": "^9.40.5",
"@auto-it/released": "^9.40.5",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.0.0
12.12.0
9 changes: 9 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [5.14.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/v5.14.2...v5.14.3) (2021-05-17)

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






## [5.14.2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/compare/v5.14.1...v5.14.2) (2021-03-28)

**Note:** Version bump only for package @pattern-lab/cli
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/bin/archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function exportPatterns(config) {
);
});

archive.on('error', function(err) {
archive.on('error', function (err) {
throw new TypeError(
`export: An error occured during zipping the patterns: ${err}`
);
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/bin/ask.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const ask = inquirer.prompt;
* @param {object} options - Options passed in from CLI
* @param {boolean} options.force - Flag whether to force install in existing project directory. May overwrite stuff.
*/
const init = options =>
wrapsAsync(function*() {
const init = (options) =>
wrapsAsync(function* () {
/**
* @property {string} project_root="./" - Path to the project root directory
* @property {string|Symbol} edition - The name of the edition npm package or a Symbol for no install
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/bin/cli-actions/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const buildPatterns = require('../build');
const resolveConfig = require('../resolve-config');
const { error, info, wrapAsync } = require('../utils');

const build = options =>
wrapAsync(function*() {
const build = (options) =>
wrapAsync(function* () {
try {
const config = yield resolveConfig(options.parent.config);
yield buildPatterns(config, options);
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/bin/cli-actions/disable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const writeJsonAsync = require('../utils').writeJsonAsync;
* @desc Handles deactivation of starterkits/plugins
* @param {object} options
*/
const enable = options =>
wrapAsync(function*() {
const enable = (options) =>
wrapAsync(function* () {
const {
parent: { config: configPath },
plugins,
Expand All @@ -24,7 +24,7 @@ const enable = options =>
spinner.succeed(
`⊙ patternlab → Disable following plugins: ${plugins.join(', ')}`
);
plugins.map(plugin => {
plugins.map((plugin) => {
if (_.has(config, `plugins[${plugin}]`)) {
_.set(config, `plugins[${plugin}]['enabled']`, false);
spinner.succeed(
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/bin/cli-actions/enable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const writeJsonAsync = require('../utils').writeJsonAsync;
* @desc Handles activation of starterkits/plugins
* @param {object} options
*/
const enable = options =>
wrapAsync(function*() {
const enable = (options) =>
wrapAsync(function* () {
const {
parent: { config: configPath },
plugins,
Expand All @@ -24,7 +24,7 @@ const enable = options =>
spinner.succeed(
`⊙ patternlab → Enable following plugins: ${plugins.join(', ')}`
);
plugins.map(plugin => {
plugins.map((plugin) => {
if (_.has(config, `plugins[${plugin}]`)) {
_.set(config, `plugins[${plugin}]['enabled']`, true);
spinner.succeed(`⊙ patternlab → Enabled following plugin: ${plugin}`);
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/bin/cli-actions/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const archive = require('../archive');
const resolveConfig = require('../resolve-config');
const wrapAsync = require('../utils').wrapAsync;

const _export = options =>
wrapAsync(function*() {
const _export = (options) =>
wrapAsync(function* () {
const config = yield resolveConfig(options.parent.config);
archive(config);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/bin/cli-actions/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const defaultPatternlabConfig = patternlab.getDefaultConfig();
// https://github.com/TehShrike/deepmerge#overwrite-array
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;

const init = options =>
wrapAsync(function*() {
const init = (options) =>
wrapAsync(function* () {
const sourceDir = 'source';
const publicDir = 'public';
const exportDir = 'pattern_exports';
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/bin/cli-actions/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const writeJsonAsync = require('../utils').writeJsonAsync;
* @desc Handles async install and activation of starterkits/plugins
* @param {object} options
*/
const install = options =>
wrapAsync(function*() {
const install = (options) =>
wrapAsync(function* () {
const config = yield resolveConfig(options.parent.config);

const spinner = ora(
Expand All @@ -21,8 +21,8 @@ const install = options =>

if (options.starterkits && Array.isArray(options.starterkits)) {
const starterkits = yield Promise.all(
options.starterkits.map(starterkit =>
wrapAsync(function*() {
options.starterkits.map((starterkit) =>
wrapAsync(function* () {
spinner.text = `⊙ patternlab → Installing starterkit: ${starterkit}`;
return yield installStarterkit(
{
Expand All @@ -42,8 +42,8 @@ const install = options =>
}
if (options.plugins && Array.isArray(options.plugins)) {
const plugins = yield Promise.all(
options.plugins.map(plugin =>
wrapAsync(function*() {
options.plugins.map((plugin) =>
wrapAsync(function* () {
return yield installPlugin(
{
name: plugin,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/bin/cli-actions/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const resolveConfig = require('../resolve-config');
const servePatterns = require('../serve');
const wrapAsync = require('../utils').wrapAsync;

const serve = options =>
wrapAsync(function*() {
const serve = (options) =>
wrapAsync(function* () {
const config = yield resolveConfig(options.parent.config);
servePatterns(config, options);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/bin/inquiries/edition.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const editionSetup = [
value: false,
},
],
default: function() {
default: function () {
return {
name: 'Handlebars',
value: '@pattern-lab/edition-node',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/bin/install-edition.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;
const installEdition = (edition, config, projectDir) => {
const pkg = require(path.resolve(projectDir, 'package.json'));

return wrapAsync(function*() {
return wrapAsync(function* () {
/**
* 1. Trigger edition install
* 2. Copy over the mandatory edition files to sourceDir
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/bin/install-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { checkAndInstallPackage, wrapAsync } = require('./utils');
const { resolveFileInPackage } = require('@pattern-lab/core/src/lib/resolver');

const installPlugin = (plugin, config) =>
wrapAsync(function*() {
wrapAsync(function* () {
const name = plugin.name || plugin;
yield checkAndInstallPackage(name);
// Put the installed plugin in the patternlab-config.json
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/bin/install-starterkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {
} = require('@pattern-lab/core/src/lib/resolver');

const installStarterkit = (starterkit, config) =>
wrapAsync(function*() {
wrapAsync(function* () {
const sourceDir = config.paths.source.root;
const name = starterkit.value || starterkit;
yield checkAndInstallPackage(name);
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/bin/patternlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const { error, log } = require('./utils');
const pkg = require('../package.json');

// Register info and error logging
log.on('patternlab.error', err => console.log(err)); // eslint-disable-line
log.on('patternlab.info', msg => console.log(msg)); // eslint-disable-line
log.on('patternlab.error', (err) => console.log(err)); // eslint-disable-line
log.on('patternlab.info', (msg) => console.log(msg)); // eslint-disable-line

// Conditionally register verbose logging
const verboseLogs = () => log.on('patternlab.debug', msg => console.log(msg)); // eslint-disable-line
const verboseLogs = () => log.on('patternlab.debug', (msg) => console.log(msg)); // eslint-disable-line

// Conditionally unregister all logging
const silenceLogs = () => {
Expand All @@ -30,7 +30,7 @@ const silenceLogs = () => {
};

// Split strings into an array
const list = val => val.split(',');
const list = (val) => val.split(',');

/**
* Hook up cli version, usage and options
Expand All @@ -42,7 +42,7 @@ cli
.option(
'-c, --config <path>',
'Specify config file. Default looks up the project dir',
val => val.trim(),
(val) => val.trim(),
path.resolve(process.cwd(), 'patternlab-config.json')
)
.option('-v, --verbose', 'Show verbose console logs', verboseLogs)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/bin/resolve-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const wrapAsync = require('./utils').wrapAsync;
* @return {object|boolean} Returns the config object or false otherwise.
*/
function resolveConfig(configPath) {
return wrapAsync(function*() {
return wrapAsync(function* () {
if (typeof configPath !== 'string') {
error(
'resolveConfig: If configPath is set, it is expected to be of type string.'
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/bin/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const mkdirsAsync = require('./utils').mkdirsAsync;
* @return {void}
*/
const scaffold = (projectDir, sourceDir, publicDir, exportDir) =>
wrapAsync(function*() {
wrapAsync(function* () {
const projectPath = path.join(process.cwd(), projectDir);
if (!fs.existsSync(path.join(projectPath, 'package.json'))) {
execa.sync('npm', ['init', '-y'], {
Expand Down
22 changes: 10 additions & 12 deletions packages/cli/bin/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const error = log.error.bind(log);
* @desc Wraps an generator function to yield out promisified stuff
* @param {function} fn - Takes a generator function
*/
const wrapAsync = fn =>
const wrapAsync = (fn) =>
new Promise((resolve, reject) => {
const generator = fn();
/* eslint-disable */
Expand All @@ -84,9 +84,7 @@ const wrapAsync = fn =>
if (res.done) {
return resolve(v);
}
Promise.resolve(v)
.then(spwn)
.catch(spwn);
Promise.resolve(v).then(spwn).catch(spwn);
})();
/* eslint-enable */
});
Expand Down Expand Up @@ -114,13 +112,13 @@ const asyncGlob = (pattern, opts) =>
* @return {Promise}
*/
const copyWithPattern = (cwd, pattern, dest) =>
wrapAsync(function*() {
wrapAsync(function* () {
const files = yield asyncGlob(pattern, { cwd: cwd });
if (files.length === 0) {
debug('copy: Nothing to copy');
}
// Copy concurrently
const promises = files.map(file =>
const promises = files.map((file) =>
fs.copy(path.join(cwd, file), path.join(dest, file))
);
return yield Promise.all(promises);
Expand All @@ -131,8 +129,8 @@ const copyWithPattern = (cwd, pattern, dest) =>
* @desc Fetches packages from an npm package registry and adds a reference in the package.json under dependencies
* @param {string} packageName - The package name
*/
const fetchPackage = packageName =>
wrapAsync(function*() {
const fetchPackage = (packageName) =>
wrapAsync(function* () {
const useYarn = hasYarn();
const pm = useYarn ? 'yarn' : 'npm';
const installCmd = useYarn ? 'add' : 'install';
Expand All @@ -159,8 +157,8 @@ const fetchPackage = packageName =>
* @param {string} packageName - The package name
* @return {boolean}
*/
const checkAndInstallPackage = packageName =>
wrapAsync(function*() {
const checkAndInstallPackage = (packageName) =>
wrapAsync(function* () {
try {
resolvePackageFolder(packageName);
return true;
Expand All @@ -186,7 +184,7 @@ const noop = () => {};
* @param {object} data
*/
const writeJsonAsync = (filePath, data) =>
wrapAsync(function*() {
wrapAsync(function* () {
yield fs.outputJSON(filePath, data, { spaces: 2 });
});

Expand All @@ -198,7 +196,7 @@ const writeJsonAsync = (filePath, data) =>
* @param {object} fileName - the filePath of the JSON
*/
const getJSONKey = (packageName, key, fileName = 'package.json') =>
wrapAsync(function*() {
wrapAsync(function* () {
yield checkAndInstallPackage(packageName);
const jsonData = yield fs.readJson(
resolveFileInPackage(packageName, fileName)
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@pattern-lab/cli",
"description": "Command-line interface (CLI) for the @pattern-lab/core.",
"version": "5.14.2",
"version": "5.14.3",
"bin": {
"patternlab": "bin/patternlab.js"
},
"author": {
"name": "Patternlab contributors"
},
"dependencies": {
"@pattern-lab/core": "^5.14.2",
"@pattern-lab/live-server": "^5.14.2",
"@pattern-lab/core": "^5.14.3",
"@pattern-lab/live-server": "^5.14.3",
"@pattern-lab/starterkit-mustache-base": "3.0.3",
"archiver": "2.1.1",
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const build = proxyquire('../bin/build', {
});
const opts = { patternsOnly: true };

tap.test('Build ->', t => {
tap.test('Build ->', (t) => {
t.throws(
() => {
build();
Expand Down
Loading

0 comments on commit e536cb2

Please sign in to comment.