зеркало из https://github.com/mozilla/brackets.git
* Always run unlocalize script when server stops, no matter version of npm * Switch back to poststart, add grunt-newer for iframe API build on start * Update README * Force proper exit code for server
This commit is contained in:
Родитель
cd9d8e5a4e
Коммит
e2f5c9da16
19
Gruntfile.js
19
Gruntfile.js
|
@ -42,7 +42,8 @@ module.exports = function (grunt) {
|
|||
'grunt-targethtml',
|
||||
'grunt-usemin',
|
||||
'grunt-cleanempty',
|
||||
'grunt-exec'
|
||||
'grunt-exec',
|
||||
'grunt-newer'
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -219,7 +220,16 @@ module.exports = function (grunt) {
|
|||
}
|
||||
},
|
||||
iframe: {
|
||||
// Standalone dist/bramble.js iframe api
|
||||
// Define files involved, so grunt-newer knows whether to re-build or not
|
||||
files: {
|
||||
'dist/bramble.js': [
|
||||
'src/bramble/client/**/*.js',
|
||||
'src/bramble/thirdparty/**/*.js',
|
||||
'src/bramble/ChannelUtils.js',
|
||||
'thirdparty/filer/dist/filer.min.js',
|
||||
]
|
||||
},
|
||||
// Standalone, minified dist/bramble.js iframe api
|
||||
options: {
|
||||
name: 'thirdparty/almond',
|
||||
baseUrl: 'src',
|
||||
|
@ -545,6 +555,11 @@ module.exports = function (grunt) {
|
|||
'build-config' */
|
||||
]);
|
||||
|
||||
// task: build for development, skipping most steps: only build iframe API if needed.
|
||||
grunt.registerTask('build-browser-dev', [
|
||||
'newer:requirejs:iframe'
|
||||
]);
|
||||
|
||||
// task: build dist/ for browser
|
||||
grunt.registerTask('build-browser', [
|
||||
'build',
|
||||
|
|
|
@ -55,7 +55,7 @@ The easiest way to run Bramble is to simply use:
|
|||
$ npm start
|
||||
```
|
||||
|
||||
This will generate the strings needed for localization in your `src/nls` folder and allow you to access Bramble on `localhost:8000`. You can terminate the server with `Ctrl+C` which will also clean up the strings that were generated in your `src/nls` folder.
|
||||
This will generate the strings needed for localization in your `src/nls` folder and allow you to access Bramble on `localhost:8000` (NOTE: you need npm version 5 for the cleanup step to run properly; if it doesn't, use `npm run unlocalize` to restore the files in `src/nls/**/*`). It will also build the Bramble iframe API in dist/ if necessary. You can terminate the server with `Ctrl+C` which will also clean up the strings that were generated in your `src/nls` folder.
|
||||
|
||||
If you want to simply run the server without the localized strings, run:
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"bluebird": "^3.4.7",
|
||||
"grunt-newer": "^1.3.0",
|
||||
"gunzip-maybe": "^1.3.1",
|
||||
"http-server": "mozilla/http-server#gzip",
|
||||
"mkdirp": "0.5.1",
|
||||
|
@ -72,8 +73,8 @@
|
|||
"production": "npm start -- --gzip",
|
||||
"test": "grunt test && grunt build-browser-compressed",
|
||||
"server": "http-server -p 8000 --cors",
|
||||
"prestart": "npm run localize",
|
||||
"start": "npm run server",
|
||||
"prestart": "npm run localize && grunt build-browser-dev",
|
||||
"start": "npm run server || true",
|
||||
"poststart": "npm run unlocalize"
|
||||
},
|
||||
"license": "MIT"
|
||||
|
|
|
@ -29,7 +29,8 @@ require.config({
|
|||
});
|
||||
|
||||
define([
|
||||
// Change this to filer vs. filer.min if you need to debug Filer
|
||||
// NOTE: if you modify the files involved here, also change the requirejs:iframe files list in Gruntfile.js
|
||||
// filer.min - change this to filer vs. filer.min if you need to debug Filer
|
||||
"thirdparty/filer/dist/filer.min",
|
||||
"bramble/ChannelUtils",
|
||||
"EventEmitter",
|
||||
|
|
|
@ -130,13 +130,19 @@
|
|||
});
|
||||
}
|
||||
|
||||
// Support loading from src/ or dist/ to make local dev easier
|
||||
require(["bramble/client/main"], function(Bramble) {
|
||||
// Support loading from src/ or dist/ (default) to make local dev easier
|
||||
var isSrc = !!window.location.pathname.match(/\/src\/[^/]+$/);
|
||||
var brambleModule;
|
||||
|
||||
if(isSrc) {
|
||||
console.log("Bramble src/ build");
|
||||
brambleModule = "../dist/bramble";
|
||||
} else {
|
||||
console.log("Bramble dist/ build");
|
||||
brambleModule = "bramble";
|
||||
}
|
||||
|
||||
require([brambleModule], function(Bramble) {
|
||||
load(Bramble);
|
||||
}, function(err) {
|
||||
console.log("Unable to load Bramble from src/, trying from dist/");
|
||||
require(["bramble"], function(Bramble) {
|
||||
load(Bramble);
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
|
Загрузка…
Ссылка в новой задаче