proteum 1.0.2 → 2.0.0-1
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 +14 -49
- 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
|
@@ -12,12 +12,10 @@ import type { TBasicUser } from '@server/services/auth';
|
|
|
12
12
|
- TYPES
|
|
13
13
|
----------------------------------*/
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
/*----------------------------------
|
|
17
16
|
- CONTEXT
|
|
18
17
|
----------------------------------*/
|
|
19
18
|
export default abstract class BaseRequest {
|
|
20
|
-
|
|
21
19
|
// Permet d'accèder à l'instance complète via spread
|
|
22
20
|
public request: this = this;
|
|
23
21
|
public url!: string;
|
|
@@ -27,9 +25,5 @@ export default abstract class BaseRequest {
|
|
|
27
25
|
public abstract response?: Response;
|
|
28
26
|
public user: TBasicUser | null = null;
|
|
29
27
|
|
|
30
|
-
public constructor(
|
|
31
|
-
|
|
32
|
-
) {
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
28
|
+
public constructor(public path: string) {}
|
|
29
|
+
}
|
|
@@ -2,35 +2,28 @@
|
|
|
2
2
|
- DEPENDANCES
|
|
3
3
|
----------------------------------*/
|
|
4
4
|
|
|
5
|
-
// Npm
|
|
6
|
-
import { FunctionalComponent } from "preact";
|
|
7
|
-
|
|
8
5
|
// Core
|
|
9
|
-
import { TAnyRoute } from
|
|
10
|
-
import type
|
|
11
|
-
import Page from '@client/services/router/response/page'
|
|
6
|
+
import { TAnyRoute } from '..';
|
|
7
|
+
import type BaseRequest from '@common/router/request';
|
|
12
8
|
|
|
13
9
|
/*----------------------------------
|
|
14
10
|
- TYPES
|
|
15
11
|
----------------------------------*/
|
|
16
12
|
|
|
17
|
-
export type TResponseData =
|
|
13
|
+
export type TResponseData = unknown;
|
|
18
14
|
|
|
19
15
|
/*----------------------------------
|
|
20
16
|
- CONTEXT
|
|
21
17
|
----------------------------------*/
|
|
22
18
|
export default abstract class BaseResponse<
|
|
23
|
-
TData extends TResponseData =
|
|
24
|
-
TRequest extends
|
|
19
|
+
TData extends TResponseData = TResponseData,
|
|
20
|
+
TRequest extends BaseRequest = BaseRequest,
|
|
25
21
|
> {
|
|
26
|
-
|
|
27
22
|
public data?: TData;
|
|
28
23
|
public request: TRequest;
|
|
29
24
|
public route?: TAnyRoute;
|
|
30
25
|
|
|
31
|
-
public constructor(
|
|
32
|
-
request: TRequest,
|
|
33
|
-
) {
|
|
26
|
+
public constructor(request: TRequest) {
|
|
34
27
|
// ServerResponse et ClientResponse assignent request.response
|
|
35
28
|
request.response = this;
|
|
36
29
|
this.request = request as TRequest;
|
|
@@ -41,5 +34,5 @@ export default abstract class BaseResponse<
|
|
|
41
34
|
return this;
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
public abstract redirect(url: string, code
|
|
45
|
-
}
|
|
37
|
+
public abstract redirect(url: string, code?: number, absolute?: boolean): unknown;
|
|
38
|
+
}
|
|
@@ -7,66 +7,71 @@ import type { VNode } from 'preact';
|
|
|
7
7
|
import type { Thing } from 'schema-dts';
|
|
8
8
|
|
|
9
9
|
// Core libs
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import type { ClientContext } from '@/client/context';
|
|
11
|
+
import { ClientOrServerRouter, TErrorRoute, TPageErrorRoute, TPageRoute, TRoute } from '@common/router';
|
|
12
|
+
import type { TFetcher, TFetcherList } from '@common/router/request/api';
|
|
13
|
+
import { splitRouteSetupResult } from '@common/router/pageSetup';
|
|
12
14
|
|
|
13
15
|
/*----------------------------------
|
|
14
16
|
- TYPES
|
|
15
17
|
----------------------------------*/
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
export type TPageSetupContext = ClientContext;
|
|
20
|
+
|
|
21
|
+
export type TPageRenderContext = With<ClientContext, 'page'>;
|
|
22
|
+
|
|
23
|
+
export type TResolvedPageData<TProvidedData extends {} = {}> = {
|
|
24
|
+
[Property in keyof TProvidedData]: TProvidedData[Property] extends TFetcher<infer TData>
|
|
25
|
+
? TData
|
|
26
|
+
: Awaited<TProvidedData[Property]>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// The function that prepares route config and SSR data before rendering.
|
|
30
|
+
export type TPageSetup<TProvidedData extends {} = {}> = (
|
|
31
|
+
context: TPageSetupContext & {
|
|
20
32
|
// URL query parameters
|
|
21
33
|
// TODO: typings
|
|
22
|
-
data: {[key: string]: string | number}
|
|
23
|
-
}
|
|
24
|
-
) => TProvidedData
|
|
34
|
+
data: { [key: string]: string | number };
|
|
35
|
+
},
|
|
36
|
+
) => TProvidedData;
|
|
37
|
+
|
|
38
|
+
export type TDataProvider<TProvidedData extends {} = TFetcherList> = (
|
|
39
|
+
context: TPageSetupContext & { data: { [key: string]: PrimitiveValue } },
|
|
40
|
+
) => TProvidedData;
|
|
25
41
|
|
|
26
42
|
// The function that renders routes
|
|
27
43
|
export type TFrontRenderer<
|
|
28
|
-
TProvidedData extends
|
|
44
|
+
TProvidedData extends {} = {},
|
|
29
45
|
TAdditionnalData extends {} = {},
|
|
30
46
|
TRouter = ClientOrServerRouter,
|
|
31
|
-
> = (
|
|
32
|
-
context:
|
|
33
|
-
|
|
34
|
-
&
|
|
35
|
-
|
|
36
|
-
&
|
|
37
|
-
{
|
|
38
|
-
context: TClientOrServerContextForPage,
|
|
39
|
-
data: {[key: string]: PrimitiveValue}
|
|
40
|
-
}
|
|
41
|
-
)
|
|
42
|
-
) => VNode<any> | null
|
|
47
|
+
> = (
|
|
48
|
+
context: TPageRenderContext &
|
|
49
|
+
TResolvedPageData<TProvidedData> &
|
|
50
|
+
TAdditionnalData & { context: TPageRenderContext; data: { [key: string]: PrimitiveValue } },
|
|
51
|
+
) => VNode<any> | null;
|
|
43
52
|
|
|
44
53
|
// Script or CSS resource
|
|
45
|
-
export type TPageResource = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
inline: string
|
|
50
|
-
} | {
|
|
51
|
-
url: string,
|
|
52
|
-
preload?: boolean
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
type TMetasDict = {
|
|
56
|
-
[key: string]: string | Date | undefined | null
|
|
57
|
-
}
|
|
54
|
+
export type TPageResource = { id: string; attrs?: TObjetDonnees } & (
|
|
55
|
+
| { inline: string }
|
|
56
|
+
| { url: string; preload?: boolean }
|
|
57
|
+
);
|
|
58
58
|
|
|
59
|
-
type
|
|
59
|
+
type TMetasDict = { [key: string]: string | Date | undefined | null };
|
|
60
|
+
|
|
61
|
+
type TMetasList = ({ $: string } & TMetasDict)[];
|
|
60
62
|
|
|
61
63
|
const debug = false;
|
|
62
64
|
|
|
63
65
|
/*----------------------------------
|
|
64
66
|
- CLASS
|
|
65
67
|
----------------------------------*/
|
|
66
|
-
export default abstract class PageResponse<
|
|
67
|
-
|
|
68
|
+
export default abstract class PageResponse<
|
|
69
|
+
TRouter extends ClientOrServerRouter = ClientOrServerRouter,
|
|
70
|
+
TRouteLike extends TRoute | TErrorRoute = TPageRoute | TPageErrorRoute,
|
|
71
|
+
TContext extends TPageRenderContext = TPageRenderContext,
|
|
72
|
+
> {
|
|
68
73
|
// Metadata
|
|
69
|
-
public chunkId
|
|
74
|
+
public chunkId?: string;
|
|
70
75
|
public title?: string;
|
|
71
76
|
public description?: string;
|
|
72
77
|
public bodyClass: Set<string> = new Set<string>();
|
|
@@ -79,50 +84,57 @@ export default abstract class PageResponse<TRouter extends ClientOrServerRouter
|
|
|
79
84
|
public jsonld: Thing[] = [];
|
|
80
85
|
public scripts: TPageResource[] = [];
|
|
81
86
|
public style: TPageResource[] = [];
|
|
87
|
+
public layout?: { data?: TDataProvider };
|
|
82
88
|
|
|
83
89
|
// Data
|
|
84
90
|
public fetchers: TFetcherList = {};
|
|
85
91
|
public data: TObjetDonnees = {};
|
|
86
92
|
|
|
87
93
|
public constructor(
|
|
88
|
-
public route:
|
|
94
|
+
public route: TRouteLike,
|
|
89
95
|
public renderer: TFrontRenderer,
|
|
90
|
-
public context:
|
|
96
|
+
public context: TContext,
|
|
91
97
|
) {
|
|
92
|
-
|
|
93
|
-
this.chunkId = context.route.options["id"];
|
|
98
|
+
this.chunkId = context.route.options.id;
|
|
94
99
|
|
|
95
100
|
this.url = context.request.url;
|
|
96
|
-
|
|
97
|
-
this.fetchers = this.createFetchers(route.options.data);
|
|
98
|
-
|
|
99
101
|
}
|
|
100
102
|
|
|
101
|
-
private
|
|
103
|
+
private resolveSetup() {
|
|
104
|
+
const setup = this.route.options.setup;
|
|
105
|
+
if (!setup) return { options: {}, data: {} };
|
|
102
106
|
|
|
103
|
-
|
|
104
|
-
if (dataProvider)
|
|
105
|
-
return dataProvider({
|
|
106
|
-
...this.context,
|
|
107
|
-
data: this.context.request.data
|
|
108
|
-
});
|
|
109
|
-
else
|
|
110
|
-
return {}
|
|
107
|
+
const setupContext = { ...this.context, data: this.context.request.data } as Parameters<typeof setup>[0];
|
|
111
108
|
|
|
109
|
+
return splitRouteSetupResult(setup(setupContext) || {});
|
|
112
110
|
}
|
|
113
|
-
|
|
111
|
+
|
|
112
|
+
private createFetchers() {
|
|
113
|
+
const { options, data } = this.resolveSetup();
|
|
114
|
+
this.route.options = { ...this.route.options, ...options };
|
|
115
|
+
this.chunkId = this.route.options.id;
|
|
116
|
+
|
|
117
|
+
return data as TFetcherList;
|
|
118
|
+
}
|
|
119
|
+
|
|
114
120
|
public async fetchData() {
|
|
121
|
+
this.fetchers = this.createFetchers();
|
|
122
|
+
this.bodyId = this.route.options.bodyId;
|
|
115
123
|
|
|
116
124
|
// Fetch layout data
|
|
117
125
|
if (this.layout?.data) {
|
|
118
|
-
const
|
|
126
|
+
const layoutContext = {
|
|
127
|
+
...this.context,
|
|
128
|
+
data: this.context.request.data,
|
|
129
|
+
} as Parameters<typeof this.layout.data>[0];
|
|
130
|
+
const fetchers = this.layout.data(layoutContext);
|
|
119
131
|
this.fetchers = { ...this.fetchers, ...fetchers };
|
|
120
132
|
}
|
|
121
133
|
|
|
122
134
|
// Fetch page data
|
|
123
135
|
debug && console.log(`[router][page] Fetching api data:` + Object.keys(this.fetchers));
|
|
124
|
-
this.data = await this.context.request.api.fetchSync(
|
|
136
|
+
this.data = await this.context.request.api.fetchSync(this.fetchers, this.data);
|
|
125
137
|
|
|
126
138
|
return this.data;
|
|
127
139
|
}
|
|
128
|
-
}
|
|
140
|
+
}
|
package/common/utils.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param seconds The number of seconds to wait
|
|
5
5
|
* @returns A void promise
|
|
6
6
|
*/
|
|
7
|
-
export const seconds = (seconds: number) => new Promise((resolve) => setTimeout(resolve, seconds * 1000));
|
|
7
|
+
export const seconds = (seconds: number) => new Promise((resolve) => setTimeout(resolve, seconds * 1000));
|
package/doc/TODO.md
CHANGED
package/eslint.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const tseslint = require('typescript-eslint');
|
|
2
|
+
const reactPlugin = require('eslint-plugin-react');
|
|
3
|
+
const reactHooksPlugin = require('eslint-plugin-react-hooks');
|
|
4
|
+
const jsxA11yPlugin = require('eslint-plugin-jsx-a11y');
|
|
5
|
+
|
|
6
|
+
const defaultIgnores = [
|
|
7
|
+
'**/node_modules/**',
|
|
8
|
+
'**/bin/**',
|
|
9
|
+
'**/bin-dev/**',
|
|
10
|
+
'**/.generated/**',
|
|
11
|
+
'**/var/**',
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const createDoubleAssertionSelector = (typeKeyword) =>
|
|
15
|
+
`TSAsExpression[expression.type='TSAsExpression'][expression.typeAnnotation.type='${typeKeyword}']`;
|
|
16
|
+
|
|
17
|
+
const createProteumEslintConfig = ({ ignores = [] } = {}) => [
|
|
18
|
+
{
|
|
19
|
+
ignores: [...defaultIgnores, ...ignores],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
linterOptions: {
|
|
23
|
+
reportUnusedDisableDirectives: 'off',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
files: ['**/*.{ts,tsx,mts,cts}'],
|
|
28
|
+
languageOptions: {
|
|
29
|
+
parser: tseslint.parser,
|
|
30
|
+
parserOptions: {
|
|
31
|
+
ecmaVersion: 'latest',
|
|
32
|
+
sourceType: 'module',
|
|
33
|
+
ecmaFeatures: {
|
|
34
|
+
jsx: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
plugins: {
|
|
39
|
+
'@typescript-eslint': tseslint.plugin,
|
|
40
|
+
react: reactPlugin,
|
|
41
|
+
'react-hooks': reactHooksPlugin,
|
|
42
|
+
'jsx-a11y': jsxA11yPlugin,
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
'no-restricted-syntax': [
|
|
46
|
+
'error',
|
|
47
|
+
{
|
|
48
|
+
selector: createDoubleAssertionSelector('TSUnknownKeyword'),
|
|
49
|
+
message: 'Do not use double assertions through `unknown`.',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
selector: createDoubleAssertionSelector('TSAnyKeyword'),
|
|
53
|
+
message: 'Do not use double assertions through `any`.',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
module.exports = {
|
|
61
|
+
createProteumEslintConfig,
|
|
62
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proteum",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "
|
|
3
|
+
"description": "AI-first SSR, SEO, and TypeScript framework optimized for autonomous agent development.",
|
|
4
|
+
"version": "2.0.0-1",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/proteum.git",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
9
|
+
"node": ">=20.19.0",
|
|
10
10
|
"npm": ">=3.10.10"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
@@ -16,43 +16,26 @@
|
|
|
16
16
|
"proteum": "cli/bin.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@babel/cli": "^7.15.4",
|
|
20
|
-
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
|
21
|
-
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
22
|
-
"@babel/plugin-proposal-private-methods": "^7.14.5",
|
|
23
|
-
"@babel/plugin-proposal-private-property-in-object": "^7.15.4",
|
|
24
|
-
"@babel/plugin-transform-react-constant-elements": "^7.14.5",
|
|
25
|
-
"@babel/preset-env": "^7.15.6",
|
|
26
|
-
"@babel/preset-react": "^7.14.5",
|
|
27
|
-
"@babel/preset-typescript": "^7.15.0",
|
|
28
|
-
"@lexical/react": "^0.18.0",
|
|
29
|
-
"@prefresh/webpack": "^3.3.2",
|
|
30
19
|
"@prisma/client": "^6.5.0",
|
|
20
|
+
"@rspack/core": "^1.7.9",
|
|
31
21
|
"@tailwindcss/postcss": "^4.1.17",
|
|
32
22
|
"accepts": "^1.3.7",
|
|
33
23
|
"ansi-to-html": "^0.7.1",
|
|
34
24
|
"autoprefixer": "^10.4.21",
|
|
35
25
|
"aws-sdk": "^2.1415.0",
|
|
36
|
-
"babel-loader": "^10.0.0",
|
|
37
|
-
"babel-plugin-glob-import": "^0.0.9-1",
|
|
38
|
-
"babel-plugin-transform-imports": "^2.0.0",
|
|
39
|
-
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
40
|
-
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
41
26
|
"bowser": "^2.11.0",
|
|
42
|
-
"brotli-webpack-plugin": "^1.1.0",
|
|
43
|
-
"browser-sync": "^2.27.5",
|
|
44
27
|
"cli-highlight": "^2.1.11",
|
|
45
28
|
"compression": "^1.7.4",
|
|
46
|
-
"compression-webpack-plugin": "^8.0.1",
|
|
47
29
|
"cookie-parser": "^1.4.5",
|
|
48
|
-
"core-js": "^3.18.1",
|
|
49
30
|
"cors": "^2.8.5",
|
|
50
31
|
"cron-parser": "^4.0.0",
|
|
51
32
|
"css-loader": "^6.2.0",
|
|
52
|
-
"css-minimizer-webpack-plugin": "^7.0.4",
|
|
53
33
|
"dayjs": "^1.11.5",
|
|
54
|
-
"dottie": "^2.0.2",
|
|
55
34
|
"escape-regexp": "^0.0.1",
|
|
35
|
+
"eslint": "^9.39.4",
|
|
36
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
37
|
+
"eslint-plugin-react": "^7.37.5",
|
|
38
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
56
39
|
"express": "^4.17.1",
|
|
57
40
|
"express-csp-header": "^5.0.0",
|
|
58
41
|
"express-fileupload": "^1.2.1",
|
|
@@ -64,35 +47,23 @@
|
|
|
64
47
|
"history": "^5.0.1",
|
|
65
48
|
"hpp": "^0.2.3",
|
|
66
49
|
"human-interval": "^2.0.1",
|
|
67
|
-
"image-minimizer-webpack-plugin": "^4.1.4",
|
|
68
|
-
"imagemin": "^9.0.1",
|
|
69
|
-
"imagemin-svgo": "^10.0.0",
|
|
70
|
-
"imagemin-webp": "^6.0.0",
|
|
71
50
|
"intl": "^1.2.5",
|
|
72
51
|
"iso-639-1": "^2.1.9",
|
|
73
|
-
"json5": "^2.2.0",
|
|
74
52
|
"jsonwebtoken": "^8.5.1",
|
|
75
53
|
"less-loader": "^10.0.1",
|
|
76
|
-
"lexical": "^0.18.0",
|
|
77
|
-
"load-script": "^2.0.0",
|
|
78
54
|
"locale": "^0.1.0",
|
|
79
55
|
"markdown-it": "^13.0.1",
|
|
80
56
|
"md5": "^2.3.0",
|
|
81
57
|
"mime-types": "^2.1.35",
|
|
82
|
-
"mini-css-extract-plugin": "^2.2.2",
|
|
83
58
|
"module-alias": "^2.2.2",
|
|
84
59
|
"mysql2": "^2.3.0",
|
|
85
60
|
"node-cmd": "^5.0.0",
|
|
86
61
|
"null-loader": "^4.0.1",
|
|
87
|
-
"object-sizeof": "^1.6.3",
|
|
88
62
|
"path-to-regexp": "^6.2.0",
|
|
89
63
|
"postcss-loader": "^8.2.0",
|
|
90
64
|
"preact": "^10.27.1",
|
|
91
65
|
"preact-render-to-string": "^6.6.1",
|
|
92
|
-
"prettier": "^3.3.3",
|
|
93
66
|
"prompts": "^2.4.2",
|
|
94
|
-
"react-dev-utils": "^11.0.4",
|
|
95
|
-
"regenerator-runtime": "^0.13.9",
|
|
96
67
|
"replace-once": "^1.0.0",
|
|
97
68
|
"request": "^2.88.2",
|
|
98
69
|
"responsive-loader": "^3.1.2",
|
|
@@ -101,26 +72,23 @@
|
|
|
101
72
|
"slugify": "^1.6.6",
|
|
102
73
|
"source-map-support": "^0.5.21",
|
|
103
74
|
"stopword": "^3.1.1",
|
|
75
|
+
"style-loader": "^4.0.0",
|
|
104
76
|
"tailwindcss": "^4.1.17",
|
|
105
|
-
"terser-webpack-plugin": "^5.2.4",
|
|
106
77
|
"ts-alias": "^0.0.7",
|
|
107
78
|
"ts-node": "^10.9.1",
|
|
108
79
|
"tslog": "^4.9.1",
|
|
80
|
+
"typescript": "^5.9.3",
|
|
81
|
+
"typescript-eslint": "^8.57.1",
|
|
109
82
|
"uuid": "^8.3.2",
|
|
110
83
|
"validator": "^13.7.0",
|
|
111
|
-
"webpack": "^5.104.1",
|
|
112
|
-
"webpack-assets-manifest": "^5.0.6",
|
|
113
|
-
"webpack-bundle-analyzer": "^4.4.2",
|
|
114
|
-
"ws": "^8.2.2",
|
|
115
84
|
"yaml": "^1.10.2",
|
|
116
85
|
"yargs-parser": "^21.1.1",
|
|
117
86
|
"youch": "^3.3.3",
|
|
118
87
|
"youch-terminal": "^2.2.3",
|
|
119
|
-
"zod": "^4.1.5"
|
|
88
|
+
"zod": "^4.1.5",
|
|
89
|
+
"webpack-bundle-analyzer": "^5.2.0"
|
|
120
90
|
},
|
|
121
91
|
"devDependencies": {
|
|
122
|
-
"@types/babel__core": "^7.1.16",
|
|
123
|
-
"@types/babel__preset-env": "^7.9.6",
|
|
124
92
|
"@types/cookie": "^0.4.1",
|
|
125
93
|
"@types/express": "^4.17.13",
|
|
126
94
|
"@types/favicons": "^6.2.2",
|
|
@@ -134,10 +102,7 @@
|
|
|
134
102
|
"@types/prompts": "^2.0.14",
|
|
135
103
|
"@types/sharp": "^0.31.1",
|
|
136
104
|
"@types/universal-analytics": "^0.4.5",
|
|
137
|
-
"@types/webpack-env": "^1.16.2",
|
|
138
|
-
"@types/ws": "^7.4.7",
|
|
139
105
|
"@types/yargs-parser": "^21.0.0",
|
|
140
|
-
"schema-dts": "^1.1.2"
|
|
141
|
-
"speed-measure-webpack-v5-plugin": "^1.5.2"
|
|
106
|
+
"schema-dts": "^1.1.2"
|
|
142
107
|
}
|
|
143
108
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
const findControllerFiles = (dir: string): string[] => {
|
|
5
|
+
if (!fs.existsSync(dir)) return [];
|
|
6
|
+
|
|
7
|
+
const files: string[] = [];
|
|
8
|
+
|
|
9
|
+
for (const dirent of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
10
|
+
const filepath = path.join(dir, dirent.name);
|
|
11
|
+
|
|
12
|
+
if (dirent.isDirectory()) {
|
|
13
|
+
files.push(...findControllerFiles(filepath));
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (dirent.isFile() && dirent.name.endsWith('.controller.ts')) files.push(filepath);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return files;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const repoRoots = process.argv.slice(2);
|
|
24
|
+
if (!repoRoots.length)
|
|
25
|
+
throw new Error('Usage: ts-node scripts/cleanup-generated-controllers.ts <repo-root> [repo-root...]');
|
|
26
|
+
|
|
27
|
+
for (const repoRoot of repoRoots) {
|
|
28
|
+
const controllerFiles = findControllerFiles(path.join(repoRoot, 'server', 'services'));
|
|
29
|
+
let updated = 0;
|
|
30
|
+
|
|
31
|
+
for (const controllerFile of controllerFiles) {
|
|
32
|
+
let content = fs.readFileSync(controllerFile, 'utf8');
|
|
33
|
+
let changed = false;
|
|
34
|
+
|
|
35
|
+
if (
|
|
36
|
+
content.includes('this.input(schema.') &&
|
|
37
|
+
content.includes("import Controller from '@server/app/controller';")
|
|
38
|
+
) {
|
|
39
|
+
content = content.replace(
|
|
40
|
+
"import Controller from '@server/app/controller';",
|
|
41
|
+
"import Controller, { schema } from '@server/app/controller';",
|
|
42
|
+
);
|
|
43
|
+
changed = true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (content.includes('export default class indexController extends Controller')) {
|
|
47
|
+
const parentName = path.basename(path.dirname(controllerFile)).replace(/[^A-Za-z0-9_$]/g, '');
|
|
48
|
+
content = content.replace(
|
|
49
|
+
'export default class indexController extends Controller',
|
|
50
|
+
`export default class ${parentName || 'Generated'}Controller extends Controller`,
|
|
51
|
+
);
|
|
52
|
+
changed = true;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!changed) continue;
|
|
56
|
+
|
|
57
|
+
fs.writeFileSync(controllerFile, content);
|
|
58
|
+
updated++;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
console.log(`[cleanup-generated-controllers] ${repoRoot}: updated ${updated} controller files`);
|
|
62
|
+
}
|