Skip to content

Commit b3e0224

Browse files
committed
chore: clean up
1 parent d88b643 commit b3e0224

File tree

4 files changed

+3
-62
lines changed

4 files changed

+3
-62
lines changed

documentation/Standard-Lib.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Add comments in the stdlib files (one line above the function/value), the format
141141

142142
After you fill the comments, you need to update the document by running
143143
```bash
144-
npm run docs:update
144+
npm run build:docs
145145
```
146146

147147
Check the output document out and submit a pull request. Thank you!

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121
"build": "npm run clear && webpack --mode production",
2222
"build:dev": "npm run clear && webpack --mode development",
2323
"build:site": "webpack --mode development --config webpack.site.config.js",
24+
"build:docs": "node ./tools/make_examples_readme.js && node ./tools/make_stdlib_cheatsheet.js",
2425
"dev:site": "webpack --mode development --config webpack.site.config.js --watch",
2526
"dev": "npm run clear && webpack --mode development --watch",
2627
"clear": "rimraf ./dist",
2728
"publish": "bump --commit && node ./tools/publish.js",
2829
"publish:ci": "node ./tools/publish.js",
2930
"release": "bump --commit --tag && git push --follow-tags",
30-
"docs:update": "node ./tools/stdlib_doc.js",
31-
"make_examples_readme": "node ./tools/make_examples_readme.js",
3231
"test": "mocha --require mocha-snapshots",
3332
"test:update": "mocha --require mocha-snapshots --update",
3433
"lint:fix": "npm run lint -- --fix",

tools/stdlib_doc.js renamed to tools/make_stdlib_cheatsheet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Add comments in the stdlib files (one line above the function/value), the format
3737
3838
After you fill the comments, you need to update the document by running
3939
\`\`\`bash
40-
npm run docs:update
40+
npm run build:docs
4141
\`\`\`
4242
4343
Check the output document out and submit a pull request. Thank you!

tools/utils.js

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,6 @@ const fs = require("fs");
22
const path = require("path");
33
var execSync = require("child_process").execSync;
44

5-
const catsrcIgnore = "/* wenyan-catsrc-ignore */";
6-
7-
function remotelib(urls) {
8-
var src = urls
9-
.map(url => execSync(`curl -s ${url}`, { encoding: "utf-8" }).toString())
10-
.join("\n")
11-
.replace(/"use strict"/g, /"use shit"/);
12-
(1, eval)(src);
13-
}
14-
15-
function catsrc() {
16-
var s = "";
17-
var rootPath = "../src/";
18-
var compilerPath = "../src/compiler/";
19-
var compilerList = ["base", "js", "py", "rb", "compilers"];
20-
// Must make sure compilers.js in the end.
21-
compilerList.push("compilers");
22-
compilerList = compilerList.map(filename => compilerPath + filename + ".js");
23-
var srcs = fs.readdirSync(rootPath).map(filename => rootPath + filename);
24-
srcs = srcs.concat(compilerList);
25-
26-
for (var i = 0; i < srcs.length; i++) {
27-
if (srcs[i].endsWith(".js") && !srcs[i].includes("cli")) {
28-
const raw = fs.readFileSync(srcs[i], "utf-8");
29-
30-
if (!raw.startsWith(catsrcIgnore))
31-
s += raw.replace(/const\s/g, "var ") + ";\n";
32-
}
33-
}
34-
return s;
35-
}
36-
375
function loadlib(libDir = path.resolve(__dirname, "../lib/")) {
386
var lib = {};
397
var srcs = fs.readdirSync(libDir);
@@ -48,21 +16,6 @@ function loadlib(libDir = path.resolve(__dirname, "../lib/")) {
4816
return lib;
4917
}
5018

51-
function uglifier() {
52-
remotelib([
53-
"https://skalman.github.io/UglifyJS-online/uglify/lib/utils.js",
54-
"https://skalman.github.io/UglifyJS-online/uglify/lib/ast.js",
55-
"https://skalman.github.io/UglifyJS-online/uglify/lib/parse.js",
56-
"https://skalman.github.io/UglifyJS-online/uglify/lib/transform.js",
57-
"https://skalman.github.io/UglifyJS-online/uglify/lib/scope.js",
58-
"https://skalman.github.io/UglifyJS-online/uglify/lib/output.js",
59-
"https://skalman.github.io/UglifyJS-online/uglify/lib/compress.js",
60-
"https://skalman.github.io/UglifyJS-online/uglify/lib/propmangle.js",
61-
"https://skalman.github.io/UglifyJS-online/uglify/lib/minify.js"
62-
]);
63-
return minify;
64-
}
65-
6619
function pyeval(py) {
6720
fs.writeFileSync("tmp.py", py);
6821
var ret = execSync(
@@ -79,19 +32,8 @@ function rbeval(rb) {
7932
return ret;
8033
}
8134

82-
function beautifier() {
83-
remotelib([
84-
"https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.10.2/beautify.js"
85-
]);
86-
return js_beautify;
87-
}
88-
8935
module.exports = {
90-
uglifier,
91-
beautifier,
92-
catsrc,
9336
loadlib,
94-
remotelib,
9537
pyeval,
9638
rbeval
9739
};

0 commit comments

Comments
 (0)