vueless 1.3.7-beta.0 → 1.3.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.
- package/bin/commands/init.js +7 -7
- package/constants.d.ts +2 -1
- package/constants.js +3 -2
- package/package.json +1 -1
- package/plugin-vite.js +2 -2
- package/utils/node/helper.d.ts +1 -1
- package/utils/node/helper.js +11 -9
package/bin/commands/init.js
CHANGED
|
@@ -12,7 +12,7 @@ import { DEFAULT_VUELESS_CONFIG_CONTENT } from "../constants.js";
|
|
|
12
12
|
import {
|
|
13
13
|
JAVASCRIPT_EXT,
|
|
14
14
|
TYPESCRIPT_EXT,
|
|
15
|
-
|
|
15
|
+
VUELESS_APP_DIR,
|
|
16
16
|
CONFIG_INDEX_FILE_NAME,
|
|
17
17
|
VUELESS_CONFIG_FILE_NAME,
|
|
18
18
|
} from "../../constants.js";
|
|
@@ -51,8 +51,8 @@ export async function vuelessInit(options) {
|
|
|
51
51
|
/* Create a default config file. */
|
|
52
52
|
await createVuelessConfig(destPath);
|
|
53
53
|
|
|
54
|
-
/* Create a vueless
|
|
55
|
-
await
|
|
54
|
+
/* Create a vueless app directory and index file. */
|
|
55
|
+
await createVuelessAppDir(fileExt);
|
|
56
56
|
|
|
57
57
|
/* Create pnpm package manager config. */
|
|
58
58
|
if (options.includes("--pnpm")) {
|
|
@@ -111,17 +111,17 @@ async function createVuelessConfig(destPath) {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
* Creates a Vueless
|
|
114
|
+
* Creates a Vueless app directory and index file.
|
|
115
115
|
* @param {string} fileExt - The file extension to use for the index file.
|
|
116
116
|
*/
|
|
117
|
-
async function
|
|
118
|
-
const vuelessDir = path.join(cwd(),
|
|
117
|
+
async function createVuelessAppDir(fileExt) {
|
|
118
|
+
const vuelessDir = path.join(cwd(), VUELESS_APP_DIR);
|
|
119
119
|
|
|
120
120
|
if (existsSync(vuelessDir)) return;
|
|
121
121
|
|
|
122
122
|
mkdirSync(vuelessDir);
|
|
123
123
|
console.log(
|
|
124
|
-
styleText("green", `The '${
|
|
124
|
+
styleText("green", `The '${VUELESS_APP_DIR}' directory was created in the project root.`),
|
|
125
125
|
);
|
|
126
126
|
|
|
127
127
|
const indexFileContent = await generateConfigIndexContent();
|
package/constants.d.ts
CHANGED
|
@@ -339,7 +339,8 @@ export const VUELESS_CONFIGS_CACHED_DIR: "node_modules/.cache/vueless/configs";
|
|
|
339
339
|
export const VUELESS_MERGED_CONFIGS_CACHED_DIR: "node_modules/.cache/vueless/mergedConfigs";
|
|
340
340
|
export const VUELESS_CONFIG_FILE_NAME: "vueless.config";
|
|
341
341
|
export const CONFIG_INDEX_FILE_NAME: "index";
|
|
342
|
-
export const
|
|
342
|
+
export const VUELESS_APP_DIR: ".vueless";
|
|
343
|
+
export const VUELESS_APP_CONFIGS_DIR: ".vueless/configs";
|
|
343
344
|
export const VUELESS_USER_COMPONENTS_DIR: ".vueless/components";
|
|
344
345
|
export const SRC_USER_COMPONENTS_DIR: "src/components";
|
|
345
346
|
export const DEFAULT_EXIT_CODE: 0;
|
package/constants.js
CHANGED
|
@@ -420,8 +420,9 @@ export const VUELESS_CONFIGS_CACHED_DIR = `${VUELESS_CACHE_DIR}/configs`;
|
|
|
420
420
|
export const VUELESS_MERGED_CONFIGS_CACHED_DIR = `${VUELESS_CACHE_DIR}/mergedConfigs`;
|
|
421
421
|
export const VUELESS_CONFIG_FILE_NAME = "vueless.config";
|
|
422
422
|
export const CONFIG_INDEX_FILE_NAME = "index";
|
|
423
|
-
export const
|
|
424
|
-
export const
|
|
423
|
+
export const VUELESS_APP_DIR = ".vueless";
|
|
424
|
+
export const VUELESS_APP_CONFIGS_DIR = `${VUELESS_APP_DIR}/configs`;
|
|
425
|
+
export const VUELESS_USER_COMPONENTS_DIR = `${VUELESS_APP_DIR}/components`;
|
|
425
426
|
export const SRC_USER_COMPONENTS_DIR = `${SRC_DIR}/components`;
|
|
426
427
|
|
|
427
428
|
/* System error codes */
|
package/package.json
CHANGED
package/plugin-vite.js
CHANGED
|
@@ -24,7 +24,7 @@ import { overrideComponents, restoreComponents } from "./utils/node/componentOve
|
|
|
24
24
|
import {
|
|
25
25
|
getNuxtDirs,
|
|
26
26
|
getVueDirs,
|
|
27
|
-
|
|
27
|
+
getVuelessAppDirs,
|
|
28
28
|
cacheMergedConfigs,
|
|
29
29
|
autoImportUserConfigs,
|
|
30
30
|
} from "./utils/node/helper.js";
|
|
@@ -77,7 +77,7 @@ export const Vueless = function (options = {}) {
|
|
|
77
77
|
|
|
78
78
|
const targetFiles = [
|
|
79
79
|
...(include || []),
|
|
80
|
-
...
|
|
80
|
+
...getVuelessAppDirs(),
|
|
81
81
|
...(isNuxtModuleEnv ? getNuxtDirs() : getVueDirs()),
|
|
82
82
|
];
|
|
83
83
|
|
package/utils/node/helper.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export function getDirFiles(dirPath: string, ext: string, { recursive, exclude }
|
|
|
4
4
|
}): Promise<string[]>;
|
|
5
5
|
export function getNuxtDirs(): string[];
|
|
6
6
|
export function getVueDirs(): string[];
|
|
7
|
-
export function
|
|
7
|
+
export function getVuelessAppDirs(): string[];
|
|
8
8
|
export function getMergedComponentConfig(name: string): Promise<Object>;
|
|
9
9
|
export function getDefaultComponentConfig(name: string, configDir: string): Promise<Object>;
|
|
10
10
|
export function cacheMergedConfigs({ vuelessSrcDir, basePath }?: {
|
package/utils/node/helper.js
CHANGED
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
JAVASCRIPT_EXT,
|
|
13
13
|
TYPESCRIPT_EXT,
|
|
14
14
|
SUPPRESS_TS_CHECK,
|
|
15
|
-
|
|
15
|
+
VUELESS_APP_DIR,
|
|
16
|
+
VUELESS_APP_CONFIGS_DIR,
|
|
16
17
|
COMPONENTS_INDEX_EXPORT,
|
|
17
18
|
COMPONENTS_INDEX_COMMENT,
|
|
18
19
|
VUELESS_CONFIGS_CACHED_DIR,
|
|
@@ -108,8 +109,8 @@ export function getVueDirs() {
|
|
|
108
109
|
* Retrieves an array of directory paths and specific file paths within the current working directory related to a Vueless project.
|
|
109
110
|
* @return {string[]}.
|
|
110
111
|
*/
|
|
111
|
-
export function
|
|
112
|
-
return [path.join(cwd(),
|
|
112
|
+
export function getVuelessAppDirs() {
|
|
113
|
+
return [path.join(cwd(), VUELESS_APP_DIR)];
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
/**
|
|
@@ -251,10 +252,11 @@ export async function detectTypeScript() {
|
|
|
251
252
|
* @return {Promise<void>} A promise that resolves when the configuration import and index file generation is completed.
|
|
252
253
|
*/
|
|
253
254
|
export async function autoImportUserConfigs(basePath = "") {
|
|
254
|
-
const
|
|
255
|
+
const vuelessAppDir = path.join(cwd(), basePath, VUELESS_APP_DIR);
|
|
256
|
+
const vuelessConfigDir = path.join(cwd(), basePath, VUELESS_APP_CONFIGS_DIR);
|
|
255
257
|
|
|
256
|
-
const indexTsPath = path.join(
|
|
257
|
-
const indexJsPath = path.join(
|
|
258
|
+
const indexTsPath = path.join(vuelessAppDir, `${CONFIG_INDEX_FILE_NAME}${TYPESCRIPT_EXT}`);
|
|
259
|
+
const indexJsPath = path.join(vuelessAppDir, `${CONFIG_INDEX_FILE_NAME}${JAVASCRIPT_EXT}`);
|
|
258
260
|
|
|
259
261
|
const hasTypeScript = await detectTypeScript();
|
|
260
262
|
|
|
@@ -281,7 +283,7 @@ export async function autoImportUserConfigs(basePath = "") {
|
|
|
281
283
|
if (componentConfigFiles.length) {
|
|
282
284
|
for (const configFilePath of componentConfigFiles) {
|
|
283
285
|
const fileName = path.basename(configFilePath, path.extname(configFilePath));
|
|
284
|
-
const relativePath = path.relative(
|
|
286
|
+
const relativePath = path.relative(vuelessAppDir, configFilePath);
|
|
285
287
|
const importPath = "./" + relativePath.replace(/\\/g, "/");
|
|
286
288
|
|
|
287
289
|
imports.push(`import ${fileName} from "${importPath}";`);
|
|
@@ -289,8 +291,8 @@ export async function autoImportUserConfigs(basePath = "") {
|
|
|
289
291
|
}
|
|
290
292
|
}
|
|
291
293
|
|
|
292
|
-
if (!existsSync(
|
|
293
|
-
await mkdir(
|
|
294
|
+
if (!existsSync(vuelessAppDir)) {
|
|
295
|
+
await mkdir(vuelessAppDir, { recursive: true });
|
|
294
296
|
}
|
|
295
297
|
|
|
296
298
|
const indexFileContent = await generateConfigIndexContent(imports, componentEntries);
|