@kodly.dev/kodly-cli 1.0.17 → 1.0.18
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 +7 -3
- package/dist/bin/kodly.js +0 -0
- package/dist/commands/man.js +2 -2
- package/dist/commands/scaffold.js +19 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -38,15 +38,19 @@ kodly scaffold create \
|
|
|
38
38
|
-g com.acme.orders \
|
|
39
39
|
-n orders-app \
|
|
40
40
|
-p ./orders-app \
|
|
41
|
-
sql
|
|
41
|
+
sql redis-cache
|
|
42
42
|
|
|
43
43
|
# Or step by step
|
|
44
44
|
kodly scaffold init -g com.acme.orders -n orders-app -p ./orders-app
|
|
45
45
|
cd ./orders-app
|
|
46
|
-
kodly scaffold sql
|
|
47
|
-
kodly scaffold redis-cache
|
|
46
|
+
kodly scaffold sql
|
|
47
|
+
kodly scaffold redis-cache
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
Unversioned skeletons and recipes use the latest stable published Git tag.
|
|
51
|
+
`--skeleton-version <version>` and `recipe@<version>` pin a specific release.
|
|
52
|
+
The API delegates to this same resolver. New tags affect new projects only.
|
|
53
|
+
|
|
50
54
|
## Common commands
|
|
51
55
|
|
|
52
56
|
| Area | Commands |
|
package/dist/bin/kodly.js
CHANGED
|
File without changes
|
package/dist/commands/man.js
CHANGED
|
@@ -62,7 +62,7 @@ export const manCommands = (program) => {
|
|
|
62
62
|
console.log(' Does not require login — fetches recipes from GitHub and writes local files.');
|
|
63
63
|
console.log(chalk.cyan(' $ kodly scaffold create -g <group> -n <name> -p <dir> [recipes...]'));
|
|
64
64
|
console.log(' Example: ' +
|
|
65
|
-
chalk.cyan('kodly scaffold create -g com.acme.orders -n orders-app -p ./orders-app sql
|
|
65
|
+
chalk.cyan('kodly scaffold create -g com.acme.orders -n orders-app -p ./orders-app sql redis-cache'));
|
|
66
66
|
console.log(chalk.cyan(' $ kodly scaffold init --group <group> --name <name>'));
|
|
67
67
|
console.log(' Generate skeleton only (no recipes).');
|
|
68
68
|
console.log(chalk.cyan(' $ kodly scaffold <recipe-name>@<version>'));
|
|
@@ -77,7 +77,7 @@ export const manCommands = (program) => {
|
|
|
77
77
|
chalk.yellow('--dry-run') +
|
|
78
78
|
', ' +
|
|
79
79
|
chalk.yellow('--recipe'));
|
|
80
|
-
console.log(' List available recipes (
|
|
80
|
+
console.log(' List available recipes (latest stable published tags):');
|
|
81
81
|
console.log(chalk.cyan(' $ kodly scaffold list'));
|
|
82
82
|
console.log(chalk.bold('\n10. Shell Autocompletion'));
|
|
83
83
|
console.log(' Enable tab completion for kodly commands.');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import ora from 'ora';
|
|
4
|
-
import { scaffold, scaffoldInit, listRecipes, ScaffoldError, } from '@kodly.dev/scaffolder';
|
|
4
|
+
import { scaffold, scaffoldInit, listRecipes, resolveScaffoldVersions, ScaffoldError, } from '@kodly.dev/scaffolder';
|
|
5
5
|
function errorMessage(error) {
|
|
6
6
|
if (error instanceof ScaffoldError)
|
|
7
7
|
return error.message;
|
|
@@ -24,7 +24,7 @@ async function runInit(opts) {
|
|
|
24
24
|
spinner.succeed(chalk.green(`Dry run for skeleton init (${result.version})`));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
spinner.succeed(chalk.green(`Initialized project ${result.projectName}`));
|
|
27
|
+
spinner.succeed(chalk.green(`Initialized project ${result.projectName} (skeleton@${result.version})`));
|
|
28
28
|
}
|
|
29
29
|
console.log(chalk.dim(` ${result.filesAdded.length} files created (${result.durationMs}ms)`));
|
|
30
30
|
for (const file of result.filesAdded) {
|
|
@@ -70,24 +70,33 @@ async function runApply(recipe, opts) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
async function runCreate(opts) {
|
|
73
|
+
let resolved;
|
|
74
|
+
try {
|
|
75
|
+
resolved = await resolveScaffoldVersions(opts.recipes, opts.version);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.error(chalk.red(errorMessage(error)));
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
73
82
|
const ok = await runInit({
|
|
74
83
|
path: opts.path,
|
|
75
84
|
group: opts.group,
|
|
76
85
|
name: opts.name,
|
|
77
86
|
prefix: opts.prefix,
|
|
78
|
-
version:
|
|
87
|
+
version: resolved.version,
|
|
79
88
|
dryRun: opts.dryRun,
|
|
80
89
|
});
|
|
81
90
|
if (!ok) {
|
|
82
91
|
process.exitCode = 1;
|
|
83
92
|
return;
|
|
84
93
|
}
|
|
85
|
-
if (
|
|
94
|
+
if (resolved.recipes.length === 0) {
|
|
86
95
|
console.log(chalk.dim('\nNo recipes requested. Skeleton is ready.'));
|
|
87
96
|
return;
|
|
88
97
|
}
|
|
89
|
-
console.log(chalk.bold(`\nApplying ${
|
|
90
|
-
for (const recipe of
|
|
98
|
+
console.log(chalk.bold(`\nApplying ${resolved.recipes.length} recipe(s)…\n`));
|
|
99
|
+
for (const recipe of resolved.recipes) {
|
|
91
100
|
const applied = await runApply(recipe, {
|
|
92
101
|
path: opts.path,
|
|
93
102
|
group: opts.group,
|
|
@@ -155,7 +164,7 @@ export const scaffoldCommands = (program) => {
|
|
|
155
164
|
.requiredOption('-n, --name <name>', 'Gradle project name (e.g. rental-app)')
|
|
156
165
|
.option('-p, --path <dir>', 'Target directory (must be empty or not exist)', process.cwd())
|
|
157
166
|
.option('--prefix <prefix>', 'Class prefix (defaults from project name, e.g. RentalApp)')
|
|
158
|
-
.option('--skeleton-version <version>', 'Skeleton
|
|
167
|
+
.option('--skeleton-version <version>', 'Skeleton tag version (default: latest published stable)')
|
|
159
168
|
.option('--dry-run', 'Show what would be created without writing')
|
|
160
169
|
.action(async (opts) => {
|
|
161
170
|
const ok = await runInit({
|
|
@@ -172,12 +181,12 @@ export const scaffoldCommands = (program) => {
|
|
|
172
181
|
scaffoldCmd
|
|
173
182
|
.command('create')
|
|
174
183
|
.description('Create a Spring Boot project and optionally apply recipes in one step')
|
|
175
|
-
.argument('[recipes...]', 'Recipes to apply after init (name@version)')
|
|
184
|
+
.argument('[recipes...]', 'Recipes to apply after init (name or name@version)')
|
|
176
185
|
.requiredOption('-g, --group <group>', 'Java package group (e.g. com.rental.app)')
|
|
177
186
|
.requiredOption('-n, --name <name>', 'Gradle project name (e.g. rental-app)')
|
|
178
187
|
.option('-p, --path <dir>', 'Target directory (must be empty or not exist)', process.cwd())
|
|
179
188
|
.option('--prefix <prefix>', 'Class prefix (defaults from project name, e.g. RentalApp)')
|
|
180
|
-
.option('--skeleton-version <version>', 'Skeleton
|
|
189
|
+
.option('--skeleton-version <version>', 'Skeleton tag version (default: latest published stable)')
|
|
181
190
|
.option('-r, --recipe <ref>', 'Recipe to apply (repeatable; same as positional recipes)', collectRecipe, [])
|
|
182
191
|
.option('--dry-run', 'Show what would be created without writing')
|
|
183
192
|
.action(async (recipes, opts) => {
|
|
@@ -202,7 +211,7 @@ export const scaffoldCommands = (program) => {
|
|
|
202
211
|
});
|
|
203
212
|
scaffoldCmd
|
|
204
213
|
.command('list')
|
|
205
|
-
.description('List
|
|
214
|
+
.description('List the latest published stable recipes')
|
|
206
215
|
.action(async () => {
|
|
207
216
|
await printRecipes();
|
|
208
217
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kodly.dev/kodly-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"kodly": "./dist/bin/kodly.js"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@kodly.dev/scaffolder": "1.0.
|
|
33
|
+
"@kodly.dev/scaffolder": "1.0.2",
|
|
34
34
|
"@types/inquirer": "^9.0.9",
|
|
35
35
|
"@types/node": "^25.0.5",
|
|
36
36
|
"axios": "^1.13.2",
|