Skip to content

Commit 9be545a

Browse files
authoredOct 20, 2016
Merge pull request metabase#3541 from metabase/kill-npm-with-fire
Replace npm with yarn
2 parents a9ec0eb + 08f8970 commit 9be545a

13 files changed

+7158
-14084
lines changed
 

‎.flowconfig

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.*/node_modules/postcss-import/node_modules/.*
44
.*/node_modules/fixed-data-table/.*
55
.*/node_modules/@kadira/storybook/node_modules/.*
6+
.*/node_modules/.*/\(lib\|test\).*\.json$
67

78
[include]
89

‎.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ bin/release/aws-eb/metabase-aws-eb.zip
3939
*.sqlite
4040
/reset-password-artifacts
4141
/.env
42-
/npm-debug.log
4342
/screenshots
4443
/plugins
4544
/build.xml

‎Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ENV LC_CTYPE en_US.UTF-8
99

1010
# install core build tools
1111
RUN apk add --update nodejs git wget bash python make g++ java-cacerts ttf-dejavu fontconfig && \
12-
npm install -g npm@2 && \
12+
npm install -g yarn && \
1313
ln -sf "${JAVA_HOME}/bin/"* "/usr/bin/"
1414

1515
# fix broken cacerts
@@ -29,7 +29,7 @@ RUN bin/build
2929

