@vueless/storybook 0.0.71 → 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.
Files changed (2) hide show
  1. package/index.js +21 -5
  2. 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);
@@ -21,13 +22,19 @@ if (parsedArgs.pnpm) {
21
22
  await createNpmrc();
22
23
  }
23
24
 
24
- function copyStorybookPreset(source, target) {
25
+ function copyStorybookPreset(source, target, { consoles = true } = {}) {
25
26
  if (fs.existsSync(target)) {
26
27
  const timestamp = new Date().valueOf();
27
28
  const renamedTarget = `${target}-backup-${timestamp}`;
28
29
 
29
30
  fs.renameSync(target, renamedTarget);
30
- console.log(`Renamed existing ${path.basename(target)} to ${path.basename(renamedTarget)}`);
31
+
32
+ const warnMessage = styleText(
33
+ "yellow",
34
+ `Current Storybook preset backed into : '${path.basename(renamedTarget)}' folder. Don't forget to remove it before commit.`,
35
+ );
36
+
37
+ console.log(warnMessage);
31
38
  }
32
39
 
33
40
  fs.mkdirSync(target, { recursive: true });
@@ -40,9 +47,18 @@ function copyStorybookPreset(source, target) {
40
47
  const stat = fs.lstatSync(srcFile);
41
48
 
42
49
  stat.isDirectory()
43
- ? copyStorybookPreset(srcFile, destFile)
50
+ ? copyStorybookPreset(srcFile, destFile, { consoles: false })
44
51
  : fs.copyFileSync(srcFile, destFile);
45
52
  });
53
+
54
+ if (consoles) {
55
+ const successMessage = styleText(
56
+ "green",
57
+ `Storybook preset successfully saved into '${path.basename(target)}' folder.`,
58
+ );
59
+
60
+ console.log(successMessage);
61
+ }
46
62
  }
47
63
 
48
64
  async function addStorybookCommands() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "0.0.71",
3
+ "version": "0.0.73",
4
4
  "description": "Simplifies Storybook configuration for Vueless UI library.",
5
5
  "homepage": "https://vueless.com",
6
6
  "author": "Johnny Grid",