fscr 6.2.3 → 7.3.0

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.
Files changed (98) hide show
  1. package/README.md +48 -30
  2. package/dist/index.js +502 -185
  3. package/dist/lib/auth/auth-conf.js +49 -45
  4. package/dist/lib/cache/README.md +341 -0
  5. package/dist/lib/cache/cli.js +152 -0
  6. package/dist/lib/cache/file-watcher.js +193 -0
  7. package/dist/lib/cache/index.js +422 -0
  8. package/dist/lib/cache/monitor.js +224 -0
  9. package/dist/lib/commands/doctor.js +225 -0
  10. package/dist/lib/completions/completion.js +342 -0
  11. package/dist/lib/completions/generator.js +152 -0
  12. package/dist/lib/completions/scripts/bash.sh +108 -0
  13. package/dist/lib/completions/scripts/fish.sh +105 -0
  14. package/dist/lib/completions/scripts/powershell.ps1 +168 -0
  15. package/dist/lib/completions/scripts/zsh.sh +124 -0
  16. package/dist/lib/diagnostics/cache.js +121 -0
  17. package/dist/lib/diagnostics/fileSystem.js +236 -0
  18. package/dist/lib/diagnostics/gitCheck.js +41 -0
  19. package/dist/lib/diagnostics/nodeVersion.js +68 -0
  20. package/dist/lib/diagnostics/packageManager.js +64 -0
  21. package/dist/lib/diagnostics/performance.js +141 -0
  22. package/dist/lib/encryption/decryptConfig.js +3 -2
  23. package/dist/lib/encryption/encryption.js +153 -113
  24. package/dist/lib/generators/generateFScripts.js +16 -13
  25. package/dist/lib/generators/generateToc.js +23 -14
  26. package/dist/lib/generators/index.js +1 -1
  27. package/dist/lib/git/pub.js +27 -31
  28. package/dist/lib/git/taskRunner.js +79 -69
  29. package/dist/lib/git/validateNotDev.js +65 -54
  30. package/dist/lib/optionList.js +69 -57
  31. package/dist/lib/parsers/parseScriptsMd.cached.js +208 -0
  32. package/dist/lib/parsers/parseScriptsMd.js +88 -79
  33. package/dist/lib/parsers/parseScriptsPackage.js +4 -3
  34. package/dist/lib/performance/cache.js +199 -0
  35. package/dist/lib/performance/lazy-loader.js +189 -0
  36. package/dist/lib/performance/monitor.js +303 -0
  37. package/dist/lib/plugins/deployment/index.js +113 -0
  38. package/dist/lib/plugins/hooks.js +17 -0
  39. package/dist/lib/plugins/loader.js +91 -0
  40. package/dist/lib/plugins/task-notifier/index.js +72 -0
  41. package/dist/lib/release/bump.js +51 -43
  42. package/dist/lib/release/commitWithMessage.js +80 -52
  43. package/dist/lib/release/publish.js +19 -14
  44. package/dist/lib/release/pushToGit.js +40 -31
  45. package/dist/lib/release/releasenotes.js +116 -97
  46. package/dist/lib/release/seeChangedFiles.js +68 -60
  47. package/dist/lib/release/sort.js +200 -116
  48. package/dist/lib/release/tree.js +161 -147
  49. package/dist/lib/release/validateNotDev.js +52 -44
  50. package/dist/lib/running/index.js +1 -1
  51. package/dist/lib/running/runCLICommand.js +41 -31
  52. package/dist/lib/running/runParallel.js +61 -59
  53. package/dist/lib/running/runSequence.js +55 -53
  54. package/dist/lib/startScripts.js +129 -114
  55. package/dist/lib/taskList.js +99 -84
  56. package/dist/lib/test-files/.fscripts.md +113 -0
  57. package/dist/lib/test-files/.fscripts.test.md +103 -0
  58. package/dist/lib/test-files/.fscriptsb.md +107 -0
  59. package/dist/lib/test-files/.mdtest.md +40 -0
  60. package/dist/lib/test-files/consoleSample.js +17 -0
  61. package/dist/lib/test-files/inputSample.js +20 -0
  62. package/dist/lib/test-files/testConsole.js +1 -0
  63. package/dist/lib/test-files/testInput.js +2 -0
  64. package/dist/lib/upgradePackages.js +56 -46
  65. package/dist/lib/utils/clear.js +16 -13
  66. package/dist/lib/utils/console.js +27 -21
  67. package/dist/lib/utils/encryption.js +55 -13
  68. package/dist/lib/utils/hash.js +128 -0
  69. package/dist/lib/utils/helpers.js +153 -142
  70. package/dist/lib/utils/index.js +1 -1
  71. package/dist/lib/utils/prompt.js +24 -29
  72. package/package.json +20 -32
  73. package/dist/lib/codemod/arrow.js +0 -13
  74. package/dist/lib/codemod/arrow2.js +0 -67
  75. package/dist/lib/codemod/funcs.js +0 -25
  76. package/dist/lib/codemod/removeConsole.js +0 -12
  77. package/dist/lib/codemod/test.js +0 -8
  78. package/dist/lib/components/App.js +0 -64
  79. package/dist/lib/components/Selector.js +0 -133
  80. package/dist/lib/components/TabChanger.js +0 -113
  81. package/dist/lib/components/Table.js +0 -177
  82. package/dist/lib/components/Tabs.js +0 -221
  83. package/dist/lib/generateFScripts.js +0 -25
  84. package/dist/lib/generateToc.js +0 -30
  85. package/dist/lib/helpers.js +0 -191
  86. package/dist/lib/parseScriptsMd.js +0 -85
  87. package/dist/lib/parseScriptsPackage.js +0 -9
  88. package/dist/lib/release/index.js +0 -4
  89. package/dist/lib/run/lib.js +0 -454
  90. package/dist/lib/run/main-p.js +0 -59
  91. package/dist/lib/run/main-s.js +0 -56
  92. package/dist/lib/run/parse-cli-args.js +0 -222
  93. package/dist/lib/run/run-p.js +0 -30
  94. package/dist/lib/run/run-s.js +0 -57
  95. package/dist/lib/runCLICommand.js +0 -30
  96. package/dist/lib/runParallel.js +0 -20
  97. package/dist/lib/runSequence.js +0 -38
  98. package/dist/lib/taskListAutoComplete.js +0 -15
