[canvas] move yarn scripts to node scripts (#25258)

* [canvas] move yarn scripts to node scripts

* [canvas/eslint] allow scripts to access devDeps

* [canvas/eslint] remove packageDir override

* [x-pack] move babel-register to deps for canvas

* [canvas] rename scripts from : to _

* [canvas] update readme with correct script paths

* [canvas] remove yarn.lock file

* Remove redundant require

(cherry picked from commit cfaa1783c3)
This commit is contained in:
Spencer 2018-11-07 10:53:06 -08:00 committed by spalger
parent e161dc724b
commit 90588acbae
19 changed files with 112 additions and 48 deletions

View file

@ -29,6 +29,6 @@ bower_components
/x-pack/plugins/**/__tests__/fixtures/**
/x-pack/plugins/canvas/common/lib/grammar.js
/x-pack/plugins/canvas/canvas_plugin
/x-pack/plugins/canvas/canvas_plugin_src/lib/flot-charts/*
/x-pack/plugins/canvas/canvas_plugin_src/lib/flot-charts
**/*.js.snap
!/.eslintrc.js

View file

@ -345,17 +345,6 @@ module.exports = {
/**
* Canvas overrides
*/
{
files: ['x-pack/plugins/canvas/*', 'x-pack/plugins/canvas/**/*'],
rules: {
'import/no-extraneous-dependencies': [
'error',
{
packageDir: resolve(__dirname, 'x-pack'),
},
],
},
},
{
files: ['x-pack/plugins/canvas/**/*'],
plugins: ['prettier'],
@ -417,6 +406,7 @@ module.exports = {
{
files: [
'x-pack/plugins/canvas/gulpfile.js',
'x-pack/plugins/canvas/scripts/*.js',
'x-pack/plugins/canvas/tasks/*.js',
'x-pack/plugins/canvas/tasks/**/*.js',
'x-pack/plugins/canvas/__tests__/**/*',

View file

@ -67,7 +67,6 @@
"babel-plugin-mock-imports": "^0.0.5",
"babel-plugin-pegjs-inline-precompile": "^0.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.14",
"babel-register": "^6.26.0",
"chalk": "^2.4.1",
"chance": "1.0.10",
"checksum": "0.1.1",
@ -145,6 +144,7 @@
"axios": "^0.18.0",
"babel-core": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"babel-runtime": "^6.26.0",
"base64-js": "^1.2.1",
"bluebird": "3.1.1",

View file

@ -6,10 +6,10 @@
Canvas is included with X-Pack and requires a Basic license or better to use.
Canvas has its own build pipeline that gets triggered as part of `yarn kbn bootstrap`. However, should you ever need to run the build manually, like if you updated one of the plugins, you can do so with the following command:
Canvas has its own build pipeline that gets triggered as part of `node scripts/kbn bootstrap`. However, should you ever need to run the build manually, like if you updated one of the plugins, you can do so with the following command:
```bash
yarn kbn run build:plugins --include canvas
yarn kbn run build --include x-pack
```
### Developing in Canvas
@ -28,10 +28,10 @@ yarn start
There are several other scripts available once you are in that path as well.
- `yarn build:plugins` - local alias to build Canvas plugins, an alternative to using `kbn`.
- `yarn lint` - local linter setup, can also be used with the `--fix` flag for automatic fixes.
- `yarn test` - local test runner, does not require a real Kibana instance. Runs all the same unit tests the normal runner does, just limited to Canvas, and *waaaaaay* faster (currently 12 seconds or less).
- `yarn test:dev` - Same as above, but watches for changes and only runs tests for the given scope (browser, server, or common).
- `node scripts/build_plugins` - local alias to build Canvas plugins, an alternative to using `kbn`.
- `node scripts/lint` - local linter setup, can also be used with the `--fix` flag for automatic fixes.
- `node scripts/test` - local test runner, does not require a real Kibana instance. Runs all the same unit tests the normal runner does, just limited to Canvas, and *waaaaaay* faster (currently 12 seconds or less).
- `node scripts/test_dev` - Same as above, but watches for changes and only runs tests for the given scope (browser, server, or common).
## Feature Questions

View file

@ -1,25 +0,0 @@
{
"name": "canvas",
"version": "7.0.0-alpha1",
"description": "Data driven workpads for kibana",
"main": "index.js",
"kibana": {
"version": "kibana"
},
"private": true,
"scripts": {
"kbn": "node ../../../scripts/kbn",
"start": "../../node_modules/.bin/gulp canvas:dev",
"lint": "node ../../../scripts/eslint -c ../../../.eslintrc.js '*.js' '__tests__/**/*.js' 'tasks/**/*.js' 'server/**/*.js' 'common/**/*.js' 'public/**/*.{js,jsx}' 'canvas_plugin_src/**/*.{js,jsx}' --ignore-pattern 'canvas_plugin_src/lib/flot-charts/**/*' --ignore-pattern 'common/lib/grammar.js' --ignore-pattern 'canvas_plugin/**/*'",
"test": "../../node_modules/.bin/gulp canvas:test",
"test:common": "../../node_modules/.bin/gulp canvas:test:common",
"test:server": "../../node_modules/.bin/gulp canvas:test:server",
"test:browser": "../../node_modules/.bin/gulp canvas:test:browser",
"test:plugins": "../../node_modules/.bin/gulp canvas:test:plugins",
"test:dev": "../../node_modules/.bin/gulp canvas:test:dev",
"peg:build": "../../node_modules/.bin/gulp canvas:peg:build",
"peg:dev": "../../node_modules/.bin/gulp canvas:peg:dev",
"build": "echo Run build from x-pack root; exit 1",
"build:plugins": "../../node_modules/.bin/gulp canvas:plugins:build"
}
}

View file

@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
const { resolve } = require('path');
exports.runGulpTask = function(name) {
process.chdir(resolve(__dirname, '../../..'));
process.argv.splice(2, 0, name);
require('gulp/bin/gulp');
};
exports.runKibanaScript = function(name, args = []) {
process.chdir(resolve(__dirname, '../../../..'));
process.argv.splice(2, 0, ...args);
require('../../../../scripts/' + name);
};

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:plugins:build');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runKibanaScript('kbn');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runKibanaScript('eslint', ['x-pack/plugins/canvas/**/*.{js,jsx}']);

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:peg:build');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:peg:dev');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:dev');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:test');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:test:browser');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:test:common');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:test:dev');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:test:plugins');

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
require('./_helpers').runGulpTask('canvas:test:server');

View file

@ -1,4 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1