@evjs/cli 0.3.14 → 0.3.16

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,24 @@
1
+ import { type BuildOptions, type BundlerAdapter, type DevOptions, type PrepareFrameworkBuildOptions } from "@evjs/ev/_internal/build";
2
+ import type { Config } from "@evjs/ev/config";
3
+ import type { DefaultBundlerConfig } from "../config/load.js";
4
+ export type { BuildOptions, BundlerAdapter, DevOptions, PrepareFrameworkBuildOptions, } from "@evjs/ev/_internal/build";
5
+ export { CONFIG_DEFAULTS, type Config, defineConfig, type ResolvedConfig, resolveConfig, } from "@evjs/ev/config";
6
+ export { type DefaultBundlerConfig, loadConfig } from "../config/load.js";
7
+ type ConfigWithBundler<TBundlerCfg> = Config<TBundlerCfg> & {
8
+ readonly bundler: BundlerAdapter<TBundlerCfg>;
9
+ };
10
+ type DevOptionsWithBundler<TBundlerCfg> = DevOptions<TBundlerCfg> & ({
11
+ readonly bundler: BundlerAdapter<TBundlerCfg>;
12
+ } | {
13
+ readonly fallbackBundler: BundlerAdapter<TBundlerCfg>;
14
+ });
15
+ type BuildOptionsWithBundler<TBundlerCfg> = BuildOptions<TBundlerCfg> & {
16
+ readonly bundler: BundlerAdapter<TBundlerCfg>;
17
+ };
18
+ export declare function dev(userConfig?: Config<DefaultBundlerConfig>, options?: DevOptions<DefaultBundlerConfig>): Promise<void>;
19
+ export declare function dev<TBundlerCfg>(userConfig: ConfigWithBundler<TBundlerCfg>, options?: DevOptions<TBundlerCfg>): Promise<void>;
20
+ export declare function dev<TBundlerCfg>(userConfig: Config<TBundlerCfg> | undefined, options: DevOptionsWithBundler<TBundlerCfg>): Promise<void>;
21
+ export declare function build(userConfig?: Config<DefaultBundlerConfig>, options?: BuildOptions<DefaultBundlerConfig>): Promise<void>;
22
+ export declare function build<TBundlerCfg>(userConfig: ConfigWithBundler<TBundlerCfg>, options?: BuildOptions<TBundlerCfg>): Promise<void>;
23
+ export declare function build<TBundlerCfg>(userConfig: Config<TBundlerCfg> | undefined, options: BuildOptionsWithBundler<TBundlerCfg>): Promise<void>;
24
+ export declare function prepare<TBundlerCfg = DefaultBundlerConfig>(userConfig?: Config<TBundlerCfg>, options?: PrepareFrameworkBuildOptions<TBundlerCfg>): Promise<void>;
@@ -0,0 +1,45 @@
1
+ import { utoopackAdapter } from "@evjs/bundler-utoopack";
2
+ import { build as frameworkBuild, dev as frameworkDev, prepareFrameworkBuild, } from "@evjs/ev/_internal/build";
3
+ export { CONFIG_DEFAULTS, defineConfig, resolveConfig, } from "@evjs/ev/config";
4
+ export { loadConfig } from "../config/load.js";
5
+ const defaultBundler = utoopackAdapter;
6
+ export async function dev(userConfig, options) {
7
+ const { loadConfig } = await import("../config/load.js");
8
+ const defaultLoadConfig = loadConfig;
9
+ const reloadInitialConfig = options?.reloadInitialConfig ?? userConfig === undefined;
10
+ const configLoader = options?.loadConfig ??
11
+ (reloadInitialConfig ? defaultLoadConfig : undefined);
12
+ const explicitBundler = options?.bundler ?? userConfig?.bundler ?? options?.fallbackBundler;
13
+ if (explicitBundler) {
14
+ await frameworkDev(userConfig, {
15
+ ...options,
16
+ loadConfig: configLoader,
17
+ reloadInitialConfig,
18
+ });
19
+ return;
20
+ }
21
+ await frameworkDev(userConfig, {
22
+ ...options,
23
+ fallbackBundler: defaultBundler,
24
+ loadConfig: configLoader,
25
+ reloadInitialConfig,
26
+ });
27
+ }
28
+ export async function build(userConfig, options) {
29
+ const explicitBundler = options?.bundler ?? userConfig?.bundler;
30
+ if (explicitBundler) {
31
+ await frameworkBuild(userConfig, {
32
+ ...options,
33
+ bundler: explicitBundler,
34
+ });
35
+ return;
36
+ }
37
+ await frameworkBuild(userConfig, {
38
+ ...options,
39
+ bundler: defaultBundler,
40
+ });
41
+ }
42
+ export async function prepare(userConfig, options) {
43
+ const prepared = await prepareFrameworkBuild(userConfig, options);
44
+ await prepared.dispose();
45
+ }
package/dist/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
- export declare function runCli(argv?: readonly string[]): Promise<number>;
1
+ export { runCli } from "./program/run.js";
package/dist/cli.js CHANGED
@@ -1,64 +1 @@
1
- #!/usr/bin/env node
2
- import fs from "node:fs";
3
- import path from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import { configure, getConsoleSink, getLogger } from "@logtape/logtape";
6
- import { runCliProgram } from "./cli-program.js";
7
- import { build, dev, prepare } from "./index.js";
8
- import { runInspectCommand } from "./inspect-command.js";
9
- import { loadConfig } from "./load-config.js";
10
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
- const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, "../package.json"), "utf-8"));
12
- let configureLoggingPromise;
13
- function getLevelColor(level) {
14
- if (level === "info")
15
- return "\x1b[36m";
16
- if (level === "warning")
17
- return "\x1b[33m";
18
- if (level === "error" || level === "fatal")
19
- return "\x1b[31m";
20
- return "\x1b[32m";
21
- }
22
- function configureLogging() {
23
- configureLoggingPromise ??= configure({
24
- sinks: {
25
- console: getConsoleSink({
26
- formatter: (record) => {
27
- const time = new Date(record.timestamp).toLocaleTimeString("en-US", {
28
- hour12: false,
29
- });
30
- const levelColor = getLevelColor(record.level);
31
- const reset = "\x1b[0m";
32
- const cat = record.category[1]
33
- ? `\x1b[90m[${record.category[1]}]\x1b[0m `
34
- : "";
35
- const msg = record.message.map(String).join("");
36
- return `${levelColor}${time}${reset} ${cat}${msg}\n`;
37
- },
38
- }),
39
- },
40
- loggers: [
41
- { category: ["logtape", "meta"], lowestLevel: "warning" },
42
- { category: ["evjs"], sinks: ["console"], lowestLevel: "info" },
43
- ],
44
- });
45
- return configureLoggingPromise;
46
- }
47
- export async function runCli(argv = process.argv) {
48
- await configureLogging();
49
- const logger = getLogger(["evjs", "cli"]);
50
- return runCliProgram(argv, {
51
- version: pkg.version,
52
- cwd: () => process.cwd(),
53
- loadConfig: (cwd, options) => loadConfig(cwd, options),
54
- dev,
55
- build,
56
- prepare,
57
- inspect: runInspectCommand,
58
- writeStdout: (output) => process.stdout.write(output),
59
- writeStderr: (output) => process.stderr.write(output),
60
- reportError(summary, error) {
61
- logger.error `${summary}: ${error}`;
62
- },
63
- });
64
- }
1
+ export { runCli } from "./program/run.js";
@@ -1,6 +1,6 @@
1
1
  import { inspectFrameworkBuild } from "@evjs/ev/_internal/build";
