@kunk/cli 3.0.0
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/.turbo/turbo-build.log +13 -0
- package/CHANGELOG.md +13 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +2 -0
- package/package.json +21 -0
- package/src/commands/docker_up.ts +15 -0
- package/src/index.ts +34 -0
- package/tsconfig.json +14 -0
- package/tsdown.config.ts +16 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
$ tsdown
|
|
2
|
+
[34mℹ[39m tsdown [2mv0.20.3[22m powered by rolldown [2mv1.0.0-rc.3[22m
|
|
3
|
+
[34mℹ[39m config file: [4m/home/runner/work/kunk/kunk/packages/cli/tsdown.config.ts[24m (unrun)
|
|
4
|
+
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
5
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
6
|
+
[34mℹ[39m Build start
|
|
7
|
+
[34mℹ[39m Granting execute permission to [4mdist/index.mjs[24m
|
|
8
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m0.97 kB[22m [2m│ gzip: 0.55 kB[22m
|
|
9
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
10
|
+
[34mℹ[39m 2 files, total: 0.99 kB
|
|
11
|
+
[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
12
|
+
|
|
13
|
+
[32m✔[39m Build complete in [32m7774ms[39m
|
package/CHANGELOG.md
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import{program}from"commander";import{DatabaseConfig}from"@kunk/server";var version=`3.0.0`;async function docker_up(){await import(`@kunk/server`);let{PostgresContainer:e}=await import(`@kunk/docker`),{uri:n}=DatabaseConfig.get(),r=new URL(n);await e.start({hostname:r.hostname,port:r.port,username:r.username,password:r.password,database:r.pathname.slice(1)})}console.log(process.cwd()),program.name(`kunk`).description(`Kunk is a framework for building microservices`).version(version),program.command(`docker up`).description(`Start the docker containers`).option(`--detach`,`run the command in the background`).action(async(e,t)=>{if(console.log(`Starting docker containers in background...`,t),t.detach){let e=Bun.spawn([`bun`,`run`,`cli`,`docker`,`up`],{detached:!0,stdio:[`ignore`,`pipe`,`inherit`]});e.unref(),console.log(`Processo iniciado em background com PID: ${e.pid}`),process.exit(0)}else docker_up()}),program.parse(process.argv);export{};
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kunk/cli",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.ts",
|
|
7
|
+
"module": "./index.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsdown"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@kunk/server": "workspace:*",
|
|
13
|
+
"@kunk/docker": "workspace:*"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"kunk": "./cli.ts"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DatabaseConfig } from "@kunk/server"
|
|
2
|
+
|
|
3
|
+
export default async function docker_up() {
|
|
4
|
+
await import("@kunk/server")
|
|
5
|
+
const { PostgresContainer } = await import("@kunk/docker")
|
|
6
|
+
const { uri } = DatabaseConfig.get()
|
|
7
|
+
const url = new URL(uri)
|
|
8
|
+
await PostgresContainer.start({
|
|
9
|
+
hostname: url.hostname,
|
|
10
|
+
port: url.port,
|
|
11
|
+
username: url.username,
|
|
12
|
+
password: url.password,
|
|
13
|
+
database: url.pathname.slice(1),
|
|
14
|
+
})
|
|
15
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
console.log(process.cwd());
|
|
4
|
+
|
|
5
|
+
import { program } from "commander"
|
|
6
|
+
import { version } from "package.json"
|
|
7
|
+
import docker_up from "@/commands/docker_up";
|
|
8
|
+
|
|
9
|
+
program
|
|
10
|
+
.name("kunk")
|
|
11
|
+
.description("Kunk is a framework for building microservices")
|
|
12
|
+
.version(version);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
program.command("docker up")
|
|
16
|
+
.description("Start the docker containers")
|
|
17
|
+
.option('--detach', 'run the command in the background')
|
|
18
|
+
.action(async (str, options) => {
|
|
19
|
+
console.log('Starting docker containers in background...', options)
|
|
20
|
+
if (options.detach) {
|
|
21
|
+
const child = Bun.spawn(['bun', 'run', 'cli', 'docker', 'up'], {
|
|
22
|
+
detached: true,
|
|
23
|
+
stdio: ['ignore', 'pipe', 'inherit'],
|
|
24
|
+
})
|
|
25
|
+
child.unref() // permite que o processo pai encerre sem esperar o filho
|
|
26
|
+
console.log(`Processo iniciado em background com PID: ${child.pid}`)
|
|
27
|
+
process.exit(0)
|
|
28
|
+
} else {
|
|
29
|
+
docker_up()
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
program.parse(process.argv);
|
|
34
|
+
|
package/tsconfig.json
ADDED
package/tsdown.config.ts
ADDED