proteum 1.0.2 → 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 +101 -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 +13 -11
- package/cli/app/index.ts +74 -82
- package/cli/bin.js +1 -1
- package/cli/commands/build.ts +51 -14
- 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 +189 -64
- 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 +18 -0
- package/cli/commands/typecheck.ts +18 -0
- package/cli/compiler/client/identite.ts +80 -53
- package/cli/compiler/client/index.ts +139 -213
- 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 +11 -22
- package/cli/compiler/common/generatedRouteModules.ts +368 -0
- package/cli/compiler/common/index.ts +31 -65
- 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 +781 -230
- package/cli/compiler/server/index.ts +59 -75
- package/cli/compiler/writeIfChanged.ts +21 -0
- package/cli/index.ts +71 -72
- 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/doc/TODO.md +1 -1
- package/eslint.js +62 -0
- package/package.json +12 -47
- 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 +48 -59
- 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 +78 -73
- 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 -35
- 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 +13 -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 -170
- 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 -1130
- 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,30 +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
|
-
|
|
38
|
-
}
|
|
25
|
+
type TServiceRef = { refTo: string; type: 'service.ref' };
|
|
26
|
+
|
|
27
|
+
type TServiceSubservices = { [key: string]: TServiceSetup | TServiceRef };
|
|
28
|
+
|
|
29
|
+
const parseRouterPortOverride = (rawPort: string | boolean | string[] | undefined): number | undefined => {
|
|
30
|
+
if (rawPort === undefined || rawPort === '') return undefined;
|
|
31
|
+
|
|
32
|
+
if (typeof rawPort !== 'string') throw new Error(`Invalid value for -port: expected a numeric value.`);
|
|
33
|
+
|
|
34
|
+
const port = Number(rawPort);
|
|
35
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535)
|
|
36
|
+
throw new Error(`Invalid value for -port: "${rawPort}". Expected an integer between 1 and 65535.`);
|
|
37
|
+
|
|
38
|
+
return port;
|
|
39
|
+
};
|
|
39
40
|
|
|
40
41
|
/*----------------------------------
|
|
41
42
|
- SERVICE
|
|
42
43
|
----------------------------------*/
|
|
43
44
|
export class App {
|
|
44
|
-
|
|
45
45
|
// config
|
|
46
46
|
// WARNING: High level config files (env and services) shouldn't be loaded from the CLI
|
|
47
47
|
// The CLI will be run on CircleCI, and no env file should be sent to this service
|
|
@@ -49,36 +49,34 @@ export class App {
|
|
|
49
49
|
|
|
50
50
|
public env: TEnvConfig;
|
|
51
51
|
|
|
52
|
-
public
|
|
52
|
+
public routerPortOverride?: number;
|
|
53
|
+
|
|
54
|
+
public devEventPort?: number;
|
|
55
|
+
|
|
56
|
+
public packageJson: { [key: string]: any };
|
|
53
57
|
|
|
54
58
|
public buildId: number = Date.now();
|
|
55
59
|
|
|
56
60
|
public paths = {
|
|
57
|
-
|
|
58
61
|
root: cli.paths.appRoot,
|
|
59
|
-
bin: path.join(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
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') },
|
|
68
70
|
server: {
|
|
69
|
-
generated: path.join(
|
|
70
|
-
configs: path.join(
|
|
71
|
+
generated: path.join(cli.paths.appRoot, 'server', '.generated'),
|
|
72
|
+
configs: path.join(cli.paths.appRoot, 'server', 'app'),
|
|
71
73
|
},
|
|
72
|
-
common: {
|
|
73
|
-
generated: path.join( cli.paths.appRoot, 'common', '.generated')
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
withAlias: (filename: string, side: TAppSide) =>
|
|
77
|
-
this.aliases[side].apply(filename),
|
|
74
|
+
common: { generated: path.join(cli.paths.appRoot, 'common', '.generated') },
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
withAlias: (filename: string, side: TAppSide) => this.aliases[side].apply(filename),
|
|
77
|
+
|
|
78
|
+
withoutAlias: (filename: string, side: TAppSide) => this.aliases[side].realpath(filename),
|
|
79
|
+
};
|
|
82
80
|
|
|
83
81
|
public containerServices = [
|
|
84
82
|
//'Services',
|
|
@@ -87,16 +85,20 @@ export class App {
|
|
|
87
85
|
/*'Application',
|
|
88
86
|
'Path',
|
|
89
87
|
'Event'*/
|
|
90
|
-
]
|
|
88
|
+
];
|
|
91
89
|
|
|
92
90
|
public constructor() {
|
|
93
|
-
|
|
94
91
|
cli.debug && console.log(`[cli] Loading app config ...`);
|
|
95
|
-
|
|
92
|
+
this.routerPortOverride = parseRouterPortOverride(cli.args.port);
|
|
93
|
+
|
|
94
|
+
const configParser = new ConfigParser(cli.paths.appRoot, undefined, this.routerPortOverride);
|
|
96
95
|
this.identity = configParser.identity();
|
|
97
96
|
this.env = configParser.env();
|
|
98
97
|
this.packageJson = this.loadPkg();
|
|
99
|
-
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public outputPath(target: 'dev' | 'bin') {
|
|
101
|
+
return target === 'dev' ? this.paths.dev : this.paths.bin;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
/*----------------------------------
|
|
@@ -106,21 +108,15 @@ export class App {
|
|
|
106
108
|
public aliases = {
|
|
107
109
|
client: new TsAlias({
|
|
108
110
|
rootDir: this.paths.root + '/client',
|
|
109
|
-
modulesDir: [
|
|
110
|
-
|
|
111
|
-
cli.paths.coreRoot + '/node_modules'
|
|
112
|
-
],
|
|
113
|
-
debug: false
|
|
111
|
+
modulesDir: [cli.paths.appRoot + '/node_modules', cli.paths.coreRoot + '/node_modules'],
|
|
112
|
+
debug: false,
|
|
114
113
|
}),
|
|
115
114
|
server: new TsAlias({
|
|
116
115
|
rootDir: this.paths.root + '/server',
|
|
117
|
-
modulesDir: [
|
|
118
|
-
|
|
119
|
-
cli.paths.coreRoot + '/node_modules'
|
|
120
|
-
],
|
|
121
|
-
debug: false
|
|
116
|
+
modulesDir: [cli.paths.appRoot + '/node_modules', cli.paths.coreRoot + '/node_modules'],
|
|
117
|
+
debug: false,
|
|
122
118
|
}),
|
|
123
|
-
}
|
|
119
|
+
};
|
|
124
120
|
|
|
125
121
|
private loadPkg() {
|
|
126
122
|
return fs.readJSONSync(this.paths.root + '/package.json');
|
|
@@ -130,66 +126,62 @@ export class App {
|
|
|
130
126
|
- WARMUP (Services awareness)
|
|
131
127
|
----------------------------------*/
|
|
132
128
|
|
|
133
|
-
public registered = {}
|
|
134
|
-
|
|
135
|
-
public use( referenceName: string ): TServiceRef {
|
|
129
|
+
public registered = {};
|
|
136
130
|
|
|
131
|
+
public use(referenceName: string): TServiceRef {
|
|
137
132
|
// We don't check because all service are not regstered when we register subservices
|
|
138
133
|
/*if (this.registered[referenceName] === undefined) {
|
|
139
134
|
throw new Error(`Service ${referenceName} is not registered`);
|
|
140
135
|
}*/
|
|
141
136
|
|
|
142
|
-
return {
|
|
143
|
-
refTo: referenceName,
|
|
144
|
-
type: 'service.ref'
|
|
145
|
-
}
|
|
137
|
+
return { refTo: referenceName, type: 'service.ref' };
|
|
146
138
|
}
|
|
147
139
|
|
|
148
|
-
public setup(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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 {
|
|
159
154
|
// Registration to app root
|
|
160
155
|
if (typeof args[1] === 'string') {
|
|
161
|
-
|
|
162
156
|
const [name, id, config] = args;
|
|
163
157
|
|
|
164
|
-
const service = { id, name, config, type: 'service.setup' } as TServiceSetup
|
|
158
|
+
const service = { id, name, config, type: 'service.setup' } as TServiceSetup;
|
|
165
159
|
|
|
166
160
|
this.registered[name] = service;
|
|
167
161
|
|
|
168
162
|
return service;
|
|
169
163
|
|
|
170
|
-
|
|
164
|
+
// Scoped to a parent service
|
|
171
165
|
} else {
|
|
172
|
-
|
|
173
166
|
const [id, config] = args;
|
|
174
167
|
|
|
175
|
-
const service = { id, config, type: 'service.setup' } as TServiceSetup
|
|
168
|
+
const service = { id, config, type: 'service.setup' } as TServiceSetup;
|
|
176
169
|
|
|
177
170
|
return service;
|
|
178
171
|
}
|
|
179
172
|
}
|
|
180
173
|
|
|
181
174
|
public async warmup() {
|
|
182
|
-
|
|
183
175
|
// Require all config files in @/server/config
|
|
184
176
|
const configDir = path.resolve(cli.paths.appRoot, 'server', 'config');
|
|
185
177
|
const configFiles = fs.readdirSync(configDir);
|
|
186
178
|
for (const configFile of configFiles) {
|
|
187
|
-
console.log(
|
|
188
|
-
require(
|
|
179
|
+
console.log('Loading config file:', configFile);
|
|
180
|
+
require(path.resolve(configDir, configFile));
|
|
189
181
|
}
|
|
190
182
|
}
|
|
191
183
|
}
|
|
192
184
|
|
|
193
|
-
export const app = new App
|
|
185
|
+
export const app = new App();
|
|
194
186
|
|
|
195
|
-
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
|
@@ -2,33 +2,70 @@
|
|
|
2
2
|
- DEPENDANCES
|
|
3
3
|
----------------------------------*/
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
import
|
|
5
|
+
// Core
|
|
6
|
+
import cli from '..';
|
|
7
|
+
import { app } from '../app';
|
|
7
8
|
|
|
8
9
|
// Configs
|
|
9
10
|
import Compiler from '../compiler';
|
|
11
|
+
import type { TCompileMode } from '../compiler/common';
|
|
12
|
+
import {
|
|
13
|
+
getClientBundleAnalysisReportPaths,
|
|
14
|
+
waitForClientBundleAnalysisArtifacts,
|
|
15
|
+
} from '../compiler/common/bundleAnalysis';
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
- TYPES
|
|
13
|
-
----------------------------------*/
|
|
17
|
+
const allowedBuildArgs = new Set(['prod', 'cache', 'analyze']);
|
|
14
18
|
|
|
15
19
|
/*----------------------------------
|
|
16
20
|
- COMMAND
|
|
17
21
|
----------------------------------*/
|
|
18
|
-
|
|
22
|
+
function resolveBuildMode(): TCompileMode {
|
|
23
|
+
const enabledArgs = Object.entries(cli.args)
|
|
24
|
+
.filter(([name, value]) => name !== 'workdir' && value === true)
|
|
25
|
+
.map(([name]) => name);
|
|
26
|
+
|
|
27
|
+
const invalidArgs = enabledArgs.filter((arg) => !allowedBuildArgs.has(arg));
|
|
28
|
+
if (invalidArgs.length > 0)
|
|
29
|
+
throw new Error(`Unknown build argument(s): ${invalidArgs.join(', ')}. Allowed values: prod, cache, analyze.`);
|
|
30
|
+
|
|
31
|
+
const requestedModes = enabledArgs.filter((arg): arg is TCompileMode => arg === 'prod');
|
|
32
|
+
if (requestedModes.length > 1)
|
|
33
|
+
throw new Error(`Please specify only one build mode. Received: ${requestedModes.join(', ')}.`);
|
|
19
34
|
|
|
20
|
-
|
|
35
|
+
return requestedModes[0] ?? 'prod';
|
|
36
|
+
}
|
|
21
37
|
|
|
38
|
+
export const run = async (): Promise<void> => {
|
|
39
|
+
const mode = resolveBuildMode();
|
|
40
|
+
const compiler = new Compiler(mode, {}, false, 'bin');
|
|
22
41
|
const multiCompiler = await compiler.create();
|
|
23
42
|
|
|
24
|
-
|
|
43
|
+
await new Promise<void>((resolve, reject) => {
|
|
44
|
+
multiCompiler.run((error, stats) => {
|
|
45
|
+
if (error) {
|
|
46
|
+
console.error('An error occurred during the compilation:', error);
|
|
47
|
+
reject(error);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
25
50
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
if (stats?.hasErrors()) {
|
|
52
|
+
reject(new Error(`Compilation failed for build mode "${mode}".`));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
30
55
|
|
|
31
|
-
|
|
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
|
+
}
|
|
32
67
|
|
|
68
|
+
resolve();
|
|
69
|
+
});
|
|
33
70
|
});
|
|
34
|
-
}
|
|
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
|
+
}
|