mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
chore(NA): move into single pkg json (#80015)
* chore(NA): update gitignore to include first changes from moving into a single package.json * chore(NA): update gitignore * chore(NA): move all the dependencies into the single package.json and apply changes to bootstrap * chore(NA): fix types problems after the single package json * chore(NA): include code to find the dependencies used across the code * chore(NA): introduce pure lockfile for install dependencies on build * chore(NA): update clean task to not delete anything from xpack node_modules * chore(NA): update gitignore to remove development temporary rules * chore(NA): update notice file * chore(NA): update jest snapshots * chore(NA): fix whitelisted licenses to include a new specify form of an already included one * chore(NA): remove check lockfile symlinks from child projects * chore(NA): fix eslint and add missing declared deps on single pkg json * chore(NA): correctly update notice * chore(NA): fix failing jest test for storyshots.test.tsx * chore(NA): fix cypress multi reporter path * chore(NA): fix Project tests check * chore(NA): fix problem with logic to detect used dependes on oss build * chore(NA): include correct x-pack plugins dep discovery * chore(NA): discover entries under dynamic requires on vis_type_timelion * chore(NA): remove canvas * test(NA): fix jest unit tests * chore(NA): remove double react declaration from storyshot test file * chore(NA): try removing isOSS check * chore(NA): support for plugin development * chore(NA): update logic to fix unit tests and typechecking * chore(NA): support to run npm scripts in child kbn projects across all envs * chore(NA): support github checks reporter on x-pack and remove cpy types as the package correctly provides them * chore(NA): update cpy version * chore(NA): include last kbn pm changes * chore(NA): update style on build_production_projects.ts * chore(NA): remove any cast fom telemetry opt in stats * chore(NA): remove del and re-use rm -rf again Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
dfcf7fe686
commit
0eeaafa722
161 changed files with 14557 additions and 19767 deletions
|
@ -13,6 +13,7 @@
|
|||
/x-pack/build
|
||||
node_modules
|
||||
target
|
||||
snapshots.js
|
||||
|
||||
!/.eslintrc.js
|
||||
|
||||
|
@ -22,7 +23,6 @@ target
|
|||
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
|
||||
/src/plugins/vis_type_timelion/public/_generated_/**
|
||||
/x-pack/legacy/plugins/**/__tests__/fixtures/**
|
||||
/x-pack/plugins/apm/e2e/**/snapshots.js
|
||||
/x-pack/plugins/apm/e2e/tmp/*
|
||||
/x-pack/plugins/canvas/canvas_plugin
|
||||
/x-pack/plugins/canvas/shareable_runtime/build
|
||||
|
|
41
.eslintrc.js
41
.eslintrc.js
|
@ -447,6 +447,7 @@ module.exports = {
|
|||
{
|
||||
devDependencies: false,
|
||||
peerDependencies: true,
|
||||
packageDir: '.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -478,6 +479,7 @@ module.exports = {
|
|||
{
|
||||
devDependencies: true,
|
||||
peerDependencies: true,
|
||||
packageDir: '.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -732,22 +734,6 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* ML overrides
|
||||
*/
|
||||
{
|
||||
files: ['x-pack/plugins/ml/**/*.js'],
|
||||
rules: {
|
||||
'no-shadow': 'error',
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
packageDir: './x-pack',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Security Solution overrides
|
||||
*/
|
||||
|
@ -1149,16 +1135,11 @@ module.exports = {
|
|||
{
|
||||
devDependencies: true,
|
||||
peerDependencies: true,
|
||||
packageDir: '.',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['x-pack/plugins/canvas/storybook/**'],
|
||||
rules: {
|
||||
'import/no-extraneous-dependencies': 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['x-pack/plugins/canvas/canvas_plugin_src/**/*.js'],
|
||||
globals: { canvas: true, $: true },
|
||||
|
@ -1237,5 +1218,21 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Single package.json rules, it tells eslint to ignore the child package.json files
|
||||
* and look for dependencies declarations in the single and root level package.json
|
||||
*/
|
||||
{
|
||||
files: ['**/*.{js,mjs,ts,tsx}'],
|
||||
rules: {
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
packageDir: '.',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -56,6 +56,8 @@ npm-debug.log*
|
|||
# apm plugin
|
||||
/x-pack/plugins/apm/tsconfig.json
|
||||
apm.tsconfig.json
|
||||
## @cypress/snapshot from apm plugin
|
||||
snapshots.js
|
||||
|
||||
# release notes script output
|
||||
report.csv
|
||||
|
|
1
.yarnrc
1
.yarnrc
|
@ -1 +0,0 @@
|
|||
--ignore-workspace-root-check true
|
|
@ -26,6 +26,9 @@ This module was heavily inspired by the externals plugin that ships with webpack
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
|
||||
---
|
||||
This product has relied on ASTExplorer that is licensed under MIT.
|
||||
|
||||
---
|
||||
This product includes code that is based on Ace editor, which was available
|
||||
under a "BSD" license.
|
||||
|
|
521
package.json
521
package.json
|
@ -95,39 +95,23 @@
|
|||
"**/request": "^2.88.2",
|
||||
"**/typescript": "4.0.2"
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"x-pack",
|
||||
"x-pack/plugins/*",
|
||||
"x-pack/legacy/plugins/*",
|
||||
"examples/*",
|
||||
"test/plugin_functional/plugins/*",
|
||||
"test/interpreter_functional/plugins/*",
|
||||
"x-pack/test/functional_with_es_ssl/fixtures/plugins/*",
|
||||
"x-pack/test/plugin_api_integration/plugins/*"
|
||||
],
|
||||
"nohoist": [
|
||||
"**/@types/*",
|
||||
"**/@types/*/**",
|
||||
"**/grunt-*",
|
||||
"**/grunt-*/**",
|
||||
"x-pack/typescript",
|
||||
"@elastic/eui/rehype-react",
|
||||
"@elastic/eui/remark-parse",
|
||||
"@elastic/eui/remark-rehype",
|
||||
"@elastic/eui/remark-rehype/**",
|
||||
"@elastic/eui/unified"
|
||||
]
|
||||
"engines": {
|
||||
"node": "10.22.1",
|
||||
"yarn": "^1.21.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/datemath": "5.0.3",
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/runtime": "^7.11.2",
|
||||
"@elastic/datemath": "link:packages/elastic-datemath",
|
||||
"@elastic/elasticsearch": "7.10.0-rc.1",
|
||||
"@elastic/ems-client": "7.10.0",
|
||||
"@elastic/eui": "30.1.1",
|
||||
"@elastic/filesaver": "1.1.2",
|
||||
"@elastic/good": "8.1.1-kibana2",
|
||||
"@elastic/node-crypto": "1.2.1",
|
||||
"@elastic/numeral": "^2.5.0",
|
||||
"@elastic/request-crypto": "1.1.4",
|
||||
"@elastic/safer-lodash-set": "0.0.0",
|
||||
"@elastic/safer-lodash-set": "link:packages/elastic-safer-lodash-set",
|
||||
"@hapi/boom": "^7.4.11",
|
||||
"@hapi/cookie": "^10.1.2",
|
||||
"@hapi/good-squeeze": "5.2.1",
|
||||
|
@ -139,77 +123,171 @@
|
|||
"@hapi/statehood": "^6.1.2",
|
||||
"@hapi/vision": "^5.5.4",
|
||||
"@hapi/wreck": "^15.0.2",
|
||||
"@kbn/ace": "1.0.0",
|
||||
"@kbn/analytics": "1.0.0",
|
||||
"@kbn/apm-config-loader": "1.0.0",
|
||||
"@kbn/config": "1.0.0",
|
||||
"@kbn/config-schema": "1.0.0",
|
||||
"@kbn/i18n": "1.0.0",
|
||||
"@kbn/interpreter": "1.0.0",
|
||||
"@kbn/logging": "1.0.0",
|
||||
"@kbn/monaco": "1.0.0",
|
||||
"@kbn/std": "1.0.0",
|
||||
"@kbn/ui-framework": "1.0.0",
|
||||
"@kbn/ui-shared-deps": "1.0.0",
|
||||
"@kbn/ace": "link:packages/kbn-ace",
|
||||
"@kbn/analytics": "link:packages/kbn-analytics",
|
||||
"@kbn/apm-config-loader": "link:packages/kbn-apm-config-loader",
|
||||
"@kbn/config": "link:packages/kbn-config",
|
||||
"@kbn/config-schema": "link:packages/kbn-config-schema",
|
||||
"@kbn/i18n": "link:packages/kbn-i18n",
|
||||
"@kbn/interpreter": "link:packages/kbn-interpreter",
|
||||
"@kbn/logging": "link:packages/kbn-logging",
|
||||
"@kbn/monaco": "link:packages/kbn-monaco",
|
||||
"@kbn/std": "link:packages/kbn-std",
|
||||
"@kbn/ui-framework": "link:packages/kbn-ui-framework",
|
||||
"@kbn/ui-shared-deps": "link:packages/kbn-ui-shared-deps",
|
||||
"@kbn/utils": "link:packages/kbn-utils",
|
||||
"@slack/webhook": "^5.0.0",
|
||||
"@storybook/addons": "^6.0.16",
|
||||
"@turf/circle": "6.0.1",
|
||||
"@types/pdfmake": "^0.1.15",
|
||||
"@types/yauzl": "^2.9.1",
|
||||
"JSONStream": "1.3.5",
|
||||
"abort-controller": "^3.0.0",
|
||||
"abortcontroller-polyfill": "^1.4.0",
|
||||
"accept": "3.0.2",
|
||||
"ajv": "^6.12.4",
|
||||
"angular": "^1.8.0",
|
||||
"angular-elastic": "^2.5.1",
|
||||
"angular-resource": "1.8.0",
|
||||
"angular-sanitize": "^1.8.0",
|
||||
"angular-ui-ace": "0.2.3",
|
||||
"apollo-cache-inmemory": "1.6.2",
|
||||
"apollo-client": "^2.3.8",
|
||||
"apollo-link-http": "^1.5.16",
|
||||
"apollo-link-http-common": "^0.2.15",
|
||||
"apollo-link-schema": "^1.1.0",
|
||||
"apollo-server-core": "^1.3.6",
|
||||
"apollo-server-errors": "^2.0.2",
|
||||
"apollo-server-hapi": "^1.3.6",
|
||||
"apollo-server-module-graphiql": "^1.3.4",
|
||||
"archiver": "^3.1.1",
|
||||
"axios": "^0.19.2",
|
||||
"bluebird": "3.5.5",
|
||||
"brace": "0.11.1",
|
||||
"chalk": "^4.1.0",
|
||||
"check-disk-space": "^2.1.0",
|
||||
"cheerio": "0.22.0",
|
||||
"chokidar": "^3.4.2",
|
||||
"chroma-js": "^1.4.1",
|
||||
"classnames": "2.2.6",
|
||||
"color": "1.0.3",
|
||||
"commander": "^3.0.2",
|
||||
"compression-webpack-plugin": "^4.0.0",
|
||||
"concat-stream": "1.6.2",
|
||||
"content-disposition": "0.5.3",
|
||||
"core-js": "^3.6.5",
|
||||
"custom-event-polyfill": "^0.3.0",
|
||||
"cypress-promise": "^1.1.0",
|
||||
"cytoscape": "^3.10.0",
|
||||
"cytoscape-dagre": "^2.2.2",
|
||||
"d3-array": "1.2.4",
|
||||
"d3-shape": "^1.1.0",
|
||||
"d3-time": "^1.1.0",
|
||||
"dedent": "^0.7.0",
|
||||
"deep-freeze-strict": "^1.1.1",
|
||||
"del": "^5.1.0",
|
||||
"elastic-apm-node": "^3.7.0",
|
||||
"elasticsearch": "^16.7.0",
|
||||
"execa": "^4.0.2",
|
||||
"exit-hook": "^2.2.0",
|
||||
"expiry-js": "0.1.7",
|
||||
"extract-zip": "^2.0.1",
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"file-type": "^10.9.0",
|
||||
"focus-trap-react": "^3.1.1",
|
||||
"font-awesome": "4.7.0",
|
||||
"fp-ts": "^2.3.1",
|
||||
"geojson-vt": "^3.2.1",
|
||||
"get-port": "^5.0.0",
|
||||
"getopts": "^2.2.5",
|
||||
"getos": "^3.1.0",
|
||||
"git-url-parse": "11.1.2",
|
||||
"github-markdown-css": "^2.10.0",
|
||||
"glob": "^7.1.2",
|
||||
"glob-all": "^3.2.1",
|
||||
"globby": "^8.0.1",
|
||||
"graphql": "^0.13.2",
|
||||
"graphql-fields": "^1.0.2",
|
||||
"graphql-tag": "^2.10.3",
|
||||
"graphql-tools": "^3.0.2",
|
||||
"handlebars": "4.7.6",
|
||||
"history": "^4.9.0",
|
||||
"hjson": "3.2.1",
|
||||
"http-proxy-agent": "^2.1.0",
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"idx": "^2.5.6",
|
||||
"immer": "^1.5.0",
|
||||
"inline-style": "^2.0.0",
|
||||
"intl": "^1.2.5",
|
||||
"intl-format-cache": "^2.1.0",
|
||||
"intl-messageformat": "^2.2.0",
|
||||
"intl-relativeformat": "^2.1.0",
|
||||
"io-ts": "^2.0.5",
|
||||
"isbinaryfile": "4.0.2",
|
||||
"joi": "^13.5.2",
|
||||
"jquery": "^3.5.0",
|
||||
"js-yaml": "^3.14.0",
|
||||
"json-stable-stringify": "^1.0.1",
|
||||
"json-stringify-safe": "5.0.1",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"load-json-file": "^6.2.0",
|
||||
"lodash": "^4.17.20",
|
||||
"lru-cache": "^4.1.5",
|
||||
"markdown-it": "^10.0.0",
|
||||
"md5": "^2.1.0",
|
||||
"mime": "^2.4.4",
|
||||
"mini-css-extract-plugin": "0.8.0",
|
||||
"minimatch": "^3.0.4",
|
||||
"moment": "^2.24.0",
|
||||
"moment-duration-format": "^2.3.2",
|
||||
"moment-timezone": "^0.5.27",
|
||||
"monaco-editor": "~0.17.0",
|
||||
"mustache": "^2.3.2",
|
||||
"ngreact": "^0.5.1",
|
||||
"nock": "12.0.3",
|
||||
"node-fetch": "^2.6.1",
|
||||
"node-forge": "^0.10.0",
|
||||
"nodemailer": "^4.7.0",
|
||||
"normalize-path": "^3.0.0",
|
||||
"object-hash": "^1.3.1",
|
||||
"object-path-immutable": "^3.1.1",
|
||||
"opn": "^5.5.0",
|
||||
"oppsy": "^2.0.0",
|
||||
"p-map": "^4.0.0",
|
||||
"p-retry": "^4.2.0",
|
||||
"papaparse": "^5.2.0",
|
||||
"pdfmake": "^0.1.65",
|
||||
"pegjs": "0.10.0",
|
||||
"pngjs": "^3.4.0",
|
||||
"podium": "^3.1.2",
|
||||
"prop-types": "^15.7.2",
|
||||
"proper-lockfile": "^3.2.0",
|
||||
"proxy-from-env": "1.0.0",
|
||||
"puid": "1.0.7",
|
||||
"puppeteer": "^2.1.1",
|
||||
"puppeteer-core": "^1.19.0",
|
||||
"query-string": "^6.13.2",
|
||||
"raw-loader": "^3.1.0",
|
||||
"re2": "^1.15.4",
|
||||
"react": "^16.12.0",
|
||||
"react-ace": "^5.9.0",
|
||||
"react-color": "^2.13.8",
|
||||
"react-datetime": "^2.14.0",
|
||||
"react-dom": "^16.12.0",
|
||||
"react-input-range": "^1.3.0",
|
||||
"react-intl": "^2.8.0",
|
||||
"react-is": "^16.8.0",
|
||||
"react-moment-proptypes": "^1.7.0",
|
||||
"react-portal": "^3.2.0",
|
||||
"react-redux": "^7.2.0",
|
||||
"react-resizable": "^1.7.5",
|
||||
"react-router": "^5.2.0",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-use": "^13.27.0",
|
||||
"recompose": "^0.26.0",
|
||||
"redux": "^4.0.5",
|
||||
"redux-actions": "^2.6.5",
|
||||
"redux-observable": "^1.2.0",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"regenerator-runtime": "^0.13.3",
|
||||
"request": "^2.88.0",
|
||||
|
@ -218,55 +296,102 @@
|
|||
"rxjs": "^6.5.5",
|
||||
"seedrandom": "^3.0.5",
|
||||
"semver": "^5.7.0",
|
||||
"set-value": "^3.0.2",
|
||||
"source-map-support": "^0.5.19",
|
||||
"squel": "^5.13.0",
|
||||
"statehood": "6.0.6",
|
||||
"stats-lite": "^2.2.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"style-it": "^2.1.3",
|
||||
"styled-components": "^5.1.0",
|
||||
"symbol-observable": "^1.2.0",
|
||||
"tabbable": "1.1.3",
|
||||
"tar": "4.4.13",
|
||||
"tinygradient": "0.4.3",
|
||||
"tinymath": "1.2.1",
|
||||
"tree-kill": "^1.2.2",
|
||||
"ts-easing": "^0.2.0",
|
||||
"tslib": "^2.0.0",
|
||||
"type-detect": "^4.0.8",
|
||||
"ui-select": "0.19.8",
|
||||
"utility-types": "^3.10.0",
|
||||
"uuid": "3.3.2",
|
||||
"vinyl": "^2.2.0",
|
||||
"vscode-languageserver": "^5.2.1",
|
||||
"vt-pbf": "^3.1.1",
|
||||
"webpack": "^4.41.5",
|
||||
"wellknown": "^0.5.0",
|
||||
"whatwg-fetch": "^3.0.0",
|
||||
"xml2js": "^0.4.22",
|
||||
"xregexp": "4.2.4",
|
||||
"yauzl": "^2.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/cli": "^7.10.5",
|
||||
"@babel/parser": "^7.11.2",
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.10.4",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
|
||||
"@babel/plugin-proposal-private-methods": "^7.10.4",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
|
||||
"@babel/plugin-transform-runtime": "^7.11.0",
|
||||
"@babel/preset-env": "^7.11.0",
|
||||
"@babel/preset-react": "^7.10.4",
|
||||
"@babel/preset-typescript": "^7.10.4",
|
||||
"@babel/register": "^7.10.5",
|
||||
"@babel/traverse": "^7.11.5",
|
||||
"@babel/types": "^7.11.0",
|
||||
"@cypress/snapshot": "^2.1.3",
|
||||
"@cypress/webpack-preprocessor": "^5.4.1",
|
||||
"@elastic/apm-rum": "^5.6.1",
|
||||
"@elastic/apm-rum-react": "^1.2.5",
|
||||
"@elastic/charts": "24.0.0",
|
||||
"@elastic/ems-client": "7.10.0",
|
||||
"@elastic/eslint-config-kibana": "0.15.0",
|
||||
"@elastic/eslint-config-kibana": "link:packages/elastic-eslint-config-kibana",
|
||||
"@elastic/eslint-plugin-eui": "0.0.2",
|
||||
"@elastic/filesaver": "1.1.2",
|
||||
"@elastic/github-checks-reporter": "0.0.20b3",
|
||||
"@elastic/makelogs": "^6.0.0",
|
||||
"@elastic/maki": "6.3.0",
|
||||
"@elastic/ui-ace": "0.2.3",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/es": "1.0.0",
|
||||
"@kbn/es-archiver": "1.0.0",
|
||||
"@kbn/eslint-import-resolver-kibana": "2.0.0",
|
||||
"@kbn/eslint-plugin-eslint": "1.0.0",
|
||||
"@kbn/expect": "1.0.0",
|
||||
"@kbn/optimizer": "1.0.0",
|
||||
"@kbn/plugin-generator": "1.0.0",
|
||||
"@kbn/pm": "1.0.0",
|
||||
"@kbn/release-notes": "1.0.0",
|
||||
"@kbn/telemetry-tools": "1.0.0",
|
||||
"@kbn/test": "1.0.0",
|
||||
"@kbn/test-subj-selector": "0.2.1",
|
||||
"@kbn/utility-types": "1.0.0",
|
||||
"@hapi/hapi": "^18.4.1",
|
||||
"@istanbuljs/schema": "^0.1.2",
|
||||
"@jest/reporters": "^26.5.2",
|
||||
"@kbn/babel-code-parser": "link:packages/kbn-babel-code-parser",
|
||||
"@kbn/babel-preset": "link:packages/kbn-babel-preset",
|
||||
"@kbn/dev-utils": "link:packages/kbn-dev-utils",
|
||||
"@kbn/es": "link:packages/kbn-es",
|
||||
"@kbn/es-archiver": "link:packages/kbn-es-archiver",
|
||||
"@kbn/eslint-import-resolver-kibana": "link:packages/kbn-eslint-import-resolver-kibana",
|
||||
"@kbn/eslint-plugin-eslint": "link:packages/kbn-eslint-plugin-eslint",
|
||||
"@kbn/expect": "link:packages/kbn-expect",
|
||||
"@kbn/optimizer": "link:packages/kbn-optimizer",
|
||||
"@kbn/plugin-generator": "link:packages/kbn-plugin-generator",
|
||||
"@kbn/pm": "link:packages/kbn-pm",
|
||||
"@kbn/release-notes": "link:packages/kbn-release-notes",
|
||||
"@kbn/plugin-helpers": "link:packages/kbn-plugin-helpers",
|
||||
"@kbn/telemetry-tools": "link:packages/kbn-telemetry-tools",
|
||||
"@kbn/test": "link:packages/kbn-test",
|
||||
"@kbn/test-subj-selector": "link:packages/kbn-test-subj-selector",
|
||||
"@kbn/utility-types": "link:packages/kbn-utility-types",
|
||||
"@kbn/storybook": "link:packages/kbn-storybook",
|
||||
"@mapbox/geojson-rewind": "^0.5.0",
|
||||
"@mapbox/mapbox-gl-draw": "^1.2.0",
|
||||
"@mapbox/mapbox-gl-rtl-text": "^0.2.3",
|
||||
"@microsoft/api-documenter": "7.7.2",
|
||||
"@microsoft/api-extractor": "7.7.0",
|
||||
"@octokit/rest": "^16.35.0",
|
||||
"@percy/agent": "^0.26.0",
|
||||
"@scant/router": "^0.1.0",
|
||||
"@storybook/addon-a11y": "^6.0.26",
|
||||
"@storybook/addon-actions": "^6.0.26",
|
||||
"@storybook/addon-essentials": "^6.0.26",
|
||||
"@storybook/addon-knobs": "^6.0.26",
|
||||
"@storybook/addon-storyshots": "^6.0.26",
|
||||
"@storybook/components": "^6.0.26",
|
||||
"@storybook/core": "^6.0.26",
|
||||
"@storybook/core-events": "^6.0.26",
|
||||
"@storybook/node-logger": "^6.0.26",
|
||||
"@storybook/react": "^6.0.26",
|
||||
"@storybook/theming": "^6.0.26",
|
||||
"@testing-library/dom": "^7.24.2",
|
||||
|
@ -274,128 +399,234 @@
|
|||
"@testing-library/react": "^11.0.4",
|
||||
"@testing-library/react-hooks": "^3.4.1",
|
||||
"@testing-library/user-event": "^12.1.6",
|
||||
"@turf/bbox": "6.0.1",
|
||||
"@turf/bbox-polygon": "6.0.1",
|
||||
"@turf/boolean-contains": "6.0.1",
|
||||
"@turf/distance": "6.0.1",
|
||||
"@turf/helpers": "6.0.1",
|
||||
"@types/accept": "3.1.1",
|
||||
"@types/angular": "^1.6.56",
|
||||
"@types/angular-mocks": "^1.7.0",
|
||||
"@types/archiver": "^3.1.0",
|
||||
"@types/babel__core": "^7.1.10",
|
||||
"@types/base64-js": "^1.2.5",
|
||||
"@types/bluebird": "^3.1.1",
|
||||
"@types/chance": "^1.0.0",
|
||||
"@types/cheerio": "^0.22.10",
|
||||
"@types/chroma-js": "^1.4.2",
|
||||
"@types/chromedriver": "^81.0.0",
|
||||
"@types/classnames": "^2.2.9",
|
||||
"@types/cmd-shim": "^2.0.0",
|
||||
"@types/color": "^3.0.0",
|
||||
"@types/compression-webpack-plugin": "^2.0.2",
|
||||
"@types/console-stamp": "^0.2.32",
|
||||
"@types/cypress-cucumber-preprocessor": "^1.14.1",
|
||||
"@types/cytoscape": "^3.14.0",
|
||||
"@types/d3": "^3.5.43",
|
||||
"@types/d3-array": "^1.2.7",
|
||||
"@types/d3-scale": "^2.1.1",
|
||||
"@types/d3-shape": "^1.3.1",
|
||||
"@types/d3-time": "^1.0.10",
|
||||
"@types/d3-time-format": "^2.1.1",
|
||||
"@types/dedent": "^0.7.0",
|
||||
"@types/deep-freeze-strict": "^1.1.0",
|
||||
"@types/delete-empty": "^2.0.0",
|
||||
"@types/ejs": "^3.0.4",
|
||||
"@types/elasticsearch": "^5.0.33",
|
||||
"@types/enzyme": "^3.10.5",
|
||||
"@types/eslint": "^6.1.3",
|
||||
"@types/extract-zip": "^1.6.2",
|
||||
"@types/fancy-log": "^1.3.1",
|
||||
"@types/fetch-mock": "^7.3.1",
|
||||
"@types/file-saver": "^2.0.0",
|
||||
"@types/flot": "^0.0.31",
|
||||
"@types/geojson": "7946.0.7",
|
||||
"@types/getopts": "^2.0.1",
|
||||
"@types/getos": "^3.0.0",
|
||||
"@types/git-url-parse": "^9.0.0",
|
||||
"@types/glob": "^7.1.2",
|
||||
"@types/globby": "^8.0.0",
|
||||
"@types/graphql": "^0.13.2",
|
||||
"@types/hapi__boom": "^7.4.1",
|
||||
"@types/hapi__cookie": "^10.1.1",
|
||||
"@types/hapi__h2o2": "8.3.0",
|
||||
"@types/hapi": "^17.0.18", "@types/hapi__cookie": "^10.1.1",
|
||||
"@types/hapi-auth-cookie": "^9.1.0", "@types/hapi__h2o2": "8.3.0",
|
||||
"@types/hapi__hapi": "^18.2.6",
|
||||
"@types/hapi__hoek": "^6.2.0",
|
||||
"@types/hapi__inert": "^5.2.1",
|
||||
"@types/hapi__podium": "^3.4.1",
|
||||
"@types/gulp": "^4.0.6",
|
||||
"@types/gulp-zip": "^4.0.1",
|
||||
"@types/hapi__wreck": "^15.0.1",
|
||||
"@types/has-ansi": "^3.0.0",
|
||||
"@types/he": "^1.1.1",
|
||||
"@types/history": "^4.7.3",
|
||||
"@types/hjson": "^2.4.2",
|
||||
"@types/hoist-non-react-statics": "^3.3.1",
|
||||
"@types/http-proxy": "^1.17.4",
|
||||
"@types/http-proxy-agent": "^2.0.2",
|
||||
"@types/inquirer": "^7.3.1",
|
||||
"@types/intl-relativeformat": "^2.1.0",
|
||||
"@types/jest": "^26.0.14",
|
||||
"@types/jest-specific-snapshot": "^0.5.4",
|
||||
"@types/jest-when": "^2.7.1",
|
||||
"@types/joi": "^13.4.2",
|
||||
"@types/jquery": "^3.3.31",
|
||||
"@types/js-search": "^1.4.0",
|
||||
"@types/js-yaml": "^3.11.1",
|
||||
"@types/jsdom": "^16.2.3",
|
||||
"@types/json-stable-stringify": "^1.0.32",
|
||||
"@types/json5": "^0.0.30",
|
||||
"@types/jsonwebtoken": "^7.2.8",
|
||||
"@types/license-checker": "15.0.0",
|
||||
"@types/listr": "^0.14.0",
|
||||
"@types/loader-utils": "^1.1.3",
|
||||
"@types/lodash": "^4.14.159",
|
||||
"@types/log-symbols": "^2.0.0",
|
||||
"@types/lru-cache": "^5.1.0",
|
||||
"@types/mapbox-gl": "^1.9.1",
|
||||
"@types/markdown-it": "^0.0.7",
|
||||
"@types/md5": "^2.2.0",
|
||||
"@types/memoize-one": "^4.1.0",
|
||||
"@types/mime": "^2.0.1",
|
||||
"@types/minimatch": "^2.0.29",
|
||||
"@types/mocha": "^7.0.2",
|
||||
"@types/mock-fs": "^4.10.0",
|
||||
"@types/moment-timezone": "^0.5.12",
|
||||
"@types/mustache": "^0.8.31",
|
||||
"@types/ncp": "^2.0.1",
|
||||
"@types/nock": "^10.0.3",
|
||||
"@types/node": ">=10.17.17 <10.20.0",
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@types/node-forge": "^0.9.5",
|
||||
"@types/nodemailer": "^6.2.1",
|
||||
"@types/normalize-path": "^3.0.0",
|
||||
"@types/object-hash": "^1.3.0",
|
||||
"@types/opn": "^5.1.0",
|
||||
"@types/ora": "^1.3.5",
|
||||
"@types/papaparse": "^5.0.3",
|
||||
"@types/parse-link-header": "^1.0.0",
|
||||
"@types/pegjs": "^0.10.1",
|
||||
"@types/pngjs": "^3.4.0",
|
||||
"@types/prettier": "^2.0.2",
|
||||
"@types/pretty-ms": "^5.0.0",
|
||||
"@types/prop-types": "^15.7.3",
|
||||
"@types/proper-lockfile": "^3.0.1",
|
||||
"@types/puppeteer": "^1.20.1",
|
||||
"@types/rbush": "^3.0.0",
|
||||
"@types/reach__router": "^1.2.6",
|
||||
"@types/react": "^16.9.36",
|
||||
"@types/react-beautiful-dnd": "^13.0.0",
|
||||
"@types/react-dom": "^16.9.8",
|
||||
"@types/react-grid-layout": "^0.16.7",
|
||||
"@types/react-intl": "^2.3.15",
|
||||
"@types/react-redux": "^7.1.9",
|
||||
"@types/react-resize-detector": "^4.0.1",
|
||||
"@types/react-router": "^5.1.7",
|
||||
"@types/react-router-dom": "^5.1.5",
|
||||
"@types/react-sticky": "^6.0.3",
|
||||
"@types/react-test-renderer": "^16.9.1",
|
||||
"@types/react-virtualized": "^9.18.7",
|
||||
"@types/read-pkg": "^4.0.0",
|
||||
"@types/recompose": "^0.30.6",
|
||||
"@types/reduce-reducers": "^1.0.0",
|
||||
"@types/redux-actions": "^2.6.1",
|
||||
"@types/request": "^2.48.2",
|
||||
"@types/seedrandom": ">=2.0.0 <4.0.0",
|
||||
"@types/selenium-webdriver": "^4.0.9",
|
||||
"@types/semver": "^5.5.0",
|
||||
"@types/set-value": "^2.0.0",
|
||||
"@types/sinon": "^7.0.13",
|
||||
"@types/source-map-support": "^0.5.3",
|
||||
"@types/stats-lite": "^2.2.0",
|
||||
"@types/strip-ansi": "^5.2.1",
|
||||
"@types/strong-log-transformer": "^1.0.0",
|
||||
"@types/styled-components": "^5.1.0",
|
||||
"@types/supertest": "^2.0.5",
|
||||
"@types/supertest-as-promised": "^2.0.38",
|
||||
"@types/tapable": "^1.0.6",
|
||||
"@types/tar": "^4.0.3",
|
||||
"@types/tar-fs": "^1.16.1",
|
||||
"@types/tempy": "^0.2.0",
|
||||
"@types/testing-library__jest-dom": "^5.9.3",
|
||||
"@types/testing-library__react-hooks": "^3.4.0",
|
||||
"@types/tinycolor2": "^1.4.1",
|
||||
"@types/type-detect": "^4.0.1",
|
||||
"@types/use-resize-observer": "^6.0.0",
|
||||
"@types/uuid": "^3.4.4",
|
||||
"@types/vinyl": "^2.0.4",
|
||||
"@types/vinyl-fs": "^2.4.11",
|
||||
"@types/watchpack": "^1.1.5",
|
||||
"@types/webpack": "^4.41.3",
|
||||
"@types/webpack-env": "^1.15.2",
|
||||
"@types/webpack-merge": "^4.1.5",
|
||||
"@types/write-pkg": "^3.1.0",
|
||||
"@types/xml-crypto": "^1.4.1",
|
||||
"@types/xml2js": "^0.4.5",
|
||||
"@types/zen-observable": "^0.8.0",
|
||||
"@typescript-eslint/eslint-plugin": "^3.10.0",
|
||||
"@typescript-eslint/parser": "^3.10.0",
|
||||
"@welldone-software/why-did-you-render": "^4.0.0",
|
||||
"@yarnpkg/lockfile": "^1.1.0",
|
||||
"abab": "^1.0.4",
|
||||
"angular-aria": "^1.8.0",
|
||||
"angular-mocks": "^1.7.9",
|
||||
"angular-recursion": "^1.0.5",
|
||||
"angular-route": "^1.8.0",
|
||||
"angular-sortable-view": "^0.0.17",
|
||||
"archiver": "^3.1.1",
|
||||
"apidoc": "^0.20.1",
|
||||
"apidoc-markdown": "^5.0.0",
|
||||
"apollo-link": "^1.2.3",
|
||||
"apollo-link-error": "^1.1.7",
|
||||
"apollo-link-state": "^0.4.1",
|
||||
"autoprefixer": "^9.7.4",
|
||||
"axe-core": "^4.0.2",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"babel-jest": "^26.3.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-plugin-add-module-exports": "^1.0.2",
|
||||
"babel-plugin-istanbul": "^6.0.0",
|
||||
"babel-plugin-require-context-hook": "npm:babel-plugin-require-context-hook-babel7@1.0.0",
|
||||
"babel-plugin-styled-components": "^1.10.7",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
||||
"backport": "5.6.0",
|
||||
"brace": "0.11.1",
|
||||
"base64-js": "^1.3.1",
|
||||
"base64url": "^3.0.1",
|
||||
"broadcast-channel": "^3.0.3",
|
||||
"chai": "3.5.0",
|
||||
"chance": "1.0.18",
|
||||
"cheerio": "0.22.0",
|
||||
"chromedriver": "^86.0.0",
|
||||
"classnames": "2.2.6",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"cmd-shim": "^2.1.0",
|
||||
"compare-versions": "3.5.1",
|
||||
"console-stamp": "^0.2.9",
|
||||
"constate": "^1.3.2",
|
||||
"copy-to-clipboard": "^3.0.8",
|
||||
"copy-webpack-plugin": "^6.0.2",
|
||||
"cpy": "^8.1.1",
|
||||
"cronstrue": "^1.51.0",
|
||||
"css-loader": "^3.4.2",
|
||||
"cypress": "^5.4.0",
|
||||
"cypress-cucumber-preprocessor": "^2.5.2",
|
||||
"cypress-multi-reporters": "^1.2.3",
|
||||
"d3": "3.5.17",
|
||||
"d3-cloud": "1.2.5",
|
||||
"dedent": "^0.7.0",
|
||||
"d3-scale": "1.0.7",
|
||||
"debug": "^2.6.9",
|
||||
"deepmerge": "^4.2.2",
|
||||
"del-cli": "^3.0.1",
|
||||
"delete-empty": "^2.0.0",
|
||||
"dependency-check": "^4.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"ejs": "^3.1.5",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.2",
|
||||
"enzyme-adapter-utils": "^1.13.0",
|
||||
"enzyme-to-json": "^3.4.4",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-import-resolver-node": "0.3.2",
|
||||
"eslint-import-resolver-webpack": "0.11.1",
|
||||
"eslint-module-utils": "2.5.0",
|
||||
"eslint-plugin-babel": "^5.3.0",
|
||||
"eslint-plugin-ban": "^1.4.0",
|
||||
"eslint-plugin-cypress": "^2.8.1",
|
||||
|
@ -411,37 +642,76 @@
|
|||
"eslint-plugin-react": "^7.20.3",
|
||||
"eslint-plugin-react-hooks": "^4.0.4",
|
||||
"eslint-plugin-react-perf": "^3.2.3",
|
||||
"exit-hook": "^2.2.0",
|
||||
"expose-loader": "^0.7.5",
|
||||
"faker": "1.1.0",
|
||||
"fancy-log": "^1.3.2",
|
||||
"fast-glob": "2.2.7",
|
||||
"fetch-mock": "^7.3.9",
|
||||
"fp-ts": "^2.3.1",
|
||||
"file-loader": "^4.2.0",
|
||||
"file-saver": "^1.3.8",
|
||||
"formsy-react": "^1.1.5",
|
||||
"geckodriver": "^1.20.0",
|
||||
"getopts": "^2.2.5",
|
||||
"glob-watcher": "5.0.3",
|
||||
"graphql-code-generator": "^0.18.2",
|
||||
"graphql-codegen-add": "^0.18.2",
|
||||
"graphql-codegen-introspection": "^0.18.2",
|
||||
"graphql-codegen-typescript-client": "^0.18.2",
|
||||
"graphql-codegen-typescript-common": "^0.18.2",
|
||||
"graphql-codegen-typescript-resolvers": "^0.18.2",
|
||||
"graphql-codegen-typescript-server": "^0.18.2",
|
||||
"grunt": "1.0.4",
|
||||
"grunt-available-tasks": "^0.6.3",
|
||||
"grunt-babel": "^8.0.0",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-contrib-clean": "^1.1.0",
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-peg": "^2.0.1",
|
||||
"grunt-run": "0.8.1",
|
||||
"gulp": "4.0.2",
|
||||
"gulp-babel": "^8.0.0",
|
||||
"gulp-sourcemaps": "2.6.5",
|
||||
"gulp-zip": "^5.0.2",
|
||||
"has-ansi": "^3.0.0",
|
||||
"history": "^4.9.0",
|
||||
"hdr-histogram-js": "^1.2.0",
|
||||
"he": "^1.2.0",
|
||||
"highlight.js": "9.15.10",
|
||||
"history-extra": "^5.0.1",
|
||||
"hoist-non-react-statics": "^3.3.2",
|
||||
"html": "1.0.0",
|
||||
"html-loader": "^0.5.5",
|
||||
"http-proxy": "^1.18.1",
|
||||
"i18n-iso-countries": "^4.3.1",
|
||||
"icalendar": "0.7.1",
|
||||
"iedriver": "^3.14.2",
|
||||
"immer": "^1.5.0",
|
||||
"imports-loader": "^0.8.0",
|
||||
"inquirer": "^7.3.3",
|
||||
"intl-messageformat-parser": "^1.4.0",
|
||||
"is-glob": "^4.0.1",
|
||||
"is-path-inside": "^3.0.2",
|
||||
"istanbul-instrumenter-loader": "^3.0.1",
|
||||
"jest": "^26.4.2",
|
||||
"jest-canvas-mock": "^2.2.0",
|
||||
"jest-circus": "^26.4.2",
|
||||
"jest-cli": "^26.4.2",
|
||||
"jest-diff": "^26.4.2",
|
||||
"jest-environment-jsdom-thirteen": "^1.0.1",
|
||||
"jest-raw-loader": "^1.0.1",
|
||||
"jest-silent-reporter": "^0.2.1",
|
||||
"jest-snapshot": "^26.4.2",
|
||||
"jest-specific-snapshot": "2.0.0",
|
||||
"jest-styled-components": "^7.0.2",
|
||||
"jest-when": "^2.7.2",
|
||||
"jimp": "^0.14.0",
|
||||
"jquery": "^3.5.0",
|
||||
"js-levenshtein": "^1.1.6",
|
||||
"js-search": "^1.4.3",
|
||||
"jsdom": "13.1.0",
|
||||
"json-stringify-pretty-compact": "1.2.0",
|
||||
"json5": "^1.0.1",
|
||||
"jsondiffpatch": "0.4.1",
|
||||
"jsts": "^1.6.2",
|
||||
"kea": "^2.2.0",
|
||||
"keymirror": "0.1.1",
|
||||
"leaflet": "1.5.1",
|
||||
"leaflet-draw": "0.4.14",
|
||||
"leaflet-responsive-popup": "0.6.4",
|
||||
|
@ -450,64 +720,135 @@
|
|||
"less": "npm:@elastic/less@2.7.3-kibana",
|
||||
"license-checker": "^16.0.0",
|
||||
"listr": "^0.14.1",
|
||||
"lmdb-store": "^0.6.10",
|
||||
"load-grunt-config": "^3.0.1",
|
||||
"load-json-file": "^6.2.0",
|
||||
"markdown-it": "^10.0.0",
|
||||
"loader-utils": "^1.2.3",
|
||||
"log-symbols": "^2.2.0",
|
||||
"lz-string": "^1.4.4",
|
||||
"madge": "3.4.4",
|
||||
"mapbox-gl": "^1.12.0",
|
||||
"mapbox-gl-draw-rectangle-mode": "^1.0.4",
|
||||
"marge": "^1.0.1",
|
||||
"memoize-one": "^5.0.0",
|
||||
"micromatch": "3.1.10",
|
||||
"minimist": "^1.2.5",
|
||||
"mkdirp": "0.5.1",
|
||||
"mocha": "^7.1.1",
|
||||
"mocha-junit-reporter": "^1.23.1",
|
||||
"mochawesome": "^4.1.0",
|
||||
"mochawesome-merge": "^4.1.0",
|
||||
"mock-fs": "^4.12.0",
|
||||
"mock-http-server": "1.3.0",
|
||||
"monaco-editor": "~0.17.0",
|
||||
"ms-chromium-edge-driver": "^0.2.3",
|
||||
"multimatch": "^4.0.0",
|
||||
"multistream": "^2.1.1",
|
||||
"murmurhash3js": "3.0.1",
|
||||
"mutation-observer": "^1.0.3",
|
||||
"ngreact": "^0.5.1",
|
||||
"nock": "12.0.3",
|
||||
"normalize-path": "^3.0.0",
|
||||
"ncp": "^2.0.0",
|
||||
"node-sass": "^4.13.1",
|
||||
"null-loader": "^3.0.0",
|
||||
"nyc": "^15.0.1",
|
||||
"oboe": "^2.1.4",
|
||||
"ora": "^4.0.4",
|
||||
"p-limit": "^3.0.1",
|
||||
"parse-link-header": "^1.0.1",
|
||||
"pirates": "^4.0.1",
|
||||
"pixelmatch": "^5.1.0",
|
||||
"pkg-up": "^2.0.0",
|
||||
"pngjs": "^3.4.0",
|
||||
"pluralize": "3.1.0",
|
||||
"polished": "^1.9.2",
|
||||
"postcss": "^7.0.32",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"postcss-prefix-selector": "^1.7.2",
|
||||
"prettier": "^2.1.1",
|
||||
"prop-types": "^15.7.2",
|
||||
"pretty-ms": "5.0.0",
|
||||
"proxyquire": "1.8.0",
|
||||
"querystring": "^0.2.0",
|
||||
"rbush": "^3.0.1",
|
||||
"re-resizable": "^6.1.1",
|
||||
"react-apollo": "^2.1.4",
|
||||
"react-beautiful-dnd": "^13.0.0",
|
||||
"react-docgen-typescript-loader": "^3.1.1",
|
||||
"react-dropzone": "^4.2.9",
|
||||
"react-fast-compare": "^2.0.4",
|
||||
"react-grid-layout": "^0.16.2",
|
||||
"react-markdown": "^4.3.1",
|
||||
"react-monaco-editor": "~0.27.0",
|
||||
"react-popper-tooltip": "^2.10.1",
|
||||
"react-redux": "^7.2.0",
|
||||
"react-resize-detector": "^4.2.0",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-reverse-portal": "^1.0.4",
|
||||
"react-router-redux": "^4.0.8",
|
||||
"react-shortcuts": "^2.0.0",
|
||||
"react-sizeme": "^2.3.6",
|
||||
"react-sticky": "^6.0.3",
|
||||
"react-syntax-highlighter": "^5.7.0",
|
||||
"react-test-renderer": "^16.12.0",
|
||||
"react-tiny-virtual-list": "^2.2.0",
|
||||
"react-virtualized": "^9.21.2",
|
||||
"react-vis": "^1.8.1",
|
||||
"react-visibility-sensor": "^5.1.1",
|
||||
"reactcss": "1.2.3",
|
||||
"redux": "^4.0.5",
|
||||
"read-pkg": "^5.2.0",
|
||||
"reduce-reducers": "^1.0.4",
|
||||
"redux-devtools-extension": "^2.13.8",
|
||||
"redux-saga": "^1.1.3",
|
||||
"redux-thunks": "^1.0.0",
|
||||
"regenerate": "^1.4.0",
|
||||
"reselect": "^4.0.0",
|
||||
"resize-observer-polyfill": "^1.5.0",
|
||||
"resolve": "^1.7.1",
|
||||
"rxjs-marbles": "^5.0.6",
|
||||
"sass-lint": "^1.12.1",
|
||||
"sass-loader": "^8.0.2",
|
||||
"sass-resources-loader": "^2.0.1",
|
||||
"selenium-webdriver": "^4.0.0-alpha.7",
|
||||
"serve-static": "1.14.1",
|
||||
"shelljs": "^0.8.3",
|
||||
"simple-git": "1.116.0",
|
||||
"sinon": "^7.4.2",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"spawn-sync": "^1.0.15",
|
||||
"string-replace-loader": "^2.2.0",
|
||||
"strong-log-transformer": "^2.1.0",
|
||||
"style-loader": "^1.1.3",
|
||||
"superagent": "^3.8.2",
|
||||
"supertest": "^3.1.0",
|
||||
"supertest-as-promised": "^4.0.2",
|
||||
"supports-color": "^7.0.0",
|
||||
"suricata-sid-db": "^1.0.2",
|
||||
"tape": "^5.0.1",
|
||||
"tar-fs": "^2.1.0",
|
||||
"tempy": "^0.3.0",
|
||||
"terminal-link": "^2.1.1",
|
||||
"terser-webpack-plugin": "^2.1.2",
|
||||
"tinycolor2": "1.4.1",
|
||||
"topojson-client": "3.0.0",
|
||||
"tree-kill": "^1.2.2",
|
||||
"ts-loader": "^7.0.5",
|
||||
"tsd": "^0.13.1",
|
||||
"typescript": "4.0.2",
|
||||
"ui-select": "0.19.8",
|
||||
"typescript-fsa": "^3.0.0",
|
||||
"typescript-fsa-reducers": "^1.2.1",
|
||||
"unlazy-loader": "^0.1.3",
|
||||
"unstated": "^2.1.1",
|
||||
"url-loader": "^2.2.0",
|
||||
"use-resize-observer": "^6.0.0",
|
||||
"val-loader": "^1.1.1",
|
||||
"vega": "^5.17.0",
|
||||
"vega-lite": "^4.17.0",
|
||||
"vega-schema-url-parser": "^2.1.0",
|
||||
"vega-tooltip": "^0.24.2",
|
||||
"venn.js": "0.2.20",
|
||||
"vinyl-fs": "^3.0.3",
|
||||
"xml2js": "^0.4.22",
|
||||
"wait-on": "^5.0.1",
|
||||
"watchpack": "^1.6.0",
|
||||
"webpack-cli": "^3.3.10",
|
||||
"webpack-dev-server": "^3.8.2",
|
||||
"webpack-merge": "^4.2.2",
|
||||
"write-pkg": "^4.0.0",
|
||||
"xml-crypto": "^2.0.0",
|
||||
"xmlbuilder": "13.0.2",
|
||||
"yargs": "^15.4.1",
|
||||
"yeoman-generator": "1.1.1",
|
||||
"yo": "2.0.6",
|
||||
"zlib": "^1.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "10.22.1",
|
||||
"yarn": "^1.21.1"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,8 +4,5 @@
|
|||
"description": "elasticsearch datemath parser, used in kibana",
|
||||
"license": "Apache-2.0",
|
||||
"main": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"peerDependencies": {
|
||||
"moment": "^2.24.0"
|
||||
}
|
||||
}
|
||||
"typings": "index.d.ts"
|
||||
}
|
|
@ -16,22 +16,5 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/elastic/kibana/tree/master/packages/elastic-eslint-config-kibana"
|
||||
},
|
||||
"homepage": "https://github.com/elastic/kibana/tree/master/packages/elastic-eslint-config-kibana",
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^3.10.0",
|
||||
"@typescript-eslint/parser": "^3.10.0",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-babel": "^5.3.0",
|
||||
"eslint-plugin-ban": "^1.4.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-import": "^2.19.1",
|
||||
"eslint-plugin-jest": "^24.0.2",
|
||||
"eslint-plugin-mocha": "^6.2.2",
|
||||
"eslint-plugin-no-unsanitized": "^3.0.2",
|
||||
"eslint-plugin-prefer-object-spread": "^1.2.1",
|
||||
"eslint-plugin-react": "^7.17.0",
|
||||
"eslint-plugin-react-hooks": "^4.0.4"
|
||||
}
|
||||
}
|
||||
"homepage": "https://github.com/elastic/kibana/tree/master/packages/elastic-eslint-config-kibana"
|
||||
}
|
|
@ -4,19 +4,10 @@
|
|||
"description": "A safer version of the lodash set and setWith functions",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"dependency-check": "^4.1.0",
|
||||
"tape": "^5.0.1",
|
||||
"tsd": "^0.13.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"lodash": "4.x"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "dependency-check --no-dev package.json set.js setWith.js fp/*.js",
|
||||
"test": "npm run lint && tape test/*.js && npm run test:types",
|
||||
"test:types": "tsc --noEmit",
|
||||
"lint": "../../node_modules/.bin/dependency-check --missing ../../package.json ./packages/elastic-safer-lodash-set/set.js ./packages/elastic-safer-lodash-set/setWith.js ./packages/elastic-safer-lodash-set/fp/*.js",
|
||||
"test": "npm run lint && ../../node_modules/.bin/tape test/*.js && npm run test:types",
|
||||
"test:types": "../../node_modules/.bin/tsc --noEmit",
|
||||
"update": "./scripts/update.sh",
|
||||
"save_state": "./scripts/save_state.sh"
|
||||
},
|
||||
|
@ -43,4 +34,4 @@
|
|||
"/lodash/"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,13 +8,8 @@
|
|||
"build": "node ./scripts/build.js",
|
||||
"kbn:bootstrap": "yarn build --dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"brace": "0.11.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"raw-loader": "^3.1.0",
|
||||
"typescript": "4.0.2"
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils",
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -14,9 +14,7 @@
|
|||
"kbn:watch": "node scripts/build --source-maps --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.10.5",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"typescript": "4.0.2"
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils",
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,18 +6,12 @@
|
|||
"license": "Apache-2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "../../node_modules/.bin/tsc",
|
||||
"kbn:bootstrap": "yarn build",
|
||||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/safer-lodash-set": "0.0.0",
|
||||
"@kbn/utils": "1.0.0",
|
||||
"js-yaml": "^3.14.0",
|
||||
"lodash": "^4.17.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "4.0.2",
|
||||
"tsd": "^0.13.1"
|
||||
"@elastic/safer-lodash-set": "link:../elastic-safer-lodash-set",
|
||||
"@kbn/utils": "link:../kbn-utils"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
3
packages/kbn-babel-code-parser/.babelrc
Normal file
3
packages/kbn-babel-code-parser/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"presets": ["@kbn/babel-preset/node_preset"]
|
||||
}
|
19
packages/kbn-babel-code-parser/README.md
Executable file
19
packages/kbn-babel-code-parser/README.md
Executable file
|
@ -0,0 +1,19 @@
|
|||
# @kbn/babel-code-parser
|
||||
|
||||
Simple abstraction over the `@babel/parser` and the `@babel/traverse` in order
|
||||
to build a code parser on top.
|
||||
|
||||
We have two main functions `parseSingleFile` (sync and sync version) and the
|
||||
`parseEntries` (only async version). The first one just parse one entry file
|
||||
and the second one parses recursively all the files from a list of
|
||||
start entry points.
|
||||
|
||||
Then we have `visitors` and `strategies`. The first ones are basically the
|
||||
`visitors` to use into the ast from the `@babel/traverse`. They are the only
|
||||
way to collect info when using the `parseSingleFile`. The `strategies` are
|
||||
meant to be used with the `parseEntries` and configures the info we want
|
||||
to collect from our parsed code. After each loop, one per entry file, the
|
||||
`parseEntries` method will call the given `strategy` expecting that
|
||||
`strategy` would call the desired visitors, assemble the important
|
||||
information to collect and adds them to the final results.
|
||||
|
20
packages/kbn-babel-code-parser/package.json
Executable file
20
packages/kbn-babel-code-parser/package.json
Executable file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "@kbn/babel-code-parser",
|
||||
"description": "babel code parser for Kibana",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "./target/index.js",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/elastic/kibana/tree/master/packages/kbn-babel-code-parser"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "../../node_modules/.bin/babel src --out-dir target",
|
||||
"kbn:bootstrap": "yarn build --quiet",
|
||||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset"
|
||||
}
|
||||
}
|
34
packages/kbn-babel-code-parser/src/can_require.js
Normal file
34
packages/kbn-babel-code-parser/src/can_require.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export function canRequire(cwd, entry) {
|
||||
try {
|
||||
// We will try to test if we can resolve
|
||||
// this entry through the require.resolve
|
||||
// setting as the start looking path the
|
||||
// given cwd. Require.resolve will keep
|
||||
// looking recursively as normal starting
|
||||
// from that location.
|
||||
return require.resolve(entry, {
|
||||
paths: [cwd],
|
||||
});
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
105
packages/kbn-babel-code-parser/src/code_parser.js
Normal file
105
packages/kbn-babel-code-parser/src/code_parser.js
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { canRequire } from './can_require';
|
||||
import { readFile, readFileSync } from 'fs';
|
||||
import { extname } from 'path';
|
||||
import { promisify } from 'util';
|
||||
import * as parser from '@babel/parser';
|
||||
import traverse from '@babel/traverse';
|
||||
import * as babelParserOptions from '@kbn/babel-preset/common_babel_parser_options';
|
||||
|
||||
const read = promisify(readFile);
|
||||
|
||||
function _cannotParseFile(filePath) {
|
||||
return extname(filePath) !== '.js';
|
||||
}
|
||||
|
||||
function _parseAndTraverseFileContent(fileContent, visitorsGenerator) {
|
||||
const results = [];
|
||||
|
||||
// Parse and get the code AST
|
||||
// All the babel parser plugins
|
||||
// were enabled
|
||||
const ast = parser.parse(fileContent, babelParserOptions);
|
||||
|
||||
// Loop through the code AST with
|
||||
// the defined visitors
|
||||
traverse(ast, visitorsGenerator(results));
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
export async function parseSingleFile(filePath, visitorsGenerator) {
|
||||
// Don't parse any other files than .js ones
|
||||
if (_cannotParseFile(filePath)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Read the file
|
||||
const content = await read(filePath, { encoding: 'utf8' });
|
||||
|
||||
// return the results found on parse and traverse
|
||||
// the file content with the given visitors
|
||||
return _parseAndTraverseFileContent(content, visitorsGenerator);
|
||||
}
|
||||
|
||||
export function parseSingleFileSync(filePath, visitorsGenerator) {
|
||||
// Don't parse any other files than .js ones
|
||||
if (_cannotParseFile(filePath)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Read the file
|
||||
const content = readFileSync(filePath, { encoding: 'utf8' });
|
||||
|
||||
// return the results found on parse and traverse
|
||||
// the file content with the given visitors
|
||||
return _parseAndTraverseFileContent(content, visitorsGenerator);
|
||||
}
|
||||
|
||||
export async function parseEntries(cwd, entries, strategy, results, wasParsed = {}) {
|
||||
// Assure that we always have a cwd
|
||||
const sanitizedCwd = cwd || process.cwd();
|
||||
|
||||
// Test each entry against canRequire function
|
||||
const entriesQueue = entries.map((entry) => canRequire(sanitizedCwd, entry));
|
||||
|
||||
while (entriesQueue.length) {
|
||||
// Get the first element in the queue as
|
||||
// select it as our current entry to parse
|
||||
const mainEntry = entriesQueue.shift();
|
||||
|
||||
// Avoid parse the current entry if it is not valid
|
||||
// or it was already parsed
|
||||
if (typeof mainEntry !== 'string' || wasParsed[mainEntry]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find new entries and adds them to the end of the queue
|
||||
entriesQueue.push(
|
||||
...(await strategy(sanitizedCwd, parseSingleFile, mainEntry, wasParsed, results))
|
||||
);
|
||||
|
||||
// Mark the current main entry as already parsed
|
||||
wasParsed[mainEntry] = true;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
22
packages/kbn-babel-code-parser/src/index.js
Normal file
22
packages/kbn-babel-code-parser/src/index.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export { dependenciesParseStrategy } from './strategies';
|
||||
export { dependenciesVisitorsGenerator } from './visitors';
|
||||
export { parseSingleFile, parseSingleFileSync, parseEntries } from './code_parser';
|
101
packages/kbn-babel-code-parser/src/strategies.js
Normal file
101
packages/kbn-babel-code-parser/src/strategies.js
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { canRequire } from './can_require';
|
||||
import { dependenciesVisitorsGenerator } from './visitors';
|
||||
import { dirname, isAbsolute, resolve } from 'path';
|
||||
|
||||
export function _calculateTopLevelDependency(inputDep, outputDep = '') {
|
||||
// The path separator will be always the forward slash
|
||||
// as at this point we only have the found entries into
|
||||
// the provided source code entries where we just use it
|
||||
const pathSeparator = '/';
|
||||
const depSplitPaths = inputDep.split(pathSeparator);
|
||||
const firstPart = depSplitPaths.shift();
|
||||
const outputDepFirstArgAppend = outputDep ? pathSeparator : '';
|
||||
|
||||
outputDep += `${outputDepFirstArgAppend}${firstPart}`;
|
||||
|
||||
// In case our dependency isn't started by @
|
||||
// we are already done and we can return the
|
||||
// dependency value we already have
|
||||
if (firstPart.charAt(0) !== '@') {
|
||||
return outputDep;
|
||||
}
|
||||
|
||||
// Otherwise we need to keep constructing the dependency
|
||||
// value because dependencies starting with @ points to
|
||||
// folders of dependencies. For example, in case we found
|
||||
// dependencies values with '@the-deps/a' and '@the-deps/a/b'
|
||||
// we don't want to map it to '@the-deps' but also to @'the-deps/a'
|
||||
// because inside '@the-deps' we can also have '@the-dep/b'
|
||||
return _calculateTopLevelDependency(depSplitPaths.join(pathSeparator), outputDep);
|
||||
}
|
||||
|
||||
export async function dependenciesParseStrategy(
|
||||
cwd,
|
||||
parseSingleFile,
|
||||
mainEntry,
|
||||
wasParsed,
|
||||
results
|
||||
) {
|
||||
// Retrieve native nodeJS modules
|
||||
const natives = process.binding('natives');
|
||||
|
||||
// Get dependencies from a single file and filter
|
||||
// out node native modules from the result
|
||||
const dependencies = (await parseSingleFile(mainEntry, dependenciesVisitorsGenerator)).filter(
|
||||
(dep) => !natives[dep]
|
||||
);
|
||||
|
||||
// Return the list of all the new entries found into
|
||||
// the current mainEntry that we could use to look for
|
||||
// new dependencies
|
||||
return dependencies.reduce((filteredEntries, entry) => {
|
||||
const absEntryPath = resolve(cwd, dirname(mainEntry), entry);
|
||||
const requiredPath = canRequire(cwd, absEntryPath);
|
||||
const requiredRelativePath = canRequire(cwd, entry);
|
||||
const isRelativeFile = !isAbsolute(entry);
|
||||
const isNodeModuleDep = isRelativeFile && !requiredPath && requiredRelativePath;
|
||||
const isNewEntry = isRelativeFile && requiredPath;
|
||||
|
||||
// If it is a node_module add it to the results and also
|
||||
// add the resolved path for the node_module main file
|
||||
// as an entry point to look for dependencies it was
|
||||
// not already parsed
|
||||
if (isNodeModuleDep) {
|
||||
// Save the result as the top level dependency
|
||||
results[_calculateTopLevelDependency(entry)] = true;
|
||||
|
||||
if (!wasParsed[requiredRelativePath]) {
|
||||
filteredEntries.push(requiredRelativePath);
|
||||
}
|
||||
}
|
||||
|
||||
// If a new, not yet parsed, relative entry were found
|
||||
// add it to the list of entries to be parsed
|
||||
if (isNewEntry && !wasParsed[requiredPath]) {
|
||||
if (!wasParsed[requiredPath]) {
|
||||
filteredEntries.push(requiredPath);
|
||||
}
|
||||
}
|
||||
|
||||
return filteredEntries;
|
||||
}, []);
|
||||
}
|
108
packages/kbn-babel-code-parser/src/strategies.test.js
Normal file
108
packages/kbn-babel-code-parser/src/strategies.test.js
Normal file
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { readFile } from 'fs';
|
||||
import { canRequire } from './can_require';
|
||||
import { parseSingleFile } from './code_parser';
|
||||
import { _calculateTopLevelDependency, dependenciesParseStrategy } from './strategies';
|
||||
|
||||
jest.mock('./can_require', () => ({
|
||||
canRequire: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
readFile: jest.fn(),
|
||||
}));
|
||||
|
||||
const mockCwd = '/tmp/project/dir/';
|
||||
|
||||
describe('Code Parser Strategies', () => {
|
||||
it('should calculate the top level dependencies correctly', () => {
|
||||
const plainDep = 'dep1/file';
|
||||
const foldedDep = '@kbn/es/file';
|
||||
const otherFoldedDep = '@kbn/es';
|
||||
|
||||
expect(_calculateTopLevelDependency(plainDep)).toEqual('dep1');
|
||||
expect(_calculateTopLevelDependency(foldedDep)).toEqual('@kbn/es');
|
||||
expect(_calculateTopLevelDependency(otherFoldedDep)).toEqual('@kbn/es');
|
||||
});
|
||||
|
||||
it('should exclude native modules', async () => {
|
||||
readFile.mockImplementationOnce((path, options, cb) => {
|
||||
cb(null, `require('fs')`);
|
||||
});
|
||||
|
||||
const results = [];
|
||||
await dependenciesParseStrategy(mockCwd, parseSingleFile, 'dep1/file.js', {}, results);
|
||||
|
||||
expect(results.length).toBe(0);
|
||||
});
|
||||
|
||||
it('should return a dep from_modules', async () => {
|
||||
readFile.mockImplementationOnce((path, options, cb) => {
|
||||
cb(null, `require('dep_from_node_modules')`);
|
||||
});
|
||||
|
||||
canRequire.mockImplementation((mockCwd, entry) => {
|
||||
if (entry === `${mockCwd}dep1/dep_from_node_modules`) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entry === 'dep_from_node_modules') {
|
||||
return `${mockCwd}node_modules/dep_from_node_modules/index.js`;
|
||||
}
|
||||
});
|
||||
|
||||
const results = await dependenciesParseStrategy(
|
||||
mockCwd,
|
||||
parseSingleFile,
|
||||
'dep1/file.js',
|
||||
{},
|
||||
{}
|
||||
);
|
||||
expect(results[0]).toBe(`${mockCwd}node_modules/dep_from_node_modules/index.js`);
|
||||
});
|
||||
|
||||
it('should return a relative dep file', async () => {
|
||||
readFile.mockImplementationOnce((path, options, cb) => {
|
||||
cb(null, `require('./relative_dep')`);
|
||||
});
|
||||
|
||||
canRequire.mockImplementation((mockCwd, entry) => {
|
||||
if (entry === `${mockCwd}dep1/relative_dep`) {
|
||||
return `${entry}/index.js`;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
const results = await dependenciesParseStrategy(
|
||||
mockCwd,
|
||||
parseSingleFile,
|
||||
'dep1/file.js',
|
||||
{},
|
||||
{}
|
||||
);
|
||||
expect(results[0]).toBe(`${mockCwd}dep1/relative_dep/index.js`);
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
});
|
142
packages/kbn-babel-code-parser/src/visitors.js
Normal file
142
packages/kbn-babel-code-parser/src/visitors.js
Normal file
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { matches } from 'lodash';
|
||||
|
||||
/**
|
||||
* @notice
|
||||
*
|
||||
* This product has relied on ASTExplorer that is licensed under MIT.
|
||||
*/
|
||||
export function dependenciesVisitorsGenerator(dependenciesAcc) {
|
||||
return (() => {
|
||||
// This was built with help on an ast explorer and some ESTree docs
|
||||
// like the babel parser ast spec and the main docs for the Esprima
|
||||
// which is a complete and useful docs for the ESTree spec.
|
||||
//
|
||||
// https://astexplorer.net
|
||||
// https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md
|
||||
// https://esprima.readthedocs.io/en/latest/syntax-tree-format.html
|
||||
// https://github.com/estree/estree
|
||||
return {
|
||||
// Visitors to traverse and found dependencies
|
||||
// raw values on require + require.resolve
|
||||
CallExpression: ({ node }) => {
|
||||
// AST check for require expressions
|
||||
const isRequire = (node) => {
|
||||
return matches({
|
||||
callee: {
|
||||
type: 'Identifier',
|
||||
name: 'require',
|
||||
},
|
||||
})(node);
|
||||
};
|
||||
|
||||
// AST check for require.resolve expressions
|
||||
const isRequireResolve = (node) => {
|
||||
return matches({
|
||||
callee: {
|
||||
type: 'MemberExpression',
|
||||
object: {
|
||||
type: 'Identifier',
|
||||
name: 'require',
|
||||
},
|
||||
property: {
|
||||
type: 'Identifier',
|
||||
name: 'resolve',
|
||||
},
|
||||
},
|
||||
})(node);
|
||||
};
|
||||
|
||||
// Get string values inside the expressions
|
||||
// whether they are require or require.resolve
|
||||
if (isRequire(node) || isRequireResolve(node)) {
|
||||
const nodeArguments = node.arguments;
|
||||
const reqArg = Array.isArray(nodeArguments) ? nodeArguments.shift() : null;
|
||||
|
||||
if (!reqArg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reqArg.type === 'StringLiteral') {
|
||||
dependenciesAcc.push(reqArg.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
// Visitors to traverse and found dependencies
|
||||
// raw values on import
|
||||
ImportDeclaration: ({ node }) => {
|
||||
// AST check for supported import expressions
|
||||
const isImport = (node) => {
|
||||
return matches({
|
||||
type: 'ImportDeclaration',
|
||||
source: {
|
||||
type: 'StringLiteral',
|
||||
},
|
||||
})(node);
|
||||
};
|
||||
|
||||
// Get string values from import expressions
|
||||
if (isImport(node)) {
|
||||
const importSource = node.source;
|
||||
dependenciesAcc.push(importSource.value);
|
||||
}
|
||||
},
|
||||
// Visitors to traverse and found dependencies
|
||||
// raw values on export from
|
||||
ExportNamedDeclaration: ({ node }) => {
|
||||
// AST check for supported export from expressions
|
||||
const isExportFrom = (node) => {
|
||||
return matches({
|
||||
type: 'ExportNamedDeclaration',
|
||||
source: {
|
||||
type: 'StringLiteral',
|
||||
},
|
||||
})(node);
|
||||
};
|
||||
|
||||
// Get string values from export from expressions
|
||||
if (isExportFrom(node)) {
|
||||
const exportFromSource = node.source;
|
||||
dependenciesAcc.push(exportFromSource.value);
|
||||
}
|
||||
},
|
||||
// Visitors to traverse and found dependencies
|
||||
// raw values on export * from
|
||||
ExportAllDeclaration: ({ node }) => {
|
||||
// AST check for supported export * from expressions
|
||||
const isExportAllFrom = (node) => {
|
||||
return matches({
|
||||
type: 'ExportAllDeclaration',
|
||||
source: {
|
||||
type: 'StringLiteral',
|
||||
},
|
||||
})(node);
|
||||
};
|
||||
|
||||
// Get string values from export * from expressions
|
||||
if (isExportAllFrom(node)) {
|
||||
const exportAllFromSource = node.source;
|
||||
dependenciesAcc.push(exportAllFromSource.value);
|
||||
}
|
||||
},
|
||||
};
|
||||
})();
|
||||
}
|
68
packages/kbn-babel-code-parser/src/visitors.test.js
Normal file
68
packages/kbn-babel-code-parser/src/visitors.test.js
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import * as parser from '@babel/parser';
|
||||
import traverse from '@babel/traverse';
|
||||
import { dependenciesVisitorsGenerator } from './visitors';
|
||||
|
||||
const visitorsApplier = (code) => {
|
||||
const result = [];
|
||||
traverse(
|
||||
parser.parse(code, {
|
||||
sourceType: 'unambiguous',
|
||||
plugins: ['exportDefaultFrom'],
|
||||
}),
|
||||
dependenciesVisitorsGenerator(result)
|
||||
);
|
||||
return result;
|
||||
};
|
||||
|
||||
describe('Code Parser Visitors', () => {
|
||||
it('should get values from require', () => {
|
||||
const rawCode = `/*foo*/require('dep1'); const bar = 1;`;
|
||||
const foundDeps = visitorsApplier(rawCode);
|
||||
expect(foundDeps[0] === 'dep1');
|
||||
});
|
||||
|
||||
it('should get values from require.resolve', () => {
|
||||
const rawCode = `/*foo*/require.resolve('dep2'); const bar = 1;`;
|
||||
const foundDeps = visitorsApplier(rawCode);
|
||||
expect(foundDeps[0] === 'dep2');
|
||||
});
|
||||
|
||||
it('should get values from import', () => {
|
||||
const rawCode = `/*foo*/import dep1 from 'dep1'; import dep2 from 'dep2';const bar = 1;`;
|
||||
const foundDeps = visitorsApplier(rawCode);
|
||||
expect(foundDeps[0] === 'dep1');
|
||||
expect(foundDeps[1] === 'dep2');
|
||||
});
|
||||
|
||||
it('should get values from export from', () => {
|
||||
const rawCode = `/*foo*/export dep1 from 'dep1'; import dep2 from 'dep2';const bar = 1;`;
|
||||
const foundDeps = visitorsApplier(rawCode);
|
||||
expect(foundDeps[0] === 'dep1');
|
||||
});
|
||||
|
||||
it('should get values from export * from', () => {
|
||||
const rawCode = `/*foo*/export * from 'dep1'; export dep2 from 'dep2';const bar = 1;`;
|
||||
const foundDeps = visitorsApplier(rawCode);
|
||||
expect(foundDeps[0] === 'dep1');
|
||||
expect(foundDeps[1] === 'dep2');
|
||||
});
|
||||
});
|
|
@ -5,20 +5,5 @@
|
|||
"license": "Apache-2.0",
|
||||
"kibana": {
|
||||
"devOnly": true
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.10.4",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
|
||||
"@babel/plugin-proposal-private-methods": "^7.10.4",
|
||||
"@babel/preset-env": "^7.11.0",
|
||||
"@babel/preset-react": "^7.10.4",
|
||||
"@babel/preset-typescript": "^7.10.4",
|
||||
"babel-plugin-add-module-exports": "^1.0.2",
|
||||
"babel-plugin-styled-components": "^1.10.7",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
||||
"react-is": "^16.8.0",
|
||||
"styled-components": "^5.1.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -6,17 +6,7 @@
|
|||
"license": "Apache-2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "../../node_modules/.bin/tsc",
|
||||
"kbn:bootstrap": "yarn build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "4.0.2",
|
||||
"tsd": "^0.13.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"lodash": "^4.17.15",
|
||||
"joi": "^13.5.2",
|
||||
"moment": "^2.24.0",
|
||||
"type-detect": "^4.0.8"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,25 +6,17 @@
|
|||
"license": "Apache-2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "../../node_modules/.bin/tsc",
|
||||
"kbn:bootstrap": "yarn build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/safer-lodash-set": "0.0.0",
|
||||
"@kbn/config-schema": "1.0.0",
|
||||
"@kbn/logging": "1.0.0",
|
||||
"@kbn/std": "1.0.0",
|
||||
"js-yaml": "^3.14.0",
|
||||
"load-json-file": "^6.2.0",
|
||||
"lodash": "^4.17.20",
|
||||
"moment": "^2.24.0",
|
||||
"rxjs": "^6.5.5",
|
||||
"type-detect": "^4.0.8"
|
||||
"@elastic/safer-lodash-set": "link:../elastic-safer-lodash-set",
|
||||
"@kbn/config-schema": "link:../kbn-config-schema",
|
||||
"@kbn/logging": "link:../kbn-logging",
|
||||
"@kbn/std": "link:../kbn-std"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/utility-types": "1.0.0",
|
||||
"typescript": "4.0.2",
|
||||
"tsd": "^0.13.1"
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils",
|
||||
"@kbn/utility-types": "link:../kbn-utility-types"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -5,7 +5,7 @@
|
|||
"license": "Apache-2.0",
|
||||
"main": "./target/index.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "../../node_modules/.bin/tsc",
|
||||
"kbn:bootstrap": "yarn build",
|
||||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
|
@ -13,30 +13,10 @@
|
|||
"devOnly": true
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@kbn/utils": "1.0.0",
|
||||
"axios": "^0.19.2",
|
||||
"chalk": "^4.1.0",
|
||||
"cheerio": "0.22.0",
|
||||
"dedent": "^0.7.0",
|
||||
"execa": "^4.0.2",
|
||||
"exit-hook": "^2.2.0",
|
||||
"getopts": "^2.2.5",
|
||||
"globby": "^8.0.1",
|
||||
"load-json-file": "^6.2.0",
|
||||
"markdown-it": "^10.0.0",
|
||||
"moment": "^2.24.0",
|
||||
"normalize-path": "^3.0.0",
|
||||
"rxjs": "^6.5.5",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"tree-kill": "^1.2.2",
|
||||
"vinyl": "^2.2.0"
|
||||
"@kbn/utils": "link:../kbn-utils"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/expect": "1.0.0",
|
||||
"@types/vinyl": "^2.0.4",
|
||||
"chance": "1.0.18",
|
||||
"typescript": "4.0.2"
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset",
|
||||
"@kbn/expect": "link:../kbn-expect"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -7,14 +7,10 @@
|
|||
"devOnly": true
|
||||
},
|
||||
"scripts": {
|
||||
"kbn:bootstrap": "rm -rf target && tsc",
|
||||
"kbn:watch": "rm -rf target && tsc --watch"
|
||||
"kbn:bootstrap": "rm -rf target && ../../node_modules/.bin/tsc",
|
||||
"kbn:watch": "rm -rf target && ../../node_modules/.bin/tsc --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"elasticsearch": "^16.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/elasticsearch": "^5.0.33"
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -12,24 +12,9 @@
|
|||
"kbn:watch": "node scripts/build --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/elasticsearch": "7.10.0-rc.1",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"abort-controller": "^3.0.0",
|
||||
"chalk": "^4.1.0",
|
||||
"dedent": "^0.7.0",
|
||||
"del": "^5.1.0",
|
||||
"execa": "^4.0.2",
|
||||
"getopts": "^2.2.5",
|
||||
"glob": "^7.1.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"simple-git": "1.116.0",
|
||||
"tar-fs": "^2.1.0",
|
||||
"tree-kill": "^1.2.2",
|
||||
"yauzl": "^2.10.0"
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@babel/cli": "^7.10.5",
|
||||
"del": "^5.1.0"
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -11,14 +11,5 @@
|
|||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/elastic/kibana/tree/master/packages/kbn-eslint-import-resolver-kibana"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^2.6.9",
|
||||
"eslint-import-resolver-node": "0.3.2",
|
||||
"eslint-import-resolver-webpack": "0.11.1",
|
||||
"glob-all": "^3.2.1",
|
||||
"lru-cache": "^4.1.5",
|
||||
"resolve": "^1.7.1",
|
||||
"webpack": "^4.41.5"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -5,14 +5,5 @@
|
|||
"license": "Apache-2.0",
|
||||
"kibana": {
|
||||
"devOnly": true
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "6.8.0",
|
||||
"babel-eslint": "^10.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"micromatch": "3.1.10",
|
||||
"dedent": "^0.7.0",
|
||||
"eslint-module-utils": "2.5.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -2,4 +2,4 @@
|
|||
"browser": "../target/web/angular",
|
||||
"main": "../target/node/angular",
|
||||
"types": "../target/types/angular/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -12,23 +12,7 @@
|
|||
"kbn:watch": "node scripts/build --watch --source-maps"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.10.5",
|
||||
"@babel/core": "^7.11.6",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@types/intl-relativeformat": "^2.1.0",
|
||||
"@types/react-intl": "^2.3.15",
|
||||
"del": "^5.1.0",
|
||||
"getopts": "^2.2.5",
|
||||
"supports-color": "^7.0.0",
|
||||
"typescript": "4.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"intl-format-cache": "^2.1.0",
|
||||
"intl-messageformat": "^2.2.0",
|
||||
"intl-relativeformat": "^2.1.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^16.12.0",
|
||||
"react-intl": "^2.8.0"
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset",
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,4 +2,4 @@
|
|||
"browser": "../target/web/react",
|
||||
"main": "../target/node/react",
|
||||
"types": "../target/types/react/index.d.ts"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -2,4 +2,4 @@
|
|||
"private": true,
|
||||
"main": "../target/common/index.js",
|
||||
"jsnext:main": "../src/common/index.js"
|
||||
}
|
||||
}
|
|
@ -3,35 +3,16 @@
|
|||
"version": "1.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"interpreter:peg": "pegjs src/common/lib/grammar.peg",
|
||||
"interpreter:peg": "../../node_modules/.bin/pegjs src/common/lib/grammar.peg",
|
||||
"build": "node scripts/build",
|
||||
"kbn:bootstrap": "node scripts/build --dev",
|
||||
"kbn:watch": "node scripts/build --dev --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.11.2",
|
||||
"@kbn/i18n": "1.0.0",
|
||||
"lodash": "^4.17.20",
|
||||
"uuid": "3.3.2"
|
||||
"@kbn/i18n": "link:../kbn-i18n"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.10.5",
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
|
||||
"@babel/plugin-transform-runtime": "^7.11.0",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"copy-webpack-plugin": "^6.0.2",
|
||||
"css-loader": "^3.4.2",
|
||||
"del": "^5.1.0",
|
||||
"getopts": "^2.2.5",
|
||||
"pegjs": "0.10.0",
|
||||
"sass-loader": "^8.0.2",
|
||||
"style-loader": "^1.1.3",
|
||||
"supports-color": "^7.0.0",
|
||||
"url-loader": "^2.2.0",
|
||||
"webpack": "^4.41.5",
|
||||
"webpack-cli": "^3.3.10"
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset",
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -5,14 +5,11 @@
|
|||
"license": "Apache-2.0",
|
||||
"main": "./target/index.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "../../node_modules/.bin/tsc",
|
||||
"kbn:bootstrap": "yarn build",
|
||||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/std": "1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "4.0.2"
|
||||
"@kbn/std": "link:../kbn-std"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -8,20 +8,8 @@
|
|||
"build": "node ./scripts/build.js",
|
||||
"kbn:bootstrap": "yarn build --dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.13.3",
|
||||
"monaco-editor": "~0.17.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"css-loader": "^3.4.2",
|
||||
"del": "^5.1.0",
|
||||
"raw-loader": "^3.1.0",
|
||||
"supports-color": "^7.0.0",
|
||||
"typescript": "4.0.2",
|
||||
"webpack": "^4.41.5",
|
||||
"webpack-cli": "^3.3.10"
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset",
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -5,60 +5,15 @@
|
|||
"license": "Apache-2.0",
|
||||
"main": "./target/index.js",
|
||||
"scripts": {
|
||||
"build": "babel src --out-dir target --copy-files --delete-dir-on-start --extensions .ts --ignore *.test.ts --source-maps=inline",
|
||||
"build": "../../node_modules/.bin/babel src --out-dir target --copy-files --delete-dir-on-start --extensions .ts --ignore *.test.ts --source-maps=inline",
|
||||
"kbn:bootstrap": "yarn build",
|
||||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/cli": "^7.10.5",
|
||||
"@babel/core": "^7.11.6",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/config": "1.0.0",
|
||||
"@kbn/std": "1.0.0",
|
||||
"@kbn/ui-shared-deps": "1.0.0",
|
||||
"autoprefixer": "^9.7.4",
|
||||
"babel-loader": "^8.0.6",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"compression-webpack-plugin": "^4.0.0",
|
||||
"cpy": "^8.0.0",
|
||||
"core-js": "^3.6.5",
|
||||
"css-loader": "^3.4.2",
|
||||
"dedent": "^0.7.0",
|
||||
"del": "^5.1.0",
|
||||
"execa": "^4.0.2",
|
||||
"file-loader": "^4.2.0",
|
||||
"istanbul-instrumenter-loader": "^3.0.1",
|
||||
"jest-diff": "^26.4.2",
|
||||
"js-yaml": "^3.14.0",
|
||||
"json-stable-stringify": "^1.0.1",
|
||||
"lmdb-store": "^0.6.10",
|
||||
"loader-utils": "^1.2.3",
|
||||
"node-sass": "^4.13.1",
|
||||
"normalize-path": "^3.0.0",
|
||||
"pirates": "^4.0.1",
|
||||
"postcss": "^7.0.32",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"raw-loader": "^3.1.0",
|
||||
"rxjs": "^6.5.5",
|
||||
"js-yaml": "^3.14.0",
|
||||
"sass-loader": "^8.0.2",
|
||||
"source-map-support": "^0.5.19",
|
||||
"style-loader": "^1.1.3",
|
||||
"terser-webpack-plugin": "^2.1.2",
|
||||
"tinymath": "1.2.1",
|
||||
"url-loader": "^2.2.0",
|
||||
"val-loader": "^1.1.1",
|
||||
"watchpack": "^1.6.0",
|
||||
"webpack": "^4.41.5",
|
||||
"webpack-merge": "^4.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/babel__core": "^7.1.10",
|
||||
"@types/compression-webpack-plugin": "^2.0.2",
|
||||
"@types/loader-utils": "^1.1.3",
|
||||
"@types/source-map-support": "^0.5.3",
|
||||
"@types/watchpack": "^1.1.5",
|
||||
"@types/webpack": "^4.41.3"
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset",
|
||||
"@kbn/config": "link:../kbn-config",
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils",
|
||||
"@kbn/std": "link:../kbn-std",
|
||||
"@kbn/ui-shared-deps": "link:../kbn-ui-shared-deps"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -9,18 +9,6 @@
|
|||
"kbn:watch": "node scripts/build --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"ejs": "^3.1.5",
|
||||
"execa": "^4.0.2",
|
||||
"inquirer": "^7.3.3",
|
||||
"normalize-path": "^3.0.0",
|
||||
"prettier": "^2.1.1",
|
||||
"vinyl": "^2.2.0",
|
||||
"vinyl-fs": "^3.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ejs": "^3.0.4",
|
||||
"@types/prettier": "^2.0.2",
|
||||
"@types/inquirer": "^7.3.1"
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -12,24 +12,11 @@
|
|||
"plugin-helpers": "bin/plugin-helpers.js"
|
||||
},
|
||||
"scripts": {
|
||||
"kbn:bootstrap": "rm -rf target && tsc",
|
||||
"kbn:watch": "tsc --watch"
|
||||
"kbn:bootstrap": "rm -rf target && ../../node_modules/.bin/tsc",
|
||||
"kbn:watch": "../../node_modules/.bin/tsc --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/optimizer": "1.0.0",
|
||||
"del": "^5.1.0",
|
||||
"execa": "^4.0.2",
|
||||
"gulp-zip": "^5.0.2",
|
||||
"inquirer": "^7.3.3",
|
||||
"load-json-file": "^6.2.0",
|
||||
"vinyl-fs": "^3.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/extract-zip": "^1.6.2",
|
||||
"@types/gulp-zip": "^4.0.1",
|
||||
"@types/inquirer": "^7.3.1",
|
||||
"extract-zip": "^2.0.1",
|
||||
"typescript": "4.0.2"
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils",
|
||||
"@kbn/optimizer": "link:../kbn-optimizer"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
22525
packages/kbn-pm/dist/index.js
vendored
22525
packages/kbn-pm/dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -8,68 +8,14 @@
|
|||
"devOnly": true
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"kbn:watch": "webpack --watch --progress",
|
||||
"prettier": "prettier --write './src/**/*.ts'"
|
||||
"build": "../../node_modules/.bin/webpack",
|
||||
"kbn:watch": "../../node_modules/.bin/webpack --watch --progress",
|
||||
"prettier": "../../node_modules/.bin/prettier --write './src/**/*.ts'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
|
||||
"@babel/preset-env": "^7.11.0",
|
||||
"@babel/preset-typescript": "^7.10.4",
|
||||
"@types/cmd-shim": "^2.0.0",
|
||||
"@types/cpy": "^5.1.0",
|
||||
"@types/dedent": "^0.7.0",
|
||||
"@types/getopts": "^2.0.1",
|
||||
"@types/glob": "^7.1.2",
|
||||
"@types/globby": "^8.0.0",
|
||||
"@types/has-ansi": "^3.0.0",
|
||||
"@types/lodash": "^4.14.159",
|
||||
"@types/log-symbols": "^2.0.0",
|
||||
"@types/ncp": "^2.0.1",
|
||||
"@types/node": ">=10.17.17 <10.20.0",
|
||||
"@types/ora": "^1.3.5",
|
||||
"@types/read-pkg": "^4.0.0",
|
||||
"@types/strip-ansi": "^5.2.1",
|
||||
"@types/strong-log-transformer": "^1.0.0",
|
||||
"@types/tempy": "^0.2.0",
|
||||
"@types/write-pkg": "^3.1.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@yarnpkg/lockfile": "^1.1.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"chalk": "^4.1.0",
|
||||
"cmd-shim": "^2.1.0",
|
||||
"cpy": "^8.0.0",
|
||||
"dedent": "^0.7.0",
|
||||
"del": "^5.1.0",
|
||||
"execa": "^4.0.2",
|
||||
"getopts": "^2.2.5",
|
||||
"glob": "^7.1.2",
|
||||
"globby": "^8.0.1",
|
||||
"has-ansi": "^3.0.0",
|
||||
"is-path-inside": "^3.0.2",
|
||||
"lodash": "^4.17.20",
|
||||
"log-symbols": "^2.2.0",
|
||||
"multimatch": "^4.0.0",
|
||||
"ncp": "^2.0.0",
|
||||
"ora": "^4.0.4",
|
||||
"prettier": "^2.1.1",
|
||||
"read-pkg": "^5.2.0",
|
||||
"rxjs": "^6.5.5",
|
||||
"spawn-sync": "^1.0.15",
|
||||
"string-replace-loader": "^2.2.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"strong-log-transformer": "^2.1.0",
|
||||
"tempy": "^0.3.0",
|
||||
"typescript": "4.0.2",
|
||||
"unlazy-loader": "^0.1.3",
|
||||
"webpack": "^4.41.5",
|
||||
"webpack-cli": "^3.3.10",
|
||||
"write-pkg": "^4.0.0"
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/utils": "1.0.0",
|
||||
"tslib": "^2.0.0"
|
||||
"@kbn/utils": "link:../kbn-utils"
|
||||
}
|
||||
}
|
||||
}
|
142
packages/kbn-pm/src/commands/__snapshots__/bootstrap.test.ts.snap
generated
Normal file
142
packages/kbn-pm/src/commands/__snapshots__/bootstrap.test.ts.snap
generated
Normal file
|
@ -0,0 +1,142 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`calls "kbn:bootstrap" scripts and links executables after installing deps: link bins 1`] = `
|
||||
Array [
|
||||
Array [
|
||||
Map {
|
||||
"kibana" => Project {
|
||||
"allDependencies": Object {
|
||||
"bar": "link:packages/bar",
|
||||
},
|
||||
"devDependencies": Object {},
|
||||
"isSinglePackageJsonProject": true,
|
||||
"json": Object {
|
||||
"dependencies": Object {
|
||||
"bar": "link:packages/bar",
|
||||
},
|
||||
"name": "kibana",
|
||||
"version": "1.0.0",
|
||||
},
|
||||
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/node_modules",
|
||||
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/package.json",
|
||||
"path": "<repoRoot>/packages/kbn-pm/src/commands",
|
||||
"productionDependencies": Object {
|
||||
"bar": "link:packages/bar",
|
||||
},
|
||||
"scripts": Object {},
|
||||
"targetLocation": "<repoRoot>/packages/kbn-pm/src/commands/target",
|
||||
"version": "1.0.0",
|
||||
},
|
||||
"bar" => Project {
|
||||
"allDependencies": Object {},
|
||||
"devDependencies": Object {},
|
||||
"isSinglePackageJsonProject": false,
|
||||
"json": Object {
|
||||
"name": "bar",
|
||||
"scripts": Object {
|
||||
"kbn:bootstrap": "node ./bar.js",
|
||||
},
|
||||
"version": "1.0.0",
|
||||
},
|
||||
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/node_modules",
|
||||
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/package.json",
|
||||
"path": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
|
||||
"productionDependencies": Object {},
|
||||
"scripts": Object {
|
||||
"kbn:bootstrap": "node ./bar.js",
|
||||
},
|
||||
"targetLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/target",
|
||||
"version": "1.0.0",
|
||||
},
|
||||
},
|
||||
Map {
|
||||
"kibana" => Array [
|
||||
Project {
|
||||
"allDependencies": Object {},
|
||||
"devDependencies": Object {},
|
||||
"isSinglePackageJsonProject": false,
|
||||
"json": Object {
|
||||
"name": "bar",
|
||||
"scripts": Object {
|
||||
"kbn:bootstrap": "node ./bar.js",
|
||||
},
|
||||
"version": "1.0.0",
|
||||
},
|
||||
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/node_modules",
|
||||
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/package.json",
|
||||
"path": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
|
||||
"productionDependencies": Object {},
|
||||
"scripts": Object {
|
||||
"kbn:bootstrap": "node ./bar.js",
|
||||
},
|
||||
"targetLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/target",
|
||||
"version": "1.0.0",
|
||||
},
|
||||
],
|
||||
"bar" => Array [],
|
||||
},
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`calls "kbn:bootstrap" scripts and links executables after installing deps: script 1`] = `
|
||||
Array [
|
||||
Array [
|
||||
Object {
|
||||
"args": Array [],
|
||||
"debug": undefined,
|
||||
"pkg": Project {
|
||||
"allDependencies": Object {},
|
||||
"devDependencies": Object {},
|
||||
"isSinglePackageJsonProject": false,
|
||||
"json": Object {
|
||||
"name": "bar",
|
||||
"scripts": Object {
|
||||
"kbn:bootstrap": "node ./bar.js",
|
||||
},
|
||||
"version": "1.0.0",
|
||||
},
|
||||
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/node_modules",
|
||||
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/package.json",
|
||||
"path": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
|
||||
"productionDependencies": Object {},
|
||||
"scripts": Object {
|
||||
"kbn:bootstrap": "node ./bar.js",
|
||||
},
|
||||
"targetLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/target",
|
||||
"version": "1.0.0",
|
||||
},
|
||||
"script": "kbn:bootstrap",
|
||||
},
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`does not run installer if no deps in package: install in dir 1`] = `
|
||||
Array [
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/commands",
|
||||
Array [],
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`handles "frozen-lockfile": install in dir 1`] = `
|
||||
Array [
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/commands",
|
||||
Array [
|
||||
"--frozen-lockfile",
|
||||
],
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`handles dependencies of dependencies: install in dir 1`] = `
|
||||
Array [
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/commands",
|
||||
Array [],
|
||||
],
|
||||
]
|
||||
`;
|
219
packages/kbn-pm/src/commands/bootstrap.test.ts
Normal file
219
packages/kbn-pm/src/commands/bootstrap.test.ts
Normal file
|
@ -0,0 +1,219 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
jest.mock('../utils/scripts');
|
||||
jest.mock('../utils/link_project_executables');
|
||||
jest.mock('../utils/validate_dependencies');
|
||||
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { ToolingLogCollectingWriter } from '@kbn/dev-utils/tooling_log';
|
||||
|
||||
import { absolutePathSnapshotSerializer, stripAnsiSnapshotSerializer } from '../test_helpers';
|
||||
import { linkProjectExecutables } from '../utils/link_project_executables';
|
||||
import { IPackageJson } from '../utils/package_json';
|
||||
import { Project } from '../utils/project';
|
||||
import { buildProjectGraph } from '../utils/projects';
|
||||
import { installInDir, runScriptInPackageStreaming } from '../utils/scripts';
|
||||
import { BootstrapCommand } from './bootstrap';
|
||||
import { Kibana } from '../utils/kibana';
|
||||
import { log } from '../utils/log';
|
||||
|
||||
const mockInstallInDir = installInDir as jest.Mock;
|
||||
const mockRunScriptInPackageStreaming = runScriptInPackageStreaming as jest.Mock;
|
||||
const mockLinkProjectExecutables = linkProjectExecutables as jest.Mock;
|
||||
|
||||
const logWriter = new ToolingLogCollectingWriter('debug');
|
||||
log.setLogLevel('silent');
|
||||
log.setWriters([logWriter]);
|
||||
beforeEach(() => {
|
||||
logWriter.messages.length = 0;
|
||||
});
|
||||
|
||||
const createProject = (packageJson: IPackageJson, path = '.') => {
|
||||
const project = new Project(
|
||||
{
|
||||
name: 'kibana',
|
||||
version: '1.0.0',
|
||||
...packageJson,
|
||||
},
|
||||
resolve(__dirname, path)
|
||||
);
|
||||
|
||||
return project;
|
||||
};
|
||||
expect.addSnapshotSerializer(absolutePathSnapshotSerializer);
|
||||
expect.addSnapshotSerializer(stripAnsiSnapshotSerializer);
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('handles dependencies of dependencies', async () => {
|
||||
const kibana = createProject({
|
||||
dependencies: {
|
||||
bar: 'link:packages/bar',
|
||||
},
|
||||
});
|
||||
const foo = createProject(
|
||||
{
|
||||
dependencies: {
|
||||
bar: 'link:../bar',
|
||||
},
|
||||
name: 'foo',
|
||||
},
|
||||
'packages/foo'
|
||||
);
|
||||
const bar = createProject(
|
||||
{
|
||||
dependencies: {
|
||||
baz: 'link:../baz',
|
||||
},
|
||||
name: 'bar',
|
||||
},
|
||||
'packages/bar'
|
||||
);
|
||||
const baz = createProject(
|
||||
{
|
||||
name: 'baz',
|
||||
},
|
||||
'packages/baz'
|
||||
);
|
||||
|
||||
const projects = new Map([
|
||||
['kibana', kibana],
|
||||
['foo', foo],
|
||||
['bar', bar],
|
||||
['baz', baz],
|
||||
]);
|
||||
const kbn = new Kibana(projects);
|
||||
const projectGraph = buildProjectGraph(projects);
|
||||
|
||||
await BootstrapCommand.run(projects, projectGraph, {
|
||||
extraArgs: [],
|
||||
options: {},
|
||||
rootPath: '',
|
||||
kbn,
|
||||
});
|
||||
|
||||
expect(mockInstallInDir.mock.calls).toMatchSnapshot('install in dir');
|
||||
expect(logWriter.messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
info [kibana] running yarn,
|
||||
"",
|
||||
"",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
test('does not run installer if no deps in package', async () => {
|
||||
const kibana = createProject({
|
||||
dependencies: {
|
||||
bar: 'link:packages/bar',
|
||||
},
|
||||
});
|
||||
// bar has no dependencies
|
||||
const bar = createProject(
|
||||
{
|
||||
name: 'bar',
|
||||
},
|
||||
'packages/bar'
|
||||
);
|
||||
|
||||
const projects = new Map([
|
||||
['kibana', kibana],
|
||||
['bar', bar],
|
||||
]);
|
||||
const kbn = new Kibana(projects);
|
||||
const projectGraph = buildProjectGraph(projects);
|
||||
|
||||
await BootstrapCommand.run(projects, projectGraph, {
|
||||
extraArgs: [],
|
||||
options: {},
|
||||
rootPath: '',
|
||||
kbn,
|
||||
});
|
||||
|
||||
expect(mockInstallInDir.mock.calls).toMatchSnapshot('install in dir');
|
||||
expect(logWriter.messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
info [kibana] running yarn,
|
||||
"",
|
||||
"",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
test('handles "frozen-lockfile"', async () => {
|
||||
const kibana = createProject({
|
||||
dependencies: {
|
||||
foo: '2.2.0',
|
||||
},
|
||||
});
|
||||
|
||||
const projects = new Map([['kibana', kibana]]);
|
||||
const kbn = new Kibana(projects);
|
||||
const projectGraph = buildProjectGraph(projects);
|
||||
|
||||
await BootstrapCommand.run(projects, projectGraph, {
|
||||
extraArgs: [],
|
||||
options: {
|
||||
'frozen-lockfile': true,
|
||||
},
|
||||
rootPath: '',
|
||||
kbn,
|
||||
});
|
||||
|
||||
expect(mockInstallInDir.mock.calls).toMatchSnapshot('install in dir');
|
||||
});
|
||||
|
||||
test('calls "kbn:bootstrap" scripts and links executables after installing deps', async () => {
|
||||
const kibana = createProject({
|
||||
dependencies: {
|
||||
bar: 'link:packages/bar',
|
||||
},
|
||||
});
|
||||
const bar = createProject(
|
||||
{
|
||||
name: 'bar',
|
||||
scripts: {
|
||||
'kbn:bootstrap': 'node ./bar.js',
|
||||
},
|
||||
},
|
||||
'packages/bar'
|
||||
);
|
||||
|
||||
const projects = new Map([
|
||||
['kibana', kibana],
|
||||
['bar', bar],
|
||||
]);
|
||||
const kbn = new Kibana(projects);
|
||||
const projectGraph = buildProjectGraph(projects);
|
||||
|
||||
await BootstrapCommand.run(projects, projectGraph, {
|
||||
extraArgs: [],
|
||||
options: {},
|
||||
rootPath: '',
|
||||
kbn,
|
||||
});
|
||||
|
||||
expect(mockLinkProjectExecutables.mock.calls).toMatchSnapshot('link bins');
|
||||
expect(mockRunScriptInPackageStreaming.mock.calls).toMatchSnapshot('script');
|
||||
});
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { sep } from 'path';
|
||||
import { linkProjectExecutables } from '../utils/link_project_executables';
|
||||
import { log } from '../utils/log';
|
||||
import { parallelizeBatches } from '../utils/parallelize';
|
||||
|
@ -33,25 +34,30 @@ export const BootstrapCommand: ICommand = {
|
|||
name: 'bootstrap',
|
||||
|
||||
async run(projects, projectGraph, { options, kbn }) {
|
||||
const batchedProjectsByWorkspace = topologicallyBatchProjects(projects, projectGraph, {
|
||||
batchByWorkspace: true,
|
||||
});
|
||||
const batchedProjects = topologicallyBatchProjects(projects, projectGraph);
|
||||
|
||||
const kibanaProjectPath = projects.get('kibana')?.path;
|
||||
const extraArgs = [
|
||||
...(options['frozen-lockfile'] === true ? ['--frozen-lockfile'] : []),
|
||||
...(options['prefer-offline'] === true ? ['--prefer-offline'] : []),
|
||||
];
|
||||
|
||||
for (const batch of batchedProjectsByWorkspace) {
|
||||
for (const batch of batchedProjects) {
|
||||
for (const project of batch) {
|
||||
if (project.isWorkspaceProject) {
|
||||
log.verbose(`Skipping workspace project: ${project.name}`);
|
||||
const isExternalPlugin = project.path.includes(`${kibanaProjectPath}${sep}plugins`);
|
||||
|
||||
if (!project.hasDependencies()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (project.hasDependencies()) {
|
||||
if (project.isSinglePackageJsonProject || isExternalPlugin) {
|
||||
await project.installDependencies({ extraArgs });
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!project.isEveryDependencyLocal() && !isExternalPlugin) {
|
||||
throw new Error(
|
||||
`[${project.name}] is not eligible to hold non local dependencies. Move the non local dependencies into the top level package.json.`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +68,8 @@ export const BootstrapCommand: ICommand = {
|
|||
await validateDependencies(kbn, yarnLock);
|
||||
}
|
||||
|
||||
// Assure all kbn projects with bin defined scripts
|
||||
// copy those scripts into the top level node_modules folder
|
||||
await linkProjectExecutables(projects, projectGraph);
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,5 +21,5 @@ export { run } from './cli';
|
|||
export { buildProductionProjects } from './production';
|
||||
export { getProjects } from './utils/projects';
|
||||
export { Project } from './utils/project';
|
||||
export { copyWorkspacePackages } from './utils/workspaces';
|
||||
export { transformDependencies } from './utils/package_json';
|
||||
export { getProjectPaths } from './config';
|
||||
|
|
|
@ -24,14 +24,18 @@ import { join, relative, resolve } from 'path';
|
|||
import { getProjectPaths } from '../config';
|
||||
import { isDirectory, isFile } from '../utils/fs';
|
||||
import { log } from '../utils/log';
|
||||
import { readPackageJson, writePackageJson } from '../utils/package_json';
|
||||
import { Project } from '../utils/project';
|
||||
import {
|
||||
createProductionPackageJson,
|
||||
readPackageJson,
|
||||
writePackageJson,
|
||||
} from '../utils/package_json';
|
||||
import {
|
||||
buildProjectGraph,
|
||||
getProjects,
|
||||
includeTransitiveProjects,
|
||||
topologicallyBatchProjects,
|
||||
} from '../utils/projects';
|
||||
import { Project } from '..';
|
||||
|
||||
export async function buildProductionProjects({
|
||||
kibanaRoot,
|
||||
|
@ -125,9 +129,9 @@ async function copyToBuild(project: Project, kibanaRoot: string, buildRoot: stri
|
|||
await copy(['**/*', '!node_modules/**'], buildProjectPath, {
|
||||
cwd: project.getIntermediateBuildDirectory(),
|
||||
dot: true,
|
||||
nodir: true,
|
||||
onlyFiles: true,
|
||||
parents: true,
|
||||
});
|
||||
} as copy.Options);
|
||||
|
||||
// If a project is using an intermediate build directory, we special-case our
|
||||
// handling of `package.json`, as the project build process might have copied
|
||||
|
@ -140,5 +144,6 @@ async function copyToBuild(project: Project, kibanaRoot: string, buildRoot: stri
|
|||
? await readPackageJson(buildProjectPath)
|
||||
: project.json;
|
||||
|
||||
await writePackageJson(buildProjectPath, packageJson);
|
||||
const preparedPackageJson = createProductionPackageJson(packageJson);
|
||||
await writePackageJson(buildProjectPath, preparedPackageJson);
|
||||
}
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
"name": "kibana",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"foo": "1.0.0"
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"packages/*"
|
||||
]
|
||||
"foo": "link:packages/foo"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
"name": "bar",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"foo": "1.0.0"
|
||||
"foo": "link:../foo"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,71 +1,32 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`bin script points nowhere does not try to create symlink or node_modules/.bin directory: fs module calls 1`] = `
|
||||
exports[`bin script points nowhere does not try to create symlink on node_modules/.bin for that bin script: fs module calls 1`] = `
|
||||
Object {
|
||||
"chmod": Array [],
|
||||
"copyDirectory": Array [],
|
||||
"createSymlink": Array [],
|
||||
"isDirectory": Array [],
|
||||
"isFile": Array [
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
|
||||
],
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
|
||||
],
|
||||
],
|
||||
"isFile": Array [],
|
||||
"isSymlink": Array [],
|
||||
"mkdirp": Array [],
|
||||
"readFile": Array [],
|
||||
"rmdirp": Array [],
|
||||
"unlink": Array [],
|
||||
"writeFile": Array [],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`bin script points to a file creates a symlink in the project node_modules/.bin directory: fs module calls 1`] = `
|
||||
exports[`bin script points to a file creates a symlink for the project bin into the roots project node_modules/.bin directory as well as node_modules/.bin directory symlink into the roots one: fs module calls 1`] = `
|
||||
Object {
|
||||
"chmod": Array [
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/foo/node_modules/.bin/bar",
|
||||
"755",
|
||||
],
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/baz/node_modules/.bin/bar",
|
||||
"755",
|
||||
],
|
||||
],
|
||||
"chmod": Array [],
|
||||
"copyDirectory": Array [],
|
||||
"createSymlink": Array [
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/foo/node_modules/.bin/bar",
|
||||
"exec",
|
||||
],
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/baz/node_modules/.bin/bar",
|
||||
"exec",
|
||||
],
|
||||
],
|
||||
"createSymlink": Array [],
|
||||
"isDirectory": Array [],
|
||||
"isFile": Array [
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
|
||||
],
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
|
||||
],
|
||||
],
|
||||
"isFile": Array [],
|
||||
"isSymlink": Array [],
|
||||
"mkdirp": Array [
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/foo/node_modules/.bin",
|
||||
],
|
||||
Array [
|
||||
"<repoRoot>/packages/kbn-pm/src/utils/baz/node_modules/.bin",
|
||||
],
|
||||
],
|
||||
"mkdirp": Array [],
|
||||
"readFile": Array [],
|
||||
"rmdirp": Array [],
|
||||
"unlink": Array [],
|
||||
"writeFile": Array [],
|
||||
}
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`#ensureValidProjectDependency using link: in workspace 1`] = `"[kibana] depends on [foo] but should be using a workspace. Update its package.json to the expected value below."`;
|
||||
|
||||
exports[`#ensureValidProjectDependency using link:, but with wrong path 1`] = `"[kibana] depends on [foo] using 'link:', but the path is wrong. Update its package.json to the expected value below."`;
|
||||
|
||||
exports[`#ensureValidProjectDependency using version instead of link: 1`] = `"[kibana] depends on [foo] but it's not using the local package. Update its package.json to the expected value below."`;
|
||||
|
||||
exports[`#ensureValidProjectDependency using wrong version in workspace 1`] = `"[kibana] depends on [foo] but it's not using the local package. Update its package.json to the expected value below."`;
|
||||
|
||||
exports[`#getExecutables() throws CliError when bin is something strange 1`] = `"[kibana] has an invalid \\"bin\\" field in its package.json, expected an object or a string"`;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
import cmdShimCb from 'cmd-shim';
|
||||
import del from 'del';
|
||||
import fs from 'fs';
|
||||
import { ncp } from 'ncp';
|
||||
import { dirname, relative } from 'path';
|
||||
|
@ -31,6 +32,7 @@ export const chmod = promisify(fs.chmod);
|
|||
const cmdShim = promisify<string, string>(cmdShimCb);
|
||||
const mkdir = promisify(fs.mkdir);
|
||||
export const mkdirp = async (path: string) => await mkdir(path, { recursive: true });
|
||||
export const rmdirp = async (path: string) => await del(path, { force: true });
|
||||
export const unlink = promisify(fs.unlink);
|
||||
export const copyDirectory = promisify(ncp);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ export class Kibana {
|
|||
return new Kibana(await getProjects(rootPath, getProjectPaths({ rootPath })));
|
||||
}
|
||||
|
||||
private readonly kibanaProject: Project;
|
||||
public readonly kibanaProject: Project;
|
||||
|
||||
constructor(private readonly allWorkspaceProjects: ProjectMap) {
|
||||
const kibanaProject = allWorkspaceProjects.get('kibana');
|
||||
|
|
|
@ -73,6 +73,7 @@ const projectsByName = new Map([
|
|||
),
|
||||
],
|
||||
]);
|
||||
(projectsByName.get('bar') as Project).isSinglePackageJsonProject = true;
|
||||
|
||||
const projectGraph = buildProjectGraph(projectsByName);
|
||||
|
||||
|
@ -96,9 +97,10 @@ afterEach(() => {
|
|||
});
|
||||
|
||||
describe('bin script points nowhere', () => {
|
||||
test('does not try to create symlink or node_modules/.bin directory', async () => {
|
||||
test('does not try to create symlink on node_modules/.bin for that bin script', async () => {
|
||||
const fs = require('./fs');
|
||||
fs.isFile.mockReturnValue(false);
|
||||
fs.isDirectory.mockReturnValue(true);
|
||||
|
||||
await linkProjectExecutables(projectsByName, projectGraph);
|
||||
expect(getFsMockCalls()).toMatchSnapshot('fs module calls');
|
||||
|
@ -106,9 +108,10 @@ describe('bin script points nowhere', () => {
|
|||
});
|
||||
|
||||
describe('bin script points to a file', () => {
|
||||
test('creates a symlink in the project node_modules/.bin directory', async () => {
|
||||
test('creates a symlink for the project bin into the roots project node_modules/.bin directory as well as node_modules/.bin directory symlink into the roots one', async () => {
|
||||
const fs = require('./fs');
|
||||
fs.isFile.mockReturnValue(true);
|
||||
fs.isDirectory.mockReturnValue(false);
|
||||
|
||||
await linkProjectExecutables(projectsByName, projectGraph);
|
||||
|
||||
|
@ -116,8 +119,6 @@ describe('bin script points to a file', () => {
|
|||
expect(logWriter.messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
debg Linking package executables,
|
||||
debg [foo] bar -> ../bar/bin/bar.js,
|
||||
debg [baz] bar -> ../bar/bin/bar.js,
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
|
|
@ -36,32 +36,46 @@ export async function linkProjectExecutables(
|
|||
projectGraph: ProjectGraph
|
||||
) {
|
||||
log.debug(`Linking package executables`);
|
||||
|
||||
// Find root and generate executables from dependencies for it
|
||||
let rootProject = null;
|
||||
let rootProjectDeps = [] as any;
|
||||
for (const [projectName, projectDeps] of projectGraph) {
|
||||
const project = projectsByName.get(projectName)!;
|
||||
const binsDir = resolve(project.nodeModulesLocation, '.bin');
|
||||
if (project.isSinglePackageJsonProject) {
|
||||
rootProject = projectsByName.get(projectName);
|
||||
rootProjectDeps = projectDeps;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (const projectDep of projectDeps) {
|
||||
const executables = projectDep.getExecutables();
|
||||
for (const name of Object.keys(executables)) {
|
||||
const srcPath = executables[name];
|
||||
if (!rootProject) {
|
||||
throw new Error('Could not finding root project while linking package executables');
|
||||
}
|
||||
|
||||
// existing logic from lerna -- ensure that the bin we are going to
|
||||
// point to exists or ignore it
|
||||
if (!(await isFile(srcPath))) {
|
||||
continue;
|
||||
}
|
||||
// Prepare root project node_modules/.bin
|
||||
const rootBinsDir = resolve(rootProject.nodeModulesLocation, '.bin');
|
||||
for (const rootProjectDep of rootProjectDeps) {
|
||||
const executables = rootProjectDep.getExecutables();
|
||||
for (const name of Object.keys(executables)) {
|
||||
const srcPath = executables[name];
|
||||
|
||||
const dest = resolve(binsDir, name);
|
||||
|
||||
// Get relative project path with normalized path separators.
|
||||
const projectRelativePath = relative(project.path, srcPath).split(sep).join('/');
|
||||
|
||||
log.debug(`[${project.name}] ${name} -> ${projectRelativePath}`);
|
||||
|
||||
await mkdirp(dirname(dest));
|
||||
await createSymlink(srcPath, dest, 'exec');
|
||||
await chmod(dest, '755');
|
||||
// existing logic from lerna -- ensure that the bin we are going to
|
||||
// point to exists or ignore it
|
||||
if (!(await isFile(srcPath))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const dest = resolve(rootBinsDir, name);
|
||||
|
||||
// Get relative project path with normalized path separators.
|
||||
const rootProjectRelativePath = relative(rootProject.path, srcPath).split(sep).join('/');
|
||||
|
||||
log.debug(`[${rootProject.name}] ${name} -> ${rootProjectRelativePath}`);
|
||||
|
||||
await mkdirp(dirname(dest));
|
||||
await createSymlink(srcPath, dest, 'exec');
|
||||
await chmod(dest, '755');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,4 +38,31 @@ export function writePackageJson(path: string, json: IPackageJson) {
|
|||
return writePkg(path, json);
|
||||
}
|
||||
|
||||
export const createProductionPackageJson = (pkgJson: IPackageJson) => ({
|
||||
...pkgJson,
|
||||
dependencies: transformDependencies(pkgJson.dependencies),
|
||||
});
|
||||
|
||||
export const isLinkDependency = (depVersion: string) => 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.
|
||||
*/
|
||||
export function transformDependencies(dependencies: IPackageDependencies = {}) {
|
||||
const newDeps: IPackageDependencies = {};
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ describe('#ensureValidProjectDependency', () => {
|
|||
'packages/foo'
|
||||
);
|
||||
|
||||
expect(() => root.ensureValidProjectDependency(foo, false)).not.toThrow();
|
||||
expect(() => root.ensureValidProjectDependency(foo)).not.toThrow();
|
||||
});
|
||||
|
||||
test('using link:, but with wrong path', () => {
|
||||
|
@ -96,7 +96,7 @@ describe('#ensureValidProjectDependency', () => {
|
|||
'packages/foo'
|
||||
);
|
||||
|
||||
expect(() => root.ensureValidProjectDependency(foo, false)).toThrowErrorMatchingSnapshot();
|
||||
expect(() => root.ensureValidProjectDependency(foo)).toThrowErrorMatchingSnapshot();
|
||||
});
|
||||
|
||||
test('using version instead of link:', () => {
|
||||
|
@ -116,60 +116,7 @@ describe('#ensureValidProjectDependency', () => {
|
|||
'packages/foo'
|
||||
);
|
||||
|
||||
expect(() => root.ensureValidProjectDependency(foo, false)).toThrowErrorMatchingSnapshot();
|
||||
});
|
||||
|
||||
test('using version in workspace', () => {
|
||||
const root = createProjectWith({
|
||||
dependencies: {
|
||||
foo: '1.0.0',
|
||||
},
|
||||
});
|
||||
|
||||
const foo = createProjectWith(
|
||||
{
|
||||
name: 'foo',
|
||||
version: '1.0.0',
|
||||
},
|
||||
'packages/foo'
|
||||
);
|
||||
|
||||
expect(() => root.ensureValidProjectDependency(foo, true)).not.toThrow();
|
||||
});
|
||||
|
||||
test('using wrong version in workspace', () => {
|
||||
const root = createProjectWith({
|
||||
dependencies: {
|
||||
foo: '1.0.0',
|
||||
},
|
||||
});
|
||||
|
||||
const foo = createProjectWith(
|
||||
{
|
||||
name: 'foo',
|
||||
version: '2.0.0',
|
||||
},
|
||||
'packages/foo'
|
||||
);
|
||||
|
||||
expect(() => root.ensureValidProjectDependency(foo, true)).toThrowErrorMatchingSnapshot();
|
||||
});
|
||||
|
||||
test('using link: in workspace', () => {
|
||||
const root = createProjectWith({
|
||||
dependencies: {
|
||||
foo: 'link:packages/foo',
|
||||
},
|
||||
});
|
||||
|
||||
const foo = createProjectWith(
|
||||
{
|
||||
name: 'foo',
|
||||
},
|
||||
'packages/foo'
|
||||
);
|
||||
|
||||
expect(() => root.ensureValidProjectDependency(foo, true)).toThrowErrorMatchingSnapshot();
|
||||
expect(() => root.ensureValidProjectDependency(foo)).toThrowErrorMatchingSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import Path from 'path';
|
||||
import { inspect } from 'util';
|
||||
|
||||
|
@ -30,12 +29,7 @@ import {
|
|||
isLinkDependency,
|
||||
readPackageJson,
|
||||
} from './package_json';
|
||||
import {
|
||||
installInDir,
|
||||
runScriptInPackage,
|
||||
runScriptInPackageStreaming,
|
||||
yarnWorkspacesInfo,
|
||||
} from './scripts';
|
||||
import { installInDir, runScriptInPackage, runScriptInPackageStreaming } from './scripts';
|
||||
|
||||
interface BuildConfig {
|
||||
skip?: boolean;
|
||||
|
@ -74,8 +68,7 @@ export class Project {
|
|||
/** scripts defined in the package.json file for the project [name => body] */
|
||||
public readonly scripts: IPackageScripts;
|
||||
|
||||
public isWorkspaceRoot = false;
|
||||
public isWorkspaceProject = false;
|
||||
public isSinglePackageJsonProject = false;
|
||||
|
||||
constructor(packageJson: IPackageJson, projectPath: string) {
|
||||
this.json = Object.freeze(packageJson);
|
||||
|
@ -92,7 +85,7 @@ export class Project {
|
|||
...this.devDependencies,
|
||||
...this.productionDependencies,
|
||||
};
|
||||
this.isWorkspaceRoot = this.json.hasOwnProperty('workspaces');
|
||||
this.isSinglePackageJsonProject = this.json.name === 'kibana';
|
||||
|
||||
this.scripts = this.json.scripts || {};
|
||||
}
|
||||
|
@ -101,38 +94,36 @@ export class Project {
|
|||
return this.json.name;
|
||||
}
|
||||
|
||||
public ensureValidProjectDependency(project: Project, dependentProjectIsInWorkspace: boolean) {
|
||||
public ensureValidProjectDependency(project: Project) {
|
||||
const relativePathToProject = normalizePath(Path.relative(this.path, project.path));
|
||||
|
||||
const versionInPackageJson = this.allDependencies[project.name];
|
||||
const expectedVersionInPackageJson = `link:${relativePathToProject}`;
|
||||
|
||||
let expectedVersionInPackageJson;
|
||||
if (dependentProjectIsInWorkspace) {
|
||||
expectedVersionInPackageJson = project.json.version;
|
||||
} else {
|
||||
const relativePathToProject = normalizePath(Path.relative(this.path, project.path));
|
||||
expectedVersionInPackageJson = `link:${relativePathToProject}`;
|
||||
}
|
||||
// TODO: after introduce bazel to build packages do not allow child projects
|
||||
// to hold dependencies
|
||||
|
||||
// No issues!
|
||||
if (versionInPackageJson === expectedVersionInPackageJson) {
|
||||
return;
|
||||
}
|
||||
|
||||
let problemMsg;
|
||||
if (isLinkDependency(versionInPackageJson) && dependentProjectIsInWorkspace) {
|
||||
problemMsg = `but should be using a workspace`;
|
||||
} else if (isLinkDependency(versionInPackageJson)) {
|
||||
problemMsg = `using 'link:', but the path is wrong`;
|
||||
} else {
|
||||
problemMsg = `but it's not using the local package`;
|
||||
const updateMsg = 'Update its package.json to the expected value below.';
|
||||
const meta = {
|
||||
actual: `"${project.name}": "${versionInPackageJson}"`,
|
||||
expected: `"${project.name}": "${expectedVersionInPackageJson}"`,
|
||||
package: `${this.name} (${this.packageJsonLocation})`,
|
||||
};
|
||||
|
||||
if (isLinkDependency(versionInPackageJson)) {
|
||||
throw new CliError(
|
||||
`[${this.name}] depends on [${project.name}] using 'link:', but the path is wrong. ${updateMsg}`,
|
||||
meta
|
||||
);
|
||||
}
|
||||
|
||||
throw new CliError(
|
||||
`[${this.name}] depends on [${project.name}] ${problemMsg}. Update its package.json to the expected value below.`,
|
||||
{
|
||||
actual: `"${project.name}": "${versionInPackageJson}"`,
|
||||
expected: `"${project.name}": "${expectedVersionInPackageJson}"`,
|
||||
package: `${this.name} (${this.packageJsonLocation})`,
|
||||
}
|
||||
`[${this.name}] depends on [${project.name}] but it's not using the local package. ${updateMsg}`,
|
||||
meta
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -213,47 +204,16 @@ export class Project {
|
|||
return Object.keys(this.allDependencies).length > 0;
|
||||
}
|
||||
|
||||
public isEveryDependencyLocal() {
|
||||
return Object.values(this.allDependencies).every((dep) => isLinkDependency(dep));
|
||||
}
|
||||
|
||||
public async installDependencies({ extraArgs }: { extraArgs: string[] }) {
|
||||
log.info(`[${this.name}] running yarn`);
|
||||
|
||||
log.write('');
|
||||
await installInDir(this.path, extraArgs);
|
||||
log.write('');
|
||||
|
||||
await this.removeExtraneousNodeModules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Yarn workspaces symlinks workspace projects to the root node_modules, even
|
||||
* when there is no depenency on the project. This results in unnecicary, and
|
||||
* often duplicated code in the build archives.
|
||||
*/
|
||||
public async removeExtraneousNodeModules() {
|
||||
// this is only relevant for the root workspace
|
||||
if (!this.isWorkspaceRoot) {
|
||||
return;
|
||||
}
|
||||
|
||||
const workspacesInfo = await yarnWorkspacesInfo(this.path);
|
||||
const unusedWorkspaces = new Set(Object.keys(workspacesInfo));
|
||||
|
||||
// check for any cross-project dependency
|
||||
for (const name of Object.keys(workspacesInfo)) {
|
||||
const workspace = workspacesInfo[name];
|
||||
workspace.workspaceDependencies.forEach((w) => unusedWorkspaces.delete(w));
|
||||
}
|
||||
|
||||
unusedWorkspaces.forEach((name) => {
|
||||
const { dependencies, devDependencies } = this.json;
|
||||
const nodeModulesPath = Path.resolve(this.nodeModulesLocation, name);
|
||||
const isDependency = dependencies && dependencies.hasOwnProperty(name);
|
||||
const isDevDependency = devDependencies && devDependencies.hasOwnProperty(name);
|
||||
|
||||
if (!isDependency && !isDevDependency && fs.existsSync(nodeModulesPath)) {
|
||||
log.debug(`No dependency on ${name}, removing link in node_modules`);
|
||||
fs.unlinkSync(nodeModulesPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -223,16 +223,6 @@ describe('#topologicallyBatchProjects', () => {
|
|||
|
||||
expect(expectedBatches).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe('batchByWorkspace = true', () => {
|
||||
test('batches projects topologically based on their project dependencies and workspaces', async () => {
|
||||
const batches = topologicallyBatchProjects(projects, graph, { batchByWorkspace: true });
|
||||
|
||||
const expectedBatches = batches.map((batch) => batch.map((project) => project.name));
|
||||
|
||||
expect(expectedBatches).toEqual([['kibana'], ['bar', 'foo'], ['baz', 'zorge'], ['quux']]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#includeTransitiveProjects', () => {
|
||||
|
|
|
@ -23,7 +23,6 @@ import { promisify } from 'util';
|
|||
|
||||
import { CliError } from './errors';
|
||||
import { Project } from './project';
|
||||
import { workspacePackagePaths } from './workspaces';
|
||||
|
||||
const glob = promisify(globSync);
|
||||
|
||||
|
@ -42,8 +41,6 @@ export async function getProjects(
|
|||
) {
|
||||
const projects: ProjectMap = new Map();
|
||||
|
||||
const workspaceProjectsPaths = await workspacePackagePaths(rootPath);
|
||||
|
||||
for (const pattern of projectsPathsPatterns) {
|
||||
const pathsToProcess = await packagesFromGlobPattern({ pattern, rootPath });
|
||||
|
||||
|
@ -52,10 +49,6 @@ export async function getProjects(
|
|||
const projectDir = path.dirname(projectConfigPath);
|
||||
const project = await Project.fromPath(projectDir);
|
||||
|
||||
if (workspaceProjectsPaths.indexOf(filePath) >= 0) {
|
||||
project.isWorkspaceProject = true;
|
||||
}
|
||||
|
||||
const excludeProject =
|
||||
exclude.includes(project.name) || (include.length > 0 && !include.includes(project.name));
|
||||
|
||||
|
@ -112,10 +105,7 @@ export function buildProjectGraph(projects: ProjectMap) {
|
|||
for (const depName of Object.keys(dependencies)) {
|
||||
if (projects.has(depName)) {
|
||||
const dep = projects.get(depName)!;
|
||||
|
||||
const dependentProjectIsInWorkspace =
|
||||
project.isWorkspaceProject || project.json.name === 'kibana';
|
||||
project.ensureValidProjectDependency(dep, dependentProjectIsInWorkspace);
|
||||
project.ensureValidProjectDependency(dep);
|
||||
|
||||
projectDeps.push(dep);
|
||||
}
|
||||
|
@ -129,40 +119,12 @@ export function buildProjectGraph(projects: ProjectMap) {
|
|||
|
||||
export function topologicallyBatchProjects(
|
||||
projectsToBatch: ProjectMap,
|
||||
projectGraph: ProjectGraph,
|
||||
{ batchByWorkspace = false } = {}
|
||||
projectGraph: ProjectGraph
|
||||
) {
|
||||
// We're going to be chopping stuff out of this list, so copy it.
|
||||
const projectsLeftToBatch = new Set(projectsToBatch.keys());
|
||||
const batches = [];
|
||||
|
||||
if (batchByWorkspace) {
|
||||
const workspaceRootProject = Array.from(projectsToBatch.values()).find(
|
||||
(p) => p.isWorkspaceRoot
|
||||
);
|
||||
|
||||
if (!workspaceRootProject) {
|
||||
throw new CliError(`There was no yarn workspace root found.`);
|
||||
}
|
||||
|
||||
// Push in the workspace root first.
|
||||
batches.push([workspaceRootProject]);
|
||||
projectsLeftToBatch.delete(workspaceRootProject.name);
|
||||
|
||||
// In the next batch, push in all workspace projects.
|
||||
const workspaceBatch = [];
|
||||
for (const projectName of projectsLeftToBatch) {
|
||||
const project = projectsToBatch.get(projectName)!;
|
||||
|
||||
if (project.isWorkspaceProject) {
|
||||
workspaceBatch.push(project);
|
||||
projectsLeftToBatch.delete(projectName);
|
||||
}
|
||||
}
|
||||
|
||||
batches.push(workspaceBatch);
|
||||
}
|
||||
|
||||
while (projectsLeftToBatch.size > 0) {
|
||||
// Get all projects that have no remaining dependencies within the repo
|
||||
// that haven't yet been picked.
|
||||
|
|
|
@ -22,15 +22,6 @@ import { Project } from './project';
|
|||
|
||||
const YARN_EXEC = process.env.npm_execpath || 'yarn';
|
||||
|
||||
interface WorkspaceInfo {
|
||||
location: string;
|
||||
workspaceDependencies: string[];
|
||||
}
|
||||
|
||||
interface WorkspacesInfo {
|
||||
[s: string]: WorkspaceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install all dependencies in the given directory
|
||||
*/
|
||||
|
@ -78,16 +69,3 @@ export function runScriptInPackageStreaming({
|
|||
debug,
|
||||
});
|
||||
}
|
||||
|
||||
export async function yarnWorkspacesInfo(directory: string): Promise<WorkspacesInfo> {
|
||||
const { stdout } = await spawn(YARN_EXEC, ['--json', 'workspaces', 'info'], {
|
||||
cwd: directory,
|
||||
stdio: 'pipe',
|
||||
});
|
||||
|
||||
try {
|
||||
return JSON.parse(JSON.parse(stdout).data);
|
||||
} catch (error) {
|
||||
throw new Error(`'yarn workspaces info --json' produced unexpected output: \n${stdout}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,14 @@
|
|||
import { stringify as stringifyLockfile } from '@yarnpkg/lockfile';
|
||||
import dedent from 'dedent';
|
||||
import chalk from 'chalk';
|
||||
import { sep } from 'path';
|
||||
|
||||
import { writeFile } from './fs';
|
||||
import { Kibana } from './kibana';
|
||||
import { YarnLock } from './yarn_lock';
|
||||
import { log } from './log';
|
||||
import { Project } from './project';
|
||||
import { isLinkDependency } from './package_json';
|
||||
import { ITree, treeToString } from './projects_tree';
|
||||
|
||||
export async function validateDependencies(kbn: Kibana, yarnLock: YarnLock) {
|
||||
|
@ -102,6 +104,11 @@ export async function validateDependencies(kbn: Kibana, yarnLock: YarnLock) {
|
|||
// look through all the package.json files to find packages which have mismatched version ranges
|
||||
const depRanges = new Map<string, Array<{ range: string; projects: Project[] }>>();
|
||||
for (const project of kbn.getAllProjects().values()) {
|
||||
// Skip if this is an external plugin
|
||||
if (project.path.includes(`${kbn.kibanaProject?.path}${sep}plugins`)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const [dep, range] of Object.entries(project.allDependencies)) {
|
||||
const existingDep = depRanges.get(dep);
|
||||
if (!existingDep) {
|
||||
|
@ -128,7 +135,9 @@ export async function validateDependencies(kbn: Kibana, yarnLock: YarnLock) {
|
|||
}
|
||||
|
||||
const duplicateRanges = Array.from(depRanges.entries())
|
||||
.filter(([, ranges]) => ranges.length > 1)
|
||||
.filter(
|
||||
([, ranges]) => ranges.length > 1 && !ranges.every((rng) => isLinkDependency(rng.range))
|
||||
)
|
||||
.reduce(
|
||||
(acc: string[], [dep, ranges]) => [
|
||||
...acc,
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import globSync from 'glob';
|
||||
import path from 'path';
|
||||
import { promisify } from 'util';
|
||||
|
||||
import { getProjectPaths } from '../config';
|
||||
import { copyDirectory, isSymlink, unlink } from './fs';
|
||||
import { readPackageJson } from './package_json';
|
||||
import { getProjects } from './projects';
|
||||
|
||||
const glob = promisify(globSync);
|
||||
|
||||
export async function workspacePackagePaths(rootPath: string): Promise<string[]> {
|
||||
const rootPkgJson = await readPackageJson(rootPath);
|
||||
|
||||
if (!rootPkgJson.workspaces) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const workspacesPathsPatterns: string[] = rootPkgJson.workspaces.packages;
|
||||
let workspaceProjectsPaths: string[] = [];
|
||||
|
||||
for (const pattern of workspacesPathsPatterns) {
|
||||
workspaceProjectsPaths = workspaceProjectsPaths.concat(
|
||||
await packagesFromGlobPattern({ pattern, rootPath })
|
||||
);
|
||||
}
|
||||
|
||||
// Filter out exclude glob patterns
|
||||
for (const pattern of workspacesPathsPatterns) {
|
||||
if (pattern.startsWith('!')) {
|
||||
const pathToRemove = path.join(rootPath, pattern.slice(1), 'package.json');
|
||||
workspaceProjectsPaths = workspaceProjectsPaths.filter((p) => p !== pathToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
return workspaceProjectsPaths;
|
||||
}
|
||||
|
||||
export async function copyWorkspacePackages(rootPath: string): Promise<void> {
|
||||
const projectPaths = getProjectPaths({ rootPath });
|
||||
const projects = await getProjects(rootPath, projectPaths);
|
||||
|
||||
for (const project of projects.values()) {
|
||||
const dest = path.resolve(rootPath, 'node_modules', project.name);
|
||||
|
||||
if ((await isSymlink(dest)) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove the symlink
|
||||
await unlink(dest);
|
||||
|
||||
// Copy in the package
|
||||
await copyDirectory(project.path, dest);
|
||||
}
|
||||
}
|
||||
|
||||
function packagesFromGlobPattern({ pattern, rootPath }: { pattern: string; rootPath: string }) {
|
||||
const globOptions = {
|
||||
cwd: rootPath,
|
||||
|
||||
// Should throw in case of unusual errors when reading the file system
|
||||
strict: true,
|
||||
|
||||
// Always returns absolute paths for matched files
|
||||
absolute: true,
|
||||
|
||||
// Do not match ** against multiple filenames
|
||||
// (This is only specified because we currently don't have a need for it.)
|
||||
noglobstar: true,
|
||||
};
|
||||
|
||||
return glob(path.join(pattern, 'package.json'), globOptions);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -7,21 +7,11 @@
|
|||
"devOnly": true
|
||||
},
|
||||
"scripts": {
|
||||
"kbn:bootstrap": "tsc",
|
||||
"kbn:watch": "tsc --watch"
|
||||
"kbn:bootstrap": "../../node_modules/.bin/tsc",
|
||||
"kbn:watch": "../../node_modules/.bin/tsc --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/utils": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"axios": "^0.19.2",
|
||||
"cheerio": "0.22.0",
|
||||
"dedent": "^0.7.0",
|
||||
"graphql": "^0.13.2",
|
||||
"graphql-tag": "^2.10.3",
|
||||
"terminal-link": "^2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"markdown-it": "^10.0.0",
|
||||
"typescript": "4.0.2"
|
||||
"@kbn/utils": "link:../kbn-utils",
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -7,8 +7,8 @@
|
|||
"lib": "lib"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"format": "prettier **/*.js --write"
|
||||
"test": "../../node_modules/.bin/jest",
|
||||
"format": "../../node_modules/.bin/prettier **/*.js --write"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
|
@ -18,13 +18,5 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/jbudz/spec-to-console/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jbudz/spec-to-console#readme",
|
||||
"devDependencies": {
|
||||
"jest": "^26.4.2",
|
||||
"prettier": "^2.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": "^3.0.2",
|
||||
"glob": "^7.1.2"
|
||||
}
|
||||
}
|
||||
"homepage": "https://github.com/jbudz/spec-to-console#readme"
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -6,15 +6,10 @@
|
|||
"license": "Apache-2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "../../node_modules/.bin/tsc",
|
||||
"kbn:bootstrap": "yarn build"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/utility-types": "1.0.0",
|
||||
"typescript": "4.0.2",
|
||||
"tsd": "^0.13.1"
|
||||
"@kbn/utility-types": "link:../kbn-utility-types"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -4,17 +4,15 @@
|
|||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"main": "./target/index.js",
|
||||
"devDependencies": {
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@types/loader-utils": "^1.1.3",
|
||||
"@types/webpack-merge": "^4.1.5"
|
||||
},
|
||||
"kibana": {
|
||||
"devOnly": true
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "../../node_modules/.bin/tsc",
|
||||
"kbn:bootstrap": "yarn build",
|
||||
"watch": "yarn build --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,18 +8,12 @@
|
|||
"devOnly": true
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src --out-dir target --delete-dir-on-start --extensions .ts --source-maps=inline",
|
||||
"build": "../../node_modules/.bin/babel src --out-dir target --delete-dir-on-start --extensions .ts --source-maps=inline",
|
||||
"kbn:bootstrap": "yarn build",
|
||||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"lodash": "^4.17.20",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/utility-types": "1.0.0",
|
||||
"@types/normalize-path": "^3.0.0",
|
||||
"normalize-path": "^3.0.0",
|
||||
"@types/lodash": "^4.14.159",
|
||||
"moment": "^2.24.0",
|
||||
"typescript": "4.0.2"
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils",
|
||||
"@kbn/utility-types": "link:../kbn-utility-types"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"license": "Apache-2.0",
|
||||
"main": "./target/index.js",
|
||||
"scripts": {
|
||||
"build": "babel src --out-dir target --delete-dir-on-start --extensions .ts,.js,.tsx --ignore *.test.js,**/__tests__/** --source-maps=inline",
|
||||
"build": "../../node_modules/.bin/babel src --out-dir target --delete-dir-on-start --extensions .ts,.js,.tsx --ignore *.test.js,**/__tests__/** --source-maps=inline",
|
||||
"kbn:bootstrap": "yarn build",
|
||||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
|
@ -13,36 +13,8 @@
|
|||
"devOnly": true
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.10.5",
|
||||
"@jest/types": "^26.5.2",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/utils": "1.0.0",
|
||||
"@types/joi": "^13.4.2",
|
||||
"@types/lodash": "^4.14.159",
|
||||
"@types/parse-link-header": "^1.0.0",
|
||||
"@types/strip-ansi": "^5.2.1",
|
||||
"@types/xml2js": "^0.4.5",
|
||||
"diff": "^4.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/reporters": "^26.5.2",
|
||||
"chalk": "^4.1.0",
|
||||
"dedent": "^0.7.0",
|
||||
"del": "^5.1.0",
|
||||
"execa": "^4.0.2",
|
||||
"exit-hook": "^2.2.0",
|
||||
"getopts": "^2.2.5",
|
||||
"glob": "^7.1.2",
|
||||
"globby": "^8.0.1",
|
||||
"joi": "^13.5.2",
|
||||
"lodash": "^4.17.20",
|
||||
"mustache": "^2.3.2",
|
||||
"parse-link-header": "^1.0.1",
|
||||
"rxjs": "^6.5.5",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"tar-fs": "^2.1.0",
|
||||
"xml2js": "^0.4.22",
|
||||
"zlib": "^1.0.5"
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset",
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils",
|
||||
"@kbn/utils": "link:../kbn-utils"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -17,10 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
const sass = require('node-sass');
|
||||
const postcss = require('postcss');
|
||||
const postcssConfig = require('@kbn/optimizer/postcss.config.js');
|
||||
const chokidar = require('chokidar');
|
||||
const path = require('path');
|
||||
const { debounce } = require('lodash');
|
||||
|
||||
const platform = require('os').platform();
|
||||
|
@ -57,9 +59,12 @@ module.exports = function (grunt) {
|
|||
},
|
||||
});
|
||||
|
||||
const cwd = process.cwd();
|
||||
grunt.file.setBase(path.resolve(__dirname, '../..'));
|
||||
grunt.loadNpmTasks('grunt-babel');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.file.setBase(cwd);
|
||||
grunt.registerTask('prodBuild', ['clean:target', 'copy:makeProdBuild', 'babel:prodBuild']);
|
||||
|
||||
grunt.registerTask('docSiteBuild', function () {
|
||||
|
|
|
@ -3,73 +3,19 @@
|
|||
"version": "1.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "grunt prodBuild",
|
||||
"docSiteStart": "grunt docSiteStart",
|
||||
"docSiteBuild": "grunt docSiteBuild",
|
||||
"createComponent": "yo ./generator-kui/app/component.js",
|
||||
"documentComponent": "yo ./generator-kui/app/documentation.js"
|
||||
"build": "../../node_modules/.bin/grunt prodBuild",
|
||||
"docSiteStart": "../../node_modules/.bin/grunt docSiteStart",
|
||||
"docSiteBuild": "../../node_modules/.bin/grunt docSiteBuild",
|
||||
"createComponent": "../../node_modules/.bin/yo ./generator-kui/app/component.js",
|
||||
"documentComponent": "../../node_modules/.bin/yo ./generator-kui/app/documentation.js"
|
||||
},
|
||||
"kibana": {
|
||||
"build": {
|
||||
"intermediateBuildDirectory": "target"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"classnames": "2.2.6",
|
||||
"focus-trap-react": "^3.1.1",
|
||||
"lodash": "^4.17.20",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^16.12.0",
|
||||
"react-ace": "^5.9.0",
|
||||
"react-color": "^2.13.8",
|
||||
"tabbable": "1.1.3",
|
||||
"uuid": "3.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"enzyme": "^3.8.0",
|
||||
"enzyme-adapter-react-16": "^1.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@elastic/eui": "30.1.1",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/optimizer": "1.0.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"brace": "0.11.1",
|
||||
"chalk": "^4.1.0",
|
||||
"chokidar": "^3.4.2",
|
||||
"core-js": "^3.6.5",
|
||||
"css-loader": "^3.4.2",
|
||||
"expose-loader": "^0.7.5",
|
||||
"file-loader": "^4.2.0",
|
||||
"grunt": "1.0.4",
|
||||
"grunt-babel": "^8.0.0",
|
||||
"grunt-contrib-clean": "^1.1.0",
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"highlight.js": "9.15.10",
|
||||
"html": "1.0.0",
|
||||
"html-loader": "^0.5.5",
|
||||
"imports-loader": "^0.8.0",
|
||||
"jquery": "^3.5.0",
|
||||
"keymirror": "0.1.1",
|
||||
"moment": "^2.24.0",
|
||||
"node-sass": "^4.13.1",
|
||||
"postcss": "^7.0.32",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"raw-loader": "^3.1.0",
|
||||
"react-dom": "^16.12.0",
|
||||
"react-redux": "^7.2.0",
|
||||
"react-router": "^5.2.0",
|
||||
"react-router-redux": "^4.0.8",
|
||||
"redux": "^4.0.5",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"regenerator-runtime": "^0.13.3",
|
||||
"sass-loader": "^8.0.2",
|
||||
"sinon": "^7.4.2",
|
||||
"style-loader": "^1.1.3",
|
||||
"webpack": "^4.41.5",
|
||||
"webpack-dev-server": "^3.8.2",
|
||||
"yeoman-generator": "1.1.1",
|
||||
"yo": "2.0.6"
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset",
|
||||
"@kbn/optimizer": "link:../kbn-optimizer"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -9,41 +9,11 @@
|
|||
"kbn:watch": "node scripts/build --dev --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/charts": "24.0.0",
|
||||
"@elastic/eui": "30.1.1",
|
||||
"@elastic/numeral": "^2.5.0",
|
||||
"@kbn/i18n": "1.0.0",
|
||||
"@kbn/monaco": "1.0.0",
|
||||
"abortcontroller-polyfill": "^1.4.0",
|
||||
"angular": "^1.8.0",
|
||||
"compression-webpack-plugin": "^4.0.0",
|
||||
"core-js": "^3.6.5",
|
||||
"custom-event-polyfill": "^0.3.0",
|
||||
"jquery": "^3.5.0",
|
||||
"lodash": "^4.17.20",
|
||||
"mini-css-extract-plugin": "0.8.0",
|
||||
"moment": "^2.24.0",
|
||||
"moment-timezone": "^0.5.27",
|
||||
"react": "^16.12.0",
|
||||
"react-dom": "^16.12.0",
|
||||
"react-is": "^16.8.0",
|
||||
"react-router": "^5.2.0",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"regenerator-runtime": "^0.13.3",
|
||||
"rxjs": "^6.5.5",
|
||||
"styled-components": "^5.1.0",
|
||||
"symbol-observable": "^1.2.0",
|
||||
"tslib": "^2.0.0",
|
||||
"whatwg-fetch": "^3.0.0"
|
||||
"@kbn/i18n": "link:../kbn-i18n",
|
||||
"@kbn/monaco": "link:../kbn-monaco"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
||||
"css-loader": "^3.4.2",
|
||||
"del": "^5.1.0",
|
||||
"loader-utils": "^1.2.3",
|
||||
"val-loader": "^1.1.1",
|
||||
"webpack": "^4.41.5"
|
||||
"@kbn/babel-preset": "link:../kbn-babel-preset",
|
||||
"@kbn/dev-utils": "link:../kbn-dev-utils"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -9,17 +9,10 @@
|
|||
"devOnly": true
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"kbn:bootstrap": "tsc",
|
||||
"kbn:watch": "tsc --watch",
|
||||
"test": "tsd",
|
||||
"clean": "del target"
|
||||
},
|
||||
"dependencies": {
|
||||
"utility-types": "^3.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"del-cli": "^3.0.1",
|
||||
"tsd": "^0.13.1"
|
||||
"build": "../../node_modules/.bin/tsc",
|
||||
"kbn:bootstrap": "../../node_modules/.bin/tsc",
|
||||
"kbn:watch": "../../node_modules/.bin/tsc --watch",
|
||||
"test": "../../node_modules/.bin/tsd",
|
||||
"clean": "../../node_modules/.bin/del target"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -5,15 +5,11 @@
|
|||
"license": "Apache-2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "../../node_modules/.bin/tsc",
|
||||
"kbn:bootstrap": "yarn build",
|
||||
"kbn:watch": "yarn build --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kbn/config-schema": "1.0.0",
|
||||
"load-json-file": "^6.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "4.0.2"
|
||||
"@kbn/config-schema": "link:../kbn-config-schema"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../yarn.lock
|
|
@ -64,11 +64,10 @@ export async function buildDistributables(log: ToolingLog, options: BuildOptions
|
|||
await run(Tasks.CreateEmptyDirsAndFiles);
|
||||
await run(Tasks.CreateReadme);
|
||||
await run(Tasks.BuildPackages);
|
||||
await run(Tasks.CreatePackageJson);
|
||||
await run(Tasks.InstallDependencies);
|
||||
await run(Tasks.BuildKibanaPlatformPlugins);
|
||||
await run(Tasks.TranspileBabel);
|
||||
await run(Tasks.RemoveWorkspaces);
|
||||
await run(Tasks.CreatePackageJson);
|
||||
await run(Tasks.InstallDependencies);
|
||||
await run(Tasks.CleanPackages);
|
||||
await run(Tasks.CreateNoticeFile);
|
||||
await run(Tasks.UpdateLicenseFile);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue