fscr 6.1.2 → 6.2.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.
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ const runCmd = async (app, argsList = []) => {
35
35
  };
36
36
  (async () => {
37
37
  clear();
38
- const argv = yargs(process.argv.slice(2)).usage("Usage: $0 <command> [options]")
38
+ const yargsInstance = yargs(process.argv.slice(2)).usage("Usage: $0 <command> [options]")
39
39
 
40
40
  /**
41
41
  * fsr
@@ -179,15 +179,14 @@ const runCmd = async (app, argsList = []) => {
179
179
  }).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) {
180
180
  let mdFile = argv._[1];
181
181
  await generateToc(mdFile);
182
- }).example(`${taskName("$0 toc")}`, `${textDescription("Generate updated Table of Contents on top of the fscripts.md file")}`).argv;
183
- if (argv._.length === 0) {
184
- (async function () {
185
- const choice = await optionList();
186
- if (choice) {
187
- await runCmd("yarn", ["fsr", choice]);
188
- } else {
189
- console.log(chalk.green.bold("See you soon!"));
190
- }
191
- })();
182
+ }).example(`${taskName("$0 toc")}`, `${textDescription("Generate updated Table of Contents on top of the fscripts.md file")}`).help();
183
+ const argv = yargsInstance.argv;
184
+ if (argv && argv._ && argv._.length === 0) {
185
+ const choice = await optionList();
186
+ if (choice) {
187
+ await runCmd("yarn", ["fsr", choice]);
188
+ } else {
189
+ console.log(chalk.green.bold("See you soon!"));
190
+ }
192
191
  }
193
192
  })();
@@ -1,81 +1,4 @@
1
- const encrypt = require("./encryption");
1
+ import encrypt from "./encryption.js";
2
2
  (async () => {
3
3
  await encrypt.init();
4
- })();
5
- const inquirer = require("inquirer");
6
- const path = require("path");
7
- const spawn = require("cross-spawn");
8
- const argv = require("yargs").argv;
9
- const clipboardy = require("clipboardy");
10
- const chalk = require("chalk");
11
- const cgf = require("changed-git-files");
12
- const projectDir = process.cwd();
13
- const packagePath = path.join(projectDir, "./");
14
- (async () => {
15
- if (argv.interactive) {
16
- inquirer.prompt({
17
- type: "list",
18
- name: "typeInc",
19
- message: "Type on increment",
20
- choices: ["patch", "minor", "major", "semver"],
21
- default: "patch"
22
- }).then(async ({
23
- typeInc
24
- }) => {
25
- // spawn.sync("yarn", ["start", ...process.argv.slice(2)], {
26
- // stdio: "inherit",
27
- // env: Object.assign({}, process.env, {
28
- // PATH: `${path.resolve("node_modules/.bin")}:${process.env.PATH}`
29
- // })
30
- // });
31
- let commitMsg = await bump(typeInc);
32
- await clipboardy.write(commitMsg);
33
- console.log(chalk.bold.green(`Commit message copied to clipboard:\n`) + chalk.bgWhite.black(`${commitMsg}`));
34
- const packageVersion = require(path.join(packagePath, "package.json")).version;
35
- await require("simple-git")().fetch().add("./packages/*").commit(commitMsg).addTag(packageVersion).pushTags().push(["-u", "--set-upstream"]);
36
- });
37
- }
38
- if (argv.package) {
39
- await runAsync(`yarn version --cwd=packages/${argv.package} --no-git-tag-version --patch --no-commit-hooks`);
40
- }
41
- })();
42
- async function message(title) {
43
- return new Promise(resolve => {
44
- inquirer.prompt({
45
- type: `text`,
46
- name: `commitMessage`,
47
- message: title
48
- }).then(({
49
- commitMessage
50
- }) => {
51
- resolve(commitMessage);
52
- });
53
- });
54
- }
55
- async function bump(type = "patch") {
56
- let defaultCommitMsg = ``;
57
- return new Promise(resolve => {
58
- cgf(async function (err, results) {
59
- let updatedPackages = [];
60
- results.forEach(path => {
61
- let segments = path.filename.split("/");
62
- if (segments[0] === "packages") {
63
- if (!updatedPackages.includes(segments[1])) {
64
- updatedPackages.push(segments[1]);
65
- }
66
- }
67
- });
68
- await runAsync(`yarn version --no-git-tag-version --${type} --no-commit-hooks`);
69
- for (let index = 0; index < updatedPackages.length; index++) {
70
- await runAsync(`yarn version --${type} --no-git-tag-version --no-commit-hooks --cwd=packages/${updatedPackages[index]}`);
71
- let packVer = require(path.join(packagePath, "./packages/" + updatedPackages[index] + "/package.json")).version;
72
- defaultCommitMsg += ` [${updatedPackages[index]}]:${packVer}\n`;
73
- let whatsNew = `${"Package: " + chalk.cyan(updatedPackages[index])} -- ${chalk.green("New version: " + packVer)}\n${chalk.bold.underline.cyan("What's changed?")}`;
74
- defaultCommitMsg += ` - ${await message(whatsNew)}\n\n`;
75
- }
76
- const packageVersion = require(path.join(packagePath, "package.json")).version;
77
- defaultCommitMsg = `Version:${packageVersion}\n- ${await message("Overall change summary:")}\n\n` + defaultCommitMsg;
78
- resolve(defaultCommitMsg);
79
- });
80
- });
81
- }
4
+ })();
@@ -12,7 +12,7 @@ const flattenObject = (obj, prefix = "") => Object.keys(obj).reduce((acc, k) =>
12
12
  if (typeof obj[k] === "object") Object.assign(acc, flattenObject(obj[k], pre + k));else acc[pre + k] = obj[k];
13
13
  return acc;
14
14
  }, {});
15
- import marked from "marked";
15
+ import { marked } from "marked";
16
16
  let parse = function (mdContent) {
17
17
  let js = marked.lexer(mdContent);
18
18
  js = js.filter(e => e.type !== "space");
@@ -12,16 +12,30 @@ const runParallel = async (tasks, FcScripts) => {
12
12
  script,
13
13
  lang
14
14
  } = taskData;
15
- let type = script.split(" ");
15
+ let pars = script.split(" ");
16
+ let type = pars[0];
17
+ let env = {};
18
+ if (pars[0].includes("=")) {
19
+ let envs = type.split("=");
20
+ env[envs[0]] = envs[1];
21
+ type = pars[1];
22
+ pars.shift();
23
+ pars.shift();
24
+ script = pars.join(" ");
25
+ } else {
26
+ pars.shift();
27
+ script = pars.join(" ");
28
+ }
16
29
  await runCLICommand({
17
30
  task: {
18
31
  name: taskName
19
32
  },
20
33
  script: {
21
34
  lang: lang,
22
- type: type.shift(),
35
+ env: env,
36
+ type: type,
23
37
  full: script,
24
- rest: script.split(" ").slice(1)
38
+ rest: script.split(" ")
25
39
  }
26
40
  });
27
41
  resolve();
@@ -15,7 +15,7 @@ import fs from "fs";
15
15
  let packagePath = path.resolve(process.cwd(), "package.json");
16
16
  const packageJsonAfter = JSON.parse(fs.readFileSync(packagePath));
17
17
  const config = new Conf({
18
- configName: packageJsonAfter.name
18
+ projectName: packageJsonAfter.name
19
19
  });
20
20
  const taskListAutoComplete = async tasks => {
21
21
  try {
@@ -1,9 +1,14 @@
1
1
  const scriptsDir = process.cwd();
2
2
  import path from "path";
3
+ import fs from "fs";
3
4
  const rootDir = path.join(scriptsDir, "../");
4
5
  const separator = " ~ ";
5
6
  import Conf from "conf";
6
- const config = new 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
+ });
7
12
  export default taskListAutoComplete;
8
13
  // (async () => {
9
14
  // await startScripts();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fscr",
3
- "version": "6.1.2",
3
+ "version": "6.2.0",
4
4
  "description": "Runs the fscripts.md file",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,8 +10,7 @@
10
10
  "build:index": "babel index.js --ignore 'node_modules' --out-file dist/index.js",
11
11
  "build:lib": "babel lib --ignore 'node_modules' --out-dir dist/lib --copy-files",
12
12
  "fsr": "node dist/index.js",
13
- "release": "run-s release:bump release:clean release:build release:publish",
14
- "old:release:build": "parcel build index.js --target node --no-cache --no-source-maps",
13
+ "release": "run-s release:bump release:clean release:build",
15
14
  "release:build": "run-p build:index build:lib",
16
15
  "release:bump": "yarn fsr bump",
17
16
  "release:clean": "rimraf dist",
@@ -24,8 +23,7 @@
24
23
  "start:watch": "nodemon --watch lib --watch index.js --ext js --exec babel-node index.js --ignore 'node_modules' -I",
25
24
  "docs": "npx cli-docs-generator --cli=./bin",
26
25
  "test1": "echo 'yolo' && sleep 2 && echo 1",
27
- "test2": "echo '2yolo' && sleep 2 && echo 22",
28
- "zb:run-s": "parcel build runall/run-s/index.js --target node --bundle-node-modules --no-cache --no-source-maps -o runs.js"
26
+ "test2": "echo '2yolo' && sleep 2 && echo 22"
29
27
  },
30
28
  "fscripts": {
31
29
  "encryptedFiles": [
@@ -55,106 +53,74 @@
55
53
  "dependencies": {
56
54
  "@babel/runtime": "^7.9.2",
57
55
  "better-md-2-json": "^1.0.6",
58
- "boxen": "^4.2.0",
59
- "chalk": "^3.0.0",
60
- "conf": "^6.2.1",
56
+ "boxen": "^8.0.1",
57
+ "chalk": "^4.1.2",
58
+ "conf": "^15.0.2",
61
59
  "cross-spawn": "^7.0.1",
62
- "detect-indent": "^6.0.0",
60
+ "detect-indent": "^7.0.2",
63
61
  "enquirer": "^2.3.4",
64
- "fs-extra": "^9.0.0",
62
+ "fs-extra": "^11.3.2",
65
63
  "git-changed-files": "^1.0.0",
66
64
  "git-release-notes": "^5.0.0",
67
65
  "git-state": "^4.1.0",
68
66
  "github-basic": "^6.0.0",
69
- "inquirer": "^7.1.0",
70
- "is-builtin-module": "^3.0.0",
71
- "joycon": "^2.2.5",
67
+ "inquirer": "^12.9.6",
68
+ "is-builtin-module": "^5.0.0",
69
+ "joycon": "^3.1.1",
72
70
  "markdown-toc": "^1.2.0",
73
- "marked": "^0.8.2",
74
- "md-2-json": "^1.0.6",
71
+ "marked": "^16.3.0",
72
+ "md-2-json": "^2.0.0",
75
73
  "micromatch": "^4.0.2",
76
74
  "moment-mini": "^2.24.0",
77
- "open": "^7.0.3",
78
- "pretty-ms": "^6.0.1",
75
+ "open": "^10.2.0",
76
+ "pretty-ms": "^9.3.0",
79
77
  "require-from-string": "^2.0.2",
80
78
  "server-destroy": "^1.0.1",
81
- "set-value": "^3.0.1",
79
+ "set-value": "^4.1.0",
82
80
  "shell-quote": "^1.7.2",
83
- "simple-git": "^1.132.0",
84
- "sort-object-keys": "^1.1.3",
81
+ "simple-git": "^3.28.0",
82
+ "sort-object-keys": "^2.0.0",
85
83
  "staged-git-files": "^1.2.0"
86
84
  },
87
85
  "devDependencies": {
88
86
  "@babel/cli": "^7.8.4",
89
87
  "@babel/core": "^7.9.0",
90
88
  "@babel/node": "^7.8.7",
91
- "@babel/parser": "^7.9.3",
92
- "@babel/plugin-proposal-class-properties": "^7.8.3",
93
89
  "@babel/plugin-proposal-decorators": "^7.8.3",
94
- "@babel/plugin-proposal-do-expressions": "^7.8.3",
95
90
  "@babel/plugin-proposal-export-default-from": "^7.8.3",
96
- "@babel/plugin-proposal-export-namespace-from": "^7.8.3",
97
- "@babel/plugin-proposal-function-sent": "^7.8.3",
98
- "@babel/plugin-proposal-json-strings": "^7.8.3",
99
- "@babel/plugin-proposal-numeric-separator": "^7.8.3",
100
- "@babel/plugin-proposal-object-rest-spread": "^7.9.0",
101
- "@babel/plugin-proposal-optional-chaining": "^7.9.0",
102
- "@babel/plugin-proposal-private-methods": "^7.10.4",
103
- "@babel/plugin-proposal-throw-expressions": "^7.8.3",
104
91
  "@babel/plugin-syntax-class-properties": "^7.8.3",
105
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
106
- "@babel/plugin-syntax-export-namespace-from": "^7.8.3",
107
- "@babel/plugin-syntax-import-meta": "^7.8.3",
108
- "@babel/plugin-transform-react-constant-elements": "^7.9.0",
109
- "@babel/plugin-transform-react-inline-elements": "^7.9.0",
110
- "@babel/plugin-transform-react-jsx-source": "^7.9.0",
111
- "@babel/plugin-transform-regenerator": "^7.8.7",
112
92
  "@babel/plugin-transform-runtime": "^7.9.0",
113
- "@babel/polyfill": "^7.8.7",
114
93
  "@babel/preset-env": "^7.9.0",
115
94
  "@babel/preset-react": "^7.9.1",
116
- "@babel/preset-typescript": "^7.9.0",
117
- "@babel/register": "^7.9.0",
118
- "babel-plugin-add-react-displayname": "^0.0.5",
119
- "babel-plugin-dynamic-import-node": "^2.3.0",
120
- "babel-plugin-module-resolver": "^4.0.0",
121
- "babel-plugin-syntax-dynamic-import": "^6.18.0",
122
- "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
123
- "babel-plugin-transform-remove-console": "^6.9.4",
124
- "fancy-log": "^1.3.3",
125
- "fkill-cli": "^6.0.1",
126
- "google-auth-library": "^6.0.0",
127
- "ink": "^2.7.1",
128
- "ink-box": "^1.0.0",
129
- "ink-select-input": "^3.1.2",
130
- "ink-tab": "^3.0.0",
131
- "ink-table": "^2.0.1",
132
- "inquirer-fuzzy-path": "^2.2.0",
95
+ "babel-plugin-module-resolver": "^5.0.2",
96
+ "fancy-log": "^2.0.0",
97
+ "fkill-cli": "^8.0.0",
98
+ "ink": "^6.3.1",
99
+ "ink-box": "^2.0.0",
100
+ "ink-select-input": "^6.2.0",
101
+ "ink-tab": "^5.2.0",
102
+ "ink-table": "^3.1.0",
133
103
  "json-colorz": "^0.2.7",
134
104
  "lodash": "^4.17.15",
135
- "markdown-it": "^10.0.0",
105
+ "markdown-it": "^14.1.0",
136
106
  "mixin-deep": "^2.0.1",
137
107
  "node-run-cmd": "^1.0.1",
138
- "nodemon": "^2.0.2",
139
- "np": "^6.2.0",
108
+ "nodemon": "^3.1.10",
140
109
  "npm-run-all": "^4.1.5",
141
- "parcel": "^1.12.4",
142
- "parcel-bundler": "^1.12.5",
143
- "parcel-plugin-copy": "^1.0.2",
144
- "prepend-file": "^1.3.1",
145
- "pretty-console-colors": "^1.1.1",
110
+ "prepend-file": "^2.0.1",
111
+ "pretty-console-colors": "^2.0.0",
146
112
  "pull-request": "^3.0.0",
147
- "react": "^16.13.1",
113
+ "react": "^19.2.0",
148
114
  "remarkable": "^2.0.0",
149
115
  "rexrex": "^1.3.0",
150
- "rimraf": "^3.0.2",
151
- "term-size": "^2.2.0",
116
+ "rimraf": "^6.0.1",
117
+ "term-size": "^4.0.0",
152
118
  "terminal-tree": "^0.0.3",
153
119
  "underscore.string": "^3.3.5",
154
- "yargs": "^14.2.3"
120
+ "yargs": "^18.0.0"
155
121
  },
156
122
  "peerDependencies": {
157
- "chalk": "^2.4.2"
123
+ "chalk": "^4.1.2"
158
124
  },
159
125
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
160
126
  }
@@ -1,26 +0,0 @@
1
- import inquirer from "inquirer";
2
- import inquirerFuzzyPath from "inquirer-fuzzy-path";
3
- inquirer.registerPrompt("fuzzypath", inquirerFuzzyPath);
4
- (async () => {
5
- return inquirer.prompt([{
6
- type: "fuzzypath",
7
- name: "path",
8
- excludePath: nodePath => nodePath.startsWith("node_modules") || nodePath.startsWith(".git") || nodePath.startsWith(".idea"),
9
- // excludePath :: (String) -> Bool
10
- // excludePath to exclude some paths from the file-system scan
11
- // itemType: "any",
12
- itemType: "directory" | "file",
13
- //'any' | | 'file'
14
- // specify the type of nodes to display
15
- // default value: 'any'
16
- // example: itemType: 'file' - hides directories from the item list
17
- // rootPath: "app",
18
- // rootPath :: String
19
- // Root search directory
20
- message: "Select a target directory for your component:",
21
- // default: "./",
22
- suggestOnly: false
23
- // suggestOnly :: Bool
24
- // Restrict prompt answer to available choices or use them as suggestions
25
- }]);
26
- })();