tego 1.3.12

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.
@@ -0,0 +1,339 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __typeError = (msg) => {
8
+ throw TypeError(msg);
9
+ };
10
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
33
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
34
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
35
+ var plugin_presets_exports = {};
36
+ __export(plugin_presets_exports, {
37
+ PluginPresets: () => PluginPresets,
38
+ default: () => plugin_presets_default
39
+ });
40
+ module.exports = __toCommonJS(plugin_presets_exports);
41
+ var import_server = require("@tachybase/server");
42
+ var import_lodash = __toESM(require("lodash"));
43
+ var _builtInPlugins, _localPlugins;
44
+ const _PluginPresets = class _PluginPresets extends import_server.Plugin {
45
+ constructor() {
46
+ super(...arguments);
47
+ __privateAdd(this, _builtInPlugins, [
48
+ "acl",
49
+ "app-info",
50
+ "auth",
51
+ "backup",
52
+ "cloud-component",
53
+ "collection",
54
+ "cron",
55
+ "data-source",
56
+ "error-handler",
57
+ "event-source",
58
+ "file",
59
+ "workflow",
60
+ "message",
61
+ "pdf",
62
+ "ui-schema",
63
+ "user",
64
+ "web",
65
+ "worker-thread",
66
+ "env-secrets"
67
+ ]);
68
+ __privateAdd(this, _localPlugins, [
69
+ // [name, version, enabled]
70
+ ["action-bulk-edit", "0.22.7", true],
71
+ ["action-bulk-update", "0.22.7", true],
72
+ ["action-custom-request", "0.22.7", true],
73
+ ["action-duplicate", "0.22.7", true],
74
+ ["action-export", "0.22.7", true],
75
+ ["action-import", "0.22.7", true],
76
+ ["action-print", "0.22.7", true],
77
+ ["block-calendar", "0.22.7", true],
78
+ ["block-charts", "0.22.7", true],
79
+ ["block-gantt", "0.22.7", true],
80
+ ["block-kanban", "0.22.7", true],
81
+ ["block-presentation", "0.22.7", true],
82
+ ["field-china-region", "0.22.7", true],
83
+ ["field-formula", "0.22.7", true],
84
+ ["field-sequence", "0.22.7", true],
85
+ ["field-encryption", "0.23.8", true],
86
+ ["log-viewer", "0.22.67", true],
87
+ ["otp", "0.22.67", true],
88
+ ["instrumentation", "1.0.18", true],
89
+ ["full-text-search", "0.23.24", true],
90
+ ["password-policy", "0.23.65", true],
91
+ ["auth-pages", "0.23.65", true],
92
+ ["manual-notification", "1.0.4", true],
93
+ // default disable
94
+ ["adapter-bullmq", "0.21.76", false],
95
+ ["adapter-red-node", "0.22.8", false],
96
+ ["adapter-remix", "0.22.9", false],
97
+ ["api-keys", "0.10.1", false],
98
+ ["audit-logs", "0.22.7", false],
99
+ ["auth-cas", "0.13.0", false],
100
+ ["auth-dingtalk", "0.21.76", false],
101
+ ["auth-lark", "0.22.42", false],
102
+ ["auth-oidc", "0.9.2", false],
103
+ ["auth-saml", "0.8.1", false],
104
+ ["auth-sms", "0.10.0", false],
105
+ ["auth-wechat", "0.21.89", false],
106
+ ["auth-wecom", "0.21.76", false],
107
+ ["block-comments", "0.22.6", false],
108
+ ["block-map", "0.8.1", false],
109
+ ["block-step-form", "1.0.0", false],
110
+ ["data-source-common", "0.22.5", false],
111
+ ["demos-game-runesweeper", "0.22.20", false],
112
+ ["devtools", "0.22.82", false],
113
+ ["field-markdown-vditor", "0.22.6", false],
114
+ ["field-snapshot", "0.8.1", false],
115
+ ["hera", "0.22.6", false],
116
+ ["i18n-editor", "0.11.1", false],
117
+ ["multi-app", "0.7.0", false],
118
+ ["multi-app-share-collection", "0.9.2", false],
119
+ ["online-user", "0.22.7", false],
120
+ ["simple-cms", "0.22.6", false],
121
+ ["sub-accounts", "0.22.56", false],
122
+ ["theme-editor", "0.11.1", false],
123
+ ["workflow-approval", "0.22.37", false],
124
+ ["ai-chat", "0.23.8", false],
125
+ ["department", "0.23.22", false],
126
+ ["workflow-analysis", "0.23.41", false],
127
+ ["api-logs", "0.23.49", false],
128
+ ["ocr-convert", "1.0.12", false],
129
+ ["text-copy", "1.2.11", false]
130
+ ]);
131
+ }
132
+ get builtInPlugins() {
133
+ return __privateGet(this, _builtInPlugins);
134
+ }
135
+ get localPlugins() {
136
+ return __privateGet(this, _localPlugins);
137
+ }
138
+ splitNames(name) {
139
+ return (name || "").split(",").filter(Boolean);
140
+ }
141
+ getBuiltInPlugins() {
142
+ const { PRESETS_CORE_PLUGINS } = process.env;
143
+ const [addPlugins, removedPlugins] = this.parseNames(PRESETS_CORE_PLUGINS);
144
+ return import_lodash.default.uniq(this.builtInPlugins.concat(addPlugins).filter((name) => !removedPlugins.includes(name)));
145
+ }
146
+ parseNames(plugins) {
147
+ const addPlugins = this.splitNames(plugins).filter((name) => !name.startsWith("!") && !name.startsWith("|"));
148
+ const removedPlugins = this.splitNames(plugins).filter((name) => name.startsWith("!")).map((name) => name.slice(1));
149
+ const addDisabledPlugins = this.splitNames(plugins).filter((name) => name.startsWith("|")).map((name) => name.slice(1));
150
+ return [addPlugins, removedPlugins, addDisabledPlugins];
151
+ }
152
+ getLocalPlugins() {
153
+ const { PRESETS_LOCAL_PLUGINS } = process.env;
154
+ let plugins = [].concat(this.localPlugins);
155
+ const [addPlugins, removedPlugins, addDisabledPlugins] = this.parseNames(PRESETS_LOCAL_PLUGINS);
156
+ addPlugins.forEach((plugin) => {
157
+ const found = plugins.find((p) => p[0] === plugin);
158
+ if (found) {
159
+ found[2] = true;
160
+ } else {
161
+ plugins.push([plugin, "0.0.0", true]);
162
+ }
163
+ });
164
+ removedPlugins.forEach((plugin) => {
165
+ plugins = plugins.filter((p) => p[0] !== plugin);
166
+ });
167
+ addDisabledPlugins.forEach((plugin) => {
168
+ const found = plugins.find((p) => p[0] === plugin);
169
+ if (found) {
170
+ found[2] = false;
171
+ } else {
172
+ plugins.push([plugin, "0.0.0", false]);
173
+ }
174
+ });
175
+ return plugins;
176
+ }
177
+ async getPackageJson(name) {
178
+ let packageName = name;
179
+ try {
180
+ packageName = await import_server.PluginManager.getPackageName(name);
181
+ } catch (error) {
182
+ packageName = name;
183
+ }
184
+ const packageJson = await import_server.PluginManager.getPackageJson(packageName);
185
+ return packageJson;
186
+ }
187
+ async allPlugins() {
188
+ return (await Promise.all(
189
+ this.getBuiltInPlugins().map(async (name) => {
190
+ const packageJson = await this.getPackageJson(name);
191
+ return {
192
+ name,
193
+ packageName: packageJson.name,
194
+ enabled: true,
195
+ builtIn: true,
196
+ version: packageJson.version
197
+ };
198
+ })
199
+ )).concat(
200
+ await Promise.all(
201
+ this.getLocalPlugins().map(async (plugin) => {
202
+ const name = plugin[0];
203
+ const enabled = plugin[2];
204
+ const packageJson = await this.getPackageJson(name);
205
+ return { name, packageName: packageJson.name, version: packageJson.version, enabled };
206
+ })
207
+ )
208
+ );
209
+ }
210
+ async getPluginToBeUpgraded() {
211
+ const repository = this.app.db.getRepository("applicationPlugins");
212
+ const items = (await repository.find()).map((item) => item.name);
213
+ const plugins = await Promise.all(
214
+ this.getBuiltInPlugins().map(async (name) => {
215
+ const packageJson = await this.getPackageJson(name);
216
+ return {
217
+ name,
218
+ packageName: packageJson.name,
219
+ enabled: true,
220
+ builtIn: true,
221
+ version: packageJson.version
222
+ };
223
+ })
224
+ );
225
+ for (const plugin of this.getLocalPlugins()) {
226
+ if (plugin[1]) {
227
+ if (!items.includes(plugin[0]) && await this.app.version.satisfies(`>${plugin[1]}`)) {
228
+ continue;
229
+ }
230
+ }
231
+ const name = plugin[0];
232
+ const packageJson = await this.getPackageJson(name);
233
+ if (items.includes(plugin[0])) {
234
+ plugins.push({
235
+ name,
236
+ packageName: packageJson.name,
237
+ version: packageJson.version
238
+ });
239
+ } else {
240
+ plugins.push({
241
+ name,
242
+ packageName: packageJson.name,
243
+ version: packageJson.version,
244
+ enabled: plugin[2],
245
+ builtIn: false
246
+ });
247
+ }
248
+ }
249
+ return plugins;
250
+ }
251
+ async updateOrCreatePlugins() {
252
+ const repository = this.pm.repository;
253
+ const plugins = await this.getPluginToBeUpgraded();
254
+ try {
255
+ await this.db.sequelize.transaction((transaction) => {
256
+ return Promise.all(
257
+ plugins.map(
258
+ (values) => repository.updateOrCreate({
259
+ transaction,
260
+ values,
261
+ filterKeys: ["name"]
262
+ })
263
+ )
264
+ );
265
+ });
266
+ } catch (err) {
267
+ console.error(err);
268
+ throw new Error("Create or update plugin error.");
269
+ }
270
+ }
271
+ async createIfNotExists() {
272
+ const repository = this.pm.repository;
273
+ const existPlugins = await repository.find();
274
+ const existPluginNames = existPlugins.map((item) => item.name);
275
+ const plugins = (await this.allPlugins()).filter((item) => !existPluginNames.includes(item.name));
276
+ this.filterForbidSubAppPlugin(plugins);
277
+ await repository.create({ values: plugins });
278
+ }
279
+ async install() {
280
+ await this.createIfNotExists();
281
+ this.log.info("start install built-in plugins");
282
+ await this.pm.repository.init();
283
+ await this.pm.load();
284
+ await this.pm.install();
285
+ this.log.info("finish install built-in plugins");
286
+ }
287
+ async upgrade() {
288
+ this.log.info("update built-in plugins");
289
+ await this.forbidSubAppPlugin();
290
+ await this.updateOrCreatePlugins();
291
+ }
292
+ getForbidSubAppPlugin() {
293
+ if (this.app.name === "main") {
294
+ return [];
295
+ }
296
+ const { FORBID_SUB_APP_PLUGINS } = process.env;
297
+ return FORBID_SUB_APP_PLUGINS ? FORBID_SUB_APP_PLUGINS.split(",") : [];
298
+ }
299
+ // 从环境变量读取禁止子应用装载的插件
300
+ async forbidSubAppPlugin() {
301
+ if (this.app.name === "main") {
302
+ return;
303
+ }
304
+ const forbidPlugins = this.getForbidSubAppPlugin();
305
+ const repository = this.pm.repository;
306
+ await repository.update({
307
+ values: {
308
+ subView: false,
309
+ enabled: false
310
+ },
311
+ filter: {
312
+ name: {
313
+ $in: forbidPlugins
314
+ }
315
+ }
316
+ });
317
+ }
318
+ async filterForbidSubAppPlugin(plugins) {
319
+ if (this.app.name === "main") {
320
+ return;
321
+ }
322
+ const forbidPlugins = this.getForbidSubAppPlugin();
323
+ plugins.forEach((plugin) => {
324
+ if (forbidPlugins.includes(plugin.name)) {
325
+ plugin.subView = false;
326
+ plugin.enabled = false;
327
+ }
328
+ });
329
+ }
330
+ };
331
+ _builtInPlugins = new WeakMap();
332
+ _localPlugins = new WeakMap();
333
+ __name(_PluginPresets, "PluginPresets");
334
+ let PluginPresets = _PluginPresets;
335
+ var plugin_presets_default = PluginPresets;
336
+ // Annotate the CommonJS export names for ESM import in node:
337
+ 0 && (module.exports = {
338
+ PluginPresets
339
+ });
@@ -0,0 +1,4 @@
1
+ declare module 'node:module' {
2
+ function _load(request: string, parent: NodeModule | null, isMain: boolean): any;
3
+ }
4
+ export {};
package/lib/preload.js ADDED
@@ -0,0 +1,76 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from))
10
+ if (!__hasOwnProp.call(to, key) && key !== except)
11
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ }
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
23
+ var import_node_module = require("node:module");
24
+ var import_globals = __toESM(require("@tachybase/globals"));
25
+ var import_loader = require("@tachybase/loader");
26
+ var import_constants = require("./constants");
27
+ Error.stackTraceLimit = process.env.ERROR_STACK_TRACE_LIMIT ? +process.env.ERROR_STACK_TRACE_LIMIT : 10;
28
+ if (!process.env.NODE_MODULES_PATH) {
29
+ process.env.NODE_MODULES_PATH = [
30
+ // 开发插件
31
+ import_constants.DEFAULT_DEV_PLUGINS_PATH,
32
+ // 远程插件
33
+ import_constants.DEFAULT_REMOTE_PLUGINS_PATH,
34
+ // 内置插件
35
+ import_constants.DEFAULT_BUILTIN_PLUGINS_PATH
36
+ ].join(",");
37
+ }
38
+ const paths = process.env.NODE_MODULES_PATH.split(",");
39
+ import_globals.default.getInstance().set("PLUGIN_PATHS", paths);
40
+ const originalLoad = import_node_module.Module._load;
41
+ const appRoot = __dirname;
42
+ const defaultWhitelists = [
43
+ "@koa/cors",
44
+ "@koa/multer",
45
+ "async-mutex",
46
+ "axios",
47
+ "cache-manager",
48
+ "dayjs",
49
+ "dotenv",
50
+ "i18next",
51
+ "jsonwebtoken",
52
+ "koa",
53
+ "koa-bodyparser",
54
+ "lodash",
55
+ "mathjs",
56
+ "multer",
57
+ "mysql2",
58
+ "pg",
59
+ "react",
60
+ "react-dom",
61
+ "sequelize",
62
+ "sqlite3",
63
+ "umzug",
64
+ "winston",
65
+ "winston-daily-rotate-file"
66
+ ];
67
+ const whitelists = new Set(defaultWhitelists);
68
+ if (process.env.ENGINE_MODULES) {
69
+ process.env.ENGINE_MODULES.split(",").forEach((item) => {
70
+ whitelists.add(item);
71
+ });
72
+ }
73
+ const lookingPaths = [appRoot, ...import_globals.default.getInstance().get("PLUGIN_PATHS")];
74
+ import_globals.default.getInstance().set("WORKER_PATHS", lookingPaths);
75
+ import_globals.default.getInstance().set("WORKER_MODULES", [...whitelists]);
76
+ import_node_module.Module._load = (0, import_loader.defineLoader)(whitelists, originalLoad, lookingPaths);
@@ -0,0 +1,7 @@
1
+ import yoctoSpinner from '@socketregistry/yocto-spinner/index.cjs';
2
+ export declare function prepare({ name, plugins, init, }: {
3
+ name?: string;
4
+ plugins: string[];
5
+ init?: boolean;
6
+ }): Promise<void>;
7
+ export declare function npmInstall(target: string, spinner: yoctoSpinner.Spinner): Promise<void>;
package/lib/prepare.js ADDED
@@ -0,0 +1,120 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var prepare_exports = {};
30
+ __export(prepare_exports, {
31
+ npmInstall: () => npmInstall,
32
+ prepare: () => prepare
33
+ });
34
+ module.exports = __toCommonJS(prepare_exports);
35
+ var import_node_fs = __toESM(require("node:fs"));
36
+ var import_node_path = __toESM(require("node:path"));
37
+ var import_node_process = __toESM(require("node:process"));
38
+ var import_yocto_spinner = __toESM(require("@socketregistry/yocto-spinner/index.cjs"));
39
+ var import_execa = __toESM(require("execa"));
40
+ var import_constants = require("./constants");
41
+ var import_default_modules = require("./default-modules");
42
+ var import_default_plugins = require("./default-plugins");
43
+ var import_utils = require("./utils");
44
+ async function prepare({
45
+ name,
46
+ plugins = import_default_plugins.defaultPlugins,
47
+ init = false
48
+ }) {
49
+ if (init) {
50
+ if (import_node_fs.default.existsSync(name)) {
51
+ console.log(`project folder ${name} already exists, exit now.`);
52
+ return;
53
+ }
54
+ import_node_fs.default.mkdirSync(name);
55
+ (0, import_utils.initEnvFile)(name);
56
+ } else {
57
+ name = import_node_process.default.cwd();
58
+ }
59
+ let npmExist = true;
60
+ try {
61
+ await (0, import_execa.default)("npm", ["--version"]);
62
+ } catch {
63
+ npmExist = false;
64
+ }
65
+ const prefix = import_node_path.default.join(name, import_constants.DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH);
66
+ console.log("\u{1F680} ~ start download ~ front end files");
67
+ const spinner = (0, import_yocto_spinner.default)({ text: `Loading ${import_constants.DEFAULT_WEB_PACKAGE_NAME}` }).start();
68
+ await (0, import_utils.downloadTar)(import_constants.DEFAULT_WEB_PACKAGE_NAME, `${prefix}/${import_constants.DEFAULT_WEB_PACKAGE_NAME}`);
69
+ spinner.success();
70
+ console.log();
71
+ console.log("\u{1F680} ~ start download ~ required modules");
72
+ const moduleNames = import_default_modules.defaultModules.map((moduleName) => `@tachybase/module-${moduleName}`);
73
+ let index = 1;
74
+ for (const moduleName of moduleNames) {
75
+ const spinner2 = (0, import_yocto_spinner.default)({ text: `[${index++}/${moduleNames.length}] Loading ${moduleName}` }).start();
76
+ await (0, import_utils.downloadTar)(moduleName, `${prefix}/${moduleName}`);
77
+ if (npmExist) {
78
+ await npmInstall(`${prefix}/${moduleName}`, spinner2);
79
+ }
80
+ spinner2.success();
81
+ }
82
+ console.log();
83
+ console.log("\u{1F680} ~ start download ~ plugins");
84
+ index = 1;
85
+ const pluginNames = plugins.map((pluginName) => `@tachybase/plugin-${pluginName}`);
86
+ for (const pluginName of pluginNames) {
87
+ const spinner2 = (0, import_yocto_spinner.default)({ text: `[${index++}/${pluginNames.length}] Loading ${pluginName}` }).start();
88
+ await (0, import_utils.downloadTar)(pluginName, `${prefix}/${pluginName}`);
89
+ if (npmExist) {
90
+ await npmInstall(`${prefix}/${pluginName}`, spinner2);
91
+ }
92
+ spinner2.success();
93
+ }
94
+ console.log();
95
+ }
96
+ __name(prepare, "prepare");
97
+ async function npmInstall(target, spinner) {
98
+ const packageJsonPath = import_node_path.default.join(target, "package.json");
99
+ const packageJson = JSON.parse(import_node_fs.default.readFileSync(packageJsonPath, "utf-8"));
100
+ if (!packageJson.dependencies || Object.keys(packageJson.dependencies).length === 0) {
101
+ return;
102
+ }
103
+ const originalText = spinner.text;
104
+ spinner.text += " [installing deps]";
105
+ await (0, import_execa.default)("npm", ["install", "--omit", "dev", "--legacy-peer-deps"], {
106
+ stdio: "inherit",
107
+ cwd: target,
108
+ env: {
109
+ npm_config_loglevel: "error",
110
+ ...import_node_process.default.env
111
+ }
112
+ });
113
+ spinner.text = originalText;
114
+ }
115
+ __name(npmInstall, "npmInstall");
116
+ // Annotate the CommonJS export names for ESM import in node:
117
+ 0 && (module.exports = {
118
+ npmInstall,
119
+ prepare
120
+ });
package/lib/utils.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare function initEnvFile(name: string): void;
2
+ export declare function parseEnvironment(): void;
3
+ export declare function guessServePath(): string | false;
4
+ export declare function downloadTar(packageName: string, target: string): Promise<void>;