zova-cli-set-front 1.2.98 → 1.2.100
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);
|
|
@@ -791,33 +798,17 @@ class CliCreatePageBase extends BeanCliBase {
|
|
|
791
798
|
await this.logUrl(argv);
|
|
792
799
|
}
|
|
793
800
|
async logUrl(argv) {
|
|
794
|
-
const env =
|
|
801
|
+
const env = loadZovaEnvs(argv.projectPath, {
|
|
802
|
+
flavor: 'admin',
|
|
803
|
+
mode: 'development',
|
|
804
|
+
appMode: 'spa'
|
|
805
|
+
});
|
|
795
806
|
const host = !env.DEV_SERVER_HOSTNAME || env.DEV_SERVER_HOSTNAME === 'true' ? 'localhost' : env.DEV_SERVER_HOSTNAME;
|
|
796
807
|
const port = env.DEV_SERVER_PORT;
|
|
797
808
|
const url = `http://${host}:${port}/${argv.moduleInfo.pid}/${argv.moduleInfo.name}/${argv.pageName}`;
|
|
798
809
|
const message = `Page URL: ${url}`;
|
|
799
810
|
await this.console.log(message);
|
|
800
811
|
}
|
|
801
|
-
async loadEnvs() {
|
|
802
|
-
const configMeta = {
|
|
803
|
-
flavor: 'admin',
|
|
804
|
-
mode: 'development',
|
|
805
|
-
appMode: 'spa'
|
|
806
|
-
};
|
|
807
|
-
const configOptions = {
|
|
808
|
-
appDir: process.cwd(),
|
|
809
|
-
runtimeDir: '.zova',
|
|
810
|
-
zovaManualChunk: {
|
|
811
|
-
debug: false,
|
|
812
|
-
vendors: []
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
// config utils
|
|
816
|
-
const configUtils = createConfigUtils(configMeta, configOptions);
|
|
817
|
-
// env
|
|
818
|
-
const env = configUtils.loadEnvs();
|
|
819
|
-
return env;
|
|
820
|
-
}
|
|
821
812
|
}
|
|
822
813
|
|
|
823
814
|
class CliCreatePage extends CliCreatePageBase {
|
|
@@ -1528,6 +1519,12 @@ class CliOpenapiGenerate extends BeanCliBase {
|
|
|
1528
1519
|
} = this.context;
|
|
1529
1520
|
// super
|
|
1530
1521
|
await super.execute();
|
|
1522
|
+
// env
|
|
1523
|
+
loadZovaEnvs(argv.projectPath, {
|
|
1524
|
+
flavor: 'admin',
|
|
1525
|
+
mode: 'development',
|
|
1526
|
+
appMode: 'spa'
|
|
1527
|
+
});
|
|
1531
1528
|
// config file
|
|
1532
1529
|
const configFile = path.join(argv.projectPath, 'openapi.config.ts');
|
|
1533
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-cli-set-front",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "1.2.100",
|
|
4
|
+
"gitHead": "c408492ce774644ac8a2530702db916986f52151",
|
|
5
5
|
"description": "zova cli-set-front",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"framework",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"@babel/plugin-proposal-decorators": "^7.29.0",
|
|
37
37
|
"@babel/plugin-transform-class-properties": "^7.28.6",
|
|
38
38
|
"@babel/plugin-transform-typescript": "^7.28.6",
|
|
39
|
-
"@cabloy/cli": "^3.1.
|
|
39
|
+
"@cabloy/cli": "^3.1.29",
|
|
40
40
|
"@cabloy/extend": "^3.2.8",
|
|
41
41
|
"@cabloy/module-info": "^2.0.3",
|
|
42
42
|
"@cabloy/openapi-typescript": "^7.9.2",
|
|
43
|
-
"@cabloy/utils": "^2.1.
|
|
43
|
+
"@cabloy/utils": "^2.1.27",
|
|
44
44
|
"@cabloy/vite-plugin-babel": "^1.3.3",
|
|
45
45
|
"@cabloy/vue-babel-plugin-jsx": "^2.0.1",
|
|
46
46
|
"@cabloy/word-utils": "^2.1.14",
|
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
"vite": "^8.0.14",
|
|
66
66
|
"yaml": "^2.8.3",
|
|
67
67
|
"zova-openapi": "^1.1.17",
|
|
68
|
-
"zova-vite": "^1.1.
|
|
68
|
+
"zova-vite": "^1.1.44"
|
|
69
69
|
}
|
|
70
70
|
}
|