@@ -9,55 +9,63 @@ import { boxInform } from "../utils/helpers.js";
9
9
  import git from "git-state";
10
10
  import simple from "simple-git";
11
11
  const pathToCwd = process.cwd();
12
+
12
13
  const newBranch = async name => {
13
- // const last = await new Promise(rzz => {
14
- // git.isGit(pathToCwd, function(exists) {
15
- // if (!exists) return;
16
- //
17
- // git.commit(pathToCwd, function(err, result) {
18
- // if (err) throw err;
19
- // rzz(result);
20
- // });
21
- // });
22
- // });
14
+ // const last = await new Promise(rzz => {
15
+ // git.isGit(pathToCwd, function(exists) {
16
+ // if (!exists) return;
17
+ //
18
+ // git.commit(pathToCwd, function(err, result) {
19
+ // if (err) throw err;
20
+ // rzz(result);
21
+ // });
22
+ // });
23
+ // });
23
24
 
24
- // await simple().checkoutLocalBranch(name);
25
- await simple().checkoutBranch(name, "origin/Development");
26
- boxInform(chalk.green(`New branch ${name} created`, "", 5));
25
+ // await simple().checkoutLocalBranch(name);
26
+ await simple().checkoutBranch(name, "origin/Development");
27
+ boxInform(chalk.green(`New branch ${name} created`, "", 5));
27
28
  };
