fscr 6.2.0 → 6.2.2
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/lib/generateToc.js
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
import
|
|
3
|
+
import fs from "fs";
|
|
4
4
|
import tocPkg from "markdown-toc";
|
|
5
5
|
const toc = tocPkg.default || tocPkg;
|
|
6
|
-
const joyRead = new JoyCon({
|
|
7
|
-
// Stop reading at parent dir
|
|
8
|
-
// i.e. Only read file from process.cwd()
|
|
9
|
-
stopDir: path.dirname(process.cwd())
|
|
10
|
-
});
|
|
11
6
|
import { writeFile } from "./utils/helpers.js";
|
|
12
7
|
// const projectDir = process.cwd();
|
|
13
8
|
|
|
14
9
|
const generateToc = async () => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
data
|
|
18
|
-
} = joyRead.loadSync(["fscripts.md"]);
|
|
19
|
-
if (!filepath) {
|
|
10
|
+
const filepath = path.resolve(process.cwd(), "fscripts.md");
|
|
11
|
+
if (!fs.existsSync(filepath)) {
|
|
20
12
|
console.warn(`${chalk.bold.red("You're missing the fscripts.md file!")}
|
|
21
13
|
${chalk.green("Please run 'fsr generate' to get started!")}`);
|
|
22
14
|
process.exit(0);
|
|
23
15
|
return null;
|
|
24
|
-
}
|
|
16
|
+
}
|
|
17
|
+
const data = fs.readFileSync(filepath, "utf-8");
|
|
18
|
+
if (data) {
|
|
25
19
|
console.warn(`${chalk.bold.green("Located fscripts.md file!")}`);
|
|
26
20
|
let newFile = ``;
|
|
27
21
|
let tocSplit = data.split("<!-- end toc -->");
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
import
|
|
3
|
+
import fs from "fs";
|
|
4
4
|
import tocPkg from "markdown-toc";
|
|
5
5
|
const toc = tocPkg.default || tocPkg;
|
|
6
|
-
const joyRead = new JoyCon({
|
|
7
|
-
// Stop reading at parent dir
|
|
8
|
-
// i.e. Only read file from process.cwd()
|
|
9
|
-
stopDir: path.dirname(process.cwd())
|
|
10
|
-
});
|
|
11
6
|
import { writeFile } from "../utils/helpers.js";
|
|
12
7
|
// const projectDir = process.cwd();
|
|
13
8
|
|
|
14
9
|
const generateToc = async (fileToLoad = "fscripts.md") => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
data
|
|
18
|
-
} = joyRead.loadSync([fileToLoad]);
|
|
19
|
-
if (!filepath) {
|
|
10
|
+
const filepath = path.resolve(process.cwd(), fileToLoad);
|
|
11
|
+
if (!fs.existsSync(filepath)) {
|
|
20
12
|
console.warn(`${chalk.bold.red("You're missing the fscripts.md file!")}
|
|
21
13
|
${chalk.green("Please run 'fsr generate' to get started!")}`);
|
|
22
14
|
process.exit(0);
|
|
23
15
|
return null;
|
|
24
|
-
}
|
|
16
|
+
}
|
|
17
|
+
const data = fs.readFileSync(filepath, "utf-8");
|
|
18
|
+
if (data) {
|
|
25
19
|
console.warn(`${chalk.bold.green("Located fscripts.md file!")}`);
|
|
26
20
|
let newFile = ``;
|
|
27
21
|
let tocSplit = data.split("<!-- end toc -->");
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import JoyCon from "joycon";
|
|
2
1
|
import path from "path";
|
|
3
2
|
import chalk from "chalk";
|
|
4
|
-
|
|
5
|
-
// Stop reading at parent dir
|
|
6
|
-
// i.e. Only read file from process.cwd()
|
|
7
|
-
stopDir: path.dirname(process.cwd())
|
|
8
|
-
});
|
|
3
|
+
import fs from "fs";
|
|
9
4
|
const flattenObject = (obj, prefix = "") => Object.keys(obj).reduce((acc, k) => {
|
|
10
5
|
const pre = prefix.length ? prefix + "." : "";
|
|
11
6
|
if (typeof obj[k] === "object") Object.assign(acc, flattenObject(obj[k], pre + k));else acc[pre + k] = obj[k];
|
|
@@ -70,11 +65,8 @@ let parse = function (mdContent) {
|
|
|
70
65
|
};
|
|
71
66
|
};
|
|
72
67
|
const parseScriptFile = async () => {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
data
|
|
76
|
-
} = joyRead.loadSync(["fscripts.md"]);
|
|
77
|
-
if (!filepath) {
|
|
68
|
+
const data = await fs.readFileSync(path.resolve(process.cwd(), "fscripts.md"), "utf-8");
|
|
69
|
+
if (!data) {
|
|
78
70
|
// console.warn(
|
|
79
71
|
// `${chalk.bold.red("You're missing the fscripts.md file!")}
|
|
80
72
|
// ${chalk.green("Please run 'fsr generate' to get started!")}`
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import JoyCon from "joycon";
|
|
2
1
|
import path from "path";
|
|
3
2
|
import chalk from "chalk";
|
|
4
3
|
import fs from "fs";
|
|
5
|
-
const joyRead = new JoyCon({
|
|
6
|
-
// Stop reading at parent dir
|
|
7
|
-
// i.e. Only read file from process.cwd()
|
|
8
|
-
stopDir: path.dirname(process.cwd())
|
|
9
|
-
});
|
|
10
4
|
const flattenObject = (obj, prefix = "") => Object.keys(obj).reduce((acc, k) => {
|
|
11
5
|
const pre = prefix.length ? prefix + "." : "";
|
|
12
6
|
if (typeof obj[k] === "object") Object.assign(acc, flattenObject(obj[k], pre + k));else acc[pre + k] = obj[k];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fscr",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.2",
|
|
4
4
|
"description": "Runs the fscripts.md file",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -64,9 +64,12 @@
|
|
|
64
64
|
"git-release-notes": "^5.0.0",
|
|
65
65
|
"git-state": "^4.1.0",
|
|
66
66
|
"github-basic": "^6.0.0",
|
|
67
|
+
"ink": "^6.3.1",
|
|
68
|
+
"ink-box": "^2.0.0",
|
|
69
|
+
"ink-select-input": "^6.2.0",
|
|
67
70
|
"inquirer": "^12.9.6",
|
|
68
71
|
"is-builtin-module": "^5.0.0",
|
|
69
|
-
"
|
|
72
|
+
"json-colorz": "^0.2.7",
|
|
70
73
|
"markdown-toc": "^1.2.0",
|
|
71
74
|
"marked": "^16.3.0",
|
|
72
75
|
"md-2-json": "^2.0.0",
|
|
@@ -74,13 +77,15 @@
|
|
|
74
77
|
"moment-mini": "^2.24.0",
|
|
75
78
|
"open": "^10.2.0",
|
|
76
79
|
"pretty-ms": "^9.3.0",
|
|
80
|
+
"react": "^19.2.0",
|
|
77
81
|
"require-from-string": "^2.0.2",
|
|
78
82
|
"server-destroy": "^1.0.1",
|
|
79
83
|
"set-value": "^4.1.0",
|
|
80
84
|
"shell-quote": "^1.7.2",
|
|
81
85
|
"simple-git": "^3.28.0",
|
|
82
86
|
"sort-object-keys": "^2.0.0",
|
|
83
|
-
"staged-git-files": "^1.2.0"
|
|
87
|
+
"staged-git-files": "^1.2.0",
|
|
88
|
+
"term-size": "^4.0.0"
|
|
84
89
|
},
|
|
85
90
|
"devDependencies": {
|
|
86
91
|
"@babel/cli": "^7.8.4",
|
|
@@ -95,12 +100,8 @@
|
|
|
95
100
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
96
101
|
"fancy-log": "^2.0.0",
|
|
97
102
|
"fkill-cli": "^8.0.0",
|
|
98
|
-
"ink": "^6.3.1",
|
|
99
|
-
"ink-box": "^2.0.0",
|
|
100
|
-
"ink-select-input": "^6.2.0",
|
|
101
103
|
"ink-tab": "^5.2.0",
|
|
102
104
|
"ink-table": "^3.1.0",
|
|
103
|
-
"json-colorz": "^0.2.7",
|
|
104
105
|
"lodash": "^4.17.15",
|
|
105
106
|
"markdown-it": "^14.1.0",
|
|
106
107
|
"mixin-deep": "^2.0.1",
|
|
@@ -110,11 +111,9 @@
|
|
|
110
111
|
"prepend-file": "^2.0.1",
|
|
111
112
|
"pretty-console-colors": "^2.0.0",
|
|
112
113
|
"pull-request": "^3.0.0",
|
|
113
|
-
"react": "^19.2.0",
|
|
114
114
|
"remarkable": "^2.0.0",
|
|
115
115
|
"rexrex": "^1.3.0",
|
|
116
116
|
"rimraf": "^6.0.1",
|
|
117
|
-
"term-size": "^4.0.0",
|
|
118
117
|
"terminal-tree": "^0.0.3",
|
|
119
118
|
"underscore.string": "^3.3.5",
|
|
120
119
|
"yargs": "^18.0.0"
|