@vueless/storybook 0.0.14 → 0.0.16

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 +33 -0
  2. package/package.json +4 -1
package/index.js ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "fs";
4
+ import path from "path";
5
+
6
+ function copyFolderSync(source, target) {
7
+ if (fs.existsSync(target)) {
8
+ const timestamp = new Date().valueOf();
9
+ const renamedTarget = `${target}-${timestamp}`;
10
+
11
+ fs.renameSync(target, renamedTarget);
12
+ console.log(`Renamed existing ${path.basename(target)} to ${path.basename(renamedTarget)}`);
13
+ }
14
+
15
+ fs.mkdirSync(target, { recursive: true });
16
+
17
+ const files = fs.readdirSync(source);
18
+
19
+ files.forEach((file) => {
20
+ const srcFile = path.join(source, file);
21
+ const destFile = path.join(target, file);
22
+ const stat = fs.lstatSync(srcFile);
23
+
24
+ stat.isDirectory() ? copyFolderSync(srcFile, destFile) : fs.copyFileSync(srcFile, destFile);
25
+ });
26
+ }
27
+
28
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
29
+
30
+ const sourceFolder = path.join(__dirname, ".storybook");
31
+ const targetFolder = path.join(__dirname, "..", "..", "..", ".storybook");
32
+
33
+ copyFolderSync(sourceFolder, targetFolder);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Simplifies Storybook configuration for Vueless UI library.",
5
5
  "homepage": "https://vueless.com",
6
6
  "author": "Johnny Grid",
@@ -12,6 +12,9 @@
12
12
  "access": "public",
13
13
  "registry": "https://registry.npmjs.org/"
14
14
  },
15
+ "bin": {
16
+ "copy": "./index.js"
17
+ },
15
18
  "scripts": {
16
19
  "lint": "eslint --ext .vue,.js,.ts --no-fix --ignore-path .eslintignore src/",
17
20
  "lint:fix": "eslint --ext .vue,.js,.ts --fix --ignore-path .eslintignore src/",