@decohere/devkit 0.0.1-dev.119
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/README.md +14 -0
- package/commonjs/src/cli/action.js +65 -0
- package/commonjs/src/cli/command.js +127 -0
- package/commonjs/src/cli/index.js +61 -0
- package/commonjs/src/cli/module.type.js +18 -0
- package/commonjs/src/cli/options.js +115 -0
- package/commonjs/src/diagnostics/index.js +22 -0
- package/commonjs/src/diagnostics/trace.js +79 -0
- package/commonjs/src/interop/docker/docker.js +54 -0
- package/commonjs/src/interop/errors/interop.error.js +12 -0
- package/commonjs/src/interop/git/git.js +134 -0
- package/commonjs/src/interop/git/git.types.js +4 -0
- package/commonjs/src/interop/index.js +97 -0
- package/commonjs/src/interop/node/index.js +18 -0
- package/commonjs/src/interop/node/node.js +45 -0
- package/commonjs/src/interop/npm/npm.js +231 -0
- package/commonjs/src/interop/npm/npm.types.js +16 -0
- package/commonjs/src/interop/pnpm/pnpm.js +34 -0
- package/commonjs/src/interop/pnpm/pnpm.types.js +4 -0
- package/commonjs/src/interop/shell/shell.argv.js +45 -0
- package/commonjs/src/interop/shell/shell.js +105 -0
- package/commonjs/src/interop/shell/shell.types.js +4 -0
- package/commonjs/src/interop/types/detect-package-manager.js +71 -0
- package/commonjs/src/interop/types/package-manager.js +4 -0
- package/commonjs/src/interop/yarn/yarn.js +34 -0
- package/commonjs/src/interop/yarn/yarn.types.js +4 -0
- package/commonjs/src/io/find-directories.js +21 -0
- package/commonjs/src/io/find-file.js +45 -0
- package/commonjs/src/io/index.js +20 -0
- package/commonjs/src/io/watch.js +261 -0
- package/es6/src/cli/action.js +47 -0
- package/es6/src/cli/command.js +106 -0
- package/es6/src/cli/index.js +4 -0
- package/es6/src/cli/module.type.js +11 -0
- package/es6/src/cli/options.js +76 -0
- package/es6/src/diagnostics/index.js +1 -0
- package/es6/src/diagnostics/trace.js +61 -0
- package/es6/src/interop/docker/docker.js +44 -0
- package/es6/src/interop/errors/interop.error.js +2 -0
- package/es6/src/interop/git/git.js +124 -0
- package/es6/src/interop/git/git.types.js +1 -0
- package/es6/src/interop/index.js +21 -0
- package/es6/src/interop/node/index.js +1 -0
- package/es6/src/interop/node/node.js +35 -0
- package/es6/src/interop/npm/npm.js +180 -0
- package/es6/src/interop/npm/npm.types.js +6 -0
- package/es6/src/interop/pnpm/pnpm.js +24 -0
- package/es6/src/interop/pnpm/pnpm.types.js +1 -0
- package/es6/src/interop/shell/shell.argv.js +35 -0
- package/es6/src/interop/shell/shell.js +95 -0
- package/es6/src/interop/shell/shell.types.js +1 -0
- package/es6/src/interop/types/detect-package-manager.js +50 -0
- package/es6/src/interop/types/package-manager.js +1 -0
- package/es6/src/interop/yarn/yarn.js +24 -0
- package/es6/src/interop/yarn/yarn.types.js +1 -0
- package/es6/src/io/find-directories.js +11 -0
- package/es6/src/io/find-file.js +27 -0
- package/es6/src/io/index.js +3 -0
- package/es6/src/io/watch.js +238 -0
- package/package.json +49 -0
- package/types/src/cli/action.d.ts +36 -0
- package/types/src/cli/command.d.ts +34 -0
- package/types/src/cli/index.d.ts +7 -0
- package/types/src/cli/module.type.d.ts +36 -0
- package/types/src/cli/options.d.ts +28 -0
- package/types/src/diagnostics/index.d.ts +1 -0
- package/types/src/diagnostics/trace.d.ts +10 -0
- package/types/src/interop/docker/docker.d.ts +19 -0
- package/types/src/interop/errors/interop.error.d.ts +2 -0
- package/types/src/interop/git/git.d.ts +16 -0
- package/types/src/interop/git/git.types.d.ts +14 -0
- package/types/src/interop/index.d.ts +14 -0
- package/types/src/interop/node/index.d.ts +1 -0
- package/types/src/interop/node/node.d.ts +5 -0
- package/types/src/interop/npm/npm.d.ts +29 -0
- package/types/src/interop/npm/npm.types.d.ts +24 -0
- package/types/src/interop/pnpm/pnpm.d.ts +9 -0
- package/types/src/interop/pnpm/pnpm.types.d.ts +3 -0
- package/types/src/interop/shell/shell.argv.d.ts +5 -0
- package/types/src/interop/shell/shell.d.ts +6 -0
- package/types/src/interop/shell/shell.types.d.ts +9 -0
- package/types/src/interop/types/detect-package-manager.d.ts +4 -0
- package/types/src/interop/types/package-manager.d.ts +10 -0
- package/types/src/interop/yarn/yarn.d.ts +9 -0
- package/types/src/interop/yarn/yarn.types.d.ts +3 -0
- package/types/src/io/find-directories.d.ts +2 -0
- package/types/src/io/find-file.d.ts +9 -0
- package/types/src/io/index.d.ts +3 -0
- package/types/src/io/watch.d.ts +16 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ContainerBuilder } from "@decohere/core/composition";
|
|
2
|
+
import type { ActionClassMap } from "./action.js";
|
|
3
|
+
import type { CommandType, DecohereCommand } from "./command.js";
|
|
4
|
+
export type CommandMap = Record<string, CommandType>;
|
|
5
|
+
export type WorkspaceFactoryOptions = {
|
|
6
|
+
configFile?: string;
|
|
7
|
+
rootDir?: string;
|
|
8
|
+
};
|
|
9
|
+
export interface ApplicationModule {
|
|
10
|
+
id: string;
|
|
11
|
+
dispose?(): void;
|
|
12
|
+
asyncDispose?(): Promise<void>;
|
|
13
|
+
command: DecohereCommand;
|
|
14
|
+
}
|
|
15
|
+
export type ModuleConfig = {
|
|
16
|
+
actions?: ActionClassMap;
|
|
17
|
+
commands?: CommandMap;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Simple declaration interface for a CLI module.
|
|
21
|
+
* Extend this and implement the four abstract members.
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class ModuleManifest {
|
|
24
|
+
/** Unique module identifier, used as the root command name. */
|
|
25
|
+
abstract readonly id: string;
|
|
26
|
+
/** Sub-command classes this module contributes. */
|
|
27
|
+
readonly commands: CommandMap;
|
|
28
|
+
/** Action classes this module contributes. */
|
|
29
|
+
readonly actions: ActionClassMap;
|
|
30
|
+
/** The root command class for this module. */
|
|
31
|
+
abstract readonly command: CommandType;
|
|
32
|
+
/** Register infrastructure services into the DI container. */
|
|
33
|
+
registerServices(_builder: ContainerBuilder): void;
|
|
34
|
+
/** Lazily create a workspace instance. Return null if this module does not use a workspace. */
|
|
35
|
+
createWorkspace(_options: WorkspaceFactoryOptions): Promise<object | null>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Option } from "commander";
|
|
2
|
+
export declare class ConfigurationOption extends Option {
|
|
3
|
+
constructor(defaultValue: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class ConfigFileOption extends Option {
|
|
6
|
+
constructor(defaultValue?: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class LogLevelOption extends Option {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
export declare class EnvFileOption extends Option {
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
14
|
+
export declare class EnvFileIfExistsOption extends Option {
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
17
|
+
export declare class NoCleanOptions extends Option {
|
|
18
|
+
constructor(defaultValue: boolean);
|
|
19
|
+
}
|
|
20
|
+
export declare class NoBuildOptions extends Option {
|
|
21
|
+
constructor(defaultValue: boolean);
|
|
22
|
+
}
|
|
23
|
+
export declare class DryRunOption extends Option {
|
|
24
|
+
constructor(description: string, defaultValue?: boolean);
|
|
25
|
+
}
|
|
26
|
+
export declare class ProjectOption extends Option {
|
|
27
|
+
constructor();
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Trace, timed, trace } from "./trace.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function trace(target: object, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
2
|
+
/**
|
|
3
|
+
* Always-on method timing. Logs duration at `info` regardless of `FORGE_TRACE`.
|
|
4
|
+
* Use this to time a specific method without raising the process log level.
|
|
5
|
+
*/
|
|
6
|
+
export declare function timed(target: object, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
7
|
+
export declare function Trace(constructor: {
|
|
8
|
+
name: string;
|
|
9
|
+
prototype: object;
|
|
10
|
+
}): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Shell } from "../shell/shell.js";
|
|
2
|
+
export type DockerBuildOptions = {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
dockerfile?: string;
|
|
5
|
+
tags?: string[];
|
|
6
|
+
buildArgs?: Record<string, string>;
|
|
7
|
+
secrets?: Record<string, string>;
|
|
8
|
+
noCache?: boolean;
|
|
9
|
+
pull?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type DockerPushOptions = {
|
|
12
|
+
cwd?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare class Docker extends Shell {
|
|
15
|
+
readonly name: "docker";
|
|
16
|
+
protected program: string;
|
|
17
|
+
build(contextDir: string, options?: DockerBuildOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
18
|
+
push(tag: string, options?: DockerPushOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Shell } from "../shell/shell.js";
|
|
2
|
+
import type { ShellResponse } from "../shell/shell.types.js";
|
|
3
|
+
import type { CommitOptions, GitOptions, PushOptions, StageOptions } from "./git.types.js";
|
|
4
|
+
export declare class Git extends Shell {
|
|
5
|
+
protected program: string;
|
|
6
|
+
getModifiedFiles(options?: GitOptions): Promise<string[]>;
|
|
7
|
+
getBranchName(options?: GitOptions): Promise<string>;
|
|
8
|
+
tag(tag: string, options?: GitOptions): Promise<ShellResponse>;
|
|
9
|
+
pushTag(tag: string, options?: GitOptions & {
|
|
10
|
+
remote?: string;
|
|
11
|
+
}): Promise<ShellResponse>;
|
|
12
|
+
commit(message: string, options: CommitOptions): Promise<ShellResponse>;
|
|
13
|
+
push(branch: string, options?: PushOptions): Promise<ShellResponse>;
|
|
14
|
+
pull(branch: string, options?: GitOptions): Promise<ShellResponse>;
|
|
15
|
+
stage(options: StageOptions): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type GitOptions = {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
};
|
|
4
|
+
export type CommitOptions = {
|
|
5
|
+
files?: string[];
|
|
6
|
+
all?: boolean;
|
|
7
|
+
} & GitOptions;
|
|
8
|
+
export type PushOptions = {
|
|
9
|
+
setUpstream: string;
|
|
10
|
+
} & GitOptions;
|
|
11
|
+
export type StageOptions = {
|
|
12
|
+
files?: string[];
|
|
13
|
+
all?: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./docker/docker.js";
|
|
2
|
+
export * from "./git/git.js";
|
|
3
|
+
export * as git from "./git/git.types.js";
|
|
4
|
+
export * from "./node/node.js";
|
|
5
|
+
export * from "./npm/npm.js";
|
|
6
|
+
export * as npm from "./npm/npm.types.js";
|
|
7
|
+
export * from "./pnpm/pnpm.js";
|
|
8
|
+
export * as pnpm from "./pnpm/pnpm.types.js";
|
|
9
|
+
export * from "./shell/shell.js";
|
|
10
|
+
export * as shell from "./shell/shell.types.js";
|
|
11
|
+
export * from "./types/detect-package-manager.js";
|
|
12
|
+
export * from "./types/package-manager.js";
|
|
13
|
+
export * from "./yarn/yarn.js";
|
|
14
|
+
export * as yarn from "./yarn/yarn.types.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./node.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Shell } from "../shell/shell.js";
|
|
2
|
+
import type { PackageManager } from "../types/package-manager.js";
|
|
3
|
+
import type { NpmOptions, PublishOptions, VersionOptions, VersionType } from "./npm.types.js";
|
|
4
|
+
export declare class Npm extends Shell implements PackageManager {
|
|
5
|
+
readonly name: "npm";
|
|
6
|
+
protected program: string;
|
|
7
|
+
publish(directory: string, options?: PublishOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
8
|
+
/**
|
|
9
|
+
* @description Runs in the directory of the package
|
|
10
|
+
* @param options
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
version(versionType: VersionType, options: VersionOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
14
|
+
link(directory: string, options?: NpmOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
15
|
+
install(options?: NpmOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Install only `dependencies` as real folders: `--omit=dev` skips devDependencies and
|
|
18
|
+
* `--no-bin-links` skips the `.bin` symlinks, so the result holds no symlinks at all.
|
|
19
|
+
*/
|
|
20
|
+
installProduction(options?: NpmOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
21
|
+
syncLockFile(options?: NpmOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* True when package@version exists on the registry.
|
|
24
|
+
* Uses ambient npm config (cwd `.npmrc`); do not pass tokens on argv.
|
|
25
|
+
*/
|
|
26
|
+
private isPublished;
|
|
27
|
+
private createTempUserConfig;
|
|
28
|
+
private removeTempUserConfig;
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type NpmOptions = {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
};
|
|
4
|
+
export type PublishOptions = {
|
|
5
|
+
dryRun?: boolean;
|
|
6
|
+
skipIfPublished?: boolean;
|
|
7
|
+
authToken?: string;
|
|
8
|
+
otp?: string;
|
|
9
|
+
provenance?: boolean;
|
|
10
|
+
/** @deprecated use channel */
|
|
11
|
+
versionType?: VersionType;
|
|
12
|
+
channel?: string;
|
|
13
|
+
} & NpmOptions;
|
|
14
|
+
export type VersionType = "major" | "minor" | "patch" | "prerelease";
|
|
15
|
+
export declare const VersionTypes: {
|
|
16
|
+
major: "major";
|
|
17
|
+
minor: "minor";
|
|
18
|
+
patch: "patch";
|
|
19
|
+
prerelease: "prerelease";
|
|
20
|
+
};
|
|
21
|
+
export type VersionOptions = {
|
|
22
|
+
preid?: string;
|
|
23
|
+
noTag?: boolean;
|
|
24
|
+
} & NpmOptions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Shell } from "../shell/shell.js";
|
|
2
|
+
import type { PackageManager } from "../types/package-manager.js";
|
|
3
|
+
import type { PnpmOptions } from "./pnpm.types.js";
|
|
4
|
+
export declare class Pnpm extends Shell implements PackageManager {
|
|
5
|
+
readonly name: "pnpm";
|
|
6
|
+
protected program: string;
|
|
7
|
+
install(options?: PnpmOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
8
|
+
syncLockFile(options?: PnpmOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PackageManager } from "./package-manager.js";
|
|
2
|
+
export declare function detectPackageManager(cwd: string): PackageManager | undefined;
|
|
3
|
+
export declare function packageManagerFromString(name: string): PackageManager;
|
|
4
|
+
export declare function promptForPackageManager(): Promise<PackageManager>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ShellResponse } from "../shell/shell.types.js";
|
|
2
|
+
export interface PackageManager {
|
|
3
|
+
readonly name: "npm" | "pnpm" | "yarn";
|
|
4
|
+
install(options?: {
|
|
5
|
+
cwd?: string;
|
|
6
|
+
}): Promise<ShellResponse>;
|
|
7
|
+
syncLockFile(options?: {
|
|
8
|
+
cwd?: string;
|
|
9
|
+
}): Promise<ShellResponse>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Shell } from "../shell/shell.js";
|
|
2
|
+
import type { PackageManager } from "../types/package-manager.js";
|
|
3
|
+
import type { YarnOptions } from "./yarn.types.js";
|
|
4
|
+
export declare class Yarn extends Shell implements PackageManager {
|
|
5
|
+
readonly name: "yarn";
|
|
6
|
+
protected program: string;
|
|
7
|
+
install(options?: YarnOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
8
|
+
syncLockFile(options?: YarnOptions): Promise<import("../shell/shell.types.js").ShellResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FileEx } from "@decohere/core/io";
|
|
2
|
+
export type FindFileOptions = {
|
|
3
|
+
cwd: string;
|
|
4
|
+
ignore?: string | string[];
|
|
5
|
+
};
|
|
6
|
+
export declare function findFile(pattern: string): Promise<{
|
|
7
|
+
relativePath: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function findFiles(patterns: string[], options?: FindFileOptions): Promise<FileEx[]>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Watcher } from "@decohere/core/io";
|
|
2
|
+
export type WatchOptions = {
|
|
3
|
+
include?: string[];
|
|
4
|
+
ignore?: string[];
|
|
5
|
+
cwd?: string;
|
|
6
|
+
ignoreInitial?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type WatchEventName = "add" | "change" | "addDir" | "unlink" | "unlinkDir";
|
|
9
|
+
export declare const WatchEvents: {
|
|
10
|
+
add: "add";
|
|
11
|
+
change: "change";
|
|
12
|
+
addDir: "addDir";
|
|
13
|
+
unlink: "unlink";
|
|
14
|
+
unlinkDir: "unlinkDir";
|
|
15
|
+
};
|
|
16
|
+
export declare function watch(directory: string, options?: WatchOptions): Watcher;
|