fscr 6.2.3 → 6.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -1
- package/dist/lib/git/pub.js +0 -14
- package/dist/lib/release/bump.js +9 -6
- package/dist/lib/taskList.js +69 -61
- package/dist/lib/test-files/consoleSample.js +13 -0
- package/dist/lib/test-files/inputSample.js +17 -0
- package/dist/lib/test-files/testConsole.js +1 -0
- package/dist/lib/test-files/testInput.js +2 -0
- package/package.json +12 -6
- package/dist/lib/codemod/arrow.js +0 -13
- package/dist/lib/codemod/arrow2.js +0 -67
- package/dist/lib/codemod/funcs.js +0 -25
- package/dist/lib/codemod/removeConsole.js +0 -12
- package/dist/lib/codemod/test.js +0 -8
- package/dist/lib/components/App.js +0 -64
- package/dist/lib/components/Selector.js +0 -133
- package/dist/lib/components/TabChanger.js +0 -113
- package/dist/lib/components/Table.js +0 -177
- package/dist/lib/components/Tabs.js +0 -221
- package/dist/lib/generateFScripts.js +0 -25
- package/dist/lib/generateToc.js +0 -30
- package/dist/lib/helpers.js +0 -191
- package/dist/lib/parseScriptsMd.js +0 -85
- package/dist/lib/parseScriptsPackage.js +0 -9
- package/dist/lib/release/index.js +0 -4
- package/dist/lib/run/lib.js +0 -454
- package/dist/lib/run/main-p.js +0 -59
- package/dist/lib/run/main-s.js +0 -56
- package/dist/lib/run/parse-cli-args.js +0 -222
- package/dist/lib/run/run-p.js +0 -30
- package/dist/lib/run/run-s.js +0 -57
- package/dist/lib/runCLICommand.js +0 -30
- package/dist/lib/runParallel.js +0 -20
- package/dist/lib/runSequence.js +0 -38
- package/dist/lib/taskListAutoComplete.js +0 -15
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Toru Nagashima
|
|
3
|
-
* @copyright 2016 Toru Nagashima. All rights reserved.
|
|
4
|
-
* See LICENSE file in root directory for full license.
|
|
5
|
-
*/
|
|
6
|
-
"use strict";
|
|
7
|
-
|
|
8
|
-
/*eslint-disable no-process-env */
|
|
9
|
-
|
|
10
|
-
//------------------------------------------------------------------------------
|
|
11
|
-
// Helpers
|
|
12
|
-
//------------------------------------------------------------------------------
|
|
13
|
-
const OVERWRITE_OPTION = /^--([^:]+?):([^=]+?)(?:=(.+))?$/;
|
|
14
|
-
const CONFIG_OPTION = /^--([^=]+?)(?:=(.+))$/;
|
|
15
|
-
const PACKAGE_CONFIG_PATTERN = /^npm_package_config_(.+)$/;
|
|
16
|
-
const CONCAT_OPTIONS = /^-[clnprs]+$/;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Overwrites a specified package config.
|
|
20
|
-
*
|
|
21
|
-
* @param {object} config - A config object to be overwritten.
|
|
22
|
-
* @param {string} packageName - A package name to overwrite.
|
|
23
|
-
* @param {string} variable - A variable name to overwrite.
|
|
24
|
-
* @param {string} value - A new value to overwrite.
|
|
25
|
-
* @returns {void}
|
|
26
|
-
*/
|
|
27
|
-
function overwriteConfig(config, packageName, variable, value) {
|
|
28
|
-
const scope = config[packageName] || (config[packageName] = {});
|
|
29
|
-
scope[variable] = value;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Creates a package config object.
|
|
34
|
-
* This checks `process.env` and creates the default value.
|
|
35
|
-
*
|
|
36
|
-
* @returns {object} Created config object.
|
|
37
|
-
*/
|
|
38
|
-
function createPackageConfig() {
|
|
39
|
-
const retv = {};
|
|
40
|
-
const packageName = process.env.npm_package_name;
|
|
41
|
-
if (!packageName) {
|
|
42
|
-
return retv;
|
|
43
|
-
}
|
|
44
|
-
for (const key of Object.keys(process.env)) {
|
|
45
|
-
const m = PACKAGE_CONFIG_PATTERN.exec(key);
|
|
46
|
-
if (m != null) {
|
|
47
|
-
overwriteConfig(retv, packageName, m[1], process.env[key]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return retv;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Adds a new group into a given list.
|
|
55
|
-
*
|
|
56
|
-
* @param {object[]} groups - A group list to add.
|
|
57
|
-
* @param {object} initialValues - A key-value map for the default of new value.
|
|
58
|
-
* @returns {void}
|
|
59
|
-
*/
|
|
60
|
-
function addGroup(groups, initialValues) {
|
|
61
|
-
groups.push(Object.assign({
|
|
62
|
-
parallel: false,
|
|
63
|
-
patterns: []
|
|
64
|
-
}, initialValues || {}));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* ArgumentSet is values of parsed CLI arguments.
|
|
69
|
-
* This class provides the getter to get the last group.
|
|
70
|
-
*/
|
|
71
|
-
class ArgumentSet {
|
|
72
|
-
/**
|
|
73
|
-
* @param {object} initialValues - A key-value map for the default of new value.
|
|
74
|
-
* @param {object} options - A key-value map for the options.
|
|
75
|
-
*/
|
|
76
|
-
constructor(initialValues, options) {
|
|
77
|
-
this.config = {};
|
|
78
|
-
this.continueOnError = false;
|
|
79
|
-
this.groups = [];
|
|
80
|
-
this.maxParallel = 0;
|
|
81
|
-
this.npmPath = null;
|
|
82
|
-
this.packageConfig = createPackageConfig();
|
|
83
|
-
this.printLabel = false;
|
|
84
|
-
this.printName = false;
|
|
85
|
-
this.race = false;
|
|
86
|
-
this.rest = [];
|
|
87
|
-
this.silent = process.env.npm_config_loglevel === "silent";
|
|
88
|
-
this.singleMode = Boolean(options && options.singleMode);
|
|
89
|
-
addGroup(this.groups, initialValues);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Gets the last group.
|
|
94
|
-
*/
|
|
95
|
-
get lastGroup() {
|
|
96
|
-
return this.groups[this.groups.length - 1];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Gets "parallel" flag.
|
|
101
|
-
*/
|
|
102
|
-
get parallel() {
|
|
103
|
-
return this.groups.some(g => g.parallel);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Parses CLI arguments.
|
|
109
|
-
*
|
|
110
|
-
* @param {ArgumentSet} set - The parsed CLI arguments.
|
|
111
|
-
* @param {string[]} args - CLI arguments.
|
|
112
|
-
* @returns {ArgumentSet} set itself.
|
|
113
|
-
*/
|
|
114
|
-
function parseCLIArgsCore(set, args) {
|
|
115
|
-
// eslint-disable-line complexity
|
|
116
|
-
LOOP: for (let i = 0; i < args.length; ++i) {
|
|
117
|
-
const arg = args[i];
|
|
118
|
-
switch (arg) {
|
|
119
|
-
case "--":
|
|
120
|
-
set.rest = args.slice(1 + i);
|
|
121
|
-
break LOOP;
|
|
122
|
-
case "--color":
|
|
123
|
-
case "--no-color":
|
|
124
|
-
// do nothing.
|
|
125
|
-
break;
|
|
126
|
-
case "-c":
|
|
127
|
-
case "--continue-on-error":
|
|
128
|
-
set.continueOnError = true;
|
|
129
|
-
break;
|
|
130
|
-
case "-l":
|
|
131
|
-
case "--print-label":
|
|
132
|
-
set.printLabel = true;
|
|
133
|
-
break;
|
|
134
|
-
case "-n":
|
|
135
|
-
case "--print-name":
|
|
136
|
-
set.printName = true;
|
|
137
|
-
break;
|
|
138
|
-
case "-r":
|
|
139
|
-
case "--race":
|
|
140
|
-
set.race = true;
|
|
141
|
-
break;
|
|
142
|
-
case "--silent":
|
|
143
|
-
set.silent = true;
|
|
144
|
-
break;
|
|
145
|
-
case "--max-parallel":
|
|
146
|
-
set.maxParallel = parseInt(args[++i], 10);
|
|
147
|
-
if (!Number.isFinite(set.maxParallel) || set.maxParallel <= 0) {
|
|
148
|
-
throw new Error(`Invalid Option: --max-parallel ${args[i]}`);
|
|
149
|
-
}
|
|
150
|
-
break;
|
|
151
|
-
case "-s":
|
|
152
|
-
case "--sequential":
|
|
153
|
-
case "--serial":
|
|
154
|
-
if (set.singleMode && arg === "-s") {
|
|
155
|
-
set.silent = true;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
if (set.singleMode) {
|
|
159
|
-
throw new Error(`Invalid Option: ${arg}`);
|
|
160
|
-
}
|
|
161
|
-
addGroup(set.groups);
|
|
162
|
-
break;
|
|
163
|
-
case "--aggregate-output":
|
|
164
|
-
set.aggregateOutput = true;
|
|
165
|
-
break;
|
|
166
|
-
case "-p":
|
|
167
|
-
case "--parallel":
|
|
168
|
-
if (set.singleMode) {
|
|
169
|
-
throw new Error(`Invalid Option: ${arg}`);
|
|
170
|
-
}
|
|
171
|
-
addGroup(set.groups, {
|
|
172
|
-
parallel: true
|
|
173
|
-
});
|
|
174
|
-
break;
|
|
175
|
-
case "--npm-path":
|
|
176
|
-
set.npmPath = args[++i] || null;
|
|
177
|
-
break;
|
|
178
|
-
default:
|
|
179
|
-
{
|
|
180
|
-
let matched = null;
|
|
181
|
-
if (matched = OVERWRITE_OPTION.exec(arg)) {
|
|
182
|
-
overwriteConfig(set.packageConfig, matched[1], matched[2], matched[3] || args[++i]);
|
|
183
|
-
} else if (matched = CONFIG_OPTION.exec(arg)) {
|
|
184
|
-
set.config[matched[1]] = matched[2];
|
|
185
|
-
} else if (CONCAT_OPTIONS.test(arg)) {
|
|
186
|
-
parseCLIArgsCore(set, arg.slice(1).split("").map(c => `-${c}`));
|
|
187
|
-
} else if (arg[0] === "-") {
|
|
188
|
-
throw new Error(`Invalid Option: ${arg}`);
|
|
189
|
-
} else {
|
|
190
|
-
set.lastGroup.patterns.push(arg);
|
|
191
|
-
}
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
if (!set.parallel && set.aggregateOutput) {
|
|
197
|
-
throw new Error("Invalid Option: --aggregate-output (without parallel)");
|
|
198
|
-
}
|
|
199
|
-
if (!set.parallel && set.race) {
|
|
200
|
-
const race = args.indexOf("--race") !== -1 ? "--race" : "-r";
|
|
201
|
-
throw new Error(`Invalid Option: ${race} (without parallel)`);
|
|
202
|
-
}
|
|
203
|
-
if (!set.parallel && set.maxParallel !== 0) {
|
|
204
|
-
throw new Error("Invalid Option: --max-parallel (without parallel)");
|
|
205
|
-
}
|
|
206
|
-
return set;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Parses CLI arguments.
|
|
211
|
-
*
|
|
212
|
-
* @param {string[]} args - CLI arguments.
|
|
213
|
-
* @param {object} initialValues - A key-value map for the default of new value.
|
|
214
|
-
* @param {object} options - A key-value map for the options.
|
|
215
|
-
* @param {boolean} options.singleMode - The flag to be single group mode.
|
|
216
|
-
* @returns {ArgumentSet} The parsed CLI arguments.
|
|
217
|
-
*/
|
|
218
|
-
module.exports = function parseCLIArgs(args, initialValues, options) {
|
|
219
|
-
return parseCLIArgsCore(new ArgumentSet(initialValues, options), args);
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
/*eslint-enable */
|
package/dist/lib/run/run-p.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//------------------------------------------------------------------------------
|
|
2
|
-
// Public Interface
|
|
3
|
-
//------------------------------------------------------------------------------
|
|
4
|
-
/*eslint-disable no-process-exit */
|
|
5
|
-
|
|
6
|
-
function bootstrap(name) {
|
|
7
|
-
const argv = process.argv.slice(2);
|
|
8
|
-
switch (argv[0]) {
|
|
9
|
-
case undefined:
|
|
10
|
-
default:
|
|
11
|
-
// https://github.com/mysticatea/npm-run-all/issues/105
|
|
12
|
-
// Avoid MaxListenersExceededWarnings.
|
|
13
|
-
process.stdout.setMaxListeners(0);
|
|
14
|
-
process.stderr.setMaxListeners(0);
|
|
15
|
-
process.stdin.setMaxListeners(0);
|
|
16
|
-
|
|
17
|
-
// Main
|
|
18
|
-
return import("./main-p.js").then(mod => mod.default(argv, process.stdout, process.stderr)).then(() => {
|
|
19
|
-
// I'm not sure why, but maybe the process never exits
|
|
20
|
-
// on Git Bash (MINGW64)
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}, () => {
|
|
23
|
-
process.exit(1);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/*eslint-enable */
|
|
29
|
-
|
|
30
|
-
bootstrap("run-p");
|
package/dist/lib/run/run-s.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Toru Nagashima
|
|
3
|
-
* @copyright 2015 Toru Nagashima. All rights reserved.
|
|
4
|
-
* See LICENSE file in root directory for full license.
|
|
5
|
-
*/
|
|
6
|
-
"use strict";
|
|
7
|
-
|
|
8
|
-
//------------------------------------------------------------------------------
|
|
9
|
-
// Main
|
|
10
|
-
//------------------------------------------------------------------------------
|
|
11
|
-
/**
|
|
12
|
-
* @author Toru Nagashima
|
|
13
|
-
* @copyright 2016 Toru Nagashima. All rights reserved.
|
|
14
|
-
* See LICENSE file in root directory for full license.
|
|
15
|
-
*/
|
|
16
|
-
import { readFileSync } from "fs";
|
|
17
|
-
import { fileURLToPath } from "url";
|
|
18
|
-
import path from "path";
|
|
19
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
-
const __dirname = path.dirname(__filename);
|
|
21
|
-
function printVersion(output) {
|
|
22
|
-
const version = JSON.parse(readFileSync(path.resolve(__dirname, "../../package.json"), "utf-8")).version;
|
|
23
|
-
output.write(`v${version}\n`);
|
|
24
|
-
return Promise.resolve(null);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//------------------------------------------------------------------------------
|
|
28
|
-
// Public Interface
|
|
29
|
-
//------------------------------------------------------------------------------
|
|
30
|
-
/*eslint-disable no-process-exit */
|
|
31
|
-
function bootstrap(name) {
|
|
32
|
-
const argv = process.argv.slice(2);
|
|
33
|
-
switch (argv[0]) {
|
|
34
|
-
case undefined:
|
|
35
|
-
case "-v":
|
|
36
|
-
case "--version":
|
|
37
|
-
return printVersion(process.stdout);
|
|
38
|
-
default:
|
|
39
|
-
// https://github.com/mysticatea/npm-run-all/issues/105
|
|
40
|
-
// Avoid MaxListenersExceededWarnings.
|
|
41
|
-
process.stdout.setMaxListeners(0);
|
|
42
|
-
process.stderr.setMaxListeners(0);
|
|
43
|
-
process.stdin.setMaxListeners(0);
|
|
44
|
-
|
|
45
|
-
// Main
|
|
46
|
-
return import(`./main-s.js`).then(mod => mod.default(argv, process.stdout, process.stderr)).then(() => {
|
|
47
|
-
// I'm not sure why, but maybe the process never exits
|
|
48
|
-
// on Git Bash (MINGW64)
|
|
49
|
-
process.exit(0);
|
|
50
|
-
}, () => {
|
|
51
|
-
process.exit(1);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/*eslint-enable */
|
|
57
|
-
bootstrap("run-s");
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import moment from "moment-mini";
|
|
4
|
-
import spawn from "cross-spawn";
|
|
5
|
-
export default async ({
|
|
6
|
-
script,
|
|
7
|
-
task,
|
|
8
|
-
type = script.type
|
|
9
|
-
}, quiet = false) => {
|
|
10
|
-
if (!quiet) {
|
|
11
|
-
console.log(`${chalk.green.bgHex("#181c24").bold("[" + moment().format("HH:MM:SS") + "]")}${chalk.bgHex("#181c24").bold.hex("#8c91a7")(" " + task.name + ": ")}`);
|
|
12
|
-
}
|
|
13
|
-
return new Promise(resolve => {
|
|
14
|
-
const cmd = spawn(type, [...script.rest], {
|
|
15
|
-
stdio: "inherit",
|
|
16
|
-
env: Object.assign({}, process.env, {
|
|
17
|
-
FORCE_COLOR: true,
|
|
18
|
-
PATH: `${path.resolve("node_modules/.bin")}:${process.env.PATH}`,
|
|
19
|
-
...script.env
|
|
20
|
-
})
|
|
21
|
-
});
|
|
22
|
-
cmd.on("close", code => {
|
|
23
|
-
if (code === 0) {
|
|
24
|
-
resolve();
|
|
25
|
-
} else {
|
|
26
|
-
console.error(`${chalk.red("ERROR")} ${code}`);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
};
|
package/dist/lib/runParallel.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import runCLICommand from "./running/runCLICommand.js";
|
|
2
|
-
const runParallel = async (tasks, FcScripts) => {
|
|
3
|
-
for (let t in tasks) {
|
|
4
|
-
let taskName = tasks[t];
|
|
5
|
-
let taskIndex = FcScripts.allTasks.findIndex(t => t.name === taskName);
|
|
6
|
-
let script = FcScripts.allTasks[taskIndex].script;
|
|
7
|
-
let params = script.split(" ");
|
|
8
|
-
let type = params.shift();
|
|
9
|
-
runCLICommand({
|
|
10
|
-
task: {
|
|
11
|
-
name: taskName
|
|
12
|
-
},
|
|
13
|
-
script: {
|
|
14
|
-
type: type,
|
|
15
|
-
rest: params
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
export default runParallel;
|
package/dist/lib/runSequence.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import runCLICommand from "./running/runCLICommand.js";
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
const runSequence = async (tasks, FcScripts) => {
|
|
4
|
-
for (let t in tasks) {
|
|
5
|
-
let taskName = tasks[t];
|
|
6
|
-
let taskIndex = FcScripts.allTasks.findIndex(t => t.name === taskName);
|
|
7
|
-
if (taskIndex === -1) {
|
|
8
|
-
console.log(`${chalk.red.underline("Skipping task " + taskName + ", as it cannot be found in .md file")}`);
|
|
9
|
-
} else {
|
|
10
|
-
let script = FcScripts.allTasks[taskIndex].script;
|
|
11
|
-
let pars = script.split(" ");
|
|
12
|
-
let type = pars[0];
|
|
13
|
-
let env = {};
|
|
14
|
-
if (pars[0].includes("=")) {
|
|
15
|
-
let envs = type.split("=");
|
|
16
|
-
env[envs[0]] = envs[1];
|
|
17
|
-
type = pars[1];
|
|
18
|
-
pars.shift();
|
|
19
|
-
pars.shift();
|
|
20
|
-
script = pars.join(" ");
|
|
21
|
-
} else {
|
|
22
|
-
pars.shift();
|
|
23
|
-
script = pars.join(" ");
|
|
24
|
-
}
|
|
25
|
-
await runCLICommand({
|
|
26
|
-
task: {
|
|
27
|
-
name: taskName
|
|
28
|
-
},
|
|
29
|
-
script: {
|
|
30
|
-
type: type,
|
|
31
|
-
rest: script.split(" "),
|
|
32
|
-
env: env
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
export default runSequence;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const scriptsDir = process.cwd();
|
|
2
|
-
import path from "path";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
const rootDir = path.join(scriptsDir, "../");
|
|
5
|
-
const separator = " ~ ";
|
|
6
|
-
import Conf from "conf";
|
|
7
|
-
let packagePath = path.resolve(process.cwd(), "package.json");
|
|
8
|
-
const packageJson = JSON.parse(fs.readFileSync(packagePath));
|
|
9
|
-
const config = new Conf({
|
|
10
|
-
projectName: packageJson.name
|
|
11
|
-
});
|
|
12
|
-
export default taskListAutoComplete;
|
|
13
|
-
// (async () => {
|
|
14
|
-
// await startScripts();
|
|
15
|
-
// })();
|