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
@@ -0,0 +1,113 @@
1
+ import promptQuestion from "../../utils/prompt.js";
2
+ import fcFilepicker1 from "fc-filepick";
3
+ import { spawn } from "child_process";
4
+
5
+ const fcFilepicker = fcFilepicker1.default;
6
+
7
+ /**
8
+ * Deploy
9
+ * @param files
10
+ * @param subdomain
11
+ * @param ctx
12
+ * @returns {Promise<unknown>}
13
+ */
14
+ const deployExec = async (files, subdomain, ctx) => {
15
+ const domain = `${subdomain}.surge.sh`;
16
+ ctx.logger.info(`Deploying ${files} → ${domain}`);
17
+ return await new Promise((resolve, reject) => {
18
+ const cmd = spawn("npx", ["surge", files, domain], { stdio: "inherit", shell: false });
19
+ cmd.on("close", (code) => {
20
+ if (code !== 0) reject(new Error(`surge exited with code ${code}`));
21
+ else resolve();
22
+ });
23
+ });
24
+ };
25
+ export default {
26
+ name: "deployment",
27
+ version: "1.0.0",
28
+ description: "Deploy your application to various environments",
29
+ author: "FSCR Team",
30
+ minFscrVersion: "7.0.0",
31
+ tags: ["deployment", "devops"],
32
+
33
+ async init(context) {
34
+ const deploymentHistory = [];
35
+
36
+ // Post-deployment tracking
37
+ context.registerHook("post-command", async (data) => {
38
+ if (data.command === "deploy") {
39
+ deploymentHistory.push({
40
+ timestamp: data.timestamp,
41
+ success: data.success,
42
+ duration: data.duration
43
+ });
44
+
45
+ context.setStorage({ deploymentHistory });
46
+ }
47
+ });
48
+
49
+ // Register deploy command
50
+ context.registerCommand({
51
+ name: "deploy",
52
+ description: "Deploy to a specific surge domain",
53
+ aliases: ["ship", "publish"],
54
+ options: [
55
+ {
56
+ flags: "--files",
57
+ description: "Location of files to publish"
58
+ },
59
+ {
60
+ flags: "--subdomain",
61
+ description: "What is the surge.sh subdomain"
62
+ }
63
+ ],
64
+ handler: async (options, ctx) => {
65
+ const files = options.files;
66
+ const subdomain = options.subdomain;
67
+
68
+ if (!files || !subdomain) {
69
+ ctx.logger.error("Usage: fsr deploy --files <path> --subdomain <name>");
70
+ return;
71
+ }
72
+
73
+ await deployExec(files, subdomain, ctx);
74
+ },
75
+ examples: [
76
+ "fsr deploy --files ./dist",
77
+ "fsr deploy --files ./dist --subdomain angel-test-5252"
78
+ ]
79
+ });
80
+
81
+ // Register deployment history command
82
+ context.registerCommand({
83
+ name: "deploy-history",
84
+ description: "View deployment history",
85
+ handler: async (options, ctx) => {
86
+ if (deploymentHistory.length === 0) {
87
+ ctx.logger.info("No deployment history");
88
+ return;
89
+ }
90
+
91
+ ctx.logger.info("Recent Deployments:");
92
+ ctx.logger.info("─".repeat(60));
93
+
94
+ const recent = deploymentHistory.slice(-10);
95
+ for (const record of recent) {
96
+ const status = record.success ? "✓" : "✗";
97
+ const date = new Date(record.timestamp).toLocaleString();
98
+ ctx.logger.info(`${status} ${date} (${record.duration}ms)`);
99
+ }
100
+
101
+ ctx.logger.info("─".repeat(60));
102
+ },
103
+ examples: ["fsr deploy-history"]
104
+ });
105
+
106
+ context.logger.success("Deployment plugin initialized");
107
+ },
108
+ async run(ctx) {
109
+ const r = await promptQuestion({}, "Subdomain?");
110
+ const folder = await fcFilepicker({ type: "folder" });
111
+ await deployExec(folder, r, ctx);
112
+ }
113
+ };
@@ -0,0 +1,17 @@
1
+ const registry = new Map();
2
+
3
+ export const registerHook = (name, fn) => {
4
+ if (!registry.has(name)) registry.set(name, []);
5
+ registry.get(name).push(fn);
6
+ };
7
+
8
+ export const fireHook = async (name, data) => {
9
+ const handlers = registry.get(name) ?? [];
10
+ for (const fn of handlers) {
11
+ try {
12
+ await fn(data);
13
+ } catch (err) {
14
+ console.error(`[hook:${name}] ${err.message}`);
15
+ }
16
+ }
17
+ };
@@ -0,0 +1,91 @@
1
+ import { readdirSync, existsSync } from "fs";
2
+ import { join, dirname } from "path";
3
+ import { fileURLToPath } from "url";
4
+ import chalk from "chalk";
5
+ import { registerHook, fireHook } from "./hooks.js";
6
+
7
+ const pluginsDir = join(dirname(fileURLToPath(import.meta.url)));
8
+
9
+ const logger = {
10
+ info: (msg) => console.log(chalk.cyan(msg)),
11
+ success: (msg) => console.log(chalk.green(msg)),
12
+ error: (msg) => console.error(chalk.red(msg)),
13
+ warn: (msg) => console.warn(chalk.yellow(msg)),
14
+ };
15
+
16
+ export const loadPlugins = async () => {
17
+ const commands = [];
18
+
19
+ let entries;
20
+ try {
21
+ entries = readdirSync(pluginsDir, { withFileTypes: true });
22
+ } catch {
23
+ return commands;
24
+ }
25
+
26
+ const dirs = entries.filter((e) => e.isDirectory());
27
+
28
+ const runnablePlugins = [];
29
+
30
+ for (const dir of dirs) {
31
+ const entryPath = join(pluginsDir, dir.name, "index.js");
32
+ if (!existsSync(entryPath)) continue;
33
+
34
+ try {
35
+ const { default: plugin } = await import(entryPath);
36
+ if (!plugin?.init) continue;
37
+
38
+ const context = {
39
+ logger,
40
+ registerHook,
41
+ registerCommand: (def) => commands.push(def),
42
+ };
43
+
44
+ await plugin.init(context);
45
+
46
+ if (typeof plugin.run === "function") {
47
+ runnablePlugins.push({ name: plugin.name || dir.name, description: plugin.description || "", run: () => plugin.run({ logger }) });
48
+ }
49
+ } catch (err) {
50
+ logger.error(`[plugin:${dir.name}] Failed to load: ${err.message}`);
51
+ }
52
+ }
53
+
54
+ return { commands, runnablePlugins };
55
+ };
56
+
57
+ export const registerPluginCommands = (yargsInstance, commands) => {
58
+ for (const cmd of commands) {
59
+ yargsInstance = yargsInstance.command(
60
+ cmd.name,
61
+ cmd.description || "",
62
+ (yargs) => {
63
+ for (const opt of cmd.options || []) {
64
+ const long = opt.flags.match(/--([a-z-]+)/)?.[1];
65
+ const short = opt.flags.match(/-([a-z])[^-]/)?.[1];
66
+ if (!long) continue;
67
+ yargs.option(long, {
68
+ alias: short,
69
+ description: opt.description,
70
+ type: opt.type || "string",
71
+ });
72
+ }
73
+ },
74
+ async (argv) => {
75
+ const start = Date.now();
76
+ try {
77
+ await cmd.handler(argv, { logger });
78
+ await fireHook("post-task", { taskName: cmd.name, duration: Date.now() - start, success: true });
79
+ } catch (err) {
80
+ await fireHook("task-error", { taskName: cmd.name, duration: Date.now() - start, error: err });
81
+ throw err;
82
+ }
83
+ }
84
+ );
85
+
86
+ for (const ex of cmd.examples || []) {
87
+ yargsInstance = yargsInstance.example(ex, "");
88
+ }
89
+ }
90
+ return yargsInstance;
91
+ };
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Task Notifier Plugin
3
+ * Send notifications when tasks complete
4
+ */
5
+
6
+ export default {
7
+ name: "task-notifier",
8
+ version: "1.0.0",
9
+ description: "Send desktop notifications for task completion",
10
+ author: "FSCR Team",
11
+ tags: ["notifications", "productivity"],
12
+
13
+ async init(context) {
14
+ let notificationsEnabled = true;
15
+
16
+ // Hook into task completion
17
+ context.registerHook("post-task", async (data) => {
18
+ if (!notificationsEnabled) return;
19
+
20
+ const title = data.success
21
+ ? `✓ Task Completed: ${data.taskName}`
22
+ : `✗ Task Failed: ${data.taskName}`;
23
+
24
+ const message = `Duration: ${(data.duration / 1000).toFixed(2)}s`;
25
+
26
+ // In real implementation, use a notification library
27
+ context.logger.info(`[Notification] ${title} - ${message}`);
28
+ console.log("TASK", title);
29
+ });
30
+
31
+ // Hook into errors
32
+ context.registerHook("task-error", async (data) => {
33
+ if (!notificationsEnabled) return;
34
+
35
+ context.logger.error(
36
+ `[Notification] ✗ Task Error: ${data.taskName}\n${data.error.message}`
37
+ );
38
+ });
39
+
40
+ // Register notification control commands
41
+ context.registerCommand({
42
+ name: "notify",
43
+ description: "Control task notifications",
44
+ options: [
45
+ { flags: "-e, --enable", description: "Enable notifications", type: "boolean" },
46
+ { flags: "-d, --disable", description: "Disable notifications", type: "boolean" },
47
+ { flags: "-s, --status", description: "Show notification status", type: "boolean" }
48
+ ],
49
+ handler: async (options, ctx) => {
50
+ if (options.enable) {
51
+ notificationsEnabled = true;
52
+ ctx.logger.success("Notifications enabled");
53
+ } else if (options.disable) {
54
+ notificationsEnabled = false;
55
+ ctx.logger.info("Notifications disabled");
56
+ } else if (options.status) {
57
+ const status = notificationsEnabled ? "enabled" : "disabled";
58
+ ctx.logger.info(`Notifications are ${status}`);
59
+ } else {
60
+ ctx.logger.info("Usage: fsr notify [--enable|--disable|--status]");
61
+ }
62
+ },
63
+ examples: [
64
+ "fsr notify --enable",
65
+ "fsr notify --disable",
66
+ "fsr notify --status"
67
+ ]
68
+ });
69
+
70
+ context.logger.success("Task Notifier plugin initialized");
71
+ }
72
+ };
@@ -4,49 +4,57 @@ import prompt from "../utils/prompt.js";
4
4
  import fs from "fs";
