@codenotch/codenotch.cli 1.0.41 → 1.0.43
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 +78 -28
- package/dist/commands/generate/dbcontext.js +2 -2
- package/dist/commands/generate/dbcontext.js.map +1 -1
- package/dist/commands/generate/index.js +1 -1
- package/dist/commands/project/compile.js +7 -4
- package/dist/commands/project/compile.js.map +1 -1
- package/dist/commands/project/deploy.js +53 -5
- package/dist/commands/project/deploy.js.map +1 -1
- package/dist/commands/project/inspect.js +65 -1
- package/dist/commands/project/inspect.js.map +1 -1
- package/dist/commands/project/package.js +2 -2
- package/dist/commands/project/package.js.map +1 -1
- package/dist/commands/system/docs.d.ts +2 -0
- package/dist/commands/system/docs.js +57 -0
- package/dist/commands/system/docs.js.map +1 -0
- package/dist/commands/system/index.js +2 -0
- package/dist/commands/system/index.js.map +1 -1
- package/dist/commands/system/read.js +2 -1
- package/dist/commands/system/read.js.map +1 -1
- package/dist/commands/validation/files/ScriptValidator.js +9 -8
- package/dist/commands/validation/files/ScriptValidator.js.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/DbSchemaUtils.d.ts +16 -10
- package/dist/utils/DbSchemaUtils.js +82 -30
- package/dist/utils/DbSchemaUtils.js.map +1 -1
- package/dist/utils/DocsUtils.d.ts +34 -0
- package/dist/utils/DocsUtils.js +76 -0
- package/dist/utils/DocsUtils.js.map +1 -0
- package/dist/utils/ProcessBundlerUtils.d.ts +103 -0
- package/dist/utils/ProcessBundlerUtils.js +336 -0
- package/dist/utils/ProcessBundlerUtils.js.map +1 -0
- package/dist/utils/ProjectCompilationUtils.d.ts +17 -6
- package/dist/utils/ProjectCompilationUtils.js +78 -10
- package/dist/utils/ProjectCompilationUtils.js.map +1 -1
- package/dist/utils/ProjectGeneratorUtils.d.ts +2 -1
- package/dist/utils/ProjectGeneratorUtils.js +21 -14
- package/dist/utils/ProjectGeneratorUtils.js.map +1 -1
- package/dist/utils/ProjectTemplates.d.ts +2 -2
- package/dist/utils/ProjectTemplates.js +12 -6
- package/dist/utils/ProjectTemplates.js.map +1 -1
- package/dist/utils/ProjectUtils.d.ts +24 -1
- package/dist/utils/ProjectUtils.js +49 -29
- package/dist/utils/ProjectUtils.js.map +1 -1
- package/dist/utils/TemplateUtils.d.ts +28 -0
- package/dist/utils/TemplateUtils.js +94 -3
- package/dist/utils/TemplateUtils.js.map +1 -1
- package/package.json +78 -71
- package/resources/docs/apps.md +109 -0
- package/resources/docs/i18n.md +51 -0
- package/resources/docs/processes.md +87 -0
- package/resources/docs/project.md +100 -0
- package/resources/docs/queries.md +54 -0
- package/resources/docs/tables.md +97 -0
package/README.md
CHANGED
|
@@ -1,28 +1,78 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
# Codenotch CLI
|
|
2
|
+
|
|
3
|
+
`cn`, the command line of the [Codenotch](https://codenotch.com/) platform: scaffold, run,
|
|
4
|
+
validate, package and deploy full-stack TypeScript projects — server-side processes, SQL tables,
|
|
5
|
+
NoSQL documents and React 19 apps — on a Codenotch runtime.
|
|
6
|
+
|
|
7
|
+
> The website is not up to date. The reference documentation ships with this CLI: run `cn docs`.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install -g @codenotch/codenotch.cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires Node.js 20+. This gives you the `cn` command (long form: `codenotch-cli`).
|
|
16
|
+
|
|
17
|
+
## Getting started
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
cn runtime update # install (or update) the local Codenotch runtime
|
|
21
|
+
cn runtime start # start it
|
|
22
|
+
cn project new # create a project (asks for the template and the name)
|
|
23
|
+
cn project start # build, deploy and open it
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`cn project new` offers four templates:
|
|
27
|
+
|
|
28
|
+
| Template | What you get |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| `default` | Empty project with a routed React 19 app |
|
|
31
|
+
| `tailwind` | Same, styled with Tailwind CSS 4 (light and dark themes) |
|
|
32
|
+
| `todolist` | Complete todo list app: tables, CRUD processes, queries, translations |
|
|
33
|
+
| `api` | API only: a table and its endpoints, no app at all |
|
|
34
|
+
|
|
35
|
+
## What a project is
|
|
36
|
+
|
|
37
|
+
A Codenotch project is TypeScript end to end, and the CLI discovers what it declares by parsing
|
|
38
|
+
the sources — there is no registry to maintain:
|
|
39
|
+
|
|
40
|
+
- **processes** — `process({...})` declarations exposed as API endpoints, timers or signals;
|
|
41
|
+
- **tables and documents** — `defineEntity({...})` / `defineDocument({...})`, from which the
|
|
42
|
+
database schema and the typed data access are generated;
|
|
43
|
+
- **queries** — `.cnql` read queries the processes run;
|
|
44
|
+
- **apps** — React 19 components, built and dev-served with Vite;
|
|
45
|
+
- **translations** — `*.i18n.csv` files turned into typed classes.
|
|
46
|
+
|
|
47
|
+
Run `cn docs` for the reference of each of these, matching the installed CLI version.
|
|
48
|
+
|
|
49
|
+
## Everyday commands
|
|
50
|
+
|
|
51
|
+
| Command | What it does |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `cn project start` | build, deploy and start the project on the local runtime |
|
|
54
|
+
| `cn project refresh` | after a change: sync the project with the running runtime |
|
|
55
|
+
| `cn project inspect` | parse the project and display everything the CLI discovered |
|
|
56
|
+
| `cn validate .` | hints, warnings and errors of every file |
|
|
57
|
+
| `cn generate ...` | derived files (db schema, openapi, i18n classes) and scaffolds (apps, model processes) |
|
|
58
|
+
| `cn react dev` | Vite dev server with hot reload for an app |
|
|
59
|
+
| `cn project package` / `deploy` | ship a project as a zip to a runtime |
|
|
60
|
+
|
|
61
|
+
Run `cn --help` (or `cn <command> --help`) for the complete list.
|
|
62
|
+
|
|
63
|
+
## Built for AI coding agents
|
|
64
|
+
|
|
65
|
+
Every generated project carries an `AGENTS.md` (and a `CLAUDE.md` importing it) telling coding
|
|
66
|
+
agents how to work on it: the rules of the generated files, and where the reference lives —
|
|
67
|
+
`cn docs <topic>` (project, tables, processes, queries, apps, i18n), so the documentation always
|
|
68
|
+
matches the installed CLI. `cn validate`, `cn project inspect`, `cn runtime info` and `cn docs`
|
|
69
|
+
take `--json` for machine-readable output.
|
|
70
|
+
|
|
71
|
+
## Contributing
|
|
72
|
+
|
|
73
|
+
See [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) for the development setup and
|
|
74
|
+
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the map of the code base.
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT
|
|
@@ -13,7 +13,7 @@ const shared_1 = require("./shared");
|
|
|
13
13
|
function registerGenerateDbContext(generate) {
|
|
14
14
|
generate
|
|
15
15
|
.command('dbcontext')
|
|
16
|
-
.description('Scan the tables of a project and generate its db-schema.xml + db-schema.ts')
|
|
16
|
+
.description('Scan the tables and documents of a project and generate its db-schema.xml + db-schema.d.ts')
|
|
17
17
|
.requiredOption('-f, --project-path <path>', 'path to the project')
|
|
18
18
|
.addHelpText('after', `
|
|
19
19
|
Examples:
|
|
@@ -30,7 +30,7 @@ Examples:
|
|
|
30
30
|
if (!(0, shared_1.reportGeneration)(result)) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
ConsoleUtils_1.default.check(`${result.tableCount} table(s) scanned, schema written to ${chalk_1.default.green(result.written[0])} and ${chalk_1.default.green(result.written[1])}`);
|
|
33
|
+
ConsoleUtils_1.default.check(`${result.tableCount} table(s) and ${result.documentCount} document(s) scanned, schema written to ${chalk_1.default.green(result.written[0])} and ${chalk_1.default.green(result.written[1])}`);
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=dbcontext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbcontext.js","sourceRoot":"","sources":["../../../src/commands/generate/dbcontext.ts"],"names":[],"mappings":";;;;;AAQA,8DA0BC;AAjCD,kDAA0B;AAC1B,+BAA+B;AAC/B,sEAA8C;AAC9C,4EAAoD;AACpD,8FAAsE;AACtE,qCAA4C;AAE5C,SAAgB,yBAAyB,CAAC,QAAiB;IACvD,QAAQ;SACH,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"dbcontext.js","sourceRoot":"","sources":["../../../src/commands/generate/dbcontext.ts"],"names":[],"mappings":";;;;;AAQA,8DA0BC;AAjCD,kDAA0B;AAC1B,+BAA+B;AAC/B,sEAA8C;AAC9C,4EAAoD;AACpD,8FAAsE;AACtE,qCAA4C;AAE5C,SAAgB,yBAAyB,CAAC,QAAiB;IACvD,QAAQ;SACH,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,4FAA4F,CAAC;SACzG,cAAc,CAAC,2BAA2B,EAAE,qBAAqB,CAAC;SAClE,WAAW,CAAC,OAAO,EAAE;;;CAG7B,CAAC;SACO,MAAM,CAAC,KAAK,EAAE,OAAgC,EAAE,EAAE;QAE/C,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAEjD,IAAI,MAAM,mBAAS,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE,CAAC;YAChD,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,MAAM,CAAC,aAAa,WAAW,eAAe,CAAC,CAAC,CAAC;YACrE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACX,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,+BAAqB,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAC1E,IAAI,CAAC,IAAA,yBAAgB,EAAC,MAAM,CAAC,EAAE,CAAC;YAC5B,OAAO;QACX,CAAC;QAED,sBAAY,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,UAAU,iBAAiB,MAAM,CAAC,aAAa,2CAA2C,eAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,eAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACnM,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -17,7 +17,7 @@ function registerGenerateCommands(program) {
|
|
|
17
17
|
Examples:
|
|
18
18
|
$ cn generate app -n Dashboard an empty React app and its manifest
|
|
19
19
|
$ cn generate i18n regenerate the *.i18n.ts classes of the project
|
|
20
|
-
$ cn generate dbcontext -f . db-schema.xml + db-schema.ts from the tables
|
|
20
|
+
$ cn generate dbcontext -f . db-schema.xml + db-schema.d.ts from the tables and documents
|
|
21
21
|
$ cn generate process -m api -t Book REST endpoints working on a table
|
|
22
22
|
`);
|
|
23
23
|
(0, manifest_1.registerGenerateProjectManifest)(generate);
|
|
@@ -5,20 +5,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.registerCompile = registerCompile;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const ProjectUtils_1 = __importDefault(require("../../utils/ProjectUtils"));
|
|
9
10
|
const shared_1 = require("./shared");
|
|
10
11
|
function registerCompile(project) {
|
|
11
12
|
(0, shared_1.withProjectPathOption)(project
|
|
12
13
|
.command('compile')
|
|
13
|
-
.description('Compile the project,
|
|
14
|
+
.description('Compile the project into .codenotch/compiled, the sources are left untouched')
|
|
15
|
+
.option('-o, --output-path <path>', 'output folder for the compiled project (default .codenotch/compiled)'))
|
|
14
16
|
.action(async (options) => {
|
|
15
|
-
const
|
|
17
|
+
const outputPath = options.outputPath ?? path_1.default.join(options.projectPath, '.codenotch', 'compiled');
|
|
18
|
+
const compilation = await ProjectUtils_1.default.compileProjectTo(options.projectPath, outputPath);
|
|
16
19
|
if (compilation.errors.length > 0) {
|
|
17
20
|
console.error(chalk_1.default.red("Compilation failed with errors:"));
|
|
18
21
|
compilation.errors.forEach(err => console.error(chalk_1.default.red(`- ${err}`)));
|
|
19
22
|
}
|
|
20
23
|
else {
|
|
21
|
-
console.log(chalk_1.default.green(`Project compiled successfully`));
|
|
24
|
+
console.log(chalk_1.default.green(`Project compiled successfully into ${outputPath}`));
|
|
22
25
|
}
|
|
23
26
|
});
|
|
24
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/commands/project/compile.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/commands/project/compile.ts"],"names":[],"mappings":";;;;;AAMA,0CAgBC;AArBD,kDAA0B;AAC1B,gDAAwB;AACxB,4EAAoD;AACpD,qCAAyE;AAEzE,SAAgB,eAAe,CAAC,OAAgB;IAC5C,IAAA,8BAAqB,EAAC,OAAO;SACxB,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,8EAA8E,CAAC;SAC3F,MAAM,CAAC,0BAA0B,EAAE,sEAAsE,CAAC,CAAC;SAC3G,MAAM,CAAC,KAAK,EAAE,OAAyD,EAAE,EAAE;QACxE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QAClG,MAAM,WAAW,GAAG,MAAM,sBAAY,CAAC,gBAAgB,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACzF,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,CAAC;YAC5D,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5E,CAAC;aACI,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAC,CAAC;QACjF,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -4,13 +4,61 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.registerDeploy = registerDeploy;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const ConsoleUtils_1 = __importDefault(require("../../utils/ConsoleUtils"));
|
|
7
11
|
const RuntimeUtils_1 = __importDefault(require("../../utils/RuntimeUtils"));
|
|
12
|
+
const shared_1 = require("./shared");
|
|
8
13
|
function registerDeploy(project) {
|
|
9
|
-
project
|
|
10
|
-
.command('deploy
|
|
11
|
-
.description('Deploy
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
+
(0, shared_1.withProjectPathOption)(project
|
|
15
|
+
.command('deploy')
|
|
16
|
+
.description('Deploy a packaged project to the runtime')
|
|
17
|
+
.argument('<service>', 'service name of the project on the runtime (the serviceName of its manifest.json)')
|
|
18
|
+
.argument('[zip]', "package to deploy, the zip written by 'cn project package' (omitted: pick one under .codenotch/)"))
|
|
19
|
+
.addHelpText('after', `
|
|
20
|
+
Examples:
|
|
21
|
+
$ cn project deploy myproject pick a zip found under .codenotch/
|
|
22
|
+
$ cn project package -o ./myproject.zip
|
|
23
|
+
$ cn project deploy myproject ./myproject.zip
|
|
24
|
+
`)
|
|
25
|
+
.action(async (service, zip, options) => {
|
|
26
|
+
const zipPath = zip ?? await pickPackagedZip(options.projectPath);
|
|
27
|
+
if (zipPath === undefined) {
|
|
28
|
+
process.exitCode = 1;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
await RuntimeUtils_1.default.deployProject(service, zipPath);
|
|
14
32
|
});
|
|
15
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Lets the user pick one of the zips of '<project>/.codenotch', where 'cn project package'
|
|
36
|
+
* writes them, newest first. When stdin is not interactive the newest one is taken.
|
|
37
|
+
*/
|
|
38
|
+
async function pickPackagedZip(projectPath) {
|
|
39
|
+
const codenotchPath = (0, path_1.join)(projectPath, '.codenotch');
|
|
40
|
+
const zips = !(0, fs_1.existsSync)(codenotchPath) ? [] : (0, fs_1.readdirSync)(codenotchPath, { withFileTypes: true })
|
|
41
|
+
.filter(entry => entry.isFile() && entry.name.toLowerCase().endsWith('.zip'))
|
|
42
|
+
.map(entry => {
|
|
43
|
+
const filePath = (0, path_1.join)(codenotchPath, entry.name);
|
|
44
|
+
const stats = (0, fs_1.statSync)(filePath);
|
|
45
|
+
return { name: entry.name, path: filePath, modified: stats.mtime, size: stats.size };
|
|
46
|
+
})
|
|
47
|
+
.sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
48
|
+
if (zips.length === 0) {
|
|
49
|
+
console.error(chalk_1.default.yellow(`Aborted: no zip found in '${codenotchPath}', run 'cn project package' first (or pass the zip to deploy).`));
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const choices = zips.map(zip => ({
|
|
53
|
+
name: zip.name,
|
|
54
|
+
description: `${zip.modified.toLocaleString()}, ${formatSize(zip.size)}`
|
|
55
|
+
}));
|
|
56
|
+
const index = await ConsoleUtils_1.default.select('Package to deploy:', choices);
|
|
57
|
+
return zips[index].path;
|
|
58
|
+
}
|
|
59
|
+
function formatSize(bytes) {
|
|
60
|
+
return bytes < 1024 * 1024
|
|
61
|
+
? `${Math.max(1, Math.round(bytes / 1024))} KB`
|
|
62
|
+
: `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
63
|
+
}
|
|
16
64
|
//# sourceMappingURL=deploy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/commands/project/deploy.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/commands/project/deploy.ts"],"names":[],"mappings":";;;;;AAQA,wCAoBC;AA3BD,kDAA0B;AAC1B,2BAAuD;AACvD,+BAA4B;AAC5B,4EAAoD;AACpD,4EAAoD;AACpD,qCAAyE;AAEzE,SAAgB,cAAc,CAAC,OAAgB;IAC3C,IAAA,8BAAqB,EAAC,OAAO;SACxB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,0CAA0C,CAAC;SACvD,QAAQ,CAAC,WAAW,EAAE,mFAAmF,CAAC;SAC1G,QAAQ,CAAC,OAAO,EAAE,kGAAkG,CAAC,CAAC;SACtH,WAAW,CAAC,OAAO,EAAE;;;;;CAK7B,CAAC;SACO,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,GAAuB,EAAE,OAA+B,EAAE,EAAE;QACxF,MAAM,OAAO,GAAG,GAAG,IAAI,MAAM,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAClE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACX,CAAC;QACD,MAAM,sBAAY,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC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AE,CAAC,CAAC;QAC7B,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,WAAW,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC,cAAc,EAAE,KAAK,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;KAC3E,CAAC,CAAC,CAAC;IACJ,MAAM,KAAK,GAAG,MAAM,sBAAY,CAAC,MAAM,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;AAC5B,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC7B,OAAO,KAAK,GAAG,IAAI,GAAG,IAAI;QACtB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,KAAK;QAC/C,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC"}
|
|
@@ -4,14 +4,78 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.registerInspect = registerInspect;
|
|
7
|
+
const path_1 = require("path");
|
|
7
8
|
const ProjectUtils_1 = __importDefault(require("../../utils/ProjectUtils"));
|
|
9
|
+
const DbSchemaUtils_1 = __importDefault(require("../../utils/DbSchemaUtils"));
|
|
8
10
|
const shared_1 = require("./shared");
|
|
9
11
|
function registerInspect(project) {
|
|
10
12
|
(0, shared_1.withProjectPathOption)(project
|
|
11
13
|
.command('inspect')
|
|
12
|
-
.description('Parse the project and display its structure and configuration')
|
|
14
|
+
.description('Parse the project and display its structure and configuration')
|
|
15
|
+
.option('--json', 'output the discovered structure as JSON instead of text')
|
|
16
|
+
.addHelpText('after', `
|
|
17
|
+
Examples:
|
|
18
|
+
$ cn project inspect what the sources declare (processes, tables, apps, i18n...)
|
|
19
|
+
$ cn project inspect --json the same, machine-readable
|
|
20
|
+
`))
|
|
13
21
|
.action(async (options) => {
|
|
22
|
+
if (options.json === true) {
|
|
23
|
+
const info = await ProjectUtils_1.default.collectProjectInfo(options.projectPath);
|
|
24
|
+
console.log(JSON.stringify(buildJsonReport(options.projectPath, info), null, 4));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
14
27
|
await ProjectUtils_1.default.inspectProject(options.projectPath);
|
|
15
28
|
});
|
|
16
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The machine-readable form of the inspection. A curated shape on purpose: it is a contract for
|
|
32
|
+
* scripts and coding agents, so it exposes what the text output says (plus the structured
|
|
33
|
+
* details behind it) rather than freezing the internal discover* interfaces.
|
|
34
|
+
*/
|
|
35
|
+
function buildJsonReport(projectPath, info) {
|
|
36
|
+
const root = (0, path_1.resolve)(projectPath);
|
|
37
|
+
// Posix separators whatever the OS, so a consumer does not have to handle both
|
|
38
|
+
const rel = (filePath) => ((0, path_1.relative)(root, filePath) || filePath).replaceAll('\\', '/');
|
|
39
|
+
return {
|
|
40
|
+
path: root,
|
|
41
|
+
manifest: info.manifest ?? null,
|
|
42
|
+
package: info.pkgJson ? { name: info.pkgJson.name ?? null, version: info.pkgJson.version ?? null } : null,
|
|
43
|
+
processes: info.processes.map(process => ({
|
|
44
|
+
id: process.id ?? null,
|
|
45
|
+
trigger: process.trigger ?? null,
|
|
46
|
+
scope: process.scope ?? null,
|
|
47
|
+
description: process.description ?? null,
|
|
48
|
+
takesInput: process.takesInput,
|
|
49
|
+
file: rel(process.filePath),
|
|
50
|
+
line: process.line
|
|
51
|
+
})),
|
|
52
|
+
tables: info.tables.map(table => ({
|
|
53
|
+
name: table.name ?? null,
|
|
54
|
+
// The key of 'ctx.tables' in the processes
|
|
55
|
+
collection: table.name !== undefined ? DbSchemaUtils_1.default.toCollectionName(table.name) : null,
|
|
56
|
+
columns: table.columns.map(column => ({ name: column.name, type: column.type ?? null, primary: column.isPrimary })),
|
|
57
|
+
file: rel(table.filePath),
|
|
58
|
+
line: table.line
|
|
59
|
+
})),
|
|
60
|
+
documents: info.documents.map(document => ({
|
|
61
|
+
name: document.name ?? null,
|
|
62
|
+
key: document.name?.toLowerCase() ?? null,
|
|
63
|
+
fields: document.fields.map(field => ({ name: field.name, type: field.type ?? null })),
|
|
64
|
+
file: rel(document.filePath),
|
|
65
|
+
line: document.line
|
|
66
|
+
})),
|
|
67
|
+
apps: info.apps.map(app => ({
|
|
68
|
+
name: app.name,
|
|
69
|
+
type: app.type,
|
|
70
|
+
title: app.manifest.html?.title ?? app.manifest.app?.name ?? null,
|
|
71
|
+
script: rel(app.scriptPath),
|
|
72
|
+
manifest: rel(app.manifestPath)
|
|
73
|
+
})),
|
|
74
|
+
i18ns: info.i18ns.map(i18n => ({
|
|
75
|
+
file: rel(i18n.filePath),
|
|
76
|
+
languages: i18n.languages,
|
|
77
|
+
keys: i18n.keys.length
|
|
78
|
+
}))
|
|
79
|
+
};
|
|
80
|
+
}
|
|
17
81
|
//# sourceMappingURL=inspect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../../src/commands/project/inspect.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../../src/commands/project/inspect.ts"],"names":[],"mappings":";;;;;AAMA,0CAoBC;AAzBD,+BAAyC;AACzC,4EAAoD;AACpD,8EAAsD;AACtD,qCAAyE;AAEzE,SAAgB,eAAe,CAAC,OAAgB;IAC5C,IAAA,8BAAqB,EAAC,OAAO;SACxB,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,+DAA+D,CAAC;SAC5E,MAAM,CAAC,QAAQ,EAAE,yDAAyD,CAAC;SAC3E,WAAW,CAAC,OAAO,EAAE;;;;CAI7B,CAAC,CAAC;SACM,MAAM,CAAC,KAAK,EAAE,OAAoD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ACtF,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC5B,IAAI,EAAE,QAAQ,CAAC,IAAI;SACtB,CAAC,CAAC;QACH,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACxB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,IAAI,IAAI;YACjE,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;YAC3B,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC;SAClC,CAAC,CAAC;QACH,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC3B,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;YACxB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;SACzB,CAAC,CAAC;KACN,CAAC;AACN,CAAC"}
|
|
@@ -13,10 +13,10 @@ function registerPackage(project) {
|
|
|
13
13
|
.command('package')
|
|
14
14
|
.alias('build')
|
|
15
15
|
.description('Compile and package the project, output a zip file')
|
|
16
|
-
.option('-o, --output-path <path>', 'output path for the build zip file')
|
|
16
|
+
.option('-o, --output-path <path>', 'output path for the build zip file (default .codenotch/build.zip)')
|
|
17
17
|
.option('-i, --ignore-errors', 'ignore compilation errors and proceed with packaging', false))
|
|
18
18
|
.action(async (options) => {
|
|
19
|
-
const outputPath = options.outputPath ?? path_1.default.join(options.projectPath, "build.zip");
|
|
19
|
+
const outputPath = options.outputPath ?? path_1.default.join(options.projectPath, ".codenotch", "build.zip");
|
|
20
20
|
const ignoreErrors = options.ignoreErrors ?? false;
|
|
21
21
|
await ProjectUtils_1.default.packageProject(options.projectPath, outputPath, ignoreErrors);
|
|
22
22
|
console.log(chalk_1.default.green(`Project built successfully at ${outputPath}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/commands/project/package.ts"],"names":[],"mappings":";;;;;AAMA,0CAaC;AAlBD,kDAA0B;AAC1B,gDAAwB;AACxB,4EAAoD;AACpD,qCAAyE;AAEzE,SAAgB,eAAe,CAAC,OAAgB;IAC5C,IAAA,8BAAqB,EAAC,OAAO;SACxB,OAAO,CAAC,SAAS,CAAC;SAClB,KAAK,CAAC,OAAO,CAAC;SACd,WAAW,CAAC,oDAAoD,CAAC;SACjE,MAAM,CAAC,0BAA0B,EAAE,
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/commands/project/package.ts"],"names":[],"mappings":";;;;;AAMA,0CAaC;AAlBD,kDAA0B;AAC1B,gDAAwB;AACxB,4EAAoD;AACpD,qCAAyE;AAEzE,SAAgB,eAAe,CAAC,OAAgB;IAC5C,IAAA,8BAAqB,EAAC,OAAO;SACxB,OAAO,CAAC,SAAS,CAAC;SAClB,KAAK,CAAC,OAAO,CAAC;SACd,WAAW,CAAC,oDAAoD,CAAC;SACjE,MAAM,CAAC,0BAA0B,EAAE,mEAAmE,CAAC;SACvG,MAAM,CAAC,qBAAqB,EAAE,sDAAsD,EAAE,KAAK,CAAC,CAAC;SAC7F,MAAM,CAAC,KAAK,EAAE,OAAiF,EAAE,EAAE;QAChG,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;QACnG,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,KAAK,CAAC;QACnD,MAAM,sBAAY,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;QACjF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,iCAAiC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.registerDocs = registerDocs;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const DocsUtils_1 = __importDefault(require("../../utils/DocsUtils"));
|
|
9
|
+
function registerDocs(program) {
|
|
10
|
+
program
|
|
11
|
+
.command('docs [topic]')
|
|
12
|
+
.description('Print the reference documentation of a topic, or list the topics')
|
|
13
|
+
.option('--json', 'output the topic list as JSON instead of text')
|
|
14
|
+
.addHelpText('after', `
|
|
15
|
+
The documentation ships with the CLI and matches its version. It is written for coding agents
|
|
16
|
+
as much as for developers: the AGENTS.md of a generated project tells them to read the topic
|
|
17
|
+
before writing a file of that kind.
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
$ cn docs lists the topics
|
|
21
|
+
$ cn docs --json the same, machine-readable
|
|
22
|
+
$ cn docs tables the reference of the table declarations
|
|
23
|
+
`)
|
|
24
|
+
.action((topic, options) => {
|
|
25
|
+
const topics = DocsUtils_1.default.listTopics();
|
|
26
|
+
if (topics.length === 0) {
|
|
27
|
+
console.error(chalk_1.default.red(`No documentation found at '${DocsUtils_1.default.getDocsFolder()}', the installation looks broken.`));
|
|
28
|
+
process.exitCode = 1;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (options.json === true) {
|
|
32
|
+
// The content of a topic is plain markdown already, only the listing has a JSON form
|
|
33
|
+
if (topic !== undefined) {
|
|
34
|
+
console.error(chalk_1.default.yellow(`'--json' only applies to the topic list, 'cn docs ${topic}' already prints plain markdown.`));
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
console.log(JSON.stringify(topics.map(entry => ({ name: entry.name, summary: entry.summary })), null, 4));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (topic === undefined) {
|
|
42
|
+
for (const entry of topics) {
|
|
43
|
+
console.log(`${chalk_1.default.cyan(`cn docs ${entry.name}`.padEnd(20))} ${entry.summary}`);
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const content = DocsUtils_1.default.readTopic(topic);
|
|
48
|
+
if (content === undefined) {
|
|
49
|
+
console.error(chalk_1.default.yellow(`Unknown topic '${topic}', expected one of: ${topics.map(entry => entry.name).join(', ')}.`));
|
|
50
|
+
process.exitCode = 1;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// Raw markdown on purpose: the output is meant to be read by agents and pagers alike
|
|
54
|
+
console.log(content);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/commands/system/docs.ts"],"names":[],"mappings":";;;;;AAIA,oCAoDC;AAvDD,kDAA0B;AAC1B,sEAA8C;AAE9C,SAAgB,YAAY,CAAC,OAAgB;IACzC,OAAO;SACF,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,kEAAkE,CAAC;SAC/E,MAAM,CAAC,QAAQ,EAAE,+CAA+C,CAAC;SACjE,WAAW,CAAC,OAAO,EAAE;;;;;;;;;CAS7B,CAAC;SACO,MAAM,CAAC,CAAC,KAAyB,EAAE,OAA2B,EAAE,EAAE;QAE/D,MAAM,MAAM,GAAG,mBAAS,CAAC,UAAU,EAAE,CAAC;QACtC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC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AK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACzH,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACX,CAAC;QAED,qFAAqF;QACrF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.registerSystemCommands = registerSystemCommands;
|
|
4
4
|
const info_1 = require("./info");
|
|
5
5
|
const read_1 = require("./read");
|
|
6
|
+
const docs_1 = require("./docs");
|
|
6
7
|
// Root-level commands that are not tied to a specific project or the runtime
|
|
7
8
|
function registerSystemCommands(program) {
|
|
8
9
|
(0, info_1.registerInfo)(program);
|
|
9
10
|
(0, read_1.registerRead)(program);
|
|
11
|
+
(0, docs_1.registerDocs)(program);
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/system/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/system/index.ts"],"names":[],"mappings":";;AAMA,wDAIC;AATD,iCAAsC;AACtC,iCAAsC;AACtC,iCAAsC;AAEtC,6EAA6E;AAC7E,SAAgB,sBAAsB,CAAC,OAAgB;IACnD,IAAA,mBAAY,EAAC,OAAO,CAAC,CAAC;IACtB,IAAA,mBAAY,EAAC,OAAO,CAAC,CAAC;IACtB,IAAA,mBAAY,EAAC,OAAO,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -8,8 +8,9 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
8
8
|
const readline_1 = require("readline");
|
|
9
9
|
const process_1 = require("process");
|
|
10
10
|
function registerRead(program) {
|
|
11
|
+
// Manual test of the readline prompts, of no use to a consumer: kept out of --help
|
|
11
12
|
program
|
|
12
|
-
.command('read')
|
|
13
|
+
.command('read', { hidden: true })
|
|
13
14
|
.description('Read test')
|
|
14
15
|
.action(async () => {
|
|
15
16
|
console.log(chalk_1.default.green('Read test:'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/commands/system/read.ts"],"names":[],"mappings":";;;;;AAKA,
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/commands/system/read.ts"],"names":[],"mappings":";;;;;AAKA,oCAoBC;AAxBD,kDAA0B;AAC1B,uCAA2C;AAC3C,qCAA2D;AAE3D,SAAgB,YAAY,CAAC,OAAgB;IACzC,mFAAmF;IACnF,OAAO;SACF,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;SACjC,WAAW,CAAC,WAAW,CAAC;SACxB,MAAM,CAAC,KAAK,IAAI,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QAEvC,MAAM,EAAE,GAAG,IAAA,0BAAe,EAAC,EAAE,KAAK,EAAL,eAAK,EAAE,MAAM,EAAN,gBAAM,EAAE,CAAC,CAAC;QAE9C,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;gBACjD,EAAE,CAAC,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;YACnD,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,iBAAiB,eAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC;gBACO,CAAC;YACL,EAAE,CAAC,KAAK,EAAE,CAAC;QACf,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -97,15 +97,16 @@ class CliScriptCompiler {
|
|
|
97
97
|
options = typescript_1.default.convertCompilerOptionsFromJson(BuildUtils_1.default.defaultCompilerOptions(), basePath).options;
|
|
98
98
|
}
|
|
99
99
|
options.noEmit = true;
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
// The generated 'db-schema.d.ts' augments '@codenotch/process' with the typed tables and
|
|
101
|
+
// documents. A tsconfig includes it through its file list (handled above); without one it
|
|
102
|
+
// has to join the program by hand, or 'ctx.tables.<name>' would not resolve.
|
|
103
|
+
if (!configPath) {
|
|
104
|
+
const workspacePath = BuildUtils_1.default.findWorkspaceFromFile(requestedFiles[0]);
|
|
105
|
+
const dbSchemaPath = workspacePath ? (0, path_1.join)(workspacePath, 'db-schema.d.ts') : undefined;
|
|
106
|
+
if (dbSchemaPath !== undefined && (0, fs_1.existsSync)(dbSchemaPath)) {
|
|
107
|
+
rootFiles.push((0, path_1.resolve)(dbSchemaPath));
|
|
107
108
|
}
|
|
108
|
-
}
|
|
109
|
+
}
|
|
109
110
|
const program = typescript_1.default.createProgram([...new Set(rootFiles)], options);
|
|
110
111
|
const diagnostics = [...configDiagnostics, ...typescript_1.default.getPreEmitDiagnostics(program)];
|
|
111
112
|
const isRequestedFile = (fileName) => requestedFiles.some(f => f.toLowerCase() === (0, path_1.resolve)(fileName).toLowerCase());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptValidator.js","sourceRoot":"","sources":["../../../../src/commands/validation/files/ScriptValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"ScriptValidator.js","sourceRoot":"","sources":["../../../../src/commands/validation/files/ScriptValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,2BAAgC;AAChC,4DAA4B;AAE5B,2EAAmD;AACnD,yE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AC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,IAAA,cAAO,EAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QAElF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACnC,gEAAgE;YAChE,IAAI,UAAU,CAAC,IAAI,IAAI,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,EAAE,CAAC;gBACzE,SAAS;YACb,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,yBAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,SAAS,CAAC,KAAmB;QACzB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IACpE,CAAC;IAED,WAAW,CAAC,OAAe;QACvB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACtE,CAAC;CACJ;AAvED,8CAuEC"}
|
package/dist/index.js
CHANGED
|
@@ -48,8 +48,18 @@ const packageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname
|
|
|
48
48
|
const program = new commander_1.Command();
|
|
49
49
|
program
|
|
50
50
|
.name('codenotch-cli')
|
|
51
|
-
.description('CLI
|
|
52
|
-
.version(packageJson.version)
|
|
51
|
+
.description('CLI of the Codenotch platform: manage the local runtime, scaffold and deploy projects, generate their derived files, and work on their React apps')
|
|
52
|
+
.version(packageJson.version)
|
|
53
|
+
.addHelpText('after', `
|
|
54
|
+
The reference documentation ships with the CLI: 'cn docs' lists its topics (project anatomy,
|
|
55
|
+
tables, processes, queries, apps, i18n). Read the topic before writing a file of that kind.
|
|
56
|
+
|
|
57
|
+
Getting started:
|
|
58
|
+
$ cn runtime update install (or update) the local Codenotch runtime
|
|
59
|
+
$ cn runtime start
|
|
60
|
+
$ cn project new create a project (asks for the template and the name)
|
|
61
|
+
$ cn project start build, deploy and open it
|
|
62
|
+
`);
|
|
53
63
|
(0, commands_1.registerAllCommands)(program);
|
|
54
64
|
program.parse();
|
|
55
65
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,2BAAkC;AAClC,6CAAkC;AAClC,oDAA4B;AAC5B,yCAAiD;AAEjD,2HAA2H;AAC3H,gBAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACzF,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACF,IAAI,CAAC,eAAe,CAAC;KACrB,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,2BAAkC;AAClC,6CAAkC;AAClC,oDAA4B;AAC5B,yCAAiD;AAEjD,2HAA2H;AAC3H,gBAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACzF,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACF,IAAI,CAAC,eAAe,CAAC;KACrB,WAAW,CAAC,mJAAmJ,CAAC;KAChK,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC;KAC5B,WAAW,CAAC,OAAO,EAAE;;;;;;;;;CASzB,CAAC,CAAC;AAEH,IAAA,8BAAmB,EAAC,OAAO,CAAC,CAAC;AAE7B,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { IDiscoveredTable } from './ProjectUtils';
|
|
1
|
+
import { IDiscoveredDocument, IDiscoveredTable } from './ProjectUtils';
|
|
2
2
|
export interface IDbSchemaGenerationResult {
|
|
3
3
|
content: string;
|
|
4
4
|
warnings: string[];
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* Builds the two files describing the database of a project out of its 'defineEntity'
|
|
8
|
-
* 'db-schema.xml', read by the runtime to migrate the database,
|
|
9
|
-
*
|
|
7
|
+
* Builds the two files describing the database of a project out of its 'defineEntity' and
|
|
8
|
+
* 'defineDocument' declarations: 'db-schema.xml', read by the runtime to migrate the database,
|
|
9
|
+
* and 'db-schema.d.ts', which augments the 'ProjectTables' and 'ProjectDocs' interfaces of
|
|
10
|
+
* '@codenotch/process' so that `ctx.tables.<name>` is typed in the processes.
|
|
10
11
|
*/
|
|
11
12
|
export default abstract class DbSchemaUtils {
|
|
12
13
|
/**
|
|
@@ -22,15 +23,20 @@ export default abstract class DbSchemaUtils {
|
|
|
22
23
|
static generateXml(tables: IDiscoveredTable[], version: string): IDbSchemaGenerationResult;
|
|
23
24
|
private static generateColumnXml;
|
|
24
25
|
/**
|
|
25
|
-
* 'db-schema.ts', the
|
|
26
|
+
* 'db-schema.d.ts', the declaration merging file typing `ctx.tables` and the documents:
|
|
27
|
+
* it augments '@codenotch/process' with one typed handle per table and per document.
|
|
28
|
+
*
|
|
29
|
+
* The file must stay a module (have a top level import) for the `declare module` block to be
|
|
30
|
+
* an augmentation: as a plain script it would *declare* '@codenotch/process' instead of
|
|
31
|
+
* merging into it. It also only applies to files of the same TypeScript program, hence the
|
|
32
|
+
* tsconfig of the project has to include it.
|
|
26
33
|
*
|
|
27
34
|
* @param tables tables of the project, see ProjectUtils.discoverTableFiles
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
35
|
+
* @param documents documents of the project, see ProjectUtils.discoverDocumentFiles
|
|
36
|
+
* @param tableImports import line of each table row type, keyed by table name
|
|
37
|
+
* @param documentImports import line of each document type, keyed by document name
|
|
30
38
|
*/
|
|
31
|
-
static
|
|
32
|
-
/** 'my project' and 'my-project' both give 'MyProjectDbSchema' */
|
|
33
|
-
private static toInterfaceName;
|
|
39
|
+
static generateDts(tables: IDiscoveredTable[], documents: IDiscoveredDocument[], tableImports: Map<string, string>, documentImports: Map<string, string>): IDbSchemaGenerationResult;
|
|
34
40
|
/** Splits an import statement back into the type it brings and the file it comes from */
|
|
35
41
|
private static parseImport;
|
|
36
42
|
private static sortByName;
|