@vueless/storybook 1.2.7-beta.1 → 1.2.7-beta.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.
@@ -3,8 +3,12 @@ import { defineConfigWithVueless } from "@vueless/storybook";
3
3
 
4
4
  export default defineConfigWithVueless({
5
5
  stories: [
6
- /* Define a path to your own component stories. */
7
- // "../src/**/stories.{js,jsx,ts,tsx}",
6
+ /* Path to the project component stories. */
7
+ // "../src/**/stories.js",
8
8
  // "../src/**/docs.mdx",
9
+ //
10
+ /* Path to the custom vueless component stories. */
11
+ // "../.vueless/components/**/stories.js",
12
+ // "../.vueless/components/**/docs.mdx",
9
13
  ],
10
14
  });
@@ -3,8 +3,12 @@ import { defineConfigWithVueless } from "@vueless/storybook";
3
3
 
4
4
  export default defineConfigWithVueless({
5
5
  stories: [
6
- /* Define a path to your own component stories. */
7
- // "../src/**/stories.{js,jsx,ts,tsx}",
6
+ /* Path to the project component stories. */
7
+ // "../src/**/stories.ts",
8
8
  // "../src/**/docs.mdx",
9
+ //
10
+ /* Path to the custom vueless component stories. */
11
+ // "../.vueless/components/**/stories.ts",
12
+ // "../.vueless/components/**/docs.mdx",
9
13
  ],
10
14
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "1.2.7-beta.1",
3
+ "version": "1.2.7-beta.2",
4
4
  "description": "Simplifies Storybook configuration for Vueless UI library.",
5
5
  "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
6
6
  "homepage": "https://vueless.com",
@@ -54,7 +54,7 @@
54
54
  "vue": "latest",
55
55
  "vue-router": "latest",
56
56
  "vue-tsc": "^3.0.6",
57
- "vueless": "^1.2.2"
57
+ "vueless": "^1.2.5"
58
58
  },
59
59
  "type": "module",
60
60
  "main": "index.js",
@@ -6,6 +6,7 @@ import chokidar from "chokidar";
6
6
  import { globbySync } from "globby";
7
7
  import { parse } from "vue-docgen-api";
8
8
  import _ from "lodash-es";
9
+ import { VUELESS_USER_COMPONENTS_DIR, VUELESS_LIBRARY } from "vueless/constants.js";
9
10
 
10
11
  export default async function build(config, vuelessConfig, srcDir) {
11
12
  config.outFile = path.resolve(config.cwd, config.outFile);
@@ -138,7 +139,11 @@ function getType(prop) {
138
139
  async function extractInformation(absolutePath, config, vuelessConfig) {
139
140
  const doc = await parse(config.cwd + "/" + absolutePath, {
140
141
  /* Allow to parse vueless components from node_modules. */
141
- validExtends: (filePath) => filePath.replace(/\\/g, "/").includes(config.srcDir),
142
+ validExtends: (filePath) => {
143
+ const path = filePath.replace(/\\/g, "/");
144
+
145
+ return path.includes(config.srcDir) || path.includes(VUELESS_USER_COMPONENTS_DIR);
146
+ },
142
147
  ...config.apiOptions,
143
148
  });
144
149
  const name = doc.name || doc.displayName;
@@ -175,7 +180,7 @@ async function extractInformation(absolutePath, config, vuelessConfig) {
175
180
 
176
181
  const componentPath = ensureRelative(path.relative(config.cwd, absolutePath));
177
182
  // Prevent "Chose declaration" duplication issue in Intellij
178
- const source = !componentPath.includes("vueless")
183
+ const source = !componentPath.includes(VUELESS_LIBRARY)
179
184
  ? { source: { module: componentPath, symbol: doc.exportName } }
180
185
  : {};
181
186
 
@@ -4,8 +4,14 @@ import { cwd } from "node:process";
4
4
  import { readFile } from "fs/promises";
5
5
  import { pathToFileURL } from "node:url";
6
6
  import esbuild from "esbuild";
7
+ import {
8
+ VUELESS_CACHE_DIR,
9
+ VUELESS_LOCAL_DIR,
10
+ VUELESS_PACKAGE_DIR,
11
+ SRC_USER_COMPONENTS_DIR,
12
+ VUELESS_USER_COMPONENTS_DIR,
13
+ } from "vueless/constants.js";
7
14
 
8
- const CACHE_PATH = "./node_modules/.cache/vueless";
9
15
  const WEB_TYPES_CONFIG_FILE_NAME = "web-types.config";
10
16
 
11
17
  export async function extractConfig() {
@@ -15,13 +21,17 @@ export async function extractConfig() {
15
21
  const config = await getConfig();
16
22
 
17
23
  const components = config?.isVuelessEnv
18
- ? ["src/**/*.vue"]
19
- : ["node_modules/vueless/**/*.vue", "src/components/**/*.vue", ".vueless/components/**/*.vue"];
24
+ ? [`${VUELESS_LOCAL_DIR}/**/*.vue`]
25
+ : [
26
+ `${VUELESS_PACKAGE_DIR}/**/*.vue`,
27
+ `${SRC_USER_COMPONENTS_DIR}/**/*.vue`,
28
+ `${VUELESS_USER_COMPONENTS_DIR}/**/*.vue`,
29
+ ];
20
30
 
21
31
  return {
22
32
  cwd: cwd(),
23
33
  components,
24
- outFile: `${CACHE_PATH}/web-types.json`,
34
+ outFile: `./${VUELESS_CACHE_DIR}/web-types.json`,
25
35
  packageName: packageJson["name"],
26
36
  packageVersion: packageJson["version"],
27
37
  descriptionMarkup: "markdown",
@@ -33,7 +43,7 @@ export async function extractConfig() {
33
43
  async function getConfig() {
34
44
  const configPathJs = path.resolve(cwd(), `${WEB_TYPES_CONFIG_FILE_NAME}.js`);
35
45
  const configPathTs = path.resolve(cwd(), `${WEB_TYPES_CONFIG_FILE_NAME}.ts`);
36
- const configOutPath = path.join(cwd(), `${CACHE_PATH}/${WEB_TYPES_CONFIG_FILE_NAME}.mjs`);
46
+ const configOutPath = path.join(cwd(), `${VUELESS_CACHE_DIR}/${WEB_TYPES_CONFIG_FILE_NAME}.mjs`);
37
47
 
38
48
  let config = {};
39
49