mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-23 12:30:29 +01:00
Unify, improve development environment
This commit is contained in:
2
Makefile
2
Makefile
@@ -34,7 +34,7 @@ $(BUILDJS_TARGETS): $(BUILDJS_SOURCES) build.js
|
||||
node build.js
|
||||
|
||||
dist/iD.js: $(BUILDJS_TARGETS)
|
||||
./node_modules/.bin/rollup --config=./rollup.config.js --input ./modules/id.js --output dist/iD.js
|
||||
npm run build
|
||||
|
||||
dist/iD.min.js: dist/iD.js Makefile
|
||||
@rm -f $@
|
||||
|
||||
49
development_server.js
Normal file
49
development_server.js
Normal file
@@ -0,0 +1,49 @@
|
||||
var rollup = require( 'rollup' );
|
||||
var nodeResolve = require('rollup-plugin-node-resolve');
|
||||
var commonjs = require('rollup-plugin-commonjs');
|
||||
var json = require('rollup-plugin-json');
|
||||
var http = require('http');
|
||||
var gaze = require('gaze');
|
||||
var ecstatic = require('ecstatic');
|
||||
|
||||
var cache;
|
||||
var building = false;
|
||||
|
||||
function build() {
|
||||
if (building) return;
|
||||
building = true;
|
||||
console.log('Rebuilding');
|
||||
console.time('Rebuilt');
|
||||
rollup.rollup({
|
||||
entry: './modules/id.js',
|
||||
cache: cache,
|
||||
plugins: [
|
||||
nodeResolve({ jsnext: true, main: true, browser: false }),
|
||||
commonjs(),
|
||||
json()
|
||||
]
|
||||
}).then(function (bundle) {
|
||||
console.timeEnd('Rebuilt');
|
||||
cache = bundle;
|
||||
bundle.write({
|
||||
format: 'iife',
|
||||
dest: 'dist/iD.js'
|
||||
});
|
||||
building = false;
|
||||
});
|
||||
}
|
||||
|
||||
if (process.argv[2] === 'develop') {
|
||||
build();
|
||||
gaze('modules/**.js', function(err, watcher) {
|
||||
watcher.on('all', function() {
|
||||
build();
|
||||
});
|
||||
});
|
||||
http.createServer(
|
||||
ecstatic({ root: __dirname })
|
||||
).listen(8080);
|
||||
console.log('Listening on :8080');
|
||||
} else {
|
||||
build();
|
||||
}
|
||||
12
package.json
12
package.json
@@ -9,10 +9,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run lint && make && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec",
|
||||
"start": "rollup --config=./rollup.config.js -f iife --input ./modules/id.js --output dist/iD.js -w",
|
||||
"web": "http-server",
|
||||
"start": "node development_server.js develop",
|
||||
"build-min": "npm run build && uglifyjs dist/iD.js -c -m -o dist/iD.min.js",
|
||||
"build": "rollup --config=./rollup.config.js -f iife --input ./modules/id.js --output dist/iD.js",
|
||||
"build": "node development_server.js",
|
||||
"lint": "eslint js/id test/spec modules"
|
||||
},
|
||||
"repository": {
|
||||
@@ -36,14 +35,15 @@
|
||||
"wmf-sitematrix": "0.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "~3.5.0",
|
||||
"brfs": "1.4.3",
|
||||
"chai": "~3.5.0",
|
||||
"d3": "4.2.1",
|
||||
"ecstatic": "2.1.0",
|
||||
"editor-layer-index": "git://github.com/osmlab/editor-layer-index.git#gh-pages",
|
||||
"eslint": "~3.3.1",
|
||||
"gaze": "1.1.1",
|
||||
"glob": "~7.0.5",
|
||||
"happen": "~0.3.1",
|
||||
"http-server": "0.9.0",
|
||||
"js-yaml": "~3.6.1",
|
||||
"jsonschema": "~1.1.0",
|
||||
"maki": "0.5.0",
|
||||
@@ -55,10 +55,10 @@
|
||||
"request": "~2.73.0",
|
||||
"rollup": "0.34.10",
|
||||
"rollup-plugin-commonjs": "3.3.1",
|
||||
"rollup-plugin-json": "2.0.1",
|
||||
"rollup-plugin-node-resolve": "2.0.0",
|
||||
"sinon": "~1.17.5",
|
||||
"sinon-chai": "~2.8.0",
|
||||
"rollup-plugin-json": "2.0.1",
|
||||
"smash": "0.0",
|
||||
"svg-sprite": "1.3.3",
|
||||
"uglify-js": "~2.7.0",
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import nodeResolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import json from 'rollup-plugin-json';
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
nodeResolve({ jsnext: true, main: true, browser: false }),
|
||||
commonjs(),
|
||||
json()
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user