Skip to content

Commit 318f568

Browse files
committed
v1.2.2: Add TypeScript types to config and fix CI
- Import AppConfig from @morojs/moro for type safety - Use Partial<AppConfig> for better developer experience - Fix CI test to use modern 'module create' command - Remove duplicate legacy generate commands - CLI help and module commands now work correctly
1 parent 131258f commit 318f568

5 files changed

Lines changed: 9 additions & 29 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ jobs:
9898
run: |
9999
mkdir -p /tmp/test-cli
100100
cd /tmp/test-cli
101-
node ${{ github.workspace }}/dist/cli.js generate test-module --features=websocket,database
102-
ls -la test-module/
101+
node ${{ github.workspace }}/dist/cli.js module create test-module --features=websocket,database
102+
ls -la src/modules/test-module/
103103
104104
build:
105105
name: Build

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@morojs/cli",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "MoroJS Framework - Comprehensive Development Toolkit",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/cli.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -428,30 +428,6 @@ export async function runCLI(): Promise<void> {
428428
}
429429
});
430430

431-
// Legacy support for existing module generation
432-
program
433-
.command('generate <name>')
434-
.alias('g')
435-
.description('Generate module (legacy command)')
436-
.option('--features <features>', 'Comma-separated features')
437-
.action(async (name: string, options: any) => {
438-
logger.info(
439-
'Using legacy module generation. Consider using "morojs-cli module create" for enhanced features.',
440-
'Legacy'
441-
);
442-
try {
443-
const generator = new ModuleStubGenerator();
444-
const features = options.features ? options.features.split(',') : [];
445-
await generator.generateModule(name, features);
446-
} catch (error) {
447-
logger.error(
448-
`Failed to generate module: ${error instanceof Error ? error.message : 'Unknown error'}`,
449-
'Generate'
450-
);
451-
process.exit(1);
452-
}
453-
});
454-
455431
// Help and examples
456432
program
457433
.command('examples')

src/commands/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ export class ConfigManager {
8181
return `// MoroJS Configuration
8282
// Auto-generated by MoroJS CLI
8383
84+
import { AppConfig } from '@morojs/moro';
85+
8486
export default {
8587
server: {
8688
port: parseInt(process.env.PORT || '3000'),
@@ -224,7 +226,7 @@ export default {
224226
workers: parseInt(process.env.CLUSTER_WORKERS || '0') || 'auto'
225227
}
226228
}
227-
};`;
229+
} as Partial<AppConfig>;`;
228230
}
229231

230232
private generateEnvContent(environment: string): string {

src/commands/init.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,8 @@ CLOUDFLARE_API_TOKEN=`
598598
// Generated based on selected features: ${config.features.join(', ')}
599599
// Reference: https://morojs.com/docs/configuration
600600
601+
import { AppConfig } from '@morojs/moro';
602+
601603
export default {
602604
// Server Configuration
603605
server: {
@@ -852,7 +854,7 @@ ${
852854
}`
853855
: ''
854856
}
855-
};`;
857+
} as Partial<AppConfig>;`;
856858

857859
await writeFile(join(projectPath, 'moro.config.ts'), configContent);
858860
}

0 commit comments

Comments
 (0)