3030
# remove unnecessary packages & tidy up
3131
RUN apk del nodejs git wget python make g++
32-
RUN rm -rf /root/.lein /root/.m2 /root/.node-gyp /root/.npm /tmp/* /var/cache/apk/* /app/source/node_modules
32+
RUN rm -rf /root/.lein /root/.m2 /root/.node-gyp /root/.npm /root/.yarn /root/.yarn-cache /tmp/* /var/cache/apk/* /app/source/node_modules
3333

3434
# expose our default runtime port
3535
EXPOSE 3000

‎bin/build

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ version() {
1414
echo "date=${info[3]}" >> resources/version.properties
1515
}
1616

17-
npm-install() {
18-
echo "Running 'npm install' to download javascript dependencies..." &&
19-
npm install
17+
frontend-deps() {
18+
echo "Running 'yarn' to download javascript dependencies..." &&
19+
yarn
2020
}
2121

2222
frontend() {
@@ -44,7 +44,7 @@ uberjar() {
4444
}
4545

4646
all() {
47-
version && npm-install && frontend && sample-dataset && uberjar
47+
version && frontend-deps && frontend && sample-dataset && uberjar
4848
}
4949

5050
# Default to running all but let someone specify one or more sub-tasks to run instead if desired

‎bin/ci

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ node-4() {
3434
}
3535
node-5() {
3636
run_step lein eastwood
37-
run_step npm run lint
38-
run_step npm run test
39-
run_step npm run flow
37+
run_step yarn run lint
38+
run_step yarn run test
39+
run_step yarn run flow
4040
}
4141
node-6() {
4242
if is_enabled "jar" || is_enabled "e2e" || is_enabled "screenshots"; then
4343
run_step ./bin/build version frontend sample-dataset uberjar
4444
fi
4545
if is_enabled "e2e" || is_enabled "compare_screenshots"; then
4646
USE_SAUCE=true \
47-
run_step npm run test-e2e
47+
run_step yarn run test-e2e
4848
fi
4949
if is_enabled "screenshots"; then
5050
run_step node_modules/.bin/babel-node ./bin/compare-screenshots

‎bin/clean-shrinkwrap

-28
This file was deleted.

‎bin/update-emoji

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var emoji;
77
try {
88
emoji = require("emojione/emoji.json");
99
} catch (e) {
10-
console.log("Please `npm install emojione` and re-run.");
10+
console.log("Please `yarn global add emojione` and re-run.");
1111
process.exit(1);
1212
}
1313

‎circle.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,20 @@ dependencies:
1212
override:
1313
- lein deps
1414
- pip install awscli==1.7.3
15-
- npm install -g npm@2.15.9
15+
- npm install -g 'yarn@>=0.16.0'
1616
# Forces the Sauce Connect binary to be downloaded during dependencies phase so it's cached
17-
- SAUCE_CONNECT_DOWNLOAD_ON_INSTALL=true npm install
17+
- SAUCE_CONNECT_DOWNLOAD_ON_INSTALL=true yarn
1818
- mkdir plugins
1919
- wget --output-document=plugins/ojdbc7.jar $ORACLE_JDBC_JAR
20+
cache_directories:
21+
- "~/.yarn"
22+
- "~/.yarn-cache"
2023
database:
2124
post:
2225
# MySQL doesn't load named timezone information automatically, you have to run this command to load it
2326
- mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u ubuntu mysql
2427
test:
2528
override:
26-
# 0) runs unit tests w/ H2 local DB. Runs against H2, Mongo, MySQL, BigQuery
27-
# 1) runs unit tests w/ Postgres local DB. Runs against H2, SQL Server, Oracle
28-
# 2) runs unit tests w/ MySQL local DB. Runs against H2, Postgres, SQLite, Crate
29-
# 3) runs unit tests w/ H2 local DB. Runs against H2, Redshift, Druid
30-
# 4) runs Eastwood linter, Bikeshed linter, docstring-checker & ./bin/reflection-linter
31-
# 5) runs JS linter + JS test
32-
# 6) runs lein uberjar. (We don't run bin/build because we're not really concerned about `npm install` (etc) in this test, which runs elsewhere)
3329
- ./bin/ci:
3430
parallel: true
3531
deployment:

‎docs/developers-guide.md

+13-21
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ We don't like getting sued, so before merging any pull request, we'll need each
2020
These are the set of tools which are required in order to complete any build of the Metabase code. Follow the links to download and install them on your own before continuing.
2121

2222
1. [Oracle JDK 8 (http://www.oracle.com/technetwork/java/javase/downloads/index.html)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
23-
2. [Node.js for npm (http://nodejs.org/)](http://nodejs.org/)
23+
2. [Node.js (http://nodejs.org/)](http://nodejs.org/)
24+
3. [Yarn package manager for Node.js](https://yarnpkg.com/)
2425
3. [Leiningen (http://leiningen.org/)](http://leiningen.org/)
2526

2627

@@ -58,7 +59,7 @@ Metabase depends on lots of other 3rd party libraries to run, so as you are deve
5859
# clojure dependencies
5960
$ lein deps
6061
# javascript dependencies
61-
$ npm install
62+
$ yarn
6263
```
6364

6465
### Development server (quick start)
@@ -69,7 +70,7 @@ Run your backend development server with
6970

7071
Start the frontend build process with
7172

72-
npm run build-hot
73+
yarn run build-hot
7374

7475
This will get you a full development server running on port :3000 by default.
7576

@@ -81,48 +82,39 @@ We use these technologies for our FE build process to allow us to use modules, e
8182
- babel
8283
- cssnext
8384

84-
Frontend tasks are managed by `npm`. All available tasks can be found in `package.json` under *scripts*.
85+
Frontend tasks are executed using `yarn run`. All available tasks can be found in `package.json` under *scripts*.
8586

8687
To build the frontend client without watching for changes, you can use:
8788

8889
```sh
89-
$ npm run build
90+
$ yarn run build
9091
```
9192

9293
If you're working on the frontend directly, you'll most likely want to reload changes on save, and in the case of React components, do so while maintaining state. To start a build with hot reloading, use:
9394

9495
```sh
95-
$ npm run build-hot
96+
$ yarn run build-hot
9697
```
9798

9899
Note that at this time if you change CSS variables, those changes will only be picked up when a build is restarted.
99100

100101
There is also an option to reload changes on save without hot reloading if you prefer that.
101102

102103
```sh
103-
$ npm run build-watch
104+
$ yarn run build-watch
104105
```
105106

106-
#### Adding packages
107-
108-
If you add/change/remove an npm package, you need to run
109-
110-
```sh
111-
$ npm run shrinkwrap
112-
```
113-
114-
Like much of the NPM ecosystem, this only works at 3:12pm on the 3rd tuesday after the anniversary of the 3rd Roman emperor after Octavius.
115-
116107
#### Unit Tests / Linting
117108

118109
Run unit tests with
119110

120-
npm run test # Karma
121-
npm run test-e2e # Protractor
111+
yarn run test # Karma
112+
yarn run test-e2e # Selenium Webdriver
122113

123-
Run the linters with
114+
Run the linters and type checker with
124115

125-
npm run lint
116+
yarn run lint
117+
yarn run flow
126118

127119

128120
## Backend development

‎npm-shrinkwrap.json

-14,009
This file was deleted.

‎package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@
132132
"test": "karma start frontend/test/karma.conf.js --single-run",
133133
"test-watch": "karma start frontend/test/karma.conf.js --auto-watch --reporters nyan",
134134
"test-e2e": "JASMINE_CONFIG_PATH=./frontend/test/e2e/support/jasmine.json jasmine",
135-
"test-e2e-sauce": "USE_SAUCE=true npm run test-e2e",
135+
"test-e2e-sauce": "USE_SAUCE=true yarn run test-e2e",
136136
"build": "webpack --bail",
137137
"build-watch": "webpack --watch",
138138
"build-hot": "NODE_ENV=hot webpack && NODE_ENV=hot webpack-dev-server",
139-
"shrinkwrap": "npm prune && npm shrinkwrap --dev && ./bin/clean-shrinkwrap",
140-
"start": "npm run build && lein ring server",
141-
"storybook": "start-storybook -p 9001"
139+
"start": "yarn run build && lein ring server",
140+
"storybook": "start-storybook -p 9001",
141+
"preinstall": "ps -fp $PPID | grep -q yarn || (echo '\\033[0;33mSorry, npm is not supported. Please use Yarn (https://yarnpkg.com/).\\033[0m'; exit 1)"
142142
}
143143
}

‎webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ if (NODE_ENV === "hot") {
205205
config.entry.app
206206
];
207207

208-
// suffixing with ".hot" allows us to run both `npm run build-hot` and `npm run test` or `npm run test-watch` simultaneously
208+
// suffixing with ".hot" allows us to run both `yarn run build-hot` and `yarn run test` or `yarn run test-watch` simultaneously
209209
config.output.filename = "[name].hot.bundle.js?[hash]";
210210

211211
// point the publicPath (inlined in index.html by HtmlWebpackPlugin) to the hot-reloading server

‎yarn.lock

+7,123
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.