diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 3453506e1..8f26582b4 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -4,102 +4,77 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + ## [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) **Note:** Version bump only for package @pattern-lab/cli - - - - -## [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) +## [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) ### Bug Fixes * **install:** add break statements to install edition command ([3b1813c](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3b1813c)) * **install:** use process to find package.json ([200c7cb](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/200c7cb)) - ### Features * **package:** add npmrc file ([55f5bc2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/55f5bc2)) * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/5ab3995)) - - - - -## [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) +## [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) ### Bug Fixes * **cli:** change whitespace to spaces per standard ([4556fc7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/4556fc7)) * **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)) - ### Features * **serve:** change calling method ([3b86a0d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3b86a0d)) * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/38a01b1)) - - - -## [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) +## [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) ### Bug Fixes * **cli:** change line-endings of cli entrypoint ([3fc86c2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/3fc86c2)) * **wording:** reconcile Pattern Lab vs PatternLab ([f3d1e0d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/f3d1e0d)) - - - -## [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) +## [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) ### Bug Fixes * **version:** use static core method getVersion ([f9dcd4d](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/f9dcd4d)) - - - -## [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) +## [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) ### Bug Fixes * **package:** update publish config and installation target ([27d2c8f](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/27d2c8f)) - - - -## [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) +## [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) ### Features * **API:** standardize v() and version() into a single call ([6309e69](https://github.com/pattern-lab/patternlab-node/tree/master/packages/cli/commit/6309e69)) - ### BREAKING CHANGES * **API:** change `version()` to return a string representation of the version, removing `v()` - - - ## [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) diff --git a/packages/cli/bin/install-plugin.js b/packages/cli/bin/install-plugin.js index b90ed1c1c..42ea84c63 100644 --- a/packages/cli/bin/install-plugin.js +++ b/packages/cli/bin/install-plugin.js @@ -1,5 +1,9 @@ 'use strict'; + +const path = require('path'); + const _ = require('lodash'); + const checkAndInstallPackage = require('./utils').checkAndInstallPackage; const wrapAsync = require('./utils').wrapAsync; @@ -8,7 +12,21 @@ const installPlugin = (plugin, config) => const name = plugin.name || plugin; yield checkAndInstallPackage(name); // Put the installed plugin in the patternlab-config.json - _.set(config, `plugins[${name}]['enabled']`, false); + _.set(config, `plugins[${name}]['enabled']`, true); + _.set(config, `plugins[${name}]['initialized']`, false); + + // Get the options from the plugin, if any + const pluginPathConfig = path.resolve( + path.join(process.cwd(), 'node_modules', name, 'config.json') + ); + try { + const pluginConfigJSON = require(pluginPathConfig); + if (!_.has(config.plugins[name].options)) { + _.set(config, `plugins[${name}]['options]`, pluginConfigJSON); + } + } catch (ex) { + //a config.json file is not required at this time + } return name; }); diff --git a/packages/cli/bin/patternlab.js b/packages/cli/bin/patternlab.js index 0f05a61df..8800dd2fd 100755 --- a/packages/cli/bin/patternlab.js +++ b/packages/cli/bin/patternlab.js @@ -1,6 +1,7 @@ #!/usr/bin/env node 'use strict'; const cli = require('commander'); +const path = require('path'); const build = require('./cli-actions/build'); const disable = require('./cli-actions/disable'); const enable = require('./cli-actions/enable'); @@ -42,7 +43,7 @@ cli '-c, --config ', 'Specify config file. Default looks up the project dir', val => val.trim(), - './patternlab-config.json' + path.resolve(process.cwd(), 'patternlab-config.json') ) .option('-v, --verbose', 'Show verbose console logs', verboseLogs) .option('--silent', 'Turn off console logs', silenceLogs); diff --git a/packages/cli/bin/utils.js b/packages/cli/bin/utils.js index 0699bff36..aae408bbb 100644 --- a/packages/cli/bin/utils.js +++ b/packages/cli/bin/utils.js @@ -175,13 +175,31 @@ const checkAndInstallPackage = (packageName, url) => */ const noop = () => {}; +/** + * @func writeJsonAsync + * Wrapper for fs.writeJsonAsync with consistent spacing + * @param {string} filePath + * @param {object} data + */ +const writeJsonAsync = (filePath, data) => + wrapAsync(function*() { + yield fs.outputJSON(filePath, data, { spaces: 2 }); + }); + +/** + * @func getJSONKey + * Installs package, then returns the value for the given JSON file's key within + * @param {string} packageName - the node_module to install / load + * @param {object} key - the key to find + * @param {object} fileName - the filePath of the JSON + */ const getJSONKey = (packageName, key, fileName = 'package.json') => wrapAsync(function*() { yield checkAndInstallPackage(packageName); - const packageJSON = yield fs.readJson( + const jsonData = yield fs.readJson( path.resolve('node_modules', packageName, fileName) ); - return packageJSON[key]; + return jsonData[key]; }); module.exports = { @@ -189,7 +207,7 @@ module.exports = { copyAsync: fs.copy, mkdirsAsync: fs.mkdirs, moveAsync: fs.move, - writeJsonAsync: fs.outputJson, + writeJsonAsync: writeJsonAsync, readJsonAsync: fs.readJson, error, info, diff --git a/packages/cli/test/cli-init.test.js b/packages/cli/test/cli-init.test.js index cafcdb163..a80c031ff 100644 --- a/packages/cli/test/cli-init.test.js +++ b/packages/cli/test/cli-init.test.js @@ -8,31 +8,31 @@ const wrapAsync = require('../bin/utils').wrapAsync; const projectRoot = getUniqueProjectPath(); tap.test('Init ->', t => - wrapAsync(function*() { - yield spawnCmd([ - 'init', - '--verbose', - '--project-dir', - projectRoot, - '--edition', - '@pattern-lab/edition-node', - '--starterkit', - '@pattern-lab/starterkit-mustache-base', - ]); - t.ok( - exists.sync(path.resolve(projectRoot)), - 'should initialize a Pattern Lab project' - ); - t.ok(exists.sync(path.resolve(projectRoot, 'source')), 'with a source dir'); - t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'with a public dir'); - t.ok( - exists.sync(path.resolve(projectRoot, 'pattern_exports')), - 'with a pattern_exports dir' - ); - t.ok( - exists.sync(path.resolve(projectRoot, 'patternlab-config.json')), - 'with a pattern_exports dir' - ); - t.end(); - }) + wrapAsync(function*() { + yield spawnCmd([ + 'init', + '--verbose', + '--project-dir', + projectRoot, + '--edition', + '@pattern-lab/edition-node', + '--starterkit', + '@pattern-lab/starterkit-mustache-base', + ]); + t.ok( + exists.sync(path.resolve(projectRoot)), + 'should initialize a Pattern Lab project' + ); + t.ok(exists.sync(path.resolve(projectRoot, 'source')), 'with a source dir'); + t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'with a public dir'); + t.ok( + exists.sync(path.resolve(projectRoot, 'pattern_exports')), + 'with a pattern_exports dir' + ); + t.ok( + exists.sync(path.resolve(projectRoot, 'patternlab-config.json')), + 'with a pattern_exports dir' + ); + t.end(); + }) ); diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 1ff344cf6..b8aae92b1 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -4,17 +4,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + # [3.0.0-alpha.16](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.15...@pattern-lab/core@3.0.0-alpha.16) (2018-07-06) **Note:** Version bump only for package @pattern-lab/core - - - - -# [3.0.0-alpha.15](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.14...@pattern-lab/core@3.0.0-alpha.15) (2018-07-06) +# [3.0.0-alpha.15](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.14...@pattern-lab/core@3.0.0-alpha.15) (2018-07-06) ### Features @@ -22,13 +19,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/5ab3995)) - - - - -# [3.0.0-alpha.14](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.13...@pattern-lab/core@3.0.0-alpha.14) (2018-07-05) +# [3.0.0-alpha.14](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.13...@pattern-lab/core@3.0.0-alpha.14) (2018-07-05) ### Bug Fixes @@ -38,7 +31,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **viewall:** fix viewall generation ([543558a](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/543558a)) * **watch:** wire up serve and watch listeners correctly ([04cd18e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/04cd18e)) - ### Features * **events:** add PATTERNLAB_BUILD_END event and rename BUILD_START ([5b7bfa3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/5b7bfa3)) @@ -47,23 +39,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **server:** continue server refactor ([8f6cd91](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/8f6cd91)) * **watches:** add additional assets to ignore ([18e74c2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/18e74c2)) - - - -# [3.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.12...@pattern-lab/core@3.0.0-alpha.13) (2018-05-04) +# [3.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.12...@pattern-lab/core@3.0.0-alpha.13) (2018-05-04) ### Features * **api:** expose getVersion statically ([4683cd0](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/4683cd0)) - - - -# [3.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.11...@pattern-lab/core@3.0.0-alpha.12) (2018-05-04) +# [3.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.11...@pattern-lab/core@3.0.0-alpha.12) (2018-05-04) ### Bug Fixes @@ -76,7 +62,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **tests:** prevent dependency graph output file from being written ([0d9c57e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/0d9c57e)) * **uikits:** fix ui_builder_tests ([e75f434](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/e75f434)) - ### Features * **API:** standardize v() and version() into a single call ([6309e69](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/6309e69)) @@ -96,14 +81,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **uikits:** support watched-asset copying ([4f05311](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/4f05311)) * **uikits:** uikits config to default ([a393851](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/commit/a393851)) - ### BREAKING CHANGES * **API:** change `version()` to return a string representation of the version, removing `v()` - - - # [3.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/core/compare/@pattern-lab/core@3.0.0-alpha.10...@pattern-lab/core@3.0.0-alpha.11) (2018-03-21) diff --git a/packages/core/scripts/events.handlebars b/packages/core/scripts/events.handlebars index ca564fd52..667e8c9bf 100644 --- a/packages/core/scripts/events.handlebars +++ b/packages/core/scripts/events.handlebars @@ -5,7 +5,7 @@ Pattern Lab emits numerous events during the [build](../docs/) process. Some uses of events: * Core uses `patternlab-pattern-change` events when watching for changes in order to trigger another build -* Plugins such as [plugin-node-tab](https://github.com/pattern-lab/plugin-node-tab) can use an event like `patternlab-pattern-write-end` to define additional code tabs to the pattern viewer / modal +* Plugins such as [plugin-tab](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab) can use an event like `patternlab-pattern-write-end` to define additional code tabs to the pattern viewer / modal Learn more about [Creating Plugins](https://github.com/pattern-lab/patternlab-node/wiki/Creating-Plugins). diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 48eb93022..eb20f4af0 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -10,11 +10,14 @@ 'use strict'; +const path = require('path'); + const updateNotifier = require('update-notifier'); const packageInfo = require('../package.json'); const events = require('./lib/events'); const pe = require('./lib/pattern_exporter'); +const pm = require('./lib/plugin_manager'); const defaultConfig = require('../patternlab-config.json'); @@ -189,7 +192,11 @@ const patternlab_module = function(config) { * @returns {void} */ installplugin: function(pluginName) { - patternlab.installPlugin(pluginName); + //get the config + const configPath = path.resolve(process.cwd(), 'patternlab-config.json'); + const plugin_manager = new pm(config, configPath); + + plugin_manager.install_plugin(pluginName); }, /** diff --git a/packages/core/src/lib/patternlab.js b/packages/core/src/lib/patternlab.js index 940ca5c89..07d4f1d0d 100644 --- a/packages/core/src/lib/patternlab.js +++ b/packages/core/src/lib/patternlab.js @@ -7,9 +7,9 @@ const cleanHtml = require('js-beautify').html; const inherits = require('util').inherits; const pm = require('./plugin_manager'); +const plugin_manager = new pm(); const packageInfo = require('../../package.json'); const events = require('./events'); -const findModules = require('./findModules'); const buildListItems = require('./buildListItems'); const dataLoader = require('./data_loader')(); const loaduikits = require('./loaduikits'); @@ -77,7 +77,6 @@ module.exports = class PatternLab { // Verify correctness of configuration (?) this.checkConfiguration(this); - // TODO: determine if this is the best place to wire up plugins this.initializePlugins(this); } @@ -134,29 +133,11 @@ module.exports = class PatternLab { * Finds and calls the main method of any found plugins. * @param patternlab - global data store */ - //todo, move this to plugin_manager initializePlugins(patternlab) { if (!patternlab.config.plugins) { return; } - - const plugin_manager = new pm( - patternlab.config, - path.resolve(__dirname, '../../patternlab-config.json') - ); - const foundPlugins = findModules('plugin-'); - - if (foundPlugins && foundPlugins.length > 0) { - for (let i = 0; i < foundPlugins.length; i++) { - const pluginKey = foundPlugins[i]; - - logger.info(`Found plugin: ${pluginKey}`); - logger.info(`Attempting to load and initialize plugin.`); - - const plugin = plugin_manager.load_plugin(pluginKey); - plugin(patternlab); - } - } + plugin_manager.intialize_plugins(patternlab); } buildGlobalData(additionalData) { @@ -311,19 +292,6 @@ module.exports = class PatternLab { } } - /** - * Installs a given plugin. Assumes it has already been pulled down via npm - * @param pluginName - the name of the plugin - */ - installPlugin(pluginName) { - //get the config - const configPath = path.resolve(process.cwd(), 'patternlab-config.json'); - const config = fs.readJSONSync(path.resolve(configPath), 'utf8'); - const plugin_manager = new pm(config, configPath); - - plugin_manager.install_plugin(pluginName); - } - /** * Given a path, load info from the folder to compile into a single config object. * @param dataFilesPath diff --git a/packages/core/src/lib/plugin_manager.js b/packages/core/src/lib/plugin_manager.js index 01de3880e..a3a37ab58 100644 --- a/packages/core/src/lib/plugin_manager.js +++ b/packages/core/src/lib/plugin_manager.js @@ -1,114 +1,65 @@ 'use strict'; -const plugin_manager = function(config, configPath) { +const plugin_manager = function() { const path = require('path'); - const fs = require('fs-extra'); + const findModules = require('./findModules'); + + const _ = require('lodash'); + const logger = require('./log'); + const pluginMatcher = /^plugin-(.*)$/; + /** * Loads a plugin * - * @param pluginName {string} the name of the plugin + * @param modulePath {string} the path to the plugin * @return {object} the loaded plugin */ - function loadPlugin(pluginName) { - return require(path.join(process.cwd(), 'node_modules', pluginName)); + function loadPlugin(modulePath) { + return require(modulePath); } /** - * Installs a plugin - * - * @param pluginName {string} the name of the plugin + * Given a path: return the plugin name if the path points to a valid plugin + * module directory, or false if it doesn't. + * @param filePath + * @returns Plugin name if exists or FALSE */ - function installPlugin(pluginName) { - try { - const pluginPath = path.resolve( - path.join(process.cwd(), 'node_modules', pluginName) - ); - logger.debug(`Attempting to load plugin from ${pluginPath}`); - let pluginDirStats; - try { - pluginDirStats = fs.statSync(pluginPath); - } catch (ex) { - logger.warning(`${pluginName} not found, use npm to install it first.`); - logger.warning(`${pluginName} not loaded.`); - return; - } - const pluginPathDirExists = pluginDirStats.isDirectory(); - if (pluginPathDirExists) { - const diskConfig = fs.readJSONSync(path.resolve(configPath), 'utf8'); - - //add the plugin entry to patternlab-config.json - if (!diskConfig.plugins) { - diskConfig.plugins = {}; - } - - if (!diskConfig.plugins[pluginName]) { - diskConfig.plugins[pluginName] = { - enabled: true, - initialized: false, - }; - } - - const pluginPathConfig = path.resolve(pluginPath, 'config.json'); - try { - const pluginConfigJSON = require(pluginPathConfig); - if (!diskConfig.plugins[pluginName].options) { - diskConfig.plugins[pluginName].options = pluginConfigJSON; - } - } catch (ex) { - //a config.json file is not required at this time - } + function isPlugin(filePath) { + const baseName = path.basename(filePath); + const pluginMatch = baseName.match(pluginMatcher); - //write config entry back - fs.outputFileSync( - path.resolve(configPath), - JSON.stringify(diskConfig, null, 2) - ); - - logger.info('Plugin ' + pluginName + ' installed.'); - logger.info('Plugin configration added to patternlab-config.json.'); - } - } catch (ex) { - logger.warning( - `An error occurred during plugin installation for plugin ${pluginName}` - ); - logger.warning(ex); + if (pluginMatch) { + return pluginMatch[1]; } + return false; } /** - * Disables an installed plugin - * Not implemented yet - */ - function disablePlugin(pluginName) { - logger.warning( - `disablePlugin() not implemented yet. No change made to state of plugin ${pluginName}` - ); - } - - /** - * Enables an installed plugin - * Not implemented yet + * Looks for installed plugins, loads them, and invokes them + * @param {object} patternlab */ - function enablePlugin(pluginName) { - logger.warning( - `enablePlugin() not implemented yet. No change made to state of plugin ${pluginName}` - ); + function initializePlugins(patternlab) { + const nodeModulesPath = path.join(process.cwd(), 'node_modules'); + const foundPlugins = findModules(nodeModulesPath, plugin_manager.is_plugin); + foundPlugins.forEach(plugin => { + logger.info(`Found plugin: plugin-${plugin.name}`); + logger.info(`Attempting to load and initialize plugin.`); + const pluginModule = plugin_manager.load_plugin(plugin.modulePath); + pluginModule(patternlab); + }); } return { - install_plugin: function(pluginName) { - installPlugin(pluginName); - }, - load_plugin: function(pluginName) { - return loadPlugin(pluginName); + intialize_plugins: patternlab => { + initializePlugins(patternlab); }, - disable_plugin: function(pluginName) { - disablePlugin(pluginName); + load_plugin: modulePath => { + return loadPlugin(modulePath); }, - enable_plugin: function(pluginName) { - enablePlugin(pluginName); + is_plugin: filePath => { + return isPlugin(filePath); }, }; }; diff --git a/packages/development-edition-engine-react/CHANGELOG.md b/packages/development-edition-engine-react/CHANGELOG.md index 515588f83..3143802a6 100644 --- a/packages/development-edition-engine-react/CHANGELOG.md +++ b/packages/development-edition-engine-react/CHANGELOG.md @@ -4,52 +4,40 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + ## [0.1.1-alpha.4](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.3...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.4) (2018-07-06) **Note:** Version bump only for package @pattern-lab/engine-react-testing-tree - - - - -## [0.1.1-alpha.3](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.2...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.3) (2018-07-06) +## [0.1.1-alpha.3](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.2...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.3) (2018-07-06) ### Bug Fixes * **package:** fix fat-fingered dependency ([e439f4e](https://github.com/pattern-lab/edition-node-gulp/commit/e439f4e)) - ### Features * **package:** add npmrc file ([55f5bc2](https://github.com/pattern-lab/edition-node-gulp/commit/55f5bc2)) * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/edition-node-gulp/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/edition-node-gulp/commit/5ab3995)) - - - - -## [0.1.1-alpha.2](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.1...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.2) (2018-07-05) - - +## [0.1.1-alpha.2](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.1...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.2) (2018-07-05) **Note:** Version bump only for package @pattern-lab/engine-react-testing-tree -## [0.1.1-alpha.1](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.0...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.1) (2018-05-04) - - +## [0.1.1-alpha.1](https://github.com/pattern-lab/edition-node-gulp/compare/@pattern-lab/engine-react-testing-tree@0.1.1-alpha.0...@pattern-lab/engine-react-testing-tree@0.1.1-alpha.1) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-react-testing-tree -## 0.1.1-alpha.0 (2018-05-04) +## 0.1.1-alpha.0 (2018-05-04) ### Features diff --git a/packages/development-edition-engine-react/gulpfile.js b/packages/development-edition-engine-react/gulpfile.js index 4e97eecf2..8d8653659 100644 --- a/packages/development-edition-engine-react/gulpfile.js +++ b/packages/development-edition-engine-react/gulpfile.js @@ -2,13 +2,13 @@ * PATTERN LAB NODE * EDITION-NODE-GULP * The gulp wrapper around patternlab-node core, providing tasks to interact with the core library. -******************************************************/ + ******************************************************/ const gulp = require('gulp'); const argv = require('minimist')(process.argv.slice(2)); /****************************************************** * PATTERN LAB NODE WRAPPER TASKS with core library -******************************************************/ + ******************************************************/ const config = require('./patternlab-config.json'); const patternlab = require('@pattern-lab/core')(config); diff --git a/packages/development-edition-engine-react/source/_patterns/00-atoms/00-general/HelloWorld.jsx b/packages/development-edition-engine-react/source/_patterns/00-atoms/00-general/HelloWorld.jsx index c714186b9..9790e5af0 100644 --- a/packages/development-edition-engine-react/source/_patterns/00-atoms/00-general/HelloWorld.jsx +++ b/packages/development-edition-engine-react/source/_patterns/00-atoms/00-general/HelloWorld.jsx @@ -1,9 +1,5 @@ import React from 'react'; -const HelloWorld = () => ( -
- Hello world! -
-); +const HelloWorld = () =>
Hello world!
; export default HelloWorld; diff --git a/packages/development-edition-engine-react/source/_patterns/01-molecules/00-general/HelloIncluder.jsx b/packages/development-edition-engine-react/source/_patterns/01-molecules/00-general/HelloIncluder.jsx index 0a2b918bf..6b2f3c985 100644 --- a/packages/development-edition-engine-react/source/_patterns/01-molecules/00-general/HelloIncluder.jsx +++ b/packages/development-edition-engine-react/source/_patterns/01-molecules/00-general/HelloIncluder.jsx @@ -12,17 +12,15 @@ class HelloIncluder extends Component { constructor() { super(); this.state = { - bgColor: 'transparent' - } + bgColor: 'transparent', + }; setTimeout(() => this.setState({ bgColor: 'red' }), 2000); } render() { return ( -
-
- Hey! Here's the Hello World component: -
+
+
Hey! Here's the Hello World component:
); diff --git a/packages/development-edition-engine-react/source/css/pattern-scaffolding.css b/packages/development-edition-engine-react/source/css/pattern-scaffolding.css index 2a69457ed..b09172fc8 100644 --- a/packages/development-edition-engine-react/source/css/pattern-scaffolding.css +++ b/packages/development-edition-engine-react/source/css/pattern-scaffolding.css @@ -5,7 +5,7 @@ */ #sg-patterns { -webkit-box-sizing: border-box !important; - box-sizing: border-box !important; + box-sizing: border-box !important; max-width: 100%; padding: 0 0.5em; } @@ -24,15 +24,15 @@ display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; - flex-wrap: wrap; + flex-wrap: wrap; list-style: none !important; padding: 0 !important; margin: 0 !important; } .sg-colors li { -webkit-box-flex: 1; - -ms-flex: auto; - flex: auto; + -ms-flex: auto; + flex: auto; padding: 0.3em; margin: 0 0.5em 0.5em 0; min-width: 5em; diff --git a/packages/development-edition-engine-react/source/css/style.css b/packages/development-edition-engine-react/source/css/style.css index 588a45915..04f745349 100644 --- a/packages/development-edition-engine-react/source/css/style.css +++ b/packages/development-edition-engine-react/source/css/style.css @@ -1,3 +1,3 @@ /* * YOUR STYLES HERE - */ \ No newline at end of file + */ diff --git a/packages/edition-node-gulp/CHANGELOG.md b/packages/edition-node-gulp/CHANGELOG.md index ce928004f..c5881bde1 100644 --- a/packages/edition-node-gulp/CHANGELOG.md +++ b/packages/edition-node-gulp/CHANGELOG.md @@ -4,17 +4,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + # [2.0.0-alpha.14](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.13...@pattern-lab/edition-node-gulp@2.0.0-alpha.14) (2018-07-06) **Note:** Version bump only for package @pattern-lab/edition-node-gulp - - - - -# [2.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.12...@pattern-lab/edition-node-gulp@2.0.0-alpha.13) (2018-07-06) +# [2.0.0-alpha.13](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.12...@pattern-lab/edition-node-gulp@2.0.0-alpha.13) (2018-07-06) ### Features @@ -22,53 +19,39 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/5ab3995)) - - - - -# [2.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.11...@pattern-lab/edition-node-gulp@2.0.0-alpha.12) (2018-07-05) +# [2.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.11...@pattern-lab/edition-node-gulp@2.0.0-alpha.12) (2018-07-05) ### Bug Fixes * **gulp:** remove help command ([71575db](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/71575db)) - ### Features * **serve:** change calling method ([f47217a](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/f47217a)) - - - -# [2.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.10...@pattern-lab/edition-node-gulp@2.0.0-alpha.11) (2018-05-19) - - +# [2.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.10...@pattern-lab/edition-node-gulp@2.0.0-alpha.11) (2018-05-19) **Note:** Version bump only for package @pattern-lab/edition-node-gulp -# [2.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.9...@pattern-lab/edition-node-gulp@2.0.0-alpha.10) (2018-05-04) - - +# [2.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.9...@pattern-lab/edition-node-gulp@2.0.0-alpha.10) (2018-05-04) **Note:** Version bump only for package @pattern-lab/edition-node-gulp -# [2.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.8...@pattern-lab/edition-node-gulp@2.0.0-alpha.9) (2018-05-04) - - +# [2.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.8...@pattern-lab/edition-node-gulp@2.0.0-alpha.9) (2018-05-04) **Note:** Version bump only for package @pattern-lab/edition-node-gulp -# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.7...@pattern-lab/edition-node-gulp@2.0.0-alpha.8) (2018-05-04) +# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.7...@pattern-lab/edition-node-gulp@2.0.0-alpha.8) (2018-05-04) ### Features @@ -79,14 +62,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** add cli as a dependency ([a52b487](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/a52b487)) * **uikits:** remove workshop for default config ([55570ff](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/commit/55570ff)) - ### BREAKING CHANGES * **API:** change `version()` to return a string representation of the version, removing `v()` - - - # [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node-gulp/compare/@pattern-lab/edition-node-gulp@2.0.0-alpha.6...@pattern-lab/edition-node-gulp@2.0.0-alpha.7) (2018-03-21) diff --git a/packages/edition-node/CHANGELOG.md b/packages/edition-node/CHANGELOG.md index d99da0e1e..80214a6ac 100644 --- a/packages/edition-node/CHANGELOG.md +++ b/packages/edition-node/CHANGELOG.md @@ -4,17 +4,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + # [1.0.0-alpha.12](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.11...@pattern-lab/edition-node@1.0.0-alpha.12) (2018-07-06) **Note:** Version bump only for package @pattern-lab/edition-node - - - - -# [1.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.10...@pattern-lab/edition-node@1.0.0-alpha.11) (2018-07-06) +# [1.0.0-alpha.11](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.10...@pattern-lab/edition-node@1.0.0-alpha.11) (2018-07-06) ### Features @@ -22,45 +19,33 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/commit/5ab3995)) - - - - -# [1.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.9...@pattern-lab/edition-node@1.0.0-alpha.10) (2018-07-05) - - +# [1.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.9...@pattern-lab/edition-node@1.0.0-alpha.10) (2018-07-05) **Note:** Version bump only for package @pattern-lab/edition-node -# [1.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.8...@pattern-lab/edition-node@1.0.0-alpha.9) (2018-05-19) - - +# [1.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.8...@pattern-lab/edition-node@1.0.0-alpha.9) (2018-05-19) **Note:** Version bump only for package @pattern-lab/edition-node -# [1.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.7...@pattern-lab/edition-node@1.0.0-alpha.8) (2018-05-04) - - +# [1.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.7...@pattern-lab/edition-node@1.0.0-alpha.8) (2018-05-04) **Note:** Version bump only for package @pattern-lab/edition-node -# [1.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.6...@pattern-lab/edition-node@1.0.0-alpha.7) (2018-05-04) - - +# [1.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.6...@pattern-lab/edition-node@1.0.0-alpha.7) (2018-05-04) **Note:** Version bump only for package @pattern-lab/edition-node -# [1.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.5...@pattern-lab/edition-node@1.0.0-alpha.6) (2018-05-04) +# [1.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.5...@pattern-lab/edition-node@1.0.0-alpha.6) (2018-05-04) ### Features @@ -68,9 +53,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **scripts:** refactor to use cli commands ([e8d5c21](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/commit/e8d5c21)) * **uikits:** uikits config ([027e56c](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/commit/027e56c)) - - - # [1.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/edition-node/compare/@pattern-lab/edition-node@1.0.0-alpha.4...@pattern-lab/edition-node@1.0.0-alpha.5) (2018-03-21) diff --git a/packages/engine-handlebars/CHANGELOG.md b/packages/engine-handlebars/CHANGELOG.md index 92ddef103..6ac98f4e6 100644 --- a/packages/engine-handlebars/CHANGELOG.md +++ b/packages/engine-handlebars/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.7...@pattern-lab/engine-handlebars@2.0.0-alpha.8) (2018-07-06) +# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.7...@pattern-lab/engine-handlebars@2.0.0-alpha.8) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/commit/5ab3995)) - - - - -# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.6...@pattern-lab/engine-handlebars@2.0.0-alpha.7) (2018-07-05) +# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.6...@pattern-lab/engine-handlebars@2.0.0-alpha.7) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/commit/38a01b1)) - - - -# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.5...@pattern-lab/engine-handlebars@2.0.0-alpha.6) (2018-05-04) - - +# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-handlebars/compare/@pattern-lab/engine-handlebars@2.0.0-alpha.5...@pattern-lab/engine-handlebars@2.0.0-alpha.6) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-handlebars diff --git a/packages/engine-liquid/CHANGELOG.md b/packages/engine-liquid/CHANGELOG.md index 389219d6d..25592dc11 100644 --- a/packages/engine-liquid/CHANGELOG.md +++ b/packages/engine-liquid/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [1.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/compare/@pattern-lab/engine-liquid@1.0.0-alpha.9...@pattern-lab/engine-liquid@1.0.0-alpha.10) (2018-07-06) +# [1.0.0-alpha.10](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/compare/@pattern-lab/engine-liquid@1.0.0-alpha.9...@pattern-lab/engine-liquid@1.0.0-alpha.10) (2018-07-06) ### Features @@ -13,15 +13,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/commit/5ab3995)) - - - - -# [1.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/compare/@pattern-lab/engine-liquid@1.0.0-alpha.8...@pattern-lab/engine-liquid@1.0.0-alpha.9) (2018-05-04) - - +# [1.0.0-alpha.9](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-liquid/compare/@pattern-lab/engine-liquid@1.0.0-alpha.8...@pattern-lab/engine-liquid@1.0.0-alpha.9) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-liquid diff --git a/packages/engine-mustache/CHANGELOG.md b/packages/engine-mustache/CHANGELOG.md index 3a65a3975..698db7c44 100644 --- a/packages/engine-mustache/CHANGELOG.md +++ b/packages/engine-mustache/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.7...@pattern-lab/engine-mustache@2.0.0-alpha.8) (2018-07-06) +# [2.0.0-alpha.8](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.7...@pattern-lab/engine-mustache@2.0.0-alpha.8) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/commit/5ab3995)) - - - - -# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.6...@pattern-lab/engine-mustache@2.0.0-alpha.7) (2018-07-05) +# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.6...@pattern-lab/engine-mustache@2.0.0-alpha.7) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/commit/38a01b1)) - - - -# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.5...@pattern-lab/engine-mustache@2.0.0-alpha.6) (2018-05-04) - - +# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-mustache/compare/@pattern-lab/engine-mustache@2.0.0-alpha.5...@pattern-lab/engine-mustache@2.0.0-alpha.6) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-mustache diff --git a/packages/engine-nunjucks/CHANGELOG.md b/packages/engine-nunjucks/CHANGELOG.md index 85b485607..c5f334584 100644 --- a/packages/engine-nunjucks/CHANGELOG.md +++ b/packages/engine-nunjucks/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [0.1.4-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.3...@pattern-lab/engine-nunjucks@0.1.4-alpha.4) (2018-07-06) +## [0.1.4-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.3...@pattern-lab/engine-nunjucks@0.1.4-alpha.4) (2018-07-06) ### Features @@ -13,32 +13,22 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/commit/5ab3995)) - - - - -## [0.1.4-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.2...@pattern-lab/engine-nunjucks@0.1.4-alpha.3) (2018-07-05) +## [0.1.4-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.2...@pattern-lab/engine-nunjucks@0.1.4-alpha.3) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/commit/38a01b1)) - - - -## [0.1.4-alpha.2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.1...@pattern-lab/engine-nunjucks@0.1.4-alpha.2) (2018-05-04) +## [0.1.4-alpha.2](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/compare/@pattern-lab/engine-nunjucks@0.1.4-alpha.1...@pattern-lab/engine-nunjucks@0.1.4-alpha.2) (2018-05-04) ### Features * **package:** add [@pattern-lab](https://github.com/pattern-lab)/cli as a dependency ([760d0e0](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-nunjucks/commit/760d0e0)) - - - ## 0.1.4-alpha.1 (2018-03-21) diff --git a/packages/engine-react/CHANGELOG.md b/packages/engine-react/CHANGELOG.md index c1afffdb9..49e7cfcdc 100644 --- a/packages/engine-react/CHANGELOG.md +++ b/packages/engine-react/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [0.2.1-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.4...@pattern-lab/engine-react@0.2.1-alpha.5) (2018-07-06) +## [0.2.1-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.4...@pattern-lab/engine-react@0.2.1-alpha.5) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/commit/5ab3995)) - - - - -## [0.2.1-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.3...@pattern-lab/engine-react@0.2.1-alpha.4) (2018-07-05) +## [0.2.1-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.3...@pattern-lab/engine-react@0.2.1-alpha.4) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/commit/38a01b1)) - - - -## [0.2.1-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.2...@pattern-lab/engine-react@0.2.1-alpha.3) (2018-05-04) - - +## [0.2.1-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-react/compare/@pattern-lab/engine-react@0.2.1-alpha.2...@pattern-lab/engine-react@0.2.1-alpha.3) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-react diff --git a/packages/engine-react/lib/engine_react.js b/packages/engine-react/lib/engine_react.js index 70e821bc5..b0f01cdd2 100644 --- a/packages/engine-react/lib/engine_react.js +++ b/packages/engine-react/lib/engine_react.js @@ -215,9 +215,7 @@ var engine_react = { * each with two properties: path, and content */ addOutputFiles(paths, patternlab) { - return [ - - ]; + return []; }, /** diff --git a/packages/engine-twig/CHANGELOG.md b/packages/engine-twig/CHANGELOG.md index cd0f9d89d..040dc4ac8 100644 --- a/packages/engine-twig/CHANGELOG.md +++ b/packages/engine-twig/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [0.2.1-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.4...@pattern-lab/engine-twig@0.2.1-alpha.5) (2018-07-06) +## [0.2.1-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.4...@pattern-lab/engine-twig@0.2.1-alpha.5) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/commit/5ab3995)) - - - - -## [0.2.1-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.3...@pattern-lab/engine-twig@0.2.1-alpha.4) (2018-07-05) +## [0.2.1-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.3...@pattern-lab/engine-twig@0.2.1-alpha.4) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/commit/38a01b1)) - - - -## [0.2.1-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.2...@pattern-lab/engine-twig@0.2.1-alpha.3) (2018-05-04) - - +## [0.2.1-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-twig/compare/@pattern-lab/engine-twig@0.2.1-alpha.2...@pattern-lab/engine-twig@0.2.1-alpha.3) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-twig diff --git a/packages/engine-underscore/CHANGELOG.md b/packages/engine-underscore/CHANGELOG.md index 04dcadba5..533ecb7e8 100644 --- a/packages/engine-underscore/CHANGELOG.md +++ b/packages/engine-underscore/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.6...@pattern-lab/engine-underscore@2.0.0-alpha.7) (2018-07-06) +# [2.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.6...@pattern-lab/engine-underscore@2.0.0-alpha.7) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/commit/5ab3995)) - - - - -# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.5...@pattern-lab/engine-underscore@2.0.0-alpha.6) (2018-07-05) +# [2.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.5...@pattern-lab/engine-underscore@2.0.0-alpha.6) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/commit/38a01b1)) - - - -# [2.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.4...@pattern-lab/engine-underscore@2.0.0-alpha.5) (2018-05-04) - - +# [2.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/engine-underscore/compare/@pattern-lab/engine-underscore@2.0.0-alpha.4...@pattern-lab/engine-underscore@2.0.0-alpha.5) (2018-05-04) **Note:** Version bump only for package @pattern-lab/engine-underscore diff --git a/packages/live-server/CHANGELOG.md b/packages/live-server/CHANGELOG.md index 9396dc2a1..90c875efe 100644 --- a/packages/live-server/CHANGELOG.md +++ b/packages/live-server/CHANGELOG.md @@ -4,20 +4,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [1.3.3-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.5...@pattern-lab/live-server@1.3.3-alpha.6) (2018-07-06) +## [1.3.3-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.5...@pattern-lab/live-server@1.3.3-alpha.6) (2018-07-06) ### Bug Fixes * **dependencies:** pin all packages marked as latest ([87347d5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/commit/87347d5)) - - - - -## [1.3.3-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.4...@pattern-lab/live-server@1.3.3-alpha.5) (2018-07-06) +## [1.3.3-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.4...@pattern-lab/live-server@1.3.3-alpha.5) (2018-07-06) ### Features @@ -25,26 +21,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/commit/5ab3995)) - - - - -## [1.3.3-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.3...@pattern-lab/live-server@1.3.3-alpha.4) (2018-07-05) +## [1.3.3-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.3...@pattern-lab/live-server@1.3.3-alpha.4) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/commit/38a01b1)) - - - -## [1.3.3-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.2...@pattern-lab/live-server@1.3.3-alpha.3) (2018-05-04) - - +## [1.3.3-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/live-server/compare/@pattern-lab/live-server@1.3.3-alpha.2...@pattern-lab/live-server@1.3.3-alpha.3) (2018-05-04) **Note:** Version bump only for package @pattern-lab/live-server diff --git a/packages/plugin-tab/CHANGELOG.md b/packages/plugin-tab/CHANGELOG.md index 5987384b9..db05da1ca 100644 --- a/packages/plugin-tab/CHANGELOG.md +++ b/packages/plugin-tab/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [2.0.3-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.4...@pattern-lab/plugin-tab@2.0.3-alpha.5) (2018-07-06) +## [2.0.3-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.4...@pattern-lab/plugin-tab@2.0.3-alpha.5) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/commit/5ab3995)) - - - - -## [2.0.3-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.3...@pattern-lab/plugin-tab@2.0.3-alpha.4) (2018-07-05) +## [2.0.3-alpha.4](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.3...@pattern-lab/plugin-tab@2.0.3-alpha.4) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/commit/38a01b1)) - - - -## [2.0.3-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.2...@pattern-lab/plugin-tab@2.0.3-alpha.3) (2018-05-04) - - +## [2.0.3-alpha.3](https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab/compare/@pattern-lab/plugin-tab@2.0.3-alpha.2...@pattern-lab/plugin-tab@2.0.3-alpha.3) (2018-05-04) **Note:** Version bump only for package @pattern-lab/plugin-tab diff --git a/packages/plugin-tab/README.md b/packages/plugin-tab/README.md index 50e24a477..8bd03b862 100644 --- a/packages/plugin-tab/README.md +++ b/packages/plugin-tab/README.md @@ -1,4 +1,4 @@ -![license](https://img.shields.io/github/license/pattern-lab/plugin-node-tab.svg) +![license](https://img.shields.io/github/license/pattern-lab/patternlab-node.svg) [![npm](https://img.shields.io/npm/v/@pattern-lab/plugin-tab.svg)](https://www.npmjs.com/package/@pattern-lab/plugin-tab) [![Join the chat at Gitter](https://badges.gitter.im/pattern-lab/node.svg)](https://gitter.im/pattern-lab/node) @@ -28,7 +28,7 @@ Example: ``` "plugins": { - "plugin-node-tab": { + "pattern-lab-plugin-tab": { "enabled": true, "initialized": false, "options": { @@ -38,7 +38,7 @@ Example: } ``` -Add file extensions to this array as strings. Example: `"tabsToAdd": ['scss', 'js']`. You are all set now. +Add file extensions to this array as strings. Example: `"tabsToAdd": ["scss", "js"]`. You are all set now. ## Expected Structure @@ -56,4 +56,4 @@ For example, if we added an `scss` tab: ## Enabling / Disabling the Plugin -After install, you may manually enable or disable the plugin by finding the `plugin-node-tab` key within your main Pattern Lab project's `patternlab-config.json` file and setting the `enabled` flag. In the future this will be possible via CLI. +After install, you may manually enable or disable the plugin by finding the `@pattern-lab/plugin-tab` key within your main Pattern Lab project's `patternlab-config.json` file and setting the `enabled` flag. In the future this will be possible via CLI. diff --git a/packages/plugin-tab/dist/js/plugin-node-tab.js b/packages/plugin-tab/dist/js/pattern-lab-plugin-tab.js similarity index 93% rename from packages/plugin-tab/dist/js/plugin-node-tab.js rename to packages/plugin-tab/dist/js/pattern-lab-plugin-tab.js index d0e999422..9573b9bed 100644 --- a/packages/plugin-tab/dist/js/plugin-node-tab.js +++ b/packages/plugin-tab/dist/js/pattern-lab-plugin-tab.js @@ -1,4 +1,4 @@ -var PluginTab = { +const PluginTab = { /** * The function defined as the onready callback within the plugin configuration. */ diff --git a/packages/plugin-tab/index.js b/packages/plugin-tab/index.js index 3790ea383..b5cea6072 100644 --- a/packages/plugin-tab/index.js +++ b/packages/plugin-tab/index.js @@ -1,24 +1,31 @@ 'use strict'; -const pluginName = 'plugin-node-tab'; +const path = require('path'); +const EOL = require('os').EOL; +const _ = require('lodash'); const fs = require('fs-extra'); const glob = require('glob'); -const path = require('path'); -const EOL = require('os').EOL; + const tab_loader = require('./src/tab-loader'); +const pluginName = 'pattern-lab-plugin-tab'; + function writeConfigToOutput(patternlab, pluginConfig) { - var pluginConfigPathName = path.resolve( - patternlab.config.paths.public.root, - 'patternlab-components', - 'packages' - ); try { - fs.outputFileSync( - pluginConfigPathName + '/' + pluginName + '.json', - JSON.stringify(pluginConfig, null, 2) - ); + _.each(patternlab.uikits, uikit => { + fs.outputFileSync( + path.join( + process.cwd(), + uikit.outputDir, + patternlab.config.paths.public.root, + 'patternlab-components', + 'packages', + `/${pluginName}.json` + ), + JSON.stringify(pluginConfig, null, 2) + ); + }); } catch (ex) { console.trace( pluginName + ': Error occurred while writing pluginFile configuration' @@ -48,7 +55,7 @@ function registerEvents(patternlab) { */ function getPluginFrontendConfig() { return { - name: 'pattern-lab/' + pluginName, + name: pluginName, templates: [], stylesheets: [], javascripts: [ @@ -69,33 +76,16 @@ function getPluginFrontendConfig() { */ function pluginInit(patternlab) { if (!patternlab) { - console.error('patternlab object not provided to plugin-init'); + console.error('patternlab object not provided to pluginInit'); process.exit(1); } //write the plugin json to public/patternlab-components - var pluginConfig = getPluginFrontendConfig(); + const pluginConfig = getPluginFrontendConfig(); pluginConfig.tabsToAdd = patternlab.config.plugins[pluginName].options.tabsToAdd; writeConfigToOutput(patternlab, pluginConfig); - var pluginConfigPathName = path.resolve( - patternlab.config.paths.public.root, - 'patternlab-components', - 'packages' - ); - try { - fs.outputFileSync( - pluginConfigPathName + '/' + pluginName + '.json', - JSON.stringify(pluginConfig, null, 2) - ); - } catch (ex) { - console.trace( - 'plugin-node-tab: Error occurred while writing pluginFile configuration' - ); - console.log(ex); - } - //add the plugin config to the patternlab-object if (!patternlab.plugins) { patternlab.plugins = []; @@ -103,22 +93,22 @@ function pluginInit(patternlab) { patternlab.plugins.push(pluginConfig); //write the plugin dist folder to public/pattern-lab - var pluginFiles = glob.sync(__dirname + '/dist/**/*'); + const pluginFiles = glob.sync(__dirname + '/dist/**/*'); if (pluginFiles && pluginFiles.length > 0) { - let tab_frontend_snippet = fs.readFileSync( + const tab_frontend_snippet = fs.readFileSync( path.resolve(__dirname + '/src/snippet.js'), 'utf8' ); for (let i = 0; i < pluginFiles.length; i++) { try { - var fileStat = fs.statSync(pluginFiles[i]); + const fileStat = fs.statSync(pluginFiles[i]); if (fileStat.isFile()) { - var relativePath = path + const relativePath = path .relative(__dirname, pluginFiles[i]) .replace('dist', ''); //dist is dropped - var writePath = path.join( + const writePath = path.join( patternlab.config.paths.public.root, 'patternlab-components', 'pattern-lab', @@ -134,10 +124,10 @@ function pluginInit(patternlab) { //in this case, we need to alter the dist file to loop through our tabs to load as defined in the package.json //we are also being a bit lazy here, since we only expect one file let tabJSFileContents = fs.readFileSync(pluginFiles[i], 'utf8'); - var snippetString = ''; + let snippetString = ''; if (pluginConfig.tabsToAdd && pluginConfig.tabsToAdd.length > 0) { for (let j = 0; j < pluginConfig.tabsToAdd.length; j++) { - let tabSnippetLocal = tab_frontend_snippet + const tabSnippetLocal = tab_frontend_snippet .replace(/<>/g, pluginConfig.tabsToAdd[j]) .replace( /<>/g, @@ -149,12 +139,17 @@ function pluginInit(patternlab) { '/*SNIPPETS*/', snippetString ); - fs.outputFileSync(writePath, tabJSFileContents); + _.each(patternlab.uikits, uikit => { + fs.outputFileSync( + path.join(process.cwd(), uikit.outputDir, writePath), + tabJSFileContents + ); + }); } } } catch (ex) { console.trace( - 'plugin-node-tab: Error occurred while copying pluginFile', + 'plugin-tab: Error occurred while copying pluginFile', pluginFiles[i] ); console.log(ex); diff --git a/packages/plugin-tab/package.json b/packages/plugin-tab/package.json index 744175bda..cc26ea744 100644 --- a/packages/plugin-tab/package.json +++ b/packages/plugin-tab/package.json @@ -5,7 +5,8 @@ "main": "index.js", "dependencies": { "fs-extra": "0.30.0", - "glob": "7.0.0" + "glob": "7.0.0", + "lodash": "4.17.5" }, "repository": "https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab", "bugs": "https://github.com/pattern-lab/patternlab-node/issues", @@ -15,7 +16,7 @@ }, "author": "Brian Muenzenmeyer", "license": "MIT", - "homepage": "https://github.com/pattern-lab/plugin-node-tab#readme", + "homepage": "https://github.com/pattern-lab/patternlab-node/tree/master/packages/plugin-tab", "devDependencies": { "eslint": "4.18.2" }, diff --git a/packages/plugin-tab/postinstall.js b/packages/plugin-tab/postinstall.js index 56620abe5..25c8c2039 100644 --- a/packages/plugin-tab/postinstall.js +++ b/packages/plugin-tab/postinstall.js @@ -1,10 +1,5 @@ -console.log('Pattern Lab Node Plugin - "plugin-node-tab" installed. '); -console.log( - 'You may have to run `npm run postinstall` from your console as well.' -); -console.log( - 'Configure or disable this plugin inside your patternlab-config.json file.' -); -console.log( - 'Add tabs to the Pattern Lab UI by adding file extensions to the "tabsToAdd" array on the plugins.plugin-node-tab.options object.' -); +console.log(`Pattern Lab Node Plugin - "plugin-tab" installed. +Use the CLI to install this: patternlab install --plugins @pattern-lab/plugin-tab +Configure or disable this plugin inside your patternlab-config.json file. +Add tabs to the Pattern Lab UI by adding file extensions to the "tabsToAdd" array on the plugins['@pattern-lab/plugin-tab'].options object. +`); diff --git a/packages/plugin-tab/src/snippet.js b/packages/plugin-tab/src/snippet.js index b7e08bb36..499fc65f5 100644 --- a/packages/plugin-tab/src/snippet.js +++ b/packages/plugin-tab/src/snippet.js @@ -9,6 +9,6 @@ Panels.add({ httpRequestReplace: '.<>', httpRequestCompleted: false, prismHighlight: true, - language: 'markup', + language: '<>', keyCombo: 'ctrl+shift+z', }); diff --git a/packages/plugin-tab/src/tab-loader.js b/packages/plugin-tab/src/tab-loader.js index 4793128a9..7ae297500 100644 --- a/packages/plugin-tab/src/tab-loader.js +++ b/packages/plugin-tab/src/tab-loader.js @@ -1,8 +1,10 @@ 'use strict'; -const fs = require('fs-extra'); const path = require('path'); +const _ = require('lodash'); +const fs = require('fs-extra'); + /** * The backend method that is called during the patternlab-pattern-write-end event. * Responsible for looking for a companion filetype file alongside a pattern file and outputting it if found. @@ -12,21 +14,21 @@ const path = require('path'); function findTab(patternlab, pattern) { //read the filetypes from the configuration const fileTypes = - patternlab.config.plugins['plugin-node-tab'].options.tabsToAdd; + patternlab.config.plugins['pattern-lab-plugin-tab'].options.tabsToAdd; //exit if either of these two parameters are missing if (!patternlab) { - console.error('plugin-node-tab: patternlab object not provided to findTab'); + console.error('plugin-tab: patternlab object not provided to findTab'); process.exit(1); } if (!pattern) { - console.error('plugin-node-tab: pattern object not provided to findTab'); + console.error('plugin-tab: pattern object not provided to findTab'); process.exit(1); } //derive the custom filetype paths from the pattern relPath - var customFileTypePath = path.join( + let customFileTypePath = path.join( patternlab.config.paths.source.patterns, pattern.relPath ); @@ -39,35 +41,47 @@ function findTab(patternlab, pattern) { customFileTypePath.substr(0, customFileTypePath.lastIndexOf('.')) + '.' + fileType; - var customFileTypeOutputPath = + const customFileTypeOutputPath = patternlab.config.paths.public.patterns + pattern.getPatternLink(patternlab, 'custom', '.' + fileType); //look for a custom filetype for this template + let tabFileName; + let tabFileNameStats; try { - var tabFileName = path.resolve(customFileTypePath); + tabFileName = path.resolve(customFileTypePath); try { - var tabFileNameStats = fs.statSync(tabFileName); + tabFileNameStats = fs.statSync(tabFileName); } catch (err) { //not a file - move on quietly } if (tabFileNameStats && tabFileNameStats.isFile()) { if (patternlab.config.debug) { console.log( - 'plugin-node-tab: copied pattern-specific custom file for ' + + 'plugin-tab: copied pattern-specific custom file for ' + pattern.patternPartial ); } //copy the file to our output target if found - fs.copySync(tabFileName, customFileTypeOutputPath); + _.each(patternlab.uikits, uikit => { + fs.copySync( + tabFileName, + path.join(process.cwd(), uikit.outputDir, customFileTypeOutputPath) + ); + }); } else { //otherwise write nothing to the same location - this prevents GET errors on the tab. - fs.outputFileSync(customFileTypeOutputPath, ''); + _.each(patternlab.uikits, uikit => { + fs.outputFileSync( + path.join(process.cwd(), uikit.outputDir, customFileTypeOutputPath), + '' + ); + }); } } catch (err) { console.log( - 'plugin-node-tab:There was an error parsing sibling JSON for ' + + 'plugin-tab: There was an error parsing sibling JSON for ' + pattern.relPath ); console.log(err); diff --git a/packages/uikit-workshop/CHANGELOG.md b/packages/uikit-workshop/CHANGELOG.md index 995e767c6..cc83a4d59 100644 --- a/packages/uikit-workshop/CHANGELOG.md +++ b/packages/uikit-workshop/CHANGELOG.md @@ -4,8 +4,8 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [1.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.6...@pattern-lab/uikit-workshop@1.0.0-alpha.7) (2018-07-06) +# [1.0.0-alpha.7](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.6...@pattern-lab/uikit-workshop@1.0.0-alpha.7) (2018-07-06) ### Features @@ -13,26 +13,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * **package:** pin all dependencies ([415698e](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/commit/415698e)) * **package:** remove package-lock.json files ([5ab3995](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/commit/5ab3995)) - - - - -# [1.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.5...@pattern-lab/uikit-workshop@1.0.0-alpha.6) (2018-07-05) +# [1.0.0-alpha.6](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.5...@pattern-lab/uikit-workshop@1.0.0-alpha.6) (2018-07-05) ### Features * **tests:** use lerna run test at the monorepo level ([38a01b1](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/commit/38a01b1)) - - - -# [1.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.4...@pattern-lab/uikit-workshop@1.0.0-alpha.5) (2018-05-04) - - +# [1.0.0-alpha.5](https://github.com/pattern-lab/patternlab-node/tree/master/packages/uikit-workshop/compare/@pattern-lab/uikit-workshop@1.0.0-alpha.4...@pattern-lab/uikit-workshop@1.0.0-alpha.5) (2018-05-04) **Note:** Version bump only for package @pattern-lab/uikit-workshop