@codenotch/codenotch.cli 1.0.35 → 1.0.37
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/README.md +2 -2
- package/dist/commands/generate/app.d.ts +2 -0
- package/dist/commands/generate/app.js +45 -0
- package/dist/commands/generate/app.js.map +1 -0
- package/dist/commands/generate/appmanifest.d.ts +2 -0
- package/dist/commands/generate/appmanifest.js +34 -0
- package/dist/commands/generate/appmanifest.js.map +1 -0
- package/dist/commands/generate/dbcontext.d.ts +2 -0
- package/dist/commands/generate/dbcontext.js +32 -0
- package/dist/commands/generate/dbcontext.js.map +1 -0
- package/dist/commands/generate/i18n.d.ts +2 -0
- package/dist/commands/generate/i18n.js +29 -0
- package/dist/commands/generate/i18n.js.map +1 -0
- package/dist/commands/generate/index.d.ts +2 -0
- package/dist/commands/generate/index.js +23 -0
- package/dist/commands/generate/index.js.map +1 -0
- package/dist/commands/generate/manifest.d.ts +2 -0
- package/dist/commands/generate/manifest.js +29 -0
- package/dist/commands/generate/manifest.js.map +1 -0
- package/dist/commands/generate/openapi.d.ts +2 -0
- package/dist/commands/generate/openapi.js +32 -0
- package/dist/commands/generate/openapi.js.map +1 -0
- package/dist/commands/generate/pkg.d.ts +2 -0
- package/dist/commands/generate/pkg.js +34 -0
- package/dist/commands/generate/pkg.js.map +1 -0
- package/dist/commands/generate/shared.d.ts +17 -0
- package/dist/commands/generate/shared.js +70 -0
- package/dist/commands/generate/shared.js.map +1 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/project/new.js +107 -187
- package/dist/commands/project/new.js.map +1 -1
- package/dist/commands/react/build.js +11 -5
- package/dist/commands/react/build.js.map +1 -1
- package/dist/commands/react/clean.d.ts +2 -0
- package/dist/commands/react/clean.js +46 -0
- package/dist/commands/react/clean.js.map +1 -0
- package/dist/commands/react/dev.d.ts +2 -0
- package/dist/commands/react/dev.js +27 -0
- package/dist/commands/react/dev.js.map +1 -0
- package/dist/commands/react/index.js +5 -1
- package/dist/commands/react/index.js.map +1 -1
- package/dist/commands/react/serve.js +33 -4
- package/dist/commands/react/serve.js.map +1 -1
- package/dist/commands/react/shared.d.ts +21 -0
- package/dist/commands/react/shared.js +80 -0
- package/dist/commands/react/shared.js.map +1 -0
- package/dist/commands/system/info.js +0 -7
- package/dist/commands/system/info.js.map +1 -1
- package/dist/commands/validation/ValidationUtils.d.ts +3 -13
- package/dist/commands/validation/ValidationUtils.js +5 -58
- package/dist/commands/validation/ValidationUtils.js.map +1 -1
- package/dist/commands/validation/files/AppManifestValidator.js +5 -20
- package/dist/commands/validation/files/AppManifestValidator.js.map +1 -1
- package/dist/commands/validation/files/I18nValidator.d.ts +24 -0
- package/dist/commands/validation/files/I18nValidator.js +190 -5
- package/dist/commands/validation/files/I18nValidator.js.map +1 -1
- package/dist/commands/validation/files/{BpmnValidator.d.ts → ProjectManifestValidator.d.ts} +1 -1
- package/dist/commands/validation/files/ProjectManifestValidator.js +31 -0
- package/dist/commands/validation/files/ProjectManifestValidator.js.map +1 -0
- package/dist/commands/validation/files/ScriptValidator.d.ts +6 -2
- package/dist/commands/validation/files/ScriptValidator.js +1 -1
- package/dist/commands/validation/files/ScriptValidator.js.map +1 -1
- package/dist/commands/validation/validate.js +15 -46
- package/dist/commands/validation/validate.js.map +1 -1
- package/dist/models/Codenotch.d.ts +0 -205
- package/dist/models/Codenotch.js +0 -211
- package/dist/models/Codenotch.js.map +1 -1
- package/dist/utils/BuildUtils.d.ts +66 -28
- package/dist/utils/BuildUtils.js +292 -330
- package/dist/utils/BuildUtils.js.map +1 -1
- package/dist/utils/ConsoleUtils.d.ts +13 -0
- package/dist/utils/ConsoleUtils.js +50 -0
- package/dist/utils/ConsoleUtils.js.map +1 -1
- package/dist/utils/DbSchemaUtils.d.ts +49 -0
- package/dist/utils/DbSchemaUtils.js +246 -0
- package/dist/utils/DbSchemaUtils.js.map +1 -0
- package/dist/utils/FileUtils.d.ts +104 -15
- package/dist/utils/FileUtils.js +285 -100
- package/dist/utils/FileUtils.js.map +1 -1
- package/dist/utils/GitHubAuthUtils.js.map +1 -1
- package/dist/utils/I18nTsUtils.d.ts +66 -0
- package/dist/utils/I18nTsUtils.js +221 -0
- package/dist/utils/I18nTsUtils.js.map +1 -0
- package/dist/utils/ManifestUtils.d.ts +24 -0
- package/dist/utils/ManifestUtils.js +53 -0
- package/dist/utils/ManifestUtils.js.map +1 -0
- package/dist/utils/OpenApiUtils.d.ts +81 -0
- package/dist/utils/OpenApiUtils.js +123 -0
- package/dist/utils/OpenApiUtils.js.map +1 -0
- package/dist/utils/ProjectCompilationUtils.d.ts +3 -30
- package/dist/utils/ProjectCompilationUtils.js +26 -760
- package/dist/utils/ProjectCompilationUtils.js.map +1 -1
- package/dist/utils/ProjectGeneratorUtils.d.ts +35 -0
- package/dist/utils/ProjectGeneratorUtils.js +119 -0
- package/dist/utils/ProjectGeneratorUtils.js.map +1 -0
- package/dist/utils/ProjectTemplates.d.ts +102 -0
- package/dist/utils/ProjectTemplates.js +284 -0
- package/dist/utils/ProjectTemplates.js.map +1 -0
- package/dist/utils/ProjectUtils.d.ts +217 -4
- package/dist/utils/ProjectUtils.js +386 -50
- package/dist/utils/ProjectUtils.js.map +1 -1
- package/dist/utils/RuntimeUtils.js +14 -8
- package/dist/utils/RuntimeUtils.js.map +1 -1
- package/dist/utils/ScriptDeclarationUtils.d.ts +169 -0
- package/dist/utils/ScriptDeclarationUtils.js +398 -0
- package/dist/utils/ScriptDeclarationUtils.js.map +1 -0
- package/dist/utils/ServeUtils.d.ts +0 -1
- package/dist/utils/ServeUtils.js +11 -29
- package/dist/utils/ServeUtils.js.map +1 -1
- package/dist/utils/ShellUtils.d.ts +6 -0
- package/dist/utils/ShellUtils.js +13 -0
- package/dist/utils/ShellUtils.js.map +1 -1
- package/dist/utils/TemplateUtils.d.ts +62 -0
- package/dist/utils/TemplateUtils.js +218 -0
- package/dist/utils/TemplateUtils.js.map +1 -0
- package/dist/utils/TypeSchemaUtils.d.ts +42 -0
- package/dist/utils/TypeSchemaUtils.js +171 -0
- package/dist/utils/TypeSchemaUtils.js.map +1 -0
- package/package.json +3 -3
- package/dist/commands/validation/files/BpmnValidator.js +0 -32
- package/dist/commands/validation/files/BpmnValidator.js.map +0 -1
- package/dist/commands/validation/files/DbSchemaValidator.d.ts +0 -5
- package/dist/commands/validation/files/DbSchemaValidator.js +0 -16
- package/dist/commands/validation/files/DbSchemaValidator.js.map +0 -1
- package/dist/commands/validation/files/DocumentValidator.d.ts +0 -5
- package/dist/commands/validation/files/DocumentValidator.js +0 -12
- package/dist/commands/validation/files/DocumentValidator.js.map +0 -1
- package/dist/commands/validation/files/ManifestCacheValidator.d.ts +0 -5
- package/dist/commands/validation/files/ManifestCacheValidator.js +0 -121
- package/dist/commands/validation/files/ManifestCacheValidator.js.map +0 -1
- package/dist/commands/validation/files/ManifestValidator.d.ts +0 -5
- package/dist/commands/validation/files/ManifestValidator.js +0 -14
- package/dist/commands/validation/files/ManifestValidator.js.map +0 -1
- package/dist/commands/validation/files/TableValidator.d.ts +0 -5
- package/dist/commands/validation/files/TableValidator.js +0 -19
- package/dist/commands/validation/files/TableValidator.js.map +0 -1
- package/dist/models/DbModels.d.ts +0 -221
- package/dist/models/DbModels.js +0 -130
- package/dist/models/DbModels.js.map +0 -1
- package/dist/models/OpenApiModels.d.ts +0 -115
- package/dist/models/OpenApiModels.js +0 -103
- package/dist/models/OpenApiModels.js.map +0 -1
- package/dist/utils/I18nUtils.d.ts +0 -9
- package/dist/utils/I18nUtils.js +0 -54
- package/dist/utils/I18nUtils.js.map +0 -1
- package/dist/utils/OpenAPIUtils.d.ts +0 -33
- package/dist/utils/OpenAPIUtils.js +0 -279
- package/dist/utils/OpenAPIUtils.js.map +0 -1
|
@@ -1,34 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICodenotchProjectManifest, IAppManifest } from "@codenotch/codenotch.core";
|
|
2
2
|
interface IWorkspace {
|
|
3
|
-
manifest:
|
|
3
|
+
manifest: ICodenotchProjectManifest;
|
|
4
4
|
path: string;
|
|
5
5
|
}
|
|
6
6
|
export interface IBuildOptions {
|
|
7
7
|
cluster?: string;
|
|
8
8
|
}
|
|
9
9
|
export default abstract class BuildUtils {
|
|
10
|
-
static readonly CN_REACT_VERSION = "2.0.
|
|
10
|
+
static readonly CN_REACT_VERSION = "2.0.1";
|
|
11
11
|
static findWorkspaceFromFile(childPath: string): string | undefined;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Builds one React app of a Codenotch project into a ready-to-serve bundle.
|
|
14
|
+
* Behind the command: cn react build <target_file>
|
|
15
|
+
*
|
|
16
|
+
* Everything is staged under the `.codenotch/` folder of the workspace, the sources of the
|
|
17
|
+
* project are never touched:
|
|
18
|
+
* - `.codenotch/<appName>-source` — the Vite project: generated package.json, index.html,
|
|
19
|
+
* index.jsx (mounts the app component with react 19's createRoot), vite.config.mjs,
|
|
20
|
+
* tsconfig.json, the workspace `.npmrc` when there is one, and a copy of every source file of the workspace,
|
|
21
|
+
* mirrored flat so that root config files (postcss.config.js, ...) stay where Vite looks.
|
|
22
|
+
* - `.codenotch/<appName>-dist` — the bundle Vite emits, plus a `.env` holding the Codenotch
|
|
23
|
+
* environment (app name, manifests, cluster url) read by the served page.
|
|
24
|
+
* Both folders are deleted first when a previous build left them behind.
|
|
25
|
+
*
|
|
26
|
+
* The build itself runs `npm install` then `npm run build` (vite alone: the copy holds server
|
|
27
|
+
* files too, typechecking is the job of 'cn validate') inside `-source`, with the Node the CLI
|
|
28
|
+
* runs under — Node 20 or newer is expected (Vite 8), and npm needs the network.
|
|
29
|
+
*
|
|
30
|
+
* On success, prints the `cn react serve '<dist>'` command to try the bundle.
|
|
31
|
+
*
|
|
32
|
+
* @param appFilePath Path (absolute, or relative to the current directory) to the app
|
|
33
|
+
* component, e.g. `./apps/index.tsx`. NOT the manifest: the sibling
|
|
34
|
+
* `<name>.manifest.json` is derived from it, and must exist and declare
|
|
35
|
+
* `app.name`, which names the staging folders. The file must live inside
|
|
36
|
+
* a Codenotch workspace (a `manifest.json` in one of its parent folders).
|
|
37
|
+
* @param clusterUrl Base URL of the Codenotch cluster the bundle will talk to, written into
|
|
38
|
+
* the `.env` of the dist. Without it the bundle is built all the same,
|
|
39
|
+
* but not bound to a cluster.
|
|
40
|
+
*
|
|
41
|
+
* Validation failures (missing file, no workspace, no app name...) print the reason and leave
|
|
42
|
+
* with `process.exit(1)`: this method is the command, not a library call. See `buildApp2` for
|
|
43
|
+
* the throwing, CI oriented variant.
|
|
14
44
|
*/
|
|
15
|
-
static
|
|
45
|
+
static buildReactApp(appFilePath: string, clusterUrl?: string): Promise<void>;
|
|
16
46
|
static buildApp2(appFilePath: string): Promise<string>;
|
|
17
47
|
private static createIndexJsx;
|
|
18
48
|
/**
|
|
19
49
|
* When served from the runtime env variables are not available, the variables are injected into the html file instead
|
|
20
50
|
*/
|
|
21
51
|
private static createIndexJsxDeployment;
|
|
22
|
-
private static fetchTenantName;
|
|
23
52
|
static getCodenotchEnvVariables(workpace: IWorkspace, options: {
|
|
24
53
|
baseUrl?: string;
|
|
25
54
|
accessToken?: string;
|
|
26
55
|
appName?: string;
|
|
27
|
-
app?:
|
|
28
|
-
tenantName?: string;
|
|
56
|
+
app?: IAppManifest;
|
|
29
57
|
clusterUrl?: string;
|
|
30
58
|
}): Promise<any>;
|
|
31
|
-
static getTenantName(cluster: string): Promise<string | undefined>;
|
|
32
59
|
/** Compiler options shared by the generated build tsconfig and `cn validate` on script files. */
|
|
33
60
|
static defaultCompilerOptions(): {
|
|
34
61
|
target: string;
|
|
@@ -47,27 +74,38 @@ export default abstract class BuildUtils {
|
|
|
47
74
|
jsx: string;
|
|
48
75
|
};
|
|
49
76
|
private static createTsConfig;
|
|
50
|
-
private static createEmptyModule;
|
|
51
77
|
private static createViteConfig;
|
|
52
78
|
private static createIndexHtml;
|
|
53
79
|
private static createPkgJson;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
static
|
|
80
|
+
/**
|
|
81
|
+
* Starts the Vite dev server of one app, with hot reload on the real sources of the project.
|
|
82
|
+
* Behind the command: cn react dev <app>
|
|
83
|
+
*
|
|
84
|
+
* Unlike {@link BuildUtils.buildReactApp}, nothing of the project is copied: the staging
|
|
85
|
+
* folder `.codenotch/<appName>-dev` only holds the generated files (package.json, index.html,
|
|
86
|
+
* index.jsx, vite.config.mjs), and the config aliases the app component to its real path in
|
|
87
|
+
* the workspace. Editing a project file is therefore picked up live by Vite.
|
|
88
|
+
*
|
|
89
|
+
* The `/api/env` endpoint the app reads at startup is served by the dev server itself,
|
|
90
|
+
* through a small plugin of the generated config: the page behaves like the served bundle.
|
|
91
|
+
*
|
|
92
|
+
* Dependencies are installed in the staging on the first run only; delete the folder
|
|
93
|
+
* (or run 'cn react clean <app>') to force a fresh install.
|
|
94
|
+
*
|
|
95
|
+
* Blocks until the server is stopped (Ctrl+C), and returns the exit code it left.
|
|
96
|
+
*/
|
|
97
|
+
static devReactApp(appFilePath: string, options: {
|
|
98
|
+
port: number;
|
|
99
|
+
clusterUrl?: string;
|
|
100
|
+
}): Promise<number>;
|
|
101
|
+
/** The dev entry: same contract as the built one, the app itself comes through the '@app' alias */
|
|
102
|
+
private static createIndexJsxDev;
|
|
103
|
+
/**
|
|
104
|
+
* The dev flavoured Vite config: the app is aliased to its real file in the workspace so that
|
|
105
|
+
* hot reload watches the project sources, and a tiny plugin serves the Codenotch environment.
|
|
106
|
+
*/
|
|
107
|
+
private static createViteDevConfig;
|
|
108
|
+
static getFullManifestAt(folderPath: string): ICodenotchProjectManifest;
|
|
109
|
+
static getManifestAt(folderPath: string): ICodenotchProjectManifest;
|
|
72
110
|
}
|
|
73
111
|
export {};
|