client_apps: use script/build
Each client_app is now expected to provide a runnable script at /client_apps/app_name/script/build that builds its JS assets. Also, `npm install` will only be run if an npm `package.json` file exists, so the app is free not to use npm if it doesn't need to. Closes CNVS-15445 TEST PLAN ---- ---- - run `bundle exec rake canvas:compile_assets` and make sure it works Change-Id: I635c79234dbb2c890e73cd9889fac86bd68fdf53 Reviewed-on: https://gerrit.instructure.com/41195 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Ryan Florence <ryanf@instructure.com> Product-Review: Ahmad Amireh <ahmad@instructure.com> QA-Review: Ahmad Amireh <ahmad@instructure.com>
This commit is contained in:
parent
60d6d8eca5
commit
858919c072
|
@ -21,9 +21,9 @@
|
|||
"url": "https://github.com/amireh/canvas_quiz_statistics/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "./node_modules/.bin/grunt",
|
||||
"test": "./node_modules/.bin/grunt test",
|
||||
"build": "./node_modules/.bin/grunt compile_js"
|
||||
"start": "./node_modules/grunt-cli/bin/grunt",
|
||||
"test": "./node_modules/grunt-cli/bin/grunt test",
|
||||
"build": "./node_modules/grunt-cli/bin/grunt compile_js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"node-sass": "^0.9.3",
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var path = require('path');
|
||||
var root = path.join(__dirname, '..');
|
||||
var grunt;
|
||||
|
||||
// Use the app root as the CWD so that grunt can read the Gruntfile there:
|
||||
process.chdir(root);
|
||||
|
||||
// Make sure we load the development tasks (override any CLI flags):
|
||||
process.env.production = false;
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
||||
// Run the "compile_js" grunt task; no need to use the full "build" task as
|
||||
// Canvas will not use the compiled SCSS anyway:
|
||||
grunt = require(path.join(root, 'node_modules', 'grunt', 'lib', 'grunt'));
|
||||
grunt.tasks('compile_js');
|
|
@ -148,7 +148,7 @@ namespace :js do
|
|||
Dir.chdir(app_dir) do
|
||||
puts "Building client app '#{app_name}'"
|
||||
|
||||
begin
|
||||
if File.exists?('./package.json')
|
||||
puts "\tRunning 'npm install'..."
|
||||
output = `npm install`
|
||||
unless $?.exitstatus == 0
|
||||
|
@ -165,7 +165,7 @@ namespace :js do
|
|||
|
||||
begin
|
||||
puts "\tRunning 'npm run build'..."
|
||||
output = `npm run build`
|
||||
output = `./script/build`
|
||||
unless $?.exitstatus == 0
|
||||
puts <<-MESSAGE
|
||||
-------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue