From a093f6a9b365da62889a90571f064f70eff342cc Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 25 Oct 2016 01:15:29 -0400 Subject: [PATCH] Bye Bye Makefile --- .travis.yml | 3 --- CONTRIBUTING.md | 28 ++++++++++++---------------- Makefile | 24 ------------------------ README.md | 32 ++++++++++++-------------------- RELEASING.md | 14 ++++++-------- package.json | 14 ++++++++++++-- 6 files changed, 42 insertions(+), 73 deletions(-) delete mode 100644 Makefile diff --git a/.travis.yml b/.travis.yml index 5218daa21..61ae833f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,3 @@ node_js: - "5" - "6" sudo: false -before_script: - - make clean - - make diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 093578807..0c363a12c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ Please [search for your issue before filing it: many bugs and improvements have To report a bug: -* Write specifically what browser (type and version, like "Firefox 43.0"), OS, +* Write specifically what browser (type and version, like "Firefox 49.0"), OS, and browser extensions you have installed * Write steps to replicate the error: when did it happen? What did you expect to happen? What happened instead? @@ -99,8 +99,9 @@ to iD, only display them in the interface through the `t()` function. Then, add the new string to `data/core.yaml`. The translation system, Transifex, will automatically detect the change. -Use `make` to build the translations with the local changes. -`make translate` can be used to pull the latest translations from Transifex. +Use `npm run build` to build the translations with the local changes. + +`npm run translations` can be used to pull the latest translations from Transifex. ## Contributing Documentation @@ -161,23 +162,19 @@ Just like HTML and JavaScript, 4 space soft tabs always. ``` We write vanilla CSS with no preprocessing step. Since iD targets modern browsers, -feel free to use newer features wisely. +(Chrome, Firefox, Safair, Opera, IE11, and Edge) feel free to use newer features wisely. ## Tests Test your code and make sure it passes. -First ensure you have a `phantomjs` binary, version 2.0 or later, available on your `$PATH`. On a Mac, -you can install this via homebrew with `brew install phantomjs`. Then: - 1. Go to the directory where you have checked out `iD` 2. run `npm install` -3. run `make` -4. run `npm test` to see whether your tests pass or fail. +3. run `npm test` to see whether your tests pass or fail. ## Building / Installing -You can build a concatenated and minified version of iD with the command `make && npm run build-min`. +You can rebuild iD completely with the command `npm run all`. iD will be built to the `dist` directory. This directory is self-contained; you can copy it into the public directory of your webserver to deploy iD. @@ -197,13 +194,12 @@ In your local copy, make a branch for this change: git checkout -b make-red -Make your changes to source files. By source files we mean the files in `js/`. -the `iD.js` and `iD.min.js` files in this project are autogenerated - don't edit -them. +Make your changes to source files under `modules/`. +The `iD.js` and `iD.min.js` files in this project are autogenerated - don't edit them. -So let's say you've changed `js/ui/confirm.js`. +So let's say you've changed `modules/ui/confirm.js`. -1. Run `eslint js/id` to make sure your code is clean -2. Run tests with `npm test` +1. Try it out locally. Run `npm start` and visit `localhost:8080` in a browser. +2. Run lint and tests with `npm test` 3. Commit your changes with an informative commit message 4. [Submit a pull request](https://help.github.com/articles/using-pull-requests) to the `openstreetmap/iD` project. diff --git a/Makefile b/Makefile deleted file mode 100644 index 034dbc637..000000000 --- a/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -all: \ - dist/iD.css \ - dist/img/iD-sprite.svg \ - dist/img/maki-sprite.svg - -MAKI_SOURCES = node_modules/maki/src/*.svg - -dist/img/maki-sprite.svg: $(MAKI_SOURCES) Makefile - node_modules/.bin/svg-sprite --symbol --symbol-dest . --symbol-sprite $@ $(MAKI_SOURCES) - -dist/img/iD-sprite.svg: svg/iD-sprite.src.svg svg/iD-sprite.json - node svg/spriteify.js --svg svg/iD-sprite.src.svg --json svg/iD-sprite.json > $@ - -dist/iD.css: css/*.css - cat css/reset.css css/map.css css/app.css > $@ - -translations: - node data/update_locales - -imagery: - node data/update_imagery - -clean: - rm -f dist/*.js dist/*.map dist/*.css dist/img/*.svg diff --git a/README.md b/README.md index a548c533f..e035487cb 100644 --- a/README.md +++ b/README.md @@ -22,26 +22,19 @@ * Stable mirror of `release` branch: http://openstreetmap.us/iD/release * Development mirror of `master` branch: http://openstreetmap.us/iD/master -Come on in, the water's lovely. More help? Ping `jfire` or `bhousel` on -[OpenStreetMap IRC](http://wiki.openstreetmap.org/wiki/IRC) -(`irc.oftc.net`, in `#iD` or `#osm-dev` or `#osm`) or on the [OpenStreetMap `dev` mailing list](http://wiki.openstreetmap.org/wiki/Mailing_lists). +Come on in, the water's lovely. More help? Ping `jfire` or `bhousel` on: +* [OpenStreetMap US Slack](https://osmus-slack.herokuapp.com/) +(`#dev` or `#general` channels) +* [OpenStreetMap IRC](http://wiki.openstreetmap.org/wiki/IRC) +(`irc.oftc.net`, in `#iD` or `#osm-dev` or `#osm`) +* [OpenStreetMap `dev` mailing list](http://wiki.openstreetmap.org/wiki/Mailing_lists) ## Prerequisites * [Node.js](http://nodejs.org/) version 4 or newer -* Command line development tools (`make`, `git`, and a compiler) for your platform - * Ubuntu: - * `sudo apt-get install build-essential git` - * macOS: - * Run `xcode-select --install` from a command line or install [Xcode](https://developer.apple.com/xcode/) - * Windows (Cygwin): - * Install [Git for Windows](https://git-scm.com/downloads) - * Install [Cygwin](https://cygwin.com/install.html) - choose default packages + `make`, `wget`, `apache2` (needed for updated mime type list) - * Optionally, install [apt-cyg](https://github.com/transcode-open/apt-cyg) for managing your Cygwin packages - * Edit `~/.bashrc`:
- Put Git for Windows before Cygwin in PATH, otherwise `npm install` may [fail to fetch git repositories](https://github.com/npm/npm/issues/7456)
-      export PATH=/cygdrive/c/Program\ Files/Git/mingw64/bin/:$PATH
- * Edit `~/.gitconfig`:
+* [`git`](https://www.atlassian.com/git/tutorials/install-git/) for your platform + * Note for Windows users: + * Edit `$HOME\.gitconfig`:
Add these lines to avoid checking in files with CRLF newlines
       [core]
           autocrlf = input
@@ -52,10 +45,9 @@ To run the current development version of iD on your own computer: 1. Create a local `git clone` of the project, then `cd` into the project folder 2. (Windows Only) Run `fixWinSymlinks.bat`. This script will prompt for Administrator rights. see also: http://stackoverflow.com/questions/5917249/git-symlinks-in-windows -3. Run `npm install` -4. Run `make` -5. Run `npm start` -6. Open `http://localhost:8080/` in a web browser +3. Run `npm install` (this will run the `prepublish` script that builds everything) +4. Run `npm start` +5. Open `http://localhost:8080/` in a web browser For guidance on building a packaged version, running tests, and contributing to development, see [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/RELEASING.md b/RELEASING.md index fd9080323..449a112a1 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -13,21 +13,19 @@ ### Update master branch - [ ] git checkout master -- [ ] make translations -- [ ] git add . && git commit -m 'make translations' -- [ ] make imagery -- [ ] git add . && git commit -m 'make imagery' -- [ ] make suggestions -- [ ] git add . && git commit -m 'make suggestions' +- [ ] npm run translations +- [ ] git add . && git commit -m 'npm run translations' +- [ ] npm run imagery +- [ ] git add . && git commit -m 'npm run imagery' - [ ] Update `CHANGELOG.md` -- [ ] Update version number in `id.js`, `package.json` +- [ ] Update version number in `modules/core/context.js`, `package.json` - [ ] git add . && git commit -m 'A.B.C' - [ ] git push origin master ### Update and tag release branch - [ ] git checkout release - [ ] git reset --hard master -- [ ] make +- [ ] npm run all - [ ] git add -f dist/*.css dist/*.js dist/img/*.svg dist/locales/*.json - [ ] git commit -m 'Check in build' - [ ] git tag vA.B.C diff --git a/package.json b/package.json index 285651f18..016d688e1 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,21 @@ "test": "test" }, "scripts": { + "all": "npm run clean && npm run build-assets && npm run build && npm run build-min", "build": "node build.js && node development_server.js", - "build-min": "npm run build && uglifyjs dist/iD.js -c -m -o dist/iD.min.js", + "build-assets": "npm run build-css && npm run build-svg", + "build-css": "cat css/reset.css css/map.css css/app.css > dist/iD.css", + "build-min": "uglifyjs dist/iD.js -c -m -o dist/iD.min.js", + "build-svg": "npm run build-svg-maki && npm run build-svg-id", + "build-svg-maki": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/maki-sprite.svg node_modules/maki/src/*.svg", + "build-svg-id": "node svg/spriteify.js --svg svg/iD-sprite.src.svg --json svg/iD-sprite.json > dist/img/iD-sprite.svg", + "clean": "rm -f dist/*.js dist/*.map dist/*.css dist/img/*.svg", + "imagery": "node data/update_imagery", "lint": "eslint *.js js/id test/spec modules", + "prepublish": "npm run all", "start": "node development_server.js develop", - "test": "npm run lint && npm run build && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec" + "test": "npm run lint && npm run build && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec", + "translations": "node data/update_locales" }, "repository": { "type": "git",