mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Revert "Switch to Yarn (#11637)"
This reverts commit 71a9b8b6bc
.
Until we get all the relevant infra configured with yarn as well.
This commit is contained in:
parent
71a9b8b6bc
commit
2876f1fdf6
10 changed files with 71 additions and 8913 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -35,3 +35,4 @@ selenium
|
|||
*.out
|
||||
ui_framework/doc_site/build
|
||||
!ui_framework/doc_site/build/index.html
|
||||
yarn.lock
|
||||
|
|
|
@ -103,17 +103,10 @@ Install the version of node.js listed in the `.node-version` file _(this can be
|
|||
nvm install "$(cat .node-version)"
|
||||
```
|
||||
|
||||
Install the latest version of [yarn](https://yarnpkg.com/en/docs/install)
|
||||
Install `npm` dependencies
|
||||
|
||||
```bash
|
||||
# See https://yarnpkg.com/en/docs/install for non-MacOS install
|
||||
brew install yarn
|
||||
```
|
||||
|
||||
Install dependencies
|
||||
|
||||
```bash
|
||||
yarn
|
||||
npm install
|
||||
```
|
||||
|
||||
Start elasticsearch.
|
||||
|
@ -367,4 +360,4 @@ Remember, someone is blocked by a pull awaiting review, make it count. Be thorou
|
|||
1. **Hand it off** If you're the first reviewer and everything looks good but the changes are more than a few lines, hand the pull to someone else to take a second look. Again, try to find the right person to assign it to.
|
||||
1. **Merge the code** When everything looks good, put in a `LGTM` (looks good to me) comment. Merge into the target branch. Check the labels on the pull to see if backporting is required, and perform the backport if so.
|
||||
|
||||
Thank you so much for reading our guidelines! :tada:
|
||||
Thank you so much for reading our guidelines! :tada:
|
||||
|
|
|
@ -10,14 +10,14 @@ Before you can use an external library with Kibana you have to install it. You
|
|||
do that using...
|
||||
|
||||
[float]
|
||||
==== yarn (preferred method)
|
||||
==== npm (preferred method)
|
||||
|
||||
Once you've http://npmsearch.com[found] a dependency you want to add, you can
|
||||
install it like so:
|
||||
|
||||
["source","shell"]
|
||||
-----------
|
||||
yarn add some-neat-library
|
||||
npm install --save some-neat-library
|
||||
-----------
|
||||
|
||||
At the top of a javascript file, just import the library using it's name:
|
||||
|
@ -28,13 +28,13 @@ import someNeatLibrary from 'some-neat-library';
|
|||
-----------
|
||||
|
||||
Just like working in node.js, front-end code can require node modules installed
|
||||
by yarn without any additional configuration.
|
||||
by npm without any additional configuration.
|
||||
|
||||
[float]
|
||||
==== webpackShims
|
||||
|
||||
When a library you want to use does use es6 or common.js modules but is not
|
||||
available with yarn, you can copy the source of the library into a webpackShim.
|
||||
available on npm, you can copy the source of the library into a webpackShim.
|
||||
|
||||
["source","shell"]
|
||||
-----------
|
||||
|
@ -97,7 +97,7 @@ module.exports = window.angular;
|
|||
What this shim does is fairly simple if you go line by line:
|
||||
|
||||
. makes sure that jQuery is loaded before angular (which actually runs the shim above)
|
||||
. load the angular.js file from the node_modules directory
|
||||
. load the angular.js file from the npm installation
|
||||
. load the angular-elastic plugin, a plugin we want to always be included whenever we import angular
|
||||
. use the `ui/modules` module to add the module exported by angular-elastic as a dependency to the `kibana` angular module
|
||||
. finally, export the window.angular variable. This means that writing `import angular from 'angular';` will properly set the angular variable to the angular library, rather than undefined which is the default behavior.
|
||||
. finally, export the window.angular variable. This means that writing `import angular from 'angular';` will properly set the angular variable to the angular library, rather than undefined which is the default behavior.
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
"check-hash": "1.0.1",
|
||||
"color": "1.0.3",
|
||||
"commander": "2.8.1",
|
||||
"css-loader": "^0.28.1",
|
||||
"css-loader": "0.17.0",
|
||||
"d3": "3.5.6",
|
||||
"d3-cloud": "1.2.1",
|
||||
"dragula": "3.7.0",
|
||||
|
|
|
@ -16,7 +16,7 @@ module.exports = function (grunt) {
|
|||
'_build:packageJson',
|
||||
'_build:readme',
|
||||
'_build:babelCache',
|
||||
'_build:installDependencies',
|
||||
'_build:installNpmDeps',
|
||||
'_build:notice',
|
||||
'_build:removePkgJsonDeps',
|
||||
'clean:testsFromModules',
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
import { exec } from 'child_process';
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('_build:installDependencies', function () {
|
||||
grunt.file.mkdir('<%= root %>/build/kibana/node_modules');
|
||||
|
||||
exec('yarn --production --ignore-optional', {
|
||||
cwd: grunt.config.process('<%= root %>/build/kibana')
|
||||
}, this.async());
|
||||
});
|
||||
};
|
12
tasks/build/install_npm_deps.js
Normal file
12
tasks/build/install_npm_deps.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { exec } from 'child_process';
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('_build:installNpmDeps', function () {
|
||||
grunt.file.mkdir('build/kibana/node_modules');
|
||||
|
||||
exec('npm install --production --no-optional', {
|
||||
cwd: grunt.config.process('<%= root %>/build/kibana')
|
||||
}, this.async());
|
||||
});
|
||||
};
|
||||
|
||||
|
39
tasks/utils/install_or_update_repo.js
Normal file
39
tasks/utils/install_or_update_repo.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
import Promise from 'bluebird';
|
||||
import spawn from './spawn';
|
||||
import grunt from 'grunt';
|
||||
|
||||
module.exports = function (repo, dir) {
|
||||
// store the previous and new hash from the repo
|
||||
// to know if there was an update from fetch
|
||||
let prevHash;
|
||||
let newHash;
|
||||
|
||||
return Promise.resolve()
|
||||
.then(function () {
|
||||
if (!grunt.file.isDir(dir + '/.git')) {
|
||||
if (grunt.file.isDir(dir)) {
|
||||
throw new Error(dir + ' needs to be removed so that we can replace it with a git-repo');
|
||||
}
|
||||
|
||||
return spawn('git', ['clone', repo, dir])();
|
||||
} else {
|
||||
return spawn.silent('git', ['log', '-1', '--pretty=%H'], dir)()
|
||||
.then(function (out) {
|
||||
prevHash = out.trim();
|
||||
})
|
||||
.then(spawn('git', ['fetch', 'origin', 'master'], dir))
|
||||
.then(spawn('git', ['reset', '--hard', 'origin/master'], dir))
|
||||
.then(spawn.silent('git', ['log', '-1', '--pretty=%H'], dir));
|
||||
}
|
||||
})
|
||||
.then(function (out) {
|
||||
if (prevHash) newHash = out.trim();
|
||||
if (!prevHash || newHash !== prevHash) {
|
||||
return spawn('npm', ['update'], dir)()
|
||||
.then(spawn('bower', ['install'], dir))
|
||||
.then(function () {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
|
@ -28,10 +28,12 @@ fi
|
|||
nvm install "$(cat .node-version)"
|
||||
|
||||
###*****###
|
||||
### yarn ###
|
||||
### NPM ###
|
||||
###*****###
|
||||
mkdir .bin
|
||||
curl -L https://github.com/yarnpkg/yarn/releases/download/v0.24.2/yarn-0.24.2.js > .bin/yarn
|
||||
chmod +x .bin/yarn
|
||||
PATH="$(pwd)/.bin:$PATH"
|
||||
yarn
|
||||
npm install
|
||||
|
||||
|
||||
if [ -z "$(npm bin)" ]; then
|
||||
echo "npm does not know where it stores executables..... huh??"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue