Commit 0b253689 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'replace-npm-with-yarn' into 'master'

Replace NPM with Yarn

See merge request !9055
parents 10a063e9 e8b5b082
...@@ -107,7 +107,10 @@ setup-test-env: ...@@ -107,7 +107,10 @@ setup-test-env:
<<: *dedicated-runner <<: *dedicated-runner
stage: prepare stage: prepare
script: script:
- npm install - node --version
- yarn --version
- yarn install --pure-lockfile
- yarn check # ensure that yarn.lock matches package.json
- bundle exec rake gitlab:assets:compile - bundle exec rake gitlab:assets:compile
- bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init' - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init'
artifacts: artifacts:
...@@ -246,7 +249,6 @@ karma: ...@@ -246,7 +249,6 @@ karma:
<<: *use-db <<: *use-db
<<: *dedicated-runner <<: *dedicated-runner
script: script:
- npm link istanbul
- bundle exec rake karma - bundle exec rake karma
artifacts: artifacts:
name: coverage-javascript name: coverage-javascript
...@@ -325,11 +327,9 @@ lint:javascript: ...@@ -325,11 +327,9 @@ lint:javascript:
paths: paths:
- node_modules/ - node_modules/
stage: test stage: test
image: "node:7.1" before_script: []
before_script:
- npm install
script: script:
- npm --silent run eslint - yarn run eslint
lint:javascript:report: lint:javascript:report:
<<: *dedicated-runner <<: *dedicated-runner
...@@ -337,12 +337,10 @@ lint:javascript:report: ...@@ -337,12 +337,10 @@ lint:javascript:report:
paths: paths:
- node_modules/ - node_modules/
stage: post-test stage: post-test
image: "node:7.1" before_script: []
before_script:
- npm install
script: script:
- find app/ spec/ -name '*.js' -or -name '*.js.es6' -exec sed --in-place 's|/\* eslint-disable .*\*/||' {} \; # run report over all files - find app/ spec/ -name '*.js' -or -name '*.js.es6' -exec sed --in-place 's|/\* eslint-disable .*\*/||' {} \; # run report over all files
- npm --silent run eslint-report || true # ignore exit code - yarn run eslint-report || true # ignore exit code
artifacts: artifacts:
name: eslint-report name: eslint-report
expire_in: 31d expire_in: 31d
......
---
title: replace npm with yarn and add yarn.lock
merge_request: 9055
author:
unless Rails.env.production? unless Rails.env.production?
desc "GitLab | Run ESLint" desc "GitLab | Run ESLint"
task :eslint do task :eslint do
system("npm", "run", "eslint") system("yarn", "run", "eslint")
end end
end end
...@@ -11,7 +11,7 @@ unless Rails.env.production? ...@@ -11,7 +11,7 @@ unless Rails.env.production?
desc 'GitLab | Karma | Run JavaScript tests' desc 'GitLab | Karma | Run JavaScript tests'
task :tests do task :tests do
sh "npm run karma" do |ok, res| sh "yarn run karma" do |ok, res|
abort('rake karma:tests failed') unless ok abort('rake karma:tests failed') unless ok
end end
end end
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
"scripts": { "scripts": {
"dev-server": "webpack-dev-server --config config/webpack.config.js", "dev-server": "webpack-dev-server --config config/webpack.config.js",
"eslint": "eslint --max-warnings 0 --ext .js,.js.es6 .", "eslint": "eslint --max-warnings 0 --ext .js,.js.es6 .",
"eslint-fix": "npm run eslint -- --fix", "eslint-fix": "eslint --max-warnings 0 --ext .js,.js.es6 --fix .",
"eslint-report": "npm run eslint -- --format html --output-file ./eslint-report.html", "eslint-report": "eslint --max-warnings 0 --ext .js,.js.es6 --format html --output-file ./eslint-report.html .",
"karma": "karma start config/karma.config.js --single-run", "karma": "karma start config/karma.config.js --single-run",
"karma-start": "karma start config/karma.config.js", "karma-start": "karma start config/karma.config.js",
"webpack": "webpack --config config/webpack.config.js", "webpack": "webpack --config config/webpack.config.js",
"webpack-prod": "NODE_ENV=production npm run webpack" "webpack-prod": "NODE_ENV=production webpack --config config/webpack.config.js"
}, },
"dependencies": { "dependencies": {
"babel-core": "^6.22.1", "babel-core": "^6.22.1",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment