File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2- import nodeModule from ' node:module' ;
2+ import nodeModule from " node:module" ;
33
44// enable on-disk code caching of all modules loaded by Node.js
55// requires Nodejs >= 22.8.0
@@ -11,3 +11,10 @@ if (enableCompileCache) {
1111 // ignore errors
1212 }
1313}
14+
15+ async function main ( ) {
16+ const { runCLI } = await import ( "../dist/index.js" ) ;
17+ runCLI ( ) ;
18+ }
19+
20+ main ( ) ;
Original file line number Diff line number Diff line change 2727 "dev" : " rslib -w" ,
2828 "format" : " oxfmt ." ,
2929 "format:check" : " oxfmt . --check" ,
30- "lint" : " rslint && pnpm format:check" ,
31- "lint:write" : " rslint --fix && pnpm format" ,
30+ "lint" : " rslint && node --run format:check" ,
31+ "lint:write" : " rslint --fix && node --run format" ,
3232 "test" : " echo 'pass'" ,
3333 "bump" : " pnpx bumpp"
3434 },
35+ "dependencies" : {
36+ "@rsbuild/core" : " catalog:"
37+ },
3538 "devDependencies" : {
3639 "@playwright/test" : " catalog:" ,
37- "@rsbuild/core" : " catalog:" ,
3840 "@rslib/core" : " catalog:" ,
3941 "@rslint/core" : " catalog:" ,
4042 "@types/node" : " catalog:" ,
Original file line number Diff line number Diff line change 1+ import { logger } from '@rsbuild/core' ;
2+
3+ const { argv } = process ;
4+
5+ function initNodeEnv ( command : string | undefined ) {
6+ if ( ! process . env . NODE_ENV ) {
7+ if ( command === 'build' || command === 'preview' ) {
8+ process . env . NODE_ENV = 'production' ;
9+ } else if ( command === 'dev' ) {
10+ process . env . NODE_ENV = 'development' ;
11+ }
12+ }
13+ }
14+
15+ export function runCLI ( ) : void {
16+ const command = argv [ 2 ] ;
17+
18+ initNodeEnv ( command ) ;
19+
20+ try {
21+ // setupCommands();
22+ } catch ( err ) {
23+ logger . error ( 'Failed to start Rstack CLI.' ) ;
24+ logger . error ( err ) ;
25+ process . exit ( 1 ) ;
26+ }
27+ }
Original file line number Diff line number Diff line change 1- console . log ( 'Hello, World!' ) ;
1+ export { runCLI } from './cli/index.js' ;
You can’t perform that action at this time.
0 commit comments