@fluojs/cli 1.0.5 → 1.0.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":"AAMA,OAAO,EAOL,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAC;AAMzB,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnE,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,KAAK,qBAAqB,GAAG,CAAC,QAAQ,EAAE,qBAAqB,KAAK,MAAM,CAAC;AAEzE,KAAK,2BAA2B,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;AAE/F;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,yEAAyE;IACzE,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yEAAyE;IACzE,yBAAyB,CAAC,EAAE,2BAA2B,CAAC;IACxD,wFAAwF;IACxF,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,sCAAsC;IACtC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,yCAAyC;IACzC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;A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yCAAyC;IACzC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAmFD;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAarC;AA+PD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,4BAAiC,GAAG,OAAO,CAAC,MAAM,CAAC,CAkDnH"}
|
package/dist/commands/inspect.js
CHANGED
|
@@ -289,13 +289,7 @@ export async function runInspectCommand(argv, runtime = {}) {
|
|
|
289
289
|
const context = await FluoFactory.createApplicationContext(rootModule, {
|
|
290
290
|
diagnostics: parsed.timing || parsed.report ? {
|
|
291
291
|
timing: true
|
|
292
|
-
} : undefined
|
|
293
|
-
logger: {
|
|
294
|
-
debug() {},
|
|
295
|
-
error() {},
|
|
296
|
-
log() {},
|
|
297
|
-
warn() {}
|
|
298
|
-
}
|
|
292
|
+
} : undefined
|
|
299
293
|
});
|
|
300
294
|
try {
|
|
301
295
|
const platformShell = await context.get(PLATFORM_SHELL);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/new/scaffold.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/new/scaffold.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,YAAY,CAAC;AA8xEnE;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,gBAAgB,EACzB,aAAa,SAAkB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,6BAAuB,CAAC"}
|
package/dist/new/scaffold.js
CHANGED
|
@@ -52,6 +52,7 @@ function describeApplicationStarter(options) {
|
|
|
52
52
|
entrypoint: 'src/main.ts',
|
|
53
53
|
packageName: '@fluojs/platform-bun',
|
|
54
54
|
platformLabel: 'Bun native HTTP',
|
|
55
|
+
runHelper: 'runBunApplication',
|
|
55
56
|
runtimeLabel: 'Bun runtime'
|
|
56
57
|
};
|
|
57
58
|
}
|
|
@@ -79,6 +80,7 @@ function describeApplicationStarter(options) {
|
|
|
79
80
|
entrypoint: 'src/main.ts',
|
|
80
81
|
packageName: '@fluojs/platform-express',
|
|
81
82
|
platformLabel: 'Express HTTP',
|
|
83
|
+
runHelper: 'runExpressApplication',
|
|
82
84
|
runtimeLabel: 'Node.js runtime'
|
|
83
85
|
};
|
|
84
86
|
case 'nodejs':
|
|
@@ -88,6 +90,7 @@ function describeApplicationStarter(options) {
|
|
|
88
90
|
entrypoint: 'src/main.ts',
|
|
89
91
|
packageName: '@fluojs/platform-nodejs',
|
|
90
92
|
platformLabel: 'raw Node.js HTTP',
|
|
93
|
+
runHelper: 'runNodejsApplication',
|
|
91
94
|
runtimeLabel: 'Node.js runtime'
|
|
92
95
|
};
|
|
93
96
|
default:
|
|
@@ -97,6 +100,7 @@ function describeApplicationStarter(options) {
|
|
|
97
100
|
entrypoint: 'src/main.ts',
|
|
98
101
|
packageName: '@fluojs/platform-fastify',
|
|
99
102
|
platformLabel: 'Fastify HTTP',
|
|
103
|
+
runHelper: 'runFastifyApplication',
|
|
100
104
|
runtimeLabel: 'Node.js runtime'
|
|
101
105
|
};
|
|
102
106
|
}
|
|
@@ -380,8 +384,8 @@ function createHttpCommandsSection(options) {
|
|
|
380
384
|
function createHttpProjectReadme(options) {
|
|
381
385
|
const starter = describeApplicationStarter(options);
|
|
382
386
|
const entrypointLabel = starter.entrypoint;
|
|
383
|
-
const starterContract = options.runtime === 'deno' ? `\`${entrypointLabel}\` boots the selected first-class application starter: ${starter.runtimeLabel} + ${starter.platformLabel} via \`runDenoApplication(...)\`` : options.runtime === 'cloudflare-workers' ? `\`${entrypointLabel}\` exports the selected first-class application starter: ${starter.runtimeLabel} + ${starter.platformLabel} via \`createCloudflareWorkerEntrypoint(...)\`` : `\`${entrypointLabel}\` wires the selected first-class application starter: ${starter.runtimeLabel} + ${starter.platformLabel} via \`${starter.adapterFactory}(... )\``.replace('(... )', '(...)');
|
|
384
|
-
const corsLine = options.runtime === 'cloudflare-workers' ? '- CORS: defaults to allowOrigin `*`; pass a `cors` option to `createCloudflareWorkerEntrypoint(..., { cors })` when you need edge-specific restrictions' : options.runtime === 'deno' ? '- CORS: defaults to allowOrigin `*`; configure it through the Deno HTTP bootstrap path before exposing the adapter in production' : `- CORS: defaults to allowOrigin '*'; pass a \`cors\` option to \`FluoFactory.create(..., { cors, adapter: ${starter.adapterFactory}(...) })\` to restrict origins`;
|
|
387
|
+
const starterContract = starter.runHelper ? `\`${entrypointLabel}\` boots the selected first-class application starter: ${starter.runtimeLabel} + ${starter.platformLabel} via \`${starter.runHelper}(...)\`` : options.runtime === 'deno' ? `\`${entrypointLabel}\` boots the selected first-class application starter: ${starter.runtimeLabel} + ${starter.platformLabel} via \`runDenoApplication(...)\`` : options.runtime === 'cloudflare-workers' ? `\`${entrypointLabel}\` exports the selected first-class application starter: ${starter.runtimeLabel} + ${starter.platformLabel} via \`createCloudflareWorkerEntrypoint(...)\`` : `\`${entrypointLabel}\` wires the selected first-class application starter: ${starter.runtimeLabel} + ${starter.platformLabel} via \`${starter.adapterFactory}(... )\``.replace('(... )', '(...)');
|
|
388
|
+
const corsLine = options.runtime === 'cloudflare-workers' ? '- CORS: defaults to allowOrigin `*`; pass a `cors` option to `createCloudflareWorkerEntrypoint(..., { cors })` when you need edge-specific restrictions' : options.runtime === 'deno' ? '- CORS: defaults to allowOrigin `*`; configure it through the Deno HTTP bootstrap path before exposing the adapter in production' : starter.runHelper ? `- CORS: defaults to allowOrigin '*'; pass a \`cors\` option to \`${starter.runHelper}(..., { cors })\` to restrict origins` : `- CORS: defaults to allowOrigin '*'; pass a \`cors\` option to \`FluoFactory.create(..., { cors, adapter: ${starter.adapterFactory}(...) })\` to restrict origins`;
|
|
385
389
|
const testingSection = options.runtime === 'deno' ? `## Official generated testing templates\n\n- \`src/app.test.ts\` — Deno-native integration-style dispatch verification for the generated runtime + starter routes.\n\nUse this test when you need confidence that the generated Deno entrypoint and module graph still agree on the same HTTP contract.` : `## Official generated testing templates\n\n- \`src/greeting/greeting.repo.test.ts\`, \`src/greeting/greeting.service.test.ts\`, and \`src/greeting/greeting.controller.test.ts\` — unit templates for the starter-owned greeting slice.\n- \`src/greeting/greeting.slice.test.ts\` — module/slice template via \`createTestingModule\` for real DI graph confidence.\n- \`src/app.test.ts\` — integration-style dispatch template for runtime + starter routes.\n- \`test/app.e2e.test.ts\` — default HTTP/e2e-style template powered by \`createTestApp\` and \`app.request(...).send()\` from \`@fluojs/testing\`; older \`src/app.e2e.test.ts\` tests can be moved here without changing the request helper.\n- \`${createExecCommand(options.packageManager, 'fluo g repo User')}\` also adds:\n - \`src/users/user.repo.test.ts\` (unit template)\n - \`src/users/user.repo.slice.test.ts\` (slice/integration template via \`createTestingModule\`)\n\nUse unit templates for fast logic checks, \`${createRunCommand(options.packageManager, 'test:e2e')}\` for the dedicated request-level e2e suite, and \`${createRunCommand(options.packageManager, 'test:cov')}\` when your Vitest runtime supports coverage.`;
|
|
386
390
|
return `# ${options.projectName}
|
|
387
391
|
|
|
@@ -774,12 +778,17 @@ export default {
|
|
|
774
778
|
`;
|
|
775
779
|
}
|
|
776
780
|
const portExpression = options.runtime === 'bun' ? "Bun.env.PORT ?? '3000'" : "process.env.PORT ?? '3000'";
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
781
|
+
if (starter.runHelper) {
|
|
782
|
+
return `import { ${starter.runHelper} } from '${starter.packageName}';
|
|
783
|
+
|
|
784
|
+
import { AppModule } from './app';
|
|
785
|
+
|
|
786
|
+
const parsedPort = Number.parseInt(${portExpression}, 10);
|
|
787
|
+
const port = Number.isFinite(parsedPort) ? parsedPort : 3000;
|
|
788
|
+
|
|
789
|
+
await ${starter.runHelper}(AppModule, { port });
|
|
790
|
+
`;
|
|
791
|
+
}
|
|
783
792
|
return `import { ${starter.adapterFactory} } from '${starter.packageName}';
|
|
784
793
|
import { FluoFactory } from '@fluojs/runtime';
|
|
785
794
|
|
|
@@ -787,7 +796,6 @@ import { AppModule } from './app';
|
|
|
787
796
|
|
|
788
797
|
// The generated starter wires the selected first-class fluo new application path:
|
|
789
798
|
// ${starter.runtimeLabel} + ${starter.platformLabel} via ${starter.adapterFactory}(...).
|
|
790
|
-
${loggerGuidance}
|
|
791
799
|
|
|
792
800
|
const parsedPort = Number.parseInt(${portExpression}, 10);
|
|
793
801
|
const port = Number.isFinite(parsedPort) ? parsedPort : 3000;
|
|
@@ -1610,17 +1618,14 @@ export class AppModule {}
|
|
|
1610
1618
|
`;
|
|
1611
1619
|
}
|
|
1612
1620
|
function createMixedMainFile() {
|
|
1613
|
-
return `import {
|
|
1614
|
-
import { FluoFactory } from '@fluojs/runtime';
|
|
1621
|
+
return `import { bootstrapFastifyApplication } from '@fluojs/platform-fastify';
|
|
1615
1622
|
|
|
1616
1623
|
import { AppModule } from './app';
|
|
1617
1624
|
|
|
1618
1625
|
const parsedPort = Number.parseInt(process.env.PORT ?? '3000', 10);
|
|
1619
1626
|
const port = Number.isFinite(parsedPort) ? parsedPort : 3000;
|
|
1620
1627
|
|
|
1621
|
-
const app = await
|
|
1622
|
-
adapter: createFastifyAdapter({ port }),
|
|
1623
|
-
});
|
|
1628
|
+
const app = await bootstrapFastifyApplication(AppModule, { port });
|
|
1624
1629
|
await app.connectMicroservice();
|
|
1625
1630
|
await app.startAllMicroservices();
|
|
1626
1631
|
await app.listen();
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"migration",
|
|
10
10
|
"diagnostics"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.
|
|
12
|
+
"version": "1.0.6",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"ejs": "^3.1.10",
|
|
45
45
|
"tsx": "^4.20.4",
|
|
46
46
|
"typescript": "^6.0.2",
|
|
47
|
-
"@fluojs/runtime": "^1.1.
|
|
47
|
+
"@fluojs/runtime": "^1.1.5"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@fluojs/studio": "^1.0.5"
|