@decohere/workspace 0.0.1-dev.20261123.374 → 0.0.1-dev.20261123.401
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 +23 -1
- package/es6/src/factories/project.factory.js +15 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -47,7 +47,18 @@ export default {
|
|
|
47
47
|
};
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
Per-project settings go under `projects`, keyed by package name: `docker` (image, Dockerfile, tags, build args)
|
|
50
|
+
Per-project settings go under `projects`, keyed by package name: `docker` (image, Dockerfile, tags, build args), `ui` (the UI project a deployable ships, see [forge](../forge/README.md#shipping-the-ui-with-the-api)), and `ignore` and `copyFiles`, which **add** to the workspace's lists:
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
// Files the package copies at run time: not compiled, not scanned for dependencies, shipped as they are.
|
|
54
|
+
export default {
|
|
55
|
+
projects: {
|
|
56
|
+
"@app/tool": { ignore: ["templates/**"], copyFiles: ["templates/**", "templates/**/.*", "templates/**/.*/**"] },
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Globs skip dotfiles unless a segment starts with a dot, hence the last two patterns.
|
|
51
62
|
|
|
52
63
|
### A project's own scripts
|
|
53
64
|
|
|
@@ -94,3 +105,14 @@ const aliases = workspace.getPackageAliases("debug");
|
|
|
94
105
|
A tool with defaults of its own passes them as the second argument, `WorkspaceFactory.create(options, defaults)`, so `.decohere.js` can override them. Anything in `options` overrides the user's file.
|
|
95
106
|
|
|
96
107
|
Pass a pre-built `workspace` into Forge/Flux in tests to skip filesystem discovery.
|
|
108
|
+
|
|
109
|
+
## Working on this package
|
|
110
|
+
|
|
111
|
+
For contributors to Decohere: how the package is laid out and tested. Using it needs nothing below.
|
|
112
|
+
|
|
113
|
+
`src/` has two folders:
|
|
114
|
+
|
|
115
|
+
- `models/`: the workspace and its projects (`workspace.model.ts`, `project.model.ts`), their `package.json` and `tsconfig` models with the mixins that give a project them, package aliases, project scripts, source extensions, and JSONC parsing. They keep `.model.ts`, since they model files, not a business domain ([ADR 0027](../../docs/contributing/adr/0027-code-design.md)).
|
|
116
|
+
- `factories/`: `ProjectFactory`, plus `WorkspaceFactory` and `UserConfigFactory` (which loads `.decohere.js`); those two are exported as instances today, not classes.
|
|
117
|
+
|
|
118
|
+
There is no canonical suite for workspace in the [testing table](../../docs/contributing/testing/README.md#canonical-suite-ownership): it is exercised through the forge and flux CLI suites in `projects/cli/tests/`. Its own specs, in `tests/`, cover the factories and models in memfs, and move beside the code.
|
|
@@ -6,6 +6,10 @@ import { PACKAGE_JSON, PROJECTS_DIR, WorkspaceDefaults } from "../const.js";
|
|
|
6
6
|
import { WorkspaceConfigurationError } from "../errors.js";
|
|
7
7
|
import { PackageJson } from "../models/package-json.model.js";
|
|
8
8
|
import { Project } from "../models/project.model.js";
|
|
9
|
+
/** A project's own `ignore` and `copyFiles` (under `projects` in `.decohere.js`) add to the workspace's. */ const PROJECT_ADDITIVE = [
|
|
10
|
+
"ignore",
|
|
11
|
+
"copyFiles"
|
|
12
|
+
];
|
|
9
13
|
export class ProjectFactory {
|
|
10
14
|
static async getProjectSeeds(config) {
|
|
11
15
|
const { includeProjects, ignoreProjects, rootDir } = config;
|
|
@@ -75,12 +79,22 @@ export class ProjectFactory {
|
|
|
75
79
|
const name = packageJsonData.name;
|
|
76
80
|
const packageJson = new PackageJson(packageJsonData);
|
|
77
81
|
const projectDir = path.dirname(file.relativePath);
|
|
82
|
+
const own = config?.projects?.[name] ?? {};
|
|
78
83
|
const mergedConfig = merge.withOptions({
|
|
79
84
|
mergeArrays: false
|
|
80
|
-
}, config,
|
|
85
|
+
}, config, own, {
|
|
81
86
|
projectDir,
|
|
82
87
|
packageJson
|
|
83
88
|
});
|
|
89
|
+
// A project's own lists add to the workspace's, so it names only what it leaves out or adds.
|
|
90
|
+
for (const key of PROJECT_ADDITIVE){
|
|
91
|
+
mergedConfig[key] = [
|
|
92
|
+
...new Set([
|
|
93
|
+
...config[key] ?? [],
|
|
94
|
+
...own[key] ?? []
|
|
95
|
+
])
|
|
96
|
+
];
|
|
97
|
+
}
|
|
84
98
|
return {
|
|
85
99
|
name,
|
|
86
100
|
config: mergedConfig
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decohere/workspace",
|
|
3
|
-
"version": "0.0.1-dev.20261123.
|
|
3
|
+
"version": "0.0.1-dev.20261123.401",
|
|
4
4
|
"description": "Workspace and project model primitives for monorepo tooling",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@decohere/core": "0.0.1-dev.20261123.
|
|
36
|
-
"@decohere/crucible": "0.0.1-dev.20261123.
|
|
37
|
-
"@decohere/devkit": "0.0.1-dev.20261123.
|
|
35
|
+
"@decohere/core": "0.0.1-dev.20261123.401",
|
|
36
|
+
"@decohere/crucible": "0.0.1-dev.20261123.401",
|
|
37
|
+
"@decohere/devkit": "0.0.1-dev.20261123.401",
|
|
38
38
|
"get-tsconfig": "^4.14.3",
|
|
39
39
|
"picomatch": "^4.0.4"
|
|
40
40
|
},
|