zova-cli-set-front 1.2.97 → 1.2.99
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.
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { ZovaOpenapiConfig } from 'zova-openapi';
|
|
2
2
|
|
|
3
3
|
export default function (): ZovaOpenapiConfig {
|
|
4
|
+
const apiBaseURL = process.env.API_BASE_URL;
|
|
5
|
+
if (!apiBaseURL) {
|
|
6
|
+
throw new Error('Missing API_BASE_URL');
|
|
7
|
+
}
|
|
4
8
|
return {
|
|
5
9
|
default: {
|
|
6
|
-
source: '
|
|
10
|
+
source: `${apiBaseURL.replace(/\/$/, '')}/swagger/json?version=V31`,
|
|
7
11
|
},
|
|
8
12
|
modules: {},
|
|
9
13
|
};
|
package/dist/index.js
CHANGED
|
@@ -158,6 +158,13 @@ function getControllerFileName(module, type, beanName) {
|
|
|
158
158
|
}
|
|
159
159
|
return 'controller.tsx';
|
|
160
160
|
}
|
|
161
|
+
function loadZovaEnvs(appDir, configMeta) {
|
|
162
|
+
const configUtils = createConfigUtils(configMeta, {
|
|
163
|
+
appDir,
|
|
164
|
+
runtimeDir: '.zova'
|
|
165
|
+
});
|
|
166
|
+
return configUtils.loadEnvs();
|
|
167
|
+
}
|
|
161
168
|
async function loadJSONFile(fileName) {
|
|
162
169
|
const pkgContent = (await fse.readFile(fileName)).toString();
|
|
163
170
|
return JSON.parse(pkgContent);
|
|
@@ -326,8 +333,9 @@ class CliBinBuildRest extends BeanCliBase {
|
|
|
326
333
|
plugins: [svgResolverPlugin()],
|
|
327
334
|
deps: {
|
|
328
335
|
alwaysBundle: id => {
|
|
329
|
-
|
|
330
|
-
|
|
336
|
+
return bundleModules.some(moduleName => {
|
|
337
|
+
return id === moduleName || id.startsWith(`${moduleName}/`);
|
|
338
|
+
});
|
|
331
339
|
}
|
|
332
340
|
}
|
|
333
341
|
// minify: true,
|
|
@@ -790,33 +798,17 @@ class CliCreatePageBase extends BeanCliBase {
|
|
|
790
798
|
await this.logUrl(argv);
|
|
791
799
|
}
|
|
792
800
|
async logUrl(argv) {
|
|
793
|
-
const env =
|
|
801
|
+
const env = loadZovaEnvs(argv.projectPath, {
|
|
802
|
+
flavor: 'admin',
|
|
803
|
+
mode: 'development',
|
|
804
|
+
appMode: 'spa'
|
|
805
|
+
});
|
|
794
806
|
const host = !env.DEV_SERVER_HOSTNAME || env.DEV_SERVER_HOSTNAME === 'true' ? 'localhost' : env.DEV_SERVER_HOSTNAME;
|
|
795
807
|
const port = env.DEV_SERVER_PORT;
|
|
796
808
|
const url = `http://${host}:${port}/${argv.moduleInfo.pid}/${argv.moduleInfo.name}/${argv.pageName}`;
|
|
797
809
|
const message = `Page URL: ${url}`;
|
|
798
810
|
await this.console.log(message);
|
|
799
811
|
}
|
|
800
|
-
async loadEnvs() {
|
|
801
|
-
const configMeta = {
|
|
802
|
-
flavor: 'admin',
|
|
803
|
-
mode: 'development',
|
|
804
|
-
appMode: 'spa'
|
|
805
|
-
};
|
|
806
|
-
const configOptions = {
|
|
807
|
-
appDir: process.cwd(),
|
|
808
|
-
runtimeDir: '.zova',
|
|
809
|
-
zovaManualChunk: {
|
|
810
|
-
debug: false,
|
|
811
|
-
vendors: []
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
// config utils
|
|
815
|
-
const configUtils = createConfigUtils(configMeta, configOptions);
|
|
816
|
-
// env
|
|
817
|
-
const env = configUtils.loadEnvs();
|
|
818
|
-
return env;
|
|
819
|
-
}
|
|
820
812
|
}
|
|
821
813
|
|
|
822
814
|
class CliCreatePage extends CliCreatePageBase {
|
|
@@ -1527,6 +1519,12 @@ class CliOpenapiGenerate extends BeanCliBase {
|
|
|
1527
1519
|
} = this.context;
|
|
1528
1520
|
// super
|
|
1529
1521
|
await super.execute();
|
|
1522
|
+
// env
|
|
1523
|
+
loadZovaEnvs(argv.projectPath, {
|
|
1524
|
+
flavor: 'admin',
|
|
1525
|
+
mode: 'development',
|
|
1526
|
+
appMode: 'spa'
|
|
1527
|
+
});
|
|
1530
1528
|
// config file
|
|
1531
1529
|
const configFile = path.join(argv.projectPath, 'openapi.config.ts');
|
|
1532
1530
|
if (!fse.existsSync(configFile)) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { IModule } from '@cabloy/module-info';
|
|
1
|
+
import type { IModule, ZovaConfigMeta } from '@cabloy/module-info';
|
|
2
2
|
export declare function getControllerFileName(module: IModule, type: 'page' | 'component', beanName: any): "controller.ts" | "controller.tsx";
|
|
3
3
|
export declare function copyTemplateIfNeed(fileSrc: any, fileDest: any): void;
|
|
4
4
|
export declare function pathToHref(fileName: string): string;
|
|
5
|
+
export declare function loadZovaEnvs(appDir: string, configMeta: ZovaConfigMeta): {
|
|
6
|
+
[name: string]: string;
|
|
7
|
+
};
|
|
5
8
|
export declare function loadJSONFile(fileName: string): Promise<any>;
|
|
6
9
|
export declare function saveJSONFile(fileName: string, json: object): Promise<void>;
|
package/package.json
CHANGED