@atomservice/cli 0.1.8 → 0.1.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomservice/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "atomservice 命令行工具(atom):init / run / add / service",
5
5
  "type": "module",
6
6
  "author": "openorson",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@clack/prompts": "1.5.0",
33
- "@atomservice/core": "0.1.8",
33
+ "@atomservice/core": "0.1.9",
34
34
  "citty": "0.2.2",
35
35
  "cli-table3": "0.6.5",
36
36
  "log-update": "8.0.0",
@@ -0,0 +1,8 @@
1
+ export async function resolveLocalCore(): Promise<typeof import("@atomservice/core")> {
2
+ try {
3
+ const url = import.meta.resolve("@atomservice/core", `file://${process.cwd()}/`)
4
+ return (await import(url)) as typeof import("@atomservice/core")
5
+ } catch {
6
+ return import("@atomservice/core")
7
+ }
8
+ }
@@ -1,6 +1,6 @@
1
- import { initForCli, loadConfig, selectServices } from "@atomservice/core"
2
1
  import { defineCommand } from "citty"
3
2
  import pc from "picocolors"
3
+ import { resolveLocalCore } from "../cli.core.ts"
4
4
  import { runAtom } from "./run.utils.ts"
5
5
 
6
6
  export const downCmd = defineCommand({
@@ -16,6 +16,7 @@ export const downCmd = defineCommand({
16
16
  },
17
17
  run: async ({ args }) => {
18
18
  if (args.verbose) process.env.ATOMSERVICE_VERBOSE = "1"
19
+ const { initForCli, loadConfig, selectServices } = await resolveLocalCore()
19
20
  const config = await loadConfig()
20
21
  let services = await initForCli(config)
21
22
 
@@ -1,9 +1,9 @@
1
1
  import type { HealthStatus } from "@atomservice/core"
2
- import { initForCli, loadConfig } from "@atomservice/core"
3
2
  import { defineCommand } from "citty"
4
3
  import Table from "cli-table3"
5
4
  import logUpdate from "log-update"
6
5
  import pc from "picocolors"
6
+ import { resolveLocalCore } from "../cli.core.ts"
7
7
 
8
8
  function renderTable(results: Map<string, HealthStatus>): string {
9
9
  const table = new Table({
@@ -34,6 +34,7 @@ export const statusCmd = defineCommand({
34
34
  },
35
35
  run: async ({ args }) => {
36
36
  if (args.verbose) process.env.ATOMSERVICE_VERBOSE = "1"
37
+ const { initForCli, loadConfig } = await resolveLocalCore()
37
38
  const config = await loadConfig()
38
39
  const services = await initForCli(config)
39
40
 
package/src/run/run.up.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { initForCli, loadConfig, selectServices } from "@atomservice/core"
2
1
  import { defineCommand } from "citty"
3
2
  import pc from "picocolors"
3
+ import { resolveLocalCore } from "../cli.core.ts"
4
4
  import { runAtom } from "./run.utils.ts"
5
5
 
6
6
  export const upCmd = defineCommand({
@@ -16,6 +16,7 @@ export const upCmd = defineCommand({
16
16
  },
17
17
  run: async ({ args }) => {
18
18
  if (args.verbose) process.env.ATOMSERVICE_VERBOSE = "1"
19
+ const { initForCli, loadConfig, selectServices } = await resolveLocalCore()
19
20
  const config = await loadConfig()
20
21
  let services = await initForCli(config)
21
22
 
@@ -1,7 +1,8 @@
1
- import { initForCli, loadConfig } from "@atomservice/core"
2
1
  import { defineCommand } from "citty"
2
+ import { resolveLocalCore } from "../cli.core.ts"
3
3
 
4
4
  export async function buildServiceSubCommands(): Promise<Record<string, ReturnType<typeof defineCommand>>> {
5
+ const { initForCli, loadConfig } = await resolveLocalCore()
5
6
  let config: Awaited<ReturnType<typeof loadConfig>>
6
7
  try {
7
8
  config = await loadConfig()