Skip to content

Commit

Permalink
Don't build package.json. Fixes d3#1213.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Apr 25, 2013
1 parent 9f25c5f commit 8e5b974
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 71 deletions.
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
LOCALE ?= en_US

all: \
GENERATED_FILES = \
d3.js \
d3.min.js \
component.json \
package.json
component.json

all: $(GENERATED_FILES)

.PHONY: clean all test

Expand All @@ -22,7 +23,9 @@ src/time/format-localized.js: src/locale.js src/time/format-locale.js

d3.js: $(shell node_modules/.bin/smash --list src/d3.js)
@rm -f $@
node_modules/.bin/smash src/d3.js | node_modules/.bin/uglifyjs - -b indent-level=2 -o $@
node_modules/.bin/smash src/d3.js \
| sed 's/[[:<:]]VERSION[[:>:]]/"$(shell ./version)"/' \
| node_modules/.bin/uglifyjs - -b indent-level=2 -o $@
@chmod a-w $@

d3.min.js: d3.js
Expand All @@ -34,10 +37,5 @@ component.json: src/component.js d3.js
node src/component.js > $@
@chmod a-w $@

package.json: src/package.js d3.js
@rm -f $@
node src/package.js > $@
@chmod a-w $@

clean:
rm -f d3*.js package.json component.json
rm -f $(GENERATED_FILES)
4 changes: 1 addition & 3 deletions src/component.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
var d3 = require("../index");

console.log(JSON.stringify({
"name": "d3",
"version": d3.version,
"version": require("../package.json").version,
"main": "index-browserify.js",
"scripts": ["index-browserify.js", "d3.js"]
}, null, 2));
55 changes: 0 additions & 55 deletions src/package.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/start.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
d3 = (function(){
var d3 = {version: "3.1.5"}; // semver
var d3 = {version: VERSION}; // semver
6 changes: 4 additions & 2 deletions test/load.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
process.env.TZ = "America/Los_Angeles";

var smash = require("smash"),
jsdom = require("jsdom");
jsdom = require("jsdom"),
version = require("../package.json").version;

require("./XMLHttpRequest");

module.exports = function() {
var files = [].slice.call(arguments).map(function(d) { return "src/" + d; }),
expression = "d3",
sandbox = null;
sandbox = {VERSION: version};

files.unshift("src/start");
files.push("src/end");
Expand All @@ -34,6 +35,7 @@ module.exports = function() {
};

sandbox = {
VERSION: version,
console: console,
XMLHttpRequest: XMLHttpRequest,
document: document,
Expand Down
3 changes: 3 additions & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

console.log(require("./package.json").version);

0 comments on commit 8e5b974

Please sign in to comment.