proteum 1.0.3 → 2.0.0
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/AGENTS.md +92 -0
- package/agents/codex/AGENTS.md +95 -0
- package/agents/codex/CODING_STYLE.md +71 -0
- package/agents/codex/agents.md.zip +0 -0
- package/agents/codex/client/AGENTS.md +102 -0
- package/agents/codex/client/pages/AGENTS.md +35 -0
- package/agents/codex/server/routes/AGENTS.md +12 -0
- package/agents/codex/server/services/AGENTS.md +137 -0
- package/agents/codex/tests/AGENTS.md +8 -0
- package/cli/app/config.ts +12 -17
- package/cli/app/index.ts +59 -99
- package/cli/bin.js +1 -1
- package/cli/commands/build.ts +23 -12
- package/cli/commands/check.ts +19 -0
- package/cli/commands/deploy/app.ts +4 -8
- package/cli/commands/deploy/web.ts +16 -20
- package/cli/commands/dev.ts +185 -75
- package/cli/commands/devEvents.ts +106 -0
- package/cli/commands/init.ts +63 -57
- package/cli/commands/lint.ts +21 -0
- package/cli/commands/refresh.ts +6 -6
- package/cli/commands/typecheck.ts +18 -0
- package/cli/compiler/client/identite.ts +79 -49
- package/cli/compiler/client/index.ts +132 -214
- package/cli/compiler/common/bundleAnalysis.ts +94 -0
- package/cli/compiler/common/clientManifest.ts +67 -0
- package/cli/compiler/common/controllers.ts +288 -0
- package/cli/compiler/common/files/autres.ts +7 -18
- package/cli/compiler/common/files/images.ts +40 -37
- package/cli/compiler/common/files/style.ts +12 -25
- package/cli/compiler/common/generatedRouteModules.ts +368 -0
- package/cli/compiler/common/index.ts +29 -68
- package/cli/compiler/common/loaders/forbid-ssr-import.js +13 -0
- package/cli/compiler/common/rspackAliases.ts +13 -0
- package/cli/compiler/common/scripts.ts +37 -0
- package/cli/compiler/index.ts +764 -234
- package/cli/compiler/server/index.ts +52 -77
- package/cli/compiler/writeIfChanged.ts +21 -0
- package/cli/index.ts +65 -90
- package/cli/paths.ts +51 -57
- package/cli/print.ts +17 -11
- package/cli/tsconfig.json +5 -4
- package/cli/utils/agents.ts +100 -0
- package/cli/utils/check.ts +71 -0
- package/cli/utils/index.ts +1 -3
- package/cli/utils/keyboard.ts +8 -25
- package/cli/utils/runProcess.ts +30 -0
- package/client/app/component.tsx +29 -29
- package/client/app/index.ts +36 -57
- package/client/app/service.ts +7 -12
- package/client/app.tsconfig.json +2 -2
- package/client/components/Dialog/Manager.ssr.tsx +40 -0
- package/client/components/Dialog/Manager.tsx +119 -150
- package/client/components/Dialog/status.tsx +3 -3
- package/client/components/index.ts +1 -1
- package/client/components/types.d.ts +1 -3
- package/client/dev/hmr.ts +65 -0
- package/client/global.d.ts +2 -2
- package/client/hooks.ts +6 -9
- package/client/index.ts +2 -1
- package/client/islands/index.ts +7 -0
- package/client/islands/useDeferredModule.ts +199 -0
- package/client/pages/_layout/index.tsx +4 -12
- package/client/pages/useHeader.tsx +14 -21
- package/client/router.ts +27 -0
- package/client/services/router/components/Link.tsx +34 -27
- package/client/services/router/components/Page.tsx +6 -14
- package/client/services/router/components/router.ssr.tsx +36 -0
- package/client/services/router/components/router.tsx +63 -83
- package/client/services/router/index.tsx +185 -220
- package/client/services/router/request/api.ts +97 -119
- package/client/services/router/request/history.ts +2 -2
- package/client/services/router/request/index.ts +13 -12
- package/client/services/router/request/multipart.ts +72 -62
- package/client/services/router/response/index.tsx +68 -61
- package/client/services/router/response/page.ts +28 -32
- package/client/utils/dom.ts +17 -33
- package/common/app/index.ts +3 -3
- package/common/data/chaines/index.ts +22 -23
- package/common/data/dates.ts +35 -70
- package/common/data/markdown.ts +42 -39
- package/common/dev/serverHotReload.ts +26 -0
- package/common/errors/index.tsx +110 -142
- package/common/router/contracts.ts +29 -0
- package/common/router/index.ts +89 -108
- package/common/router/layouts.ts +34 -47
- package/common/router/pageSetup.ts +50 -0
- package/common/router/register.ts +53 -24
- package/common/router/request/api.ts +30 -36
- package/common/router/request/index.ts +2 -8
- package/common/router/response/index.ts +8 -15
- package/common/router/response/page.ts +70 -58
- package/common/utils.ts +1 -1
- package/eslint.js +62 -0
- package/package.json +12 -45
- package/prettier.config.cjs +9 -0
- package/scripts/cleanup-generated-controllers.ts +62 -0
- package/scripts/fix-reference-app-typing.ts +490 -0
- package/scripts/refactor-client-app-imports.ts +244 -0
- package/scripts/refactor-client-pages.ts +587 -0
- package/scripts/refactor-server-controllers.ts +470 -0
- package/scripts/refactor-server-runtime-aliases.ts +360 -0
- package/scripts/restore-client-app-import-files.ts +41 -0
- package/scripts/restore-files-from-git-head.ts +20 -0
- package/scripts/update-codex-agents.ts +35 -0
- package/server/app/commands.ts +35 -64
- package/server/app/container/config.ts +39 -69
- package/server/app/container/console/index.ts +202 -248
- package/server/app/container/index.ts +33 -71
- package/server/app/controller/index.ts +61 -0
- package/server/app/index.ts +39 -105
- package/server/app/service/container.ts +41 -42
- package/server/app/service/index.ts +120 -147
- package/server/context.ts +1 -1
- package/server/index.ts +25 -1
- package/server/services/auth/index.ts +75 -115
- package/server/services/auth/router/index.ts +31 -32
- package/server/services/auth/router/request.ts +14 -16
- package/server/services/cron/CronTask.ts +13 -26
- package/server/services/cron/index.ts +14 -36
- package/server/services/disks/driver.ts +40 -58
- package/server/services/disks/drivers/local/index.ts +79 -90
- package/server/services/disks/drivers/s3/index.ts +116 -163
- package/server/services/disks/index.ts +23 -38
- package/server/services/email/index.ts +45 -104
- package/server/services/email/utils.ts +14 -27
- package/server/services/fetch/index.ts +53 -85
- package/server/services/prisma/Facet.ts +39 -91
- package/server/services/prisma/index.ts +74 -110
- package/server/services/router/generatedRuntime.ts +29 -0
- package/server/services/router/http/index.ts +77 -72
- package/server/services/router/http/multipart.ts +19 -42
- package/server/services/router/index.ts +378 -365
- package/server/services/router/request/api.ts +26 -25
- package/server/services/router/request/index.ts +44 -51
- package/server/services/router/request/service.ts +7 -11
- package/server/services/router/request/validation/zod.ts +111 -148
- package/server/services/router/response/index.ts +110 -125
- package/server/services/router/response/mask/Filter.ts +31 -72
- package/server/services/router/response/mask/index.ts +8 -15
- package/server/services/router/response/mask/selecteurs.ts +11 -25
- package/server/services/router/response/page/clientManifest.ts +25 -0
- package/server/services/router/response/page/document.tsx +199 -127
- package/server/services/router/response/page/index.tsx +89 -94
- package/server/services/router/service.ts +13 -15
- package/server/services/schema/index.ts +17 -26
- package/server/services/schema/request.ts +19 -33
- package/server/services/schema/router/index.ts +8 -11
- package/server/services/security/encrypt/aes/index.ts +15 -35
- package/server/utils/slug.ts +29 -32
- package/skills/clean-project-code/SKILL.md +63 -0
- package/skills/clean-project-code/agents/openai.yaml +4 -0
- package/tsconfig.common.json +4 -3
- package/tsconfig.json +4 -1
- package/types/aliases.d.ts +17 -21
- package/types/controller-input.test.ts +48 -0
- package/types/express-extra.d.ts +6 -0
- package/types/global/constants.d.ts +1 -0
- package/types/global/express-extra.d.ts +6 -0
- package/types/global/modules.d.ts +13 -16
- package/types/global/utils.d.ts +17 -49
- package/types/global/vendors.d.ts +62 -0
- package/types/icons.d.ts +65 -1
- package/types/uuid.d.ts +3 -0
- package/types/vendors.d.ts +62 -0
- package/cli/compiler/common/babel/index.ts +0 -173
- package/cli/compiler/common/babel/plugins/index.ts +0 -0
- package/cli/compiler/common/babel/plugins/services.ts +0 -586
- package/cli/compiler/common/babel/routes/imports.ts +0 -127
- package/cli/compiler/common/babel/routes/routes.ts +0 -1170
- package/client/services/captcha/index.ts +0 -67
- package/client/services/socket/index.ts +0 -147
- package/common/data/rte/nodes.ts +0 -83
- package/common/data/stats.ts +0 -90
- package/common/utils/rte.ts +0 -183
- package/server/services/auth/old.ts +0 -277
- package/server/services/cache/commands.ts +0 -41
- package/server/services/cache/index.ts +0 -297
- package/server/services/cache/service.json +0 -6
- package/server/services/socket/index.ts +0 -162
- package/server/services/socket/scope.ts +0 -226
- package/server/services/socket/service.json +0 -6
- package/server/services_old/SocketClient.ts +0 -92
- package/server/services_old/Token.old.ts +0 -97
package/cli/app/index.ts
CHANGED
|
@@ -18,47 +18,30 @@ import type { TEnvConfig } from '../../server/app/container/config';
|
|
|
18
18
|
- TYPES
|
|
19
19
|
----------------------------------*/
|
|
20
20
|
|
|
21
|
-
export type TAppSide = 'server' | 'client'
|
|
22
|
-
|
|
23
|
-
type TServiceSetup = {
|
|
24
|
-
id: string,
|
|
25
|
-
name: string,
|
|
26
|
-
config: {},
|
|
27
|
-
subservices: TServiceSubservices,
|
|
28
|
-
type: 'service.setup'
|
|
29
|
-
}
|
|
21
|
+
export type TAppSide = 'server' | 'client';
|
|
30
22
|
|
|
31
|
-
type
|
|
32
|
-
refTo: string,
|
|
33
|
-
type: 'service.ref'
|
|
34
|
-
}
|
|
23
|
+
type TServiceSetup = { id: string; name: string; config: {}; subservices: TServiceSubservices; type: 'service.setup' };
|
|
35
24
|
|
|
36
|
-
type
|
|
37
|
-
[key: string]: TServiceSetup | TServiceRef
|
|
38
|
-
}
|
|
25
|
+
type TServiceRef = { refTo: string; type: 'service.ref' };
|
|
39
26
|
|
|
40
|
-
|
|
41
|
-
rawPort: string | boolean | string[] | undefined
|
|
42
|
-
): number | undefined => {
|
|
27
|
+
type TServiceSubservices = { [key: string]: TServiceSetup | TServiceRef };
|
|
43
28
|
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
const parseRouterPortOverride = (rawPort: string | boolean | string[] | undefined): number | undefined => {
|
|
30
|
+
if (rawPort === undefined || rawPort === '') return undefined;
|
|
46
31
|
|
|
47
|
-
if (typeof rawPort !== 'string')
|
|
48
|
-
throw new Error(`Invalid value for -port: expected a numeric value.`);
|
|
32
|
+
if (typeof rawPort !== 'string') throw new Error(`Invalid value for -port: expected a numeric value.`);
|
|
49
33
|
|
|
50
34
|
const port = Number(rawPort);
|
|
51
35
|
if (!Number.isInteger(port) || port < 1 || port > 65535)
|
|
52
36
|
throw new Error(`Invalid value for -port: "${rawPort}". Expected an integer between 1 and 65535.`);
|
|
53
37
|
|
|
54
38
|
return port;
|
|
55
|
-
}
|
|
39
|
+
};
|
|
56
40
|
|
|
57
41
|
/*----------------------------------
|
|
58
42
|
- SERVICE
|
|
59
43
|
----------------------------------*/
|
|
60
44
|
export class App {
|
|
61
|
-
|
|
62
45
|
// config
|
|
63
46
|
// WARNING: High level config files (env and services) shouldn't be loaded from the CLI
|
|
64
47
|
// The CLI will be run on CircleCI, and no env file should be sent to this service
|
|
@@ -68,37 +51,32 @@ export class App {
|
|
|
68
51
|
|
|
69
52
|
public routerPortOverride?: number;
|
|
70
53
|
|
|
71
|
-
public
|
|
54
|
+
public devEventPort?: number;
|
|
55
|
+
|
|
56
|
+
public packageJson: { [key: string]: any };
|
|
72
57
|
|
|
73
58
|
public buildId: number = Date.now();
|
|
74
59
|
|
|
75
60
|
public paths = {
|
|
76
|
-
|
|
77
61
|
root: cli.paths.appRoot,
|
|
78
|
-
bin: path.join(
|
|
79
|
-
dev: path.join(
|
|
80
|
-
data: path.join(
|
|
81
|
-
public: path.join(
|
|
82
|
-
pages: path.join(
|
|
83
|
-
cache: path.join(
|
|
84
|
-
|
|
85
|
-
client: {
|
|
86
|
-
generated: path.join( cli.paths.appRoot, 'client', '.generated')
|
|
87
|
-
},
|
|
62
|
+
bin: path.join(cli.paths.appRoot, 'bin'),
|
|
63
|
+
dev: path.join(cli.paths.appRoot, 'dev'),
|
|
64
|
+
data: path.join(cli.paths.appRoot, 'var', 'data'),
|
|
65
|
+
public: path.join(cli.paths.appRoot, 'public'),
|
|
66
|
+
pages: path.join(cli.paths.appRoot, 'client', 'pages'),
|
|
67
|
+
cache: path.join(cli.paths.appRoot, '.cache'),
|
|
68
|
+
|
|
69
|
+
client: { generated: path.join(cli.paths.appRoot, 'client', '.generated') },
|
|
88
70
|
server: {
|
|
89
|
-
generated: path.join(
|
|
90
|
-
configs: path.join(
|
|
91
|
-
},
|
|
92
|
-
common: {
|
|
93
|
-
generated: path.join( cli.paths.appRoot, 'common', '.generated')
|
|
71
|
+
generated: path.join(cli.paths.appRoot, 'server', '.generated'),
|
|
72
|
+
configs: path.join(cli.paths.appRoot, 'server', 'app'),
|
|
94
73
|
},
|
|
95
|
-
|
|
96
|
-
withAlias: (filename: string, side: TAppSide) =>
|
|
97
|
-
this.aliases[side].apply(filename),
|
|
74
|
+
common: { generated: path.join(cli.paths.appRoot, 'common', '.generated') },
|
|
98
75
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
76
|
+
withAlias: (filename: string, side: TAppSide) => this.aliases[side].apply(filename),
|
|
77
|
+
|
|
78
|
+
withoutAlias: (filename: string, side: TAppSide) => this.aliases[side].realpath(filename),
|
|
79
|
+
};
|
|
102
80
|
|
|
103
81
|
public containerServices = [
|
|
104
82
|
//'Services',
|
|
@@ -107,28 +85,20 @@ export class App {
|
|
|
107
85
|
/*'Application',
|
|
108
86
|
'Path',
|
|
109
87
|
'Event'*/
|
|
110
|
-
]
|
|
88
|
+
];
|
|
111
89
|
|
|
112
90
|
public constructor() {
|
|
113
|
-
|
|
114
91
|
cli.debug && console.log(`[cli] Loading app config ...`);
|
|
115
|
-
this.routerPortOverride = parseRouterPortOverride(
|
|
92
|
+
this.routerPortOverride = parseRouterPortOverride(cli.args.port);
|
|
116
93
|
|
|
117
|
-
const configParser = new ConfigParser(
|
|
118
|
-
cli.paths.appRoot,
|
|
119
|
-
undefined,
|
|
120
|
-
this.routerPortOverride
|
|
121
|
-
);
|
|
94
|
+
const configParser = new ConfigParser(cli.paths.appRoot, undefined, this.routerPortOverride);
|
|
122
95
|
this.identity = configParser.identity();
|
|
123
96
|
this.env = configParser.env();
|
|
124
97
|
this.packageJson = this.loadPkg();
|
|
125
|
-
|
|
126
98
|
}
|
|
127
99
|
|
|
128
100
|
public outputPath(target: 'dev' | 'bin') {
|
|
129
|
-
return target === 'dev'
|
|
130
|
-
? this.paths.dev
|
|
131
|
-
: this.paths.bin;
|
|
101
|
+
return target === 'dev' ? this.paths.dev : this.paths.bin;
|
|
132
102
|
}
|
|
133
103
|
|
|
134
104
|
/*----------------------------------
|
|
@@ -138,21 +108,15 @@ export class App {
|
|
|
138
108
|
public aliases = {
|
|
139
109
|
client: new TsAlias({
|
|
140
110
|
rootDir: this.paths.root + '/client',
|
|
141
|
-
modulesDir: [
|
|
142
|
-
|
|
143
|
-
cli.paths.coreRoot + '/node_modules'
|
|
144
|
-
],
|
|
145
|
-
debug: false
|
|
111
|
+
modulesDir: [cli.paths.appRoot + '/node_modules', cli.paths.coreRoot + '/node_modules'],
|
|
112
|
+
debug: false,
|
|
146
113
|
}),
|
|
147
114
|
server: new TsAlias({
|
|
148
115
|
rootDir: this.paths.root + '/server',
|
|
149
|
-
modulesDir: [
|
|
150
|
-
|
|
151
|
-
cli.paths.coreRoot + '/node_modules'
|
|
152
|
-
],
|
|
153
|
-
debug: false
|
|
116
|
+
modulesDir: [cli.paths.appRoot + '/node_modules', cli.paths.coreRoot + '/node_modules'],
|
|
117
|
+
debug: false,
|
|
154
118
|
}),
|
|
155
|
-
}
|
|
119
|
+
};
|
|
156
120
|
|
|
157
121
|
private loadPkg() {
|
|
158
122
|
return fs.readJSONSync(this.paths.root + '/package.json');
|
|
@@ -162,66 +126,62 @@ export class App {
|
|
|
162
126
|
- WARMUP (Services awareness)
|
|
163
127
|
----------------------------------*/
|
|
164
128
|
|
|
165
|
-
public registered = {}
|
|
166
|
-
|
|
167
|
-
public use( referenceName: string ): TServiceRef {
|
|
129
|
+
public registered = {};
|
|
168
130
|
|
|
131
|
+
public use(referenceName: string): TServiceRef {
|
|
169
132
|
// We don't check because all service are not regstered when we register subservices
|
|
170
133
|
/*if (this.registered[referenceName] === undefined) {
|
|
171
134
|
throw new Error(`Service ${referenceName} is not registered`);
|
|
172
135
|
}*/
|
|
173
136
|
|
|
174
|
-
return {
|
|
175
|
-
refTo: referenceName,
|
|
176
|
-
type: 'service.ref'
|
|
177
|
-
}
|
|
137
|
+
return { refTo: referenceName, type: 'service.ref' };
|
|
178
138
|
}
|
|
179
139
|
|
|
180
|
-
public setup(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
140
|
+
public setup(
|
|
141
|
+
...args:
|
|
142
|
+
| [
|
|
143
|
+
// { user: app.setup('Core/User') }
|
|
144
|
+
servicePath: string,
|
|
145
|
+
serviceConfig?: {},
|
|
146
|
+
]
|
|
147
|
+
| [
|
|
148
|
+
// app.setup('User', 'Core/User')
|
|
149
|
+
serviceName: string,
|
|
150
|
+
servicePath: string,
|
|
151
|
+
serviceConfig?: {},
|
|
152
|
+
]
|
|
153
|
+
): TServiceSetup {
|
|
191
154
|
// Registration to app root
|
|
192
155
|
if (typeof args[1] === 'string') {
|
|
193
|
-
|
|
194
156
|
const [name, id, config] = args;
|
|
195
157
|
|
|
196
|
-
const service = { id, name, config, type: 'service.setup' } as TServiceSetup
|
|
158
|
+
const service = { id, name, config, type: 'service.setup' } as TServiceSetup;
|
|
197
159
|
|
|
198
160
|
this.registered[name] = service;
|
|
199
161
|
|
|
200
162
|
return service;
|
|
201
163
|
|
|
202
|
-
|
|
164
|
+
// Scoped to a parent service
|
|
203
165
|
} else {
|
|
204
|
-
|
|
205
166
|
const [id, config] = args;
|
|
206
167
|
|
|
207
|
-
const service = { id, config, type: 'service.setup' } as TServiceSetup
|
|
168
|
+
const service = { id, config, type: 'service.setup' } as TServiceSetup;
|
|
208
169
|
|
|
209
170
|
return service;
|
|
210
171
|
}
|
|
211
172
|
}
|
|
212
173
|
|
|
213
174
|
public async warmup() {
|
|
214
|
-
|
|
215
175
|
// Require all config files in @/server/config
|
|
216
176
|
const configDir = path.resolve(cli.paths.appRoot, 'server', 'config');
|
|
217
177
|
const configFiles = fs.readdirSync(configDir);
|
|
218
178
|
for (const configFile of configFiles) {
|
|
219
|
-
console.log(
|
|
220
|
-
require(
|
|
179
|
+
console.log('Loading config file:', configFile);
|
|
180
|
+
require(path.resolve(configDir, configFile));
|
|
221
181
|
}
|
|
222
182
|
}
|
|
223
183
|
}
|
|
224
184
|
|
|
225
|
-
export const app = new App
|
|
185
|
+
export const app = new App();
|
|
226
186
|
|
|
227
|
-
export default app
|
|
187
|
+
export default app;
|
package/cli/bin.js
CHANGED
|
@@ -23,7 +23,7 @@ if (!process.env.TS_NODE_IGNORE) {
|
|
|
23
23
|
// Default ts-node ignore rule (works when deps are nested under `../node_modules/...`)
|
|
24
24
|
'(node_modules\/(?!proteum\/))|(\.generated\/)|(\.cache\/)',
|
|
25
25
|
// Extra rule for deps hoisted next to Proteum (ex: `../../tailwindcss/...`)
|
|
26
|
-
'^\\.\\./\\.\\./(?!\\./|\\.\\./)[^/]+/'
|
|
26
|
+
'^\\.\\./\\.\\./(?!\\./|\\.\\./)[^/]+/',
|
|
27
27
|
].join(',');
|
|
28
28
|
}
|
|
29
29
|
|
package/cli/commands/build.ts
CHANGED
|
@@ -4,46 +4,46 @@
|
|
|
4
4
|
|
|
5
5
|
// Core
|
|
6
6
|
import cli from '..';
|
|
7
|
+
import { app } from '../app';
|
|
7
8
|
|
|
8
9
|
// Configs
|
|
9
10
|
import Compiler from '../compiler';
|
|
10
11
|
import type { TCompileMode } from '../compiler/common';
|
|
12
|
+
import {
|
|
13
|
+
getClientBundleAnalysisReportPaths,
|
|
14
|
+
waitForClientBundleAnalysisArtifacts,
|
|
15
|
+
} from '../compiler/common/bundleAnalysis';
|
|
11
16
|
|
|
12
|
-
const allowedBuildArgs = new Set(['
|
|
17
|
+
const allowedBuildArgs = new Set(['prod', 'cache', 'analyze']);
|
|
13
18
|
|
|
14
19
|
/*----------------------------------
|
|
15
20
|
- COMMAND
|
|
16
21
|
----------------------------------*/
|
|
17
22
|
function resolveBuildMode(): TCompileMode {
|
|
18
|
-
|
|
19
23
|
const enabledArgs = Object.entries(cli.args)
|
|
20
24
|
.filter(([name, value]) => name !== 'workdir' && value === true)
|
|
21
25
|
.map(([name]) => name);
|
|
22
26
|
|
|
23
|
-
const invalidArgs = enabledArgs.filter(arg => !allowedBuildArgs.has(arg));
|
|
27
|
+
const invalidArgs = enabledArgs.filter((arg) => !allowedBuildArgs.has(arg));
|
|
24
28
|
if (invalidArgs.length > 0)
|
|
25
|
-
throw new Error(`Unknown build argument(s): ${invalidArgs.join(', ')}. Allowed values:
|
|
29
|
+
throw new Error(`Unknown build argument(s): ${invalidArgs.join(', ')}. Allowed values: prod, cache, analyze.`);
|
|
26
30
|
|
|
27
|
-
const requestedModes = enabledArgs.filter((arg): arg is TCompileMode =>
|
|
28
|
-
arg === 'dev' || arg === 'prod'
|
|
29
|
-
);
|
|
31
|
+
const requestedModes = enabledArgs.filter((arg): arg is TCompileMode => arg === 'prod');
|
|
30
32
|
if (requestedModes.length > 1)
|
|
31
33
|
throw new Error(`Please specify only one build mode. Received: ${requestedModes.join(', ')}.`);
|
|
32
34
|
|
|
33
|
-
return requestedModes[0] ?? '
|
|
35
|
+
return requestedModes[0] ?? 'prod';
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export const run = async (): Promise<void> => {
|
|
37
|
-
|
|
38
39
|
const mode = resolveBuildMode();
|
|
39
40
|
const compiler = new Compiler(mode, {}, false, 'bin');
|
|
40
41
|
const multiCompiler = await compiler.create();
|
|
41
42
|
|
|
42
43
|
await new Promise<void>((resolve, reject) => {
|
|
43
44
|
multiCompiler.run((error, stats) => {
|
|
44
|
-
|
|
45
45
|
if (error) {
|
|
46
|
-
console.error(
|
|
46
|
+
console.error('An error occurred during the compilation:', error);
|
|
47
47
|
reject(error);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
@@ -53,8 +53,19 @@ export const run = async (): Promise<void> => {
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
if (cli.args.analyze === true) {
|
|
57
|
+
waitForClientBundleAnalysisArtifacts(app, 'bin')
|
|
58
|
+
.then(() => {
|
|
59
|
+
const { reportPath, statsPath } = getClientBundleAnalysisReportPaths(app, 'bin');
|
|
60
|
+
console.info(`Client bundle analysis report: ${reportPath}`);
|
|
61
|
+
console.info(`Client bundle analysis stats: ${statsPath}`);
|
|
62
|
+
resolve();
|
|
63
|
+
})
|
|
64
|
+
.catch(reject);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
resolve();
|
|
57
69
|
});
|
|
58
|
-
|
|
59
70
|
});
|
|
60
71
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import cli from '..';
|
|
2
|
+
import { refreshGeneratedTypings, runAppLint, runAppTypecheck } from '../utils/check';
|
|
3
|
+
|
|
4
|
+
const validateCheckArgs = () => {
|
|
5
|
+
const enabledArgs = Object.entries(cli.args).filter(([name, value]) => name !== 'workdir' && value === true);
|
|
6
|
+
|
|
7
|
+
if (enabledArgs.length > 0)
|
|
8
|
+
throw new Error(
|
|
9
|
+
`Unknown check argument(s): ${enabledArgs.map(([name]) => name).join(', ')}. This command does not accept options.`,
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const run = async (): Promise<void> => {
|
|
14
|
+
validateCheckArgs();
|
|
15
|
+
|
|
16
|
+
await refreshGeneratedTypings();
|
|
17
|
+
await runAppTypecheck();
|
|
18
|
+
await runAppLint();
|
|
19
|
+
};
|
|
@@ -13,17 +13,13 @@ import { api } from '../../utils';
|
|
|
13
13
|
- COMMAND
|
|
14
14
|
----------------------------------*/
|
|
15
15
|
export async function run() {
|
|
16
|
-
|
|
17
16
|
const { project, local } = cli.args;
|
|
18
17
|
|
|
19
|
-
const versionfile = fs.readFileSync(
|
|
18
|
+
const versionfile = fs.readFileSync(project + '/version.txt', 'utf-8');
|
|
20
19
|
|
|
21
20
|
const [platform, version, build] = versionfile.split('\n');
|
|
22
21
|
|
|
23
22
|
console.log({ project, platform, version, build });
|
|
24
|
-
|
|
25
|
-
await cli.shell(
|
|
26
|
-
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
}
|
|
23
|
+
|
|
24
|
+
await cli.shell(api('POST', '/app/release', { platform, version, build }, local));
|
|
25
|
+
}
|
|
@@ -10,51 +10,47 @@ import prompts from 'prompts';
|
|
|
10
10
|
import cli from '../..';
|
|
11
11
|
import { api } from '../../utils';
|
|
12
12
|
|
|
13
|
-
0/*----------------------------------
|
|
13
|
+
0; /*----------------------------------
|
|
14
14
|
- HELPERS
|
|
15
15
|
----------------------------------*/
|
|
16
16
|
|
|
17
17
|
const mergeDeps = ({ dependencies: coreDeps }, { dependencies: appDeps }) => {
|
|
18
18
|
for (const dep in appDeps)
|
|
19
19
|
if (dep in coreDeps) {
|
|
20
|
-
|
|
21
20
|
if (coreDeps[dep] !== appDeps[dep])
|
|
22
|
-
throw new Error(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} else
|
|
27
|
-
coreDeps[dep] = appDeps[dep];
|
|
21
|
+
throw new Error(
|
|
22
|
+
`Duplicate dependency "${dep}" with different version in core (${coreDeps[dep]}) and app (${appDeps[dep]})`,
|
|
23
|
+
);
|
|
24
|
+
else console.warn(`Duplicate dependency "${dep}" in core and app`);
|
|
25
|
+
} else coreDeps[dep] = appDeps[dep];
|
|
28
26
|
return coreDeps;
|
|
29
|
-
}
|
|
27
|
+
};
|
|
30
28
|
|
|
31
29
|
const toast = (type: string, title: string, content: string) =>
|
|
32
|
-
api('POST', '/admin/api/notification', { type, title, content }, true)
|
|
30
|
+
api('POST', '/admin/api/notification', { type, title, content }, true);
|
|
33
31
|
|
|
34
32
|
/*----------------------------------
|
|
35
33
|
- COMMAND
|
|
36
34
|
----------------------------------*/
|
|
37
35
|
export async function run() {
|
|
38
|
-
|
|
39
36
|
const { simulate } = cli.args;
|
|
40
37
|
|
|
41
38
|
const temp = app.paths.root + '/.deployment';
|
|
42
39
|
fs.emptyDirSync(temp);
|
|
43
40
|
|
|
44
41
|
// Merge package.json: framework + app
|
|
45
|
-
fs.outputJSONSync(
|
|
46
|
-
|
|
47
|
-
dependencies: mergeDeps(cli.packageJson, appPkg),
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
fs.outputJSONSync(
|
|
43
|
+
temp + '/package.json',
|
|
44
|
+
{ ...appPkg, dependencies: mergeDeps(cli.packageJson, appPkg), devDependencies: {} },
|
|
45
|
+
{ spaces: 4 },
|
|
46
|
+
);
|
|
50
47
|
|
|
51
48
|
// Copy config file
|
|
52
|
-
fs.copyFileSync(
|
|
49
|
+
fs.copyFileSync(app.paths.root + (simulate ? '/env.yaml' : '/env.server.yaml'), temp + '/env.yaml');
|
|
53
50
|
|
|
54
51
|
// Compile & Run Docker
|
|
55
52
|
await cli.shell(`docker compose up --build`);
|
|
56
|
-
toast(
|
|
53
|
+
toast('info', 'Server update', 'A server update will start. You might experience some temporary slowdowns.');
|
|
57
54
|
|
|
58
55
|
fs.removeSync(temp);
|
|
59
|
-
|
|
60
|
-
}
|
|
56
|
+
}
|