@vueless/storybook 0.0.72 → 0.0.73
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/index.js +9 -29
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
|
|
4
|
-
import fs, { promises } from "fs";
|
|
4
|
+
import fs, { promises } from "node:fs";
|
|
5
|
+
import { styleText } from "node:util";
|
|
5
6
|
import { cwd } from "node:process";
|
|
6
|
-
import path from "path";
|
|
7
|
+
import path from "node:path";
|
|
7
8
|
|
|
8
9
|
// Get the command-line arguments
|
|
9
10
|
const args = process.argv.slice(2);
|
|
@@ -28,10 +29,12 @@ function copyStorybookPreset(source, target, { consoles = true } = {}) {
|
|
|
28
29
|
|
|
29
30
|
fs.renameSync(target, renamedTarget);
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
const warnMessage = styleText(
|
|
32
33
|
"yellow",
|
|
33
34
|
`Current Storybook preset backed into : '${path.basename(renamedTarget)}' folder. Don't forget to remove it before commit.`,
|
|
34
35
|
);
|
|
36
|
+
|
|
37
|
+
console.log(warnMessage);
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
fs.mkdirSync(target, { recursive: true });
|
|
@@ -49,10 +52,12 @@ function copyStorybookPreset(source, target, { consoles = true } = {}) {
|
|
|
49
52
|
});
|
|
50
53
|
|
|
51
54
|
if (consoles) {
|
|
52
|
-
|
|
55
|
+
const successMessage = styleText(
|
|
53
56
|
"green",
|
|
54
57
|
`Storybook preset successfully saved into '${path.basename(target)}' folder.`,
|
|
55
58
|
);
|
|
59
|
+
|
|
60
|
+
console.log(successMessage);
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
|
|
@@ -107,28 +112,3 @@ function parseArgs(args) {
|
|
|
107
112
|
|
|
108
113
|
return result;
|
|
109
114
|
}
|
|
110
|
-
|
|
111
|
-
function coloredConsole(color, message) {
|
|
112
|
-
let coloredMessage = message;
|
|
113
|
-
|
|
114
|
-
if (color === "green") {
|
|
115
|
-
coloredMessage = `\x1b[32m${message}\x1b[0m`;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (color === "yellow") {
|
|
119
|
-
coloredMessage = `\x1b[33m${message}\x1b[0m`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (color === "red") {
|
|
123
|
-
coloredMessage = `\x1b[31m${message}\x1b[0m`;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/* Remove spaces and tabs around each line. */
|
|
127
|
-
coloredMessage
|
|
128
|
-
.trim()
|
|
129
|
-
.split("\n")
|
|
130
|
-
.map((line) => line.trim())
|
|
131
|
-
.join("\n");
|
|
132
|
-
|
|
133
|
-
return console.log(coloredMessage);
|
|
134
|
-
}
|