@weapp-core/init 0.0.2-alpha.1 → 0.0.2-alpha.3
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/dist/index.cjs +121 -9
- package/dist/index.d.cts +34 -10
- package/dist/index.d.ts +34 -10
- package/dist/index.js +118 -9
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -31,15 +31,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
initConfig: () => initConfig,
|
|
34
|
+
initTsDtsFile: () => initTsDtsFile,
|
|
35
|
+
initTsJsonFiles: () => initTsJsonFiles,
|
|
36
|
+
initViteConfigFile: () => initViteConfigFile,
|
|
34
37
|
updatePackageJson: () => updatePackageJson,
|
|
35
38
|
updateProjectConfig: () => updateProjectConfig
|
|
36
39
|
});
|
|
37
40
|
module.exports = __toCommonJS(src_exports);
|
|
38
41
|
var import_node_path = __toESM(require("path"), 1);
|
|
42
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
39
43
|
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
40
44
|
var import_shared = require("@weapp-core/shared");
|
|
41
45
|
function updateProjectConfig(options) {
|
|
42
|
-
const { root, dest } = options;
|
|
46
|
+
const { root, dest, cb, write = true } = options;
|
|
43
47
|
const projectConfigFilename = "project.config.json";
|
|
44
48
|
const projectConfigPath = import_node_path.default.resolve(root, projectConfigFilename);
|
|
45
49
|
if (import_fs_extra.default.existsSync(projectConfigPath)) {
|
|
@@ -48,6 +52,11 @@ function updateProjectConfig(options) {
|
|
|
48
52
|
(0, import_shared.set)(projectConfig, "miniprogramRoot", "dist/");
|
|
49
53
|
(0, import_shared.set)(projectConfig, "srcMiniprogramRoot", "dist/");
|
|
50
54
|
(0, import_shared.set)(projectConfig, "setting.packNpmManually", true);
|
|
55
|
+
cb?.(
|
|
56
|
+
(...args) => {
|
|
57
|
+
(0, import_shared.set)(projectConfig, ...args);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
51
60
|
if (Array.isArray((0, import_shared.get)(projectConfig, "setting.packNpmRelationList"))) {
|
|
52
61
|
const x = projectConfig.setting.packNpmRelationList.find(
|
|
53
62
|
(x2) => x2.packageJsonPath === "./package.json" && x2.miniprogramNpmDistDir === "./dist"
|
|
@@ -66,10 +75,13 @@ function updateProjectConfig(options) {
|
|
|
66
75
|
}
|
|
67
76
|
]);
|
|
68
77
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
if (write) {
|
|
79
|
+
import_fs_extra.default.outputJSONSync(dest ?? projectConfigPath, projectConfig, {
|
|
80
|
+
spaces: 2
|
|
81
|
+
});
|
|
82
|
+
}
|
|
72
83
|
console.log(`\u2728 \u8BBE\u7F6E ${projectConfigFilename} \u914D\u7F6E\u6587\u4EF6\u6210\u529F!`);
|
|
84
|
+
return projectConfig;
|
|
73
85
|
} catch {
|
|
74
86
|
console.warn(`\u2728 \u8BBE\u7F6E ${projectConfigFilename} \u914D\u7F6E\u6587\u4EF6\u5931\u8D25!`);
|
|
75
87
|
}
|
|
@@ -78,7 +90,7 @@ function updateProjectConfig(options) {
|
|
|
78
90
|
}
|
|
79
91
|
}
|
|
80
92
|
function updatePackageJson(options) {
|
|
81
|
-
const { root, dest, command } = options;
|
|
93
|
+
const { root, dest, command, cb, write = true } = options;
|
|
82
94
|
const packageJsonFilename = "package.json";
|
|
83
95
|
const packageJsonPath = import_node_path.default.resolve(root, packageJsonFilename);
|
|
84
96
|
if (import_fs_extra.default.existsSync(packageJsonPath)) {
|
|
@@ -86,21 +98,121 @@ function updatePackageJson(options) {
|
|
|
86
98
|
const packageJson = import_fs_extra.default.readJSONSync(packageJsonPath);
|
|
87
99
|
(0, import_shared.set)(packageJson, "scripts.dev", `${command} dev`);
|
|
88
100
|
(0, import_shared.set)(packageJson, "scripts.build", `${command} build`);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
101
|
+
if (command === "weapp-vite") {
|
|
102
|
+
(0, import_shared.set)(packageJson, "scripts.open", `${command} open`);
|
|
103
|
+
}
|
|
104
|
+
cb?.(
|
|
105
|
+
(...args) => {
|
|
106
|
+
(0, import_shared.set)(packageJson, ...args);
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
if (write) {
|
|
110
|
+
import_fs_extra.default.outputJSONSync(dest ?? packageJsonPath, packageJson, {
|
|
111
|
+
spaces: 2
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return packageJson;
|
|
92
115
|
} catch {
|
|
93
116
|
}
|
|
94
117
|
}
|
|
95
118
|
}
|
|
119
|
+
function initViteConfigFile(options) {
|
|
120
|
+
const { root, write = true } = options;
|
|
121
|
+
const viteConfigFilePath = import_node_path.default.resolve(root, "vite.config.ts");
|
|
122
|
+
const viteConfigFileCode = `import { defineConfig } from 'weapp-vite/config'
|
|
123
|
+
|
|
124
|
+
export default defineConfig({})
|
|
125
|
+
`;
|
|
126
|
+
if (write) {
|
|
127
|
+
import_fs_extra.default.outputFileSync(viteConfigFilePath, viteConfigFileCode, "utf8");
|
|
128
|
+
}
|
|
129
|
+
return viteConfigFileCode;
|
|
130
|
+
}
|
|
131
|
+
function initTsDtsFile(options) {
|
|
132
|
+
const { root, write = true } = options;
|
|
133
|
+
const viteDtsFilePath = import_node_path.default.resolve(root, "vite-env.d.ts");
|
|
134
|
+
const code = `/// <reference types="vite/client" />
|
|
135
|
+
`;
|
|
136
|
+
if (write) {
|
|
137
|
+
import_fs_extra.default.outputFileSync(viteDtsFilePath, code, "utf8");
|
|
138
|
+
}
|
|
139
|
+
return code;
|
|
140
|
+
}
|
|
141
|
+
function initTsJsonFiles(options) {
|
|
142
|
+
const { root, write = true } = options;
|
|
143
|
+
const tsJsonFilePath = import_node_path.default.resolve(root, "tsconfig.json");
|
|
144
|
+
const tsNodeJsonFilePath = import_node_path.default.resolve(root, "tsconfig.node.json");
|
|
145
|
+
if (write) {
|
|
146
|
+
import_fs_extra.default.outputJSONSync(tsJsonFilePath, {
|
|
147
|
+
compilerOptions: {
|
|
148
|
+
target: "ES2020",
|
|
149
|
+
jsx: "preserve",
|
|
150
|
+
lib: [
|
|
151
|
+
"ES2020",
|
|
152
|
+
"DOM",
|
|
153
|
+
"DOM.Iterable"
|
|
154
|
+
],
|
|
155
|
+
useDefineForClassFields: true,
|
|
156
|
+
module: "ESNext",
|
|
157
|
+
moduleResolution: "bundler",
|
|
158
|
+
resolveJsonModule: true,
|
|
159
|
+
allowImportingTsExtensions: true,
|
|
160
|
+
allowJs: true,
|
|
161
|
+
strict: true,
|
|
162
|
+
noFallthroughCasesInSwitch: true,
|
|
163
|
+
noUnusedLocals: true,
|
|
164
|
+
noUnusedParameters: true,
|
|
165
|
+
noEmit: true,
|
|
166
|
+
isolatedModules: true,
|
|
167
|
+
skipLibCheck: true
|
|
168
|
+
},
|
|
169
|
+
references: [
|
|
170
|
+
{
|
|
171
|
+
path: "./tsconfig.node.json"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
include: [
|
|
175
|
+
"src/**/*.ts",
|
|
176
|
+
"src/**/*.js"
|
|
177
|
+
]
|
|
178
|
+
}, {
|
|
179
|
+
encoding: "utf8",
|
|
180
|
+
spaces: 2
|
|
181
|
+
});
|
|
182
|
+
import_fs_extra.default.outputJSONSync(tsNodeJsonFilePath, {
|
|
183
|
+
compilerOptions: {
|
|
184
|
+
composite: true,
|
|
185
|
+
module: "ESNext",
|
|
186
|
+
moduleResolution: "bundler",
|
|
187
|
+
strict: true,
|
|
188
|
+
allowSyntheticDefaultImports: true,
|
|
189
|
+
skipLibCheck: true
|
|
190
|
+
},
|
|
191
|
+
include: [
|
|
192
|
+
"vite.config.ts"
|
|
193
|
+
]
|
|
194
|
+
}, {
|
|
195
|
+
encoding: "utf8",
|
|
196
|
+
spaces: 2
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
96
200
|
function initConfig(options) {
|
|
97
|
-
const { root, command } = options;
|
|
201
|
+
const { root = import_node_process.default.cwd(), command } = options;
|
|
98
202
|
updateProjectConfig({ root });
|
|
99
203
|
updatePackageJson({ root, command });
|
|
204
|
+
if (command === "weapp-vite") {
|
|
205
|
+
initViteConfigFile({ root });
|
|
206
|
+
initTsDtsFile({ root });
|
|
207
|
+
initTsJsonFiles({ root });
|
|
208
|
+
}
|
|
100
209
|
}
|
|
101
210
|
// Annotate the CommonJS export names for ESM import in node:
|
|
102
211
|
0 && (module.exports = {
|
|
103
212
|
initConfig,
|
|
213
|
+
initTsDtsFile,
|
|
214
|
+
initTsJsonFiles,
|
|
215
|
+
initViteConfigFile,
|
|
104
216
|
updatePackageJson,
|
|
105
217
|
updateProjectConfig
|
|
106
218
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { set } from '@weapp-core/shared';
|
|
2
|
+
|
|
3
|
+
interface SetMethod {
|
|
4
|
+
(path: set.InputType, value: any, options?: set.Options): void;
|
|
5
|
+
}
|
|
6
|
+
interface SharedUpdateOptions {
|
|
6
7
|
root: string;
|
|
7
8
|
dest?: string;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
write?: boolean;
|
|
10
|
+
cb?: (set: SetMethod) => void;
|
|
11
|
+
}
|
|
12
|
+
interface UpdateProjectConfigOptions extends SharedUpdateOptions {
|
|
13
|
+
}
|
|
14
|
+
interface UpdatePackageJsonOptions extends SharedUpdateOptions {
|
|
15
|
+
command?: 'weapp-vite';
|
|
16
|
+
}
|
|
17
|
+
declare function updateProjectConfig(options: UpdateProjectConfigOptions): {
|
|
18
|
+
miniprogramRoot?: string;
|
|
19
|
+
srcMiniprogramRoot?: string;
|
|
20
|
+
setting: {
|
|
21
|
+
packNpmManually: boolean;
|
|
22
|
+
packNpmRelationList: {
|
|
23
|
+
packageJsonPath: string;
|
|
24
|
+
miniprogramNpmDistDir: string;
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
} | undefined;
|
|
28
|
+
declare function updatePackageJson(options: UpdatePackageJsonOptions): {
|
|
29
|
+
scripts: Record<string, string>;
|
|
30
|
+
} | undefined;
|
|
31
|
+
declare function initViteConfigFile(options: SharedUpdateOptions): string;
|
|
32
|
+
declare function initTsDtsFile(options: SharedUpdateOptions): string;
|
|
33
|
+
declare function initTsJsonFiles(options: SharedUpdateOptions): void;
|
|
10
34
|
declare function initConfig(options: {
|
|
11
|
-
root
|
|
12
|
-
command?:
|
|
35
|
+
root?: string;
|
|
36
|
+
command?: 'weapp-vite';
|
|
13
37
|
}): void;
|
|
14
38
|
|
|
15
|
-
export { initConfig, updatePackageJson, updateProjectConfig };
|
|
39
|
+
export { type SetMethod, type SharedUpdateOptions, type UpdatePackageJsonOptions, type UpdateProjectConfigOptions, initConfig, initTsDtsFile, initTsJsonFiles, initViteConfigFile, updatePackageJson, updateProjectConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { set } from '@weapp-core/shared';
|
|
2
|
+
|
|
3
|
+
interface SetMethod {
|
|
4
|
+
(path: set.InputType, value: any, options?: set.Options): void;
|
|
5
|
+
}
|
|
6
|
+
interface SharedUpdateOptions {
|
|
6
7
|
root: string;
|
|
7
8
|
dest?: string;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
write?: boolean;
|
|
10
|
+
cb?: (set: SetMethod) => void;
|
|
11
|
+
}
|
|
12
|
+
interface UpdateProjectConfigOptions extends SharedUpdateOptions {
|
|
13
|
+
}
|
|
14
|
+
interface UpdatePackageJsonOptions extends SharedUpdateOptions {
|
|
15
|
+
command?: 'weapp-vite';
|
|
16
|
+
}
|
|
17
|
+
declare function updateProjectConfig(options: UpdateProjectConfigOptions): {
|
|
18
|
+
miniprogramRoot?: string;
|
|
19
|
+
srcMiniprogramRoot?: string;
|
|
20
|
+
setting: {
|
|
21
|
+
packNpmManually: boolean;
|
|
22
|
+
packNpmRelationList: {
|
|
23
|
+
packageJsonPath: string;
|
|
24
|
+
miniprogramNpmDistDir: string;
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
} | undefined;
|
|
28
|
+
declare function updatePackageJson(options: UpdatePackageJsonOptions): {
|
|
29
|
+
scripts: Record<string, string>;
|
|
30
|
+
} | undefined;
|
|
31
|
+
declare function initViteConfigFile(options: SharedUpdateOptions): string;
|
|
32
|
+
declare function initTsDtsFile(options: SharedUpdateOptions): string;
|
|
33
|
+
declare function initTsJsonFiles(options: SharedUpdateOptions): void;
|
|
10
34
|
declare function initConfig(options: {
|
|
11
|
-
root
|
|
12
|
-
command?:
|
|
35
|
+
root?: string;
|
|
36
|
+
command?: 'weapp-vite';
|
|
13
37
|
}): void;
|
|
14
38
|
|
|
15
|
-
export { initConfig, updatePackageJson, updateProjectConfig };
|
|
39
|
+
export { type SetMethod, type SharedUpdateOptions, type UpdatePackageJsonOptions, type UpdateProjectConfigOptions, initConfig, initTsDtsFile, initTsJsonFiles, initViteConfigFile, updatePackageJson, updateProjectConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
3
4
|
import fs from "fs-extra";
|
|
4
5
|
import { get, set } from "@weapp-core/shared";
|
|
5
6
|
function updateProjectConfig(options) {
|
|
6
|
-
const { root, dest } = options;
|
|
7
|
+
const { root, dest, cb, write = true } = options;
|
|
7
8
|
const projectConfigFilename = "project.config.json";
|
|
8
9
|
const projectConfigPath = path.resolve(root, projectConfigFilename);
|
|
9
10
|
if (fs.existsSync(projectConfigPath)) {
|
|
@@ -12,6 +13,11 @@ function updateProjectConfig(options) {
|
|
|
12
13
|
set(projectConfig, "miniprogramRoot", "dist/");
|
|
13
14
|
set(projectConfig, "srcMiniprogramRoot", "dist/");
|
|
14
15
|
set(projectConfig, "setting.packNpmManually", true);
|
|
16
|
+
cb?.(
|
|
17
|
+
(...args) => {
|
|
18
|
+
set(projectConfig, ...args);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
15
21
|
if (Array.isArray(get(projectConfig, "setting.packNpmRelationList"))) {
|
|
16
22
|
const x = projectConfig.setting.packNpmRelationList.find(
|
|
17
23
|
(x2) => x2.packageJsonPath === "./package.json" && x2.miniprogramNpmDistDir === "./dist"
|
|
@@ -30,10 +36,13 @@ function updateProjectConfig(options) {
|
|
|
30
36
|
}
|
|
31
37
|
]);
|
|
32
38
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
if (write) {
|
|
40
|
+
fs.outputJSONSync(dest ?? projectConfigPath, projectConfig, {
|
|
41
|
+
spaces: 2
|
|
42
|
+
});
|
|
43
|
+
}
|
|
36
44
|
console.log(`\u2728 \u8BBE\u7F6E ${projectConfigFilename} \u914D\u7F6E\u6587\u4EF6\u6210\u529F!`);
|
|
45
|
+
return projectConfig;
|
|
37
46
|
} catch {
|
|
38
47
|
console.warn(`\u2728 \u8BBE\u7F6E ${projectConfigFilename} \u914D\u7F6E\u6587\u4EF6\u5931\u8D25!`);
|
|
39
48
|
}
|
|
@@ -42,7 +51,7 @@ function updateProjectConfig(options) {
|
|
|
42
51
|
}
|
|
43
52
|
}
|
|
44
53
|
function updatePackageJson(options) {
|
|
45
|
-
const { root, dest, command } = options;
|
|
54
|
+
const { root, dest, command, cb, write = true } = options;
|
|
46
55
|
const packageJsonFilename = "package.json";
|
|
47
56
|
const packageJsonPath = path.resolve(root, packageJsonFilename);
|
|
48
57
|
if (fs.existsSync(packageJsonPath)) {
|
|
@@ -50,20 +59,120 @@ function updatePackageJson(options) {
|
|
|
50
59
|
const packageJson = fs.readJSONSync(packageJsonPath);
|
|
51
60
|
set(packageJson, "scripts.dev", `${command} dev`);
|
|
52
61
|
set(packageJson, "scripts.build", `${command} build`);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
62
|
+
if (command === "weapp-vite") {
|
|
63
|
+
set(packageJson, "scripts.open", `${command} open`);
|
|
64
|
+
}
|
|
65
|
+
cb?.(
|
|
66
|
+
(...args) => {
|
|
67
|
+
set(packageJson, ...args);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
if (write) {
|
|
71
|
+
fs.outputJSONSync(dest ?? packageJsonPath, packageJson, {
|
|
72
|
+
spaces: 2
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return packageJson;
|
|
56
76
|
} catch {
|
|
57
77
|
}
|
|
58
78
|
}
|
|
59
79
|
}
|
|
80
|
+
function initViteConfigFile(options) {
|
|
81
|
+
const { root, write = true } = options;
|
|
82
|
+
const viteConfigFilePath = path.resolve(root, "vite.config.ts");
|
|
83
|
+
const viteConfigFileCode = `import { defineConfig } from 'weapp-vite/config'
|
|
84
|
+
|
|
85
|
+
export default defineConfig({})
|
|
86
|
+
`;
|
|
87
|
+
if (write) {
|
|
88
|
+
fs.outputFileSync(viteConfigFilePath, viteConfigFileCode, "utf8");
|
|
89
|
+
}
|
|
90
|
+
return viteConfigFileCode;
|
|
91
|
+
}
|
|
92
|
+
function initTsDtsFile(options) {
|
|
93
|
+
const { root, write = true } = options;
|
|
94
|
+
const viteDtsFilePath = path.resolve(root, "vite-env.d.ts");
|
|
95
|
+
const code = `/// <reference types="vite/client" />
|
|
96
|
+
`;
|
|
97
|
+
if (write) {
|
|
98
|
+
fs.outputFileSync(viteDtsFilePath, code, "utf8");
|
|
99
|
+
}
|
|
100
|
+
return code;
|
|
101
|
+
}
|
|
102
|
+
function initTsJsonFiles(options) {
|
|
103
|
+
const { root, write = true } = options;
|
|
104
|
+
const tsJsonFilePath = path.resolve(root, "tsconfig.json");
|
|
105
|
+
const tsNodeJsonFilePath = path.resolve(root, "tsconfig.node.json");
|
|
106
|
+
if (write) {
|
|
107
|
+
fs.outputJSONSync(tsJsonFilePath, {
|
|
108
|
+
compilerOptions: {
|
|
109
|
+
target: "ES2020",
|
|
110
|
+
jsx: "preserve",
|
|
111
|
+
lib: [
|
|
112
|
+
"ES2020",
|
|
113
|
+
"DOM",
|
|
114
|
+
"DOM.Iterable"
|
|
115
|
+
],
|
|
116
|
+
useDefineForClassFields: true,
|
|
117
|
+
module: "ESNext",
|
|
118
|
+
moduleResolution: "bundler",
|
|
119
|
+
resolveJsonModule: true,
|
|
120
|
+
allowImportingTsExtensions: true,
|
|
121
|
+
allowJs: true,
|
|
122
|
+
strict: true,
|
|
123
|
+
noFallthroughCasesInSwitch: true,
|
|
124
|
+
noUnusedLocals: true,
|
|
125
|
+
noUnusedParameters: true,
|
|
126
|
+
noEmit: true,
|
|
127
|
+
isolatedModules: true,
|
|
128
|
+
skipLibCheck: true
|
|
129
|
+
},
|
|
130
|
+
references: [
|
|
131
|
+
{
|
|
132
|
+
path: "./tsconfig.node.json"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
include: [
|
|
136
|
+
"src/**/*.ts",
|
|
137
|
+
"src/**/*.js"
|
|
138
|
+
]
|
|
139
|
+
}, {
|
|
140
|
+
encoding: "utf8",
|
|
141
|
+
spaces: 2
|
|
142
|
+
});
|
|
143
|
+
fs.outputJSONSync(tsNodeJsonFilePath, {
|
|
144
|
+
compilerOptions: {
|
|
145
|
+
composite: true,
|
|
146
|
+
module: "ESNext",
|
|
147
|
+
moduleResolution: "bundler",
|
|
148
|
+
strict: true,
|
|
149
|
+
allowSyntheticDefaultImports: true,
|
|
150
|
+
skipLibCheck: true
|
|
151
|
+
},
|
|
152
|
+
include: [
|
|
153
|
+
"vite.config.ts"
|
|
154
|
+
]
|
|
155
|
+
}, {
|
|
156
|
+
encoding: "utf8",
|
|
157
|
+
spaces: 2
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
60
161
|
function initConfig(options) {
|
|
61
|
-
const { root, command } = options;
|
|
162
|
+
const { root = process.cwd(), command } = options;
|
|
62
163
|
updateProjectConfig({ root });
|
|
63
164
|
updatePackageJson({ root, command });
|
|
165
|
+
if (command === "weapp-vite") {
|
|
166
|
+
initViteConfigFile({ root });
|
|
167
|
+
initTsDtsFile({ root });
|
|
168
|
+
initTsJsonFiles({ root });
|
|
169
|
+
}
|
|
64
170
|
}
|
|
65
171
|
export {
|
|
66
172
|
initConfig,
|
|
173
|
+
initTsDtsFile,
|
|
174
|
+
initTsJsonFiles,
|
|
175
|
+
initViteConfigFile,
|
|
67
176
|
updatePackageJson,
|
|
68
177
|
updateProjectConfig
|
|
69
178
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-core/init",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.2-alpha.
|
|
4
|
+
"version": "0.0.2-alpha.3",
|
|
5
5
|
"description": "@weapp-core/init",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "ISC",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"fs-extra": "^11.2.0",
|
|
25
|
-
"@weapp-core/shared": "^0.0.2-alpha.
|
|
25
|
+
"@weapp-core/shared": "^0.0.2-alpha.3"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"dev": "tsup --watch --sourcemap",
|