@h3ravel/console 11.14.6 → 11.14.7
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/package.json +1 -1
- package/bin/fire.cjs +0 -56
- package/bin/fire.d.cts +0 -1
- package/bin/fire.d.mts +0 -2
- package/bin/prepare.cjs +0 -2
- package/bin/prepare.d.cts +0 -1
- package/bin/prepare.d.mts +0 -1
- package/bin/zero-CvhYK9f6.cjs +0 -1
package/package.json
CHANGED
package/bin/fire.cjs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./zero-CvhYK9f6.cjs`);require(`tsx/esm`);let t=require(`@h3ravel/core`),n=require(`@h3ravel/shared`),r=require(`@h3ravel/musket`),i=require(`execa`),a=require(`preferred-pm`);a=e.n(a);let o=require(`fs/promises`),s=require(`crypto`);s=e.n(s);let c=require(`dotenv`);c=e.n(c);let l=require(`node:fs/promises`),u=require(`@h3ravel/support`),d=require(`node:path`);d=e.n(d);let f=require(`node:fs`),p=require(`child_process`),m=require(`path`);var h=class e extends r.Command{signature=`build
|
|
3
|
-
{--m|minify : Minify your bundle output}
|
|
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)})})}},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:
|
|
9
|
-
{controller : Create a new controller class.
|
|
10
|
-
| {--a|api : Exclude the create and edit methods from the controller}
|
|
11
|
-
| {--m|model= : Generate a resource controller for the given model}
|
|
12
|
-
| {--r|resource : Generate a resource controller class}
|
|
13
|
-
| {--force : Create the controller even if it already exists}
|
|
14
|
-
}
|
|
15
|
-
{resource : Create a new resource.
|
|
16
|
-
| {--c|collection : Create a resource collection}
|
|
17
|
-
| {--force : Create the resource even if it already exists}
|
|
18
|
-
}
|
|
19
|
-
{command : Create a new Musket command.
|
|
20
|
-
| {--command : The terminal command that will be used to invoke the class}
|
|
21
|
-
| {--force : Create the class even if the console command already exists}
|
|
22
|
-
}
|
|
23
|
-
{view : Create a new view.
|
|
24
|
-
| {--force : Create the view even if it already exists}
|
|
25
|
-
}
|
|
26
|
-
{^name : The name of the [name] to generate}
|
|
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`
|
|
28
|
-
111
|
|
29
|
-
111111111
|
|
30
|
-
1111111111 111111
|
|
31
|
-
111111 111 111111
|
|
32
|
-
111111 111 111111
|
|
33
|
-
11111 111 11111
|
|
34
|
-
1111111 111 1111111
|
|
35
|
-
111 11111 111 111111 111 1111 1111 11111111 1111
|
|
36
|
-
111 11111 1111 111111 111 1111 1111 1111 11111 1111
|
|
37
|
-
111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
|
|
38
|
-
111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
|
|
39
|
-
111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
|
|
40
|
-
111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
|
|
41
|
-
111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
|
|
42
|
-
1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
|
|
43
|
-
11011 111111 11 11111
|
|
44
|
-
111111 11101 111111
|
|
45
|
-
111111 111 111111
|
|
46
|
-
111111 111 111111
|
|
47
|
-
111111111
|
|
48
|
-
110
|
|
49
|
-
`,b=String.raw`
|
|
50
|
-
_ _ _____ _
|
|
51
|
-
| | | |___ / _ __ __ ___ _____| |
|
|
52
|
-
| |_| | |_ \| '__/ _ \ \ / / _ \ |
|
|
53
|
-
| _ |___) | | | (_| |\ V / __/ |
|
|
54
|
-
|_| |_|____/|_| \__,_| \_/ \___|_|
|
|
55
|
-
|
|
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/*.mjs`).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.mjs`));try{n.push(...(await import(i)).default)}catch{}n.push(E),await r.quickStartup(n,[`CoreServiceProvider`])}};new D().fire();
|
package/bin/fire.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/bin/fire.d.mts
DELETED
package/bin/prepare.cjs
DELETED
package/bin/prepare.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/bin/prepare.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/bin/zero-CvhYK9f6.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@h3ravel/shared`),l=require(`execa`),u=require(`preferred-pm`);u=s(u);let d=require(`node:fs/promises`),f=require(`node:path`);f=s(f);var p=class{async prepare(e=`.h3ravel/serve`){let t=(await(0,u.default)(process.cwd()))?.name??`npm`,n=(0,f.join)(process.env.DIST_DIR??e);if(await c.FileSystem.fileExists(n)&&(await(0,d.readdir)(n)).length>0)return;await c.FileSystem.fileExists(f.default.join(n,`tsconfig.json`))||(await(0,d.mkdir)(f.default.join(n.replace(`/serve`,``)),{recursive:!0}),await(0,d.writeFile)(f.default.join(n.replace(`/serve`,``),`tsconfig.json`),JSON.stringify(c.mainTsconfig,null,2)));let r={EXTENDED_DEBUG:`false`,CLI_BUILD:`true`,NODE_ENV:`production`,DIST_DIR:n,LOG_LEVEL:`silent`};await(0,l.execa)(t,[`tsdown`,`--silent`,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:(0,f.join)(process.cwd()),env:Object.assign({},process.env,r)})}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
|