mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-28 23:24:14 +08:00
v0.0.1
This commit is contained in:
6
codemirror/bin/authors.sh
Normal file
6
codemirror/bin/authors.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
# Combine existing list of authors with everyone known in git, sort, add header.
|
||||
tail --lines=+3 AUTHORS > AUTHORS.tmp
|
||||
git log --format='%aN' | grep -v "Piët Delport" >> AUTHORS.tmp
|
||||
echo -e "List of CodeMirror contributors. Updated before every release.\n" > AUTHORS
|
||||
sort -u AUTHORS.tmp | sed 's/Google Inc\./Google LLC/' >> AUTHORS
|
||||
rm -f AUTHORS.tmp
|
3
codemirror/bin/lint
Normal file
3
codemirror/bin/lint
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
process.exit(require("../test/lint").ok ? 0 : 1);
|
38
codemirror/bin/release
Normal file
38
codemirror/bin/release
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var fs = require("fs"), child = require("child_process");
|
||||
|
||||
var number, bumpOnly;
|
||||
|
||||
for (var i = 2; i < process.argv.length; i++) {
|
||||
if (process.argv[i] == "-bump") bumpOnly = true;
|
||||
else if (/^\d+\.\d+\.\d+$/.test(process.argv[i])) number = process.argv[i];
|
||||
else { console.log("Bogus command line arg: " + process.argv[i]); process.exit(1); }
|
||||
}
|
||||
|
||||
if (!number) { console.log("Must give a version"); process.exit(1); }
|
||||
|
||||
function rewrite(file, f) {
|
||||
fs.writeFileSync(file, f(fs.readFileSync(file, "utf8")), "utf8");
|
||||
}
|
||||
|
||||
rewrite("src/edit/main.js", function(lib) {
|
||||
return lib.replace(/CodeMirror\.version = "\d+\.\d+\.\d+"/,
|
||||
"CodeMirror.version = \"" + number + "\"");
|
||||
});
|
||||
function rewriteJSON(pack) {
|
||||
return pack.replace(/"version":\s*"\d+\.\d+\.\d+"/, "\"version\": \"" + number + "\"");
|
||||
}
|
||||
rewrite("package.json", rewriteJSON);
|
||||
rewrite("doc/manual.html", function(manual) {
|
||||
return manual.replace(/>version \d+\.\d+\.\d+<\/span>/, ">version " + number + "</span>");
|
||||
});
|
||||
|
||||
if (bumpOnly) process.exit(0);
|
||||
|
||||
child.exec("bash bin/authors.sh", function(){});
|
||||
|
||||
rewrite("index.html", function(index) {
|
||||
return index.replace(/\.zip">\d+\.\d+\.\d+<\/a>/,
|
||||
".zip\">" + number + "</a>");
|
||||
});
|
48
codemirror/bin/source-highlight
Normal file
48
codemirror/bin/source-highlight
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// Simple command-line code highlighting tool. Reads code from stdin,
|
||||
// spits html to stdout. For example:
|
||||
//
|
||||
// echo 'function foo(a) { return a; }' | bin/source-highlight -s javascript
|
||||
// bin/source-highlight -s
|
||||
|
||||
var fs = require("fs");
|
||||
|
||||
var CodeMirror = require("../addon/runmode/runmode.node.js");
|
||||
require("../mode/meta.js");
|
||||
|
||||
var sPos = process.argv.indexOf("-s");
|
||||
if (sPos == -1 || sPos == process.argv.length - 1) {
|
||||
console.error("Usage: source-highlight -s language");
|
||||
process.exit(1);
|
||||
}
|
||||
var lang = process.argv[sPos + 1].toLowerCase(), modeName = lang;
|
||||
var found = CodeMirror.findModeByMIME(lang) || CodeMirror.findModeByName(lang)
|
||||
if (found) {
|
||||
modeName = found.mode
|
||||
lang = found.mime
|
||||
}
|
||||
|
||||
if (!CodeMirror.modes[modeName])
|
||||
require("../mode/" + modeName + "/" + modeName + ".js");
|
||||
|
||||
function esc(str) {
|
||||
return str.replace(/[<&]/g, function(ch) { return ch == "&" ? "&" : "<"; });
|
||||
}
|
||||
|
||||
var code = fs.readFileSync("/dev/stdin", "utf8");
|
||||
var curStyle = null, accum = "";
|
||||
function flush() {
|
||||
if (curStyle) process.stdout.write("<span class=\"" + curStyle.replace(/(^|\s+)/g, "$1cm-") + "\">" + esc(accum) + "</span>");
|
||||
else process.stdout.write(esc(accum));
|
||||
}
|
||||
|
||||
CodeMirror.runMode(code, lang, function(text, style) {
|
||||
if (style != curStyle) {
|
||||
flush();
|
||||
curStyle = style; accum = text;
|
||||
} else {
|
||||
accum += text;
|
||||
}
|
||||
});
|
||||
flush();
|
35
codemirror/bin/upload-release.js
Normal file
35
codemirror/bin/upload-release.js
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict"
|
||||
|
||||
let version = process.argv[2]
|
||||
let auth = process.argv[3]
|
||||
|
||||
if (!auth) {
|
||||
console.log("Usage: upload-release.js [TAG] [github-user:password]")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
require('child_process').exec("git --no-pager show -s --format='%s' " + version, (error, stdout) => {
|
||||
if (error) throw error
|
||||
let message = stdout.split("\n").slice(2)
|
||||
message = message.slice(0, message.indexOf("-----BEGIN PGP SIGNATURE-----")).join("\n")
|
||||
|
||||
let req = require("https").request({
|
||||
host: "api.github.com",
|
||||
auth: auth,
|
||||
headers: {"user-agent": "Release uploader"},
|
||||
path: "/repos/codemirror/codemirror/releases",
|
||||
method: "POST"
|
||||
}, res => {
|
||||
if (res.statusCode >= 300) {
|
||||
console.error(res.statusMessage)
|
||||
res.on("data", d => console.log(d.toString()))
|
||||
res.on("end", process.exit(1))
|
||||
}
|
||||
})
|
||||
req.write(JSON.stringify({
|
||||
tag_name: version,
|
||||
name: version,
|
||||
body: message
|
||||
}))
|
||||
req.end()
|
||||
})
|
Reference in New Issue
Block a user