vueless 1.1.1-beta.49 → 1.1.1-beta.50
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/bin/commands/init.js +8 -4
- package/constants.d.ts +1 -0
- package/constants.js +1 -0
- package/package.json +1 -1
- package/plugin-vite.js +3 -4
- package/utils/node/helper.js +13 -9
- package/utils/node/storybook.js +4 -0
package/bin/commands/init.js
CHANGED
|
@@ -12,6 +12,7 @@ import { DEFAULT_VUELESS_CONFIG_CONTENT } from "../constants.js";
|
|
|
12
12
|
import {
|
|
13
13
|
JAVASCRIPT_EXT,
|
|
14
14
|
TYPESCRIPT_EXT,
|
|
15
|
+
VUELESS_CONFIG_DIR,
|
|
15
16
|
CONFIG_INDEX_FILE_NAME,
|
|
16
17
|
VUELESS_CONFIG_FILE_NAME,
|
|
17
18
|
} from "../../constants.js";
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
const vuelessInitOptions = ["--ts", "--js"];
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
* Initializes Vueless in the project by creating a default config file and
|
|
23
|
+
* Initializes Vueless in the project by creating a default config file and vueless config directory.
|
|
23
24
|
* @param {string[]} options - The function options.
|
|
24
25
|
* @param {boolean} options.includes("--ts") - If true, creates a TypeScript config file.
|
|
25
26
|
* @param {boolean} options.includes("--js") - If true, creates a JavaScript config file.
|
|
@@ -68,14 +69,17 @@ export async function vuelessInit(options) {
|
|
|
68
69
|
),
|
|
69
70
|
);
|
|
70
71
|
|
|
71
|
-
/* Create
|
|
72
|
-
const vuelessDir = path.join(cwd(),
|
|
72
|
+
/* Create a vueless config directory and index file. */
|
|
73
|
+
const vuelessDir = path.join(cwd(), VUELESS_CONFIG_DIR);
|
|
73
74
|
const destPath = path.join(vuelessDir, `${CONFIG_INDEX_FILE_NAME}${fileExt}`);
|
|
74
75
|
|
|
75
76
|
if (!existsSync(vuelessDir)) {
|
|
76
77
|
mkdirSync(vuelessDir);
|
|
77
78
|
console.log(
|
|
78
|
-
styleText(
|
|
79
|
+
styleText(
|
|
80
|
+
"green",
|
|
81
|
+
`The '${VUELESS_CONFIG_DIR}' directory was created in the project root directory.`,
|
|
82
|
+
),
|
|
79
83
|
);
|
|
80
84
|
}
|
|
81
85
|
|
package/constants.d.ts
CHANGED
|
@@ -319,6 +319,7 @@ export const VUELESS_CONFIGS_CACHED_DIR: "node_modules/.cache/vueless/configs";
|
|
|
319
319
|
export const VUELESS_MERGED_CONFIGS_CACHED_DIR: "node_modules/.cache/vueless/mergedConfigs";
|
|
320
320
|
export const VUELESS_CONFIG_FILE_NAME: "vueless.config";
|
|
321
321
|
export const CONFIG_INDEX_FILE_NAME: "index";
|
|
322
|
+
export const VUELESS_CONFIG_DIR: ".vueless";
|
|
322
323
|
export const DEFAULT_EXIT_CODE: 0;
|
|
323
324
|
export const FAILURE_CODE: 1;
|
|
324
325
|
export const PX_IN_REM: 16;
|
package/constants.js
CHANGED
|
@@ -403,6 +403,7 @@ export const VUELESS_CONFIGS_CACHED_DIR = `${VUELESS_CACHE_DIR}/configs`;
|
|
|
403
403
|
export const VUELESS_MERGED_CONFIGS_CACHED_DIR = `${VUELESS_CACHE_DIR}/mergedConfigs`;
|
|
404
404
|
export const VUELESS_CONFIG_FILE_NAME = "vueless.config";
|
|
405
405
|
export const CONFIG_INDEX_FILE_NAME = "index";
|
|
406
|
+
export const VUELESS_CONFIG_DIR = ".vueless";
|
|
406
407
|
|
|
407
408
|
/* System error codes */
|
|
408
409
|
export const DEFAULT_EXIT_CODE = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "1.1.1-beta.
|
|
3
|
+
"version": "1.1.1-beta.50",
|
|
4
4
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
5
5
|
"author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
|
|
6
6
|
"homepage": "https://vueless.com",
|
package/plugin-vite.js
CHANGED
|
@@ -122,14 +122,13 @@ export const Vueless = function (options = {}) {
|
|
|
122
122
|
|
|
123
123
|
configResolved: async () => {
|
|
124
124
|
if (!isNuxtModuleEnv) {
|
|
125
|
+
/* auto import user configs */
|
|
126
|
+
await autoImportUserConfigs();
|
|
127
|
+
|
|
125
128
|
/* merge and cache component configs. */
|
|
126
129
|
await cacheMergedConfigs(vuelessSrcDir);
|
|
127
130
|
}
|
|
128
131
|
|
|
129
|
-
if (!isInternalEnv && !isNuxtModuleEnv) {
|
|
130
|
-
await autoImportUserConfigs();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
132
|
await buildWebTypes(vuelessSrcDir);
|
|
134
133
|
await setCustomPropTypes(vuelessSrcDir);
|
|
135
134
|
|
package/utils/node/helper.js
CHANGED
|
@@ -12,10 +12,12 @@ import {
|
|
|
12
12
|
JAVASCRIPT_EXT,
|
|
13
13
|
TYPESCRIPT_EXT,
|
|
14
14
|
SUPPRESS_TS_CHECK,
|
|
15
|
+
VUELESS_CONFIG_DIR,
|
|
15
16
|
COMPONENTS_INDEX_EXPORT,
|
|
16
17
|
COMPONENTS_INDEX_COMMENT,
|
|
17
18
|
VUELESS_CONFIGS_CACHED_DIR,
|
|
18
19
|
VUELESS_MERGED_CONFIGS_CACHED_DIR,
|
|
20
|
+
CONFIG_INDEX_FILE_NAME,
|
|
19
21
|
} from "../../constants.js";
|
|
20
22
|
|
|
21
23
|
export async function getDirFiles(dirPath, ext, { recursive = true, exclude = [] } = {}) {
|
|
@@ -85,7 +87,7 @@ export function getVueDirs() {
|
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
export function getVuelessConfigDirs() {
|
|
88
|
-
return [path.join(cwd(),
|
|
90
|
+
return [path.join(cwd(), VUELESS_CONFIG_DIR)];
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
export async function getMergedComponentConfig(name) {
|
|
@@ -184,10 +186,10 @@ export async function detectTypeScript() {
|
|
|
184
186
|
}
|
|
185
187
|
|
|
186
188
|
export async function autoImportUserConfigs(rootDir = "") {
|
|
187
|
-
const vuelessConfigDir = path.join(cwd(), rootDir,
|
|
189
|
+
const vuelessConfigDir = path.join(cwd(), rootDir, VUELESS_CONFIG_DIR);
|
|
188
190
|
|
|
189
|
-
const indexTsPath = path.join(vuelessConfigDir,
|
|
190
|
-
const indexJsPath = path.join(vuelessConfigDir,
|
|
191
|
+
const indexTsPath = path.join(vuelessConfigDir, `${CONFIG_INDEX_FILE_NAME}${TYPESCRIPT_EXT}`);
|
|
192
|
+
const indexJsPath = path.join(vuelessConfigDir, `${CONFIG_INDEX_FILE_NAME}${JAVASCRIPT_EXT}`);
|
|
191
193
|
|
|
192
194
|
const hasTypeScript = detectTypeScript();
|
|
193
195
|
|
|
@@ -196,13 +198,16 @@ export async function autoImportUserConfigs(rootDir = "") {
|
|
|
196
198
|
|
|
197
199
|
const configFiles = await getDirFiles(vuelessConfigDir, fileExt, {
|
|
198
200
|
recursive: true,
|
|
199
|
-
exclude: [
|
|
201
|
+
exclude: [
|
|
202
|
+
`${CONFIG_INDEX_FILE_NAME}${TYPESCRIPT_EXT}`,
|
|
203
|
+
`${CONFIG_INDEX_FILE_NAME}${JAVASCRIPT_EXT}`,
|
|
204
|
+
],
|
|
200
205
|
});
|
|
201
206
|
|
|
202
207
|
const componentConfigFiles = configFiles.filter((filePath) => {
|
|
203
208
|
const fileName = path.basename(filePath);
|
|
204
209
|
|
|
205
|
-
return /^U\w+\.
|
|
210
|
+
return /^U\w+\.(ts|js)$/.test(fileName);
|
|
206
211
|
});
|
|
207
212
|
|
|
208
213
|
const imports = [];
|
|
@@ -211,12 +216,11 @@ export async function autoImportUserConfigs(rootDir = "") {
|
|
|
211
216
|
if (componentConfigFiles.length) {
|
|
212
217
|
for (const configFilePath of componentConfigFiles) {
|
|
213
218
|
const fileName = path.basename(configFilePath, path.extname(configFilePath));
|
|
214
|
-
const componentName = fileName.replace(".config", "");
|
|
215
219
|
const relativePath = path.relative(vuelessConfigDir, configFilePath);
|
|
216
220
|
const importPath = "./" + relativePath.replace(/\\/g, "/");
|
|
217
221
|
|
|
218
|
-
imports.push(`import ${
|
|
219
|
-
componentEntries.push(` ${
|
|
222
|
+
imports.push(`import ${fileName} from "${importPath}";`);
|
|
223
|
+
componentEntries.push(` ${fileName},`);
|
|
220
224
|
}
|
|
221
225
|
}
|
|
222
226
|
|
package/utils/node/storybook.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getVuelessConfig } from "./vuelessConfig.js";
|
|
2
|
+
import { autoImportUserConfigs } from "./helper.js";
|
|
2
3
|
import {
|
|
3
4
|
COMPONENTS,
|
|
4
5
|
DIRECTIVES,
|
|
@@ -27,6 +28,9 @@ export function defineConfigWithVueless(config) {
|
|
|
27
28
|
* @return {Promise<string[]>} A promise that resolves to an array of glob patterns for Vueless stories.
|
|
28
29
|
*/
|
|
29
30
|
export async function getVuelessStoriesGlob(vuelessEnv) {
|
|
31
|
+
/* Auto import user configs. */
|
|
32
|
+
await autoImportUserConfigs();
|
|
33
|
+
|
|
30
34
|
const vuelessSrcDir = vuelessEnv === INTERNAL_ENV ? VUELESS_LOCAL_DIR : VUELESS_PACKAGE_DIR;
|
|
31
35
|
const vuelessConfig = await getVuelessConfig();
|
|
32
36
|
const storiesGlob = [];
|