@avijs/cli 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +20 -2
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +4 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +154 -0
- package/dist/cli.js.map +1 -0
- package/dist/generate.d.ts +3 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +308 -0
- package/dist/generate.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/templates.d.ts +16 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +310 -0
- package/dist/templates.js.map +1 -0
- package/package.json +52 -3
- package/src/bin.ts +4 -0
- package/src/cli.ts +160 -0
- package/src/generate.ts +394 -0
- package/src/index.ts +3 -0
- package/src/templates.ts +333 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christopher Robin Chase
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @avijs/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The avi command for Avi.js projects.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -D @avijs/cli
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| Command | What it does |
|
|
10
|
+
| ------------------------- | --------------------------------------------------------------------------------- |
|
|
11
|
+
| `avi new <name>` | Creates a project (`--template modular` or `minimal`). Also `npm create avi` |
|
|
12
|
+
| `avi g <kind> <path>` | Adds a `module`, `controller` or `service` and registers it in the nearest module |
|
|
13
|
+
| `avi dev` | Compiles, then recompiles and restarts on every change |
|
|
14
|
+
| `avi check` | Type-checks every `static inject` list |
|
|
15
|
+
| `avi manifest <entry.js>` | Writes the app's modules, providers and routes as JSON |
|
|
16
|
+
|
|
17
|
+
Part of [Avi.js](https://github.com/chrischase011/avi-js), a TypeScript framework for Node.js with
|
|
18
|
+
modules, controllers and dependency injection, without `reflect-metadata`. See the
|
|
19
|
+
[tutorial](https://github.com/chrischase011/avi-js/blob/main/docs/tutorial/README.md) to get started.
|
|
20
|
+
|
|
21
|
+
Requires Node.js 22.12 or newer. MIT licensed.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AA0BA,wBAAsB,IAAI,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBnE"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { main as compile } from '@avijs/compiler';
|
|
2
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { mkdir, readdir, writeFile } from 'node:fs/promises';
|
|
5
|
+
import { createRequire } from 'node:module';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { parseArgs } from 'node:util';
|
|
8
|
+
import { GENERATE_USAGE, generate } from './generate.js';
|
|
9
|
+
import { templateFiles } from './templates.js';
|
|
10
|
+
const { version } = createRequire(import.meta.url)('../package.json');
|
|
11
|
+
const USAGE = `Usage:
|
|
12
|
+
avi new <name> [--template modular|minimal] [--dir .] [--avi-version ^x.y.z] [--from <dir>]
|
|
13
|
+
Create a project. The modular template (default) uses modules and decorators;
|
|
14
|
+
minimal uses plain routes and services. --from points at a folder of packed
|
|
15
|
+
@avijs tarballs (pnpm pack) to install instead of the registry. --avi-version
|
|
16
|
+
defaults to this CLI's version.
|
|
17
|
+
${GENERATE_USAGE}
|
|
18
|
+
avi dev [--project tsconfig.json] [--entry dist/main.js]
|
|
19
|
+
Compile, then recompile and restart on every change.
|
|
20
|
+
avi check [--project tsconfig.json]
|
|
21
|
+
Type-check every static inject list.
|
|
22
|
+
avi manifest <entry.js> [--export AppModule] [--out avi.manifest.json]
|
|
23
|
+
Describe the app's modules, providers and routes.`;
|
|
24
|
+
export async function main(argv) {
|
|
25
|
+
const [command, ...rest] = argv;
|
|
26
|
+
switch (command) {
|
|
27
|
+
case 'new':
|
|
28
|
+
return create(rest);
|
|
29
|
+
case 'generate':
|
|
30
|
+
case 'g':
|
|
31
|
+
return generate(rest);
|
|
32
|
+
case 'dev':
|
|
33
|
+
return dev(rest);
|
|
34
|
+
case 'check':
|
|
35
|
+
case 'manifest':
|
|
36
|
+
return compile(argv);
|
|
37
|
+
default:
|
|
38
|
+
console.error(USAGE);
|
|
39
|
+
return command === undefined || command === 'help' || command === '--help' ? 0 : 2;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function create(args) {
|
|
43
|
+
const { values, positionals } = parseArgs({
|
|
44
|
+
args: [...args],
|
|
45
|
+
allowPositionals: true,
|
|
46
|
+
options: {
|
|
47
|
+
template: { type: 'string', default: 'modular' },
|
|
48
|
+
dir: { type: 'string', default: '.' },
|
|
49
|
+
'avi-version': { type: 'string', default: `^${version}` },
|
|
50
|
+
from: { type: 'string' },
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
const name = positionals[0];
|
|
54
|
+
if (!name || !/^[a-z0-9][a-z0-9._-]*$/.test(name)) {
|
|
55
|
+
console.error('avi new needs a project name in lowercase letters, digits, ".", "_" or "-"');
|
|
56
|
+
return 2;
|
|
57
|
+
}
|
|
58
|
+
const template = values.template;
|
|
59
|
+
if (template !== 'modular' && template !== 'minimal') {
|
|
60
|
+
console.error(`Unknown template "${template}". Use modular or minimal.`);
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
const target = path.resolve(values.dir, name);
|
|
64
|
+
if (existsSync(target) && (await readdir(target)).length > 0) {
|
|
65
|
+
console.error(`${target} already exists and is not empty`);
|
|
66
|
+
return 1;
|
|
67
|
+
}
|
|
68
|
+
const files = templateFiles({
|
|
69
|
+
name,
|
|
70
|
+
template,
|
|
71
|
+
aviVersion: values['avi-version'],
|
|
72
|
+
...(values.from ? { localPackages: await localPackages(values.from, target) } : {}),
|
|
73
|
+
});
|
|
74
|
+
for (const [file, content] of Object.entries(files)) {
|
|
75
|
+
const destination = path.join(target, file);
|
|
76
|
+
await mkdir(path.dirname(destination), { recursive: true });
|
|
77
|
+
await writeFile(destination, content);
|
|
78
|
+
}
|
|
79
|
+
console.log(`Created ${name} (${template}) in ${target}
|
|
80
|
+
|
|
81
|
+
Next:
|
|
82
|
+
cd ${path.relative(process.cwd(), target) || '.'}
|
|
83
|
+
npm install
|
|
84
|
+
npm run dev`);
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
async function dev(args) {
|
|
88
|
+
const { values } = parseArgs({
|
|
89
|
+
args: [...args],
|
|
90
|
+
options: {
|
|
91
|
+
project: { type: 'string', default: 'tsconfig.json' },
|
|
92
|
+
entry: { type: 'string', default: 'dist/main.js' },
|
|
93
|
+
'dry-run': { type: 'boolean', default: false },
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
let tsc;
|
|
97
|
+
try {
|
|
98
|
+
tsc = createRequire(path.resolve('package.json')).resolve('typescript/bin/tsc');
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
console.error('avi dev needs TypeScript installed in this project: npm install -D typescript');
|
|
102
|
+
return 1;
|
|
103
|
+
}
|
|
104
|
+
const build = [tsc, '-p', values.project];
|
|
105
|
+
const watchBuild = [tsc, '-p', values.project, '--watch', '--preserveWatchOutput'];
|
|
106
|
+
const watchRun = ['--watch', '--watch-preserve-output', values.entry];
|
|
107
|
+
if (values['dry-run']) {
|
|
108
|
+
for (const command of [build, watchBuild, watchRun]) {
|
|
109
|
+
console.log(['node', ...command].join(' '));
|
|
110
|
+
}
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
const first = spawnSync(process.execPath, build, { stdio: 'inherit' });
|
|
114
|
+
if (first.status !== 0)
|
|
115
|
+
return first.status ?? 1;
|
|
116
|
+
const children = [
|
|
117
|
+
spawn(process.execPath, watchBuild, { stdio: 'inherit' }),
|
|
118
|
+
spawn(process.execPath, watchRun, { stdio: 'inherit' }),
|
|
119
|
+
];
|
|
120
|
+
return new Promise((resolve) => {
|
|
121
|
+
const stop = () => {
|
|
122
|
+
for (const child of children)
|
|
123
|
+
child.kill();
|
|
124
|
+
resolve(0);
|
|
125
|
+
};
|
|
126
|
+
process.once('SIGINT', stop);
|
|
127
|
+
process.once('SIGTERM', stop);
|
|
128
|
+
for (const child of children) {
|
|
129
|
+
child.once('exit', (code) => {
|
|
130
|
+
if (code !== null && code !== 0) {
|
|
131
|
+
for (const other of children)
|
|
132
|
+
other.kill();
|
|
133
|
+
resolve(code);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/** Maps each packed @avi tarball in `dir` to a `file:` spec relative to the new project. */
|
|
140
|
+
async function localPackages(dir, project) {
|
|
141
|
+
const folder = path.resolve(dir);
|
|
142
|
+
const specs = {};
|
|
143
|
+
for (const file of await readdir(folder)) {
|
|
144
|
+
const match = /^avijs-([a-z-]+?)-\d+\.\d+\.\d+.*\.tgz$/.exec(file);
|
|
145
|
+
if (!match?.[1])
|
|
146
|
+
continue;
|
|
147
|
+
const relative = path.relative(project, path.join(folder, file)).replaceAll(path.sep, '/');
|
|
148
|
+
specs[`@avijs/${match[1]}`] = `file:${relative}`;
|
|
149
|
+
}
|
|
150
|
+
if (!specs['@avijs/core'])
|
|
151
|
+
throw new Error(`No @avijs package tarballs found in ${folder}`);
|
|
152
|
+
return specs;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 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,CAAC,CAAC;QACnE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAAE,SAAS;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC3F,KAAK,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,QAAQ,EAAE,CAAC;IACnD,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;IAC5F,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const GENERATE_USAGE = " avi generate <module|controller|service> <path> [--root .] [--dry-run]\n Create a module, controller or service and register it. Short: avi g co admin/posts.\n Modular projects get src/modules/<path>/<name>.<kind>.ts, registered in the nearest\n module; minimal projects get src/routes/<path>.ts or src/services/<path>.ts, registered\n in src/app.ts.";
|
|
2
|
+
export declare function generate(args: readonly string[]): Promise<number>;
|
|
3
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,cAAc,yXAIN,CAAC;AAiDtB,wBAAsB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAmDvE"}
|
package/dist/generate.js
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { parseArgs } from 'node:util';
|
|
5
|
+
import ts from 'typescript';
|
|
6
|
+
const KINDS = {
|
|
7
|
+
module: 'module',
|
|
8
|
+
mo: 'module',
|
|
9
|
+
controller: 'controller',
|
|
10
|
+
co: 'controller',
|
|
11
|
+
service: 'service',
|
|
12
|
+
s: 'service',
|
|
13
|
+
};
|
|
14
|
+
const SEGMENT = /^[a-z][a-z0-9-]*$/;
|
|
15
|
+
export const GENERATE_USAGE = ` avi generate <module|controller|service> <path> [--root .] [--dry-run]
|
|
16
|
+
Create a module, controller or service and register it. Short: avi g co admin/posts.
|
|
17
|
+
Modular projects get src/modules/<path>/<name>.<kind>.ts, registered in the nearest
|
|
18
|
+
module; minimal projects get src/routes/<path>.ts or src/services/<path>.ts, registered
|
|
19
|
+
in src/app.ts.`;
|
|
20
|
+
/** Files to write, keyed by absolute path. Reads fall back to disk. */
|
|
21
|
+
class Plan {
|
|
22
|
+
#files = new Map();
|
|
23
|
+
notes = [];
|
|
24
|
+
exists(file) {
|
|
25
|
+
return this.#files.has(file) || existsSync(file);
|
|
26
|
+
}
|
|
27
|
+
async read(file) {
|
|
28
|
+
return this.#files.get(file)?.content ?? (await readFile(file, 'utf8'));
|
|
29
|
+
}
|
|
30
|
+
create(file, content) {
|
|
31
|
+
if (this.exists(file))
|
|
32
|
+
throw new GenerateError(`${file} already exists`);
|
|
33
|
+
this.#files.set(file, { content, created: true });
|
|
34
|
+
}
|
|
35
|
+
update(file, content) {
|
|
36
|
+
const existing = this.#files.get(file);
|
|
37
|
+
this.#files.set(file, { content, created: existing?.created ?? false });
|
|
38
|
+
}
|
|
39
|
+
async apply(root, dryRun) {
|
|
40
|
+
for (const [file, { content, created }] of this.#files) {
|
|
41
|
+
console.log(`${created ? 'CREATE' : 'UPDATE'} ${path.relative(root, file).replaceAll('\\', '/')}`);
|
|
42
|
+
if (dryRun)
|
|
43
|
+
continue;
|
|
44
|
+
await mkdir(path.dirname(file), { recursive: true });
|
|
45
|
+
await writeFile(file, content);
|
|
46
|
+
}
|
|
47
|
+
for (const note of this.notes)
|
|
48
|
+
console.log(note);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class GenerateError extends Error {
|
|
52
|
+
}
|
|
53
|
+
export async function generate(args) {
|
|
54
|
+
const { values, positionals } = parseArgs({
|
|
55
|
+
args: [...args],
|
|
56
|
+
allowPositionals: true,
|
|
57
|
+
options: {
|
|
58
|
+
root: { type: 'string', default: '.' },
|
|
59
|
+
'dry-run': { type: 'boolean', default: false },
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
const [kindArg, target] = positionals;
|
|
63
|
+
const kind = kindArg === undefined ? undefined : KINDS[kindArg];
|
|
64
|
+
if (!kind || !target) {
|
|
65
|
+
console.error(`Usage:\n${GENERATE_USAGE}`);
|
|
66
|
+
return 2;
|
|
67
|
+
}
|
|
68
|
+
const segments = target.split('/').filter(Boolean);
|
|
69
|
+
const bad = segments.find((segment) => !SEGMENT.test(segment));
|
|
70
|
+
if (segments.length === 0 || bad !== undefined) {
|
|
71
|
+
console.error(`Invalid path "${target}": use lowercase names with letters, digits and "-", separated by "/"`);
|
|
72
|
+
return 2;
|
|
73
|
+
}
|
|
74
|
+
const root = path.resolve(values.root);
|
|
75
|
+
const src = path.join(root, 'src');
|
|
76
|
+
const layout = existsSync(path.join(src, 'app.module.ts'))
|
|
77
|
+
? 'modular'
|
|
78
|
+
: existsSync(path.join(src, 'app.ts'))
|
|
79
|
+
? 'minimal'
|
|
80
|
+
: undefined;
|
|
81
|
+
if (!layout) {
|
|
82
|
+
console.error(`No src/app.module.ts or src/app.ts in ${root}. Run avi generate in an Avi.js project, or pass --root.`);
|
|
83
|
+
return 1;
|
|
84
|
+
}
|
|
85
|
+
const names = toNames(segments.at(-1));
|
|
86
|
+
const dirs = segments.slice(0, -1);
|
|
87
|
+
const plan = new Plan();
|
|
88
|
+
try {
|
|
89
|
+
if (layout === 'modular')
|
|
90
|
+
await modular(plan, src, kind, dirs, names);
|
|
91
|
+
else
|
|
92
|
+
await minimal(plan, src, kind, dirs, names);
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
if (!(error instanceof GenerateError))
|
|
96
|
+
throw error;
|
|
97
|
+
console.error(error.message);
|
|
98
|
+
return 1;
|
|
99
|
+
}
|
|
100
|
+
await plan.apply(root, values['dry-run']);
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
async function modular(plan, src, kind, dirs, names) {
|
|
104
|
+
const folder = path.join(src, 'modules', ...dirs, names.file);
|
|
105
|
+
const file = path.join(folder, `${names.file}.${kind}.ts`);
|
|
106
|
+
const className = `${names.pascal}${capitalize(kind)}`;
|
|
107
|
+
if (kind === 'module') {
|
|
108
|
+
plan.create(file, `import { Module } from '@avijs/core';\n\n@Module({})\nexport class ${className} {}\n`);
|
|
109
|
+
await register(plan, nearestModule(plan, src, path.dirname(folder)), 'imports', className, file);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (kind === 'service') {
|
|
113
|
+
plan.create(file, `import { Injectable } from '@avijs/core';
|
|
114
|
+
|
|
115
|
+
@Injectable()
|
|
116
|
+
export class ${className} {
|
|
117
|
+
findAll(): unknown[] {
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`);
|
|
122
|
+
await register(plan, nearestModule(plan, src, folder), 'providers', className, file);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const service = path.join(folder, `${names.file}.service.ts`);
|
|
126
|
+
const serviceClass = `${names.pascal}Service`;
|
|
127
|
+
plan.create(file, plan.exists(service)
|
|
128
|
+
? `import { Controller, Get } from '@avijs/core';
|
|
129
|
+
import { ${serviceClass} } from './${names.file}.service.js';
|
|
130
|
+
|
|
131
|
+
@Controller('/${names.file}')
|
|
132
|
+
export class ${className} {
|
|
133
|
+
static inject = [${serviceClass}] as const;
|
|
134
|
+
|
|
135
|
+
constructor(private readonly ${names.camel}: ${serviceClass}) {}
|
|
136
|
+
|
|
137
|
+
@Get()
|
|
138
|
+
findAll() {
|
|
139
|
+
return this.${names.camel}.findAll();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
`
|
|
143
|
+
: `import { Controller, Get } from '@avijs/core';
|
|
144
|
+
|
|
145
|
+
@Controller('/${names.file}')
|
|
146
|
+
export class ${className} {
|
|
147
|
+
@Get()
|
|
148
|
+
findAll() {
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
`);
|
|
153
|
+
await register(plan, nearestModule(plan, src, folder), 'controllers', className, file);
|
|
154
|
+
}
|
|
155
|
+
async function minimal(plan, src, kind, dirs, names) {
|
|
156
|
+
if (kind === 'module') {
|
|
157
|
+
throw new GenerateError('This is a minimal project (src/app.ts, no src/app.module.ts), which does not use modules. Generate a controller or service, or see the project structure chapter to move to modules.');
|
|
158
|
+
}
|
|
159
|
+
const app = path.join(src, 'app.ts');
|
|
160
|
+
const service = path.join(src, 'services', ...dirs, `${names.file}.ts`);
|
|
161
|
+
const serviceClass = `${names.pascal}Service`;
|
|
162
|
+
if (kind === 'service') {
|
|
163
|
+
plan.create(service, `export class ${serviceClass} {
|
|
164
|
+
findAll(): unknown[] {
|
|
165
|
+
return [];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
`);
|
|
169
|
+
await register(plan, app, 'providers', serviceClass, service);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const file = path.join(src, 'routes', ...dirs, `${names.file}.ts`);
|
|
173
|
+
const exportName = `${names.camel}Routes`;
|
|
174
|
+
const serviceImport = importPath(file, service);
|
|
175
|
+
plan.create(file, plan.exists(service)
|
|
176
|
+
? `import { defineController, route } from '@avijs/core';
|
|
177
|
+
import { ${serviceClass} } from '${serviceImport}';
|
|
178
|
+
|
|
179
|
+
export const ${exportName} = defineController({
|
|
180
|
+
prefix: '/${names.file}',
|
|
181
|
+
inject: [${serviceClass}],
|
|
182
|
+
routes: (${names.camel}) => [
|
|
183
|
+
route({ method: 'GET', path: '/', handler: () => ${names.camel}.findAll() }),
|
|
184
|
+
],
|
|
185
|
+
});
|
|
186
|
+
`
|
|
187
|
+
: `import { defineController, route } from '@avijs/core';
|
|
188
|
+
|
|
189
|
+
export const ${exportName} = defineController({
|
|
190
|
+
prefix: '/${names.file}',
|
|
191
|
+
routes: [route({ method: 'GET', path: '/', handler: () => [] })],
|
|
192
|
+
});
|
|
193
|
+
`);
|
|
194
|
+
await register(plan, app, 'controllers', exportName, file);
|
|
195
|
+
}
|
|
196
|
+
/** The closest `*.module.ts` from `dir` up to `src/modules`, else `src/app.module.ts`. */
|
|
197
|
+
function nearestModule(plan, src, dir) {
|
|
198
|
+
const stop = path.join(src, 'modules');
|
|
199
|
+
for (let current = dir; current.startsWith(stop); current = path.dirname(current)) {
|
|
200
|
+
const own = path.join(current, `${path.basename(current)}.module.ts`);
|
|
201
|
+
if (plan.exists(own))
|
|
202
|
+
return own;
|
|
203
|
+
if (existsSync(current)) {
|
|
204
|
+
const other = readdirSync(current)
|
|
205
|
+
.filter((entry) => entry.endsWith('.module.ts'))
|
|
206
|
+
.sort()[0];
|
|
207
|
+
if (other)
|
|
208
|
+
return path.join(current, other);
|
|
209
|
+
}
|
|
210
|
+
if (current === stop)
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
return path.join(src, 'app.module.ts');
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Adds `identifier` to the `property` array of the first `@Module({...})`, `defineModule({...})`
|
|
217
|
+
* or `.register({...})` object in `file`, and imports it. Leaves a note when it can't.
|
|
218
|
+
*/
|
|
219
|
+
async function register(plan, file, property, identifier, from) {
|
|
220
|
+
const where = path.basename(file);
|
|
221
|
+
const manual = `NOTE Add ${identifier} to ${property} in ${where} yourself (import it from '${importPath(file, from)}').`;
|
|
222
|
+
if (!plan.exists(file)) {
|
|
223
|
+
plan.notes.push(manual);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const text = await plan.read(file);
|
|
227
|
+
const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
228
|
+
const object = findRegistration(source);
|
|
229
|
+
if (!object) {
|
|
230
|
+
plan.notes.push(manual);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const edits = [];
|
|
234
|
+
const existing = object.properties.find((prop) => ts.isPropertyAssignment(prop) && prop.name.getText(source) === property);
|
|
235
|
+
if (existing) {
|
|
236
|
+
const array = existing.initializer;
|
|
237
|
+
if (!ts.isArrayLiteralExpression(array)) {
|
|
238
|
+
plan.notes.push(manual);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (array.elements.some((element) => element.getText(source) === identifier))
|
|
242
|
+
return;
|
|
243
|
+
const last = array.elements.at(-1);
|
|
244
|
+
edits.push(last
|
|
245
|
+
? { at: last.getEnd(), text: `, ${identifier}` }
|
|
246
|
+
: { at: array.getStart(source) + 1, text: identifier });
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
const last = object.properties.at(-1);
|
|
250
|
+
edits.push(last
|
|
251
|
+
? { at: last.getEnd(), text: `, ${property}: [${identifier}]` }
|
|
252
|
+
: { at: object.getStart(source) + 1, text: ` ${property}: [${identifier}] ` });
|
|
253
|
+
}
|
|
254
|
+
const imported = source.statements.some((statement) => ts.isImportDeclaration(statement) &&
|
|
255
|
+
statement.importClause?.namedBindings !== undefined &&
|
|
256
|
+
ts.isNamedImports(statement.importClause.namedBindings) &&
|
|
257
|
+
statement.importClause.namedBindings.elements.some((e) => e.name.text === identifier));
|
|
258
|
+
if (!imported) {
|
|
259
|
+
const line = `import { ${identifier} } from '${importPath(file, from)}';`;
|
|
260
|
+
const lastImport = source.statements.filter(ts.isImportDeclaration).at(-1);
|
|
261
|
+
edits.push(lastImport ? { at: lastImport.getEnd(), text: `\n${line}` } : { at: 0, text: `${line}\n` });
|
|
262
|
+
}
|
|
263
|
+
let updated = text;
|
|
264
|
+
for (const edit of edits.sort((a, b) => b.at - a.at)) {
|
|
265
|
+
updated = updated.slice(0, edit.at) + edit.text + updated.slice(edit.at);
|
|
266
|
+
}
|
|
267
|
+
plan.update(file, updated);
|
|
268
|
+
}
|
|
269
|
+
function findRegistration(source) {
|
|
270
|
+
let found;
|
|
271
|
+
const visit = (node) => {
|
|
272
|
+
if (found)
|
|
273
|
+
return;
|
|
274
|
+
if (ts.isCallExpression(node)) {
|
|
275
|
+
const callee = node.expression;
|
|
276
|
+
const name = ts.isIdentifier(callee)
|
|
277
|
+
? callee.text
|
|
278
|
+
: ts.isPropertyAccessExpression(callee)
|
|
279
|
+
? callee.name.text
|
|
280
|
+
: undefined;
|
|
281
|
+
const [first] = node.arguments;
|
|
282
|
+
if ((name === 'Module' || name === 'defineModule' || name === 'register') &&
|
|
283
|
+
first &&
|
|
284
|
+
ts.isObjectLiteralExpression(first)) {
|
|
285
|
+
found = first;
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
ts.forEachChild(node, visit);
|
|
290
|
+
};
|
|
291
|
+
visit(source);
|
|
292
|
+
return found;
|
|
293
|
+
}
|
|
294
|
+
function importPath(from, to) {
|
|
295
|
+
const relative = path
|
|
296
|
+
.relative(path.dirname(from), to)
|
|
297
|
+
.replaceAll('\\', '/')
|
|
298
|
+
.replace(/\.ts$/, '.js');
|
|
299
|
+
return relative.startsWith('.') ? relative : `./${relative}`;
|
|
300
|
+
}
|
|
301
|
+
function toNames(file) {
|
|
302
|
+
const camel = file.replace(/-([a-z0-9])/g, (_, char) => char.toUpperCase());
|
|
303
|
+
return { file, camel, pascal: capitalize(camel) };
|
|
304
|
+
}
|
|
305
|
+
function capitalize(value) {
|
|
306
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE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,EAAE,CAAC,CAAC;IACpF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;AACpD,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type TemplateName = 'modular' | 'minimal';
|
|
2
|
+
export interface TemplateOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
template: TemplateName;
|
|
5
|
+
/** Version range for the @avijs packages. */
|
|
6
|
+
aviVersion: string;
|
|
7
|
+
/**
|
|
8
|
+
* Local package files to use instead of the registry, keyed by package name, such as
|
|
9
|
+
* 'file:../artifacts/avijs-core-0.1.0.tgz'. Also added as npm overrides so packages that depend on
|
|
10
|
+
* each other resolve locally too.
|
|
11
|
+
*/
|
|
12
|
+
localPackages?: Readonly<Record<string, string>>;
|
|
13
|
+
}
|
|
14
|
+
/** Every file of a new project, keyed by its path relative to the project folder. */
|
|
15
|
+
export declare function templateFiles(options: TemplateOptions): Record<string, string>;
|
|
16
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAClD;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAK9E"}
|