fscr 5.4.1 → 6.1.1
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/bin +1 -1
- package/dist/index.js +196 -49
- package/dist/lib/auth/auth-conf.js +63 -0
- package/dist/lib/codemod/arrow.js +13 -0
- package/dist/lib/codemod/arrow2.js +67 -0
- package/dist/lib/codemod/funcs.js +25 -0
- package/dist/lib/codemod/removeConsole.js +12 -0
- package/dist/lib/codemod/test.js +8 -0
- package/dist/lib/components/App.js +64 -0
- package/dist/lib/components/Selector.js +133 -0
- package/dist/lib/components/TabChanger.js +113 -0
- package/dist/lib/components/Table.js +177 -0
- package/dist/lib/components/Tabs.js +221 -0
- package/dist/lib/encryption/decryptConfig.js +81 -0
- package/dist/lib/encryption/encryption.js +135 -0
- package/dist/lib/generateFScripts.js +25 -0
- package/dist/lib/generateToc.js +36 -0
- package/dist/lib/generators/generateFScripts.js +25 -0
- package/dist/lib/generators/generateToc.js +38 -0
- package/dist/lib/generators/index.js +2 -0
- package/dist/lib/git/files.js +26 -0
- package/dist/lib/git/pub.js +42 -0
- package/dist/lib/git/taskRunner.js +80 -0
- package/dist/lib/git/validateNotDev.js +71 -0
- package/dist/lib/helpers.js +191 -0
- package/dist/lib/optionList.js +61 -0
- package/dist/lib/parseScriptsMd.js +93 -0
- package/dist/lib/parseScriptsPackage.js +9 -0
- package/dist/lib/parsers/parseScriptsMd.js +96 -0
- package/dist/lib/parsers/parseScriptsPackage.js +9 -0
- package/dist/lib/release/bump.js +52 -0
- package/dist/lib/release/commitWithMessage.js +65 -0
- package/dist/lib/release/index.js +4 -0
- package/dist/lib/release/publish.js +23 -0
- package/dist/lib/release/publish.sh +1 -0
- package/dist/lib/release/pushToGit.js +43 -0
- package/dist/lib/release/releasenotes.js +158 -0
- package/dist/lib/release/seeChangedFiles.js +89 -0
- package/dist/lib/release/sort.js +136 -0
- package/dist/lib/release/tree.js +163 -0
- package/dist/lib/release/validateNotDev.js +63 -0
- package/dist/lib/run/lib.js +454 -0
- package/dist/lib/run/main-p.js +59 -0
- package/dist/lib/run/main-s.js +56 -0
- package/dist/lib/run/parse-cli-args.js +222 -0
- package/dist/lib/run/run-p.js +30 -0
- package/dist/lib/run/run-s.js +57 -0
- package/dist/lib/runCLICommand.js +30 -0
- package/dist/lib/runParallel.js +20 -0
- package/dist/lib/runSequence.js +38 -0
- package/dist/lib/running/index.js +3 -0
- package/dist/lib/running/runCLICommand.js +38 -0
- package/dist/lib/running/runParallel.js +33 -0
- package/dist/lib/running/runSequence.js +43 -0
- package/dist/lib/startScripts.js +135 -0
- package/dist/lib/taskList.js +93 -0
- package/dist/lib/taskListAutoComplete.js +10 -0
- package/dist/lib/upgradePackages.js +65 -0
- package/dist/lib/utils/clear.js +18 -0
- package/dist/lib/utils/console.js +33 -0
- package/dist/lib/utils/encryption.js +18 -0
- package/dist/lib/utils/helpers.js +228 -0
- package/dist/lib/utils/index.js +2 -0
- package/dist/lib/utils/prompt.js +34 -0
- package/package.json +9 -7
- /package/dist/{index.html → lib/auth/index.html} +0 -0
package/bin
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import('./dist/index.js');
|
package/dist/index.js
CHANGED
|
@@ -1,49 +1,196 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
import bump from "./lib/release/bump.js";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { generateFScripts, generateToc } from "./lib/generators/index.js";
|
|
4
|
+
import parseScriptFile from "./lib/parsers/parseScriptsMd.js";
|
|
5
|
+
import upgradePackages from "./lib/upgradePackages.js";
|
|
6
|
+
import { runSequence, runParallel, runCLICommand } from "./lib/running/index.js";
|
|
7
|
+
import { startPackageScripts, startScripts, clearRecent } from "./lib/startScripts.js";
|
|
8
|
+
const taskName = chalk.rgb(39, 173, 96).bold.underline;
|
|
9
|
+
const textDescription = chalk.rgb(159, 161, 181);
|
|
10
|
+
import optionList from "./lib/optionList.js";
|
|
11
|
+
import validateNotInDev from "./lib/git/validateNotDev.js";
|
|
12
|
+
import encrypt from "./lib/encryption/encryption.js";
|
|
13
|
+
import { clear } from "./lib/utils/index.js";
|
|
14
|
+
import authConfig from "./lib/auth/auth-conf.js";
|
|
15
|
+
import { spawn } from "child_process";
|
|
16
|
+
import yargs from "yargs";
|
|
17
|
+
import "./lib/utils/console.js";
|
|
18
|
+
const runCmd = async (app, argsList = []) => {
|
|
19
|
+
let shell;
|
|
20
|
+
shell = spawn(app, argsList, {
|
|
21
|
+
stdio: "inherit",
|
|
22
|
+
cwd: process.cwd(),
|
|
23
|
+
env: {
|
|
24
|
+
...process.env,
|
|
25
|
+
...{
|
|
26
|
+
FORCE_COLOR: true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return new Promise(resolve => {
|
|
31
|
+
shell.on("close", code => {
|
|
32
|
+
resolve();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
(async () => {
|
|
37
|
+
clear();
|
|
38
|
+
const argv = yargs(process.argv.slice(2)).usage("Usage: $0 <command> [options]")
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* fsr
|
|
42
|
+
*/.command("", "Choose a script runner command", yargs => {}, async function () {}).example(`${taskName("$0")}`, `${textDescription("Choose a script runner command")}`)
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* fsr
|
|
46
|
+
*/.command("branch", "Create new branch instead of Development", yargs => {}, async function () {
|
|
47
|
+
await validateNotInDev();
|
|
48
|
+
}).example(`${taskName("$0")}`, `${textDescription("Validates branch and creates new")}`)
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* fsr
|
|
52
|
+
* start --
|
|
53
|
+
*/.usage("$0 <task> name:of:task").command("start", "Choose category then task to run", yargs => {}, async () => {
|
|
54
|
+
await startScripts(); // if ((await startScripts()) === false) {
|
|
55
|
+
// await startPackageScripts();
|
|
56
|
+
// }
|
|
57
|
+
}).example(`${taskName("$0 start")}`, `${textDescription("Open a task selection selector")}`)
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* fsr
|
|
61
|
+
* scripts --
|
|
62
|
+
*/.command("scripts", "Choose a script from package.json", yargs => {}, async function () {
|
|
63
|
+
await startPackageScripts();
|
|
64
|
+
}).example(`${taskName("$0 scripts")}`, `${textDescription("Choose a script from package.json")}`)
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* fsr
|
|
68
|
+
* list --
|
|
69
|
+
*/.command("list", "Select any task with text autocompletion", () => {}, async function (argv) {
|
|
70
|
+
await startScripts(false);
|
|
71
|
+
// const tasks = await scriptsParsed().allTasks;
|
|
72
|
+
}).example(`${taskName("$0 list")}`, `${textDescription("Show you all tasks you can run")}`)
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* fsr
|
|
76
|
+
* run --
|
|
77
|
+
*/.command("run [task]", "Run a specific task", yargs => {
|
|
78
|
+
yargs.positional("task", {
|
|
79
|
+
describe: "name of task to start",
|
|
80
|
+
default: ""
|
|
81
|
+
});
|
|
82
|
+
}, async function (argv) {
|
|
83
|
+
let {
|
|
84
|
+
task
|
|
85
|
+
} = argv;
|
|
86
|
+
const {
|
|
87
|
+
allTasks
|
|
88
|
+
} = await parseScriptFile();
|
|
89
|
+
const taskData = allTasks.find(t => t.name === task);
|
|
90
|
+
if (!taskData) {
|
|
91
|
+
console.error(`${chalk.bold.underline.red("Task not found")}`);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
let {
|
|
95
|
+
script,
|
|
96
|
+
lang
|
|
97
|
+
} = taskData;
|
|
98
|
+
let pars = script.split(" ");
|
|
99
|
+
let type = pars[0];
|
|
100
|
+
let env = {};
|
|
101
|
+
if (pars[0].includes("=")) {
|
|
102
|
+
let envs = type.split("=");
|
|
103
|
+
env[envs[0]] = envs[1];
|
|
104
|
+
type = pars[1];
|
|
105
|
+
pars.shift();
|
|
106
|
+
pars.shift();
|
|
107
|
+
script = pars.join(" ");
|
|
108
|
+
} else {
|
|
109
|
+
pars.shift();
|
|
110
|
+
script = pars.join(" ");
|
|
111
|
+
}
|
|
112
|
+
await runCLICommand({
|
|
113
|
+
task: {
|
|
114
|
+
name: task
|
|
115
|
+
},
|
|
116
|
+
script: {
|
|
117
|
+
lang: lang,
|
|
118
|
+
env: env,
|
|
119
|
+
type: type,
|
|
120
|
+
full: script,
|
|
121
|
+
rest: script.split(" ")
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}).example(`${taskName("$0 run start:web")}`, `${textDescription("Run task 'start:web'")}`)
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* fsr
|
|
128
|
+
* upgrade --
|
|
129
|
+
*/.command("upgrade", "Upgrade all your packages except ones specified by 'ignore-upgrade':[]", () => {}, async function (argv) {
|
|
130
|
+
let task = argv._[1];
|
|
131
|
+
await upgradePackages();
|
|
132
|
+
}).example(`${taskName("$0 upgrade")}`, `${textDescription("Upgraded!")}`)
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* fsr
|
|
136
|
+
* bump --
|
|
137
|
+
*/.command("bump", "Bump package.json and beautify it!", () => {}, async function (argv) {
|
|
138
|
+
let type = argv.type;
|
|
139
|
+
await bump(type);
|
|
140
|
+
}).example(`${taskName("$0 bump")}`, `${textDescription("BUMPED AND PRETTY!")}`)
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* fsr
|
|
144
|
+
* run-s --
|
|
145
|
+
*/.command("run-s", "Run a set of tasks one after another", () => {}, async function (argv) {
|
|
146
|
+
let tasks = argv._.slice();
|
|
147
|
+
tasks.shift();
|
|
148
|
+
const FcScripts = await parseScriptFile();
|
|
149
|
+
await runSequence(tasks, FcScripts);
|
|
150
|
+
}).example(`${taskName("$0 run-s start:web start:desktop")}`, `${textDescription("Run task 'start:web' and afterwards 'start:desktop'")}`)
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* fsr
|
|
154
|
+
* run-p --
|
|
155
|
+
*/.command("run-p", "Run tasks in parallel", () => {}, async function (argv) {
|
|
156
|
+
let tasks = argv._.slice();
|
|
157
|
+
tasks.shift();
|
|
158
|
+
const FcScripts = await parseScriptFile();
|
|
159
|
+
await runParallel(tasks, FcScripts);
|
|
160
|
+
}).example(`${taskName("$0 run-p start:web start:desktop")}`, `${textDescription("Run task 'start:web' and at the same time 'start:desktop'")}`)
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* fsr
|
|
164
|
+
* remote config --
|
|
165
|
+
*/.command("remote", "Get remote configuration", () => {}, async function (argv) {
|
|
166
|
+
await authConfig().catch(console.error);
|
|
167
|
+
}).example(`${taskName("$0 remote")}`, `${textDescription("Get remote config")}`)
|
|
168
|
+
/**
|
|
169
|
+
* fsr
|
|
170
|
+
* encryption --
|
|
171
|
+
*/.command("encryption", "Encrypt/Decrypt secret files", () => {}, async function (argv) {
|
|
172
|
+
await encrypt.init();
|
|
173
|
+
}).example(`${taskName("$0 encryption")}`, `${textDescription("Encrypt/Decrypt secret files")}`)
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* fsr
|
|
177
|
+
* clear --
|
|
178
|
+
*/.command("clear", "Clear recent task history", () => {}, async function (argv) {
|
|
179
|
+
await clearRecent();
|
|
180
|
+
}).example(`${taskName("$0 clear")}`, `${textDescription("Clear your recently run tasks")}`).example(`${taskName("$0 config")}`, `${textDescription("Update a config value")}`).command("generate", "Generate a sample fscripts.md file from the package.json", () => {}, async function (argv) {
|
|
181
|
+
await generateFScripts();
|
|
182
|
+
}).example(`${taskName("$0 generate")}`, `${textDescription("Generates a sample.fscripts.md you can use as template for your fscripts file")}`).command("toc", "Generate updated Table of Contents on top of the fscripts.md file", () => {}, async function (argv) {
|
|
183
|
+
let mdFile = argv._[1];
|
|
184
|
+
await generateToc(mdFile);
|
|
185
|
+
}).example(`${taskName("$0 toc")}`, `${textDescription("Generate updated Table of Contents on top of the fscripts.md file")}`).argv;
|
|
186
|
+
if (argv._.length === 0) {
|
|
187
|
+
(async function () {
|
|
188
|
+
const choice = await optionList();
|
|
189
|
+
if (choice) {
|
|
190
|
+
await runCmd("yarn", ["fsr", choice]);
|
|
191
|
+
} else {
|
|
192
|
+
console.log(chalk.green.bold("See you soon!"));
|
|
193
|
+
}
|
|
194
|
+
})();
|
|
195
|
+
}
|
|
196
|
+
})();
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import http from "http";
|
|
2
|
+
import open from "open";
|
|
3
|
+
import destroyer from "server-destroy";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
import { readJson } from "../utils/helpers.js";
|
|
10
|
+
const scriptsDir = process.cwd();
|
|
11
|
+
const rootDir = path.join(scriptsDir, "./");
|
|
12
|
+
const packagePath = path.join(rootDir, "package.json");
|
|
13
|
+
const serverConfig = async () => {
|
|
14
|
+
let index = await fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf-8");
|
|
15
|
+
return new Promise(resolve => {
|
|
16
|
+
const server = http.createServer(async (req, res) => {
|
|
17
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
18
|
+
res.setHeader("Access-Control-Request-Method", "*");
|
|
19
|
+
res.setHeader("Access-Control-Allow-Methods", "OPTIONS, GET, POST");
|
|
20
|
+
res.setHeader("Access-Control-Allow-Headers", "*");
|
|
21
|
+
const headers = {
|
|
22
|
+
"Access-Control-Allow-Origin": "*",
|
|
23
|
+
"Content-Type": "text/json",
|
|
24
|
+
"Access-Control-Allow-Methods": "OPTIONS, POST, GET",
|
|
25
|
+
"Access-Control-Max-Age": 2592000 // 30 days
|
|
26
|
+
};
|
|
27
|
+
if (req.method === "POST") {
|
|
28
|
+
res.writeHead(200, headers);
|
|
29
|
+
let body = "";
|
|
30
|
+
req.on("data", chunk => {
|
|
31
|
+
body += chunk.toString(); // convert Buffer to string
|
|
32
|
+
});
|
|
33
|
+
req.on("end", () => {
|
|
34
|
+
res.end(JSON.stringify({
|
|
35
|
+
done: true
|
|
36
|
+
}));
|
|
37
|
+
server.destroy();
|
|
38
|
+
resolve(JSON.parse(body));
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
res.end(index);
|
|
42
|
+
}
|
|
43
|
+
}).listen(5252, () => {
|
|
44
|
+
// open the browser to the authorize url to start the workflow
|
|
45
|
+
open("http://localhost:5252", {
|
|
46
|
+
wait: false
|
|
47
|
+
}).then(cp => cp.unref());
|
|
48
|
+
});
|
|
49
|
+
destroyer(server);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
async function main() {
|
|
53
|
+
const config = await serverConfig();
|
|
54
|
+
const packageJson = await readJson(packagePath);
|
|
55
|
+
let configFile = path.resolve(rootDir, "config.json");
|
|
56
|
+
if (packageJson.fscripts) {
|
|
57
|
+
if (packageJson.fscripts.config) {
|
|
58
|
+
configFile = path.resolve(rootDir, packageJson.fscripts.config);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
await fs.writeFileSync(configFile, JSON.stringify(config, null, 4), "utf-8");
|
|
62
|
+
}
|
|
63
|
+
export default main;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
let bbt = $("<div id='btt'>DOWNLOAD LINKS</div>");
|
|
2
|
+
$("body").append(`<style>#btt { position:fixed; z-index:8999999; bottom:0;left:0; background:rgba(0,0,0,0.6); padding:10px; color:white;}</style>`);
|
|
3
|
+
bbt.on("click", function () {
|
|
4
|
+
let linkszz = $(".c-dl-links a");
|
|
5
|
+
let dwlinks = [];
|
|
6
|
+
linkszz.each(function () {
|
|
7
|
+
if ($(this).attr("href").startsWith("https://rapidga")) {
|
|
8
|
+
dwlinks.push($(this).attr("href"));
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
window.navigator.clipboard.writeText(JSON.stringify(dwlinks));
|
|
12
|
+
});
|
|
13
|
+
$("body").append(bbt);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
module.exports = (file, api, options) => {
|
|
2
|
+
const j = api.jscodeshift;
|
|
3
|
+
const printOptions = options.printOptions || {
|
|
4
|
+
quote: 'single'
|
|
5
|
+
};
|
|
6
|
+
const root = j(file.source);
|
|
7
|
+
const ARGUMENTS = 'arguments';
|
|
8
|
+
const ARGS = 'args';
|
|
9
|
+
const createArrowFunctionExpression = (fn, args) => j.arrowFunctionExpression((fn.params || []).concat(j.restElement(args)), fn.body, fn.generator);
|
|
10
|
+
const filterMemberExpressions = path => path.parent.value.type !== "MemberExpression";
|
|
11
|
+
const filterArrowFunctions = path => {
|
|
12
|
+
while (path.parent) {
|
|
13
|
+
switch (path.value.type) {
|
|
14
|
+
case 'ArrowFunctionExpression':
|
|
15
|
+
if (j(path).find(j.Identifier, {
|
|
16
|
+
name: ARGS
|
|
17
|
+
}).size()) {
|
|
18
|
+
console.error(file.path + ': arrow function uses "' + ARGS + '" already. ' + 'Please rename this identifier first.');
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
case 'FunctionExpression':
|
|
23
|
+
case 'MethodDeclaration':
|
|
24
|
+
case 'Function':
|
|
25
|
+
case 'FunctionDeclaration':
|
|
26
|
+
return false;
|
|
27
|
+
default:
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
path = path.parent;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
};
|
|
34
|
+
const updateArgumentsCalls = path => {
|
|
35
|
+
var afPath = path;
|
|
36
|
+
while (afPath.parent) {
|
|
37
|
+
if (afPath.value.type == 'ArrowFunctionExpression') {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
afPath = afPath.parent;
|
|
41
|
+
}
|
|
42
|
+
const {
|
|
43
|
+
value: fn
|
|
44
|
+
} = afPath;
|
|
45
|
+
const {
|
|
46
|
+
params
|
|
47
|
+
} = fn;
|
|
48
|
+
const param = params[params.length - 1];
|
|
49
|
+
var args;
|
|
50
|
+
if (param && param.type == 'RestElement') {
|
|
51
|
+
params.pop();
|
|
52
|
+
args = param.argument;
|
|
53
|
+
} else {
|
|
54
|
+
args = j.identifier(ARGS);
|
|
55
|
+
}
|
|
56
|
+
j(afPath).replaceWith(createArrowFunctionExpression(fn, args));
|
|
57
|
+
if (params.length) {
|
|
58
|
+
j(path).replaceWith(j.arrayExpression(params.concat(j.spreadElement(args))));
|
|
59
|
+
} else {
|
|
60
|
+
j(path).replaceWith(args);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const didTransform = root.find(j.Identifier, {
|
|
64
|
+
name: ARGUMENTS
|
|
65
|
+
}).filter(filterMemberExpressions).filter(filterArrowFunctions).forEach(updateArgumentsCalls).size() > 0;
|
|
66
|
+
return didTransform ? root.toSource(printOptions) : null;
|
|
67
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default (fileInfo, api) => {
|
|
2
|
+
const j = api.jscodeshift;
|
|
3
|
+
return j(fileInfo.source).find(j.FunctionExpression).forEach(path => {
|
|
4
|
+
console.warn("-- Console oa", path.value);
|
|
5
|
+
}).toSource();
|
|
6
|
+
// return j(fileInfo.source)
|
|
7
|
+
// .find(j.CallExpression, {
|
|
8
|
+
// callee: {
|
|
9
|
+
// type: "MemberExpression",
|
|
10
|
+
// object: { type: "Identifier", name: "function" }
|
|
11
|
+
// }
|
|
12
|
+
// })
|
|
13
|
+
// .remove()
|
|
14
|
+
// .toSource();
|
|
15
|
+
// return api
|
|
16
|
+
// .jscodeshift(fileInfo.source)
|
|
17
|
+
// .find(j.CallExpression, {
|
|
18
|
+
// callee: {
|
|
19
|
+
// type: "MemberExpression",
|
|
20
|
+
// object: { type: "Identifier", name: "function" }
|
|
21
|
+
// }
|
|
22
|
+
// })
|
|
23
|
+
// .renameTo("zebra")
|
|
24
|
+
// .toSource();
|
|
25
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { Component } from "react";
|
|
2
|
+
import { render, Color, Box } from "ink";
|
|
3
|
+
import Selector from "./Selector.js";
|
|
4
|
+
import SelectInput from "ink-select-input";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import { Tabs, Tab } from "./TabChanger.js";
|
|
7
|
+
// import { Tabs, Tab } from "ink-tab";
|
|
8
|
+
|
|
9
|
+
class App extends Component {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.state = {
|
|
13
|
+
activeTab: "foo",
|
|
14
|
+
i: 0,
|
|
15
|
+
active: [0, 0]
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
handleTabChange = name => {
|
|
19
|
+
this.setState({
|
|
20
|
+
activeTab: name
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
render() {
|
|
24
|
+
return /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Tabs, {
|
|
25
|
+
activeTab: this.state.activeTab,
|
|
26
|
+
onChange: this.handleTabChange
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
28
|
+
name: "foo"
|
|
29
|
+
// renderName={() => (
|
|
30
|
+
// <Box flexDirection={"column"}>
|
|
31
|
+
// <Box>
|
|
32
|
+
// <Color bold>TITLE</Color>
|
|
33
|
+
// </Box>
|
|
34
|
+
// <Box>Under</Box>
|
|
35
|
+
// </Box>
|
|
36
|
+
// )}
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Box, null, "Test 52")), /*#__PURE__*/React.createElement(Tab, {
|
|
38
|
+
name: "baaar"
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
40
|
+
padding: 2
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Color, {
|
|
42
|
+
red: true,
|
|
43
|
+
bold: true
|
|
44
|
+
}, "HI"))), /*#__PURE__*/React.createElement(Tab, {
|
|
45
|
+
name: "baz"
|
|
46
|
+
}, "Baz")));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
render(/*#__PURE__*/React.createElement(App, null));
|
|
50
|
+
/**
|
|
51
|
+
<Selector />
|
|
52
|
+
|
|
53
|
+
<SelectInput
|
|
54
|
+
items={[
|
|
55
|
+
{
|
|
56
|
+
label: `${chalk.bold.green("Test")}
|
|
57
|
+
two four fibe`,
|
|
58
|
+
value: "test"
|
|
59
|
+
},
|
|
60
|
+
{ label: "Test2", value: "test2" }
|
|
61
|
+
]}
|
|
62
|
+
onSelect={this.handleSelect}
|
|
63
|
+
/>
|
|
64
|
+
*/
|