@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.
@@ -0,0 +1,13 @@
1
+ $ tsdown
2
+ ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
3
+ ℹ config file: /home/runner/work/kunk/kunk/packages/cli/tsdown.config.ts (unrun)
4
+ ℹ entry: src/index.ts
5
+ ℹ tsconfig: tsconfig.json
6
+ ℹ Build start
7
+ ℹ Granting execute permission to dist/index.mjs
8
+ ℹ dist/index.mjs 0.97 kB │ gzip: 0.55 kB
9
+ ℹ dist/index.d.mts 0.01 kB │ gzip: 0.03 kB
10
+ ℹ 2 files, total: 0.99 kB
11
+ [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
12
+
13
+ ✔ Build complete in 7774ms
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # @kunk/cli
2
+
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - version 2
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @kunk/docker@3.0.0
13
+ - @kunk/server@3.0.0
@@ -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
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": ".",
4
+ "baseUrl": ".",
5
+ "paths": {
6
+ "@/*": ["./src/*"]
7
+ },
8
+ "resolveJsonModule": true,
9
+ "esModuleInterop": true
10
+ },
11
+ "include": [
12
+ "src/**/*.ts"
13
+ ]
14
+ }
@@ -0,0 +1,16 @@
1
+ import { defineConfig } from 'tsdown'
2
+
3
+ export default defineConfig({
4
+ entry: [
5
+ './src/index.ts'
6
+ ],
7
+ external: [
8
+ "@kunk/server",
9
+ "@kunk/docker",
10
+ "commander"
11
+ ],
12
+ dts: true,
13
+ minify: {
14
+ mangle: true,
15
+ }
16
+ })