29
+
28
30
  async function pub() {
29
- return new Promise(resolve => {
30
- inquirer.prompt([{
31
- type: "input",
32
- message: chalk.bold.hex("#38be18")(`Name new feature branch (or type cancel):`),
33
- name: "branchname"
34
- }]).then(async ({
35
- branchname
36
- }) => {
37
- if (branchname !== "Development") await newBranch(branchname);
38
- resolve();
31
+ return new Promise(resolve => {
32
+ inquirer
33
+ .prompt([
34
+ {
35
+ type: "input",
36
+ message: chalk.bold.hex("#38be18")(`Name new feature branch (or type cancel):`),
37
+ name: "branchname"
38
+ }
39
+ ])
40
+ .then(async ({ branchname }) => {
41
+ if (branchname !== "Development") await newBranch(branchname);
42
+ resolve();
43
+ });
39
44
  });
40
- });
41
45
  }
46
+
42
47
  const validateNotInDev = async () => {
43
- await new Promise(async resolve => {
44
- const {
45
- default: git
46
- } = await import("simple-git/promise");
47
- let statusSummary = await git(__dirname).status();
48
- if (statusSummary.current === "Development") {
49
- console.clear();
50
- console.log(boxen(chalk.bold.underline.red("DO NO MAKE CHANGES IN DEV!"), {
51
- padding: 2
52
- }));
53
- await new Promise(resolve1 => setTimeout(() => {
54
- resolve1();
55
- }, 1000));
56
- await pub();
57
- resolve();
58
- } else {
59
- resolve();
60
- }
61
- });
48
+ await new Promise(async resolve => {
49
+ const { default: git } = await import("simple-git/promise");
50
+
51
+ let statusSummary = await git(__dirname).status();
52
+ if (statusSummary.current === "Development") {
53
+ console.clear();
54
+ console.log(
55
+ boxen(chalk.bold.underline.red("DO NO MAKE CHANGES IN DEV!"), {
56
+ padding: 2
57
+ })
58
+ );
59
+ await new Promise(resolve1 =>
60
+ setTimeout(() => {
61
+ resolve1();
62
+ }, 1000)
63
+ );
64
+ await pub();
65
+ resolve();
66
+ } else {
67
+ resolve();
68
+ }
69
+ });
62
70
  };
63
- export default validateNotInDev;
71
+ export default validateNotInDev;
@@ -1,3 +1,3 @@
1
1
  export { default as runSequence } from "./runSequence.js";
2
2
  export { default as runParallel } from "./runParallel.js";
3
- export { default as runCLICommand } from "./runCLICommand.js";
3
+ export { default as runCLICommand } from "./runCLICommand.js";
@@ -3,36 +3,46 @@ import path from "path";
3
3
  import moment from "moment-mini";
4
4
  import spawn from "cross-spawn";
5
5
  import requireFromString from "require-from-string";
6
- export default async ({
7
- script,
8
- task,
9
- type = script.type
10
- }, quiet = false) => {
11
- if (!quiet) {
12
- console.log(`${chalk.green.bgHex("#181c24").bold("[" + moment().format("HH:MM:SS") + "]")}${chalk.bgHex("#181c24").bold.hex("#8c91a7")(" " + task.name + ": ")}`);
13
- }
14
- return new Promise(resolve => {
15
- if (script.lang === "javascript") {
16
- requireFromString(script.full, "./fscripts.md");
17
- resolve();
18
- } else {
19
- const cmd = spawn(type, [...script.rest], {
20
- stdio: "inherit",
21
- env: Object.assign({}, process.env, {
22
- FORCE_COLOR: true,
23
- PATH: `${path.resolve("node_modules/.bin")}:${process.env.PATH}`,
24
- ...script.env
25
- })
26
- });
27
- cmd.on("close", code => {
28
- if (code === 0) {
29
- resolve();
6
+ import { fireHook } from "../plugins/hooks.js";
7
+
8
+ export default async ({ script, task, type = script.type }, quiet = false) => {
9
+ if (!quiet) {
10
+ console.log(
11
+ `${chalk.green
12
+ .bgHex("#181c24")
13
+ .bold("[" + moment().format("HH:MM:SS") + "]")}${chalk
14
+ .bgHex("#181c24")
15
+ .bold.hex("#8c91a7")(" " + task.name + ": ")}`
16
+ );
17
+ }
18
+ const start = Date.now();
19
+ return new Promise(resolve => {
20
+ if (script.lang === "javascript") {
21
+ requireFromString(script.full, "./fscripts.md");
22
+ fireHook("post-task", { taskName: task.name, duration: Date.now() - start, success: true });
23
+ resolve();
30
24
  } else {
31
- console.error(`${chalk.red("ERROR")} ${code} runCli`);
32
- resolve();
25
+ const command = [type, script.full].filter(Boolean).join(" ").trim();
26
+ const cmd = spawn(command, [], {
27
+ stdio: "inherit",
28
+ shell: true,
29
+ env: Object.assign({}, process.env, {
30
+ FORCE_COLOR: true,
31
+ PATH: `${path.resolve("node_modules/.bin")}:${process.env.PATH}`,
32
+ ...script.env
33
+ })
34
+ });
35
+
36
+ cmd.on("close", async code => {
37
+ const duration = Date.now() - start;
38
+ if (code !== 0) {
39
+ console.error(`${chalk.red("ERROR")} ${code} runCli`);
40
+ await fireHook("task-error", { taskName: task.name, duration, error: new Error(`exit code ${code}`) });
41
+ } else {
42
+ await fireHook("post-task", { taskName: task.name, duration, success: true });
43
+ }
44
+ resolve();
45
+ });
33
46
  }
34
- });
35
- // }
36
- }
37
- });
38
- };
47
+ });
48
+ };
@@ -1,65 +1,67 @@
1
1
  import runCLICommand from "./runCLICommand.js";
2
2
  import chalk from "chalk";
3
+
3
4
  const runParallel = async (tasks, FcScripts) => {
4
- const promises = tasks.map(async taskName => {
5
- return new Promise(async resolve => {
6
- const taskData = FcScripts.allTasks.find(z => z.name === taskName);
7
- if (!taskData) {
8
- console.error(`${chalk.bold.underline.red("Task not found")}`);
9
- resolve();
10
- } else {
11
- let {
12
- script,
13
- lang
14
- } = taskData;
15
- if (lang === "javascript") {
16
- // For JavaScript, use the script as-is without parsing
17
- await runCLICommand({
18
- task: {
19
- name: taskName
20
- },
21
- script: {
22
- lang: lang,
23
- env: {},
24
- type: "node",
25
- full: script,
26
- rest: []
5
+ const promises = tasks.map(async taskName => {
6
+ return new Promise(async resolve => {
7
+ const taskData = FcScripts.allTasks.find(z => z.name === taskName);
8
+ if (!taskData) {
9
+ console.error(`${chalk.bold.underline.red("Task not found")}`);
10
+ resolve();
11
+ } else {
12
+ let { script, lang } = taskData;
13
+
14
+ try {
15
+ if (lang === "javascript") {
16
+ // For JavaScript, use the script as-is without parsing
17
+ await runCLICommand({
18
+ task: { name: taskName },
19
+ script: {
20
+ lang: lang,
21
+ env: {},
22
+ type: "node",
23
+ full: script,
24
+ rest: []
25
+ }
26
+ });
27
+ } else {
28
+ // For bash scripts, parse command and environment variables
29
+ let pars = script.split(" ");
30
+ let type = pars[0];
31
+ let env = {};
32
+ if (pars[0].includes("=")) {
33
+ let envs = type.split("=");
34
+ env[envs[0]] = envs[1];
35
+ type = pars[1];
36
+ pars.shift();
37
+ pars.shift();
38
+ script = pars.join(" ");
39
+ } else {
40
+ pars.shift();
41
+ script = pars.join(" ");
42
+ }
43
+
44
+ await runCLICommand({
45
+ task: { name: taskName },
46
+ script: {
47
+ lang: lang,
48
+ env: env,
49
+ type: type,
50
+ full: script,
51
+ rest: script.split(" ")
52
+ }
53
+ });
54
+ }
55
+ } catch (error) {
56
+ // Silently catch errors to allow other tasks to continue
57
+ // Error logging is handled by runCLICommand
58
+ }
59
+ resolve();
27
60
  }
28
- });
29
- resolve();
30
- } else {
31
- // For bash scripts, parse command and environment variables
32
- let pars = script.split(" ");
33
- let type = pars[0];
34
- let env = {};
35
- if (pars[0].includes("=")) {
36
- let envs = type.split("=");
37
- env[envs[0]] = envs[1];
38
- type = pars[1];
39
- pars.shift();
40
- pars.shift();
41
- script = pars.join(" ");
42
- } else {
43
- pars.shift();
44
- script = pars.join(" ");
45
- }
46
- await runCLICommand({
47
- task: {
48
- name: taskName
49
- },
50
- script: {
51
- lang: lang,
52
- env: env,
53
- type: type,
54
- full: script,
55
- rest: script.split(" ")
56
- }
57
- });
58
- resolve();
59
- }
60
- }
61
+ });
61
62
  });
62
- });
63
- let results = await Promise.all(promises);
63
+
64
+ let results = await Promise.all(promises);
64
65
  };
65
- export default runParallel;
66
+
67
+ export default runParallel;
@@ -1,60 +1,62 @@
1
1
  import runCLICommand from "./runCLICommand.js";
2
2
  import chalk from "chalk";
3
+
3
4
  const runSequence = async (tasks, FcScripts) => {
4
- for (let t in tasks) {
5
- let taskName = tasks[t];
6
- const taskData = FcScripts.allTasks.find(z => z.name === taskName);
7
- if (!taskData) {
8
- console.error(`${chalk.bold.underline.red("Task not found")}`);
9
- } else {
10
- let {
11
- script,
12
- lang
13
- } = taskData;
14
- if (lang === "javascript") {
15
- // For JavaScript, use the script as-is without parsing
16
- await runCLICommand({
17
- task: {
18
- name: taskName
19
- },
20
- script: {
21
- lang: lang,
22
- env: {},
23
- type: "node",
24
- full: script,
25
- rest: []
26
- }
27
- });
28
- } else {
29
- // For bash scripts, parse command and environment variables
30
- let pars = script.split(" ");
31
- let type = pars[0];
32
- let env = {};
33
- if (pars[0].includes("=")) {
34
- let envs = type.split("=");
35
- env[envs[0]] = envs[1];
36
- type = pars[1];
37
- pars.shift();
38
- pars.shift();
39
- script = pars.join(" ");
5
+ for (let t in tasks) {
6
+ let taskName = tasks[t];
7
+ const taskData = FcScripts.allTasks.find(z => z.name === taskName);
8
+ if (!taskData) {
9
+ console.error(`${chalk.bold.underline.red("Task not found")}`);
40
10
  } else {
41
- pars.shift();
42
- script = pars.join(" ");
11
+ let { script, lang } = taskData;
12
+
13
+ try {
14
+ if (lang === "javascript") {
15
+ // For JavaScript, use the script as-is without parsing
16
+ await runCLICommand({
17
+ task: { name: taskName },
18
+ script: {
19
+ lang: lang,
20
+ env: {},
21
+ type: "node",
22
+ full: script,
23
+ rest: []
24
+ }
25
+ });
26
+ } else {
27
+ // For bash scripts, parse command and environment variables
28
+ let pars = script.split(" ");
29
+ let type = pars[0];
30
+ let env = {};
31
+ if (pars[0].includes("=")) {
32
+ let envs = type.split("=");
33
+ env[envs[0]] = envs[1];
34
+ type = pars[1];
35
+ pars.shift();
36
+ pars.shift();
37
+ script = pars.join(" ");
38
+ } else {
39
+ pars.shift();
40
+ script = pars.join(" ");
41
+ }
42
+
43
+ await runCLICommand({
44
+ task: { name: taskName },
45
+ script: {
46
+ lang: lang,
47
+ env: env,
48
+ type: type,
49
+ full: script,
50
+ rest: script.split(" ")
51
+ }
52
+ });
53
+ }
54
+ } catch (error) {
55
+ // Silently catch errors to allow sequential execution to continue
56
+ // Error logging is handled by runCLICommand
57
+ }
43
58
  }
44
- await runCLICommand({
45
- task: {
46
- name: taskName
47
- },
48
- script: {
49
- lang: lang,
50
- env: env,
51
- type: type,
52
- full: script,
53
- rest: script.split(" ")
54
- }
55
- });
56
- }
57
59
  }
58
- }
59
60
  };
60
- export default runSequence;
61
+
62
+ export default runSequence;