11#!/usr/bin/env node
2- import inquirer from 'inquirer' ;
32import boxen from 'boxen' ;
3+ import inquirer from 'inquirer' ;
44
5- import path from 'path ' ;
6- import fs from 'fs ' ;
7- import { fileURLToPath } from 'url ' ;
8- import { dirname } from 'path ' ;
5+ import fs from 'node:fs ' ;
6+ import path from 'node:path ' ;
7+ import { dirname } from 'node:path ' ;
8+ import { fileURLToPath } from 'node:url ' ;
99import { Command } from 'commander' ;
1010
1111const __filename = fileURLToPath ( import . meta. url ) ;
@@ -86,7 +86,7 @@ const promptEVMLibrary = async () => {
8686} ;
8787
8888function isValidDirectoryName ( dirName ) {
89- const illegalRe = / [ < > : " / \\ | ? * \x00 - \x1F ] / g;
89+ const illegalRe = / [ < > : " / \\ | ? * ] / g;
9090 const windowsReservedRe = / ^ ( c o n | p r n | a u x | n u l | c o m [ 1 - 9 ] | l p t [ 1 - 9 ] ) $ / i;
9191 const trailingRe = / [ . ] + $ / ;
9292 const validNpmPackageRe = / ^ (?: @ [ a - z 0 - 9 - * ~ ] [ a -z 0 -9 -* ._ ~ ] * ) ? [ a - z 0 - 9 - ~ ] [ a - z 0 - 9 - ._ ~ ] * $ / ;
@@ -95,6 +95,7 @@ function isValidDirectoryName(dirName) {
9595 return false ;
9696 }
9797
98+ // Check for illegal characters, Windows reserved names, trailing spaces/dots
9899 if ( illegalRe . test ( dirName ) || windowsReservedRe . test ( dirName ) || trailingRe . test ( dirName ) || ! validNpmPackageRe . test ( dirName ) ) {
99100 return false ;
100101 }
@@ -166,7 +167,7 @@ async function runWizard(options: WizardOptions): Promise<void> {
166167
167168 const appFramework = options . framework || ( await promptFramework ( ) ) ;
168169 let appConnectionType = options . ecosystem || ( await promptRpcIntegrations ( ) ) ;
169- if ( appConnectionType == RPCIntegrationType . EVM ) {
170+ if ( appConnectionType === RPCIntegrationType . EVM ) {
170171 appConnectionType = options . library || ( await promptEVMLibrary ( ) ) ;
171172 }
172173
@@ -182,7 +183,7 @@ async function runWizard(options: WizardOptions): Promise<void> {
182183program
183184 . command ( 'app' )
184185 . description ( 'Create a new SEI dApp' )
185- . option ( '-n, --name <name>' , ` Specify the name of your dApp. Name must be a valid package name.` )
186+ . option ( '-n, --name <name>' , ' Specify the name of your dApp. Name must be a valid package name.' )
186187 . option ( '-f, --framework <framework>' , `Specify the app framework to use: [${ Object . values ( FrontendScaffolding ) . join ( ', ' ) } ]` )
187188 . option ( '-e, --ecosystem <ecosystem>' , `Specify the ecosystem to use: [${ Object . values ( RPCIntegrationType ) . join ( ', ' ) } ]` )
188189 . option ( '-l, --library <library>' , `Specify the EVM library to use: [${ Object . values ( EVMLibrary ) . join ( ', ' ) } ]. Only used if ecosystem chosen is 'EVM'` )
0 commit comments