@decohere/forge 0.0.1-dev.20 → 0.0.1-dev.20261105.110
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/LICENSE +15 -0
- package/README.md +152 -0
- package/es6/src/actions/build.action.js +3 -7
- package/es6/src/actions/clean.action.js +3 -6
- package/es6/src/actions/commit.action.js +3 -6
- package/es6/src/actions/copy.action.js +61 -12
- package/es6/src/actions/dependency-report.action.js +7 -7
- package/es6/src/actions/dependency-sync.action.js +8 -6
- package/es6/src/actions/docker.action.js +82 -36
- package/es6/src/actions/index.js +3 -2
- package/es6/src/actions/link.action.js +2 -5
- package/es6/src/actions/package.action.js +219 -0
- package/es6/src/actions/paths.action.js +97 -0
- package/es6/src/actions/publish.action.js +3 -6
- package/es6/src/actions/sync-lock-file.action.js +2 -4
- package/es6/src/actions/tag.action.js +5 -9
- package/es6/src/actions/typecheck.action.js +52 -0
- package/es6/src/actions/unlink.action.js +1 -3
- package/es6/src/actions/version.action.js +69 -17
- package/es6/src/actions/watch.action.js +2 -5
- package/es6/src/commands/build.command.js +4 -3
- package/es6/src/commands/dependency.command.js +1 -3
- package/es6/src/commands/docker.command.js +2 -4
- package/es6/src/commands/forge.command.js +1 -3
- package/es6/src/commands/index.js +3 -2
- package/es6/src/commands/link.command.js +4 -3
- package/es6/src/commands/package.command.js +26 -0
- package/es6/src/commands/paths.command.js +14 -0
- package/es6/src/commands/publish.command.js +1 -3
- package/es6/src/commands/tag.command.js +1 -3
- package/es6/src/commands/typecheck.command.js +14 -0
- package/es6/src/commands/version.command.js +3 -3
- package/es6/src/const.js +0 -2
- package/es6/src/create-workspace.js +26 -0
- package/es6/src/errors.js +1 -3
- package/es6/src/extensions/project.extensions.js +5 -7
- package/es6/src/factories/swc-config.factory.js +29 -9
- package/es6/src/forge.module.js +15 -20
- package/es6/src/index.js +2 -2
- package/es6/src/packaging/dependency-pinner.service.js +103 -0
- package/es6/src/packaging/deployable.js +21 -0
- package/es6/src/packaging/import-graph.service.js +122 -0
- package/es6/src/packaging/release-exports.js +80 -0
- package/es6/src/packaging/ui-assets.js +49 -0
- package/es6/src/semver/index.js +1 -0
- package/es6/src/semver/semver.js +75 -0
- package/es6/src/services/dependency-resolver.service.js +70 -26
- package/es6/src/services/file-writer.service.js +2 -11
- package/es6/src/services/incremental-watch.js +18 -0
- package/es6/src/services/output-cache.js +29 -0
- package/es6/src/services/swc-transpiler.js +85 -99
- package/es6/src/services/transpile-cache.js +29 -0
- package/es6/src/services/ts-compiler-options.js +39 -0
- package/es6/src/services/ts-program-host.js +4 -6
- package/es6/src/services/type-emission-program.js +25 -10
- package/es6/src/services/type-emitter.js +57 -20
- package/es6/src/transpile/index.js +6 -0
- package/es6/src/types/build-target.type.js +0 -2
- package/es6/src/types/configuration.type.js +0 -2
- package/es6/src/types/dependency.types.js +0 -2
- package/es6/src/types/swc-config.type.js +0 -2
- package/es6/src/types/transform-response.model.js +0 -7
- package/es6/src/types/transformer.type.js +0 -2
- package/es6/src/types/workspace-config.type.js +0 -2
- package/es6/src/vitest/forge-build.plugin.js +27 -43
- package/es6/src/vitest/index.js +0 -2
- package/es6/src/workspace.config.js +26 -6
- package/package.json +21 -10
- package/types/src/actions/build.action.d.ts +4 -4
- package/types/src/actions/clean.action.d.ts +3 -3
- package/types/src/actions/commit.action.d.ts +3 -3
- package/types/src/actions/copy.action.d.ts +18 -3
- package/types/src/actions/dependency-report.action.d.ts +3 -3
- package/types/src/actions/dependency-sync.action.d.ts +3 -3
- package/types/src/actions/docker.action.d.ts +14 -3
- package/types/src/actions/index.d.ts +3 -0
- package/types/src/actions/link.action.d.ts +3 -3
- package/types/src/actions/package.action.d.ts +38 -0
- package/types/src/actions/paths.action.d.ts +28 -0
- package/types/src/actions/publish.action.d.ts +4 -4
- package/types/src/actions/sync-lock-file.action.d.ts +2 -2
- package/types/src/actions/tag.action.d.ts +3 -3
- package/types/src/actions/typecheck.action.d.ts +14 -0
- package/types/src/actions/unlink.action.d.ts +2 -2
- package/types/src/actions/version.action.d.ts +14 -4
- package/types/src/actions/watch.action.d.ts +3 -3
- package/types/src/commands/build.command.d.ts +3 -2
- package/types/src/commands/dependency.command.d.ts +2 -2
- package/types/src/commands/docker.command.d.ts +1 -1
- package/types/src/commands/forge.command.d.ts +2 -2
- package/types/src/commands/index.d.ts +3 -0
- package/types/src/commands/link.command.d.ts +3 -2
- package/types/src/commands/package.command.d.ts +11 -0
- package/types/src/commands/paths.command.d.ts +6 -0
- package/types/src/commands/publish.command.d.ts +1 -1
- package/types/src/commands/tag.command.d.ts +1 -1
- package/types/src/commands/typecheck.command.d.ts +6 -0
- package/types/src/commands/version.command.d.ts +1 -1
- package/types/src/create-workspace.d.ts +7 -0
- package/types/src/errors.d.ts +1 -1
- package/types/src/extensions/project.extensions.d.ts +2 -2
- package/types/src/factories/swc-config.factory.d.ts +3 -2
- package/types/src/forge.module.d.ts +10 -4
- package/types/src/index.d.ts +2 -0
- package/types/src/packaging/dependency-pinner.service.d.ts +20 -0
- package/types/src/packaging/deployable.d.ts +17 -0
- package/types/src/packaging/import-graph.service.d.ts +33 -0
- package/types/src/packaging/release-exports.d.ts +18 -0
- package/types/src/packaging/ui-assets.d.ts +21 -0
- package/types/src/semver/index.d.ts +1 -0
- package/types/src/semver/semver.d.ts +20 -0
- package/types/src/services/dependency-resolver.service.d.ts +8 -1
- package/types/src/services/file-writer.service.d.ts +1 -2
- package/types/src/services/incremental-watch.d.ts +13 -0
- package/types/src/services/output-cache.d.ts +10 -0
- package/types/src/services/swc-transpiler.d.ts +28 -15
- package/types/src/services/transpile-cache.d.ts +17 -0
- package/types/src/services/ts-compiler-options.d.ts +8 -0
- package/types/src/services/ts-program-host.d.ts +2 -2
- package/types/src/services/type-emission-program.d.ts +10 -3
- package/types/src/services/type-emitter.d.ts +21 -8
- package/types/src/transpile/index.d.ts +6 -0
- package/types/src/types/configuration.type.d.ts +6 -1
- package/types/src/types/dependency.types.d.ts +8 -9
- package/types/src/types/swc-config.type.d.ts +7 -1
- package/types/src/types/transform-response.model.d.ts +2 -7
- package/types/src/types/transformer.type.d.ts +3 -12
- package/types/src/types/workspace-config.type.d.ts +3 -3
- package/types/src/vitest/forge-build.plugin.d.ts +0 -2
- package/commonjs/src/actions/build.action.js +0 -116
- package/commonjs/src/actions/clean.action.js +0 -55
- package/commonjs/src/actions/commit.action.js +0 -87
- package/commonjs/src/actions/copy.action.js +0 -83
- package/commonjs/src/actions/dependency-report.action.js +0 -142
- package/commonjs/src/actions/dependency-sync.action.js +0 -100
- package/commonjs/src/actions/docker.action.js +0 -162
- package/commonjs/src/actions/index.js +0 -33
- package/commonjs/src/actions/link.action.js +0 -156
- package/commonjs/src/actions/publish.action.js +0 -156
- package/commonjs/src/actions/sync-lock-file.action.js +0 -43
- package/commonjs/src/actions/tag.action.js +0 -76
- package/commonjs/src/actions/unlink.action.js +0 -76
- package/commonjs/src/actions/version.action.js +0 -209
- package/commonjs/src/actions/watch.action.js +0 -51
- package/commonjs/src/commands/build.command.js +0 -49
- package/commonjs/src/commands/dependency.command.js +0 -88
- package/commonjs/src/commands/docker.command.js +0 -28
- package/commonjs/src/commands/forge.command.js +0 -24
- package/commonjs/src/commands/index.js +0 -27
- package/commonjs/src/commands/link.command.js +0 -89
- package/commonjs/src/commands/publish.command.js +0 -32
- package/commonjs/src/commands/tag.command.js +0 -28
- package/commonjs/src/commands/version.command.js +0 -36
- package/commonjs/src/const.js +0 -81
- package/commonjs/src/errors.js +0 -39
- package/commonjs/src/extensions/project.extensions.js +0 -94
- package/commonjs/src/factories/swc-config.factory.js +0 -98
- package/commonjs/src/forge.module.js +0 -115
- package/commonjs/src/index.js +0 -46
- package/commonjs/src/mixins/caches-outputs.mixin.js +0 -44
- package/commonjs/src/mixins/incremental-transform.mixin.js +0 -36
- package/commonjs/src/services/dependency-resolver.service.js +0 -172
- package/commonjs/src/services/file-writer.service.js +0 -232
- package/commonjs/src/services/swc-transpiler.js +0 -235
- package/commonjs/src/services/ts-program-host.js +0 -135
- package/commonjs/src/services/type-emission-program.js +0 -160
- package/commonjs/src/services/type-emitter.js +0 -141
- package/commonjs/src/types/build-target.type.js +0 -17
- package/commonjs/src/types/configuration.type.js +0 -6
- package/commonjs/src/types/dependency.types.js +0 -6
- package/commonjs/src/types/swc-config.type.js +0 -17
- package/commonjs/src/types/transform-response.model.js +0 -65
- package/commonjs/src/types/transformer.type.js +0 -13
- package/commonjs/src/types/workspace-config.type.js +0 -6
- package/commonjs/src/vitest/forge-build.plugin.js +0 -129
- package/commonjs/src/vitest/index.js +0 -13
- package/commonjs/src/workspace.config.js +0 -75
- package/es6/src/mixins/caches-outputs.mixin.js +0 -34
- package/es6/src/mixins/incremental-transform.mixin.js +0 -26
- package/types/src/mixins/caches-outputs.mixin.d.ts +0 -7
- package/types/src/mixins/incremental-transform.mixin.d.ts +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Workspace } from "@decohere/
|
|
2
|
-
import type { Action, ResultStatus } from "@decohere/
|
|
3
|
-
import { ActionResponse } from "@decohere/
|
|
1
|
+
import { Workspace } from "@decohere/workspace";
|
|
2
|
+
import type { Action, ResultStatus } from "@decohere/devkit/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
4
4
|
export type DockerOptions = {
|
|
5
5
|
configuration: string;
|
|
6
6
|
dryRun?: boolean;
|
|
@@ -19,9 +19,20 @@ export declare class Docker implements Action<DockerOptions> {
|
|
|
19
19
|
constructor(workspace: Workspace);
|
|
20
20
|
run(options: DockerOptions): Promise<ActionResponse<DockerResponse>>;
|
|
21
21
|
private getDockerProjects;
|
|
22
|
+
/**
|
|
23
|
+
* A Dockerfile that copies `.package/` needs `forge package` to have run. Fail before the
|
|
24
|
+
* build with that instruction rather than with Docker's "not found" from deep in a layer.
|
|
25
|
+
*/
|
|
26
|
+
private assertPackaged;
|
|
22
27
|
private buildProject;
|
|
23
28
|
private interpolateBuildArgs;
|
|
29
|
+
/**
|
|
30
|
+
* Keep FORGE_DOCKER_EXTRA_TAGS_JSON scoped to this image so multi-image
|
|
31
|
+
* publishes do not stamp create:latest onto the app Dev Container (and vice versa).
|
|
32
|
+
*/
|
|
33
|
+
private extraTagsForImage;
|
|
24
34
|
private defaultImageName;
|
|
25
35
|
private normalizeDockerRepository;
|
|
36
|
+
private normalizeProjectSlug;
|
|
26
37
|
private parseJsonEnv;
|
|
27
38
|
}
|
|
@@ -6,9 +6,12 @@ export * from "./dependency-report.action.js";
|
|
|
6
6
|
export * from "./dependency-sync.action.js";
|
|
7
7
|
export * from "./docker.action.js";
|
|
8
8
|
export * from "./link.action.js";
|
|
9
|
+
export * from "./package.action.js";
|
|
10
|
+
export * from "./paths.action.js";
|
|
9
11
|
export * from "./publish.action.js";
|
|
10
12
|
export * from "./sync-lock-file.action.js";
|
|
11
13
|
export * from "./tag.action.js";
|
|
14
|
+
export * from "./typecheck.action.js";
|
|
12
15
|
export * from "./unlink.action.js";
|
|
13
16
|
export * from "./version.action.js";
|
|
14
17
|
export * from "./watch.action.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Workspace } from "@decohere/
|
|
2
|
-
import type { Action } from "@decohere/
|
|
3
|
-
import { ActionResponse } from "@decohere/
|
|
1
|
+
import { Workspace } from "@decohere/workspace";
|
|
2
|
+
import type { Action } from "@decohere/devkit/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
4
4
|
import "../extensions/project.extensions.js";
|
|
5
5
|
export declare const LINK_MANIFEST = ".forge-link.json";
|
|
6
6
|
export type LinkOptions = {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/workspace";
|
|
2
|
+
import type { Action, ResultStatus } from "@decohere/devkit/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
4
|
+
import { DependencyPinner } from "../packaging/dependency-pinner.service.js";
|
|
5
|
+
import { ImportGraph } from "../packaging/import-graph.service.js";
|
|
6
|
+
export type PackageOptions = {
|
|
7
|
+
/** Package name of one deployable. Omit to package every project that has a Dockerfile. */
|
|
8
|
+
project?: string;
|
|
9
|
+
};
|
|
10
|
+
export type PackageResponse = ResultStatus & {
|
|
11
|
+
projectName: string;
|
|
12
|
+
outDir: string;
|
|
13
|
+
workspacePackages: string[];
|
|
14
|
+
dependencies: Record<string, string>;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Turns a deployable's release build into one self-contained folder that plain `node` runs:
|
|
19
|
+
* no symlinks, no workspace tooling. See ADR 0006.
|
|
20
|
+
*/
|
|
21
|
+
export declare class PackageDeployable implements Action<PackageOptions> {
|
|
22
|
+
#private;
|
|
23
|
+
private readonly workspace;
|
|
24
|
+
private readonly importGraph;
|
|
25
|
+
private readonly pinner;
|
|
26
|
+
private readonly npm;
|
|
27
|
+
constructor(workspace: Workspace, importGraph: ImportGraph, pinner: DependencyPinner);
|
|
28
|
+
run(options: PackageOptions): Promise<ActionResponse<PackageResponse>>;
|
|
29
|
+
/** The deployables to package, or the reason a named project cannot be one. */
|
|
30
|
+
private select;
|
|
31
|
+
private releaseProjects;
|
|
32
|
+
private packageProject;
|
|
33
|
+
private write;
|
|
34
|
+
/** Copies file contents, never links: a symlink in the output would break outside the image. */
|
|
35
|
+
private copyTree;
|
|
36
|
+
private writeJson;
|
|
37
|
+
private assertNoSymlinks;
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/workspace";
|
|
2
|
+
import type { Action } from "@decohere/devkit/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
4
|
+
export declare const PATHS_FILE = "tsconfig.paths.json";
|
|
5
|
+
export type PathsOptions = {
|
|
6
|
+
/** Fail if the file is missing or out of date, instead of writing it. */
|
|
7
|
+
check?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type PathsResponse = {
|
|
10
|
+
file: string;
|
|
11
|
+
changed: boolean;
|
|
12
|
+
succeeded: boolean;
|
|
13
|
+
error?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Writes `tsconfig.paths.json`: tsconfig `paths` for every workspace package and the subpaths it
|
|
17
|
+
* exports, from the workspace aliases. Without `node_modules` links, `tsc` finds workspace
|
|
18
|
+
* packages only through `paths`; generating them keeps them in step with what Flux, the Vitest
|
|
19
|
+
* plugin and builds resolve. The root tsconfig extends the file.
|
|
20
|
+
*/
|
|
21
|
+
export declare class Paths implements Action<PathsOptions> {
|
|
22
|
+
#private;
|
|
23
|
+
private readonly workspace;
|
|
24
|
+
constructor(workspace: Workspace);
|
|
25
|
+
run(options: PathsOptions): Promise<ActionResponse<PathsResponse>>;
|
|
26
|
+
/** The file's content: convention and exported subpaths only, never the tsconfig's own paths. */
|
|
27
|
+
static render(workspace: Workspace): string;
|
|
28
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Project } from "@decohere/
|
|
2
|
-
import { Workspace } from "@decohere/
|
|
3
|
-
import type { Action, ResultStatus } from "@decohere/
|
|
4
|
-
import { ActionResponse } from "@decohere/
|
|
1
|
+
import type { Project } from "@decohere/workspace";
|
|
2
|
+
import { Workspace } from "@decohere/workspace";
|
|
3
|
+
import type { Action, ResultStatus } from "@decohere/devkit/cli";
|
|
4
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
5
5
|
export type PublishOptions = {
|
|
6
6
|
configuration: string;
|
|
7
7
|
channel?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Action } from "@decohere/
|
|
2
|
-
import { ActionResponse } from "@decohere/
|
|
1
|
+
import type { Action } from "@decohere/devkit/cli";
|
|
2
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
3
3
|
export type SyncLockFileOptions = {
|
|
4
4
|
sync?: boolean;
|
|
5
5
|
dryRun?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Workspace } from "@decohere/
|
|
2
|
-
import type { Action } from "@decohere/
|
|
3
|
-
import { ActionResponse } from "@decohere/
|
|
1
|
+
import { Workspace } from "@decohere/workspace";
|
|
2
|
+
import type { Action } from "@decohere/devkit/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
4
4
|
export type TagOptions = {
|
|
5
5
|
prefix?: string;
|
|
6
6
|
dryRun?: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Workspace } from "@decohere/workspace";
|
|
2
|
+
import type { Action } from "@decohere/devkit/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
4
|
+
import { TypeEmitter } from "../services/type-emitter.js";
|
|
5
|
+
export type TypeCheckOptions = {
|
|
6
|
+
configuration: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class TypeCheck implements Action<TypeCheckOptions> {
|
|
9
|
+
#private;
|
|
10
|
+
private readonly workspace;
|
|
11
|
+
private readonly typeEmitter;
|
|
12
|
+
constructor(workspace: Workspace, typeEmitter: TypeEmitter);
|
|
13
|
+
run: (options: TypeCheckOptions) => Promise<ActionResponse>;
|
|
14
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Action } from "@decohere/
|
|
2
|
-
import { ActionResponse } from "@decohere/
|
|
1
|
+
import type { Action } from "@decohere/devkit/cli";
|
|
2
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
3
3
|
export type UnlinkOptions = {
|
|
4
4
|
targetDir: string;
|
|
5
5
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Workspace } from "@decohere/
|
|
2
|
-
import type { Action, ResultStatus } from "@decohere/
|
|
3
|
-
import { ActionResponse } from "@decohere/
|
|
4
|
-
import { type VersionType } from "
|
|
1
|
+
import { Workspace } from "@decohere/workspace";
|
|
2
|
+
import type { Action, ResultStatus } from "@decohere/devkit/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
4
|
+
import { type VersionType } from "../semver/index.js";
|
|
5
5
|
export type VersionResponse = ResultStatus & {
|
|
6
6
|
name: string;
|
|
7
7
|
};
|
|
@@ -11,6 +11,12 @@ export type VersionOptions = {
|
|
|
11
11
|
releaseType?: VersionType;
|
|
12
12
|
channel?: string;
|
|
13
13
|
version?: string;
|
|
14
|
+
/** A CI run number: the version becomes `<base>-<channel>.<commit's UTC date>.<number>`. */
|
|
15
|
+
buildNumber?: string;
|
|
16
|
+
/** Copy the version from the built packages, failing if they don't all match. */
|
|
17
|
+
fromBuild?: boolean;
|
|
18
|
+
/** The build `fromBuild` reads. */
|
|
19
|
+
configuration?: string;
|
|
14
20
|
dryRun?: boolean;
|
|
15
21
|
commit?: boolean;
|
|
16
22
|
message?: string;
|
|
@@ -23,6 +29,10 @@ export declare class Version implements Action<VersionOptions> {
|
|
|
23
29
|
constructor(workspace: Workspace);
|
|
24
30
|
run(options: VersionOptions): Promise<ActionResponse>;
|
|
25
31
|
version(workspace: Workspace, options?: VersionOptions): Promise<ActionResponse<VersionResponse>>;
|
|
32
|
+
private resolveNextVersion;
|
|
33
|
+
private versionFromBuildNumber;
|
|
34
|
+
private versionFromBuild;
|
|
35
|
+
private readBuiltVersion;
|
|
26
36
|
private resolveBaseVersion;
|
|
27
37
|
private resolveVersionFromGitTag;
|
|
28
38
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Workspace } from "@decohere/
|
|
2
|
-
import type { Action } from "@decohere/
|
|
3
|
-
import { ActionResponse } from "@decohere/
|
|
1
|
+
import { Workspace } from "@decohere/workspace";
|
|
2
|
+
import type { Action } from "@decohere/devkit/cli";
|
|
3
|
+
import { ActionResponse } from "@decohere/devkit/cli";
|
|
4
4
|
export type WatchOptions = {
|
|
5
5
|
watch: boolean;
|
|
6
6
|
configuration: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MergeOptions } from "@decohere/
|
|
2
|
-
import { CommandResponse, DecohereCommand } from "@decohere/
|
|
1
|
+
import type { MergeOptions } from "@decohere/devkit/cli";
|
|
2
|
+
import { CommandResponse, DecohereCommand } from "@decohere/devkit/cli";
|
|
3
3
|
import type { Build } from "../actions/build.action.js";
|
|
4
4
|
import type { Clean } from "../actions/clean.action.js";
|
|
5
5
|
import type { Copy } from "../actions/copy.action.js";
|
|
@@ -12,5 +12,6 @@ export type BuildActions = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare class BuildCommand extends DecohereCommand<BuildActions> {
|
|
14
14
|
constructor(name?: string);
|
|
15
|
+
runsUntilStopped(options: Record<string, unknown>): boolean;
|
|
15
16
|
run: (actions: BuildActions, options: MergeOptions<BuildActions>) => Promise<CommandResponse<BuildActions>>;
|
|
16
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CommandHandler } from "@decohere/
|
|
2
|
-
import { DecohereCommand } from "@decohere/
|
|
1
|
+
import type { CommandHandler } from "@decohere/devkit/cli";
|
|
2
|
+
import { DecohereCommand } from "@decohere/devkit/cli";
|
|
3
3
|
export declare class DependencyCommand extends DecohereCommand {
|
|
4
4
|
constructor(name?: string, handler?: CommandHandler);
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Actions } from "@decohere/
|
|
2
|
-
import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/
|
|
1
|
+
import type { Actions } from "@decohere/devkit/cli";
|
|
2
|
+
import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/devkit/cli";
|
|
3
3
|
export declare class ForgeCommand extends DecohereCommand {
|
|
4
4
|
constructor(commands: Record<string, CommandType>, handler: CommandHandler);
|
|
5
5
|
run(_actions: Actions, _options: never): Promise<CommandResponse>;
|
|
@@ -3,6 +3,9 @@ export * from "./dependency.command.js";
|
|
|
3
3
|
export * from "./docker.command.js";
|
|
4
4
|
export * from "./forge.command.js";
|
|
5
5
|
export * from "./link.command.js";
|
|
6
|
+
export * from "./package.command.js";
|
|
7
|
+
export * from "./paths.command.js";
|
|
6
8
|
export * from "./publish.command.js";
|
|
7
9
|
export * from "./tag.command.js";
|
|
10
|
+
export * from "./typecheck.command.js";
|
|
8
11
|
export * from "./version.command.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CommandHandler, MergeOptions } from "@decohere/
|
|
2
|
-
import { CommandResponse, DecohereCommand } from "@decohere/
|
|
1
|
+
import type { CommandHandler, MergeOptions } from "@decohere/devkit/cli";
|
|
2
|
+
import { CommandResponse, DecohereCommand } from "@decohere/devkit/cli";
|
|
3
3
|
import { Build } from "../actions/build.action.js";
|
|
4
4
|
import { Clean } from "../actions/clean.action.js";
|
|
5
5
|
import { Copy } from "../actions/copy.action.js";
|
|
@@ -19,6 +19,7 @@ type UnlinkActions = {
|
|
|
19
19
|
export declare class LinkCommand extends DecohereCommand<LinkActions> {
|
|
20
20
|
get actions(): (typeof Build | typeof Clean | typeof Copy | typeof Link | typeof Watch)[];
|
|
21
21
|
constructor(name?: string);
|
|
22
|
+
runsUntilStopped(options: Record<string, unknown>): boolean;
|
|
22
23
|
run: (actions: LinkActions, options: MergeOptions<LinkActions>) => Promise<CommandResponse<LinkActions>>;
|
|
23
24
|
}
|
|
24
25
|
export declare class UnlinkCommand extends DecohereCommand<UnlinkActions> {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DecohereCommand } from "@decohere/devkit/cli";
|
|
2
|
+
import { PackageDeployable } from "../actions/package.action.js";
|
|
3
|
+
export declare class PackageCommand extends DecohereCommand {
|
|
4
|
+
get actions(): (typeof PackageDeployable)[];
|
|
5
|
+
constructor(name: string);
|
|
6
|
+
/**
|
|
7
|
+
* Commander passes the positional before the options; the CLI host reads only options,
|
|
8
|
+
* so the project name is stashed on them.
|
|
9
|
+
*/
|
|
10
|
+
action(fn: (...args: any[]) => void | Promise<void>): this;
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Workspace } from "@decohere/workspace";
|
|
2
|
+
import type { WorkspaceFactoryOptions } from "@decohere/devkit/cli";
|
|
3
|
+
/**
|
|
4
|
+
* The workspace every Decohere tool sees (forge, the flux CLI and `flux.run`): forge's
|
|
5
|
+
* defaults, the user's `.decohere.js`, and the root: `--root-dir`, else the current folder.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createWorkspace(options?: WorkspaceFactoryOptions): Promise<Workspace>;
|
package/types/src/errors.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Project } from "@decohere/
|
|
1
|
+
import { Project } from "@decohere/workspace";
|
|
2
2
|
import type { ForgeConfiguration } from "../types/configuration.type.js";
|
|
3
3
|
import { SwcConfig } from "../types/swc-config.type.js";
|
|
4
|
-
declare module "@decohere/
|
|
4
|
+
declare module "@decohere/workspace" {
|
|
5
5
|
interface Project {
|
|
6
6
|
getForgeConfiguration(): ForgeConfiguration;
|
|
7
7
|
getSwcConfig(): Promise<SwcConfig>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileEx } from "@decohere/
|
|
1
|
+
import type { FileEx } from "@decohere/core/io";
|
|
2
2
|
import type { Options } from "@swc/core";
|
|
3
3
|
import type { TranspileTarget } from "../types/build-target.type.js";
|
|
4
4
|
import type { SwcConfigOptions } from "../types/swc-config.type.js";
|
|
@@ -8,8 +8,9 @@ export declare class SwcConfigFactory {
|
|
|
8
8
|
* Call once per (project, target) and then use createFileConfig() per file.
|
|
9
9
|
*/
|
|
10
10
|
createBaseConfig(buildTarget: TranspileTarget, configOptions: SwcConfigOptions): Options;
|
|
11
|
-
/** Stamps a per-file filename onto a pre-built base config. */
|
|
11
|
+
/** Stamps a per-file filename onto a pre-built base config; `.tsx` also turns on JSX. */
|
|
12
12
|
createFileConfig(file: FileEx, baseConfig: Options): Options;
|
|
13
|
+
private static nonemptyPaths;
|
|
13
14
|
/**
|
|
14
15
|
* Validates SWC options against known causes of Rust/NAPI process crashes.
|
|
15
16
|
* Throws a ForgeError with a descriptive message instead of letting the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { WorkspaceFactoryOptions } from "@decohere/
|
|
2
|
-
import { ModuleManifest } from "@decohere/
|
|
3
|
-
import type { ContainerBuilder } from "@decohere/
|
|
1
|
+
import type { WorkspaceFactoryOptions } from "@decohere/devkit/cli";
|
|
2
|
+
import { ModuleManifest } from "@decohere/devkit/cli";
|
|
3
|
+
import type { ContainerBuilder } from "@decohere/core/composition";
|
|
4
4
|
import * as Actions from "./actions/index.js";
|
|
5
5
|
import * as Commands from "./commands/index.js";
|
|
6
6
|
export declare class ForgeModule extends ModuleManifest {
|
|
@@ -10,6 +10,7 @@ export declare class ForgeModule extends ModuleManifest {
|
|
|
10
10
|
clean: typeof Actions.Clean;
|
|
11
11
|
copy: typeof Actions.Copy;
|
|
12
12
|
docker: typeof Actions.Docker;
|
|
13
|
+
package: typeof Actions.PackageDeployable;
|
|
13
14
|
build: typeof Actions.Build;
|
|
14
15
|
watch: typeof Actions.Watch;
|
|
15
16
|
publish: typeof Actions.Publish;
|
|
@@ -18,6 +19,8 @@ export declare class ForgeModule extends ModuleManifest {
|
|
|
18
19
|
reportDependencies: typeof Actions.ReportDependencies;
|
|
19
20
|
version: typeof Actions.Version;
|
|
20
21
|
tag: typeof Actions.Tag;
|
|
22
|
+
paths: typeof Actions.Paths;
|
|
23
|
+
typecheck: typeof Actions.TypeCheck;
|
|
21
24
|
commitFiles: typeof Actions.CommitFiles;
|
|
22
25
|
link: typeof Actions.Link;
|
|
23
26
|
unlink: typeof Actions.Unlink;
|
|
@@ -27,11 +30,14 @@ export declare class ForgeModule extends ModuleManifest {
|
|
|
27
30
|
publish: typeof Commands.PublishCommand;
|
|
28
31
|
dependencies: typeof Commands.DependencyCommand;
|
|
29
32
|
docker: typeof Commands.DockerCommand;
|
|
33
|
+
package: typeof Commands.PackageCommand;
|
|
30
34
|
version: typeof Commands.VersionCommand;
|
|
31
35
|
tag: typeof Commands.TagCommand;
|
|
36
|
+
paths: typeof Commands.PathsCommand;
|
|
37
|
+
typecheck: typeof Commands.TypeCheckCommand;
|
|
32
38
|
link: typeof Commands.LinkCommand;
|
|
33
39
|
unlink: typeof Commands.UnlinkCommand;
|
|
34
40
|
};
|
|
35
41
|
registerServices(builder: ContainerBuilder): void;
|
|
36
|
-
createWorkspace(options: WorkspaceFactoryOptions): Promise<import("@decohere/
|
|
42
|
+
createWorkspace(options: WorkspaceFactoryOptions): Promise<import("@decohere/workspace").Workspace>;
|
|
37
43
|
}
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export { createWorkspace } from "./create-workspace.js";
|
|
1
2
|
export { ForgeError } from "./errors.js";
|
|
2
3
|
export { ForgeModule } from "./forge.module.js";
|
|
3
4
|
export type { TranspileOptions } from "./services/swc-transpiler.js";
|
|
4
5
|
export { SwcTranspiler } from "./services/swc-transpiler.js";
|
|
6
|
+
export { transpileCache } from "./services/transpile-cache.js";
|
|
5
7
|
export type { BuildTarget, TranspileTarget } from "./types/build-target.type.js";
|
|
6
8
|
export { BuildTargets } from "./types/build-target.type.js";
|
|
7
9
|
export type { ForgeConfiguration } from "./types/configuration.type.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PackageJson } from "@decohere/workspace";
|
|
2
|
+
import type { ReachedPackages, ReleaseProject } from "./import-graph.service.js";
|
|
3
|
+
/**
|
|
4
|
+
* Chooses the third-party `dependencies` for the packaged `package.json`: the union of
|
|
5
|
+
* `dependencies` (never devDependencies) of the deployable, every library copied in, and the
|
|
6
|
+
* workspace root. Declared is shipped, whether or not code imports it (a runtime-loaded pino
|
|
7
|
+
* transport, say), so removing an unused dependency is the author's job. Each is pinned to the
|
|
8
|
+
* exact version installed in the workspace, so the image runs what the tests ran.
|
|
9
|
+
*
|
|
10
|
+
* Code that imports a third-party package nothing ships is a crash waiting to happen, so that
|
|
11
|
+
* is an error: the package is only a devDependency, or declared nowhere.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DependencyPinner {
|
|
14
|
+
pin(imported: ReachedPackages["thirdParty"], shipped: readonly ReleaseProject[], projects: ReadonlyMap<string, ReleaseProject>, workspaceRoot: {
|
|
15
|
+
dir: string;
|
|
16
|
+
pkg: PackageJson;
|
|
17
|
+
}): Promise<Record<string, string>>;
|
|
18
|
+
private assertImportsAreShipped;
|
|
19
|
+
private installedVersion;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Project } from "@decohere/workspace";
|
|
2
|
+
/** Where `forge package` writes a deployable's output: inside the project, the Docker build context. */
|
|
3
|
+
export declare const PACKAGE_DIR = ".package";
|
|
4
|
+
/**
|
|
5
|
+
* A deployable is a project with a Dockerfile: `docker.dockerfile` from `.decohere.js`,
|
|
6
|
+
* or `Dockerfile` in the project folder. `forge docker` and `forge package` share this
|
|
7
|
+
* rule so they always agree on which projects are deployables.
|
|
8
|
+
*/
|
|
9
|
+
declare function dockerfileName(project: Project): string;
|
|
10
|
+
declare function dockerfilePath(project: Project): string;
|
|
11
|
+
declare function isDeployable(project: Project): Promise<boolean>;
|
|
12
|
+
export declare const deployable: {
|
|
13
|
+
dockerfileName: typeof dockerfileName;
|
|
14
|
+
dockerfilePath: typeof dockerfilePath;
|
|
15
|
+
isDeployable: typeof isDeployable;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PackageJson } from "@decohere/workspace";
|
|
2
|
+
/** A workspace project as the packager sees it: its manifest and its release build. */
|
|
3
|
+
export type ReleaseProject = {
|
|
4
|
+
/** The package name, e.g. `@app/kernel`. */
|
|
5
|
+
name: string;
|
|
6
|
+
pkg: PackageJson;
|
|
7
|
+
/** Absolute path of the project folder (source). */
|
|
8
|
+
projectRoot: string;
|
|
9
|
+
/** Absolute path of the project's release output (holds `es6/`). */
|
|
10
|
+
releaseDir: string;
|
|
11
|
+
};
|
|
12
|
+
export type ReachedPackages = {
|
|
13
|
+
/** Workspace packages the entry reaches, including the entry's own project. */
|
|
14
|
+
workspace: Set<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Third-party package name to the workspace packages whose code imports it. Not what
|
|
17
|
+
* ships (declared dependencies do); only used to fail on an import nothing ships.
|
|
18
|
+
*/
|
|
19
|
+
thirdParty: Map<string, Set<string>>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Walks the compiled (release) import graph from a deployable's entry point and reports which
|
|
23
|
+
* workspace and third-party packages the code actually reaches. Code that nothing imports (a
|
|
24
|
+
* library's `testing/` folder, say) is never opened, so its dependencies are not collected.
|
|
25
|
+
*/
|
|
26
|
+
export declare class ImportGraph {
|
|
27
|
+
#private;
|
|
28
|
+
walk(entry: ReleaseProject, projects: ReadonlyMap<string, ReleaseProject>): Promise<ReachedPackages>;
|
|
29
|
+
private follow;
|
|
30
|
+
private importsOf;
|
|
31
|
+
/** Compiled output keeps explicit `.js` paths; tolerate extensionless and folder imports. */
|
|
32
|
+
private resolveRelative;
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type PackageJson } from "@decohere/workspace";
|
|
2
|
+
/** Release `exports`: subpath (`.`, `./testing`) to a file path inside the release output. */
|
|
3
|
+
export type ReleaseExports = Record<string, string>;
|
|
4
|
+
/** `src/main.ts` becomes `src/main.js` (`.mts` `.mjs`, `.cts` `.cjs`), with any leading `./` dropped. */
|
|
5
|
+
declare function toJs(filePath: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* The `exports` a library needs once only its `es6/` output is shipped: the library's own
|
|
8
|
+
* map (or its `main`) with every path pointed at `./es6/...js`.
|
|
9
|
+
*/
|
|
10
|
+
declare function build(pkg: PackageJson): ReleaseExports;
|
|
11
|
+
/** The file one subpath (`""` for the package root, `/testing`) points at, or undefined. */
|
|
12
|
+
declare function resolve(exports: ReleaseExports, subpath: string): string | undefined;
|
|
13
|
+
export declare const releaseExports: {
|
|
14
|
+
build: typeof build;
|
|
15
|
+
resolve: typeof resolve;
|
|
16
|
+
toJs: typeof toJs;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Project } from "@decohere/workspace";
|
|
2
|
+
export declare const DEFAULT_UI_OUTPUT = "dist";
|
|
3
|
+
export declare const DEFAULT_UI_TARGET = "ui";
|
|
4
|
+
export type UiAssets = {
|
|
5
|
+
/** The UI project's name. */
|
|
6
|
+
project: string;
|
|
7
|
+
/** Absolute path of the built UI. */
|
|
8
|
+
from: string;
|
|
9
|
+
/** Folder name inside `.package/`. */
|
|
10
|
+
to: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* What the deployable's `ui` declaration (`.decohere.js`) asks for, checked before anything
|
|
14
|
+
* is written: the UI project exists and has been built. Forge does not build it (see ADR 0007).
|
|
15
|
+
* Returns `undefined` when the deployable declares no UI.
|
|
16
|
+
*/
|
|
17
|
+
declare function resolve(deployable: Project, projects: readonly Project[]): Promise<UiAssets | undefined>;
|
|
18
|
+
export declare const uiAssets: {
|
|
19
|
+
resolve: typeof resolve;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./semver.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type VersionType = "major" | "minor" | "patch" | "prerelease";
|
|
2
|
+
export declare const VersionTypes: {
|
|
3
|
+
major: "major";
|
|
4
|
+
minor: "minor";
|
|
5
|
+
patch: "patch";
|
|
6
|
+
prerelease: "prerelease";
|
|
7
|
+
};
|
|
8
|
+
export declare class SemverError extends Error {
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class Semver {
|
|
12
|
+
private version;
|
|
13
|
+
constructor(version: string);
|
|
14
|
+
increment(versionType: VersionType, preid?: string): Semver;
|
|
15
|
+
/** This version's major.minor.patch with `prerelease` in place of any it has now. */
|
|
16
|
+
withPrerelease(prerelease: string): Semver;
|
|
17
|
+
toString(): string;
|
|
18
|
+
private ensureValid;
|
|
19
|
+
private parse;
|
|
20
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PackageJson, Project, Workspace } from "@decohere/
|
|
1
|
+
import type { PackageJson, Project, Workspace } from "@decohere/workspace";
|
|
2
2
|
import type { DependencyWarning, DriftEntry, Package } from "../types/dependency.types.js";
|
|
3
3
|
export type ProjectDependencies = {
|
|
4
4
|
project: Project;
|
|
@@ -9,6 +9,13 @@ export declare class DependencyResolver {
|
|
|
9
9
|
computeDrift(current: PackageJson, computed: PackageJson): DriftEntry | null;
|
|
10
10
|
getWorkspacePackages(workspace: Workspace, projects: readonly Project[]): Promise<Map<string, Package>>;
|
|
11
11
|
computeProjectDependencies(project: Project, workspacePackages: Map<string, Package>): Promise<ProjectDependencies>;
|
|
12
|
+
/**
|
|
13
|
+
* A package declares its peers by name in its own `peerDependencies` (and marks optional ones in
|
|
14
|
+
* `peerDependenciesMeta`, which sync leaves as written). The root owns every version, so each
|
|
15
|
+
* peer gets the root's range; a peer the root doesn't list is an error. A declared peer stays
|
|
16
|
+
* even when no code imports it: a pino transport, say, is loaded by name.
|
|
17
|
+
*/
|
|
18
|
+
private getPeerDependencies;
|
|
12
19
|
private getDependencies;
|
|
13
20
|
private getDependencyFrom;
|
|
14
21
|
private getFileImports;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { Project } from "@decohere/
|
|
1
|
+
import type { Project } from "@decohere/workspace";
|
|
2
2
|
import "../extensions/project.extensions.js";
|
|
3
3
|
import type { TransformResponse } from "../types/transform-response.model.js";
|
|
4
4
|
export declare class FileWriterService {
|
|
5
5
|
#private;
|
|
6
|
-
initialize(): Promise<void>;
|
|
7
6
|
warmup(projects: Project[]): Promise<void>;
|
|
8
7
|
enqueueOutput(response: TransformResponse): void;
|
|
9
8
|
enqueueOutputs(responses: TransformResponse[]): void;
|