BigW Consortium Gitlab

Commit c5383de9 by Mike Greiling

Revert "Merge branch '8-17-stable-pick-yarn-support' into '8-17-stable'"

This reverts commit dab6e029, reversing changes made to bab14bdb.
parent dab6e029
...@@ -107,10 +107,7 @@ setup-test-env: ...@@ -107,10 +107,7 @@ setup-test-env:
<<: *dedicated-runner <<: *dedicated-runner
stage: prepare stage: prepare
script: script:
- node --version - npm install
- 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:
...@@ -305,6 +302,7 @@ karma: ...@@ -305,6 +302,7 @@ 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
...@@ -383,9 +381,11 @@ lint:javascript: ...@@ -383,9 +381,11 @@ lint:javascript:
paths: paths:
- node_modules/ - node_modules/
stage: test stage: test
before_script: [] image: "node:7.1"
before_script:
- npm install
script: script:
- yarn run eslint - npm --silent run eslint
lint:javascript:report: lint:javascript:report:
<<: *dedicated-runner <<: *dedicated-runner
...@@ -393,10 +393,12 @@ lint:javascript:report: ...@@ -393,10 +393,12 @@ lint:javascript:report:
paths: paths:
- node_modules/ - node_modules/
stage: post-test stage: post-test
before_script: [] image: "node:7.1"
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
- yarn run eslint-report || true # ignore exit code - npm --silent run eslint-report || true # ignore exit code
artifacts: artifacts:
name: eslint-report name: eslint-report
expire_in: 31d expire_in: 31d
......
---
title: add rake tasks to handle yarn dependencies and update documentation
merge_request: 9316
author:
---
title: replace npm with yarn and add yarn.lock
merge_request: 9055
author:
...@@ -155,18 +155,15 @@ page](https://golang.org/dl). ...@@ -155,18 +155,15 @@ page](https://golang.org/dl).
## 4. Node ## 4. Node
Since GitLab 8.17, GitLab requires the use of node >= v4.3.0 to compile Since GitLab 8.17, GitLab requires the use of node >= v4.3.0 to compile
javascript assets, and yarn >= v0.17.0 to manage javascript dependencies. javascript assets. In many distros the version provided by the official package
In many distros the versions provided by the official package repositories repositories is out of date, so we'll need to install through the following
are out of date, so we'll need to install through the following commands: commands:
# install node v7.x # install node v7.x
curl --location https://deb.nodesource.com/setup_7.x | bash - curl --location https://deb.nodesource.com/setup_7.x | bash -
sudo apt-get install -y nodejs sudo apt-get install -y nodejs
# install yarn Visit the official website for [node](https://nodejs.org/en/download/package-manager/) if you have any trouble with this step.
curl --location https://yarnpkg.com/install.sh | bash -
Visit the official websites for [node](https://nodejs.org/en/download/package-manager/) and [yarn](https://yarnpkg.com/en/docs/install/) if you have any trouble with these steps.
## 5. System Users ## 5. System Users
...@@ -468,7 +465,7 @@ Check if GitLab and its environment are configured correctly: ...@@ -468,7 +465,7 @@ Check if GitLab and its environment are configured correctly:
### Compile Assets ### Compile Assets
sudo -u git -H yarn install --production --pure-lockfile sudo -u git -H npm install --production
sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production
### Start Your GitLab Instance ### Start Your GitLab Instance
......
...@@ -60,17 +60,15 @@ module Gitlab ...@@ -60,17 +60,15 @@ module Gitlab
"Get latest code" => %W(#{Gitlab.config.git.bin_path} fetch), "Get latest code" => %W(#{Gitlab.config.git.bin_path} fetch),
"Switch to new version" => %W(#{Gitlab.config.git.bin_path} checkout v#{latest_version}), "Switch to new version" => %W(#{Gitlab.config.git.bin_path} checkout v#{latest_version}),
"Install gems" => %W(bundle), "Install gems" => %W(bundle),
"Install node modules" => %W(npm install --production),
"Migrate DB" => %W(bundle exec rake db:migrate), "Migrate DB" => %W(bundle exec rake db:migrate),
"Recompile assets" => %W(bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile), "Recompile assets" => %W(bundle exec rake gitlab:assets:clean gitlab:assets:compile),
"Clear cache" => %W(bundle exec rake cache:clear) "Clear cache" => %W(bundle exec rake cache:clear)
} }
end end
def env def env
{ { 'RAILS_ENV' => 'production' }
'RAILS_ENV' => 'production',
'NODE_ENV' => 'production'
}
end end
def upgrade def upgrade
......
unless Rails.env.production? unless Rails.env.production?
desc "GitLab | Run ESLint" desc "GitLab | Run ESLint"
task eslint: ['yarn:check'] do task :eslint do
unless system('yarn run eslint') system("npm", "run", "eslint")
abort('rake eslint failed')
end
end end
end end
namespace :gitlab do namespace :gitlab do
namespace :assets do namespace :assets do
desc 'GitLab | Assets | Compile all frontend assets' desc 'GitLab | Assets | Compile all frontend assets'
task compile: [ task :compile do
'yarn:check', Rake::Task['assets:precompile'].invoke
'assets:precompile', Rake::Task['webpack:compile'].invoke
'webpack:compile', Rake::Task['gitlab:assets:fix_urls'].invoke
'gitlab:assets:fix_urls' end
]
desc 'GitLab | Assets | Clean up old compiled frontend assets' desc 'GitLab | Assets | Clean up old compiled frontend assets'
task clean: ['assets:clean'] task :clean do
Rake::Task['assets:clean'].invoke
end
desc 'GitLab | Assets | Remove all compiled frontend assets' desc 'GitLab | Assets | Remove all compiled frontend assets'
task purge: ['assets:clobber'] task :purge do
Rake::Task['assets:clobber'].invoke
desc 'GitLab | Assets | Uninstall frontend dependencies' end
task purge_modules: ['yarn:clobber']
desc 'GitLab | Assets | Fix all absolute url references in CSS' desc 'GitLab | Assets | Fix all absolute url references in CSS'
task :fix_urls do task :fix_urls do
......
unless Rails.env.production? unless Rails.env.production?
Rake::Task['karma'].clear if Rake::Task.task_defined?('karma')
namespace :karma do namespace :karma do
desc 'GitLab | Karma | Generate fixtures for JavaScript tests' desc 'GitLab | Karma | Generate fixtures for JavaScript tests'
RSpec::Core::RakeTask.new(:fixtures) do |t| RSpec::Core::RakeTask.new(:fixtures) do |t|
...@@ -8,13 +10,16 @@ unless Rails.env.production? ...@@ -8,13 +10,16 @@ unless Rails.env.production?
end end
desc 'GitLab | Karma | Run JavaScript tests' desc 'GitLab | Karma | Run JavaScript tests'
task tests: ['yarn:check'] do task :tests do
sh "yarn run karma" do |ok, res| sh "npm run karma" do |ok, res|
abort('rake karma:tests failed') unless ok abort('rake karma:tests failed') unless ok
end end
end end
end end
desc 'GitLab | Karma | Shortcut for karma:fixtures and karma:tests' desc 'GitLab | Karma | Shortcut for karma:fixtures and karma:tests'
task karma: ['karma:fixtures', 'karma:tests'] task :karma do
Rake::Task['karma:fixtures'].invoke
Rake::Task['karma:tests'].invoke
end
end end
namespace :yarn do
desc 'Ensure Yarn is installed'
task :available do
unless system('yarn --version', out: File::NULL)
warn(
'Error: Yarn executable was not detected in the system.'.color(:red),
'Download Yarn at https://yarnpkg.com/en/docs/install'.color(:green)
)
abort
end
end
desc 'Ensure Node dependencies are installed'
task check: ['yarn:available'] do
unless system('yarn check --ignore-engines', out: File::NULL)
warn(
'Error: You have unmet dependencies. (`yarn check` command failed)'.color(:red),
'Run `yarn install` to install missing modules.'.color(:green)
)
abort
end
end
desc 'Install Node dependencies with Yarn'
task install: ['yarn:available'] do
unless system('yarn install --pure-lockfile --ignore-engines')
abort 'Error: Unable to install node modules.'.color(:red)
end
end
desc 'Remove Node dependencies'
task :clobber do
warn 'Purging ./node_modules directory'.color(:red)
FileUtils.rm_rf 'node_modules'
end
end
desc 'Install Node dependencies with Yarn'
task yarn: ['yarn:install']
...@@ -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": "eslint --max-warnings 0 --ext .js,.js.es6 --fix .", "eslint-fix": "npm run eslint -- --fix",
"eslint-report": "eslint --max-warnings 0 --ext .js,.js.es6 --format html --output-file ./eslint-report.html .", "eslint-report": "npm run eslint -- --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 webpack --config config/webpack.config.js" "webpack-prod": "NODE_ENV=production npm run webpack"
}, },
"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