Skip to content

Commit 607f11c

Browse files
committed
lib/CSSOM.js doesn’t needed in npm package, so move it out of lib
Remove lib/index.js from the repository. It generates from src/files.js by running `jake lib/index.js`.
1 parent 84dc16e commit 607f11c

3 files changed

Lines changed: 13 additions & 35 deletions

File tree

Jakefile.js

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var PATH = require("path");
22
var FS = require("fs");
33

44
function readFile(path) {
5-
var abs_path = PATH.join(__dirname, "lib", path);
5+
var abs_path = PATH.join(__dirname, path);
66
return FS.readFileSync(abs_path, "utf8");
77
}
88

@@ -11,31 +11,23 @@ function stripCommonJS(text) {
1111
}
1212

1313
desc("Packages lib files into the one huge");
14-
task("default", ["lib/index.js"], function(){
15-
var files = [readFile("CSSOM.js")];
16-
var index_file = readFile("index.js");
14+
task("default", ["build/CSSOM.js"]);
1715

18-
(function(){
19-
var exports = {};
20-
function require(path) {
21-
var text = readFile(path + ".js");
22-
files.push(stripCommonJS(text).trimLeft());
23-
return {};
24-
}
25-
eval(index_file);
26-
})();
16+
directory("build");
2717

28-
var build_dir = PATH.join(__dirname, "build");
29-
try {
30-
FS.statSync(build_dir);
31-
} catch(e) {
32-
FS.mkdirSync(build_dir, 0755);
33-
}
34-
var build_path = PATH.join(build_dir, "CSSOM.js");
35-
FS.writeFileSync(build_path, files.join(""));
18+
file("build/CSSOM.js", ["src/files.js", "src/CSSOM.js", "build"], function() {
19+
var parts = [readFile("src/CSSOM.js")];
20+
require("./src/files").files.forEach(function(path) {
21+
var text = readFile("lib/" + path + ".js");
22+
parts.push(stripCommonJS(text).trimLeft());
23+
});
24+
FS.writeFileSync("build/CSSOM.js", parts.join(""));
3625
process.stdout.write("build/CSSOM.js is done\n");
3726
});
3827

28+
desc("Creates index file for npm package");
29+
task("lib", ["lib/index.js"]);
30+
3931
file("lib/index.js", ["src/files.js"], function() {
4032
FS.writeFileSync("lib/index.js", "'use strict';\n\n" + require('./src/files').files.map(function(fileName) {
4133
return "exports." + fileName + " = require('./" + fileName + "')." + fileName + ";\n";

lib/index.js

Lines changed: 0 additions & 14 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)