@vueless/storybook 0.0.13 → 0.0.15
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/.storybook/preview.js +4 -17
- package/index.js +31 -0
- package/package.json +4 -1
package/.storybook/preview.js
CHANGED
|
@@ -1,33 +1,20 @@
|
|
|
1
1
|
import { setup } from "@storybook/vue3";
|
|
2
|
+
|
|
2
3
|
import { backgrounds, docs, layout } from "./configs/main.config";
|
|
3
4
|
import { vue3SourceDecorator } from "./decorators/vue3SourceDecorator";
|
|
4
5
|
|
|
5
6
|
// Vue plugins
|
|
6
|
-
import { createStore } from "vuex";
|
|
7
7
|
import { createVueless } from "vueless";
|
|
8
|
-
import NotifyServiceDefault from "vueless/ui.notify/services";
|
|
9
8
|
|
|
10
9
|
// Tailwind styles
|
|
11
10
|
import "./index.pcss";
|
|
12
11
|
|
|
13
|
-
// Common stores
|
|
14
|
-
import loader from "vueless/ui.loader-rendering/store";
|
|
15
|
-
import loaderTop from "vueless/ui.other-loader-top/store";
|
|
16
|
-
import breakpoint from "vueless/ui.viewport/store";
|
|
17
|
-
|
|
18
|
-
// Create store instance
|
|
19
|
-
const store = createStore({
|
|
20
|
-
modules: { loader, loaderTop, breakpoint },
|
|
21
|
-
});
|
|
22
|
-
|
|
23
12
|
// Create vueless instance
|
|
24
13
|
const vueless = createVueless();
|
|
25
14
|
|
|
26
15
|
// Create storybook app instance
|
|
27
16
|
const storybookApp = (app) => {
|
|
28
|
-
app.use(store);
|
|
29
17
|
app.use(vueless);
|
|
30
|
-
app.use(new NotifyServiceDefault().notifyInstance);
|
|
31
18
|
};
|
|
32
19
|
|
|
33
20
|
// Setup storybook
|
|
@@ -42,9 +29,9 @@ export default {
|
|
|
42
29
|
backgrounds,
|
|
43
30
|
options: {
|
|
44
31
|
storySort: (a, b) =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
a.id === b.id
|
|
33
|
+
? 0
|
|
34
|
+
: a.name === "Docs" && a.id.localeCompare(b.id, undefined, { numeric: true }),
|
|
48
35
|
},
|
|
49
36
|
},
|
|
50
37
|
};
|
package/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
function copyFolderSync(source, target) {
|
|
5
|
+
if (fs.existsSync(target)) {
|
|
6
|
+
const timestamp = new Date().valueOf();
|
|
7
|
+
const renamedTarget = `${target}-${timestamp}`;
|
|
8
|
+
|
|
9
|
+
fs.renameSync(target, renamedTarget);
|
|
10
|
+
console.log(`Renamed existing ${path.basename(target)} to ${path.basename(renamedTarget)}`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
fs.mkdirSync(target, { recursive: true });
|
|
14
|
+
|
|
15
|
+
const files = fs.readdirSync(source);
|
|
16
|
+
|
|
17
|
+
files.forEach((file) => {
|
|
18
|
+
const srcFile = path.join(source, file);
|
|
19
|
+
const destFile = path.join(target, file);
|
|
20
|
+
const stat = fs.lstatSync(srcFile);
|
|
21
|
+
|
|
22
|
+
stat.isDirectory() ? copyFolderSync(srcFile, destFile) : fs.copyFileSync(srcFile, destFile);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
27
|
+
|
|
28
|
+
const sourceFolder = path.join(__dirname, ".storybook");
|
|
29
|
+
const targetFolder = path.join(__dirname, "..", "..", "..", ".storybook");
|
|
30
|
+
|
|
31
|
+
copyFolderSync(sourceFolder, targetFolder);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueless/storybook",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
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/",
|