2
- import { formatInspectJson, formatInspectText, hasInspectErrors, } from "./inspect.js";
3
- import { loadConfig } from "./load-config.js";
2
+ import { loadConfig } from "../../config/load.js";
3
+ import { formatInspectJson, formatInspectText, hasInspectErrors, } from "./report.js";
4
4
  export async function runInspectCommand(options = {}) {
5
5
  const cwd = options.cwd ?? process.cwd();
6
6
  const config = await loadConfig(cwd);
package/dist/index.d.ts CHANGED
@@ -1,24 +1 @@
1
- import { type BuildOptions, type BundlerAdapter, type DevOptions, type PrepareFrameworkBuildOptions } from "@evjs/ev/_internal/build";
2
- import type { Config } from "@evjs/ev/config";
3
- import type { DefaultBundlerConfig } from "./load-config.js";
4
- export type { BuildOptions, BundlerAdapter, DevOptions, PrepareFrameworkBuildOptions, } from "@evjs/ev/_internal/build";
5
- export { CONFIG_DEFAULTS, type Config, defineConfig, type ResolvedConfig, resolveConfig, } from "@evjs/ev/config";
6
- export { type DefaultBundlerConfig, loadConfig } from "./load-config.js";
7
- type ConfigWithBundler<TBundlerCfg> = Config<TBundlerCfg> & {
8
- readonly bundler: BundlerAdapter<TBundlerCfg>;
9
- };
10
- type DevOptionsWithBundler<TBundlerCfg> = DevOptions<TBundlerCfg> & ({
11
- readonly bundler: BundlerAdapter<TBundlerCfg>;
12
- } | {
13
- readonly fallbackBundler: BundlerAdapter<TBundlerCfg>;
14
- });
15
- type BuildOptionsWithBundler<TBundlerCfg> = BuildOptions<TBundlerCfg> & {
16
- readonly bundler: BundlerAdapter<TBundlerCfg>;
17
- };
18
- export declare function dev(userConfig?: Config<DefaultBundlerConfig>, options?: DevOptions<DefaultBundlerConfig>): Promise<void>;
19
- export declare function dev<TBundlerCfg>(userConfig: ConfigWithBundler<TBundlerCfg>, options?: DevOptions<TBundlerCfg>): Promise<void>;
20
- export declare function dev<TBundlerCfg>(userConfig: Config<TBundlerCfg> | undefined, options: DevOptionsWithBundler<TBundlerCfg>): Promise<void>;
21
- export declare function build(userConfig?: Config<DefaultBundlerConfig>, options?: BuildOptions<DefaultBundlerConfig>): Promise<void>;
22
- export declare function build<TBundlerCfg>(userConfig: ConfigWithBundler<TBundlerCfg>, options?: BuildOptions<TBundlerCfg>): Promise<void>;
23
- export declare function build<TBundlerCfg>(userConfig: Config<TBundlerCfg> | undefined, options: BuildOptionsWithBundler<TBundlerCfg>): Promise<void>;
24
- export declare function prepare<TBundlerCfg = DefaultBundlerConfig>(userConfig?: Config<TBundlerCfg>, options?: PrepareFrameworkBuildOptions<TBundlerCfg>): Promise<void>;
1
+ export { type BuildOptions, type BundlerAdapter, build, CONFIG_DEFAULTS, type Config, type DefaultBundlerConfig, type DevOptions, defineConfig, dev, loadConfig, type PrepareFrameworkBuildOptions, prepare, type ResolvedConfig, resolveConfig, } from "./api/framework-commands.js";
package/dist/index.js CHANGED
@@ -1,45 +1 @@
1
- import { utoopackAdapter } from "@evjs/bundler-utoopack";
2
- import { build as frameworkBuild, dev as frameworkDev, prepareFrameworkBuild, } from "@evjs/ev/_internal/build";
3
- export { CONFIG_DEFAULTS, defineConfig, resolveConfig, } from "@evjs/ev/config";
4
- export { loadConfig } from "./load-config.js";
5
- const defaultBundler = utoopackAdapter;
6
- export async function dev(userConfig, options) {
7
- const { loadConfig } = await import("./load-config.js");
8
- const defaultLoadConfig = (loadConfig);
9
- const reloadInitialConfig = options?.reloadInitialConfig ?? userConfig === undefined;
10
- const configLoader = options?.loadConfig ??
11
- (reloadInitialConfig ? defaultLoadConfig : undefined);
12
- const explicitBundler = options?.bundler ?? userConfig?.bundler ?? options?.fallbackBundler;
13
- if (explicitBundler) {
14
- await frameworkDev(userConfig, {
15
- ...options,
16
- loadConfig: configLoader,
17
- reloadInitialConfig,
18
- });
19
- return;
20
- }
21
- await frameworkDev(userConfig, {
22
- ...options,
23
- fallbackBundler: defaultBundler,
24
- loadConfig: configLoader,
25
- reloadInitialConfig,
26
- });
27
- }
28
- export async function build(userConfig, options) {
29
- const explicitBundler = options?.bundler ?? userConfig?.bundler;
30
- if (explicitBundler) {
31
- await frameworkBuild(userConfig, {
32
- ...options,
33
- bundler: explicitBundler,
34
- });
35
- return;
36
- }
37
- await frameworkBuild(userConfig, {
38
- ...options,
39
- bundler: defaultBundler,
40
- });
41
- }
42
- export async function prepare(userConfig, options) {
43
- const prepared = await prepareFrameworkBuild(userConfig, options);
44
- await prepared.dispose();
45
- }
1
+ export { build, CONFIG_DEFAULTS, defineConfig, dev, loadConfig, prepare, resolveConfig, } from "./api/framework-commands.js";
@@ -1,7 +1,7 @@
1
1
  import type { Config } from "@evjs/ev/config";
2
2
  import type { CliFlags } from "@evjs/ev/plugin";
3
- import type { DefaultBundlerConfig } from "./index.js";
4
- import { type InspectCommandOptions, type InspectCommandResult } from "./inspect-command.js";
3
+ import { type InspectCommandOptions, type InspectCommandResult } from "../commands/inspect/command.js";
4
+ import type { DefaultBundlerConfig } from "../config/load.js";
5
5
  type FrameworkCommand = (config: Config<DefaultBundlerConfig> | undefined, options: {
6
6
  cwd: string;
7
7
  flags: CliFlags;
@@ -1,6 +1,6 @@
1
1
  import { Command, CommanderError } from "commander";
2
- import { parseCliFlags } from "./cli-options.js";
3
- import { formatInspectCommandErrorJson, } from "./inspect-command.js";
2
+ import { formatInspectCommandErrorJson, } from "../commands/inspect/command.js";
3
+ import { parseCliFlags } from "./options.js";
4
4
  export async function runCliProgram(argv, dependencies) {
5
5
  let exitCode = 0;
6
6
  const fail = () => {
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare function runCli(argv?: readonly string[]): Promise<number>;
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { configure, getConsoleSink, getLogger } from "@logtape/logtape";
6
+ import { build, dev, prepare } from "../api/framework-commands.js";
7
+ import { runInspectCommand } from "../commands/inspect/command.js";
8
+ import { loadConfig } from "../config/load.js";
9
+ import { runCliProgram } from "./command-program.js";
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, "../../package.json"), "utf-8"));
12
+ let configureLoggingPromise;
13
+ function getLevelColor(level) {
14
+ if (level === "info")
15
+ return "\x1b[36m";
16
+ if (level === "warning")
17
+ return "\x1b[33m";
18
+ if (level === "error" || level === "fatal")
19
+ return "\x1b[31m";
20
+ return "\x1b[32m";
21
+ }
22
+ function configureLogging() {
23
+ configureLoggingPromise ??= configure({
24
+ sinks: {
25
+ console: getConsoleSink({
26
+ formatter: (record) => {
27
+ const time = new Date(record.timestamp).toLocaleTimeString("en-US", {
28
+ hour12: false,
29
+ });
30
+ const levelColor = getLevelColor(record.level);
31
+ const reset = "\x1b[0m";
32
+ const cat = record.category[1]
33
+ ? `\x1b[90m[${record.category[1]}]\x1b[0m `
34
+ : "";
35
+ const msg = record.message.map(String).join("");
36
+ return `${levelColor}${time}${reset} ${cat}${msg}\n`;
37
+ },
38
+ }),
39
+ },
40
+ loggers: [
41
+ { category: ["logtape", "meta"], lowestLevel: "warning" },
42
+ { category: ["evjs"], sinks: ["console"], lowestLevel: "info" },
43
+ ],
44
+ });
45
+ return configureLoggingPromise;
46
+ }
47
+ export async function runCli(argv = process.argv) {
48
+ await configureLogging();
49
+ const logger = getLogger(["evjs", "cli"]);
50
+ return runCliProgram(argv, {
51
+ version: pkg.version,
52
+ cwd: () => process.cwd(),
53
+ loadConfig: (cwd, options) => loadConfig(cwd, options),
54
+ dev,
55
+ build,
56
+ prepare,
57
+ inspect: runInspectCommand,
58
+ writeStdout: (output) => process.stdout.write(output),
59
+ writeStderr: (output) => process.stderr.write(output),
60
+ reportError(summary, error) {
61
+ logger.error `${summary}: ${error}`;
62
+ },
63
+ });
64
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evjs/cli",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "description": "Command-line wrapper for the evjs framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,21 +22,21 @@
22
22
  "bin"
23
23
  ],
24
24
  "scripts": {
25
- "build": "tsc",
25
+ "build": "rm -rf dist && tsc",
26
26
  "dev": "tsc -w",
27
27
  "test": "vitest run",
28
28
  "check-types": "tsc --noEmit"
29
29
  },
30
30
  "dependencies": {
31
- "@evjs/bundler-utoopack": "0.3.14",
32
- "@evjs/ev": "0.3.14",
31
+ "@evjs/bundler-utoopack": "0.3.16",
32
+ "@evjs/ev": "0.3.16",
33
33
  "@logtape/logtape": "^2.0.4",
34
34
  "commander": "^12.1.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@evjs/shared": "*",
38
38
  "@types/node": "^22.19.15",
39
- "typescript": "^6.0.2"
39
+ "typescript": "^7.0.2"
40
40
  },
41
41
  "homepage": "https://github.com/afx-team/evjs#readme",
42
42
  "bugs": {
File without changes
File without changes
File without changes
File without changes
File without changes