1- import * as esbuild from "https://deno.land/x/esbuild@v0.19.2/mod.js" ; //v0.19.1 was better?
2- // import Babel from "https://esm.sh/@babel/standalone@7.18.8"; // causes typedarray issue
3- import Babel from "https://esm.sh/@babel/standalone@7.23.10" ; // causes typedarray issue
4-
5- //import { denoPlugins } from "https://esm.sh/gh/scriptmaster/esbuild_deno_loader@0.8.4/mod.ts";
6- import { denoPlugins } from "./plugins/esbuild_deno_loader/mod.ts" ; // path issue
7- // import pluginVue from "https://esm.sh/esbuild-plugin-vue-next";
8- // import esbuildSveltePlugin from "https://esm.sh/esbuild-svelte@0.8.0";
9- // import esbuildSveltePlugin from "./plugins/esbuild-svelte/index.deno.ts";
1+ import * as esbuild from "https://deno.land/x/esbuild@v0.19.2/mod.js" ;
2+ import Babel from "https://esm.sh/@babel/standalone@7.23.10" ; // For transpiling .html files to h() or m() calls.
3+ import { denoPlugins } from "./plugins/esbuild_deno_loader/mod.ts" ;
104
115import { NodeGlobalsPolyfillPlugin } from 'https://esm.sh/@esbuild-plugins/node-globals-polyfill' ;
126import { NodeModulesPolyfillPlugin } from 'https://esm.sh/@esbuild-plugins/node-modules-polyfill'
@@ -35,7 +29,7 @@ import { alias, awsS3Deploy, certbot, congrats, csv, head, install, nginx, readL
3529// deno install -f -A sergeant.ts; sergeant serve
3630
3731const portRangeStart = 3000 ;
38- const VERSION = 'v1.7.0 ' ;
32+ const VERSION = 'v1.7.1 ' ;
3933const ESBUILD_MODE = Deno . env . get ( 'ESBUILD_PLATFORM' ) || Deno . env . get ( 'ESBUILD_MODE' ) || 'neutral' ;
4034const ESBUILD_FORMAT = Deno . env . get ( 'ESBUILD_FORMAT' ) || 'esm' ;
4135const ESBUILD_TARGET = Deno . env . get ( 'ESBUILD_TARGET' ) || 'esnext' ;
@@ -65,8 +59,11 @@ async function main() {
6559 versionCheck ( ) ;
6660 } else {
6761 switch ( true ) {
68- case / ^ \W * h e l p $ / i. test ( command ) :
69- console . log ( 'SHOW HELP' )
62+ case / ^ \W * h ( e l p ) ? $ / i. test ( command ) :
63+ // TODO: should do something like golang's cobra does
64+ console . log ( 'To get started:\n\tsergeant create [scaffold] [appname]\n\tsergeant create react [appname]\n\tsergeant create preact mypreactapp\n\tNote: `sergeant ls` to list all available [templates] to scaffold.\n' ) ;
65+ console . log ( 'To HMR serve:\n\tsergeant serve [appname]\n' ) ;
66+ console . log ( 'To build:\n\tsergeant build [appname]\n' ) ;
7067 break ;
7168 case / ^ b u i l d $ / i. test ( command ) :
7269 await buildApps ( args [ 1 ] || "" ) ;
@@ -79,6 +76,7 @@ async function main() {
7976 //await chooseAppForMap(args[1] || "");
8077 break ;
8178 case / ^ ( s c a f f o l d | c r e a t e | n e w | n ) $ / i. test ( command ) :
79+ if ( ! args [ 1 ] ) return lsRemoteScaffolds ( ) ;
8280 create ( args [ 1 ] || "builder" , args [ 2 ] || "app_builder" ) ;
8381 break ;
8482 case / ^ ( l s | l i s t | l s - r e m o t e | l s _ r e m o t e | s c a f f o l d s ) $ / i. test ( command ) :
@@ -121,8 +119,7 @@ async function main() {
121119 source ( ) ;
122120 break ;
123121 case / ^ ( v e r s i o n | - v | - - v e r s i o n | - v e r s i o n | v | i n f o | a b o u t | - i n f o | - - i n f o ) $ / i. test ( command ) :
124- // console.log(green(VERSION));
125- // versionCheck();
122+ versionCheck ( ) ;
126123 break ;
127124 default :
128125 console . log ( gray ( '>' ) , command || '' ) ;
@@ -147,7 +144,7 @@ function lsRemoteScaffolds(command?: string): Array<string> {
147144 const scaffoldApps = list_remote_apps ( command ) ;
148145 scaffoldApps . map ( s => console . log ( '\tsergeant create' , s , 'my_' + s + '_app' ) ) ;
149146
150- const builderApp = ( prompt ( 'Create a builder app? [y/N/scaffoldName] ' , 'N' ) || 'N' ) . toLowerCase ( ) ;
147+ const builderApp = ( prompt ( 'Create a builder app? [y/N/react] or type another scaffold name: ' , 'N' ) || 'N' ) . toLowerCase ( ) ;
151148 if ( builderApp == 'y' ) {
152149 ensureDir ( appsDir ) ;
153150 create ( args [ 1 ] || "builder" , args [ 2 ] || 'my_builder_app' ) ;
@@ -160,8 +157,8 @@ function lsRemoteScaffolds(command?: string): Array<string> {
160157
161158function versionCheck ( ) {
162159 try {
160+ console . log ( green ( 'VERSION UPDATES\n===============' ) ) ;
163161 fetch ( 'https://raw.githubusercontent.com/scriptmaster/sergeant/master/CLI_ANNOUNCE.md' ) . then ( ( o ) => {
164- // console.log(o.split('\n'));
165162 if ( o . ok ) {
166163 o . text ( ) . then ( t => {
167164 const firstLine = t . split ( "\n" ) [ 0 ] ;
0 commit comments