@tulipes/cli 0.1.1 → 0.2.0-rc.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/README.md +10 -7
- package/dist/agent.d.ts +12 -0
- package/dist/agent.js +29 -0
- package/dist/agent.js.map +1 -0
- package/dist/app-core.d.ts +8 -6
- package/dist/app-core.js +23 -14
- package/dist/app-core.js.map +1 -1
- package/dist/bin.js +3 -3
- package/dist/bin.js.map +1 -1
- package/dist/config-check.d.ts +8 -0
- package/dist/config-check.js +43 -0
- package/dist/config-check.js.map +1 -0
- package/dist/config-import.d.ts +20 -0
- package/dist/config-import.js +133 -0
- package/dist/config-import.js.map +1 -0
- package/dist/dev.d.ts +4 -4
- package/dist/dev.js +7 -10
- package/dist/dev.js.map +1 -1
- package/dist/init.d.ts +6 -11
- package/dist/init.js +11 -6422
- package/dist/init.js.map +1 -1
- package/dist/inspection.d.ts +9 -8
- package/dist/inspection.js +10 -11
- package/dist/inspection.js.map +1 -1
- package/dist/main.js +82 -11
- package/dist/main.js.map +1 -1
- package/dist/migrate.d.ts +30 -0
- package/dist/migrate.js +772 -0
- package/dist/migrate.js.map +1 -0
- package/dist/new-module.js +84 -43
- package/dist/new-module.js.map +1 -1
- package/dist/routes.d.ts +3 -5
- package/dist/routes.js +4 -6
- package/dist/routes.js.map +1 -1
- package/dist/spec.d.ts +2 -5
- package/dist/spec.js +13 -6
- package/dist/spec.js.map +1 -1
- package/dist/sync.d.ts +3 -11
- package/dist/sync.js +81 -20
- package/dist/sync.js.map +1 -1
- package/dist/template.d.ts +58 -0
- package/dist/template.js +244 -0
- package/dist/template.js.map +1 -0
- package/dist/update.js +4 -4
- package/package.json +17 -16
- package/templates/AGENTS.md +68 -31
- package/templates/CLAUDE.md +5 -4
- package/templates/app/.envs/.env.development +18 -0
- package/templates/app/.envs/.env.production +19 -0
- package/templates/app/.envs/.env.staging +19 -0
- package/templates/app/README.md +327 -0
- package/templates/app/app.ts +3 -0
- package/templates/app/config/app.config.ts +73 -0
- package/templates/app/docs/agent-manifest.json +724 -0
- package/templates/app/ecosystem.config.cjs +60 -0
- package/templates/app/modules/agent/controllers/agent.controllers.ts +31 -0
- package/templates/app/modules/agent/i18n/en.json +5 -0
- package/templates/app/modules/agent/i18n/fr.json +5 -0
- package/templates/app/modules/agent/module.acl.ts +14 -0
- package/templates/app/modules/agent/package.json +21 -0
- package/templates/app/modules/agent/routes/agent.routes.ts +29 -0
- package/templates/app/modules/agent/schemas/agent.schemas.ts +9 -0
- package/templates/app/modules/auth/bootstrap/credentials.bootstrap.ts +26 -0
- package/templates/app/modules/auth/bootstrap/seed-admin.bootstrap.ts +44 -0
- package/templates/app/modules/auth/controllers/auth.controllers.ts +312 -0
- package/templates/app/modules/auth/helpers/access-check.ts +42 -0
- package/templates/app/modules/auth/helpers/auth.ts +48 -0
- package/templates/app/modules/auth/helpers/documents.ts +57 -0
- package/templates/app/modules/auth/helpers/passport.ts +180 -0
- package/templates/app/modules/auth/helpers/passwords.ts +58 -0
- package/templates/app/modules/auth/helpers/session-cache.ts +67 -0
- package/templates/app/modules/auth/helpers/tokens.ts +329 -0
- package/templates/app/modules/auth/i18n/en.json +19 -0
- package/templates/app/modules/auth/i18n/fr.json +19 -0
- package/templates/app/modules/auth/lib/index.ts +12 -0
- package/templates/app/modules/auth/models/credential.model.ts +31 -0
- package/templates/app/modules/auth/models/revoked-token.model.ts +20 -0
- package/templates/app/modules/auth/models/session.model.ts +42 -0
- package/templates/app/modules/auth/module.acl.ts +41 -0
- package/templates/app/modules/auth/module.config.ts +30 -0
- package/templates/app/modules/auth/package.json +61 -0
- package/templates/app/modules/auth/routes/auth.routes.ts +94 -0
- package/templates/app/modules/auth/schemas/auth.schemas.ts +37 -0
- package/templates/app/modules/auth/tests/auth.test.ts +1079 -0
- package/templates/app/modules/config/controllers/config.controllers.ts +89 -0
- package/templates/app/modules/config/helpers/audit.ts +41 -0
- package/templates/app/modules/config/helpers/describe.ts +72 -0
- package/templates/app/modules/config/i18n/en.json +6 -0
- package/templates/app/modules/config/i18n/fr.json +6 -0
- package/templates/app/modules/config/models/config-audit.model.ts +26 -0
- package/templates/app/modules/config/module.acl.ts +12 -0
- package/templates/app/modules/config/package.json +23 -0
- package/templates/app/modules/config/routes/config.routes.ts +37 -0
- package/templates/app/modules/config/schemas/config.schemas.ts +13 -0
- package/templates/app/modules/config/tests/config.test.ts +126 -0
- package/templates/app/modules/core/bootstrap/cache.bootstrap.ts +12 -0
- package/templates/app/modules/core/helpers/cache/index.ts +60 -0
- package/templates/app/modules/core/helpers/cache/memory-cache.ts +53 -0
- package/templates/app/modules/core/helpers/cache/redis-cache.ts +68 -0
- package/templates/app/modules/core/helpers/cache/types.ts +37 -0
- package/templates/app/modules/core/helpers/lazy.ts +13 -0
- package/templates/app/modules/core/helpers/logger/index.ts +115 -0
- package/templates/app/modules/core/helpers/mongoose/index.ts +27 -0
- package/templates/app/modules/core/helpers/mongoose/plugins/base.plugin.ts +14 -0
- package/templates/app/modules/core/helpers/mongoose/plugins/soft-delete.plugin.ts +124 -0
- package/templates/app/modules/core/helpers/mongoose/plugins/timestamps.plugin.ts +13 -0
- package/templates/app/modules/core/helpers/mongoose/plugins/types.ts +45 -0
- package/templates/app/modules/core/helpers/mongoose/register.ts +20 -0
- package/templates/app/modules/core/lib/index.ts +34 -0
- package/templates/app/modules/core/module.config.ts +24 -0
- package/templates/app/modules/core/package.json +80 -0
- package/templates/app/modules/core/routes/core.routes.ts +24 -0
- package/templates/app/modules/core/tests/core.test.ts +19 -0
- package/templates/app/modules/hello/agent/hello.agent.ts +33 -0
- package/templates/app/modules/hello/bootstrap/seed-greetings.bootstrap.ts +27 -0
- package/templates/app/modules/hello/controllers/greetings.controllers.ts +43 -0
- package/templates/app/modules/hello/controllers/hello.controllers.ts +50 -0
- package/templates/app/modules/hello/helpers/greeting.ts +8 -0
- package/templates/app/modules/hello/i18n/en.json +8 -0
- package/templates/app/modules/hello/i18n/fr.json +8 -0
- package/templates/app/modules/hello/models/greeting.model.ts +24 -0
- package/templates/app/modules/hello/module.acl.ts +16 -0
- package/templates/app/modules/hello/module.config.ts +14 -0
- package/templates/app/modules/hello/package.json +24 -0
- package/templates/app/modules/hello/queues/hello.queues.ts +38 -0
- package/templates/app/modules/hello/routes/greetings.routes.ts +25 -0
- package/templates/app/modules/hello/routes/hello.routes.ts +44 -0
- package/templates/app/modules/hello/sockets/hello.sockets.ts +21 -0
- package/templates/app/modules/hello/tests/hello.test.ts +19 -0
- package/templates/app/modules/security/bootstrap/rate-limit.bootstrap.ts +8 -0
- package/templates/app/modules/security/helpers/hardening.ts +65 -0
- package/templates/app/modules/security/helpers/proxy.ts +16 -0
- package/templates/app/modules/security/helpers/rate-limit.ts +150 -0
- package/templates/app/modules/security/module.config.ts +59 -0
- package/templates/app/modules/security/package.json +26 -0
- package/templates/app/modules/security/routes/security.routes.ts +42 -0
- package/templates/app/modules/security/tests/security.test.ts +174 -0
- package/templates/app/modules/settings/bootstrap/log-streams.bootstrap.ts +12 -0
- package/templates/app/modules/settings/controllers/settings.controllers.ts +58 -0
- package/templates/app/modules/settings/helpers/access-lease.ts +99 -0
- package/templates/app/modules/settings/helpers/log-stream.ts +272 -0
- package/templates/app/modules/settings/helpers/log-tail.ts +253 -0
- package/templates/app/modules/settings/i18n/en.json +3 -0
- package/templates/app/modules/settings/i18n/fr.json +3 -0
- package/templates/app/modules/settings/module.acl.ts +12 -0
- package/templates/app/modules/settings/package.json +21 -0
- package/templates/app/modules/settings/routes/settings.routes.ts +33 -0
- package/templates/app/modules/settings/schemas/settings.schemas.ts +8 -0
- package/templates/app/modules/settings/tests/settings.test.ts +409 -0
- package/templates/app/modules/users/controllers/users.controllers.ts +113 -0
- package/templates/app/modules/users/i18n/en.json +14 -0
- package/templates/app/modules/users/i18n/fr.json +14 -0
- package/templates/app/modules/users/models/user.model.ts +18 -0
- package/templates/app/modules/users/module.acl.ts +10 -0
- package/templates/app/modules/users/module.config.ts +11 -0
- package/templates/app/modules/users/package.json +24 -0
- package/templates/app/modules/users/queues/users.queues.ts +31 -0
- package/templates/app/modules/users/routes/users.routes.ts +60 -0
- package/templates/app/modules/users/schemas/users.schemas.ts +30 -0
- package/templates/app/modules/users/sockets/users.sockets.ts +18 -0
- package/templates/app/nginx/development.conf +44 -0
- package/templates/app/nginx/production.conf +75 -0
- package/templates/app/nginx/staging.conf +51 -0
- package/templates/app/package.json +58 -0
- package/templates/app/scripts/count-greetings.ts +29 -0
- package/templates/app/scripts/deploy-nginx.ts +143 -0
- package/templates/app/scripts/list-users.ts +34 -0
- package/templates/app/tests/app.test.ts +28 -0
- package/templates/app/tests/support.ts +36 -0
- package/templates/app/tsconfig.json +28 -0
- package/templates/app/vitest.config.ts +6 -0
- package/templates/app/worker.ts +6 -0
- package/templates/claude/skills/tulipes-agent-tool/SKILL.md +83 -0
- package/templates/claude/skills/tulipes-boot-errors/SKILL.md +11 -5
- package/templates/claude/skills/tulipes-config/SKILL.md +74 -0
- package/templates/claude/skills/tulipes-endpoint/SKILL.md +38 -25
- package/templates/claude/skills/tulipes-env-variable/SKILL.md +54 -26
- package/templates/claude/skills/tulipes-model/SKILL.md +11 -4
- package/templates/claude/skills/tulipes-module/SKILL.md +11 -10
- package/templates/claude/skills/tulipes-queue/SKILL.md +20 -6
- package/templates/claude/skills/tulipes-settings/SKILL.md +49 -100
- package/templates/claude/skills/tulipes-spec/SKILL.md +10 -12
- package/templates/minimal/README.md +21 -0
- package/templates/minimal/app.ts +3 -0
- package/templates/minimal/config/app.config.ts +16 -0
- package/templates/minimal/modules/agent/module.acl.ts +3 -0
- package/templates/minimal/modules/agent/package.json +14 -0
- package/templates/minimal/modules/agent/routes/agent.routes.ts +20 -0
- package/templates/minimal/modules/core/module.acl.ts +4 -0
- package/templates/minimal/modules/core/package.json +21 -0
- package/templates/minimal/modules/hello/i18n/en.json +3 -0
- package/templates/minimal/modules/hello/module.acl.ts +2 -0
- package/templates/minimal/modules/hello/package.json +11 -0
- package/templates/minimal/modules/hello/routes/health.routes.ts +9 -0
- package/templates/minimal/modules/hello/routes/hello.routes.ts +10 -0
- package/templates/minimal/modules/security/package.json +15 -0
- package/templates/minimal/modules/security/routes/security.routes.ts +8 -0
- package/templates/minimal/package.json +38 -0
- package/templates/minimal/tests/app.test.ts +52 -0
- package/templates/minimal/tsconfig.json +22 -0
- package/templates/minimal/vitest.config.ts +5 -0
- package/templates/overlays/no-queues/ecosystem.config.cjs +52 -0
- package/templates/overlays/no-queues/modules/hello/controllers/greetings.controllers.ts +41 -0
- package/templates/overlays/no-queues/modules/users/controllers/users.controllers.ts +107 -0
- package/templates/versions.json +11 -0
- package/dist/minimal.d.ts +0 -2
- package/dist/minimal.js +0 -2200
- package/dist/minimal.js.map +0 -1
- /package/templates/{browser-auth.md → app/docs/browser-auth.md} +0 -0
package/dist/sync.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join, relative } from "node:path";
|
|
3
3
|
import { BootReport } from "@tulipes/core/errors";
|
|
4
4
|
import { discoverModuleMeta } from "@tulipes/core/env";
|
|
@@ -6,16 +6,25 @@ import { discoverModules } from "@tulipes/core/modules";
|
|
|
6
6
|
import { sortModules } from "@tulipes/core/modules";
|
|
7
7
|
import { exploreModules } from "@tulipes/core/modules";
|
|
8
8
|
/**
|
|
9
|
-
* `tulipes sync` — everything derivable from the
|
|
9
|
+
* `tulipes sync` — everything derivable from the declarations, derived:
|
|
10
10
|
*
|
|
11
|
-
* types/
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* types/tulipes.d.ts KnownVariables, GlobalConfig, KnownModels and
|
|
12
|
+
* KnownJobs augmentations. A config namespace is typed
|
|
13
|
+
* as the OUTPUT of the schema its module.config.ts
|
|
14
|
+
* declares, a model as its file's default export and a
|
|
15
|
+
* queue's job data as its file's `jobs` schema, all via
|
|
16
|
+
* `typeof import(...)` — the compiler does the
|
|
17
|
+
* inference, codegen never executes module code. The
|
|
18
|
+
* one thing read from source is each model's name,
|
|
19
|
+
* which keys the interface and so must be a literal.
|
|
20
|
+
* .env.example every variable, grouped by module and `group`.
|
|
16
21
|
*
|
|
17
22
|
* Both files are committed and marked generated.
|
|
18
23
|
*/
|
|
24
|
+
const GENERATED_MARKER = "// AUTO-GENERATED by `tulipes sync`";
|
|
25
|
+
/** 0.10 wrote the same augmentations here; a stale copy would merge twice. */
|
|
26
|
+
const LEGACY_DTS = "config.d.ts";
|
|
27
|
+
export const TYPES_FILE = "tulipes.d.ts";
|
|
19
28
|
export async function runSync(rootDir) {
|
|
20
29
|
const report = new BootReport();
|
|
21
30
|
const modulesDir = join(rootDir, "modules");
|
|
@@ -29,9 +38,14 @@ export async function runSync(rootDir) {
|
|
|
29
38
|
.filter((meta) => meta !== undefined);
|
|
30
39
|
const typesDir = join(rootDir, "types");
|
|
31
40
|
mkdirSync(typesDir, { recursive: true });
|
|
32
|
-
const dtsPath = join(typesDir,
|
|
41
|
+
const dtsPath = join(typesDir, TYPES_FILE);
|
|
33
42
|
writeFileSync(dtsPath, renderDts(rootDir, orderedMetas, order));
|
|
34
43
|
console.log(`wrote ${relative(rootDir, dtsPath)}`);
|
|
44
|
+
const legacyPath = join(typesDir, LEGACY_DTS);
|
|
45
|
+
if (existsSync(legacyPath) && readFileSync(legacyPath, "utf8").startsWith(GENERATED_MARKER)) {
|
|
46
|
+
rmSync(legacyPath);
|
|
47
|
+
console.log(`removed ${relative(rootDir, legacyPath)} (now ${TYPES_FILE})`);
|
|
48
|
+
}
|
|
35
49
|
const envExamplePath = join(rootDir, ".env.example");
|
|
36
50
|
writeFileSync(envExamplePath, renderEnvExample(orderedMetas));
|
|
37
51
|
console.log(`wrote ${relative(rootDir, envExamplePath)}`);
|
|
@@ -41,22 +55,59 @@ function renderDts(rootDir, metas, order) {
|
|
|
41
55
|
` /** [${meta.module}] ${spec.description} */`,
|
|
42
56
|
` ${spec.name}: ${tsTypeOf(spec)};`,
|
|
43
57
|
]));
|
|
44
|
-
|
|
58
|
+
const explored = exploreModules(order);
|
|
59
|
+
// `.ts` specifiers: the app imports its own files that way (Node strips
|
|
60
|
+
// the types natively) and tsconfig allows importing them.
|
|
61
|
+
const specifierOf = (file) => "./" + relative(join(rootDir, "types"), file);
|
|
62
|
+
// Only modules with a declaration get a typed namespace; the rest fall
|
|
45
63
|
// back to GlobalConfig's index signature.
|
|
46
|
-
const configLines =
|
|
64
|
+
const configLines = explored
|
|
47
65
|
.filter((files) => files.configFile)
|
|
48
|
-
.flatMap((files) =>
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
|
|
66
|
+
.flatMap((files) => [
|
|
67
|
+
// Optional on purpose: a namespace only exists once phase 6 has loaded
|
|
68
|
+
// it, and an empty config seed must stay assignable.
|
|
69
|
+
` ${JSON.stringify(files.module.name)}?: import("zod/v4").output<`,
|
|
70
|
+
` (typeof import("${specifierOf(files.configFile)}"))["default"]["schema"]`,
|
|
71
|
+
` >;`,
|
|
72
|
+
]);
|
|
73
|
+
// A model's name keys the interface, so it is read from the file — the
|
|
74
|
+
// one place codegen looks at source rather than types. A name that is not
|
|
75
|
+
// a literal is reported and the model stays reachable through the
|
|
76
|
+
// untyped `get<T>(string)` overload.
|
|
77
|
+
const modelLines = explored.flatMap((files) => files.modelFiles.flatMap((file) => {
|
|
78
|
+
const name = modelNameOf(file);
|
|
79
|
+
if (!name) {
|
|
80
|
+
console.warn(`${relative(rootDir, file)}: model name is not a string literal; ctx.models.get() stays untyped for it`);
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
52
83
|
return [
|
|
53
|
-
` ${
|
|
54
|
-
`
|
|
55
|
-
` >;`,
|
|
84
|
+
` /** [${files.module.name}] ${relative(rootDir, file)} */`,
|
|
85
|
+
` ${JSON.stringify(name)}: (typeof import("${specifierOf(file)}"))["default"];`,
|
|
56
86
|
];
|
|
57
|
-
});
|
|
87
|
+
}));
|
|
88
|
+
// Every queue file contributes the output types of its `jobs` export, or
|
|
89
|
+
// nothing when it has none; names come from the export's keys, so no
|
|
90
|
+
// source is read.
|
|
91
|
+
const jobsParents = explored.flatMap((files) => files.queueFiles.map((file) => `JobsOf<typeof import("${specifierOf(file)}")>`));
|
|
92
|
+
// The provider augmentations are emitted only when a file of that kind
|
|
93
|
+
// exists: an app without the provider installed cannot augment it.
|
|
94
|
+
const modelsBlock = modelLines.length === 0 ? [] : [
|
|
95
|
+
"",
|
|
96
|
+
'declare module "@tulipes/mongoose" {',
|
|
97
|
+
" interface KnownModels {",
|
|
98
|
+
...modelLines,
|
|
99
|
+
" }",
|
|
100
|
+
"}",
|
|
101
|
+
];
|
|
102
|
+
const jobsBlock = jobsParents.length === 0 ? [] : [
|
|
103
|
+
"",
|
|
104
|
+
'declare module "@tulipes/bullmq" {',
|
|
105
|
+
" interface KnownJobs extends",
|
|
106
|
+
...jobsParents.map((parent, index) => ` ${parent}${index === jobsParents.length - 1 ? " {}" : ","}`),
|
|
107
|
+
"}",
|
|
108
|
+
];
|
|
58
109
|
return [
|
|
59
|
-
|
|
110
|
+
`${GENERATED_MARKER} — do not edit.`,
|
|
60
111
|
"",
|
|
61
112
|
'declare module "@tulipes/core/env" {',
|
|
62
113
|
" interface KnownVariables {",
|
|
@@ -69,11 +120,21 @@ function renderDts(rootDir, metas, order) {
|
|
|
69
120
|
...configLines,
|
|
70
121
|
" }",
|
|
71
122
|
"}",
|
|
123
|
+
...modelsBlock,
|
|
124
|
+
...jobsBlock,
|
|
72
125
|
"",
|
|
73
126
|
"export {};",
|
|
74
127
|
"",
|
|
75
128
|
].join("\n");
|
|
76
129
|
}
|
|
130
|
+
const DEFAULT_EXPORT_OBJECT = /export\s+default\s*\{([\s\S]*?)\}/;
|
|
131
|
+
const NAME_LITERAL = /\bname\s*:\s*(["'])([A-Za-z_$][\w$]*)\1/;
|
|
132
|
+
/** `export default { name: "User", schema }` — the literal, or undefined. */
|
|
133
|
+
export function modelNameOf(file) {
|
|
134
|
+
const source = readFileSync(file, "utf8");
|
|
135
|
+
const scope = DEFAULT_EXPORT_OBJECT.exec(source)?.[1] ?? source;
|
|
136
|
+
return NAME_LITERAL.exec(scope)?.[2] ?? NAME_LITERAL.exec(source)?.[2];
|
|
137
|
+
}
|
|
77
138
|
function tsTypeOf(spec) {
|
|
78
139
|
switch (spec.type) {
|
|
79
140
|
case "number":
|
|
@@ -88,7 +149,7 @@ function tsTypeOf(spec) {
|
|
|
88
149
|
}
|
|
89
150
|
function renderEnvExample(metas) {
|
|
90
151
|
const lines = [
|
|
91
|
-
"# AUTO-GENERATED by `tulipes sync` from every module's
|
|
152
|
+
"# AUTO-GENERATED by `tulipes sync` from every module's package.json tulipes.env.",
|
|
92
153
|
"# Copy into .envs/.env.<mode> and fill in the blanks.",
|
|
93
154
|
];
|
|
94
155
|
for (const meta of metas) {
|
package/dist/sync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAmB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAA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CAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC;QAED,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CACrD,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,CAClD,EAAE,CAAC;YACF,IAAI,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,KAAK,KAAK,CAAC,CAAC;YAC9C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,UAAU,GACd,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,IAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;gBACvE,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;gBACtD,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,WAAW,KAAK,UAAU,GAAG,WAAW,GAAG,CAAC,CAAC;gBAClE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { InitFeatures, InitPreset } from "./init.ts";
|
|
2
|
+
/**
|
|
3
|
+
* `tulipes init` copies a template tree and transforms it; it renders no
|
|
4
|
+
* file from strings. The production template IS the reference application
|
|
5
|
+
* (`example/` in the framework repository): the published CLI carries a
|
|
6
|
+
* copy under `templates/app`, packed at build time, and a source checkout
|
|
7
|
+
* reads the example directly. The minimal preset is the committed tree
|
|
8
|
+
* under `templates/minimal`.
|
|
9
|
+
*
|
|
10
|
+
* Every transformation is listed here, because the parity check in CI
|
|
11
|
+
* diffs a generated app against the example and must find nothing else:
|
|
12
|
+
*
|
|
13
|
+
* - the app name replaces the token `tulipes-example` wherever it occurs,
|
|
14
|
+
* and package.json `name` is set outright;
|
|
15
|
+
* - `workspace:` ranges on @tulipes packages become the versions this CLI
|
|
16
|
+
* was packed with, and `packageManager` the pnpm the framework pins;
|
|
17
|
+
* - the root manifest gets the pnpm settings a workspace root owns
|
|
18
|
+
* (overrides, the install-script allow-list), which the example cannot
|
|
19
|
+
* carry because it is itself a package inside the framework workspace;
|
|
20
|
+
* - a feature left out (`--no-queues`, `--no-sockets`) drops its files,
|
|
21
|
+
* its provider declaration, dependencies and scripts, and applies the
|
|
22
|
+
* overlay files under `templates/overlays/no-<feature>`;
|
|
23
|
+
* - README lines ending in `<!-- feature:x -->` belong to that feature.
|
|
24
|
+
*
|
|
25
|
+
* Generated outputs (`types/`, `.env.example`, the spec documents) are never
|
|
26
|
+
* copied: the app regenerates them with `pnpm sync` and `pnpm spec`. The
|
|
27
|
+
* agent guides are copied separately from `templates/`, so both presets
|
|
28
|
+
* share one copy.
|
|
29
|
+
*/
|
|
30
|
+
export interface TemplateSource {
|
|
31
|
+
/** Root of the tree to copy. */
|
|
32
|
+
dir: string;
|
|
33
|
+
/** Version of every @tulipes package, keyed by package name, plus `pnpm`. */
|
|
34
|
+
versions: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
/** The token every template spells the application name with. */
|
|
37
|
+
export declare const NAME_TOKEN = "tulipes-example";
|
|
38
|
+
/** Where the production template lives for this install. */
|
|
39
|
+
export declare function productionTemplate(): TemplateSource;
|
|
40
|
+
export declare function minimalTemplate(): TemplateSource;
|
|
41
|
+
/**
|
|
42
|
+
* Versions to scaffold against: written at pack time by
|
|
43
|
+
* `scripts/pack-templates.mjs`, or read from the workspace in a checkout.
|
|
44
|
+
*/
|
|
45
|
+
export declare function readVersions(): Record<string, string>;
|
|
46
|
+
/** Relative paths of every file the template contributes, before features apply. */
|
|
47
|
+
export declare function listTemplate(dir: string): string[];
|
|
48
|
+
export interface RenderOptions {
|
|
49
|
+
name: string;
|
|
50
|
+
preset: InitPreset;
|
|
51
|
+
features: InitFeatures;
|
|
52
|
+
}
|
|
53
|
+
/** The generated app as (relative path, contents) pairs. */
|
|
54
|
+
export declare function renderTemplate(source: TemplateSource, options: RenderOptions): [string, string | Buffer][];
|
|
55
|
+
/** @internal For the pack script: does a directory of this name belong to the template? */
|
|
56
|
+
export declare function isTemplateDir(name: string): boolean;
|
|
57
|
+
/** @internal For the pack script: is this file part of the template at all? */
|
|
58
|
+
export declare function isTemplateFile(rel: string): boolean;
|
package/dist/template.js
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { packageRoot } from "./package-info.js";
|
|
4
|
+
/** The token every template spells the application name with. */
|
|
5
|
+
export const NAME_TOKEN = "tulipes-example";
|
|
6
|
+
const EXCLUDED_DIRS = new Set(["node_modules", "logs", "coverage", "types", ".claude", ".vitest", "dist"]);
|
|
7
|
+
const EXCLUDED_FILES = new Set([
|
|
8
|
+
".env.example",
|
|
9
|
+
"docs/openapi.json",
|
|
10
|
+
"docs/collection.json",
|
|
11
|
+
"AGENTS.md",
|
|
12
|
+
"CLAUDE.md",
|
|
13
|
+
"pnpm-lock.yaml",
|
|
14
|
+
]);
|
|
15
|
+
const TEXT_EXTENSIONS = new Set([".ts", ".js", ".cjs", ".mjs", ".json", ".md", ".conf", ".yaml", ".yml", ".txt"]);
|
|
16
|
+
const TULIPES_PACKAGES = ["core", "cli", "spec", "mongoose", "bullmq", "socket.io", "testing", "mcp"];
|
|
17
|
+
/**
|
|
18
|
+
* A source checkout of the framework is recognised by its siblings. There
|
|
19
|
+
* the live example and workspace versions always win over anything a
|
|
20
|
+
* previous `pnpm pack` left under templates/, which would otherwise shadow
|
|
21
|
+
* the files being edited.
|
|
22
|
+
*/
|
|
23
|
+
function repositoryRoot() {
|
|
24
|
+
const root = resolve(packageRoot(), "..", "..");
|
|
25
|
+
const inRepository = existsSync(join(root, "example", "package.json")) && existsSync(join(root, "packages", "core", "package.json"));
|
|
26
|
+
return inRepository ? root : undefined;
|
|
27
|
+
}
|
|
28
|
+
/** Where the production template lives for this install. */
|
|
29
|
+
export function productionTemplate() {
|
|
30
|
+
const repository = repositoryRoot();
|
|
31
|
+
if (repository)
|
|
32
|
+
return { dir: join(repository, "example"), versions: readVersions() };
|
|
33
|
+
const packed = join(packageRoot(), "templates", "app");
|
|
34
|
+
if (!existsSync(join(packed, "package.json"))) {
|
|
35
|
+
throw new Error("tulipes init: no production template — this CLI was packed without templates/app");
|
|
36
|
+
}
|
|
37
|
+
return { dir: packed, versions: readVersions() };
|
|
38
|
+
}
|
|
39
|
+
export function minimalTemplate() {
|
|
40
|
+
const dir = join(packageRoot(), "templates", "minimal");
|
|
41
|
+
if (!existsSync(join(dir, "package.json"))) {
|
|
42
|
+
throw new Error("tulipes init: no minimal template — this CLI was packed without templates/minimal");
|
|
43
|
+
}
|
|
44
|
+
return { dir, versions: readVersions() };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Versions to scaffold against: written at pack time by
|
|
48
|
+
* `scripts/pack-templates.mjs`, or read from the workspace in a checkout.
|
|
49
|
+
*/
|
|
50
|
+
export function readVersions() {
|
|
51
|
+
const repository = repositoryRoot();
|
|
52
|
+
if (!repository) {
|
|
53
|
+
const packed = join(packageRoot(), "templates", "versions.json");
|
|
54
|
+
if (!existsSync(packed))
|
|
55
|
+
throw new Error("tulipes init: no templates/versions.json — this CLI was packed without its templates");
|
|
56
|
+
return JSON.parse(readFileSync(packed, "utf8"));
|
|
57
|
+
}
|
|
58
|
+
const versions = {};
|
|
59
|
+
const root = JSON.parse(readFileSync(join(repository, "package.json"), "utf8"));
|
|
60
|
+
if (root.packageManager?.startsWith("pnpm@"))
|
|
61
|
+
versions.pnpm = root.packageManager.slice("pnpm@".length);
|
|
62
|
+
for (const name of TULIPES_PACKAGES) {
|
|
63
|
+
const manifest = join(repository, "packages", name, "package.json");
|
|
64
|
+
if (!existsSync(manifest))
|
|
65
|
+
continue;
|
|
66
|
+
const pkg = JSON.parse(readFileSync(manifest, "utf8"));
|
|
67
|
+
versions[pkg.name] = pkg.version;
|
|
68
|
+
}
|
|
69
|
+
return versions;
|
|
70
|
+
}
|
|
71
|
+
/** Relative paths of every file the template contributes, before features apply. */
|
|
72
|
+
export function listTemplate(dir) {
|
|
73
|
+
const files = [];
|
|
74
|
+
const walk = (current) => {
|
|
75
|
+
for (const entry of readdirSync(current, { withFileTypes: true })) {
|
|
76
|
+
const path = join(current, entry.name);
|
|
77
|
+
const rel = relative(dir, path).split(sep).join("/");
|
|
78
|
+
if (entry.isDirectory()) {
|
|
79
|
+
if (!EXCLUDED_DIRS.has(entry.name))
|
|
80
|
+
walk(path);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (EXCLUDED_FILES.has(rel) || rel.endsWith(".missing.json"))
|
|
84
|
+
continue;
|
|
85
|
+
files.push(rel);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
walk(dir);
|
|
89
|
+
return files.sort();
|
|
90
|
+
}
|
|
91
|
+
/** The generated app as (relative path, contents) pairs. */
|
|
92
|
+
export function renderTemplate(source, options) {
|
|
93
|
+
const { name, features } = options;
|
|
94
|
+
const overlays = join(packageRoot(), "templates", "overlays");
|
|
95
|
+
const off = ["queues", "sockets"].filter((feature) => !features[feature]);
|
|
96
|
+
const output = [];
|
|
97
|
+
for (const rel of listTemplate(source.dir)) {
|
|
98
|
+
if (!features.queues && (rel === "worker.ts" || /(^|\/)queues\//.test(rel)))
|
|
99
|
+
continue;
|
|
100
|
+
if (!features.sockets && /(^|\/)sockets\//.test(rel))
|
|
101
|
+
continue;
|
|
102
|
+
let file = join(source.dir, rel);
|
|
103
|
+
for (const feature of off) {
|
|
104
|
+
const overlay = join(overlays, `no-${feature}`, rel);
|
|
105
|
+
if (existsSync(overlay))
|
|
106
|
+
file = overlay;
|
|
107
|
+
}
|
|
108
|
+
if (!TEXT_EXTENSIONS.has(extensionOf(rel)) && !rel.startsWith(".envs/")) {
|
|
109
|
+
output.push([rel, readFileSync(file)]);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
let text = readFileSync(file, "utf8").replaceAll(NAME_TOKEN, name);
|
|
113
|
+
if (rel === "package.json")
|
|
114
|
+
text = rootManifest(text, name, source.versions, features);
|
|
115
|
+
else if (/^modules\/[^/]+\/package\.json$/.test(rel))
|
|
116
|
+
text = moduleManifest(text, source.versions, features);
|
|
117
|
+
else if (rel === "tsconfig.json" && !features.queues)
|
|
118
|
+
text = withoutWorker(text);
|
|
119
|
+
else if (rel === "README.md")
|
|
120
|
+
text = featureLines(text, features);
|
|
121
|
+
output.push([rel, text]);
|
|
122
|
+
}
|
|
123
|
+
// Files a generated app has and the template tree cannot carry.
|
|
124
|
+
output.push(["pnpm-workspace.yaml", "packages:\n - modules/*\n"]);
|
|
125
|
+
output.push([".gitignore", options.preset === "minimal" ? MINIMAL_GITIGNORE : PRODUCTION_GITIGNORE]);
|
|
126
|
+
return output;
|
|
127
|
+
}
|
|
128
|
+
function extensionOf(path) {
|
|
129
|
+
const index = path.lastIndexOf(".");
|
|
130
|
+
return index === -1 ? "" : path.slice(index);
|
|
131
|
+
}
|
|
132
|
+
const json = (value) => JSON.stringify(value, null, 2) + "\n";
|
|
133
|
+
function rootManifest(text, name, versions, features) {
|
|
134
|
+
const pkg = JSON.parse(text);
|
|
135
|
+
pkg.name = name;
|
|
136
|
+
pinVersions(pkg, versions);
|
|
137
|
+
if (!versions.pnpm)
|
|
138
|
+
throw new Error("tulipes init: no packed pnpm version");
|
|
139
|
+
pkg.packageManager = `pnpm@${versions.pnpm}`;
|
|
140
|
+
// A template that is a workspace root itself (the minimal tree) carries
|
|
141
|
+
// its own pnpm settings; the example is not one, so it gets the full set.
|
|
142
|
+
pkg.pnpm ??= {
|
|
143
|
+
// PM2's transitive dependencies, pinned past their advisories until PM2
|
|
144
|
+
// ships the fixes itself: js-yaml (GHSA-c6x7-9hm3-xr4m) and basic-ftp
|
|
145
|
+
// (GHSA-c475-qrg2-pj4r; get-uri uses it for ftp:// proxies only).
|
|
146
|
+
overrides: { "pm2>js-yaml": "4.3.2", "basic-ftp": "^6.2.1" },
|
|
147
|
+
// braces (GHSA-vfj7-8cjw-p6xm, via pm2's chokidar) has no fixed release:
|
|
148
|
+
// it expands the watch globs an operator writes, never request input.
|
|
149
|
+
auditConfig: { ignoreGhsas: ["GHSA-vfj7-8cjw-p6xm"] },
|
|
150
|
+
// The only install script pnpm may run: with queues, bullmq's optional
|
|
151
|
+
// native helper. Everything else is blocked.
|
|
152
|
+
onlyBuiltDependencies: ["msgpackr-extract"],
|
|
153
|
+
};
|
|
154
|
+
if (!features.queues) {
|
|
155
|
+
delete pkg.tulipes?.providers?.queues;
|
|
156
|
+
delete pkg.dependencies?.["@tulipes/bullmq"];
|
|
157
|
+
delete pkg.scripts?.worker;
|
|
158
|
+
if (pkg.pnpm.onlyBuiltDependencies) {
|
|
159
|
+
pkg.pnpm.onlyBuiltDependencies = pkg.pnpm.onlyBuiltDependencies.filter((dep) => dep !== "msgpackr-extract");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (!features.sockets) {
|
|
163
|
+
delete pkg.tulipes?.providers?.sockets;
|
|
164
|
+
delete pkg.dependencies?.["@tulipes/socket.io"];
|
|
165
|
+
}
|
|
166
|
+
return json(pkg);
|
|
167
|
+
}
|
|
168
|
+
function moduleManifest(text, versions, features) {
|
|
169
|
+
const pkg = JSON.parse(text);
|
|
170
|
+
pinVersions(pkg, versions);
|
|
171
|
+
if (!features.queues)
|
|
172
|
+
delete pkg.dependencies?.["@tulipes/bullmq"];
|
|
173
|
+
if (!features.sockets)
|
|
174
|
+
delete pkg.dependencies?.["@tulipes/socket.io"];
|
|
175
|
+
return json(pkg);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* `workspace:*` and `workspace:^` on a @tulipes package become `^<version>`.
|
|
179
|
+
* A module's `@app/*` dependency stays a workspace link: the generated app
|
|
180
|
+
* is a pnpm workspace of its modules exactly as the example is.
|
|
181
|
+
*/
|
|
182
|
+
function pinVersions(pkg, versions) {
|
|
183
|
+
for (const field of ["dependencies", "devDependencies"]) {
|
|
184
|
+
const deps = pkg[field];
|
|
185
|
+
if (!deps)
|
|
186
|
+
continue;
|
|
187
|
+
for (const [dep, range] of Object.entries(deps)) {
|
|
188
|
+
if (!range.startsWith("workspace:") || !dep.startsWith("@tulipes/"))
|
|
189
|
+
continue;
|
|
190
|
+
const version = versions[dep];
|
|
191
|
+
if (!version)
|
|
192
|
+
throw new Error(`tulipes init: no packed version for ${dep} (${range})`);
|
|
193
|
+
deps[dep] = `^${version}`;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function withoutWorker(text) {
|
|
198
|
+
const config = JSON.parse(text);
|
|
199
|
+
if (config.include)
|
|
200
|
+
config.include = config.include.filter((path) => path !== "worker.ts");
|
|
201
|
+
return json(config);
|
|
202
|
+
}
|
|
203
|
+
/** Lines tagged `<!-- feature:x -->` stay (untagged) only when x is on. */
|
|
204
|
+
function featureLines(text, features) {
|
|
205
|
+
return text
|
|
206
|
+
.split("\n")
|
|
207
|
+
.filter((line) => {
|
|
208
|
+
const tag = /<!-- feature:(\w+) -->\s*$/.exec(line);
|
|
209
|
+
return !tag || features[tag[1]] !== false;
|
|
210
|
+
})
|
|
211
|
+
.map((line) => line.replace(/\s*<!-- feature:\w+ -->\s*$/, ""))
|
|
212
|
+
.join("\n");
|
|
213
|
+
}
|
|
214
|
+
const PRODUCTION_GITIGNORE = [
|
|
215
|
+
"node_modules/",
|
|
216
|
+
"dist/",
|
|
217
|
+
"logs/",
|
|
218
|
+
"*.log",
|
|
219
|
+
"",
|
|
220
|
+
"# Environment files are local. `.env.example` — generated by",
|
|
221
|
+
"# `pnpm sync`, and committed — is the contract: it names every",
|
|
222
|
+
"# variable any module declares. Copy from it, never the reverse.",
|
|
223
|
+
".envs/",
|
|
224
|
+
".env",
|
|
225
|
+
".env.local",
|
|
226
|
+
"",
|
|
227
|
+
"# written outside production for whoever writes the translations:",
|
|
228
|
+
"# every key a locale is still missing, with the default-locale text",
|
|
229
|
+
"**/modules/*/i18n/*.missing.json",
|
|
230
|
+
"",
|
|
231
|
+
].join("\n");
|
|
232
|
+
const MINIMAL_GITIGNORE = "node_modules/\n.envs/\ncoverage/\nlogs/\n";
|
|
233
|
+
/** @internal For the pack script: does a directory of this name belong to the template? */
|
|
234
|
+
export function isTemplateDir(name) {
|
|
235
|
+
return !EXCLUDED_DIRS.has(name);
|
|
236
|
+
}
|
|
237
|
+
/** @internal For the pack script: is this file part of the template at all? */
|
|
238
|
+
export function isTemplateFile(rel) {
|
|
239
|
+
const parts = rel.split("/");
|
|
240
|
+
if (parts.slice(0, -1).some((dir) => EXCLUDED_DIRS.has(dir)))
|
|
241
|
+
return false;
|
|
242
|
+
return !EXCLUDED_FILES.has(rel) && !rel.endsWith(".missing.json");
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,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,GAAG;IAC3B,eAAe;IACf,OAAO;IACP,OAAO;IACP,OAAO;IACP,EAAE;IACF,8DAA8D;IAC9D,gEAAgE;IAChE,kEAAkE;IAClE,QAAQ;IACR,MAAM;IACN,YAAY;IACZ,EAAE;IACF,mEAAmE;IACnE,qEAAqE;IACrE,kCAAkC;IAClC,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,iBAAiB,GAAG,2CAA2C,CAAC;AAEtE,2FAA2F;AAC3F,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3E,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AACpE,CAAC"}
|
package/dist/update.js
CHANGED
|
@@ -97,7 +97,7 @@ function globalPrefixOf(cliRoot) {
|
|
|
97
97
|
async function updateApp(rootDir, manifests, current, latest, latestCli) {
|
|
98
98
|
const range = `^${latest}`;
|
|
99
99
|
const changed = manifests.filter(({ path }) => rewrite(path, range));
|
|
100
|
-
// The app's own CLI devDependency moves with it, so `
|
|
100
|
+
// The app's own CLI devDependency moves with it, so `pnpm dev` and friends
|
|
101
101
|
// keep matching the framework they generate for.
|
|
102
102
|
if (rewrite(join(rootDir, "package.json"), `^${latestCli}`, CLI))
|
|
103
103
|
changed.push({ path: join(rootDir, "package.json") });
|
|
@@ -227,14 +227,14 @@ function detectManager(rootDir) {
|
|
|
227
227
|
try {
|
|
228
228
|
const manifest = JSON.parse(readFileSync(join(rootDir, "package.json"), "utf8"));
|
|
229
229
|
const pinned = manifest.packageManager ?? "";
|
|
230
|
-
if (pinned.startsWith("
|
|
231
|
-
return "
|
|
230
|
+
if (pinned.startsWith("yarn"))
|
|
231
|
+
return "yarn";
|
|
232
232
|
if (pinned.startsWith("npm"))
|
|
233
233
|
return "npm";
|
|
234
234
|
}
|
|
235
235
|
catch {
|
|
236
236
|
// fall through
|
|
237
237
|
}
|
|
238
|
-
return "
|
|
238
|
+
return "pnpm";
|
|
239
239
|
}
|
|
240
240
|
//# sourceMappingURL=update.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tulipes/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-rc.1",
|
|
4
4
|
"description": "The tulipes command line: scaffold, sync, inspect, describe and run Tulipes apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,27 +15,16 @@
|
|
|
15
15
|
"README.md",
|
|
16
16
|
"LICENSE"
|
|
17
17
|
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"typecheck": "tsc --noEmit",
|
|
20
|
-
"build": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
21
|
-
"prepack": "yarn build"
|
|
22
|
-
},
|
|
23
18
|
"publishConfig": {
|
|
24
|
-
"access": "public"
|
|
25
|
-
"bin": {
|
|
26
|
-
"tulipes": "./dist/bin.js"
|
|
27
|
-
},
|
|
28
|
-
"exports": {
|
|
29
|
-
".": "./dist/main.js"
|
|
30
|
-
}
|
|
19
|
+
"access": "public"
|
|
31
20
|
},
|
|
32
21
|
"dependencies": {
|
|
33
|
-
"@tulipes/core": "^0.
|
|
34
|
-
"tsx": "^4"
|
|
22
|
+
"@tulipes/core": "^0.11.0-rc.1"
|
|
35
23
|
},
|
|
36
24
|
"devDependencies": {
|
|
37
25
|
"@types/node": "^24.2.0",
|
|
38
|
-
"typescript": "^7.0.2"
|
|
26
|
+
"typescript": "^7.0.2",
|
|
27
|
+
"@tulipes/spec": "0.3.2-rc.1"
|
|
39
28
|
},
|
|
40
29
|
"repository": {
|
|
41
30
|
"type": "git",
|
|
@@ -55,5 +44,17 @@
|
|
|
55
44
|
"homepage": "https://github.com/kemora13conf/bp-backend-express/tree/master/packages/cli#readme",
|
|
56
45
|
"bugs": {
|
|
57
46
|
"url": "https://github.com/kemora13conf/bp-backend-express/issues"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@tulipes/spec": "^0.3.1 || ^0.3.2-rc.1"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@tulipes/spec": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"typecheck": "tsc --noEmit",
|
|
58
|
+
"build": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json"
|
|
58
59
|
}
|
|
59
60
|
}
|