mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[UI Framework] Add uiFramework:build task. (#11402)
* Add uiFramework:build task.
This commit is contained in:
parent
36ccbc1465
commit
1f76e7508e
3 changed files with 36 additions and 3 deletions
|
@ -63,7 +63,8 @@
|
|||
"mocha": "mocha",
|
||||
"mocha:debug": "mocha --debug-brk",
|
||||
"sterilize": "grunt sterilize",
|
||||
"uiFramework:start": "grunt uiFramework:start"
|
||||
"uiFramework:start": "grunt uiFramework:start",
|
||||
"uiFramework:build": "grunt uiFramework:build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -4,8 +4,40 @@ import postcssConfig from '../src/optimize/postcss.config';
|
|||
import chokidar from 'chokidar';
|
||||
import debounce from 'lodash/function/debounce';
|
||||
const platform = require('os').platform();
|
||||
const isPlatformWindows = /^win/.test(platform);
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('uiFramework:build', function () {
|
||||
const done = this.async();
|
||||
|
||||
const serverCmd = {
|
||||
cmd: isPlatformWindows ? '.\\node_modules\\.bin\\webpack.cmd' : './node_modules/.bin/webpack',
|
||||
args: [
|
||||
'-p',
|
||||
'--config=ui_framework/doc_site/webpack.config.js',
|
||||
],
|
||||
opts: { stdio: 'inherit' }
|
||||
};
|
||||
|
||||
const uiFrameworkServerBuild = new Promise((resolve, reject) => {
|
||||
grunt.util.spawn(serverCmd, (error, result, code) => {
|
||||
if (error || code !== 0) {
|
||||
const message = result.stderr || result.stdout;
|
||||
|
||||
grunt.log.error(message);
|
||||
|
||||
return reject();
|
||||
}
|
||||
|
||||
grunt.log.writeln(result);
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
uiFrameworkServerBuild.then(done);
|
||||
});
|
||||
|
||||
grunt.registerTask('uiFramework:start', function () {
|
||||
const done = this.async();
|
||||
Promise.all([uiFrameworkWatch(), uiFrameworkServerStart()]).then(done);
|
||||
|
@ -13,7 +45,7 @@ module.exports = function (grunt) {
|
|||
|
||||
function uiFrameworkServerStart() {
|
||||
const serverCmd = {
|
||||
cmd: /^win/.test(platform) ? '.\\node_modules\\.bin\\webpack-dev-server.cmd' : './node_modules/.bin/webpack-dev-server',
|
||||
cmd: isPlatformWindows ? '.\\node_modules\\.bin\\webpack-dev-server.cmd' : './node_modules/.bin/webpack-dev-server',
|
||||
args: [
|
||||
'--config=ui_framework/doc_site/webpack.config.js',
|
||||
'--hot ',
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'ui_framework/doc_site/build'),
|
||||
path: path.resolve(__dirname, 'build'),
|
||||
filename: 'bundle.js'
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue