From b5bda1ee324ef9dc99ed7e1b26a68325a24533fc Mon Sep 17 00:00:00 2001 From: Kim Joar Bekkelund Date: Mon, 12 Feb 2018 19:01:33 +0100 Subject: [PATCH] [plugin] Handle Kibana package dependencies (#16509) * [plugin] Handle Kibana package dependencies * Clean up 'link:' dep check in plugin installer * Tests for 'prepareProjectDependencies' * Remove unnecessary fn from 'prepareProjectDependencies' * Move prepareProjectDependencies into @kbn/build * update snapshot * Move test to Jest * clarification --- package.json | 2 +- packages/kbn-build/dist/index.js | 1554 +++++++++-------- packages/kbn-build/package.json | 5 - packages/kbn-build/src/index.js | 5 +- .../with_kibana_link_deps/package.json | 7 + .../with_other_link_deps/package.json | 7 + ...{index.js => build_production_projects.js} | 2 +- .../production/build_production_projects.js | 90 + packages/kbn-build/src/production/index.js | 94 +- .../prepare_project_dependencies.js | 37 + .../prepare_project_dependencies.test.js | 23 + .../link_project_executables.test.js.snap | 2 + packages/kbn-build/src/utils/fs.js | 3 +- packages/kbn-build/src/utils/package_json.js | 4 +- packages/kbn-build/src/utils/project.js | 10 +- src/cli_plugin/install/install.js | 3 + 16 files changed, 1012 insertions(+), 836 deletions(-) create mode 100644 packages/kbn-build/src/production/__fixtures__/external_packages/with_kibana_link_deps/package.json create mode 100644 packages/kbn-build/src/production/__fixtures__/external_packages/with_other_link_deps/package.json rename packages/kbn-build/src/production/__tests__/{index.js => build_production_projects.js} (95%) create mode 100644 packages/kbn-build/src/production/build_production_projects.js create mode 100644 packages/kbn-build/src/production/prepare_project_dependencies.js create mode 100644 packages/kbn-build/src/production/prepare_project_dependencies.test.js diff --git a/package.json b/package.json index 26c03937027a4..930d33ba6b4f6 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "@elastic/test-subj-selector": "0.2.1", "@elastic/ui-ace": "0.2.3", "@kbn/babel-preset": "link:packages/kbn-babel-preset", + "@kbn/build": "link:packages/kbn-build", "JSONStream": "1.1.1", "accept-language-parser": "1.2.0", "angular": "1.6.5", @@ -220,7 +221,6 @@ "@elastic/eslint-config-kibana": "link:packages/eslint-config-kibana", "@elastic/eslint-import-resolver-kibana": "1.0.0", "@elastic/eslint-plugin-kibana-custom": "link:packages/eslint-plugin-kibana-custom", - "@kbn/build": "link:packages/kbn-build", "angular-mocks": "1.4.7", "babel-eslint": "8.1.2", "backport": "2.2.0", diff --git a/packages/kbn-build/dist/index.js b/packages/kbn-build/dist/index.js index 96b5277c130ba..d52b8f2a01bb0 100644 --- a/packages/kbn-build/dist/index.js +++ b/packages/kbn-build/dist/index.js @@ -61,7 +61,7 @@ module.exports = /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 168); +/******/ return __webpack_require__(__webpack_require__.s = 169); /******/ }) /************************************************************************/ /******/ ([ @@ -4631,10 +4631,10 @@ module.exports = require("util"); "use strict"; const escapeStringRegexp = __webpack_require__(20); -const ansiStyles = __webpack_require__(172); -const supportsColor = __webpack_require__(176); +const ansiStyles = __webpack_require__(173); +const supportsColor = __webpack_require__(177); -const template = __webpack_require__(179); +const template = __webpack_require__(180); const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); @@ -5004,20 +5004,20 @@ module.exports = glob var fs = __webpack_require__(2) var rp = __webpack_require__(22) -var minimatch = __webpack_require__(13) +var minimatch = __webpack_require__(14) var Minimatch = minimatch.Minimatch var inherits = __webpack_require__(23) var EE = __webpack_require__(12).EventEmitter var path = __webpack_require__(1) var assert = __webpack_require__(8) -var isAbsolute = __webpack_require__(14) -var globSync = __webpack_require__(187) +var isAbsolute = __webpack_require__(15) +var globSync = __webpack_require__(188) var common = __webpack_require__(24) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts var ownProp = common.ownProp -var inflight = __webpack_require__(188) +var inflight = __webpack_require__(189) var util = __webpack_require__(3) var childrenIgnored = common.childrenIgnored var isIgnored = common.isIgnored @@ -5788,7 +5788,7 @@ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { }) } -module.exports = patch(__webpack_require__(150)) +module.exports = patch(__webpack_require__(151)) if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH) { module.exports = patch(fs) } @@ -6130,9 +6130,9 @@ var _pify = __webpack_require__(5); var _pify2 = _interopRequireDefault(_pify); -var _errors = __webpack_require__(15); +var _errors = __webpack_require__(16); -var _project = __webpack_require__(189); +var _project = __webpack_require__(27); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -6219,6 +6219,74 @@ module.exports = require("events"); /* 13 */ /***/ (function(module, exports, __webpack_require__) { +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isLinkDependency = exports.createProductionPackageJson = undefined; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.readPackageJson = readPackageJson; +exports.writePackageJson = writePackageJson; +exports.transformDependencies = transformDependencies; + +var _readPkg = __webpack_require__(230); + +var _readPkg2 = _interopRequireDefault(_readPkg); + +var _writePkg = __webpack_require__(256); + +var _writePkg2 = _interopRequireDefault(_writePkg); + +var _path = __webpack_require__(1); + +var _path2 = _interopRequireDefault(_path); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function readPackageJson(dir) { + return (0, _readPkg2.default)(_path2.default.join(dir, 'package.json'), { normalize: false }); +} + +function writePackageJson(path, json) { + return (0, _writePkg2.default)(path, json); +} + +const createProductionPackageJson = exports.createProductionPackageJson = pkgJson => _extends({}, pkgJson, { + dependencies: transformDependencies(pkgJson.dependencies) +}); + +const isLinkDependency = exports.isLinkDependency = depVersion => depVersion.startsWith('link:'); + +/** + * Replaces `link:` dependencies with `file:` dependencies. When installing + * dependencies, these `file:` dependencies will be copied into `node_modules` + * instead of being symlinked. + * + * This will allow us to copy packages into the build and run `yarn`, which + * will then _copy_ the `file:` dependencies into `node_modules` instead of + * symlinking like we do in development. + */ +function transformDependencies(dependencies = {}) { + const newDeps = {}; + for (const name of Object.keys(dependencies)) { + const depVersion = dependencies[name]; + if (isLinkDependency(depVersion)) { + newDeps[name] = depVersion.replace('link:', 'file:'); + } else { + newDeps[name] = depVersion; + } + } + return newDeps; +} + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + module.exports = minimatch minimatch.Minimatch = Minimatch @@ -6228,7 +6296,7 @@ try { } catch (er) {} var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = __webpack_require__(183) +var expand = __webpack_require__(184) var plTypes = { '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, @@ -7145,7 +7213,7 @@ function regExpEscape (s) { /***/ }), -/* 14 */ +/* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7172,7 +7240,7 @@ module.exports.win32 = win32; /***/ }), -/* 15 */ +/* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7190,13 +7258,13 @@ class CliError extends Error { exports.CliError = CliError; /***/ }), -/* 16 */ +/* 17 */ /***/ (function(module, exports) { module.exports = require("child_process"); /***/ }), -/* 17 */ +/* 18 */ /***/ (function(module, exports, __webpack_require__) { // Note: since nyc uses this module to output coverage, any lines @@ -7358,72 +7426,6 @@ function processEmit (ev, arg) { } -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.createProductionPackageJson = undefined; - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -exports.readPackageJson = readPackageJson; -exports.writePackageJson = writePackageJson; -exports.transformDependencies = transformDependencies; - -var _readPkg = __webpack_require__(230); - -var _readPkg2 = _interopRequireDefault(_readPkg); - -var _writePkg = __webpack_require__(256); - -var _writePkg2 = _interopRequireDefault(_writePkg); - -var _path = __webpack_require__(1); - -var _path2 = _interopRequireDefault(_path); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function readPackageJson(dir) { - return (0, _readPkg2.default)(_path2.default.join(dir, 'package.json'), { normalize: false }); -} - -function writePackageJson(path, json) { - return (0, _writePkg2.default)(path, json); -} - -const createProductionPackageJson = exports.createProductionPackageJson = pkgJson => _extends({}, pkgJson, { - dependencies: transformDependencies(pkgJson.dependencies) -}); - -/** - * Replaces `link:` dependencies with `file:` dependencies. When installing - * dependencies, these `file:` dependencies will be copied into `node_modules` - * instead of being symlinked. - * - * This will allow us to copy packages into the build and run `yarn`, which - * will then _copy_ the `file:` dependencies into `node_modules` instead of - * symlinking like we do in development. - */ -function transformDependencies(dependencies = {}) { - const newDeps = {}; - for (const name of Object.keys(dependencies)) { - const depVersion = dependencies[name]; - if (depVersion.startsWith('link:')) { - newDeps[name] = depVersion.replace('link:', 'file:'); - } else { - newDeps[name] = depVersion; - } - } - return newDeps; -} - /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { @@ -7434,7 +7436,7 @@ function transformDependencies(dependencies = {}) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.createSymlink = exports.isFile = exports.isDirectory = exports.mkdirp = exports.chmod = undefined; +exports.createSymlink = exports.isFile = exports.isDirectory = exports.readFile = exports.mkdirp = exports.chmod = undefined; let statTest = (() => { var _ref = _asyncToGenerator(function* (path, block) { @@ -7557,7 +7559,7 @@ var _cmdShim = __webpack_require__(263); var _cmdShim2 = _interopRequireDefault(_cmdShim); -var _mkdirp = __webpack_require__(156); +var _mkdirp = __webpack_require__(157); var _mkdirp2 = _interopRequireDefault(_mkdirp); @@ -7566,6 +7568,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } const stat = (0, _pify2.default)(_fs2.default.stat); +const readFile = (0, _pify2.default)(_fs2.default.readFile); const unlink = (0, _pify2.default)(_fs2.default.unlink); const symlink = (0, _pify2.default)(_fs2.default.symlink); const chmod = (0, _pify2.default)(_fs2.default.chmod); @@ -7574,6 +7577,7 @@ const mkdirp = (0, _pify2.default)(_mkdirp2.default); exports.chmod = chmod; exports.mkdirp = mkdirp; +exports.readFile = readFile; /***/ }), /* 20 */ @@ -7598,7 +7602,7 @@ module.exports = function (str) { /***/ (function(module, exports, __webpack_require__) { /* MIT license */ -var cssKeywords = __webpack_require__(174); +var cssKeywords = __webpack_require__(175); // NOTE: conversions should only return primitive values (i.e. arrays, or // values that give correct `typeof` results). @@ -8477,7 +8481,7 @@ var origRealpathSync = fs.realpathSync var version = process.version var ok = /^v[0-5]\./.test(version) -var old = __webpack_require__(182) +var old = __webpack_require__(183) function newError (er) { return er && er.syscall === 'realpath' && ( @@ -8541,7 +8545,7 @@ try { if (typeof util.inherits !== 'function') throw ''; module.exports = util.inherits; } catch (e) { - module.exports = __webpack_require__(186); + module.exports = __webpack_require__(187); } @@ -8564,8 +8568,8 @@ function ownProp (obj, field) { } var path = __webpack_require__(1) -var minimatch = __webpack_require__(13) -var isAbsolute = __webpack_require__(14) +var minimatch = __webpack_require__(14) +var isAbsolute = __webpack_require__(15) var Minimatch = minimatch.Minimatch function alphasorti (a, b) { @@ -8885,9 +8889,165 @@ function onceStrict (fn) { "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Project = undefined; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _path = __webpack_require__(1); + +var _path2 = _interopRequireDefault(_path); + +var _util = __webpack_require__(3); + +var _chalk = __webpack_require__(4); + +var _chalk2 = _interopRequireDefault(_chalk); + +var _scripts = __webpack_require__(190); + +var _package_json = __webpack_require__(13); + +var _errors = __webpack_require__(16); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + +class Project { + static fromPath(path) { + return _asyncToGenerator(function* () { + const pkgJson = yield (0, _package_json.readPackageJson)(path); + return new Project(pkgJson, path); + })(); + } + + constructor(packageJson, projectPath) { + this.json = Object.freeze(packageJson); + this.path = projectPath; + + this.packageJsonLocation = _path2.default.resolve(this.path, 'package.json'); + this.nodeModulesLocation = _path2.default.resolve(this.path, 'node_modules'); + this.targetLocation = _path2.default.resolve(this.path, 'target'); + + this.allDependencies = _extends({}, this.json.devDependencies || {}, this.json.dependencies || {}); + + this.scripts = this.json.scripts || {}; + } + + get name() { + return this.json.name; + } + + ensureValidProjectDependency(project) { + const relativePathToProject = normalizePath(_path2.default.relative(this.path, project.path)); + + const versionInPackageJson = this.allDependencies[project.name]; + const expectedVersionInPackageJson = `link:${relativePathToProject}`; + + if (versionInPackageJson === expectedVersionInPackageJson) { + return; + } + + const updateMsg = 'Update its package.json to the expected value below.'; + const meta = { + package: `${this.name} (${this.packageJsonLocation})`, + expected: `"${project.name}": "${expectedVersionInPackageJson}"`, + actual: `"${project.name}": "${versionInPackageJson}"` + }; + + if ((0, _package_json.isLinkDependency)(versionInPackageJson)) { + throw new _errors.CliError(`[${this.name}] depends on [${project.name}] using 'link:', but the path is wrong. ${updateMsg}`, meta); + } + + throw new _errors.CliError(`[${this.name}] depends on [${project.name}], but it's not using the local package. ${updateMsg}`, meta); + } + + skipFromBuild() { + const json = this.json; + return json.kibana && json.kibana.build && json.kibana.build.skip === true; + } + + hasScript(name) { + return name in this.scripts; + } + + getExecutables() { + const raw = this.json.bin; + + if (!raw) { + return {}; + } + + if (typeof raw === 'string') { + return { + [this.name]: _path2.default.resolve(this.path, raw) + }; + } + + if (typeof raw === 'object') { + const binsConfig = {}; + for (const binName of Object.keys(raw)) { + binsConfig[binName] = _path2.default.resolve(this.path, raw[binName]); + } + return binsConfig; + } + + throw new _errors.CliError(`[${this.name}] has an invalid "bin" field in its package.json, ` + `expected an object or a string`, { + package: `${this.name} (${this.packageJsonLocation})`, + binConfig: (0, _util.inspect)(raw) + }); + } + + runScript(scriptName, args = []) { + var _this = this; + + return _asyncToGenerator(function* () { + console.log(_chalk2.default.bold(`\n\nRunning script [${_chalk2.default.green(scriptName)}] in [${_chalk2.default.green(_this.name)}]:\n`)); + return (0, _scripts.runScriptInPackage)(scriptName, args, _this); + })(); + } + + runScriptStreaming(scriptName, args = []) { + var _this2 = this; + + return _asyncToGenerator(function* () { + return (0, _scripts.runScriptInPackageStreaming)(scriptName, args, _this2); + })(); + } + + hasDependencies() { + return Object.keys(this.allDependencies).length > 0; + } + + installDependencies({ extraArgs }) { + var _this3 = this; + + return _asyncToGenerator(function* () { + console.log(_chalk2.default.bold(`\n\nInstalling dependencies in [${_chalk2.default.green(_this3.name)}]:\n`)); + return (0, _scripts.installInDir)(_this3.path, extraArgs); + })(); + } +} + +exports.Project = Project; // We normalize all path separators to `/` in generated files + +function normalizePath(path) { + return path.replace(/[\\\/]+/g, '/'); +} + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + var path = __webpack_require__(1); var which = __webpack_require__(195); -var LRU = __webpack_require__(28); +var LRU = __webpack_require__(29); var commandCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec @@ -8917,7 +9077,7 @@ module.exports = resolveCommand; /***/ }), -/* 28 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9391,7 +9551,7 @@ function Entry (key, value, length, now, maxAge) { /***/ }), -/* 29 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9428,7 +9588,7 @@ module.exports = escapeArgument; /***/ }), -/* 30 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9607,7 +9767,7 @@ function lineMerger(host) { /***/ }), -/* 31 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9686,7 +9846,7 @@ return af; /***/ }), -/* 32 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9834,7 +9994,7 @@ return ar; /***/ }), -/* 33 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9899,7 +10059,7 @@ return arDz; /***/ }), -/* 34 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9964,7 +10124,7 @@ return arKw; /***/ }), -/* 35 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10096,7 +10256,7 @@ return arLy; /***/ }), -/* 36 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10162,7 +10322,7 @@ return arMa; /***/ }), -/* 37 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10273,7 +10433,7 @@ return arSa; /***/ }), -/* 38 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10338,7 +10498,7 @@ return arTn; /***/ }), -/* 39 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10449,7 +10609,7 @@ return az; /***/ }), -/* 40 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10589,7 +10749,7 @@ return be; /***/ }), -/* 41 */ +/* 42 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10685,7 +10845,7 @@ return bg; /***/ }), -/* 42 */ +/* 43 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10750,7 +10910,7 @@ return bm; /***/ }), -/* 43 */ +/* 44 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10875,7 +11035,7 @@ return bn; /***/ }), -/* 44 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11000,7 +11160,7 @@ return bo; /***/ }), -/* 45 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11114,7 +11274,7 @@ return br; /***/ }), -/* 46 */ +/* 47 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11272,7 +11432,7 @@ return bs; /***/ }), -/* 47 */ +/* 48 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11366,7 +11526,7 @@ return ca; /***/ }), -/* 48 */ +/* 49 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11551,7 +11711,7 @@ return cs; /***/ }), -/* 49 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11620,7 +11780,7 @@ return cv; /***/ }), -/* 50 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11707,7 +11867,7 @@ return cy; /***/ }), -/* 51 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11773,7 +11933,7 @@ return da; /***/ }), -/* 52 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11857,7 +12017,7 @@ return de; /***/ }), -/* 53 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11942,7 +12102,7 @@ return deAt; /***/ }), -/* 54 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12026,7 +12186,7 @@ return deCh; /***/ }), -/* 55 */ +/* 56 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12132,7 +12292,7 @@ return dv; /***/ }), -/* 56 */ +/* 57 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12238,7 +12398,7 @@ return el; /***/ }), -/* 57 */ +/* 58 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12311,7 +12471,7 @@ return enAu; /***/ }), -/* 58 */ +/* 59 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12380,7 +12540,7 @@ return enCa; /***/ }), -/* 59 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12453,7 +12613,7 @@ return enGb; /***/ }), -/* 60 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12526,7 +12686,7 @@ return enIe; /***/ }), -/* 61 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12599,7 +12759,7 @@ return enNz; /***/ }), -/* 62 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12678,7 +12838,7 @@ return eo; /***/ }), -/* 63 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12776,7 +12936,7 @@ return es; /***/ }), -/* 64 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12873,7 +13033,7 @@ return esDo; /***/ }), -/* 65 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12962,7 +13122,7 @@ return esUs; /***/ }), -/* 66 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13049,7 +13209,7 @@ return et; /***/ }), -/* 67 */ +/* 68 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13121,7 +13281,7 @@ return eu; /***/ }), -/* 68 */ +/* 69 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13234,7 +13394,7 @@ return fa; /***/ }), -/* 69 */ +/* 70 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13349,7 +13509,7 @@ return fi; /***/ }), -/* 70 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13415,7 +13575,7 @@ return fo; /***/ }), -/* 71 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13504,7 +13664,7 @@ return fr; /***/ }), -/* 72 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13584,7 +13744,7 @@ return frCa; /***/ }), -/* 73 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13668,7 +13828,7 @@ return frCh; /***/ }), -/* 74 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13749,7 +13909,7 @@ return fy; /***/ }), -/* 75 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13831,7 +13991,7 @@ return gd; /***/ }), -/* 76 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13914,7 +14074,7 @@ return gl; /***/ }), -/* 77 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14043,7 +14203,7 @@ return gomLatn; /***/ }), -/* 78 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14173,7 +14333,7 @@ return gu; /***/ }), -/* 79 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14278,7 +14438,7 @@ return he; /***/ }), -/* 80 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14408,7 +14568,7 @@ return hi; /***/ }), -/* 81 */ +/* 82 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14568,7 +14728,7 @@ return hr; /***/ }), -/* 82 */ +/* 83 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14684,7 +14844,7 @@ return hu; /***/ }), -/* 83 */ +/* 84 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14785,7 +14945,7 @@ return hyAm; /***/ }), -/* 84 */ +/* 85 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14874,7 +15034,7 @@ return id; /***/ }), -/* 85 */ +/* 86 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15012,7 +15172,7 @@ return is; /***/ }), -/* 86 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15088,7 +15248,7 @@ return it; /***/ }), -/* 87 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15174,7 +15334,7 @@ return ja; /***/ }), -/* 88 */ +/* 89 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15263,7 +15423,7 @@ return jv; /***/ }), -/* 89 */ +/* 90 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15358,7 +15518,7 @@ return ka; /***/ }), -/* 90 */ +/* 91 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15451,7 +15611,7 @@ return kk; /***/ }), -/* 91 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15515,7 +15675,7 @@ return km; /***/ }), -/* 92 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15647,7 +15807,7 @@ return kn; /***/ }), -/* 93 */ +/* 94 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15735,7 +15895,7 @@ return ko; /***/ }), -/* 94 */ +/* 95 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15829,7 +15989,7 @@ return ky; /***/ }), -/* 95 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15972,7 +16132,7 @@ return lb; /***/ }), -/* 96 */ +/* 97 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16048,7 +16208,7 @@ return lo; /***/ }), -/* 97 */ +/* 98 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16172,7 +16332,7 @@ return lt; /***/ }), -/* 98 */ +/* 99 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16276,7 +16436,7 @@ return lv; /***/ }), -/* 99 */ +/* 100 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16394,7 +16554,7 @@ return me; /***/ }), -/* 100 */ +/* 101 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16464,7 +16624,7 @@ return mi; /***/ }), -/* 101 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16560,7 +16720,7 @@ return mk; /***/ }), -/* 102 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16647,7 +16807,7 @@ return ml; /***/ }), -/* 103 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16814,7 +16974,7 @@ return mr; /***/ }), -/* 104 */ +/* 105 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16902,7 +17062,7 @@ return ms; /***/ }), -/* 105 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16991,7 +17151,7 @@ return msMy; /***/ }), -/* 106 */ +/* 107 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17057,7 +17217,7 @@ return mt; /***/ }), -/* 107 */ +/* 108 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17159,7 +17319,7 @@ return my; /***/ }), -/* 108 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17228,7 +17388,7 @@ return nb; /***/ }), -/* 109 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17357,7 +17517,7 @@ return ne; /***/ }), -/* 110 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17451,7 +17611,7 @@ return nl; /***/ }), -/* 111 */ +/* 112 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17545,7 +17705,7 @@ return nlBe; /***/ }), -/* 112 */ +/* 113 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17611,7 +17771,7 @@ return nn; /***/ }), -/* 113 */ +/* 114 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17741,7 +17901,7 @@ return paIn; /***/ }), -/* 114 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17873,7 +18033,7 @@ return pl; /***/ }), -/* 115 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -17944,7 +18104,7 @@ return pt; /***/ }), -/* 116 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -18011,7 +18171,7 @@ return ptBr; /***/ }), -/* 117 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -18093,7 +18253,7 @@ return ro; /***/ }), -/* 118 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -18283,7 +18443,7 @@ return ru; /***/ }), -/* 119 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -18387,7 +18547,7 @@ return sd; /***/ }), -/* 120 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -18454,7 +18614,7 @@ return se; /***/ }), -/* 121 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -18531,7 +18691,7 @@ return si; /***/ }), -/* 122 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -18694,7 +18854,7 @@ return sk; /***/ }), -/* 123 */ +/* 124 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -18873,7 +19033,7 @@ return sl; /***/ }), -/* 124 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -18949,7 +19109,7 @@ return sq; /***/ }), -/* 125 */ +/* 126 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19066,7 +19226,7 @@ return sr; /***/ }), -/* 126 */ +/* 127 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19183,7 +19343,7 @@ return srCyrl; /***/ }), -/* 127 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19278,7 +19438,7 @@ return ss; /***/ }), -/* 128 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19353,7 +19513,7 @@ return sv; /***/ }), -/* 129 */ +/* 130 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19418,7 +19578,7 @@ return sw; /***/ }), -/* 130 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19554,7 +19714,7 @@ return ta; /***/ }), -/* 131 */ +/* 132 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19649,7 +19809,7 @@ return te; /***/ }), -/* 132 */ +/* 133 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19723,7 +19883,7 @@ return tet; /***/ }), -/* 133 */ +/* 134 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19796,7 +19956,7 @@ return th; /***/ }), -/* 134 */ +/* 135 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19864,7 +20024,7 @@ return tlPh; /***/ }), -/* 135 */ +/* 136 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -19992,7 +20152,7 @@ return tlh; /***/ }), -/* 136 */ +/* 137 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20088,7 +20248,7 @@ return tr; /***/ }), -/* 137 */ +/* 138 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20186,7 +20346,7 @@ return tzl; /***/ }), -/* 138 */ +/* 139 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20250,7 +20410,7 @@ return tzm; /***/ }), -/* 139 */ +/* 140 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20314,7 +20474,7 @@ return tzmLatn; /***/ }), -/* 140 */ +/* 141 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20472,7 +20632,7 @@ return uk; /***/ }), -/* 141 */ +/* 142 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20577,7 +20737,7 @@ return ur; /***/ }), -/* 142 */ +/* 143 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20641,7 +20801,7 @@ return uz; /***/ }), -/* 143 */ +/* 144 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20705,7 +20865,7 @@ return uzLatn; /***/ }), -/* 144 */ +/* 145 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20790,7 +20950,7 @@ return vi; /***/ }), -/* 145 */ +/* 146 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20864,7 +21024,7 @@ return xPseudo; /***/ }), -/* 146 */ +/* 147 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -20930,7 +21090,7 @@ return yo; /***/ }), -/* 147 */ +/* 148 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -21047,7 +21207,7 @@ return zhCn; /***/ }), -/* 148 */ +/* 149 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -21158,7 +21318,7 @@ return zhHk; /***/ }), -/* 149 */ +/* 150 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -21268,7 +21428,7 @@ return zhTw; /***/ }), -/* 150 */ +/* 151 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -21296,7 +21456,7 @@ function clone (obj) { /***/ }), -/* 151 */ +/* 152 */ /***/ (function(module, exports, __webpack_require__) { module.exports = normalize @@ -21341,13 +21501,13 @@ function ucFirst (string) { /***/ }), -/* 152 */ +/* 153 */ /***/ (function(module, exports) { module.exports = require("url"); /***/ }), -/* 153 */ +/* 154 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -21422,7 +21582,7 @@ Object.keys(gitHosts).forEach(function (name) { /***/ }), -/* 154 */ +/* 155 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -21484,7 +21644,7 @@ module.exports = (obj, opts) => { /***/ }), -/* 155 */ +/* 156 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -21574,7 +21734,7 @@ module.exports.sync = (input, opts) => { /***/ }), -/* 156 */ +/* 157 */ /***/ (function(module, exports, __webpack_require__) { var path = __webpack_require__(1); @@ -21678,7 +21838,7 @@ mkdirP.sync = function sync (p, opts, made) { /***/ }), -/* 157 */ +/* 158 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -21709,7 +21869,7 @@ let parallelizeBatches = exports.parallelizeBatches = (() => { function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } /***/ }), -/* 158 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -21786,7 +21946,7 @@ module.exports.sync = (patterns, opts) => { /***/ }), -/* 159 */ +/* 160 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -21796,7 +21956,7 @@ module.exports = typeof Promise === 'function' ? Promise : __webpack_require__(2 /***/ }), -/* 160 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -21809,7 +21969,7 @@ module.exports = function () { /***/ }), -/* 161 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -21906,7 +22066,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { /***/ }), -/* 162 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22029,7 +22189,7 @@ module.exports.supportsColor = supportsColor; /***/ }), -/* 163 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22040,7 +22200,7 @@ module.exports = function () { /***/ }), -/* 164 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22051,7 +22211,7 @@ module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), /***/ }), -/* 165 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22085,12 +22245,12 @@ function getProjectPaths(rootPath, options) { } /***/ }), -/* 166 */ +/* 167 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const NestedError = __webpack_require__(167); +const NestedError = __webpack_require__(168); class CpFileError extends NestedError { constructor(message, nested) { @@ -22104,7 +22264,7 @@ module.exports = CpFileError; /***/ }), -/* 167 */ +/* 168 */ /***/ (function(module, exports, __webpack_require__) { var inherits = __webpack_require__(23); @@ -22158,7 +22318,7 @@ module.exports = NestedError; /***/ }), -/* 168 */ +/* 169 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22168,7 +22328,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _cli = __webpack_require__(169); +var _cli = __webpack_require__(170); Object.defineProperty(exports, 'run', { enumerable: true, @@ -22185,8 +22345,14 @@ Object.defineProperty(exports, 'buildProductionProjects', { return _production.buildProductionProjects; } }); +Object.defineProperty(exports, 'prepareExternalProjectDependencies', { + enumerable: true, + get: function () { + return _production.prepareExternalProjectDependencies; + } +}); -var _package_json = __webpack_require__(18); +var _package_json = __webpack_require__(13); Object.defineProperty(exports, 'transformDependencies', { enumerable: true, @@ -22196,7 +22362,7 @@ Object.defineProperty(exports, 'transformDependencies', { }); /***/ }), -/* 169 */ +/* 170 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22253,11 +22419,11 @@ let run = exports.run = (() => { }; })(); -var _getopts = __webpack_require__(170); +var _getopts = __webpack_require__(171); var _getopts2 = _interopRequireDefault(_getopts); -var _dedent = __webpack_require__(171); +var _dedent = __webpack_require__(172); var _dedent2 = _interopRequireDefault(_dedent); @@ -22267,7 +22433,7 @@ var _chalk2 = _interopRequireDefault(_chalk); var _path = __webpack_require__(1); -var _commands = __webpack_require__(180); +var _commands = __webpack_require__(181); var commands = _interopRequireWildcard(_commands); @@ -22302,7 +22468,7 @@ function help() { } /***/ }), -/* 170 */ +/* 171 */ /***/ (function(module, exports) { const SHORTSPLIT = /$|[!-@\[-`{-~].*/g @@ -22470,7 +22636,7 @@ module.exports = function(argv, opts) { /***/ }), -/* 171 */ +/* 172 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22536,12 +22702,12 @@ if (true) { /***/ }), -/* 172 */ +/* 173 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) { -const colorConvert = __webpack_require__(173); +const colorConvert = __webpack_require__(174); const wrapAnsi16 = (fn, offset) => function () { const code = fn.apply(colorConvert, arguments); @@ -22696,11 +22862,11 @@ Object.defineProperty(module, 'exports', { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)(module))) /***/ }), -/* 173 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { var conversions = __webpack_require__(21); -var route = __webpack_require__(175); +var route = __webpack_require__(176); var convert = {}; @@ -22780,7 +22946,7 @@ module.exports = convert; /***/ }), -/* 174 */ +/* 175 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22939,7 +23105,7 @@ module.exports = { /***/ }), -/* 175 */ +/* 176 */ /***/ (function(module, exports, __webpack_require__) { var conversions = __webpack_require__(21); @@ -23042,13 +23208,13 @@ module.exports = function (fromModel) { /***/ }), -/* 176 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const os = __webpack_require__(177); -const hasFlag = __webpack_require__(178); +const os = __webpack_require__(178); +const hasFlag = __webpack_require__(179); const env = process.env; @@ -23164,13 +23330,13 @@ module.exports = process && support(supportLevel); /***/ }), -/* 177 */ +/* 178 */ /***/ (function(module, exports) { module.exports = require("os"); /***/ }), -/* 178 */ +/* 179 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -23187,7 +23353,7 @@ module.exports = function (flag, argv) { /***/ }), -/* 179 */ +/* 180 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -23322,7 +23488,7 @@ module.exports = (chalk, tmp) => { /***/ }), -/* 180 */ +/* 181 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -23333,7 +23499,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.run = exports.clean = exports.bootstrap = undefined; -var _bootstrap = __webpack_require__(181); +var _bootstrap = __webpack_require__(182); var bootstrap = _interopRequireWildcard(_bootstrap); @@ -23352,7 +23518,7 @@ exports.clean = clean; exports.run = run; /***/ }), -/* 181 */ +/* 182 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -23412,7 +23578,7 @@ var _projects = __webpack_require__(11); var _link_project_executables = __webpack_require__(262); -var _parallelize = __webpack_require__(157); +var _parallelize = __webpack_require__(158); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -23422,7 +23588,7 @@ const name = exports.name = 'bootstrap'; const description = exports.description = 'Install dependencies and crosslink projects'; /***/ }), -/* 182 */ +/* 183 */ /***/ (function(module, exports, __webpack_require__) { // Copyright Joyent, Inc. and other Node contributors. @@ -23731,11 +23897,11 @@ exports.realpath = function realpath(p, cache, cb) { /***/ }), -/* 183 */ +/* 184 */ /***/ (function(module, exports, __webpack_require__) { -var concatMap = __webpack_require__(184); -var balanced = __webpack_require__(185); +var concatMap = __webpack_require__(185); +var balanced = __webpack_require__(186); module.exports = expandTop; @@ -23938,7 +24104,7 @@ function expand(str, isTop) { /***/ }), -/* 184 */ +/* 185 */ /***/ (function(module, exports) { module.exports = function (xs, fn) { @@ -23957,7 +24123,7 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/* 185 */ +/* 186 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -24023,7 +24189,7 @@ function range(a, b, str) { /***/ }), -/* 186 */ +/* 187 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -24052,7 +24218,7 @@ if (typeof Object.create === 'function') { /***/ }), -/* 187 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { module.exports = globSync @@ -24060,13 +24226,13 @@ globSync.GlobSync = GlobSync var fs = __webpack_require__(2) var rp = __webpack_require__(22) -var minimatch = __webpack_require__(13) +var minimatch = __webpack_require__(14) var Minimatch = minimatch.Minimatch var Glob = __webpack_require__(7).Glob var util = __webpack_require__(3) var path = __webpack_require__(1) var assert = __webpack_require__(8) -var isAbsolute = __webpack_require__(14) +var isAbsolute = __webpack_require__(15) var common = __webpack_require__(24) var alphasort = common.alphasort var alphasorti = common.alphasorti @@ -24544,7 +24710,7 @@ GlobSync.prototype._makeAbs = function (f) { /***/ }), -/* 188 */ +/* 189 */ /***/ (function(module, exports, __webpack_require__) { var wrappy = __webpack_require__(25) @@ -24603,164 +24769,6 @@ function slice (args) { } -/***/ }), -/* 189 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Project = undefined; - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -var _path = __webpack_require__(1); - -var _path2 = _interopRequireDefault(_path); - -var _util = __webpack_require__(3); - -var _chalk = __webpack_require__(4); - -var _chalk2 = _interopRequireDefault(_chalk); - -var _scripts = __webpack_require__(190); - -var _package_json = __webpack_require__(18); - -var _errors = __webpack_require__(15); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - -const PREFIX = 'link:'; - -class Project { - static fromPath(path) { - return _asyncToGenerator(function* () { - const pkgJson = yield (0, _package_json.readPackageJson)(path); - return new Project(pkgJson, path); - })(); - } - - constructor(packageJson, projectPath) { - this.json = Object.freeze(packageJson); - this.path = projectPath; - - this.packageJsonLocation = _path2.default.resolve(this.path, 'package.json'); - this.nodeModulesLocation = _path2.default.resolve(this.path, 'node_modules'); - this.targetLocation = _path2.default.resolve(this.path, 'target'); - - this.allDependencies = _extends({}, this.json.devDependencies || {}, this.json.dependencies || {}); - - this.scripts = this.json.scripts || {}; - } - - get name() { - return this.json.name; - } - - ensureValidProjectDependency(project) { - const relativePathToProject = normalizePath(_path2.default.relative(this.path, project.path)); - - const versionInPackageJson = this.allDependencies[project.name]; - const expectedVersionInPackageJson = `${PREFIX}${relativePathToProject}`; - - if (versionInPackageJson === expectedVersionInPackageJson) { - return; - } - - const updateMsg = 'Update its package.json to the expected value below.'; - const meta = { - package: `${this.name} (${this.packageJsonLocation})`, - expected: `"${project.name}": "${expectedVersionInPackageJson}"`, - actual: `"${project.name}": "${versionInPackageJson}"` - }; - - if (versionInPackageJson.startsWith(PREFIX)) { - throw new _errors.CliError(`[${this.name}] depends on [${project.name}] using '${PREFIX}', but the path is wrong. ${updateMsg}`, meta); - } - - throw new _errors.CliError(`[${this.name}] depends on [${project.name}], but it's not using the local package. ${updateMsg}`, meta); - } - - skipFromBuild() { - const json = this.json; - return json.kibana && json.kibana.build && json.kibana.build.skip === true; - } - - hasScript(name) { - return name in this.scripts; - } - - getExecutables() { - const raw = this.json.bin; - - if (!raw) { - return {}; - } - - if (typeof raw === 'string') { - return { - [this.name]: _path2.default.resolve(this.path, raw) - }; - } - - if (typeof raw === 'object') { - const binsConfig = {}; - for (const binName of Object.keys(raw)) { - binsConfig[binName] = _path2.default.resolve(this.path, raw[binName]); - } - return binsConfig; - } - - throw new _errors.CliError(`[${this.name}] has an invalid "bin" field in its package.json, ` + `expected an object or a string`, { - package: `${this.name} (${this.packageJsonLocation})`, - binConfig: (0, _util.inspect)(raw) - }); - } - - runScript(scriptName, args = []) { - var _this = this; - - return _asyncToGenerator(function* () { - console.log(_chalk2.default.bold(`\n\nRunning script [${_chalk2.default.green(scriptName)}] in [${_chalk2.default.green(_this.name)}]:\n`)); - return (0, _scripts.runScriptInPackage)(scriptName, args, _this); - })(); - } - - runScriptStreaming(scriptName, args = []) { - var _this2 = this; - - return _asyncToGenerator(function* () { - return (0, _scripts.runScriptInPackageStreaming)(scriptName, args, _this2); - })(); - } - - hasDependencies() { - return Object.keys(this.allDependencies).length > 0; - } - - installDependencies({ extraArgs }) { - var _this3 = this; - - return _asyncToGenerator(function* () { - console.log(_chalk2.default.bold(`\n\nInstalling dependencies in [${_chalk2.default.green(_this3.name)}]:\n`)); - return (0, _scripts.installInDir)(_this3.path, extraArgs); - })(); - } -} - -exports.Project = Project; // We normalize all path separators to `/` in generated files - -function normalizePath(path) { - return path.replace(/[\\\/]+/g, '/'); -} - /***/ }), /* 190 */ /***/ (function(module, exports, __webpack_require__) { @@ -24890,7 +24898,7 @@ function spawnStreaming(command, args, opts, { prefix }) { "use strict"; -const childProcess = __webpack_require__(16); +const childProcess = __webpack_require__(17); const util = __webpack_require__(3); const crossSpawn = __webpack_require__(193); const stripEof = __webpack_require__(209); @@ -24898,7 +24906,7 @@ const npmRunPath = __webpack_require__(210); const isStream = __webpack_require__(212); const _getStream = __webpack_require__(213); const pFinally = __webpack_require__(215); -const onExit = __webpack_require__(17); +const onExit = __webpack_require__(18); const errname = __webpack_require__(217); const stdio = __webpack_require__(218); @@ -25212,7 +25220,7 @@ module.exports.spawn = util.deprecate(module.exports, 'execa.spawn() is deprecat "use strict"; -var cp = __webpack_require__(16); +var cp = __webpack_require__(17); var parse = __webpack_require__(194); var enoent = __webpack_require__(207); @@ -25278,9 +25286,9 @@ module.exports._enoent = enoent; "use strict"; -var resolveCommand = __webpack_require__(27); +var resolveCommand = __webpack_require__(28); var hasEmptyArgumentBug = __webpack_require__(202); -var escapeArgument = __webpack_require__(29); +var escapeArgument = __webpack_require__(30); var escapeCommand = __webpack_require__(203); var readShebang = __webpack_require__(204); @@ -26232,7 +26240,7 @@ module.exports = hasEmptyArgumentBug(); "use strict"; -var escapeArgument = __webpack_require__(29); +var escapeArgument = __webpack_require__(30); function escapeCommand(command) { // Do not escape if this command is not dangerous.. @@ -26252,7 +26260,7 @@ module.exports = escapeCommand; var fs = __webpack_require__(2); -var LRU = __webpack_require__(28); +var LRU = __webpack_require__(29); var shebangCommand = __webpack_require__(205); var shebangCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec @@ -26331,7 +26339,7 @@ module.exports = /^#!.*/; var isWin = process.platform === 'win32'; -var resolveCommand = __webpack_require__(27); +var resolveCommand = __webpack_require__(28); var isNode10 = process.version.indexOf('v0.10.') === 0; @@ -26410,7 +26418,7 @@ module.exports.notFoundError = notFoundError; "use strict"; -module.exports = __webpack_require__(16).spawnSync; +module.exports = __webpack_require__(17).spawnSync; /***/ }), @@ -26827,7 +26835,7 @@ module.exports = opts => { // This file is licensed under the Artistic License 2.0. // License text available at https://opensource.org/licenses/Artistic-2.0 -module.exports = __webpack_require__(30); +module.exports = __webpack_require__(31); module.exports.cli = __webpack_require__(225); @@ -27210,244 +27218,244 @@ function duplex(writer, reader) { /***/ (function(module, exports, __webpack_require__) { var map = { - "./af": 31, - "./af.js": 31, - "./ar": 32, - "./ar-dz": 33, - "./ar-dz.js": 33, - "./ar-kw": 34, - "./ar-kw.js": 34, - "./ar-ly": 35, - "./ar-ly.js": 35, - "./ar-ma": 36, - "./ar-ma.js": 36, - "./ar-sa": 37, - "./ar-sa.js": 37, - "./ar-tn": 38, - "./ar-tn.js": 38, - "./ar.js": 32, - "./az": 39, - "./az.js": 39, - "./be": 40, - "./be.js": 40, - "./bg": 41, - "./bg.js": 41, - "./bm": 42, - "./bm.js": 42, - "./bn": 43, - "./bn.js": 43, - "./bo": 44, - "./bo.js": 44, - "./br": 45, - "./br.js": 45, - "./bs": 46, - "./bs.js": 46, - "./ca": 47, - "./ca.js": 47, - "./cs": 48, - "./cs.js": 48, - "./cv": 49, - "./cv.js": 49, - "./cy": 50, - "./cy.js": 50, - "./da": 51, - "./da.js": 51, - "./de": 52, - "./de-at": 53, - "./de-at.js": 53, - "./de-ch": 54, - "./de-ch.js": 54, - "./de.js": 52, - "./dv": 55, - "./dv.js": 55, - "./el": 56, - "./el.js": 56, - "./en-au": 57, - "./en-au.js": 57, - "./en-ca": 58, - "./en-ca.js": 58, - "./en-gb": 59, - "./en-gb.js": 59, - "./en-ie": 60, - "./en-ie.js": 60, - "./en-nz": 61, - "./en-nz.js": 61, - "./eo": 62, - "./eo.js": 62, - "./es": 63, - "./es-do": 64, - "./es-do.js": 64, - "./es-us": 65, - "./es-us.js": 65, - "./es.js": 63, - "./et": 66, - "./et.js": 66, - "./eu": 67, - "./eu.js": 67, - "./fa": 68, - "./fa.js": 68, - "./fi": 69, - "./fi.js": 69, - "./fo": 70, - "./fo.js": 70, - "./fr": 71, - "./fr-ca": 72, - "./fr-ca.js": 72, - "./fr-ch": 73, - "./fr-ch.js": 73, - "./fr.js": 71, - "./fy": 74, - "./fy.js": 74, - "./gd": 75, - "./gd.js": 75, - "./gl": 76, - "./gl.js": 76, - "./gom-latn": 77, - "./gom-latn.js": 77, - "./gu": 78, - "./gu.js": 78, - "./he": 79, - "./he.js": 79, - "./hi": 80, - "./hi.js": 80, - "./hr": 81, - "./hr.js": 81, - "./hu": 82, - "./hu.js": 82, - "./hy-am": 83, - "./hy-am.js": 83, - "./id": 84, - "./id.js": 84, - "./is": 85, - "./is.js": 85, - "./it": 86, - "./it.js": 86, - "./ja": 87, - "./ja.js": 87, - "./jv": 88, - "./jv.js": 88, - "./ka": 89, - "./ka.js": 89, - "./kk": 90, - "./kk.js": 90, - "./km": 91, - "./km.js": 91, - "./kn": 92, - "./kn.js": 92, - "./ko": 93, - "./ko.js": 93, - "./ky": 94, - "./ky.js": 94, - "./lb": 95, - "./lb.js": 95, - "./lo": 96, - "./lo.js": 96, - "./lt": 97, - "./lt.js": 97, - "./lv": 98, - "./lv.js": 98, - "./me": 99, - "./me.js": 99, - "./mi": 100, - "./mi.js": 100, - "./mk": 101, - "./mk.js": 101, - "./ml": 102, - "./ml.js": 102, - "./mr": 103, - "./mr.js": 103, - "./ms": 104, - "./ms-my": 105, - "./ms-my.js": 105, - "./ms.js": 104, - "./mt": 106, - "./mt.js": 106, - "./my": 107, - "./my.js": 107, - "./nb": 108, - "./nb.js": 108, - "./ne": 109, - "./ne.js": 109, - "./nl": 110, - "./nl-be": 111, - "./nl-be.js": 111, - "./nl.js": 110, - "./nn": 112, - "./nn.js": 112, - "./pa-in": 113, - "./pa-in.js": 113, - "./pl": 114, - "./pl.js": 114, - "./pt": 115, - "./pt-br": 116, - "./pt-br.js": 116, - "./pt.js": 115, - "./ro": 117, - "./ro.js": 117, - "./ru": 118, - "./ru.js": 118, - "./sd": 119, - "./sd.js": 119, - "./se": 120, - "./se.js": 120, - "./si": 121, - "./si.js": 121, - "./sk": 122, - "./sk.js": 122, - "./sl": 123, - "./sl.js": 123, - "./sq": 124, - "./sq.js": 124, - "./sr": 125, - "./sr-cyrl": 126, - "./sr-cyrl.js": 126, - "./sr.js": 125, - "./ss": 127, - "./ss.js": 127, - "./sv": 128, - "./sv.js": 128, - "./sw": 129, - "./sw.js": 129, - "./ta": 130, - "./ta.js": 130, - "./te": 131, - "./te.js": 131, - "./tet": 132, - "./tet.js": 132, - "./th": 133, - "./th.js": 133, - "./tl-ph": 134, - "./tl-ph.js": 134, - "./tlh": 135, - "./tlh.js": 135, - "./tr": 136, - "./tr.js": 136, - "./tzl": 137, - "./tzl.js": 137, - "./tzm": 138, - "./tzm-latn": 139, - "./tzm-latn.js": 139, - "./tzm.js": 138, - "./uk": 140, - "./uk.js": 140, - "./ur": 141, - "./ur.js": 141, - "./uz": 142, - "./uz-latn": 143, - "./uz-latn.js": 143, - "./uz.js": 142, - "./vi": 144, - "./vi.js": 144, - "./x-pseudo": 145, - "./x-pseudo.js": 145, - "./yo": 146, - "./yo.js": 146, - "./zh-cn": 147, - "./zh-cn.js": 147, - "./zh-hk": 148, - "./zh-hk.js": 148, - "./zh-tw": 149, - "./zh-tw.js": 149 + "./af": 32, + "./af.js": 32, + "./ar": 33, + "./ar-dz": 34, + "./ar-dz.js": 34, + "./ar-kw": 35, + "./ar-kw.js": 35, + "./ar-ly": 36, + "./ar-ly.js": 36, + "./ar-ma": 37, + "./ar-ma.js": 37, + "./ar-sa": 38, + "./ar-sa.js": 38, + "./ar-tn": 39, + "./ar-tn.js": 39, + "./ar.js": 33, + "./az": 40, + "./az.js": 40, + "./be": 41, + "./be.js": 41, + "./bg": 42, + "./bg.js": 42, + "./bm": 43, + "./bm.js": 43, + "./bn": 44, + "./bn.js": 44, + "./bo": 45, + "./bo.js": 45, + "./br": 46, + "./br.js": 46, + "./bs": 47, + "./bs.js": 47, + "./ca": 48, + "./ca.js": 48, + "./cs": 49, + "./cs.js": 49, + "./cv": 50, + "./cv.js": 50, + "./cy": 51, + "./cy.js": 51, + "./da": 52, + "./da.js": 52, + "./de": 53, + "./de-at": 54, + "./de-at.js": 54, + "./de-ch": 55, + "./de-ch.js": 55, + "./de.js": 53, + "./dv": 56, + "./dv.js": 56, + "./el": 57, + "./el.js": 57, + "./en-au": 58, + "./en-au.js": 58, + "./en-ca": 59, + "./en-ca.js": 59, + "./en-gb": 60, + "./en-gb.js": 60, + "./en-ie": 61, + "./en-ie.js": 61, + "./en-nz": 62, + "./en-nz.js": 62, + "./eo": 63, + "./eo.js": 63, + "./es": 64, + "./es-do": 65, + "./es-do.js": 65, + "./es-us": 66, + "./es-us.js": 66, + "./es.js": 64, + "./et": 67, + "./et.js": 67, + "./eu": 68, + "./eu.js": 68, + "./fa": 69, + "./fa.js": 69, + "./fi": 70, + "./fi.js": 70, + "./fo": 71, + "./fo.js": 71, + "./fr": 72, + "./fr-ca": 73, + "./fr-ca.js": 73, + "./fr-ch": 74, + "./fr-ch.js": 74, + "./fr.js": 72, + "./fy": 75, + "./fy.js": 75, + "./gd": 76, + "./gd.js": 76, + "./gl": 77, + "./gl.js": 77, + "./gom-latn": 78, + "./gom-latn.js": 78, + "./gu": 79, + "./gu.js": 79, + "./he": 80, + "./he.js": 80, + "./hi": 81, + "./hi.js": 81, + "./hr": 82, + "./hr.js": 82, + "./hu": 83, + "./hu.js": 83, + "./hy-am": 84, + "./hy-am.js": 84, + "./id": 85, + "./id.js": 85, + "./is": 86, + "./is.js": 86, + "./it": 87, + "./it.js": 87, + "./ja": 88, + "./ja.js": 88, + "./jv": 89, + "./jv.js": 89, + "./ka": 90, + "./ka.js": 90, + "./kk": 91, + "./kk.js": 91, + "./km": 92, + "./km.js": 92, + "./kn": 93, + "./kn.js": 93, + "./ko": 94, + "./ko.js": 94, + "./ky": 95, + "./ky.js": 95, + "./lb": 96, + "./lb.js": 96, + "./lo": 97, + "./lo.js": 97, + "./lt": 98, + "./lt.js": 98, + "./lv": 99, + "./lv.js": 99, + "./me": 100, + "./me.js": 100, + "./mi": 101, + "./mi.js": 101, + "./mk": 102, + "./mk.js": 102, + "./ml": 103, + "./ml.js": 103, + "./mr": 104, + "./mr.js": 104, + "./ms": 105, + "./ms-my": 106, + "./ms-my.js": 106, + "./ms.js": 105, + "./mt": 107, + "./mt.js": 107, + "./my": 108, + "./my.js": 108, + "./nb": 109, + "./nb.js": 109, + "./ne": 110, + "./ne.js": 110, + "./nl": 111, + "./nl-be": 112, + "./nl-be.js": 112, + "./nl.js": 111, + "./nn": 113, + "./nn.js": 113, + "./pa-in": 114, + "./pa-in.js": 114, + "./pl": 115, + "./pl.js": 115, + "./pt": 116, + "./pt-br": 117, + "./pt-br.js": 117, + "./pt.js": 116, + "./ro": 118, + "./ro.js": 118, + "./ru": 119, + "./ru.js": 119, + "./sd": 120, + "./sd.js": 120, + "./se": 121, + "./se.js": 121, + "./si": 122, + "./si.js": 122, + "./sk": 123, + "./sk.js": 123, + "./sl": 124, + "./sl.js": 124, + "./sq": 125, + "./sq.js": 125, + "./sr": 126, + "./sr-cyrl": 127, + "./sr-cyrl.js": 127, + "./sr.js": 126, + "./ss": 128, + "./ss.js": 128, + "./sv": 129, + "./sv.js": 129, + "./sw": 130, + "./sw.js": 130, + "./ta": 131, + "./ta.js": 131, + "./te": 132, + "./te.js": 132, + "./tet": 133, + "./tet.js": 133, + "./th": 134, + "./th.js": 134, + "./tl-ph": 135, + "./tl-ph.js": 135, + "./tlh": 136, + "./tlh.js": 136, + "./tr": 137, + "./tr.js": 137, + "./tzl": 138, + "./tzl.js": 138, + "./tzm": 139, + "./tzm-latn": 140, + "./tzm-latn.js": 140, + "./tzm.js": 139, + "./uk": 141, + "./uk.js": 141, + "./ur": 142, + "./ur.js": 142, + "./uz": 143, + "./uz-latn": 144, + "./uz-latn.js": 144, + "./uz.js": 143, + "./vi": 145, + "./vi.js": 145, + "./x-pseudo": 146, + "./x-pseudo.js": 146, + "./yo": 147, + "./yo.js": 147, + "./zh-cn": 148, + "./zh-cn.js": 148, + "./zh-hk": 149, + "./zh-hk.js": 149, + "./zh-tw": 150, + "./zh-tw.js": 150 }; function webpackContext(req) { return __webpack_require__(webpackContextResolve(req)); @@ -27480,7 +27488,7 @@ webpackContext.id = 224; var minimist = __webpack_require__(226); var path = __webpack_require__(1); -var Logger = __webpack_require__(30); +var Logger = __webpack_require__(31); var pkg = __webpack_require__(227); module.exports = cli; @@ -27812,7 +27820,7 @@ module.exports = (fp, opts) => { }) .then(x => { if (opts.normalize !== false) { - __webpack_require__(151)(x); + __webpack_require__(152)(x); } return x; @@ -27831,7 +27839,7 @@ module.exports.sync = (fp, opts) => { const x = loadJsonFile.sync(fp); if (opts.normalize !== false) { - __webpack_require__(151)(x); + __webpack_require__(152)(x); } return x; @@ -27860,7 +27868,7 @@ module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'), fp); /* 232 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(150) +var fs = __webpack_require__(151) var constants = __webpack_require__(233) var origCwd = process.cwd @@ -28638,7 +28646,7 @@ var hostedGitInfo = __webpack_require__(248) var isBuiltinModule = __webpack_require__(250) var depTypes = ["dependencies","devDependencies","optionalDependencies"] var extractDescription = __webpack_require__(252) -var url = __webpack_require__(152) +var url = __webpack_require__(153) var typos = __webpack_require__(253) var fixer = module.exports = { @@ -32101,8 +32109,8 @@ module.exports = ["Glide","Abstyles","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AF "use strict"; -var url = __webpack_require__(152) -var gitHosts = __webpack_require__(153) +var url = __webpack_require__(153) +var gitHosts = __webpack_require__(154) var GitHost = module.exports = __webpack_require__(249) var protocolToRepresentationMap = { @@ -32229,7 +32237,7 @@ function parseGitUrl (giturl) { "use strict"; -var gitHosts = __webpack_require__(153) +var gitHosts = __webpack_require__(154) var extend = Object.assign || __webpack_require__(3)._extend var GitHost = module.exports = function (type, user, auth, project, committish, defaultRepresentation, opts) { @@ -32447,7 +32455,7 @@ module.exports = {"repositories":"'repositories' (plural) Not supported. Please const path = __webpack_require__(1); const writeJsonFile = __webpack_require__(257); -const sortKeys = __webpack_require__(154); +const sortKeys = __webpack_require__(155); const opts = {detectIndent: true}; @@ -32508,8 +32516,8 @@ module.exports.sync = (fp, data) => { const path = __webpack_require__(1); const fs = __webpack_require__(9); const writeFileAtomic = __webpack_require__(258); -const sortKeys = __webpack_require__(154); -const makeDir = __webpack_require__(155); +const sortKeys = __webpack_require__(155); +const makeDir = __webpack_require__(156); const pify = __webpack_require__(5); const detectIndent = __webpack_require__(261); @@ -32592,7 +32600,7 @@ module.exports._cleanupOnExit = cleanupOnExit var fs = __webpack_require__(9) var MurmurHash3 = __webpack_require__(259) -var onExit = __webpack_require__(17) +var onExit = __webpack_require__(18) var path = __webpack_require__(1) var activeFiles = {} @@ -33157,7 +33165,7 @@ cmdShim.ifExists = cmdShimIfExists var fs = __webpack_require__(9) -var mkdir = __webpack_require__(156) +var mkdir = __webpack_require__(157) , path = __webpack_require__(1) , shebangExpr = /^#\!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/ @@ -33367,7 +33375,7 @@ let run = exports.run = (() => { }; })(); -var _del = __webpack_require__(158); +var _del = __webpack_require__(159); var _del2 = _interopRequireDefault(_del); @@ -33396,9 +33404,9 @@ const description = exports.description = 'Remove the node_modules and target di "use strict"; -var Promise = __webpack_require__(159); -var arrayUnion = __webpack_require__(160); -var objectAssign = __webpack_require__(161); +var Promise = __webpack_require__(160); +var arrayUnion = __webpack_require__(161); +var objectAssign = __webpack_require__(162); var glob = __webpack_require__(7); var pify = __webpack_require__(268); @@ -34460,7 +34468,7 @@ module.exports = (iterable, mapper, opts) => new Promise((resolve, reject) => { "use strict"; -const chalk = __webpack_require__(162); +const chalk = __webpack_require__(163); const cliCursor = __webpack_require__(280); const cliSpinners = __webpack_require__(284); const logSymbols = __webpack_require__(286); @@ -34684,7 +34692,7 @@ Object.defineProperty(module, 'exports', { "use strict"; -var ansiRegex = __webpack_require__(163)(); +var ansiRegex = __webpack_require__(164)(); module.exports = function (str) { return typeof str === 'string' ? str.replace(ansiRegex, '') : str; @@ -34697,7 +34705,7 @@ module.exports = function (str) { "use strict"; -var ansiRegex = __webpack_require__(163); +var ansiRegex = __webpack_require__(164); var re = new RegExp(ansiRegex().source); // remove the `g` flag module.exports = re.test.bind(re); @@ -34812,7 +34820,7 @@ exports.toggle = (force, stream) => { "use strict"; const onetime = __webpack_require__(282); -const signalExit = __webpack_require__(17); +const signalExit = __webpack_require__(18); module.exports = onetime(() => { signalExit(() => { @@ -34902,7 +34910,7 @@ module.exports = {"dots":{"interval":80,"frames":["⠋","⠙","⠹","⠸","⠼", "use strict"; -var chalk = __webpack_require__(162); +var chalk = __webpack_require__(163); var main = { info: chalk.blue('ℹ'), @@ -34965,7 +34973,7 @@ var _chalk2 = _interopRequireDefault(_chalk); var _projects = __webpack_require__(11); -var _parallelize = __webpack_require__(157); +var _parallelize = __webpack_require__(158); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -35044,11 +35052,11 @@ var _indentString = __webpack_require__(293); var _indentString2 = _interopRequireDefault(_indentString); -var _errors = __webpack_require__(15); +var _errors = __webpack_require__(16); var _projects = __webpack_require__(11); -var _config = __webpack_require__(165); +var _config = __webpack_require__(166); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -35061,7 +35069,7 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a "use strict"; const stringWidth = __webpack_require__(290); -const stripAnsi = __webpack_require__(164); +const stripAnsi = __webpack_require__(165); const ESCAPES = new Set([ '\u001B', @@ -35260,7 +35268,7 @@ module.exports = (str, cols, opts) => { "use strict"; -const stripAnsi = __webpack_require__(164); +const stripAnsi = __webpack_require__(165); const isFullwidthCodePoint = __webpack_require__(292); module.exports = str => { @@ -35408,6 +35416,35 @@ module.exports = (str, count, opts) => { "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _build_production_projects = __webpack_require__(295); + +Object.defineProperty(exports, 'buildProductionProjects', { + enumerable: true, + get: function () { + return _build_production_projects.buildProductionProjects; + } +}); + +var _prepare_project_dependencies = __webpack_require__(306); + +Object.defineProperty(exports, 'prepareExternalProjectDependencies', { + enumerable: true, + get: function () { + return _prepare_project_dependencies.prepareExternalProjectDependencies; + } +}); + +/***/ }), +/* 295 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + Object.defineProperty(exports, "__esModule", { value: true }); @@ -35522,21 +35559,21 @@ let copyToBuild = (() => { }; })(); -var _del = __webpack_require__(158); +var _del = __webpack_require__(159); var _del2 = _interopRequireDefault(_del); var _path = __webpack_require__(1); -var _cpy = __webpack_require__(295); +var _cpy = __webpack_require__(296); var _cpy2 = _interopRequireDefault(_cpy); -var _config = __webpack_require__(165); +var _config = __webpack_require__(166); var _projects = __webpack_require__(11); -var _package_json = __webpack_require__(18); +var _package_json = __webpack_require__(13); var _fs = __webpack_require__(19); @@ -35545,17 +35582,17 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } /***/ }), -/* 295 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const EventEmitter = __webpack_require__(12); const path = __webpack_require__(1); -const arrify = __webpack_require__(296); -const globby = __webpack_require__(297); -const cpFile = __webpack_require__(299); -const CpyError = __webpack_require__(304); +const arrify = __webpack_require__(297); +const globby = __webpack_require__(298); +const cpFile = __webpack_require__(300); +const CpyError = __webpack_require__(305); const preprocessSrcPath = (srcPath, opts) => opts.cwd ? path.resolve(opts.cwd, srcPath) : srcPath; @@ -35649,7 +35686,7 @@ module.exports = (src, dest, opts) => { /***/ }), -/* 296 */ +/* 297 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35664,16 +35701,16 @@ module.exports = function (val) { /***/ }), -/* 297 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Promise = __webpack_require__(159); -var arrayUnion = __webpack_require__(160); -var objectAssign = __webpack_require__(161); +var Promise = __webpack_require__(160); +var arrayUnion = __webpack_require__(161); +var objectAssign = __webpack_require__(162); var glob = __webpack_require__(7); -var pify = __webpack_require__(298); +var pify = __webpack_require__(299); var globP = pify(glob, Promise).bind(glob); @@ -35759,7 +35796,7 @@ module.exports.hasMagic = function (patterns, opts) { /***/ }), -/* 298 */ +/* 299 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35834,17 +35871,17 @@ pify.all = pify; /***/ }), -/* 299 */ +/* 300 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const path = __webpack_require__(1); const fsConstants = __webpack_require__(2).constants; -const Buffer = __webpack_require__(300).Buffer; -const CpFileError = __webpack_require__(166); -const fs = __webpack_require__(302); -const ProgressEmitter = __webpack_require__(303); +const Buffer = __webpack_require__(301).Buffer; +const CpFileError = __webpack_require__(167); +const fs = __webpack_require__(303); +const ProgressEmitter = __webpack_require__(304); module.exports = (src, dest, opts) => { if (!src || !dest) { @@ -35994,11 +36031,11 @@ module.exports.sync = (src, dest, opts) => { /***/ }), -/* 300 */ +/* 301 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable node/no-deprecated-api */ -var buffer = __webpack_require__(301) +var buffer = __webpack_require__(302) var Buffer = buffer.Buffer // alternative to using Object.keys for old browsers @@ -36062,21 +36099,21 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ }), -/* 301 */ +/* 302 */ /***/ (function(module, exports) { module.exports = require("buffer"); /***/ }), -/* 302 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const fs = __webpack_require__(9); -const makeDir = __webpack_require__(155); +const makeDir = __webpack_require__(156); const pify = __webpack_require__(5); -const CpFileError = __webpack_require__(166); +const CpFileError = __webpack_require__(167); const fsP = pify(fs); @@ -36221,7 +36258,7 @@ if (fs.copyFileSync) { /***/ }), -/* 303 */ +/* 304 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36263,12 +36300,12 @@ module.exports = ProgressEmitter; /***/ }), -/* 304 */ +/* 305 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const NestedError = __webpack_require__(167); +const NestedError = __webpack_require__(168); class CpyError extends NestedError { constructor(message, nested) { @@ -36281,5 +36318,62 @@ class CpyError extends NestedError { module.exports = CpyError; +/***/ }), +/* 306 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.prepareExternalProjectDependencies = undefined; + +/** + * This prepares the dependencies for an _external_ project. + */ +let prepareExternalProjectDependencies = exports.prepareExternalProjectDependencies = (() => { + var _ref = _asyncToGenerator(function* (projectPath) { + const project = yield _project.Project.fromPath(projectPath); + + if (!project.hasDependencies()) { + return; + } + + const deps = project.allDependencies; + + for (const depName of Object.keys(deps)) { + const depVersion = deps[depName]; + + // Kibana currently only supports `link:` dependencies on Kibana's own + // packages, as these are packaged into the `node_modules` folder when + // Kibana is built, so we don't need to take any action to enable + // `require(...)` to resolve for these packages. + if ((0, _package_json.isLinkDependency)(depVersion) && !isKibanaDep(depVersion)) { + // For non-Kibana packages we need to set up symlinks during the + // installation process, but this is not something we support yet. + throw new Error('This plugin is using `link:` dependencies for non-Kibana packages'); + } + } + }); + + return function prepareExternalProjectDependencies(_x) { + return _ref.apply(this, arguments); + }; +})(); + +var _project = __webpack_require__(27); + +var _package_json = __webpack_require__(13); + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + +/** + * All external projects are located within `../kibana-extra/{plugin}` relative + * to Kibana itself. + */ +const isKibanaDep = depVersion => depVersion.includes('../../kibana/'); + /***/ }) /******/ ]); \ No newline at end of file diff --git a/packages/kbn-build/package.json b/packages/kbn-build/package.json index 78e12f429f375..6c14b2a68347f 100644 --- a/packages/kbn-build/package.json +++ b/packages/kbn-build/package.json @@ -1,10 +1,5 @@ { "name": "@kbn/build", - "kibana": { - "build": { - "skip": true - } - }, "main": "./dist/index.js", "version": "1.0.0", "license": "Apache-2.0", diff --git a/packages/kbn-build/src/index.js b/packages/kbn-build/src/index.js index 8ceb801dc93d2..1b13e8af46d78 100644 --- a/packages/kbn-build/src/index.js +++ b/packages/kbn-build/src/index.js @@ -1,3 +1,6 @@ export { run } from './cli'; -export { buildProductionProjects } from './production'; +export { + buildProductionProjects, + prepareExternalProjectDependencies, +} from './production'; export { transformDependencies } from './utils/package_json'; diff --git a/packages/kbn-build/src/production/__fixtures__/external_packages/with_kibana_link_deps/package.json b/packages/kbn-build/src/production/__fixtures__/external_packages/with_kibana_link_deps/package.json new file mode 100644 index 0000000000000..6466095ed5df1 --- /dev/null +++ b/packages/kbn-build/src/production/__fixtures__/external_packages/with_kibana_link_deps/package.json @@ -0,0 +1,7 @@ +{ + "name": "quux", + "version": "1.0.0", + "dependencies": { + "@kbn/foo": "link:../../kibana/packages/foo" + } +} diff --git a/packages/kbn-build/src/production/__fixtures__/external_packages/with_other_link_deps/package.json b/packages/kbn-build/src/production/__fixtures__/external_packages/with_other_link_deps/package.json new file mode 100644 index 0000000000000..e60f626e5234f --- /dev/null +++ b/packages/kbn-build/src/production/__fixtures__/external_packages/with_other_link_deps/package.json @@ -0,0 +1,7 @@ +{ + "name": "quux", + "version": "1.0.0", + "dependencies": { + "bar": "link:../foo/packages/bar" + } +} \ No newline at end of file diff --git a/packages/kbn-build/src/production/__tests__/index.js b/packages/kbn-build/src/production/__tests__/build_production_projects.js similarity index 95% rename from packages/kbn-build/src/production/__tests__/index.js rename to packages/kbn-build/src/production/__tests__/build_production_projects.js index f38fb1d7d0e63..5ec7d3ddee0ad 100644 --- a/packages/kbn-build/src/production/__tests__/index.js +++ b/packages/kbn-build/src/production/__tests__/build_production_projects.js @@ -4,7 +4,7 @@ import copy from 'cpy'; import { resolve } from 'path'; import globby from 'globby'; -import { buildProductionProjects } from '../'; +import { buildProductionProjects } from '../build_production_projects'; import { getProjects } from '../../utils/projects'; // This is specifically a Mocha test instead of a Jest test because it's slow diff --git a/packages/kbn-build/src/production/build_production_projects.js b/packages/kbn-build/src/production/build_production_projects.js new file mode 100644 index 0000000000000..bc069591e079e --- /dev/null +++ b/packages/kbn-build/src/production/build_production_projects.js @@ -0,0 +1,90 @@ +import del from 'del'; +import { relative, resolve } from 'path'; +import copy from 'cpy'; + +import { getProjectPaths } from '../config'; +import { + getProjects, + buildProjectGraph, + topologicallyBatchProjects, +} from '../utils/projects'; +import { + createProductionPackageJson, + writePackageJson, +} from '../utils/package_json'; +import { isDirectory } from '../utils/fs'; + +export async function buildProductionProjects({ kibanaRoot, buildRoot }) { + const projectPaths = getProjectPaths(kibanaRoot, { + 'skip-kibana': true, + 'skip-kibana-extra': true, + }); + + const projects = await getProductionProjects(kibanaRoot, projectPaths); + const projectGraph = buildProjectGraph(projects); + const batchedProjects = topologicallyBatchProjects(projects, projectGraph); + + const projectNames = [...projects.values()].map(project => project.name); + console.log(`Preparing production build for [${projectNames.join(', ')}]`); + + for (const batch of batchedProjects) { + for (const project of batch) { + await deleteTarget(project); + await buildProject(project); + await copyToBuild(project, kibanaRoot, buildRoot); + } + } +} + +/** + * Returns only the projects that should be built into the production bundle + */ +async function getProductionProjects(kibanaRoot, projectPaths) { + const projects = await getProjects(kibanaRoot, projectPaths); + + const buildProjects = new Map(); + for (const [name, project] of projects.entries()) { + if (!project.skipFromBuild()) { + buildProjects.set(name, project); + } + } + + return buildProjects; +} + +async function deleteTarget(project) { + const targetDir = project.targetLocation; + + if (await isDirectory(targetDir)) { + await del(targetDir, { force: true }); + } +} + +async function buildProject(project) { + if (project.hasScript('build')) { + await project.runScript('build'); + } +} + +async function copyToBuild(project, kibanaRoot, buildRoot) { + // We want the package to have the same relative location within the build + const relativeProjectPath = relative(kibanaRoot, project.path); + const buildProjectPath = resolve(buildRoot, relativeProjectPath); + + // When copying all the files into the build, we exclude `package.json` as we + // write a separate "production-ready" `package.json` below, and we exclude + // `node_modules` because we want the Kibana build to actually install all + // dependencies. The primary reason for allowing the Kibana build process to + // install the dependencies is that it will "dedupe" them, so we don't include + // unnecessary copies of dependencies. + await copy(['**/*', '!package.json', '!node_modules/**'], buildProjectPath, { + cwd: project.path, + parents: true, + nodir: true, + dot: true, + }); + + const packageJson = project.json; + const preparedPackageJson = createProductionPackageJson(packageJson); + await writePackageJson(buildProjectPath, preparedPackageJson); +} diff --git a/packages/kbn-build/src/production/index.js b/packages/kbn-build/src/production/index.js index bc069591e079e..fc69b957075b1 100644 --- a/packages/kbn-build/src/production/index.js +++ b/packages/kbn-build/src/production/index.js @@ -1,90 +1,4 @@ -import del from 'del'; -import { relative, resolve } from 'path'; -import copy from 'cpy'; - -import { getProjectPaths } from '../config'; -import { - getProjects, - buildProjectGraph, - topologicallyBatchProjects, -} from '../utils/projects'; -import { - createProductionPackageJson, - writePackageJson, -} from '../utils/package_json'; -import { isDirectory } from '../utils/fs'; - -export async function buildProductionProjects({ kibanaRoot, buildRoot }) { - const projectPaths = getProjectPaths(kibanaRoot, { - 'skip-kibana': true, - 'skip-kibana-extra': true, - }); - - const projects = await getProductionProjects(kibanaRoot, projectPaths); - const projectGraph = buildProjectGraph(projects); - const batchedProjects = topologicallyBatchProjects(projects, projectGraph); - - const projectNames = [...projects.values()].map(project => project.name); - console.log(`Preparing production build for [${projectNames.join(', ')}]`); - - for (const batch of batchedProjects) { - for (const project of batch) { - await deleteTarget(project); - await buildProject(project); - await copyToBuild(project, kibanaRoot, buildRoot); - } - } -} - -/** - * Returns only the projects that should be built into the production bundle - */ -async function getProductionProjects(kibanaRoot, projectPaths) { - const projects = await getProjects(kibanaRoot, projectPaths); - - const buildProjects = new Map(); - for (const [name, project] of projects.entries()) { - if (!project.skipFromBuild()) { - buildProjects.set(name, project); - } - } - - return buildProjects; -} - -async function deleteTarget(project) { - const targetDir = project.targetLocation; - - if (await isDirectory(targetDir)) { - await del(targetDir, { force: true }); - } -} - -async function buildProject(project) { - if (project.hasScript('build')) { - await project.runScript('build'); - } -} - -async function copyToBuild(project, kibanaRoot, buildRoot) { - // We want the package to have the same relative location within the build - const relativeProjectPath = relative(kibanaRoot, project.path); - const buildProjectPath = resolve(buildRoot, relativeProjectPath); - - // When copying all the files into the build, we exclude `package.json` as we - // write a separate "production-ready" `package.json` below, and we exclude - // `node_modules` because we want the Kibana build to actually install all - // dependencies. The primary reason for allowing the Kibana build process to - // install the dependencies is that it will "dedupe" them, so we don't include - // unnecessary copies of dependencies. - await copy(['**/*', '!package.json', '!node_modules/**'], buildProjectPath, { - cwd: project.path, - parents: true, - nodir: true, - dot: true, - }); - - const packageJson = project.json; - const preparedPackageJson = createProductionPackageJson(packageJson); - await writePackageJson(buildProjectPath, preparedPackageJson); -} +export { buildProductionProjects } from './build_production_projects'; +export { + prepareExternalProjectDependencies, +} from './prepare_project_dependencies'; diff --git a/packages/kbn-build/src/production/prepare_project_dependencies.js b/packages/kbn-build/src/production/prepare_project_dependencies.js new file mode 100644 index 0000000000000..56289d8a3e88d --- /dev/null +++ b/packages/kbn-build/src/production/prepare_project_dependencies.js @@ -0,0 +1,37 @@ +import { Project } from '../utils/project'; +import { isLinkDependency } from '../utils/package_json'; + +/** + * All external projects are located within `../kibana-extra/{plugin}` relative + * to Kibana itself. + */ +const isKibanaDep = depVersion => depVersion.includes('../../kibana/'); + +/** + * This prepares the dependencies for an _external_ project. + */ +export async function prepareExternalProjectDependencies(projectPath) { + const project = await Project.fromPath(projectPath); + + if (!project.hasDependencies()) { + return; + } + + const deps = project.allDependencies; + + for (const depName of Object.keys(deps)) { + const depVersion = deps[depName]; + + // Kibana currently only supports `link:` dependencies on Kibana's own + // packages, as these are packaged into the `node_modules` folder when + // Kibana is built, so we don't need to take any action to enable + // `require(...)` to resolve for these packages. + if (isLinkDependency(depVersion) && !isKibanaDep(depVersion)) { + // For non-Kibana packages we need to set up symlinks during the + // installation process, but this is not something we support yet. + throw new Error( + 'This plugin is using `link:` dependencies for non-Kibana packages' + ); + } + } +} diff --git a/packages/kbn-build/src/production/prepare_project_dependencies.test.js b/packages/kbn-build/src/production/prepare_project_dependencies.test.js new file mode 100644 index 0000000000000..04f1eeb84e331 --- /dev/null +++ b/packages/kbn-build/src/production/prepare_project_dependencies.test.js @@ -0,0 +1,23 @@ +import { resolve, join } from 'path'; + +import { prepareExternalProjectDependencies } from './prepare_project_dependencies'; + +const packagesFixtures = resolve(__dirname, '__fixtures__/external_packages'); + +test('does nothing when Kibana `link:` dependencies', async () => { + const projectPath = join(packagesFixtures, 'with_kibana_link_deps'); + + // We're checking for undefined, but we don't really care about what's + // returned, we only care about it resolving. + await expect( + prepareExternalProjectDependencies(projectPath) + ).resolves.toBeUndefined(); +}); + +test('throws if non-Kibana `link` dependencies', async () => { + const projectPath = join(packagesFixtures, 'with_other_link_deps'); + + await expect(prepareExternalProjectDependencies(projectPath)).rejects.toThrow( + 'This plugin is using `link:` dependencies for non-Kibana packages' + ); +}); diff --git a/packages/kbn-build/src/utils/__snapshots__/link_project_executables.test.js.snap b/packages/kbn-build/src/utils/__snapshots__/link_project_executables.test.js.snap index 0809f868283eb..a5315d0977b75 100644 --- a/packages/kbn-build/src/utils/__snapshots__/link_project_executables.test.js.snap +++ b/packages/kbn-build/src/utils/__snapshots__/link_project_executables.test.js.snap @@ -14,6 +14,7 @@ Object { ], ], "mkdirp": Array [], + "readFile": Array [], } `; @@ -58,6 +59,7 @@ Object { "/packages/kbn-build/src/utils/baz/node_modules/.bin", ], ], + "readFile": Array [], } `; diff --git a/packages/kbn-build/src/utils/fs.js b/packages/kbn-build/src/utils/fs.js index e071e2762fe1c..126d897f8189e 100644 --- a/packages/kbn-build/src/utils/fs.js +++ b/packages/kbn-build/src/utils/fs.js @@ -5,13 +5,14 @@ import cmdShimCb from 'cmd-shim'; import mkdirpCb from 'mkdirp'; const stat = promisify(fs.stat); +const readFile = promisify(fs.readFile); const unlink = promisify(fs.unlink); const symlink = promisify(fs.symlink); const chmod = promisify(fs.chmod); const cmdShim = promisify(cmdShimCb); const mkdirp = promisify(mkdirpCb); -export { chmod, mkdirp }; +export { chmod, mkdirp, readFile }; async function statTest(path, block) { try { diff --git a/packages/kbn-build/src/utils/package_json.js b/packages/kbn-build/src/utils/package_json.js index cf094daba30f2..df1c1a548c928 100644 --- a/packages/kbn-build/src/utils/package_json.js +++ b/packages/kbn-build/src/utils/package_json.js @@ -15,6 +15,8 @@ export const createProductionPackageJson = pkgJson => ({ dependencies: transformDependencies(pkgJson.dependencies), }); +export const isLinkDependency = depVersion => depVersion.startsWith('link:'); + /** * Replaces `link:` dependencies with `file:` dependencies. When installing * dependencies, these `file:` dependencies will be copied into `node_modules` @@ -28,7 +30,7 @@ export function transformDependencies(dependencies = {}) { const newDeps = {}; for (const name of Object.keys(dependencies)) { const depVersion = dependencies[name]; - if (depVersion.startsWith('link:')) { + if (isLinkDependency(depVersion)) { newDeps[name] = depVersion.replace('link:', 'file:'); } else { newDeps[name] = depVersion; diff --git a/packages/kbn-build/src/utils/project.js b/packages/kbn-build/src/utils/project.js index 193dceb9dc8c1..9ce8cdd1eaa80 100644 --- a/packages/kbn-build/src/utils/project.js +++ b/packages/kbn-build/src/utils/project.js @@ -7,11 +7,9 @@ import { runScriptInPackage, runScriptInPackageStreaming, } from './scripts'; -import { readPackageJson } from './package_json'; +import { readPackageJson, isLinkDependency } from './package_json'; import { CliError } from './errors'; -const PREFIX = 'link:'; - export class Project { static async fromPath(path) { const pkgJson = await readPackageJson(path); @@ -44,7 +42,7 @@ export class Project { ); const versionInPackageJson = this.allDependencies[project.name]; - const expectedVersionInPackageJson = `${PREFIX}${relativePathToProject}`; + const expectedVersionInPackageJson = `link:${relativePathToProject}`; if (versionInPackageJson === expectedVersionInPackageJson) { return; @@ -57,11 +55,11 @@ export class Project { actual: `"${project.name}": "${versionInPackageJson}"`, }; - if (versionInPackageJson.startsWith(PREFIX)) { + if (isLinkDependency(versionInPackageJson)) { throw new CliError( `[${this.name}] depends on [${ project.name - }] using '${PREFIX}', but the path is wrong. ${updateMsg}`, + }] using 'link:', but the path is wrong. ${updateMsg}`, meta ); } diff --git a/src/cli_plugin/install/install.js b/src/cli_plugin/install/install.js index 0c79f2f57c6e9..03bf9837d6794 100644 --- a/src/cli_plugin/install/install.js +++ b/src/cli_plugin/install/install.js @@ -6,6 +6,7 @@ import { extract, getPackData } from './pack'; import { renamePlugin } from './rename'; import { sync as rimrafSync } from 'rimraf'; import { existingInstall, rebuildCache, assertVersion } from './kibana'; +import { prepareExternalProjectDependencies } from '@kbn/build'; import mkdirp from 'mkdirp'; const mkdir = Promise.promisify(mkdirp); @@ -28,6 +29,8 @@ export default async function install(settings, logger) { assertVersion(settings); + await prepareExternalProjectDependencies(settings.workingPath); + await renamePlugin(settings.workingPath, path.join(settings.pluginDir, settings.plugins[0].name)); await rebuildCache(settings, logger);