@simitgroup/simpleapp-generator 1.6.6-o-alpha → 1.6.6-p-alpha
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/buildinschemas/customfield.d.ts.map +1 -1
- package/dist/buildinschemas/customfield.js +13 -2
- package/dist/buildinschemas/customfield.js.map +1 -1
- package/dist/framework.d.ts +2 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +94 -57
- package/dist/framework.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +160 -34
- package/dist/generate.js.map +1 -1
- package/dist/index.js +30 -12
- package/dist/index.js.map +1 -1
- package/dist/type.d.ts +5 -0
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/customfield.ts +14 -3
- package/src/framework.ts +309 -251
- package/src/generate.ts +592 -434
- package/src/index.ts +136 -118
- package/src/type.ts +5 -0
- package/templates/basic/miniAppJsSdk/resource-bridge.service.ts.eta +117 -0
- package/templates/basic/miniAppStreamlitSdk/resource-bridge.service.ts.eta +213 -0
- package/templates/basic/nuxt/resource-bridge.service.ts.eta +162 -0
- package/templates/miniAppJsSdk/src/index.ts.eta +28 -0
- package/templates/miniAppJsSdk/src/services/bridge-resource-accessor.service.ts.eta +70 -0
- package/templates/miniAppJsSdk/src/services/bridge.service.ts.eta +91 -0
- package/templates/miniAppJsSdk/src/types/service.type.ts.eta +22 -0
- package/templates/miniAppStreamlitSdk/simtrain_eco_mini_app_streamlit_sdk/sdk.py.eta +73 -0
- package/templates/nest/src/simpleapp/apischemas/customfield.ts.eta +21 -0
- package/templates/nest/src/simpleapp/generate/jsonschemas/index.ts.eta +11 -0
- package/templates/nest/src/simpleapp/types/customfield.ts.eta +14 -0
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +2 -3
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +13 -12
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppCustomFieldClient.ts.eta +122 -125
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/common.constant.ts.eta +15 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/resource.constant.ts.eta +46 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge-resource-accessor.service.ts.eta +63 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge.service.ts.eta +110 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/bridge.type.ts.eta +72 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/resource-mapper.type.ts.eta +55 -0
- package/templates/nuxt/types/others.ts.eta +74 -65
- package/templates/nuxt/types/schema.ts.eta +225 -188
- package/templates/project/build.sh.eta +9 -0
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsolationType, SchemaType } from '../type';
|
|
1
|
+
import { IsolationType, RESTMethods, SchemaType } from '../type';
|
|
2
2
|
|
|
3
3
|
export const customfield: SchemaType = {
|
|
4
4
|
type: 'object',
|
|
@@ -7,7 +7,18 @@ export const customfield: SchemaType = {
|
|
|
7
7
|
documentName: 'customfield',
|
|
8
8
|
isolationType: IsolationType.tenant,
|
|
9
9
|
uniqueKey: 'collectionName',
|
|
10
|
-
documentTitle: 'collectionName'
|
|
10
|
+
documentTitle: 'collectionName',
|
|
11
|
+
pageType: 'pageType',
|
|
12
|
+
additionalApis: [
|
|
13
|
+
{
|
|
14
|
+
action: 'getCompleteCustomFieldResources',
|
|
15
|
+
entryPoint: 'complete-custom-field-resources',
|
|
16
|
+
requiredRole: ['Customfield_search'],
|
|
17
|
+
responseType: '[CompleteCustomFieldResource]',
|
|
18
|
+
method: RESTMethods.get,
|
|
19
|
+
description: 'Get complete custom field resources'
|
|
20
|
+
}
|
|
21
|
+
]
|
|
11
22
|
},
|
|
12
23
|
properties: {
|
|
13
24
|
_id: { type: 'string' },
|
|
@@ -35,7 +46,7 @@ export const customfield: SchemaType = {
|
|
|
35
46
|
properties: {
|
|
36
47
|
hello: {
|
|
37
48
|
type: 'string',
|
|
38
|
-
minLength: 2
|
|
49
|
+
minLength: 2
|
|
39
50
|
}
|
|
40
51
|
}
|
|
41
52
|
}
|
package/src/framework.ts
CHANGED
|
@@ -1,276 +1,334 @@
|
|
|
1
|
-
import fs, { copyFileSync, mkdirSync,existsSync, writeFileSync } from 'fs'
|
|
2
|
-
import {spawn,exec} from
|
|
3
|
-
import _ from 'lodash'
|
|
4
|
-
import { Logger, ILogObj } from
|
|
5
|
-
import * as constants from './constant'
|
|
6
|
-
import
|
|
1
|
+
import fs, { copyFileSync, mkdirSync, existsSync, writeFileSync } from 'fs';
|
|
2
|
+
import { spawn, exec } from 'child_process';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import { Logger, ILogObj } from 'tslog';
|
|
5
|
+
import * as constants from './constant';
|
|
6
|
+
import { Eta } from 'eta';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
const log: Logger<ILogObj> = new Logger();
|
|
9
9
|
|
|
10
10
|
let config = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
11
|
+
jsonschemaFolder: './jsonschemas',
|
|
12
|
+
bpmnFolder: '', //./workflows/bpmn",
|
|
13
|
+
backendFolder: './backend',
|
|
14
|
+
groupFolder: './groups',
|
|
15
|
+
langFolder: './lang',
|
|
16
|
+
backendPort: '8000',
|
|
17
|
+
mongoConnectStr: 'mongodb://127.0.0.1:27017/simpleapp',
|
|
18
|
+
mongoDbName: 'simpleapp',
|
|
19
|
+
frontendFolder: './frontend',
|
|
20
|
+
splitMobilePage: false,
|
|
21
|
+
frontendPort: '8080',
|
|
22
|
+
printFormatDir: './printformats',
|
|
23
|
+
miniAppSdkFolder: {
|
|
24
|
+
js: './miniAppSdk/js',
|
|
25
|
+
streamlit: './miniAppSdk/streamlit'
|
|
26
|
+
},
|
|
27
|
+
additionalNestModules: ['cloudapi', 'printapi'],
|
|
28
|
+
oauthSetting: {
|
|
29
|
+
oauthBaseUrl: 'https://keycloak-server-url/',
|
|
30
|
+
oauthRealm: 'realm-name',
|
|
31
|
+
oauthRealmUrl: 'https://keycloak-server-url/realms/realm-name',
|
|
32
|
+
oauthClient: 'client-id',
|
|
33
|
+
oauthClientSecret: 'client-secret-value',
|
|
34
|
+
oauthAuthSecretKey: 'my-secret',
|
|
35
|
+
adminRole: 'realmadmin'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
35
38
|
|
|
36
|
-
export const setConfiguration=(paraconfig)=>{
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
+
export const setConfiguration = (paraconfig) => {
|
|
40
|
+
config = paraconfig;
|
|
41
|
+
};
|
|
39
42
|
//create empty nest project
|
|
40
|
-
export const runCreateNest= (callback:Function) =>{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
export const runCreateNest = (callback: Function) => {
|
|
44
|
+
const backendFolder = config.backendFolder;
|
|
45
|
+
if (!fs.existsSync(backendFolder)) {
|
|
46
|
+
const child = spawn(
|
|
47
|
+
'npm',
|
|
48
|
+
[
|
|
49
|
+
'install',
|
|
50
|
+
'-g',
|
|
51
|
+
'pnpm',
|
|
52
|
+
'@nestjs/cli',
|
|
53
|
+
'@openapitools/openapi-generator-cli',
|
|
54
|
+
'nuxi'
|
|
55
|
+
],
|
|
56
|
+
{ stdio: 'inherit' }
|
|
57
|
+
);
|
|
58
|
+
child.on('close', (exitCode) => {
|
|
59
|
+
const child2 = spawn('nest', ['new', '-p', 'pnpm', backendFolder], {
|
|
60
|
+
stdio: 'inherit'
|
|
61
|
+
});
|
|
62
|
+
child2.on('close', (exitCode) => {
|
|
63
|
+
callback();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
callback();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
55
70
|
//create empty nuxt project
|
|
56
|
-
export const runCreateNuxt = (callback:Function) =>{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
callback()
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
+
export const runCreateNuxt = (callback: Function) => {
|
|
72
|
+
const frontendFolder = config.frontendFolder;
|
|
73
|
+
if (!fs.existsSync(frontendFolder)) {
|
|
74
|
+
const child3 = spawn('npx', ['nuxi@latest', 'init', frontendFolder], {
|
|
75
|
+
stdio: 'inherit'
|
|
76
|
+
});
|
|
77
|
+
child3.on('close', (exitCode) => {
|
|
78
|
+
const nuxtconfigfile = `${frontendFolder}/nuxt.config.ts`;
|
|
79
|
+
const nuxtconfigtxt =
|
|
80
|
+
'--remove-this-line-to-prevent-override--\n' +
|
|
81
|
+
fs.readFileSync(nuxtconfigfile);
|
|
82
|
+
fs.writeFileSync(nuxtconfigfile, nuxtconfigtxt);
|
|
71
83
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
//@nestjs/graphql @nestjs/apollo graphql apollo-server-express apollo-server-core
|
|
79
|
-
//@nestjs/graphql graphql-tools graphql apollo-server-express
|
|
80
|
-
exec(`cd ${targetfolder};pnpm install --save @nestjs/graphql mustache country-to-currency graphql-type-json countries-and-timezones @nestjs/apollo @apollo/server graphql @nestjs/event-emitter dayjs bpmn-server@2.1.7 @casl/ability jsonpath yaml lodash @types/lodash nest-keycloak-connect keycloak-connect bpmn-client @nestjs/serve-static jsonwebtoken axios @darkwolf/base64url json-schema @wearenova/mongoose-tenant @nestjs/swagger @nestjs/mongoose mongoose ajv ajv-formats ajv-errors @nestjs/config`,async (error, stdout, stderr)=>{
|
|
81
|
-
// log.info(`dependency installed`)
|
|
82
|
-
if(!error){
|
|
83
|
-
// fs.mkdirSync(`${targetfolder}/public_html`,{recursive:true})
|
|
84
|
-
// const eta = new Eta({views: constants.templatedir});
|
|
85
|
-
// const variables=config
|
|
86
|
-
// const txtEnv = eta.render('./nest/nest.env.eta', variables);
|
|
87
|
-
// const txtMain = eta.render('./nest/nest.main.eta', variables);
|
|
88
|
-
// const txtRedirectHtml = eta.render('./nest/oauth2-redirect.eta', variables);
|
|
84
|
+
callback();
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
callback();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
export const prepareNest = (callback: Function) => {
|
|
92
|
+
const targetfolder = config.backendFolder;
|
|
93
|
+
log.info(`creating backend project ${targetfolder}`);
|
|
94
|
+
if (!fs.existsSync(`${targetfolder}/.env`)) {
|
|
95
|
+
//@nestjs/graphql @nestjs/apollo graphql apollo-server-express apollo-server-core
|
|
96
|
+
//@nestjs/graphql graphql-tools graphql apollo-server-express
|
|
97
|
+
exec(
|
|
98
|
+
`cd ${targetfolder};pnpm install --save @nestjs/graphql mustache country-to-currency graphql-type-json countries-and-timezones @nestjs/apollo @apollo/server graphql @nestjs/event-emitter dayjs bpmn-server@2.1.7 @casl/ability jsonpath yaml lodash @types/lodash nest-keycloak-connect keycloak-connect bpmn-client @nestjs/serve-static jsonwebtoken axios @darkwolf/base64url json-schema @wearenova/mongoose-tenant @nestjs/swagger @nestjs/mongoose mongoose ajv ajv-formats ajv-errors @nestjs/config`,
|
|
99
|
+
async (error, stdout, stderr) => {
|
|
100
|
+
// log.info(`dependency installed`)
|
|
101
|
+
if (!error) {
|
|
102
|
+
// fs.mkdirSync(`${targetfolder}/public_html`,{recursive:true})
|
|
103
|
+
// const eta = new Eta({views: constants.templatedir});
|
|
104
|
+
// const variables=config
|
|
105
|
+
// const txtEnv = eta.render('./nest/nest.env.eta', variables);
|
|
106
|
+
// const txtMain = eta.render('./nest/nest.main.eta', variables);
|
|
107
|
+
// const txtRedirectHtml = eta.render('./nest/oauth2-redirect.eta', variables);
|
|
98
108
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
log.info(`${targetfolder}/.env exists, skip regenerate environment`)
|
|
109
|
-
callback()
|
|
110
|
-
}
|
|
111
|
-
}
|
|
109
|
+
// fs.writeFileSync(`${targetfolder}/.env`, txtEnv);
|
|
110
|
+
// fs.writeFileSync(`${targetfolder}/src/main.ts`, txtMain);
|
|
111
|
+
// fs.writeFileSync(`${targetfolder}/public_html/oauth2-redirect.html`, txtRedirectHtml);
|
|
112
|
+
const tsconfigpath =
|
|
113
|
+
process.cwd() + '/' + `${targetfolder}/tsconfig.json`;
|
|
114
|
+
const tsconfig = require(tsconfigpath);
|
|
115
|
+
tsconfig.compilerOptions.esModuleInterop = true;
|
|
116
|
+
tsconfig.compilerOptions.resolveJsonModule = true;
|
|
117
|
+
fs.writeFileSync(tsconfigpath, JSON.stringify(tsconfig));
|
|
112
118
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const vars = {
|
|
119
|
-
config:config
|
|
120
|
-
}
|
|
121
|
-
fs.readdirSync(`${constants.templatedir}/project`,{recursive:true}).forEach( (fullfilename)=>{
|
|
122
|
-
const templatepath = `${generateTemplatefolder}/${fullfilename}`
|
|
123
|
-
const filename:string = _.last(fullfilename.split('/'))
|
|
124
|
-
const targetfolder = dir+String(fullfilename).replace(filename,'')
|
|
125
|
-
console.log("Filename",targetfolder, filename)
|
|
126
|
-
if(targetfolder && !existsSync(targetfolder)){
|
|
127
|
-
console.log("Write directory",targetfolder)
|
|
128
|
-
mkdirSync(targetfolder,{recursive:true})
|
|
129
|
-
}
|
|
130
|
-
if(filename.includes('.eta')){
|
|
131
|
-
const tofilename =targetfolder + filename.replace('.eta','')
|
|
132
|
-
log.info(tofilename,"Render file")
|
|
133
|
-
const txt = eta.render(fullfilename,vars)
|
|
134
|
-
// log.info(fullfilename+"====>>"+tofilename)
|
|
135
|
-
// console.log(txt)
|
|
136
|
-
writeFileSync(tofilename,txt)
|
|
137
|
-
}else if(filename.includes('._eta')){
|
|
138
|
-
const tofilename =targetfolder + filename.replace('._eta','')
|
|
139
|
-
log.info(tofilename,"Render file")
|
|
140
|
-
const txt = eta.render(fullfilename,vars)
|
|
141
|
-
if(!existsSync(tofilename)){
|
|
142
|
-
writeFileSync(tofilename,txt)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
}else if(filename.includes('.md')){
|
|
146
|
-
const tofilename =dir + filename.replace('.eta','')
|
|
147
|
-
log.info(tofilename,"Copy")
|
|
148
|
-
copyFileSync(templatepath ,tofilename)
|
|
119
|
+
log.info('nest project completed');
|
|
120
|
+
callback();
|
|
121
|
+
} else {
|
|
122
|
+
log.error(stderr);
|
|
123
|
+
throw error;
|
|
149
124
|
}
|
|
150
|
-
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
} else {
|
|
128
|
+
log.info(`${targetfolder}/.env exists, skip regenerate environment`);
|
|
129
|
+
callback();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
151
132
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
133
|
+
export const prepareProject = async (callback) => {
|
|
134
|
+
const dir = process.cwd() + '/';
|
|
135
|
+
log.info('prepareProject');
|
|
136
|
+
const generateTemplatefolder = `${constants.templatedir}/project/`;
|
|
137
|
+
const eta = new Eta({ views: generateTemplatefolder });
|
|
138
|
+
const vars = {
|
|
139
|
+
config: config
|
|
140
|
+
};
|
|
141
|
+
fs.readdirSync(`${constants.templatedir}/project`, {
|
|
142
|
+
recursive: true
|
|
143
|
+
}).forEach((fullfilename) => {
|
|
144
|
+
const templatepath = `${generateTemplatefolder}/${fullfilename}`;
|
|
145
|
+
const filename: string = _.last(fullfilename.split('/'));
|
|
146
|
+
const targetfolder = dir + String(fullfilename).replace(filename, '');
|
|
147
|
+
console.log('Filename', targetfolder, filename);
|
|
148
|
+
if (targetfolder && !existsSync(targetfolder)) {
|
|
149
|
+
console.log('Write directory', targetfolder);
|
|
150
|
+
mkdirSync(targetfolder, { recursive: true });
|
|
151
|
+
}
|
|
152
|
+
if (filename.includes('.eta')) {
|
|
153
|
+
const tofilename = targetfolder + filename.replace('.eta', '');
|
|
154
|
+
log.info(tofilename, 'Render file');
|
|
155
|
+
const txt = eta.render(fullfilename, vars);
|
|
156
|
+
// log.info(fullfilename+"====>>"+tofilename)
|
|
157
|
+
// console.log(txt)
|
|
158
|
+
writeFileSync(tofilename, txt);
|
|
159
|
+
} else if (filename.includes('._eta')) {
|
|
160
|
+
const tofilename = targetfolder + filename.replace('._eta', '');
|
|
161
|
+
log.info(tofilename, 'Render file');
|
|
162
|
+
const txt = eta.render(fullfilename, vars);
|
|
163
|
+
if (!existsSync(tofilename)) {
|
|
164
|
+
writeFileSync(tofilename, txt);
|
|
165
|
+
}
|
|
166
|
+
} else if (filename.includes('.md')) {
|
|
167
|
+
const tofilename = dir + filename.replace('.eta', '');
|
|
168
|
+
log.info(tofilename, 'Copy');
|
|
169
|
+
copyFileSync(templatepath, tofilename);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
157
172
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
173
|
+
await exec(`npx prettier --write . `, () => {
|
|
174
|
+
callback();
|
|
175
|
+
});
|
|
161
176
|
|
|
162
|
-
}
|
|
177
|
+
// fs.mkdirSync(`${dir}/groups`,{recursive:true})
|
|
178
|
+
// fs.mkdirSync(`${dir}/schemas`,{recursive:true})
|
|
179
|
+
// fs.mkdirSync(`${dir}/shares`,{recursive:true})
|
|
180
|
+
};
|
|
163
181
|
//prepare nuxt project for simpleapp generator
|
|
164
|
-
export const prepareNuxt = (callback:Function)=>{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
182
|
+
export const prepareNuxt = (callback: Function) => {
|
|
183
|
+
const targetfolder = config.frontendFolder;
|
|
184
|
+
if (!fs.existsSync(`${targetfolder}/.env`)) {
|
|
185
|
+
//asume no environment. prepare now
|
|
186
|
+
exec(
|
|
187
|
+
`cd ${targetfolder};pnpm install;pnpm install -D @nuxtjs/apollo@next dayjs-nuxt @nuxtjs/device @nuxtjs/color-mode @types/json-schema @nuxtjs/i18n@next @nuxtjs/tailwindcss @types/jsonpath @sidebase/nuxt-auth @types/node @vueuse/nuxt @sidebase/nuxt-auth @vueuse/core prettier @primevue/core primevue tailwindcss-primeui`,
|
|
188
|
+
(error, stdout, stderr) => {
|
|
189
|
+
//;pnpm install
|
|
190
|
+
console.log(error, stdout, stderr);
|
|
191
|
+
exec(
|
|
192
|
+
`cd ${targetfolder};pnpm install --save vue-camera-lib vue-pdf-embed dayjs pusher-js country-code-dateformat chart.js tailwind-merge @iconify-json/heroicons json-schema @vueuse/core ts-md5 primeicons memory-cache jsonpath pinia @pinia/nuxt @nuxt/kit lodash @types/lodash @darkwolf/base64url next-auth@4.21.1 @darkwolf/base64url @nuxt/ui ajv ajv-formats ajv-errors dotenv @fullcalendar/core @fullcalendar/vue3 quill prettier axios json-schema mitt @primevue/nuxt-module lru-cache vue-advanced-cropper@vue-3`,
|
|
193
|
+
(error, stdout, stderr) => {
|
|
194
|
+
console.log(error, stdout, stderr);
|
|
173
195
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
196
|
+
// copy nuxt primevue tailwind preset to folder
|
|
197
|
+
const copyFolderRecursiveSync = (
|
|
198
|
+
source: string,
|
|
199
|
+
target: string
|
|
200
|
+
) => {
|
|
201
|
+
// Check if folder needs to be created or integrated
|
|
202
|
+
const targetFolder = path.join(target, path.basename(source));
|
|
203
|
+
if (!fs.existsSync(targetFolder)) {
|
|
204
|
+
fs.mkdirSync(targetFolder, { recursive: true });
|
|
205
|
+
}
|
|
181
206
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
207
|
+
// Copy
|
|
208
|
+
if (fs.lstatSync(source).isDirectory()) {
|
|
209
|
+
const files = fs.readdirSync(source);
|
|
210
|
+
files.forEach((file) => {
|
|
211
|
+
const curSource = path.join(source, file);
|
|
212
|
+
if (fs.lstatSync(curSource).isDirectory()) {
|
|
213
|
+
copyFolderRecursiveSync(curSource, targetFolder);
|
|
214
|
+
} else {
|
|
215
|
+
fs.copyFileSync(curSource, path.join(targetFolder, file));
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
};
|
|
195
220
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
// fs.mkdirSync(`${targetfolder}/server/api/[xorg]`,{recursive:true})
|
|
204
|
-
// fs.mkdirSync(`${targetfolder}/server/api/auth`,{recursive:true})
|
|
205
|
-
// fs.mkdirSync(`${targetfolder}/pages/[xorg]`,{recursive:true})
|
|
206
|
-
// fs.mkdirSync(`${targetfolder}/plugins`,{recursive:true})
|
|
207
|
-
// const eta = new Eta({views: `${constants.templatedir}/nuxt`});
|
|
208
|
-
// const variables=config
|
|
209
|
-
// const writes = {
|
|
210
|
-
// './app.vue.eta':'app.vue',
|
|
211
|
-
// './layouts.default.vue.eta':'layouts/default.vue',
|
|
212
|
-
// './server.api.ts.eta':'server/api/[xorg]/[...].ts',
|
|
213
|
-
// './server.api.auth.logout.ts.eta':'server/api/auth/logout.ts',
|
|
214
|
-
// './server.api.auth[...].ts.eta':'server/api/auth/[...].ts',
|
|
215
|
-
// './nuxt.config.ts.eta':'nuxt.config.ts',
|
|
216
|
-
// './pages.index.vue.eta':'pages/index.vue',
|
|
217
|
-
// './pages.[xorg].index.vue.eta':'pages/[xorg]/index.vue',
|
|
218
|
-
// './pages.login.vue.eta':'pages/login.vue',
|
|
219
|
-
// './plugins.10.simpleapp.ts.eta':'plugins/10.simpleapp.ts',
|
|
220
|
-
// './tailwind.config.ts.eta':'tailwind.config.ts',
|
|
221
|
-
// './tailwind.css.eta':'assets/css/tailwind.css',
|
|
222
|
-
// './env.eta':'.env',
|
|
223
|
-
// }
|
|
224
|
-
|
|
225
|
-
// const templates = Object.getOwnPropertyNames(writes)
|
|
226
|
-
// for(let i=0; i<templates.length;i++){
|
|
227
|
-
// const template = templates[i]
|
|
228
|
-
// const filename = writes[template]
|
|
229
|
-
// const txt = eta.render(template, variables);
|
|
230
|
-
// const file =`${targetfolder}/${filename}`
|
|
231
|
-
// log.info("writing ",file)
|
|
232
|
-
// fs.writeFileSync(file, txt);
|
|
233
|
-
// }
|
|
234
|
-
|
|
221
|
+
// Define source and target folders
|
|
222
|
+
const sourceFolder = path.join(
|
|
223
|
+
constants.templatedir,
|
|
224
|
+
'nuxt',
|
|
225
|
+
'presets'
|
|
226
|
+
);
|
|
227
|
+
copyFolderRecursiveSync(sourceFolder, config.frontendFolder);
|
|
235
228
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
229
|
+
// fs.mkdirSync(`${targetfolder}/assets/css/`,{recursive:true})
|
|
230
|
+
// fs.mkdirSync(`${targetfolder}/layouts`,{recursive:true})
|
|
231
|
+
// fs.mkdirSync(`${targetfolder}/components`,{recursive:true})
|
|
232
|
+
// fs.mkdirSync(`${targetfolder}/server/api/[xorg]`,{recursive:true})
|
|
233
|
+
// fs.mkdirSync(`${targetfolder}/server/api/auth`,{recursive:true})
|
|
234
|
+
// fs.mkdirSync(`${targetfolder}/pages/[xorg]`,{recursive:true})
|
|
235
|
+
// fs.mkdirSync(`${targetfolder}/plugins`,{recursive:true})
|
|
236
|
+
// const eta = new Eta({views: `${constants.templatedir}/nuxt`});
|
|
237
|
+
// const variables=config
|
|
238
|
+
// const writes = {
|
|
239
|
+
// './app.vue.eta':'app.vue',
|
|
240
|
+
// './layouts.default.vue.eta':'layouts/default.vue',
|
|
241
|
+
// './server.api.ts.eta':'server/api/[xorg]/[...].ts',
|
|
242
|
+
// './server.api.auth.logout.ts.eta':'server/api/auth/logout.ts',
|
|
243
|
+
// './server.api.auth[...].ts.eta':'server/api/auth/[...].ts',
|
|
244
|
+
// './nuxt.config.ts.eta':'nuxt.config.ts',
|
|
245
|
+
// './pages.index.vue.eta':'pages/index.vue',
|
|
246
|
+
// './pages.[xorg].index.vue.eta':'pages/[xorg]/index.vue',
|
|
247
|
+
// './pages.login.vue.eta':'pages/login.vue',
|
|
248
|
+
// './plugins.10.simpleapp.ts.eta':'plugins/10.simpleapp.ts',
|
|
249
|
+
// './tailwind.config.ts.eta':'tailwind.config.ts',
|
|
250
|
+
// './tailwind.css.eta':'assets/css/tailwind.css',
|
|
251
|
+
// './env.eta':'.env',
|
|
252
|
+
// }
|
|
253
|
+
|
|
254
|
+
// const templates = Object.getOwnPropertyNames(writes)
|
|
255
|
+
// for(let i=0; i<templates.length;i++){
|
|
256
|
+
// const template = templates[i]
|
|
257
|
+
// const filename = writes[template]
|
|
258
|
+
// const txt = eta.render(template, variables);
|
|
259
|
+
// const file =`${targetfolder}/${filename}`
|
|
260
|
+
// log.info("writing ",file)
|
|
261
|
+
// fs.writeFileSync(file, txt);
|
|
262
|
+
// }
|
|
263
|
+
|
|
264
|
+
// const frontendtsconfigpath = process.cwd()+'/'+`${targetfolder}/tsconfig.json`
|
|
265
|
+
// const frontendtsconfig ={
|
|
266
|
+
// "extends": "./.nuxt/tsconfig.json",
|
|
267
|
+
// "compilerOptions": {
|
|
268
|
+
// "strictNullChecks":false
|
|
269
|
+
// }
|
|
270
|
+
// }
|
|
271
|
+
// fs.writeFileSync(frontendtsconfigpath, JSON.stringify(frontendtsconfig));
|
|
272
|
+
// exec(`openapi-generator-cli generate -i ${config.backendFolder}/openapi.yaml -o ${config.frontendFolder}/generate/openapi -g typescript-axios --skip-validate-spec`)
|
|
273
|
+
// log.info("nuxt project completed")
|
|
274
|
+
callback();
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
} else {
|
|
280
|
+
//assume environment ready
|
|
281
|
+
callback();
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export const prettyMiniAppJsSdk = () => {
|
|
286
|
+
exec(
|
|
287
|
+
`npx prettier --write ${config.miniAppSdkFolder.js}/src/**/* --ignore-path .my-empty-ignore`
|
|
288
|
+
);
|
|
289
|
+
};
|
|
290
|
+
export const prettyMiniAppStreamlitSdk = () => {
|
|
291
|
+
// exec(
|
|
292
|
+
// `npx prettier --write ${config.miniAppSdkFolder.streamlit}/simtrain_eco_mini_app_streamlit_sdk/**/* --ignore-path .my-empty-ignore`
|
|
293
|
+
// );
|
|
294
|
+
};
|
|
255
295
|
|
|
256
|
-
export const prettyNuxt = ()=>{
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
296
|
+
export const prettyNuxt = () => {
|
|
297
|
+
console.log('Formatting Nuxt...');
|
|
298
|
+
prepareOpenApiClient();
|
|
299
|
+
exec(
|
|
300
|
+
`cd ${config.frontendFolder};npx prettier --write "./pages/**/*.vue" "./components/**/*.vue" "./generate/*/*.ts" `
|
|
301
|
+
);
|
|
302
|
+
exec(
|
|
303
|
+
`npx prettier --write ${config.frontendFolder}/simpleapp/generate/clients/*.ts ${config.frontendFolder}/simpleapp/generate/miniApp/**/*.ts`
|
|
304
|
+
);
|
|
305
|
+
};
|
|
261
306
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
307
|
+
export const prettyNest = () => {
|
|
308
|
+
console.log('Formatting Nest...');
|
|
309
|
+
exec(
|
|
310
|
+
`cd ${config.backendFolder};npm run format;npx prettier --write src/dicts/foreignkeys.json`
|
|
311
|
+
);
|
|
312
|
+
};
|
|
268
313
|
|
|
269
314
|
export const prepareOpenApiClient = () => {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
315
|
+
const executestr = `openapi-generator-cli generate -i ${config.backendFolder}/openapi.yaml -o ${config.frontendFolder}/generate/openapi -g typescript-axios --skip-validate-spec`;
|
|
316
|
+
log.info('execute generate openapi:');
|
|
317
|
+
log.info(executestr);
|
|
273
318
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
319
|
+
const child5 = spawn(
|
|
320
|
+
'openapi-generator-cli',
|
|
321
|
+
[
|
|
322
|
+
'generate',
|
|
323
|
+
'-i',
|
|
324
|
+
`${config.backendFolder}/openapi.yaml`,
|
|
325
|
+
'-o',
|
|
326
|
+
`${config.frontendFolder}/simpleapp/generate/openapi`,
|
|
327
|
+
'-g',
|
|
328
|
+
'typescript-axios',
|
|
329
|
+
'--skip-validate-spec'
|
|
330
|
+
],
|
|
331
|
+
{ stdio: 'inherit' }
|
|
332
|
+
);
|
|
333
|
+
// exec(executestr)
|
|
334
|
+
};
|