5
5
  let packagePath = path.resolve(process.cwd(), "package.json");
6
6
  import { execSync } from "child_process";
7
- const runAsync = async command => {
8
- return execSync(command);
7
+
8
+ const runAsync = async (command) => {
9
+ return execSync(command);
9
10
  };
10
- if (!fs.existsSync(packagePath)) {
11
- console.error("Cannot find package.json file in the current directory");
12
- process.exit(1);
13
- }
14
- const bump = async (typeParam = null) => {
15
- let type = "patch";
16
- if (!typeParam) {
17
- type = await prompt({
18
- type: "list",
19
- message: chalk.green.bold.underline("How big of a bump is this?"),
20
- choices: ["patch", "minor", "major"]
21
- });
22
- } else {
23
- type = typeParam;
24
- }
25
- let gitTag = await prompt({
26
- type: "confirm",
27
- message: chalk.green.bold.underline("Add git tag?"),
28
- default: false
29
- });
30
- await runAsync(`yarn version --${type} ${gitTag ? "--no-git-tag-version" : ""} --no-commit-hooks`);
31
- const packageJson = await fs.readFileSync(packagePath);
32
- const {
33
- version
34
- } = JSON.parse(packageJson);
35
- if (gitTag) {
36
- let description = await prompt({
37
- type: "input",
38
- message: chalk.green.bold.underline("Describe what was changed (optional):"),
39
- default: ""
40
- });
41
- let commitMessage = `VERSION ${version}`;
42
- if (description && description.trim()) {
43
- commitMessage += `\n\n${description.trim()}`;
11
+
12
+ const bump = async (typeParam = null, skipGit = false) => {
13
+ if (!fs.existsSync(packagePath)) {
14
+ console.error("Cannot find package.json file in the current directory");
15
+ process.exit(1);
44
16
  }
45
- await runAsync(`git add .`);
46
- await runAsync(`git commit -m "${commitMessage}"`);
47
- await runAsync(`git tag -a v${version} -m "VERSION ${version}"`);
48
- await runAsync(`git push origin --tags`);
49
- }
50
- console.log(chalk.green.underline(`\nNew version: ${version}\n`));
17
+ let type = "patch";
18
+ if (!typeParam) {
19
+ type = await prompt({
20
+ type: "list",
21
+ message: chalk.green.bold.underline("How big of a bump is this?"),
22
+ choices: ["patch", "minor", "major"]
23
+ });
24
+ } else {
25
+ type = typeParam;
26
+ }
27
+ let gitTag = false;
28
+ if (!skipGit) {
29
+ gitTag = await prompt({
30
+ type: "confirm",
31
+ message: chalk.green.bold.underline("Add git tag?"),
32
+ default: false
33
+ });
34
+ }
35
+ await runAsync(
36
+ `yarn version --${type} ${gitTag ? "--no-git-tag-version" : ""} --no-commit-hooks`
37
+ );
38
+ const packageJson = await fs.readFileSync(packagePath);
39
+ const { version } = JSON.parse(packageJson);
40
+ if (gitTag) {
41
+ let description = await prompt({
42
+ type: "input",
43
+ message: chalk.green.bold.underline("Describe what was changed (optional):"),
44
+ default: ""
45
+ });
46
+
47
+ let commitMessage = `VERSION ${version}`;
48
+ if (description && description.trim()) {
49
+ commitMessage += `\n\n${description.trim()}`;
50
+ }
51
+
52
+ await runAsync(`git add .`);
53
+ await runAsync(`git commit -m "${commitMessage}"`);
54
+ await runAsync(`git tag -a v${version} -m "VERSION ${version}"`);
55
+ await runAsync(`git push origin --tags`);
56
+ }
57
+ console.log(chalk.green.underline(`\nNew version: ${version}\n`));
51
58
  };
52
- export default bump;
59
+
60
+ export default bump;
@@ -5,61 +5,89 @@ import seeChangedFiles from "./seeChangedFiles.js";
5
5
  import bump from "./bump.js";
6
6
  import validateNotDev from "./validateNotDev.js";
7
7
  import simple from "simple-git";
8
+
8
9
  async function pub() {
9
- await validateNotDev();
10
- await bump();
11
- let pack = await readJson("package.json");
12
- await seeChangedFiles();
13
- let commitMsg = "";
14
- const type = await new Promise(resolve => {
15
- inquirer.prompt([{
16
- type: "list",
17
- message: chalk.green.bold.underline("What type of change is this?"),
18
- choices: ["refactor", "fix", "improvement", "docs", "style", "php", "test", "build", "ci", "chore", "revert"],
19
- name: "retType"
20
- }]).then(async ({
21
- retType
22
- }) => {
23
- resolve(retType);
10
+ await validateNotDev();
11
+ await bump();
12
+ let pack = await readJson("package.json");
13
+ await seeChangedFiles();
14
+ let commitMsg = "";
15
+ const type = await new Promise(resolve => {
16
+ inquirer
17
+ .prompt([
18
+ {
19
+ type: "list",
20
+ message: chalk.green.bold.underline("What type of change is this?"),
21
+ choices: [
22
+ "refactor",
23
+ "fix",
24
+ "improvement",
25
+ "docs",
26
+ "style",
27
+ "php",
28
+ "test",
29
+ "build",
30
+ "ci",
31
+ "chore",
32
+ "revert"
33
+ ],
34
+ name: "retType"
35
+ }
36
+ ])
37
+ .then(async ({ retType }) => {
38
+ resolve(retType);
39
+ });
24
40
  });
25
- });
26
- commitMsg += `[${type}] `;
27
- inquirer.prompt([{
28
- type: "input",
29
- message: chalk.bold.hex("#38be18")(`TITLE: What's new this version ${pack.version}: `),
30
- name: "commitTitle"
31
- }]).then(({
32
- commitTitle
33
- }) => {
34
- commitMsg += commitTitle + `\t\tVERSION ${pack.version}`;
35
- inquirer.prompt([{
36
- type: "message",
37
- message: chalk.bold.hex("#38be18")(`Explain in detail!`),
38
- name: "commitDescription"
39
- }]).then(async ({
40
- commitDescription
41
- }) => {
42
- commitMsg += "\n" + commitDescription;
43
- simple().add("./*").commit(`${commitMsg}`).addRemote("origin", "https://github.com/agrublev/freedcamp-script-runner.git").push(["-u", "origin", "Development"], () => console.log("done"));
41
+ commitMsg += `[${type}] `;
42
+ inquirer
43
+ .prompt([
44
+ {
45
+ type: "input",
46
+ message: chalk.bold.hex("#38be18")(
47
+ `TITLE: What's new this version ${pack.version}: `
48
+ ),
49
+ name: "commitTitle"
50
+ }
51
+ ])
52
+ .then(({ commitTitle }) => {
53
+ commitMsg += commitTitle + `\t\tVERSION ${pack.version}`;
54
+ inquirer
55
+ .prompt([
56
+ {
57
+ type: "message",
58
+ message: chalk.bold.hex("#38be18")(`Explain in detail!`),
59
+ name: "commitDescription"
60
+ }
61
+ ])
62
+ .then(async ({ commitDescription }) => {
63
+ commitMsg += "\n" + commitDescription;
64
+ simple()
65
+ .add("./*")
66
+ .commit(`${commitMsg}`)
67
+ .addRemote(
68
+ "origin",
69
+ "https://github.com/agrublev/freedcamp-script-runner.git"
70
+ )
71
+ .push(["-u", "origin", "Development"], () => console.log("done"));
44
72
 
45
- // .commit(`${commitMsg}`)
46
- // .addRemote("origin", "https://github.com/agrublev/freedcamp-script-runner.git")
47
- // .push(["-u", "origin", "Tztt"], () => console.log("done"));
73
+ // .commit(`${commitMsg}`)
74
+ // .addRemote("origin", "https://github.com/agrublev/freedcamp-script-runner.git")
75
+ // .push(["-u", "origin", "Tztt"], () => console.log("done"));
48
76
 
49
- // .push(["-u", "origin"], () => console.log("done"))
50
- // .addTag(`${pack.version}`, () => console.warn("-- Console TAGGED", 52))
51
- // .pushTags();
52
- try {
53
- // logInfo(command);
54
- childProcess.execSync("git push -u origin Treat", {
55
- stdio: "inherit",
56
- env: Object.assign({}, process.env, {
57
- FORCE_COLOR: true,
58
- PATH: `${path.resolve("node_modules")}:${process.env.PATH}`
59
- })
77
+ // .push(["-u", "origin"], () => console.log("done"))
78
+ // .addTag(`${pack.version}`, () => console.warn("-- Console TAGGED", 52))
79
+ // .pushTags();
80
+ try {
81
+ // logInfo(command);
82
+ childProcess.execSync("git push -u origin Treat", {
83
+ stdio: "inherit",
84
+ env: Object.assign({}, process.env, {
85
+ FORCE_COLOR: true,
86
+ PATH: `${path.resolve("node_modules")}:${process.env.PATH}`
87
+ })
88
+ });
89
+ } catch (e) {}
90
+ });
60
91
  });
61
- } catch (e) {}
62
- });
63
- });
64
92
  }
65
- pub();
93
+ pub();
@@ -5,19 +5,24 @@ const __filename = fileURLToPath(import.meta.url);
5
5
  const __dirname = path.dirname(__filename);
6
6
  import { boxInform } from "../utils/helpers.js";
7
7
  import chalk from "chalk";
8
+
8
9
  async function pub() {
9
- let command = `sh ${path.resolve(__dirname, "publish.sh")}`;
10
- try {
11
- childProcess.execSync(command, {
12
- stdio: "inherit",
13
- env: Object.assign({}, process.env, {
14
- FORCE_COLOR: true,
15
- PATH: `${path.resolve("node_modules")}:${process.env.PATH}`
16
- })
17
- });
18
- boxInform(chalk.green.bold.underline("PUBLISHED"), "https://www.npmjs.com/package/fscripts", 3);
19
- } catch (e) {
20
- console.error(`${command} - ${e}`);
21
- }
10
+ let command = `sh ${path.resolve(__dirname, "publish.sh")}`;
11
+ try {
12
+ childProcess.execSync(command, {
13
+ stdio: "inherit",
14
+ env: Object.assign({}, process.env, {
15
+ FORCE_COLOR: true,
16
+ PATH: `${path.resolve("node_modules")}:${process.env.PATH}`
17
+ })
18
+ });
19
+ boxInform(
20
+ chalk.green.bold.underline("PUBLISHED"),
21
+ "https://www.npmjs.com/package/fscripts",
22
+ 3
23
+ );
24
+ } catch (e) {
25
+ console.error(`${command} - ${e}`);
26
+ }
22
27
  }
23
- pub();
28
+ pub();
@@ -1,43 +1,52 @@
1
1
  import { spawn } from "child-process-promise";
2
2
  import prompt from "console-prompt";
3
+
3
4
  const gitTarget = "origin";
4
5
  let gitTargetBranch = "Development";
6
+
5
7
  const runGitPush = gitParams => {
6
- const gitPromise = spawn("git", gitParams);
7
- const {
8
- childProcess
9
- } = gitPromise;
10
- childProcess.stdout.pipe(process.stdout);
11
- childProcess.stderr.pipe(process.stderr);
12
- return gitPromise;
8
+ const gitPromise = spawn("git", gitParams);
9
+ const { childProcess } = gitPromise;
10
+
11
+ childProcess.stdout.pipe(process.stdout);
12
+ childProcess.stderr.pipe(process.stderr);
13
+
14
+ return gitPromise;
13
15
  };
14
16
 
15
17
  // Git command to get the current branch name: git rev-parse --abbrev-ref HEAD
16
18
 
17
19
  const push = () => {
18
- spawn("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
19
- capture: ["stdout", "stderr"]
20
- }).then(result => {
21
- const currGitBranch = result.stdout.toString().trim();
22
- if (!currGitBranch) {
23
- console.error("Current git branch is undefined!");
24
- process.exit(2);
25
- }
26
-
27
- // if (gitTargetBranch === undefined) {
28
- gitTargetBranch = currGitBranch;
29
- // }
30
-
31
- console.log(`Push current git branch [${currGitBranch}] to ${gitTargetBranch} of: \n` + `${gitTarget}`);
32
- const gitParams = ["push"];
33
- gitParams.push(`${gitTarget}`);
34
- gitParams.push(`${currGitBranch}:${gitTargetBranch}`);
35
- console.log(`The exact command is:
20
+ spawn("git", ["rev-parse", "--abbrev-ref", "HEAD"], { capture: ["stdout", "stderr"] })
21
+ .then(result => {
22
+ const currGitBranch = result.stdout.toString().trim();
23
+
24
+ if (!currGitBranch) {
25
+ console.error("Current git branch is undefined!");
26
+ process.exit(2);
27
+ }
28
+
29
+ // if (gitTargetBranch === undefined) {
30
+ gitTargetBranch = currGitBranch;
31
+ // }
32
+
33
+ console.log(
34
+ `Push current git branch [${currGitBranch}] to ${gitTargetBranch} of: \n` +
35
+ `${gitTarget}`
36
+ );
37
+
38
+ const gitParams = ["push"];
39
+
40
+ gitParams.push(`${gitTarget}`);
41
+ gitParams.push(`${currGitBranch}:${gitTargetBranch}`);
42
+
43
+ console.log(`The exact command is:
36
44
  git ${gitParams.join(" ")}`);
37
- return runGitPush(gitParams);
38
- }).catch(error => {
39
- const err = error.stderr ? error.stderr : error;
40
- console.error("Execution Errors:", err);
41
- });
45
+ return runGitPush(gitParams);
46
+ })
47
+ .catch(error => {
48
+ const err = error.stderr ? error.stderr : error;
49
+ console.error("Execution Errors:", err);
50
+ });
42
51
  };
43
- export default push;
52
+ export default push;