зеркало из https://github.com/mozilla/makedrive.git
Fixed #7 - Deployment of MakeDrive client-side package
This commit is contained in:
Родитель
4af57a5f62
Коммит
e8acfd47e3
131
Gruntfile.js
131
Gruntfile.js
|
@ -1,17 +1,22 @@
|
|||
module.exports = function(grunt) {
|
||||
var semver = require('semver'),
|
||||
fs = require('fs'),
|
||||
currentVersion = JSON.parse(fs.readFileSync('./package.json', 'utf8')).version,
|
||||
env = require('./server/lib/environment');
|
||||
|
||||
// Globals
|
||||
var PROMPT_CONFIRM_CONFIG = 'confirmation',
|
||||
GIT_BRANCH = env.get('MAKEDRIVE_UPSTREAM_BRANCH'),
|
||||
GIT_REMOTE = env.get('MAKEDRIVE_UPSTREAM_REMOTE_NAME'),
|
||||
GIT_FULL_REMOTE = env.get('MAKEDRIVE_UPSTREAM_URI') + ' ' + GIT_BRANCH;
|
||||
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON( "package.json" ),
|
||||
|
||||
jshint: {
|
||||
all: [
|
||||
"Gruntfile.js",
|
||||
"client/src/**/*.js",
|
||||
"server/**/*.js",
|
||||
"lib/**/*.js"
|
||||
]
|
||||
},
|
||||
|
||||
/**
|
||||
* Build tasks
|
||||
*/
|
||||
clean: [ "client/dist/makedrive.js", "client/dist/makedrive.min.js" ],
|
||||
|
||||
browserify: {
|
||||
|
@ -36,6 +41,60 @@ module.exports = function(grunt) {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Release tasks
|
||||
*/
|
||||
|
||||
bump: {
|
||||
options: {
|
||||
files: ['package.json', 'bower.json'],
|
||||
commit: true,
|
||||
commitMessage: 'v%VERSION%',
|
||||
commitFiles: ['package.json', 'bower.json', './client/dist/makedrive.js', './client/dist/makedrive.min.js'],
|
||||
createTag: true,
|
||||
tagName: 'v%VERSION%',
|
||||
tagMessage: 'v%VERSION%',
|
||||
push: true,
|
||||
pushTo: GIT_FULL_REMOTE
|
||||
}
|
||||
},
|
||||
|
||||
'npm-checkBranch': {
|
||||
options: {
|
||||
branch: GIT_BRANCH
|
||||
}
|
||||
},
|
||||
|
||||
'npm-publish': {
|
||||
options: {
|
||||
abortIfDirty: false
|
||||
}
|
||||
},
|
||||
|
||||
prompt: {
|
||||
confirm: {
|
||||
options: {
|
||||
questions: [
|
||||
{
|
||||
config: PROMPT_CONFIRM_CONFIG,
|
||||
type: 'confirm',
|
||||
message: 'Bump version from ' + (currentVersion).cyan +
|
||||
' to ' + semver.inc(currentVersion, "patch").yellow + '?',
|
||||
default: false
|
||||
}
|
||||
],
|
||||
then: function(results) {
|
||||
if (!results[PROMPT_CONFIRM_CONFIG]) {
|
||||
return grunt.fatal('User aborted...');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Testing & Dev tasks
|
||||
*/
|
||||
exec: {
|
||||
update_submodule: {
|
||||
command: 'git submodule update --init',
|
||||
|
@ -46,19 +105,63 @@ module.exports = function(grunt) {
|
|||
command: 'cd ' + __dirname + '/client/thirdparty/filer; npm install; rm -rf client',
|
||||
stdout: false,
|
||||
stderr: true
|
||||
},
|
||||
run_mocha: {
|
||||
command: './node_modules/.bin/mocha --recursive --reporter spec ./tests',
|
||||
stdout: true,
|
||||
stderr: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
jshint: {
|
||||
all: [
|
||||
"Gruntfile.js",
|
||||
"client/src/**/*.js",
|
||||
"server/**/*.js",
|
||||
"lib/**/*.js"
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
// Load extension tasks
|
||||
grunt.loadNpmTasks( "grunt-contrib-jshint" );
|
||||
grunt.loadNpmTasks( "grunt-contrib-clean" );
|
||||
grunt.loadNpmTasks( "grunt-contrib-uglify" );
|
||||
grunt.loadNpmTasks( "grunt-browserify" );
|
||||
grunt.loadNpmTasks( "grunt-bump" );
|
||||
grunt.loadNpmTasks( "grunt-npm" );
|
||||
grunt.loadNpmTasks( "grunt-prompt" );
|
||||
grunt.loadNpmTasks( "grunt-exec" );
|
||||
|
||||
grunt.registerTask( "test", [ "jshint" ] );
|
||||
// Simple multi-tasks
|
||||
grunt.registerTask( "test", [ "jshint", "exec:run_mocha" ] );
|
||||
grunt.registerTask( "default", [ "test" ] );
|
||||
grunt.registerTask( "init", [ "exec" ] );
|
||||
grunt.registerTask( "build", [ "clean", "browserify:makedriveClient", "uglify" ] );
|
||||
grunt.registerTask( "init", [ "exec:update_submodule", "exec:npm_install_submodule" ] );
|
||||
grunt.registerTask( "build", [ "test", "clean", "browserify:makedriveClient", "uglify" ] );
|
||||
|
||||
// Complex multi-tasks
|
||||
grunt.registerTask('publish', 'Publish MakeDrive as a new version to NPM, bower and github.', function(patchLevel) {
|
||||
var allLevels = ['patch', 'minor', 'major'];
|
||||
|
||||
patchLevel = (patchLevel || 'patch').toLowerCase();
|
||||
|
||||
// Fail out if the patch level isn't recognized
|
||||
if (allLevels.filter(function(el) { return el == patchLevel; }).length === 0) {
|
||||
return grunt.fatal('Patch level not recognized! "Patch", "minor" or "major" only.');
|
||||
}
|
||||
|
||||
// Set prompt message
|
||||
var promptOpts = grunt.config('prompt.confirm.options');
|
||||
promptOpts.questions[0].message = 'Bump version from ' + (currentVersion).cyan +
|
||||
' to ' + semver.inc(currentVersion, patchLevel).yellow + '?';
|
||||
grunt.config('prompt.confirm.options', promptOpts);
|
||||
|
||||
grunt.task.run([
|
||||
'prompt:confirm',
|
||||
'checkBranch',
|
||||
'build',
|
||||
'bump:' + patchLevel,
|
||||
'npm-publish'
|
||||
]);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"ace-builds": "1.1.3",
|
||||
"jquery.treeview": "1.4.1"
|
||||
},
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.0",
|
||||
"resolutions": {
|
||||
"jquery": "2.1.1"
|
||||
}
|
||||
|
|
16
env.dist
16
env.dist
|
@ -49,3 +49,19 @@ export TOKEN_TIMEOUT_MS=60000
|
|||
# Maximum time a client can go in a sync without contacting the server
|
||||
# (Default to 5 seconds)
|
||||
export CLIENT_TIMEOUT_MS=5000
|
||||
|
||||
###
|
||||
# Dev config
|
||||
###
|
||||
|
||||
# GIT protocol URI for the master Mozilla repo
|
||||
# (Default to "git@github.com:mozilla/makedrive.git")
|
||||
export MAKEDRIVE_UPSTREAM_URI="git@github.com:mozilla/makedrive.git"
|
||||
|
||||
# Local remote name for the master Mozilla repo
|
||||
# (Default to "upstream")
|
||||
export MAKEDRIVE_UPSTREAM_NAME="upstream"
|
||||
|
||||
# Upstream branch to ovewrite on a grunt release command
|
||||
# (Default to "master")
|
||||
export MAKEDRIVE_UPSTREAM_BRANCH="master"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"scripts": {
|
||||
"postinstall": "bower install",
|
||||
"start": "node ./server/index.js",
|
||||
"test": "grunt init && grunt test && mocha --recursive --reporter spec ./tests"
|
||||
"test": "grunt init && grunt test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Загрузка…
Ссылка в новой задаче