@h3ravel/console 11.13.0 → 11.14.1
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/bin/fire.cjs +8 -5
- package/bin/fire.js +8 -5
- package/dist/index.cjs +91 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +93 -11
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/bin/fire.cjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./zero-nnqbPV1z.cjs`);require(`tsx/esm`);let t=require(`@h3ravel/core`);t=e.n(t);let n=require(`@h3ravel/shared`);n=e.n(n);let r=require(`@h3ravel/musket`);r=e.n(r);let i=require(`execa`);i=e.n(i);let a=require(`preferred-pm`);a=e.n(a);let o=require(`
|
|
2
|
+
const e=require(`./zero-nnqbPV1z.cjs`);require(`tsx/esm`);let t=require(`@h3ravel/core`);t=e.n(t);let n=require(`@h3ravel/shared`);n=e.n(n);let r=require(`@h3ravel/musket`);r=e.n(r);let i=require(`execa`);i=e.n(i);let a=require(`preferred-pm`);a=e.n(a);let o=require(`fs/promises`);o=e.n(o);let s=require(`crypto`);s=e.n(s);let c=require(`dotenv`);c=e.n(c);let l=require(`node:fs/promises`);l=e.n(l);let u=require(`@h3ravel/support`);u=e.n(u);let d=require(`node:path`);d=e.n(d);let f=require(`node:fs`);f=e.n(f);let p=require(`child_process`);p=e.n(p);let m=require(`path`);m=e.n(m);var h=class e extends r.Command{signature=`build
|
|
3
3
|
{--m|minify : Minify your bundle output}
|
|
4
4
|
{--d|dev : Build for dev but don't watch for changes}
|
|
5
|
-
`;description=`Build the app for production`;async handle(){try{await this.fire()}catch(e){n.Logger.error(e)}}async fire(){let t=this.option(`dev`)?`.h3ravel/serve`:env(`DIST_DIR`,`dist`),n=this.option(`minify`),r=this.getVerbosity(),i=r>0;this.newLine(),await e.build({outDir:t,minify:n,verbosity:r,debug:i,mute:!1}),this.newLine()}static async build({debug:e,minify:t,mute:r,verbosity:o,outDir:s}={mute:!1,debug:!1,minify:!1,verbosity:0,outDir:`dist`}){let c=(await(0,a.default)(base_path()))?.name??`pnpm`,l={EXTENDED_DEBUG:e?`true`:`false`,CLI_BUILD:`true`,NODE_ENV:`production`,DIST_DIR:s,DIST_MINIFY:t,LOG_LEVEL:[`silent`,`info`,`warn`,`error`][o]},u=l.LOG_LEVEL===`silent`?`--silent`:null;if(r)return await(0,i.execa)(c,[`tsdown`,u,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:base_path(),env:Object.assign({},process.env,l)});let d=s===`dist`?`Production`:`Development`;return await n.TaskManager.advancedTaskRunner([[`Creating ${d} Bundle`,`STARTED`],[`${d} Bundle Created`,`COMPLETED`]],async()=>{await(0,i.execa)(c,[`tsdown`,u,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:base_path(),env:Object.assign({},process.env,l)})})}},
|
|
5
|
+
`;description=`Build the app for production`;async handle(){try{await this.fire()}catch(e){n.Logger.error(e)}}async fire(){let t=this.option(`dev`)?`.h3ravel/serve`:env(`DIST_DIR`,`dist`),n=this.option(`minify`),r=this.getVerbosity(),i=r>0;this.newLine(),await e.build({outDir:t,minify:n,verbosity:r,debug:i,mute:!1}),this.newLine()}static async build({debug:e,minify:t,mute:r,verbosity:o,outDir:s}={mute:!1,debug:!1,minify:!1,verbosity:0,outDir:`dist`}){let c=(await(0,a.default)(base_path()))?.name??`pnpm`,l={EXTENDED_DEBUG:e?`true`:`false`,CLI_BUILD:`true`,NODE_ENV:`production`,DIST_DIR:s,DIST_MINIFY:t,LOG_LEVEL:[`silent`,`info`,`warn`,`error`][o]},u=l.LOG_LEVEL===`silent`?`--silent`:null;if(r)return await(0,i.execa)(c,[`tsdown`,u,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:base_path(),env:Object.assign({},process.env,l)});let d=s===`dist`?`Production`:`Development`;return await n.TaskManager.advancedTaskRunner([[`Creating ${d} Bundle`,`STARTED`],[`${d} Bundle Created`,`COMPLETED`]],async()=>{await(0,i.execa)(c,[`tsdown`,u,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:base_path(),env:Object.assign({},process.env,l)})})}},g=class extends r.Command{signature=`key:generate
|
|
6
|
+
{--force: Force the operation to run when in production}
|
|
7
|
+
{--show: Display the key instead of modifying files}
|
|
8
|
+
`;description=`Set the application key`;async handle(){let e={key:s.default.randomBytes(32).toString(`base64`),envPath:base_path(`.env`),egEnvPath:base_path(`.env.example`),updated:!1,show:this.option(`show`)};this.newLine(),await n.FileSystem.fileExists(e.envPath)||(await n.FileSystem.fileExists(e.egEnvPath)?await(0,o.copyFile)(e.egEnvPath,e.envPath):(this.error(`.env file not found.`),this.newLine(),process.exit(0)));let t=await(0,o.readFile)(e.envPath,`utf8`),r=Buffer.from(t),i=c.default.parse(r);if(e.show){(!i.APP_KEY||i.APP_KEY===``)&&(this.error(`Application key not set.`),this.newLine(),process.exit(0));let[e,t]=i.APP_KEY.split(`:`);n.Logger.log([[e,`yellow`],[t,`white`]],`:`),this.newLine(),process.exit(0)}else i.APP_ENV===`production`&&!this.option(`force`)&&(this.error(`Application is currently in production, failed to set key.`),this.newLine(),process.exit(1));/^APP_KEY=.*$/m.test(t)?(e.updated=!0,t=t.replace(/^APP_KEY=.*$/m,`APP_KEY=base64:${e.key}`)):(e.updated=!1,t=`APP_KEY=base64:${e.key}\n\n${t}`),await(0,o.writeFile)(e.envPath,t,`utf8`),this.success(`Application key set successfully.`),this.newLine()}},_=class extends r.Command{signature=`#make:
|
|
6
9
|
{controller : Create a new controller class.
|
|
7
10
|
| {--a|api : Exclude the create and edit methods from the controller}
|
|
8
11
|
| {--m|model= : Generate a resource controller for the given model}
|
|
@@ -21,7 +24,7 @@ const e=require(`./zero-nnqbPV1z.cjs`);require(`tsx/esm`);let t=require(`@h3rave
|
|
|
21
24
|
| {--force : Create the view even if it already exists}
|
|
22
25
|
}
|
|
23
26
|
{^name : The name of the [name] to generate}
|
|
24
|
-
`;description=`Generate component classes`;async handle(){let e=this.dictionary.baseCommand??this.dictionary.name;this.argument(`name`)||this.program.error(`Please provide a valid name for the `+e),await this[{controller:`makeController`,resource:`makeResource`,view:`makeView`,command:`makeCommand`}[e]]()}async makeController(){let e=this.option(`api`)?`-resource`:``,t=this.argument(`name`),r=this.option(`force`),i=n.FileSystem.findModulePkg(`@h3ravel/http`,this.kernel.cwd)??``,a=
|
|
27
|
+
`;description=`Generate component classes`;async handle(){let e=this.dictionary.baseCommand??this.dictionary.name;this.argument(`name`)||this.program.error(`Please provide a valid name for the `+e),await this[{controller:`makeController`,resource:`makeResource`,view:`makeView`,command:`makeCommand`}[e]]()}async makeController(){let e=this.option(`api`)?`-resource`:``,t=this.argument(`name`),r=this.option(`force`),i=n.FileSystem.findModulePkg(`@h3ravel/http`,this.kernel.cwd)??``,a=d.default.join(i,`dist/stubs/controller${e}.stub`),o=app_path(`Http/Controllers/${t}.ts`);t.includes(`/`)&&await(0,l.mkdir)(u.Str.beforeLast(o,`/`),{recursive:!0}),!r&&await n.FileSystem.fileExists(o)&&n.Logger.error(`ERORR: ${t} controller already exists`);let s=await(0,l.readFile)(a,`utf-8`);s=s.replace(/{{ name }}/g,t),await(0,l.writeFile)(o,s),n.Logger.split(`INFO: Controller Created`,n.Logger.log(d.default.basename(o),`gray`,!1))}makeResource(){n.Logger.success(`Resource support is not yet available`)}makeCommand(){n.Logger.success(`Musket command creation is not yet available`)}async makeView(){let e=this.argument(`name`),t=this.option(`force`),r=base_path(`src/resources/views/${e}.edge`);e.includes(`/`)&&await(0,l.mkdir)(u.Str.beforeLast(r,`/`),{recursive:!0}),!t&&await n.FileSystem.fileExists(r)&&n.Logger.error(`ERORR: ${e} view already exists`),await(0,l.writeFile)(r,`{{-- src/resources/views/${e}.edge --}}`),n.Logger.split(`INFO: View Created`,n.Logger.log(`src/resources/views/${e}.edge`,`gray`,!1))}},v=class extends r.Command{signature=`postinstall`;description=`Default post installation command`;async handle(){this.genEncryptionKey(),this.createSqliteDB()}async genEncryptionKey(){new g(this.app,this.kernel).setProgram(this.program).setOption(`force`,!0).setOption(`silent`,!0).setOption(`quiet`,!0).setInput({force:!0,silent:!0,quiet:!0},[],[],{},this.program).handle()}async createSqliteDB(){config(`database.default`)===`sqlite`&&(await n.FileSystem.fileExists(database_path())||await(0,l.mkdir)(database_path(),{recursive:!0}),await n.FileSystem.fileExists(database_path(`db.sqlite`))||await(0,l.writeFile)(database_path(`db.sqlite`),``))}};const y=String.raw`
|
|
25
28
|
111
|
|
26
29
|
111111111
|
|
27
30
|
1111111111 111111
|
|
@@ -43,11 +46,11 @@ const e=require(`./zero-nnqbPV1z.cjs`);require(`tsx/esm`);let t=require(`@h3rave
|
|
|
43
46
|
111111 111 111111
|
|
44
47
|
111111111
|
|
45
48
|
110
|
|
46
|
-
`,
|
|
49
|
+
`,b=String.raw`
|
|
47
50
|
_ _ _____ _
|
|
48
51
|
| | | |___ / _ __ __ ___ _____| |
|
|
49
52
|
| |_| | |_ \| '__/ _ \ \ / / _ \ |
|
|
50
53
|
| _ |___) | | | (_| |\ V / __/ |
|
|
51
54
|
|_| |_|____/|_| \__,_| \_/ \___|_|
|
|
52
55
|
|
|
53
|
-
`;function
|
|
56
|
+
`;function x(e={}){let t,n,r=e.args||[],i=e.allowRestarts||!1,a=e.input,o=e.options||e;return delete o.args,delete o.allowRestarts,{name:`run`,buildStart(e){let n=a??e.input;if(typeof n==`string`&&(n=[n]),typeof n==`object`&&(n=Object.values(n)),n.length>1)throw Error("@rollup/plugin-run must have a single entry point; consider setting the `input` option");t=(0,m.resolve)(n[0])},generateBundle(e,t,n){n||this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`)},writeBundle(e,a){let s=(e,t)=>{n&&n.kill(),n=(0,p.fork)((0,m.join)(e,t),r,o)},c=e.dir||(0,m.dirname)(e.file),l=Object.keys(a).find(e=>{let n=a[e];return n.isEntry&&n.facadeModuleId===t});l?(s(c,l),i&&(process.stdin.resume(),process.stdin.setEncoding(`utf8`),process.stdin.on(`data`,e=>{let t=e.toString().trim().toLowerCase();t===`rs`||t===`restart`||e.toString().charCodeAt(0)===11?s(c,l):(t===`cls`||t===`clear`||e.toString().charCodeAt(0)===12)&&console.clear()}))):this.error(`@rollup/plugin-run could not find output chunk`)}}}const S=process.env.NODE_ENV||`development`;let C=S===`development`?`.h3ravel/serve`:`dist`;process.env.DIST_DIR&&(C=process.env.DIST_DIR);const w={outDir:C,entry:[`src/**/*.ts`],format:[`esm`],target:`node22`,sourcemap:S===`development`,minify:!!process.env.DIST_MINIFY,external:[/^@h3ravel\/.*/gi],clean:!0,shims:!0,copy:[{from:`public`,to:C},`src/resources`,`src/database`],env:S===`development`?{NODE_ENV:S,DIST_DIR:C}:{},watch:S===`development`&&process.env.CLI_BUILD!==`true`?[`.env`,`.env.*`,`src`,`../../packages`]:!1,dts:!1,logLevel:`silent`,nodeProtocol:!0,skipNodeModulesBundle:!0,hooks(e){e.hook(`build:done`,async()=>{let e=[`database/migrations`,`database/factories`,`database/seeders`];for(let t=0;t<e.length;t++){let n=e[t];(0,f.existsSync)(d.default.join(C,n))&&await(0,l.rm)(d.default.join(C,n),{recursive:!0})}})},plugins:S===`development`&&process.env.CLI_BUILD!==`true`?[x({env:Object.assign({},process.env,{NODE_ENV:S,DIST_DIR:C}),execArgv:[`-r`,`source-map-support/register`],allowRestarts:!1,input:process.cwd()+`/src/server.ts`})]:[]};var T=w,E=class extends t.ServiceProvider{static priority=992;static runsInConsole=!0;runsInConsole=!0;register(){let e=`/${env(`DIST_DIR`,`.h3ravel/serve`)}/`.replaceAll(`//`,``),n=[h,_,v,g];r.Kernel.init(this.app,{logo:b,resolver:new t.ContainerResolver(this.app).resolveMethodParams,tsDownConfig:T,baseCommands:n,packages:[{name:`@h3ravel/core`,alias:`H3ravel Framework`},{name:`@h3ravel/musket`,alias:`Musket CLI`}],cliName:`musket`,hideMusketInfo:!0,discoveryPaths:[app_path(`Console/Commands/*.js`).replace(`/src/`,e)]}),[`SIGINT`,`SIGTERM`,`SIGTSTP`].forEach(e=>process.on(e,()=>{process.exit(0)}))}},D=class{async fire(){let e=process.env.DIST_DIR??`/.h3ravel/serve/`,n=[],r=new t.Application(process.cwd()),i=base_path(d.default.join(e,`bootstrap/providers.js`));try{n.push(...(await import(i)).default)}catch{}n.push(E),await r.quickStartup(n,[`CoreServiceProvider`])}};new D().fire();
|
package/bin/fire.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./zero-CW4MtoXR.js";import"tsx/esm";import{Application as e,ContainerResolver as t,ServiceProvider as n}from"@h3ravel/core";import{FileSystem as r,Logger as i,TaskManager as a}from"@h3ravel/shared";import{Command as o,Kernel as s}from"@h3ravel/musket";import{execa as c}from"execa";import l from"preferred-pm";import{
|
|
2
|
+
import"./zero-CW4MtoXR.js";import"tsx/esm";import{Application as e,ContainerResolver as t,ServiceProvider as n}from"@h3ravel/core";import{FileSystem as r,Logger as i,TaskManager as a}from"@h3ravel/shared";import{Command as o,Kernel as s}from"@h3ravel/musket";import{execa as c}from"execa";import l from"preferred-pm";import{copyFile as u,readFile as d,writeFile as f}from"fs/promises";import p from"crypto";import m from"dotenv";import{mkdir as h,readFile as g,rm as _,writeFile as v}from"node:fs/promises";import{Str as y}from"@h3ravel/support";import b from"node:path";import{existsSync as x}from"node:fs";import{fork as S}from"child_process";import{dirname as C,join as w,resolve as T}from"path";var E=class e extends o{signature=`build
|
|
3
3
|
{--m|minify : Minify your bundle output}
|
|
4
4
|
{--d|dev : Build for dev but don't watch for changes}
|
|
5
|
-
`;description=`Build the app for production`;async handle(){try{await this.fire()}catch(e){i.error(e)}}async fire(){let t=this.option(`dev`)?`.h3ravel/serve`:env(`DIST_DIR`,`dist`),n=this.option(`minify`),r=this.getVerbosity(),i=r>0;this.newLine(),await e.build({outDir:t,minify:n,verbosity:r,debug:i,mute:!1}),this.newLine()}static async build({debug:e,minify:t,mute:n,verbosity:r,outDir:i}={mute:!1,debug:!1,minify:!1,verbosity:0,outDir:`dist`}){let o=(await l(base_path()))?.name??`pnpm`,s={EXTENDED_DEBUG:e?`true`:`false`,CLI_BUILD:`true`,NODE_ENV:`production`,DIST_DIR:i,DIST_MINIFY:t,LOG_LEVEL:[`silent`,`info`,`warn`,`error`][r]},u=s.LOG_LEVEL===`silent`?`--silent`:null;if(n)return await c(o,[`tsdown`,u,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:base_path(),env:Object.assign({},process.env,s)});let d=i===`dist`?`Production`:`Development`;return await a.advancedTaskRunner([[`Creating ${d} Bundle`,`STARTED`],[`${d} Bundle Created`,`COMPLETED`]],async()=>{await c(o,[`tsdown`,u,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:base_path(),env:Object.assign({},process.env,s)})})}},
|
|
5
|
+
`;description=`Build the app for production`;async handle(){try{await this.fire()}catch(e){i.error(e)}}async fire(){let t=this.option(`dev`)?`.h3ravel/serve`:env(`DIST_DIR`,`dist`),n=this.option(`minify`),r=this.getVerbosity(),i=r>0;this.newLine(),await e.build({outDir:t,minify:n,verbosity:r,debug:i,mute:!1}),this.newLine()}static async build({debug:e,minify:t,mute:n,verbosity:r,outDir:i}={mute:!1,debug:!1,minify:!1,verbosity:0,outDir:`dist`}){let o=(await l(base_path()))?.name??`pnpm`,s={EXTENDED_DEBUG:e?`true`:`false`,CLI_BUILD:`true`,NODE_ENV:`production`,DIST_DIR:i,DIST_MINIFY:t,LOG_LEVEL:[`silent`,`info`,`warn`,`error`][r]},u=s.LOG_LEVEL===`silent`?`--silent`:null;if(n)return await c(o,[`tsdown`,u,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:base_path(),env:Object.assign({},process.env,s)});let d=i===`dist`?`Production`:`Development`;return await a.advancedTaskRunner([[`Creating ${d} Bundle`,`STARTED`],[`${d} Bundle Created`,`COMPLETED`]],async()=>{await c(o,[`tsdown`,u,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:base_path(),env:Object.assign({},process.env,s)})})}},D=class extends o{signature=`key:generate
|
|
6
|
+
{--force: Force the operation to run when in production}
|
|
7
|
+
{--show: Display the key instead of modifying files}
|
|
8
|
+
`;description=`Set the application key`;async handle(){let e={key:p.randomBytes(32).toString(`base64`),envPath:base_path(`.env`),egEnvPath:base_path(`.env.example`),updated:!1,show:this.option(`show`)};this.newLine(),await r.fileExists(e.envPath)||(await r.fileExists(e.egEnvPath)?await u(e.egEnvPath,e.envPath):(this.error(`.env file not found.`),this.newLine(),process.exit(0)));let t=await d(e.envPath,`utf8`),n=Buffer.from(t),a=m.parse(n);if(e.show){(!a.APP_KEY||a.APP_KEY===``)&&(this.error(`Application key not set.`),this.newLine(),process.exit(0));let[e,t]=a.APP_KEY.split(`:`);i.log([[e,`yellow`],[t,`white`]],`:`),this.newLine(),process.exit(0)}else a.APP_ENV===`production`&&!this.option(`force`)&&(this.error(`Application is currently in production, failed to set key.`),this.newLine(),process.exit(1));/^APP_KEY=.*$/m.test(t)?(e.updated=!0,t=t.replace(/^APP_KEY=.*$/m,`APP_KEY=base64:${e.key}`)):(e.updated=!1,t=`APP_KEY=base64:${e.key}\n\n${t}`),await f(e.envPath,t,`utf8`),this.success(`Application key set successfully.`),this.newLine()}},O=class extends o{signature=`#make:
|
|
6
9
|
{controller : Create a new controller class.
|
|
7
10
|
| {--a|api : Exclude the create and edit methods from the controller}
|
|
8
11
|
| {--m|model= : Generate a resource controller for the given model}
|
|
@@ -21,7 +24,7 @@ import"./zero-CW4MtoXR.js";import"tsx/esm";import{Application as e,ContainerReso
|
|
|
21
24
|
| {--force : Create the view even if it already exists}
|
|
22
25
|
}
|
|
23
26
|
{^name : The name of the [name] to generate}
|
|
24
|
-
`;description=`Generate component classes`;async handle(){let e=this.dictionary.baseCommand??this.dictionary.name;this.argument(`name`)||this.program.error(`Please provide a valid name for the `+e),await this[{controller:`makeController`,resource:`makeResource`,view:`makeView`,command:`makeCommand`}[e]]()}async makeController(){let e=this.option(`api`)?`-resource`:``,t=this.argument(`name`),n=this.option(`force`),a=r.findModulePkg(`@h3ravel/http`,this.kernel.cwd)??``,o=
|
|
27
|
+
`;description=`Generate component classes`;async handle(){let e=this.dictionary.baseCommand??this.dictionary.name;this.argument(`name`)||this.program.error(`Please provide a valid name for the `+e),await this[{controller:`makeController`,resource:`makeResource`,view:`makeView`,command:`makeCommand`}[e]]()}async makeController(){let e=this.option(`api`)?`-resource`:``,t=this.argument(`name`),n=this.option(`force`),a=r.findModulePkg(`@h3ravel/http`,this.kernel.cwd)??``,o=b.join(a,`dist/stubs/controller${e}.stub`),s=app_path(`Http/Controllers/${t}.ts`);t.includes(`/`)&&await h(y.beforeLast(s,`/`),{recursive:!0}),!n&&await r.fileExists(s)&&i.error(`ERORR: ${t} controller already exists`);let c=await g(o,`utf-8`);c=c.replace(/{{ name }}/g,t),await v(s,c),i.split(`INFO: Controller Created`,i.log(b.basename(s),`gray`,!1))}makeResource(){i.success(`Resource support is not yet available`)}makeCommand(){i.success(`Musket command creation is not yet available`)}async makeView(){let e=this.argument(`name`),t=this.option(`force`),n=base_path(`src/resources/views/${e}.edge`);e.includes(`/`)&&await h(y.beforeLast(n,`/`),{recursive:!0}),!t&&await r.fileExists(n)&&i.error(`ERORR: ${e} view already exists`),await v(n,`{{-- src/resources/views/${e}.edge --}}`),i.split(`INFO: View Created`,i.log(`src/resources/views/${e}.edge`,`gray`,!1))}},k=class extends o{signature=`postinstall`;description=`Default post installation command`;async handle(){this.genEncryptionKey(),this.createSqliteDB()}async genEncryptionKey(){new D(this.app,this.kernel).setProgram(this.program).setOption(`force`,!0).setOption(`silent`,!0).setOption(`quiet`,!0).setInput({force:!0,silent:!0,quiet:!0},[],[],{},this.program).handle()}async createSqliteDB(){config(`database.default`)===`sqlite`&&(await r.fileExists(database_path())||await h(database_path(),{recursive:!0}),await r.fileExists(database_path(`db.sqlite`))||await v(database_path(`db.sqlite`),``))}};String.raw`
|
|
25
28
|
111
|
|
26
29
|
111111111
|
|
27
30
|
1111111111 111111
|
|
@@ -43,11 +46,11 @@ import"./zero-CW4MtoXR.js";import"tsx/esm";import{Application as e,ContainerReso
|
|
|
43
46
|
111111 111 111111
|
|
44
47
|
111111111
|
|
45
48
|
110
|
|
46
|
-
`;const
|
|
49
|
+
`;const A=String.raw`
|
|
47
50
|
_ _ _____ _
|
|
48
51
|
| | | |___ / _ __ __ ___ _____| |
|
|
49
52
|
| |_| | |_ \| '__/ _ \ \ / / _ \ |
|
|
50
53
|
| _ |___) | | | (_| |\ V / __/ |
|
|
51
54
|
|_| |_|____/|_| \__,_| \_/ \___|_|
|
|
52
55
|
|
|
53
|
-
`;function
|
|
56
|
+
`;function j(e={}){let t,n,r=e.args||[],i=e.allowRestarts||!1,a=e.input,o=e.options||e;return delete o.args,delete o.allowRestarts,{name:`run`,buildStart(e){let n=a??e.input;if(typeof n==`string`&&(n=[n]),typeof n==`object`&&(n=Object.values(n)),n.length>1)throw Error("@rollup/plugin-run must have a single entry point; consider setting the `input` option");t=T(n[0])},generateBundle(e,t,n){n||this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`)},writeBundle(e,a){let s=(e,t)=>{n&&n.kill(),n=S(w(e,t),r,o)},c=e.dir||C(e.file),l=Object.keys(a).find(e=>{let n=a[e];return n.isEntry&&n.facadeModuleId===t});l?(s(c,l),i&&(process.stdin.resume(),process.stdin.setEncoding(`utf8`),process.stdin.on(`data`,e=>{let t=e.toString().trim().toLowerCase();t===`rs`||t===`restart`||e.toString().charCodeAt(0)===11?s(c,l):(t===`cls`||t===`clear`||e.toString().charCodeAt(0)===12)&&console.clear()}))):this.error(`@rollup/plugin-run could not find output chunk`)}}}const M=process.env.NODE_ENV||`development`;let N=M===`development`?`.h3ravel/serve`:`dist`;process.env.DIST_DIR&&(N=process.env.DIST_DIR);var P={outDir:N,entry:[`src/**/*.ts`],format:[`esm`],target:`node22`,sourcemap:M===`development`,minify:!!process.env.DIST_MINIFY,external:[/^@h3ravel\/.*/gi],clean:!0,shims:!0,copy:[{from:`public`,to:N},`src/resources`,`src/database`],env:M===`development`?{NODE_ENV:M,DIST_DIR:N}:{},watch:M===`development`&&process.env.CLI_BUILD!==`true`?[`.env`,`.env.*`,`src`,`../../packages`]:!1,dts:!1,logLevel:`silent`,nodeProtocol:!0,skipNodeModulesBundle:!0,hooks(e){e.hook(`build:done`,async()=>{let e=[`database/migrations`,`database/factories`,`database/seeders`];for(let t=0;t<e.length;t++){let n=e[t];x(b.join(N,n))&&await _(b.join(N,n),{recursive:!0})}})},plugins:M===`development`&&process.env.CLI_BUILD!==`true`?[j({env:Object.assign({},process.env,{NODE_ENV:M,DIST_DIR:N}),execArgv:[`-r`,`source-map-support/register`],allowRestarts:!1,input:process.cwd()+`/src/server.ts`})]:[]},F=class extends n{static priority=992;static runsInConsole=!0;runsInConsole=!0;register(){let e=`/${env(`DIST_DIR`,`.h3ravel/serve`)}/`.replaceAll(`//`,``),n=[E,O,k,D];s.init(this.app,{logo:A,resolver:new t(this.app).resolveMethodParams,tsDownConfig:P,baseCommands:n,packages:[{name:`@h3ravel/core`,alias:`H3ravel Framework`},{name:`@h3ravel/musket`,alias:`Musket CLI`}],cliName:`musket`,hideMusketInfo:!0,discoveryPaths:[app_path(`Console/Commands/*.js`).replace(`/src/`,e)]}),[`SIGINT`,`SIGTERM`,`SIGTSTP`].forEach(e=>process.on(e,()=>{process.exit(0)}))}};new class{async fire(){let t=process.env.DIST_DIR??`/.h3ravel/serve/`,n=[],r=new e(process.cwd()),i=base_path(b.join(t,`bootstrap/providers.js`));try{n.push(...(await import(i)).default)}catch{}n.push(F),await r.quickStartup(n,[`CoreServiceProvider`])}}().fire();export{};
|
package/dist/index.cjs
CHANGED
|
@@ -29,6 +29,12 @@ let execa = require("execa");
|
|
|
29
29
|
execa = __toESM(execa);
|
|
30
30
|
let preferred_pm = require("preferred-pm");
|
|
31
31
|
preferred_pm = __toESM(preferred_pm);
|
|
32
|
+
let fs_promises = require("fs/promises");
|
|
33
|
+
fs_promises = __toESM(fs_promises);
|
|
34
|
+
let crypto = require("crypto");
|
|
35
|
+
crypto = __toESM(crypto);
|
|
36
|
+
let dotenv = require("dotenv");
|
|
37
|
+
dotenv = __toESM(dotenv);
|
|
32
38
|
let node_fs_promises = require("node:fs/promises");
|
|
33
39
|
node_fs_promises = __toESM(node_fs_promises);
|
|
34
40
|
let __h3ravel_support = require("@h3ravel/support");
|
|
@@ -140,6 +146,70 @@ var BuildCommand = class BuildCommand extends __h3ravel_musket.Command {
|
|
|
140
146
|
}
|
|
141
147
|
};
|
|
142
148
|
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/Commands/KeyGenerateCommand.ts
|
|
151
|
+
var KeyGenerateCommand = class extends __h3ravel_musket.Command {
|
|
152
|
+
/**
|
|
153
|
+
* The name and signature of the console command.
|
|
154
|
+
*
|
|
155
|
+
* @var string
|
|
156
|
+
*/
|
|
157
|
+
signature = `key:generate
|
|
158
|
+
{--force: Force the operation to run when in production}
|
|
159
|
+
{--show: Display the key instead of modifying files}
|
|
160
|
+
`;
|
|
161
|
+
/**
|
|
162
|
+
* The console command description.
|
|
163
|
+
*
|
|
164
|
+
* @var string
|
|
165
|
+
*/
|
|
166
|
+
description = "Set the application key";
|
|
167
|
+
async handle() {
|
|
168
|
+
const config$1 = {
|
|
169
|
+
key: crypto.default.randomBytes(32).toString("base64"),
|
|
170
|
+
envPath: base_path(".env"),
|
|
171
|
+
egEnvPath: base_path(".env.example"),
|
|
172
|
+
updated: false,
|
|
173
|
+
show: this.option("show")
|
|
174
|
+
};
|
|
175
|
+
this.newLine();
|
|
176
|
+
if (!await __h3ravel_shared.FileSystem.fileExists(config$1.envPath)) if (await __h3ravel_shared.FileSystem.fileExists(config$1.egEnvPath)) await (0, fs_promises.copyFile)(config$1.egEnvPath, config$1.envPath);
|
|
177
|
+
else {
|
|
178
|
+
this.error(".env file not found.");
|
|
179
|
+
this.newLine();
|
|
180
|
+
process.exit(0);
|
|
181
|
+
}
|
|
182
|
+
let content = await (0, fs_promises.readFile)(config$1.envPath, "utf8");
|
|
183
|
+
const buf = Buffer.from(content);
|
|
184
|
+
const env$2 = dotenv.default.parse(buf);
|
|
185
|
+
if (config$1.show) {
|
|
186
|
+
if (!env$2.APP_KEY || env$2.APP_KEY === "") {
|
|
187
|
+
this.error("Application key not set.");
|
|
188
|
+
this.newLine();
|
|
189
|
+
process.exit(0);
|
|
190
|
+
}
|
|
191
|
+
const [enc, key] = env$2.APP_KEY.split(":");
|
|
192
|
+
__h3ravel_shared.Logger.log([[enc, "yellow"], [key, "white"]], ":");
|
|
193
|
+
this.newLine();
|
|
194
|
+
process.exit(0);
|
|
195
|
+
} else if (env$2.APP_ENV === "production" && !this.option("force")) {
|
|
196
|
+
this.error("Application is currently in production, failed to set key.");
|
|
197
|
+
this.newLine();
|
|
198
|
+
process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
if (/^APP_KEY=.*$/m.test(content)) {
|
|
201
|
+
config$1.updated = true;
|
|
202
|
+
content = content.replace(/^APP_KEY=.*$/m, `APP_KEY=base64:${config$1.key}`);
|
|
203
|
+
} else {
|
|
204
|
+
config$1.updated = false;
|
|
205
|
+
content = `APP_KEY=base64:${config$1.key}\n\n${content}`;
|
|
206
|
+
}
|
|
207
|
+
await (0, fs_promises.writeFile)(config$1.envPath, content, "utf8");
|
|
208
|
+
this.success("Application key set successfully.");
|
|
209
|
+
this.newLine();
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
143
213
|
//#endregion
|
|
144
214
|
//#region src/Commands/MakeCommand.ts
|
|
145
215
|
var MakeCommand = class extends __h3ravel_musket.Command {
|
|
@@ -244,6 +314,7 @@ var PostinstallCommand = class extends __h3ravel_musket.Command {
|
|
|
244
314
|
*/
|
|
245
315
|
description = "Default post installation command";
|
|
246
316
|
async handle() {
|
|
317
|
+
this.genEncryptionKey();
|
|
247
318
|
this.createSqliteDB();
|
|
248
319
|
}
|
|
249
320
|
/**
|
|
@@ -251,6 +322,18 @@ var PostinstallCommand = class extends __h3ravel_musket.Command {
|
|
|
251
322
|
*
|
|
252
323
|
* @returns
|
|
253
324
|
*/
|
|
325
|
+
async genEncryptionKey() {
|
|
326
|
+
new KeyGenerateCommand(this.app, this.kernel).setProgram(this.program).setOption("force", true).setOption("silent", true).setOption("quiet", true).setInput({
|
|
327
|
+
force: true,
|
|
328
|
+
silent: true,
|
|
329
|
+
quiet: true
|
|
330
|
+
}, [], [], {}, this.program).handle();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Create sqlite database if none exist
|
|
334
|
+
*
|
|
335
|
+
* @returns
|
|
336
|
+
*/
|
|
254
337
|
async createSqliteDB() {
|
|
255
338
|
if (config("database.default") !== "sqlite") return;
|
|
256
339
|
if (!await __h3ravel_shared.FileSystem.fileExists(database_path())) await (0, node_fs_promises.mkdir)(database_path(), { recursive: true });
|
|
@@ -419,10 +502,17 @@ var ConsoleServiceProvider = class extends __h3ravel_core.ServiceProvider {
|
|
|
419
502
|
runsInConsole = true;
|
|
420
503
|
register() {
|
|
421
504
|
const DIST_DIR = `/${env("DIST_DIR", ".h3ravel/serve")}/`.replaceAll("//", "");
|
|
505
|
+
const baseCommands = [
|
|
506
|
+
BuildCommand,
|
|
507
|
+
MakeCommand,
|
|
508
|
+
PostinstallCommand,
|
|
509
|
+
KeyGenerateCommand
|
|
510
|
+
];
|
|
422
511
|
__h3ravel_musket.Kernel.init(this.app, {
|
|
423
512
|
logo: altLogo,
|
|
424
513
|
resolver: new __h3ravel_core.ContainerResolver(this.app).resolveMethodParams,
|
|
425
514
|
tsDownConfig: TsdownConfig_default,
|
|
515
|
+
baseCommands,
|
|
426
516
|
packages: [{
|
|
427
517
|
name: "@h3ravel/core",
|
|
428
518
|
alias: "H3ravel Framework"
|
|
@@ -432,11 +522,6 @@ var ConsoleServiceProvider = class extends __h3ravel_core.ServiceProvider {
|
|
|
432
522
|
}],
|
|
433
523
|
cliName: "musket",
|
|
434
524
|
hideMusketInfo: true,
|
|
435
|
-
baseCommands: [
|
|
436
|
-
BuildCommand,
|
|
437
|
-
MakeCommand,
|
|
438
|
-
PostinstallCommand
|
|
439
|
-
],
|
|
440
525
|
discoveryPaths: [app_path("Console/Commands/*.js").replace("/src/", DIST_DIR)]
|
|
441
526
|
});
|
|
442
527
|
[
|
|
@@ -452,6 +537,7 @@ var ConsoleServiceProvider = class extends __h3ravel_core.ServiceProvider {
|
|
|
452
537
|
//#endregion
|
|
453
538
|
exports.BuildCommand = BuildCommand;
|
|
454
539
|
exports.ConsoleServiceProvider = ConsoleServiceProvider;
|
|
540
|
+
exports.KeyGenerateCommand = KeyGenerateCommand;
|
|
455
541
|
exports.MakeCommand = MakeCommand;
|
|
456
542
|
exports.PostinstallCommand = PostinstallCommand;
|
|
457
543
|
exports.TsDownConfig = TsDownConfig;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Command","outDir","TaskManager","Command","FileSystem","nodepath","path","Str","Logger","Command","FileSystem","dir","entryFileName","env","TsDownConfig: Options","path","ServiceProvider","ContainerResolver"],"sources":["../src/Commands/BuildCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/PostinstallCommand.ts","../src/logo.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0_rollup@4.52.5/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { Logger, TaskManager } from '@h3ravel/shared'\n\nimport { Command } from '@h3ravel/musket'\nimport { execa } from 'execa'\nimport preferredPM from 'preferred-pm'\n\nexport class BuildCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `build\n {--m|minify : Minify your bundle output}\n {--d|dev : Build for dev but don't watch for changes}\n `\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Build the app for production'\n\n public async handle () {\n try {\n await this.fire()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n protected async fire () {\n const outDir = this.option('dev') ? '.h3ravel/serve' : env('DIST_DIR', 'dist')\n const minify = this.option('minify')\n const verbosity = this.getVerbosity()\n const debug = verbosity > 0\n\n this.newLine()\n await BuildCommand.build({ outDir, minify, verbosity, debug, mute: false })\n this.newLine()\n }\n\n /**\n * build\n */\n public static async build ({ debug, minify, mute, verbosity, outDir } = {\n mute: false,\n debug: false,\n minify: false,\n verbosity: 0,\n outDir: 'dist'\n }) {\n\n const pm = (await preferredPM(base_path()))?.name ?? 'pnpm'\n\n const LOG_LEVELS = [\n 'silent',\n 'info',\n 'warn',\n 'error',\n ]\n\n const ENV_VARS = {\n EXTENDED_DEBUG: debug ? 'true' : 'false',\n CLI_BUILD: 'true',\n NODE_ENV: 'production',\n DIST_DIR: outDir,\n DIST_MINIFY: minify,\n LOG_LEVEL: LOG_LEVELS[verbosity]\n }\n\n const silent = ENV_VARS.LOG_LEVEL === 'silent' ? '--silent' : null\n\n if (mute) {\n return await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n\n const type = outDir === 'dist' ? 'Production' : 'Development'\n\n return await TaskManager.advancedTaskRunner(\n [[`Creating ${type} Bundle`, 'STARTED'], [`${type} Bundle Created`, 'COMPLETED']],\n async () => {\n await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n )\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport { Str } from '@h3ravel/support'\nimport nodepath from 'node:path'\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Create a new controller class. \n | {--a|api : Exclude the create and edit methods from the controller} \n | {--m|model= : Generate a resource controller for the given model} \n | {--r|resource : Generate a resource controller class} \n | {--force : Create the controller even if it already exists}\n }\n {resource : Create a new resource. \n | {--c|collection : Create a resource collection}\n | {--force : Create the resource even if it already exists}\n }\n {command : Create a new Musket command. \n | {--command : The terminal command that will be used to invoke the class} \n | {--force : Create the class even if the console command already exists}\n }\n {view : Create a new view.\n | {--force : Create the view even if it already exists}\n }\n {^name : The name of the [name] to generate}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes'\n\n public async handle (this: any) {\n const command = (this.dictionary.baseCommand ?? this.dictionary.name) as never\n\n if (!this.argument('name')) {\n this.program.error('Please provide a valid name for the ' + command)\n }\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n view: 'makeView',\n command: 'makeCommand',\n } as const\n\n await this[methods[command]]()\n }\n\n /**\n * Create a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : ''\n const name = this.argument('name')\n const force = this.option('force')\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n const path = app_path(`Http/Controllers/${name}.ts`)\n\n /** The Controller is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the controller already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Controller Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n protected makeResource () {\n Logger.success('Resource support is not yet available')\n }\n\n /**\n * Create a new Musket command\n */\n protected makeCommand () {\n Logger.success('Musket command creation is not yet available')\n }\n\n /**\n * Create a new view.\n */\n protected async makeView () {\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = base_path(`src/resources/views/${name}.edge`)\n\n /** The view is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the view already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`)\n Logger.split('INFO: View Created', Logger.log(`src/resources/views/${name}.edge`, 'gray', false))\n }\n}\n","import { mkdir, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport { FileSystem } from '@h3ravel/shared'\n\nexport class PostinstallCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'postinstall'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Default post installation command'\n\n public async handle () {\n this.createSqliteDB()\n }\n\n /**\n * Create sqlite database if none exist\n * \n * @returns \n */\n private async createSqliteDB () {\n if (config('database.default') !== 'sqlite') return\n\n if (!await FileSystem.fileExists(database_path())) {\n await mkdir(database_path(), { recursive: true })\n }\n\n if (!await FileSystem.fileExists(database_path('db.sqlite'))) {\n await writeFile(database_path('db.sqlite'), '')\n }\n }\n}\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","import { fork } from 'child_process';\nimport { resolve, dirname, join } from 'path';\n\nfunction run(opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart(options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle(_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle(outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown'\nimport { existsSync } from 'node:fs'\nimport path from 'node:path'\nimport { rm } from 'node:fs/promises'\nimport run from '@rollup/plugin-run'\n\nconst env = process.env.NODE_ENV || 'development'\nlet outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\nif (process.env.DIST_DIR) {\n outDir = process.env.DIST_DIR\n}\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n minify: !!process.env.DIST_MINIFY,\n external: [\n /^@h3ravel\\/.*/gi,\n ],\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n DIST_DIR: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n hooks (e) {\n e.hook('build:done', async () => {\n const paths = ['database/migrations', 'database/factories', 'database/seeders']\n for (let i = 0; i < paths.length; i++) {\n const name = paths[i]\n if (existsSync(path.join(outDir, name)))\n await rm(path.join(outDir, name), { recursive: true })\n }\n })\n },\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n DIST_DIR: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n}\n\nexport default TsDownConfig\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { ContainerResolver, ServiceProvider } from '@h3ravel/core'\n\nimport { BuildCommand } from '../Commands/BuildCommand'\nimport { Kernel } from '@h3ravel/musket'\nimport { MakeCommand } from '../Commands/MakeCommand'\nimport { PostinstallCommand } from '../Commands/PostinstallCommand'\nimport { altLogo } from '../logo'\nimport tsDownConfig from '../TsdownConfig'\n\n/**\n * Handles CLI commands and tooling.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static runsInConsole = true\n public runsInConsole = true\n\n register () {\n const DIST_DIR = `/${env('DIST_DIR', '.h3ravel/serve')}/`.replaceAll('//', '')\n\n Kernel.init(\n this.app,\n {\n logo: altLogo,\n resolver: new ContainerResolver(this.app).resolveMethodParams,\n tsDownConfig,\n packages: [\n { name: '@h3ravel/core', alias: 'H3ravel Framework' },\n { name: '@h3ravel/musket', alias: 'Musket CLI' }\n ],\n cliName: 'musket',\n hideMusketInfo: true,\n baseCommands: [BuildCommand, MakeCommand, PostinstallCommand],\n discoveryPaths: [app_path('Console/Commands/*.js').replace('/src/', DIST_DIR)],\n }\n );\n\n ['SIGINT', 'SIGTERM', 'SIGTSTP'].forEach(sig => process.on(sig, () => {\n process.exit(0)\n }))\n }\n}\n"],"x_google_ignoreList":[4],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AC5Cf,IAAa,yBAAb,cAA4CG,+BAAgB;CACxD,OAAc,WAAW;;;;CAKzB,OAAc,gBAAgB;CAC9B,AAAO,gBAAgB;CAEvB,WAAY;EACR,MAAM,WAAW,IAAI,IAAI,YAAY,iBAAiB,CAAC,GAAG,WAAW,MAAM,GAAG;AAE9E,0BAAO,KACH,KAAK,KACL;GACI,MAAM;GACN,UAAU,IAAIC,iCAAkB,KAAK,IAAI,CAAC;GAC1C;GACA,UAAU,CACN;IAAE,MAAM;IAAiB,OAAO;IAAqB,EACrD;IAAE,MAAM;IAAmB,OAAO;IAAc,CACnD;GACD,SAAS;GACT,gBAAgB;GAChB,cAAc;IAAC;IAAc;IAAa;IAAmB;GAC7D,gBAAgB,CAAC,SAAS,wBAAwB,CAAC,QAAQ,SAAS,SAAS,CAAC;GACjF,CACJ;AAED;GAAC;GAAU;GAAW;GAAU,CAAC,SAAQ,QAAO,QAAQ,GAAG,WAAW;AAClE,WAAQ,KAAK,EAAE;IACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Command","outDir","TaskManager","Command","config","FileSystem","env","Command","FileSystem","nodepath","path","Str","Logger","Command","FileSystem","dir","entryFileName","env","TsDownConfig: Options","path","ServiceProvider","ContainerResolver"],"sources":["../src/Commands/BuildCommand.ts","../src/Commands/KeyGenerateCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/PostinstallCommand.ts","../src/logo.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0_rollup@4.52.5/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { Logger, TaskManager } from '@h3ravel/shared'\n\nimport { Command } from '@h3ravel/musket'\nimport { execa } from 'execa'\nimport preferredPM from 'preferred-pm'\n\nexport class BuildCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `build\n {--m|minify : Minify your bundle output}\n {--d|dev : Build for dev but don't watch for changes}\n `\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Build the app for production'\n\n public async handle () {\n try {\n await this.fire()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n protected async fire () {\n const outDir = this.option('dev') ? '.h3ravel/serve' : env('DIST_DIR', 'dist')\n const minify = this.option('minify')\n const verbosity = this.getVerbosity()\n const debug = verbosity > 0\n\n this.newLine()\n await BuildCommand.build({ outDir, minify, verbosity, debug, mute: false })\n this.newLine()\n }\n\n /**\n * build\n */\n public static async build ({ debug, minify, mute, verbosity, outDir } = {\n mute: false,\n debug: false,\n minify: false,\n verbosity: 0,\n outDir: 'dist'\n }) {\n\n const pm = (await preferredPM(base_path()))?.name ?? 'pnpm'\n\n const LOG_LEVELS = [\n 'silent',\n 'info',\n 'warn',\n 'error',\n ]\n\n const ENV_VARS = {\n EXTENDED_DEBUG: debug ? 'true' : 'false',\n CLI_BUILD: 'true',\n NODE_ENV: 'production',\n DIST_DIR: outDir,\n DIST_MINIFY: minify,\n LOG_LEVEL: LOG_LEVELS[verbosity]\n }\n\n const silent = ENV_VARS.LOG_LEVEL === 'silent' ? '--silent' : null\n\n if (mute) {\n return await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n\n const type = outDir === 'dist' ? 'Production' : 'Development'\n\n return await TaskManager.advancedTaskRunner(\n [[`Creating ${type} Bundle`, 'STARTED'], [`${type} Bundle Created`, 'COMPLETED']],\n async () => {\n await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n )\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { copyFile, readFile, writeFile } from 'fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport crypto from 'crypto'\nimport dotenv from 'dotenv'\n\nexport class KeyGenerateCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `key:generate\n {--force: Force the operation to run when in production}\n {--show: Display the key instead of modifying files}\n `\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Set the application key'\n\n public async handle () {\n const config = {\n key: crypto.randomBytes(32).toString('base64'),\n envPath: base_path('.env'),\n egEnvPath: base_path('.env.example'),\n updated: false,\n show: this.option('show')\n }\n\n this.newLine()\n\n // Try to create the .env file if it does not exist\n if (!await FileSystem.fileExists(config.envPath)) {\n if (await FileSystem.fileExists(config.egEnvPath)) {\n await copyFile(config.egEnvPath, config.envPath)\n } else {\n this.error('.env file not found.')\n this.newLine()\n process.exit(0)\n }\n }\n\n // Read and parse the .env file\n let content = await readFile(config.envPath, 'utf8')\n const buf = Buffer.from(content)\n const env = dotenv.parse(buf)\n\n // Show the Application key\n if (config.show) {\n // If the Application key is not exit with an erorr message\n if (!env.APP_KEY || env.APP_KEY === '') {\n this.error('Application key not set.')\n this.newLine()\n process.exit(0)\n }\n\n // Actually show the Application key\n const [enc, key] = env.APP_KEY.split(':')\n Logger.log([[enc, 'yellow'], [key, 'white']], ':')\n this.newLine()\n process.exit(0)\n } else if (env.APP_ENV === 'production' && !this.option('force')) {\n // If the Application is currently in production and the force flag is not set, exit with an error\n this.error('Application is currently in production, failed to set key.')\n this.newLine()\n process.exit(1)\n }\n\n // Check if APP_KEY exists\n if (/^APP_KEY=.*$/m.test(content)) {\n config.updated = true\n content = content.replace(/^APP_KEY=.*$/m, `APP_KEY=base64:${config.key}`)\n } else {\n // Add APP_KEY to the top, preserving existing content\n config.updated = false\n content = `APP_KEY=base64:${config.key}\\n\\n${content}`\n }\n\n // Write the application key to the .env file\n await writeFile(config.envPath, content, 'utf8')\n\n // Show the success message\n this.success('Application key set successfully.')\n this.newLine()\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport { Str } from '@h3ravel/support'\nimport nodepath from 'node:path'\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Create a new controller class. \n | {--a|api : Exclude the create and edit methods from the controller} \n | {--m|model= : Generate a resource controller for the given model} \n | {--r|resource : Generate a resource controller class} \n | {--force : Create the controller even if it already exists}\n }\n {resource : Create a new resource. \n | {--c|collection : Create a resource collection}\n | {--force : Create the resource even if it already exists}\n }\n {command : Create a new Musket command. \n | {--command : The terminal command that will be used to invoke the class} \n | {--force : Create the class even if the console command already exists}\n }\n {view : Create a new view.\n | {--force : Create the view even if it already exists}\n }\n {^name : The name of the [name] to generate}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes'\n\n public async handle (this: any) {\n const command = (this.dictionary.baseCommand ?? this.dictionary.name) as never\n\n if (!this.argument('name')) {\n this.program.error('Please provide a valid name for the ' + command)\n }\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n view: 'makeView',\n command: 'makeCommand',\n } as const\n\n await this[methods[command]]()\n }\n\n /**\n * Create a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : ''\n const name = this.argument('name')\n const force = this.option('force')\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n const path = app_path(`Http/Controllers/${name}.ts`)\n\n /** The Controller is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the controller already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Controller Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n protected makeResource () {\n Logger.success('Resource support is not yet available')\n }\n\n /**\n * Create a new Musket command\n */\n protected makeCommand () {\n Logger.success('Musket command creation is not yet available')\n }\n\n /**\n * Create a new view.\n */\n protected async makeView () {\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = base_path(`src/resources/views/${name}.edge`)\n\n /** The view is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the view already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`)\n Logger.split('INFO: View Created', Logger.log(`src/resources/views/${name}.edge`, 'gray', false))\n }\n}\n","import { mkdir, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport { FileSystem } from '@h3ravel/shared'\nimport { KeyGenerateCommand } from './KeyGenerateCommand'\n\nexport class PostinstallCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'postinstall'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Default post installation command'\n\n public async handle () {\n this.genEncryptionKey()\n this.createSqliteDB()\n }\n\n /**\n * Create sqlite database if none exist\n * \n * @returns \n */\n private async genEncryptionKey () {\n new KeyGenerateCommand(this.app, this.kernel)\n .setProgram(this.program)\n .setOption('force', true)\n .setOption('silent', true)\n .setOption('quiet', true)\n .setInput({ force: true, silent: true, quiet: true }, [], [], {}, this.program)\n .handle()\n }\n\n /**\n * Create sqlite database if none exist\n * \n * @returns \n */\n private async createSqliteDB () {\n if (config('database.default') !== 'sqlite') return\n\n if (!await FileSystem.fileExists(database_path())) {\n await mkdir(database_path(), { recursive: true })\n }\n\n if (!await FileSystem.fileExists(database_path('db.sqlite'))) {\n await writeFile(database_path('db.sqlite'), '')\n }\n }\n}\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","import { fork } from 'child_process';\nimport { resolve, dirname, join } from 'path';\n\nfunction run(opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart(options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle(_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle(outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown'\nimport { existsSync } from 'node:fs'\nimport path from 'node:path'\nimport { rm } from 'node:fs/promises'\nimport run from '@rollup/plugin-run'\n\nconst env = process.env.NODE_ENV || 'development'\nlet outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\nif (process.env.DIST_DIR) {\n outDir = process.env.DIST_DIR\n}\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n minify: !!process.env.DIST_MINIFY,\n external: [\n /^@h3ravel\\/.*/gi,\n ],\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n DIST_DIR: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n hooks (e) {\n e.hook('build:done', async () => {\n const paths = ['database/migrations', 'database/factories', 'database/seeders']\n for (let i = 0; i < paths.length; i++) {\n const name = paths[i]\n if (existsSync(path.join(outDir, name)))\n await rm(path.join(outDir, name), { recursive: true })\n }\n })\n },\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n DIST_DIR: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n}\n\nexport default TsDownConfig\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { ContainerResolver, ServiceProvider } from '@h3ravel/core'\n\nimport { BuildCommand } from '../Commands/BuildCommand'\nimport { Kernel } from '@h3ravel/musket'\nimport { KeyGenerateCommand } from '../Commands/KeyGenerateCommand'\nimport { MakeCommand } from '../Commands/MakeCommand'\nimport { PostinstallCommand } from '../Commands/PostinstallCommand'\nimport { altLogo } from '../logo'\nimport tsDownConfig from '../TsdownConfig'\n\n/**\n * Handles CLI commands and tooling.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static runsInConsole = true\n public runsInConsole = true\n\n register () {\n const DIST_DIR = `/${env('DIST_DIR', '.h3ravel/serve')}/`.replaceAll('//', '')\n const baseCommands = [BuildCommand, MakeCommand, PostinstallCommand, KeyGenerateCommand]\n\n Kernel.init(\n this.app,\n {\n logo: altLogo,\n resolver: new ContainerResolver(this.app).resolveMethodParams,\n tsDownConfig,\n baseCommands,\n packages: [\n { name: '@h3ravel/core', alias: 'H3ravel Framework' },\n { name: '@h3ravel/musket', alias: 'Musket CLI' }\n ],\n cliName: 'musket',\n hideMusketInfo: true,\n discoveryPaths: [app_path('Console/Commands/*.js').replace('/src/', DIST_DIR)],\n }\n );\n\n ['SIGINT', 'SIGTERM', 'SIGTSTP'].forEach(sig => process.on(sig, () => {\n process.exit(0)\n }))\n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ildCommand extends Command {
|
|
|
50
50
|
}>>;
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
|
+
//#region src/Commands/KeyGenerateCommand.d.ts
|
|
54
|
+
declare class KeyGenerateCommand extends Command {
|
|
55
|
+
/**
|
|
56
|
+
* The name and signature of the console command.
|
|
57
|
+
*
|
|
58
|
+
* @var string
|
|
59
|
+
*/
|
|
60
|
+
protected signature: string;
|
|
61
|
+
/**
|
|
62
|
+
* The console command description.
|
|
63
|
+
*
|
|
64
|
+
* @var string
|
|
65
|
+
*/
|
|
66
|
+
protected description: string;
|
|
67
|
+
handle(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
53
70
|
//#region src/Commands/MakeCommand.d.ts
|
|
54
71
|
declare class MakeCommand extends Command {
|
|
55
72
|
/**
|
|
@@ -95,6 +112,12 @@ declare class PostinstallCommand extends Command {
|
|
|
95
112
|
*/
|
|
96
113
|
protected description: string;
|
|
97
114
|
handle(): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Create sqlite database if none exist
|
|
117
|
+
*
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
private genEncryptionKey;
|
|
98
121
|
/**
|
|
99
122
|
* Create sqlite database if none exist
|
|
100
123
|
*
|
|
@@ -122,5 +145,5 @@ declare class ConsoleServiceProvider extends ServiceProvider {
|
|
|
122
145
|
//#region src/TsdownConfig.d.ts
|
|
123
146
|
declare const TsDownConfig: Options;
|
|
124
147
|
//#endregion
|
|
125
|
-
export { BuildCommand, ConsoleServiceProvider, MakeCommand, PostinstallCommand, TsDownConfig };
|
|
148
|
+
export { BuildCommand, ConsoleServiceProvider, KeyGenerateCommand, MakeCommand, PostinstallCommand, TsDownConfig };
|
|
126
149
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,23 @@ declare class BuildCommand extends Command {
|
|
|
50
50
|
}>>;
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
|
+
//#region src/Commands/KeyGenerateCommand.d.ts
|
|
54
|
+
declare class KeyGenerateCommand extends Command {
|
|
55
|
+
/**
|
|
56
|
+
* The name and signature of the console command.
|
|
57
|
+
*
|
|
58
|
+
* @var string
|
|
59
|
+
*/
|
|
60
|
+
protected signature: string;
|
|
61
|
+
/**
|
|
62
|
+
* The console command description.
|
|
63
|
+
*
|
|
64
|
+
* @var string
|
|
65
|
+
*/
|
|
66
|
+
protected description: string;
|
|
67
|
+
handle(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
53
70
|
//#region src/Commands/MakeCommand.d.ts
|
|
54
71
|
declare class MakeCommand extends Command {
|
|
55
72
|
/**
|
|
@@ -95,6 +112,12 @@ declare class PostinstallCommand extends Command {
|
|
|
95
112
|
*/
|
|
96
113
|
protected description: string;
|
|
97
114
|
handle(): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Create sqlite database if none exist
|
|
117
|
+
*
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
private genEncryptionKey;
|
|
98
121
|
/**
|
|
99
122
|
* Create sqlite database if none exist
|
|
100
123
|
*
|
|
@@ -122,5 +145,5 @@ declare class ConsoleServiceProvider extends ServiceProvider {
|
|
|
122
145
|
//#region src/TsdownConfig.d.ts
|
|
123
146
|
declare const TsDownConfig: Options;
|
|
124
147
|
//#endregion
|
|
125
|
-
export { BuildCommand, ConsoleServiceProvider, MakeCommand, PostinstallCommand, TsDownConfig };
|
|
148
|
+
export { BuildCommand, ConsoleServiceProvider, KeyGenerateCommand, MakeCommand, PostinstallCommand, TsDownConfig };
|
|
126
149
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,10 @@ import { FileSystem, Logger, TaskManager } from "@h3ravel/shared";
|
|
|
2
2
|
import { Command, Kernel } from "@h3ravel/musket";
|
|
3
3
|
import { execa } from "execa";
|
|
4
4
|
import preferredPM from "preferred-pm";
|
|
5
|
-
import {
|
|
5
|
+
import { copyFile, readFile, writeFile } from "fs/promises";
|
|
6
|
+
import crypto from "crypto";
|
|
7
|
+
import dotenv from "dotenv";
|
|
8
|
+
import { mkdir, readFile as readFile$1, rm, writeFile as writeFile$1 } from "node:fs/promises";
|
|
6
9
|
import { Str } from "@h3ravel/support";
|
|
7
10
|
import nodepath from "node:path";
|
|
8
11
|
import { ContainerResolver, ServiceProvider } from "@h3ravel/core";
|
|
@@ -106,6 +109,70 @@ var BuildCommand = class BuildCommand extends Command {
|
|
|
106
109
|
}
|
|
107
110
|
};
|
|
108
111
|
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/Commands/KeyGenerateCommand.ts
|
|
114
|
+
var KeyGenerateCommand = class extends Command {
|
|
115
|
+
/**
|
|
116
|
+
* The name and signature of the console command.
|
|
117
|
+
*
|
|
118
|
+
* @var string
|
|
119
|
+
*/
|
|
120
|
+
signature = `key:generate
|
|
121
|
+
{--force: Force the operation to run when in production}
|
|
122
|
+
{--show: Display the key instead of modifying files}
|
|
123
|
+
`;
|
|
124
|
+
/**
|
|
125
|
+
* The console command description.
|
|
126
|
+
*
|
|
127
|
+
* @var string
|
|
128
|
+
*/
|
|
129
|
+
description = "Set the application key";
|
|
130
|
+
async handle() {
|
|
131
|
+
const config$1 = {
|
|
132
|
+
key: crypto.randomBytes(32).toString("base64"),
|
|
133
|
+
envPath: base_path(".env"),
|
|
134
|
+
egEnvPath: base_path(".env.example"),
|
|
135
|
+
updated: false,
|
|
136
|
+
show: this.option("show")
|
|
137
|
+
};
|
|
138
|
+
this.newLine();
|
|
139
|
+
if (!await FileSystem.fileExists(config$1.envPath)) if (await FileSystem.fileExists(config$1.egEnvPath)) await copyFile(config$1.egEnvPath, config$1.envPath);
|
|
140
|
+
else {
|
|
141
|
+
this.error(".env file not found.");
|
|
142
|
+
this.newLine();
|
|
143
|
+
process.exit(0);
|
|
144
|
+
}
|
|
145
|
+
let content = await readFile(config$1.envPath, "utf8");
|
|
146
|
+
const buf = Buffer.from(content);
|
|
147
|
+
const env$2 = dotenv.parse(buf);
|
|
148
|
+
if (config$1.show) {
|
|
149
|
+
if (!env$2.APP_KEY || env$2.APP_KEY === "") {
|
|
150
|
+
this.error("Application key not set.");
|
|
151
|
+
this.newLine();
|
|
152
|
+
process.exit(0);
|
|
153
|
+
}
|
|
154
|
+
const [enc, key] = env$2.APP_KEY.split(":");
|
|
155
|
+
Logger.log([[enc, "yellow"], [key, "white"]], ":");
|
|
156
|
+
this.newLine();
|
|
157
|
+
process.exit(0);
|
|
158
|
+
} else if (env$2.APP_ENV === "production" && !this.option("force")) {
|
|
159
|
+
this.error("Application is currently in production, failed to set key.");
|
|
160
|
+
this.newLine();
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
if (/^APP_KEY=.*$/m.test(content)) {
|
|
164
|
+
config$1.updated = true;
|
|
165
|
+
content = content.replace(/^APP_KEY=.*$/m, `APP_KEY=base64:${config$1.key}`);
|
|
166
|
+
} else {
|
|
167
|
+
config$1.updated = false;
|
|
168
|
+
content = `APP_KEY=base64:${config$1.key}\n\n${content}`;
|
|
169
|
+
}
|
|
170
|
+
await writeFile(config$1.envPath, content, "utf8");
|
|
171
|
+
this.success("Application key set successfully.");
|
|
172
|
+
this.newLine();
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
109
176
|
//#endregion
|
|
110
177
|
//#region src/Commands/MakeCommand.ts
|
|
111
178
|
var MakeCommand = class extends Command {
|
|
@@ -164,9 +231,9 @@ var MakeCommand = class extends Command {
|
|
|
164
231
|
if (name.includes("/")) await mkdir(Str.beforeLast(path, "/"), { recursive: true });
|
|
165
232
|
/** Check if the controller already exists */
|
|
166
233
|
if (!force && await FileSystem.fileExists(path)) Logger.error(`ERORR: ${name} controller already exists`);
|
|
167
|
-
let stub = await readFile(stubPath, "utf-8");
|
|
234
|
+
let stub = await readFile$1(stubPath, "utf-8");
|
|
168
235
|
stub = stub.replace(/{{ name }}/g, name);
|
|
169
|
-
await writeFile(path, stub);
|
|
236
|
+
await writeFile$1(path, stub);
|
|
170
237
|
Logger.split("INFO: Controller Created", Logger.log(nodepath.basename(path), "gray", false));
|
|
171
238
|
}
|
|
172
239
|
makeResource() {
|
|
@@ -189,7 +256,7 @@ var MakeCommand = class extends Command {
|
|
|
189
256
|
if (name.includes("/")) await mkdir(Str.beforeLast(path, "/"), { recursive: true });
|
|
190
257
|
/** Check if the view already exists */
|
|
191
258
|
if (!force && await FileSystem.fileExists(path)) Logger.error(`ERORR: ${name} view already exists`);
|
|
192
|
-
await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`);
|
|
259
|
+
await writeFile$1(path, `{{-- src/resources/views/${name}.edge --}}`);
|
|
193
260
|
Logger.split("INFO: View Created", Logger.log(`src/resources/views/${name}.edge`, "gray", false));
|
|
194
261
|
}
|
|
195
262
|
};
|
|
@@ -210,6 +277,7 @@ var PostinstallCommand = class extends Command {
|
|
|
210
277
|
*/
|
|
211
278
|
description = "Default post installation command";
|
|
212
279
|
async handle() {
|
|
280
|
+
this.genEncryptionKey();
|
|
213
281
|
this.createSqliteDB();
|
|
214
282
|
}
|
|
215
283
|
/**
|
|
@@ -217,10 +285,22 @@ var PostinstallCommand = class extends Command {
|
|
|
217
285
|
*
|
|
218
286
|
* @returns
|
|
219
287
|
*/
|
|
288
|
+
async genEncryptionKey() {
|
|
289
|
+
new KeyGenerateCommand(this.app, this.kernel).setProgram(this.program).setOption("force", true).setOption("silent", true).setOption("quiet", true).setInput({
|
|
290
|
+
force: true,
|
|
291
|
+
silent: true,
|
|
292
|
+
quiet: true
|
|
293
|
+
}, [], [], {}, this.program).handle();
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Create sqlite database if none exist
|
|
297
|
+
*
|
|
298
|
+
* @returns
|
|
299
|
+
*/
|
|
220
300
|
async createSqliteDB() {
|
|
221
301
|
if (config("database.default") !== "sqlite") return;
|
|
222
302
|
if (!await FileSystem.fileExists(database_path())) await mkdir(database_path(), { recursive: true });
|
|
223
|
-
if (!await FileSystem.fileExists(database_path("db.sqlite"))) await writeFile(database_path("db.sqlite"), "");
|
|
303
|
+
if (!await FileSystem.fileExists(database_path("db.sqlite"))) await writeFile$1(database_path("db.sqlite"), "");
|
|
224
304
|
}
|
|
225
305
|
};
|
|
226
306
|
|
|
@@ -385,10 +465,17 @@ var ConsoleServiceProvider = class extends ServiceProvider {
|
|
|
385
465
|
runsInConsole = true;
|
|
386
466
|
register() {
|
|
387
467
|
const DIST_DIR = `/${env("DIST_DIR", ".h3ravel/serve")}/`.replaceAll("//", "");
|
|
468
|
+
const baseCommands = [
|
|
469
|
+
BuildCommand,
|
|
470
|
+
MakeCommand,
|
|
471
|
+
PostinstallCommand,
|
|
472
|
+
KeyGenerateCommand
|
|
473
|
+
];
|
|
388
474
|
Kernel.init(this.app, {
|
|
389
475
|
logo: altLogo,
|
|
390
476
|
resolver: new ContainerResolver(this.app).resolveMethodParams,
|
|
391
477
|
tsDownConfig: TsdownConfig_default,
|
|
478
|
+
baseCommands,
|
|
392
479
|
packages: [{
|
|
393
480
|
name: "@h3ravel/core",
|
|
394
481
|
alias: "H3ravel Framework"
|
|
@@ -398,11 +485,6 @@ var ConsoleServiceProvider = class extends ServiceProvider {
|
|
|
398
485
|
}],
|
|
399
486
|
cliName: "musket",
|
|
400
487
|
hideMusketInfo: true,
|
|
401
|
-
baseCommands: [
|
|
402
|
-
BuildCommand,
|
|
403
|
-
MakeCommand,
|
|
404
|
-
PostinstallCommand
|
|
405
|
-
],
|
|
406
488
|
discoveryPaths: [app_path("Console/Commands/*.js").replace("/src/", DIST_DIR)]
|
|
407
489
|
});
|
|
408
490
|
[
|
|
@@ -416,5 +498,5 @@ var ConsoleServiceProvider = class extends ServiceProvider {
|
|
|
416
498
|
};
|
|
417
499
|
|
|
418
500
|
//#endregion
|
|
419
|
-
export { BuildCommand, ConsoleServiceProvider, MakeCommand, PostinstallCommand, TsDownConfig };
|
|
501
|
+
export { BuildCommand, ConsoleServiceProvider, KeyGenerateCommand, MakeCommand, PostinstallCommand, TsDownConfig };
|
|
420
502
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["outDir","dir","entryFileName","env","TsDownConfig: Options","path"],"sources":["../src/Commands/BuildCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/PostinstallCommand.ts","../src/logo.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0_rollup@4.52.5/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { Logger, TaskManager } from '@h3ravel/shared'\n\nimport { Command } from '@h3ravel/musket'\nimport { execa } from 'execa'\nimport preferredPM from 'preferred-pm'\n\nexport class BuildCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `build\n {--m|minify : Minify your bundle output}\n {--d|dev : Build for dev but don't watch for changes}\n `\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Build the app for production'\n\n public async handle () {\n try {\n await this.fire()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n protected async fire () {\n const outDir = this.option('dev') ? '.h3ravel/serve' : env('DIST_DIR', 'dist')\n const minify = this.option('minify')\n const verbosity = this.getVerbosity()\n const debug = verbosity > 0\n\n this.newLine()\n await BuildCommand.build({ outDir, minify, verbosity, debug, mute: false })\n this.newLine()\n }\n\n /**\n * build\n */\n public static async build ({ debug, minify, mute, verbosity, outDir } = {\n mute: false,\n debug: false,\n minify: false,\n verbosity: 0,\n outDir: 'dist'\n }) {\n\n const pm = (await preferredPM(base_path()))?.name ?? 'pnpm'\n\n const LOG_LEVELS = [\n 'silent',\n 'info',\n 'warn',\n 'error',\n ]\n\n const ENV_VARS = {\n EXTENDED_DEBUG: debug ? 'true' : 'false',\n CLI_BUILD: 'true',\n NODE_ENV: 'production',\n DIST_DIR: outDir,\n DIST_MINIFY: minify,\n LOG_LEVEL: LOG_LEVELS[verbosity]\n }\n\n const silent = ENV_VARS.LOG_LEVEL === 'silent' ? '--silent' : null\n\n if (mute) {\n return await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n\n const type = outDir === 'dist' ? 'Production' : 'Development'\n\n return await TaskManager.advancedTaskRunner(\n [[`Creating ${type} Bundle`, 'STARTED'], [`${type} Bundle Created`, 'COMPLETED']],\n async () => {\n await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n )\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport { Str } from '@h3ravel/support'\nimport nodepath from 'node:path'\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Create a new controller class. \n | {--a|api : Exclude the create and edit methods from the controller} \n | {--m|model= : Generate a resource controller for the given model} \n | {--r|resource : Generate a resource controller class} \n | {--force : Create the controller even if it already exists}\n }\n {resource : Create a new resource. \n | {--c|collection : Create a resource collection}\n | {--force : Create the resource even if it already exists}\n }\n {command : Create a new Musket command. \n | {--command : The terminal command that will be used to invoke the class} \n | {--force : Create the class even if the console command already exists}\n }\n {view : Create a new view.\n | {--force : Create the view even if it already exists}\n }\n {^name : The name of the [name] to generate}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes'\n\n public async handle (this: any) {\n const command = (this.dictionary.baseCommand ?? this.dictionary.name) as never\n\n if (!this.argument('name')) {\n this.program.error('Please provide a valid name for the ' + command)\n }\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n view: 'makeView',\n command: 'makeCommand',\n } as const\n\n await this[methods[command]]()\n }\n\n /**\n * Create a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : ''\n const name = this.argument('name')\n const force = this.option('force')\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n const path = app_path(`Http/Controllers/${name}.ts`)\n\n /** The Controller is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the controller already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Controller Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n protected makeResource () {\n Logger.success('Resource support is not yet available')\n }\n\n /**\n * Create a new Musket command\n */\n protected makeCommand () {\n Logger.success('Musket command creation is not yet available')\n }\n\n /**\n * Create a new view.\n */\n protected async makeView () {\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = base_path(`src/resources/views/${name}.edge`)\n\n /** The view is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the view already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`)\n Logger.split('INFO: View Created', Logger.log(`src/resources/views/${name}.edge`, 'gray', false))\n }\n}\n","import { mkdir, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport { FileSystem } from '@h3ravel/shared'\n\nexport class PostinstallCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'postinstall'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Default post installation command'\n\n public async handle () {\n this.createSqliteDB()\n }\n\n /**\n * Create sqlite database if none exist\n * \n * @returns \n */\n private async createSqliteDB () {\n if (config('database.default') !== 'sqlite') return\n\n if (!await FileSystem.fileExists(database_path())) {\n await mkdir(database_path(), { recursive: true })\n }\n\n if (!await FileSystem.fileExists(database_path('db.sqlite'))) {\n await writeFile(database_path('db.sqlite'), '')\n }\n }\n}\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","import { fork } from 'child_process';\nimport { resolve, dirname, join } from 'path';\n\nfunction run(opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart(options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle(_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle(outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown'\nimport { existsSync } from 'node:fs'\nimport path from 'node:path'\nimport { rm } from 'node:fs/promises'\nimport run from '@rollup/plugin-run'\n\nconst env = process.env.NODE_ENV || 'development'\nlet outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\nif (process.env.DIST_DIR) {\n outDir = process.env.DIST_DIR\n}\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n minify: !!process.env.DIST_MINIFY,\n external: [\n /^@h3ravel\\/.*/gi,\n ],\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n DIST_DIR: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n hooks (e) {\n e.hook('build:done', async () => {\n const paths = ['database/migrations', 'database/factories', 'database/seeders']\n for (let i = 0; i < paths.length; i++) {\n const name = paths[i]\n if (existsSync(path.join(outDir, name)))\n await rm(path.join(outDir, name), { recursive: true })\n }\n })\n },\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n DIST_DIR: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n}\n\nexport default TsDownConfig\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { ContainerResolver, ServiceProvider } from '@h3ravel/core'\n\nimport { BuildCommand } from '../Commands/BuildCommand'\nimport { Kernel } from '@h3ravel/musket'\nimport { MakeCommand } from '../Commands/MakeCommand'\nimport { PostinstallCommand } from '../Commands/PostinstallCommand'\nimport { altLogo } from '../logo'\nimport tsDownConfig from '../TsdownConfig'\n\n/**\n * Handles CLI commands and tooling.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static runsInConsole = true\n public runsInConsole = true\n\n register () {\n const DIST_DIR = `/${env('DIST_DIR', '.h3ravel/serve')}/`.replaceAll('//', '')\n\n Kernel.init(\n this.app,\n {\n logo: altLogo,\n resolver: new ContainerResolver(this.app).resolveMethodParams,\n tsDownConfig,\n packages: [\n { name: '@h3ravel/core', alias: 'H3ravel Framework' },\n { name: '@h3ravel/musket', alias: 'Musket CLI' }\n ],\n cliName: 'musket',\n hideMusketInfo: true,\n baseCommands: [BuildCommand, MakeCommand, PostinstallCommand],\n discoveryPaths: [app_path('Console/Commands/*.js').replace('/src/', DIST_DIR)],\n }\n );\n\n ['SIGINT', 'SIGTERM', 'SIGTSTP'].forEach(sig => process.on(sig, () => {\n process.exit(0)\n }))\n }\n}\n"],"x_google_ignoreList":[4],"mappings":";;;;;;;;;;;;;AAMA,IAAa,eAAb,MAAa,qBAAqB,QAAQ;;;;;;CAOtC,AAAU,YAAoB;;;;;;;;;CAU9B,AAAU,cAAsB;CAEhC,MAAa,SAAU;AACnB,MAAI;AACA,SAAM,KAAK,MAAM;WACZ,GAAG;AACR,UAAO,MAAM,EAAS;;;CAI9B,MAAgB,OAAQ;EACpB,MAAMA,WAAS,KAAK,OAAO,MAAM,GAAG,mBAAmB,IAAI,YAAY,OAAO;EAC9E,MAAM,SAAS,KAAK,OAAO,SAAS;EACpC,MAAM,YAAY,KAAK,cAAc;EACrC,MAAM,QAAQ,YAAY;AAE1B,OAAK,SAAS;AACd,QAAM,aAAa,MAAM;GAAE;GAAQ;GAAQ;GAAW;GAAO,MAAM;GAAO,CAAC;AAC3E,OAAK,SAAS;;;;;CAMlB,aAAoB,MAAO,EAAE,OAAO,QAAQ,MAAM,WAAW,qBAAW;EACpE,MAAM;EACN,OAAO;EACP,QAAQ;EACR,WAAW;EACX,QAAQ;EACX,EAAE;EAEC,MAAM,MAAM,MAAM,YAAY,WAAW,CAAC,GAAG,QAAQ;EASrD,MAAM,WAAW;GACb,gBAAgB,QAAQ,SAAS;GACjC,WAAW;GACX,UAAU;GACV,UAAUA;GACV,aAAa;GACb,WAbe;IACf;IACA;IACA;IACA;IACH,CAQyB;GACzB;EAED,MAAM,SAAS,SAAS,cAAc,WAAW,aAAa;AAE9D,MAAI,KACA,QAAO,MAAM,MACT,IACA;GAAC;GAAU;GAAQ;GAAmB;GAAY;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AAK,EAAE,EAAE,WAAW,MAAM,CAAC;;IAEhE;;CAEN,SAASF,UAAQ,iBAAiB,QAAQ,IAAI,cAAc,SAAS,CACjE,IAAI;EACA,KAAK,OAAO,OAAO,EAAE,EAAE,QAAQ,KAAK;GAChC,UAAUA;GACV,UAAU;GACb,CAAC;EACF,UAAU,CAAC,MAAM,8BAA8B;EAC/C,eAAe;EACf,OAAO,QAAQ,KAAK,GAAG;EAC1B,CAAC,CACL,GAAG,EAAE;CACT;AAED,2BAAe;;;;;;;;;AC5Cf,IAAa,yBAAb,cAA4C,gBAAgB;CACxD,OAAc,WAAW;;;;CAKzB,OAAc,gBAAgB;CAC9B,AAAO,gBAAgB;CAEvB,WAAY;EACR,MAAM,WAAW,IAAI,IAAI,YAAY,iBAAiB,CAAC,GAAG,WAAW,MAAM,GAAG;AAE9E,SAAO,KACH,KAAK,KACL;GACI,MAAM;GACN,UAAU,IAAI,kBAAkB,KAAK,IAAI,CAAC;GAC1C;GACA,UAAU,CACN;IAAE,MAAM;IAAiB,OAAO;IAAqB,EACrD;IAAE,MAAM;IAAmB,OAAO;IAAc,CACnD;GACD,SAAS;GACT,gBAAgB;GAChB,cAAc;IAAC;IAAc;IAAa;IAAmB;GAC7D,gBAAgB,CAAC,SAAS,wBAAwB,CAAC,QAAQ,SAAS,SAAS,CAAC;GACjF,CACJ;AAED;GAAC;GAAU;GAAW;GAAU,CAAC,SAAQ,QAAO,QAAQ,GAAG,WAAW;AAClE,WAAQ,KAAK,EAAE;IACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["outDir","config","env","readFile","writeFile","writeFile","dir","entryFileName","env","TsDownConfig: Options","path"],"sources":["../src/Commands/BuildCommand.ts","../src/Commands/KeyGenerateCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/PostinstallCommand.ts","../src/logo.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0_rollup@4.52.5/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { Logger, TaskManager } from '@h3ravel/shared'\n\nimport { Command } from '@h3ravel/musket'\nimport { execa } from 'execa'\nimport preferredPM from 'preferred-pm'\n\nexport class BuildCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `build\n {--m|minify : Minify your bundle output}\n {--d|dev : Build for dev but don't watch for changes}\n `\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Build the app for production'\n\n public async handle () {\n try {\n await this.fire()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n protected async fire () {\n const outDir = this.option('dev') ? '.h3ravel/serve' : env('DIST_DIR', 'dist')\n const minify = this.option('minify')\n const verbosity = this.getVerbosity()\n const debug = verbosity > 0\n\n this.newLine()\n await BuildCommand.build({ outDir, minify, verbosity, debug, mute: false })\n this.newLine()\n }\n\n /**\n * build\n */\n public static async build ({ debug, minify, mute, verbosity, outDir } = {\n mute: false,\n debug: false,\n minify: false,\n verbosity: 0,\n outDir: 'dist'\n }) {\n\n const pm = (await preferredPM(base_path()))?.name ?? 'pnpm'\n\n const LOG_LEVELS = [\n 'silent',\n 'info',\n 'warn',\n 'error',\n ]\n\n const ENV_VARS = {\n EXTENDED_DEBUG: debug ? 'true' : 'false',\n CLI_BUILD: 'true',\n NODE_ENV: 'production',\n DIST_DIR: outDir,\n DIST_MINIFY: minify,\n LOG_LEVEL: LOG_LEVELS[verbosity]\n }\n\n const silent = ENV_VARS.LOG_LEVEL === 'silent' ? '--silent' : null\n\n if (mute) {\n return await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n\n const type = outDir === 'dist' ? 'Production' : 'Development'\n\n return await TaskManager.advancedTaskRunner(\n [[`Creating ${type} Bundle`, 'STARTED'], [`${type} Bundle Created`, 'COMPLETED']],\n async () => {\n await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n )\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { copyFile, readFile, writeFile } from 'fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport crypto from 'crypto'\nimport dotenv from 'dotenv'\n\nexport class KeyGenerateCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `key:generate\n {--force: Force the operation to run when in production}\n {--show: Display the key instead of modifying files}\n `\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Set the application key'\n\n public async handle () {\n const config = {\n key: crypto.randomBytes(32).toString('base64'),\n envPath: base_path('.env'),\n egEnvPath: base_path('.env.example'),\n updated: false,\n show: this.option('show')\n }\n\n this.newLine()\n\n // Try to create the .env file if it does not exist\n if (!await FileSystem.fileExists(config.envPath)) {\n if (await FileSystem.fileExists(config.egEnvPath)) {\n await copyFile(config.egEnvPath, config.envPath)\n } else {\n this.error('.env file not found.')\n this.newLine()\n process.exit(0)\n }\n }\n\n // Read and parse the .env file\n let content = await readFile(config.envPath, 'utf8')\n const buf = Buffer.from(content)\n const env = dotenv.parse(buf)\n\n // Show the Application key\n if (config.show) {\n // If the Application key is not exit with an erorr message\n if (!env.APP_KEY || env.APP_KEY === '') {\n this.error('Application key not set.')\n this.newLine()\n process.exit(0)\n }\n\n // Actually show the Application key\n const [enc, key] = env.APP_KEY.split(':')\n Logger.log([[enc, 'yellow'], [key, 'white']], ':')\n this.newLine()\n process.exit(0)\n } else if (env.APP_ENV === 'production' && !this.option('force')) {\n // If the Application is currently in production and the force flag is not set, exit with an error\n this.error('Application is currently in production, failed to set key.')\n this.newLine()\n process.exit(1)\n }\n\n // Check if APP_KEY exists\n if (/^APP_KEY=.*$/m.test(content)) {\n config.updated = true\n content = content.replace(/^APP_KEY=.*$/m, `APP_KEY=base64:${config.key}`)\n } else {\n // Add APP_KEY to the top, preserving existing content\n config.updated = false\n content = `APP_KEY=base64:${config.key}\\n\\n${content}`\n }\n\n // Write the application key to the .env file\n await writeFile(config.envPath, content, 'utf8')\n\n // Show the success message\n this.success('Application key set successfully.')\n this.newLine()\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport { Str } from '@h3ravel/support'\nimport nodepath from 'node:path'\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Create a new controller class. \n | {--a|api : Exclude the create and edit methods from the controller} \n | {--m|model= : Generate a resource controller for the given model} \n | {--r|resource : Generate a resource controller class} \n | {--force : Create the controller even if it already exists}\n }\n {resource : Create a new resource. \n | {--c|collection : Create a resource collection}\n | {--force : Create the resource even if it already exists}\n }\n {command : Create a new Musket command. \n | {--command : The terminal command that will be used to invoke the class} \n | {--force : Create the class even if the console command already exists}\n }\n {view : Create a new view.\n | {--force : Create the view even if it already exists}\n }\n {^name : The name of the [name] to generate}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes'\n\n public async handle (this: any) {\n const command = (this.dictionary.baseCommand ?? this.dictionary.name) as never\n\n if (!this.argument('name')) {\n this.program.error('Please provide a valid name for the ' + command)\n }\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n view: 'makeView',\n command: 'makeCommand',\n } as const\n\n await this[methods[command]]()\n }\n\n /**\n * Create a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : ''\n const name = this.argument('name')\n const force = this.option('force')\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n const path = app_path(`Http/Controllers/${name}.ts`)\n\n /** The Controller is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the controller already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Controller Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n protected makeResource () {\n Logger.success('Resource support is not yet available')\n }\n\n /**\n * Create a new Musket command\n */\n protected makeCommand () {\n Logger.success('Musket command creation is not yet available')\n }\n\n /**\n * Create a new view.\n */\n protected async makeView () {\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = base_path(`src/resources/views/${name}.edge`)\n\n /** The view is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the view already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`)\n Logger.split('INFO: View Created', Logger.log(`src/resources/views/${name}.edge`, 'gray', false))\n }\n}\n","import { mkdir, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport { FileSystem } from '@h3ravel/shared'\nimport { KeyGenerateCommand } from './KeyGenerateCommand'\n\nexport class PostinstallCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'postinstall'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Default post installation command'\n\n public async handle () {\n this.genEncryptionKey()\n this.createSqliteDB()\n }\n\n /**\n * Create sqlite database if none exist\n * \n * @returns \n */\n private async genEncryptionKey () {\n new KeyGenerateCommand(this.app, this.kernel)\n .setProgram(this.program)\n .setOption('force', true)\n .setOption('silent', true)\n .setOption('quiet', true)\n .setInput({ force: true, silent: true, quiet: true }, [], [], {}, this.program)\n .handle()\n }\n\n /**\n * Create sqlite database if none exist\n * \n * @returns \n */\n private async createSqliteDB () {\n if (config('database.default') !== 'sqlite') return\n\n if (!await FileSystem.fileExists(database_path())) {\n await mkdir(database_path(), { recursive: true })\n }\n\n if (!await FileSystem.fileExists(database_path('db.sqlite'))) {\n await writeFile(database_path('db.sqlite'), '')\n }\n }\n}\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","import { fork } from 'child_process';\nimport { resolve, dirname, join } from 'path';\n\nfunction run(opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart(options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle(_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle(outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown'\nimport { existsSync } from 'node:fs'\nimport path from 'node:path'\nimport { rm } from 'node:fs/promises'\nimport run from '@rollup/plugin-run'\n\nconst env = process.env.NODE_ENV || 'development'\nlet outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\nif (process.env.DIST_DIR) {\n outDir = process.env.DIST_DIR\n}\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n minify: !!process.env.DIST_MINIFY,\n external: [\n /^@h3ravel\\/.*/gi,\n ],\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n DIST_DIR: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n hooks (e) {\n e.hook('build:done', async () => {\n const paths = ['database/migrations', 'database/factories', 'database/seeders']\n for (let i = 0; i < paths.length; i++) {\n const name = paths[i]\n if (existsSync(path.join(outDir, name)))\n await rm(path.join(outDir, name), { recursive: true })\n }\n })\n },\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n DIST_DIR: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n}\n\nexport default TsDownConfig\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { ContainerResolver, ServiceProvider } from '@h3ravel/core'\n\nimport { BuildCommand } from '../Commands/BuildCommand'\nimport { Kernel } from '@h3ravel/musket'\nimport { KeyGenerateCommand } from '../Commands/KeyGenerateCommand'\nimport { MakeCommand } from '../Commands/MakeCommand'\nimport { PostinstallCommand } from '../Commands/PostinstallCommand'\nimport { altLogo } from '../logo'\nimport tsDownConfig from '../TsdownConfig'\n\n/**\n * Handles CLI commands and tooling.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static runsInConsole = true\n public runsInConsole = true\n\n register () {\n const DIST_DIR = `/${env('DIST_DIR', '.h3ravel/serve')}/`.replaceAll('//', '')\n const baseCommands = [BuildCommand, MakeCommand, PostinstallCommand, KeyGenerateCommand]\n\n Kernel.init(\n this.app,\n {\n logo: altLogo,\n resolver: new ContainerResolver(this.app).resolveMethodParams,\n tsDownConfig,\n baseCommands,\n packages: [\n { name: '@h3ravel/core', alias: 'H3ravel Framework' },\n { name: '@h3ravel/musket', alias: 'Musket CLI' }\n ],\n cliName: 'musket',\n hideMusketInfo: true,\n discoveryPaths: [app_path('Console/Commands/*.js').replace('/src/', DIST_DIR)],\n }\n );\n\n ['SIGINT', 'SIGTERM', 'SIGTSTP'].forEach(sig => process.on(sig, () => {\n process.exit(0)\n }))\n }\n}\n"],"x_google_ignoreList":[5],"mappings":";;;;;;;;;;;;;;;;AAMA,IAAa,eAAb,MAAa,qBAAqB,QAAQ;;;;;;CAOtC,AAAU,YAAoB;;;;;;;;;CAU9B,AAAU,cAAsB;CAEhC,MAAa,SAAU;AACnB,MAAI;AACA,SAAM,KAAK,MAAM;WACZ,GAAG;AACR,UAAO,MAAM,EAAS;;;CAI9B,MAAgB,OAAQ;EACpB,MAAMA,WAAS,KAAK,OAAO,MAAM,GAAG,mBAAmB,IAAI,YAAY,OAAO;EAC9E,MAAM,SAAS,KAAK,OAAO,SAAS;EACpC,MAAM,YAAY,KAAK,cAAc;EACrC,MAAM,QAAQ,YAAY;AAE1B,OAAK,SAAS;AACd,QAAM,aAAa,MAAM;GAAE;GAAQ;GAAQ;GAAW;GAAO,MAAM;GAAO,CAAC;AAC3E,OAAK,SAAS;;;;;CAMlB,aAAoB,MAAO,EAAE,OAAO,QAAQ,MAAM,WAAW,qBAAW;EACpE,MAAM;EACN,OAAO;EACP,QAAQ;EACR,WAAW;EACX,QAAQ;EACX,EAAE;EAEC,MAAM,MAAM,MAAM,YAAY,WAAW,CAAC,GAAG,QAAQ;EASrD,MAAM,WAAW;GACb,gBAAgB,QAAQ,SAAS;GACjC,WAAW;GACX,UAAU;GACV,UAAUA;GACV,aAAa;GACb,WAbe;IACf;IACA;IACA;IACA;IACH,CAQyB;GACzB;EAED,MAAM,SAAS,SAAS,cAAc,WAAW,aAAa;AAE9D,MAAI,KACA,QAAO,MAAM,MACT,IACA;GAAC;GAAU;GAAQ;GAAmB;GAAY;GAA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gBAAgB,CAAC,SAAS,wBAAwB,CAAC,QAAQ,SAAS,SAAS,CAAC;GACjF,CACJ;AAED;GAAC;GAAU;GAAW;GAAU,CAAC,SAAQ,QAAO,QAAQ,GAAG,WAAW;AAClE,WAAQ,KAAK,EAAE;IACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/console",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.14.1",
|
|
4
4
|
"description": "CLI utilities for scaffolding, running migrations, tasks and for H3ravel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"laravel"
|
|
52
52
|
],
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@h3ravel/core": "^1.
|
|
55
|
-
"@h3ravel/support": "^0.14.
|
|
54
|
+
"@h3ravel/core": "^1.20.0",
|
|
55
|
+
"@h3ravel/support": "^0.14.4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"typescript": "^5.9.2"
|
|
@@ -65,9 +65,10 @@
|
|
|
65
65
|
"preferred-pm": "^4.1.1",
|
|
66
66
|
"radashi": "^12.6.2",
|
|
67
67
|
"resolve-from": "^5.0.0",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
68
|
+
"dotenv": "^17.2.3",
|
|
69
|
+
"@h3ravel/musket": "^0.3.1",
|
|
70
|
+
"tsx": "^4.20.6",
|
|
71
|
+
"@h3ravel/shared": "^0.25.0"
|
|
71
72
|
},
|
|
72
73
|
"scripts": {
|
|
73
74
|
"barrelx": "barrelsby --directory src --delete --singleQuotes",
|