@workflow/nest 5.0.0-beta.2 → 5.0.0-beta.4
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/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ function generateSwcrc(pluginPath, moduleType = 'es6') {
|
|
|
30
30
|
decoratorMetadata: true,
|
|
31
31
|
},
|
|
32
32
|
experimental: {
|
|
33
|
-
plugins: [[pluginPath, { mode: '
|
|
33
|
+
plugins: [[pluginPath, { mode: 'step' }]],
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
module: {
|
|
@@ -55,7 +55,7 @@ Options:
|
|
|
55
55
|
--force Overwrite existing .swcrc file
|
|
56
56
|
|
|
57
57
|
This command generates a .swcrc file configured with the Workflow SWC plugin
|
|
58
|
-
for
|
|
58
|
+
for step-mode transformations. The plugin path is resolved from the
|
|
59
59
|
@workflow/nest package, so no additional hoisting configuration is needed.
|
|
60
60
|
`);
|
|
61
61
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C;;;GAGG;AACH,SAAS,oBAAoB;I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C,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,kBAAkB,UAAU,EAAE,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CACT,sEAAsE,CACvE,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,SAAS,IAAI;IACX,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAExB,IACE,CAAC,OAAO;QACR,OAAO,KAAK,MAAM;QAClB,OAAO,KAAK,QAAQ;QACpB,OAAO,KAAK,IAAI,EAChB,CAAC;QACD,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,EAAE,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\n\n/**\n * Resolve the path to the SWC workflow plugin.\n * This works because @workflow/nest has @workflow/swc-plugin as a dependency.\n */\nfunction resolveSwcPluginPath(): string {\n return require.resolve('@workflow/swc-plugin', {\n paths: [__dirname],\n });\n}\n\n/**\n * Generate .swcrc configuration for NestJS with the workflow plugin.\n */\nfunction generateSwcrc(\n pluginPath: string,\n moduleType: 'es6' | 'commonjs' = 'es6'\n): object {\n return {\n $schema: 'https://swc.rs/schema.json',\n jsc: {\n parser: {\n syntax: 'typescript',\n decorators: true,\n },\n transform: {\n legacyDecorator: true,\n decoratorMetadata: true,\n },\n experimental: {\n plugins: [[pluginPath, { mode: 'step' }]],\n },\n },\n module: {\n type: moduleType,\n },\n sourceMaps: true,\n };\n}\n\nfunction showHelp(): void {\n console.log(`\n@workflow/nest CLI\n\nCommands:\n init Generate .swcrc configuration with the workflow plugin\n help Show this help message\n\nUsage:\n npx @workflow/nest init [options]\n\nOptions:\n --module <type> SWC module type: 'es6' (default) or 'commonjs'\n --force Overwrite existing .swcrc file\n\nThis command generates a .swcrc file configured with the Workflow SWC plugin\nfor step-mode transformations. The plugin path is resolved from the\n@workflow/nest package, so no additional hoisting configuration is needed.\n`);\n}\n\nfunction hasWorkflowPlugin(swcrcContent: string): boolean {\n try {\n const parsed = JSON.parse(swcrcContent);\n const plugins = parsed?.jsc?.experimental?.plugins;\n return (\n Array.isArray(plugins) &&\n plugins.some(\n (p) =>\n Array.isArray(p) &&\n typeof p[0] === 'string' &&\n p[0].includes('workflow')\n )\n );\n } catch {\n return false;\n }\n}\n\nimport { parseModuleType as parseModuleTypeRaw } from './parse-module-type.js';\n\nfunction parseModuleType(args: string[]): 'es6' | 'commonjs' {\n const result = parseModuleTypeRaw(args);\n if (result === null) {\n const idx = args.indexOf('--module');\n const value = idx >= 0 && idx + 1 < args.length ? args[idx + 1] : '';\n console.error(\n `Invalid module type: ${value}. Must be 'es6' or 'commonjs'.`\n );\n process.exit(1);\n }\n return result;\n}\n\nfunction handleInit(args: string[]): void {\n const swcrcPath = resolve(process.cwd(), '.swcrc');\n const forceMode = args.includes('--force');\n const moduleType = parseModuleType(args);\n\n if (existsSync(swcrcPath)) {\n const existing = readFileSync(swcrcPath, 'utf-8');\n\n if (hasWorkflowPlugin(existing)) {\n console.log('✓ .swcrc already configured with workflow plugin');\n if (!forceMode) {\n console.log(' Run with --force to regenerate');\n process.exit(0);\n }\n } else if (!forceMode) {\n console.log('⚠ .swcrc already exists. Run with --force to overwrite.');\n process.exit(1);\n }\n }\n\n const pluginPath = resolveSwcPluginPath();\n const swcrc = generateSwcrc(pluginPath, moduleType);\n\n writeFileSync(swcrcPath, `${JSON.stringify(swcrc, null, 2)}\\n`);\n console.log('✓ Created .swcrc with workflow plugin configuration');\n console.log(` Plugin path: ${pluginPath}`);\n console.log('\\nNext steps:');\n console.log(\n '1. Ensure nest-cli.json has: \"compilerOptions\": { \"builder\": \"swc\" }'\n );\n console.log('2. Add .swcrc to .gitignore (it contains absolute paths)');\n console.log('3. Run: nest build');\n}\n\n/**\n * Main CLI entry point.\n */\nfunction main() {\n const args = process.argv.slice(2);\n const command = args[0];\n\n if (\n !command ||\n command === 'help' ||\n command === '--help' ||\n command === '-h'\n ) {\n showHelp();\n process.exit(0);\n }\n\n if (command === 'init') {\n handleInit(args);\n process.exit(0);\n }\n\n console.error(`Unknown command: ${command}`);\n console.error('Run with --help for usage information.');\n process.exit(1);\n}\n\nmain();\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workflow/nest",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.4",
|
|
4
4
|
"description": "NestJS integration for Workflow SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@swc/core": "1.15.3",
|
|
30
30
|
"pathe": "2.0.3",
|
|
31
|
-
"@workflow/builders": "5.0.0-beta.
|
|
32
|
-
"@workflow/swc-plugin": "5.0.0-beta.
|
|
31
|
+
"@workflow/builders": "5.0.0-beta.4",
|
|
32
|
+
"@workflow/swc-plugin": "5.0.0-beta.3"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@nestjs/common": ">=10.0.0",
|