@travetto/manifest 5.0.3 → 5.0.5
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 +2 -1
- package/package.json +1 -1
- package/src/context.ts +10 -8
- package/src/types/context.ts +2 -0
- package/src/types/package.ts +1 -0
package/README.md
CHANGED
|
@@ -91,7 +91,8 @@ By default, all paths within the framework are assumed to be in a POSIX style, a
|
|
|
91
91
|
"compilerUrl": "http://127.0.0.1:26803",
|
|
92
92
|
"compilerModuleFolder": "module/compiler",
|
|
93
93
|
"outputFolder": ".trv/output",
|
|
94
|
-
"toolFolder": ".trv/tool"
|
|
94
|
+
"toolFolder": ".trv/tool",
|
|
95
|
+
"typesFolder": ".trv/types"
|
|
95
96
|
},
|
|
96
97
|
"main": {
|
|
97
98
|
"name": "@travetto/manifest",
|
package/package.json
CHANGED
package/src/context.ts
CHANGED
|
@@ -17,6 +17,7 @@ type Workspace = Pkg<{
|
|
|
17
17
|
const TOOL_FOLDER = '.trv/tool';
|
|
18
18
|
const COMPILER_FOLDER = '.trv/compiler';
|
|
19
19
|
const OUTPUT_FOLDER = '.trv/output';
|
|
20
|
+
const TYPES_FOLDER = '.trv/types';
|
|
20
21
|
|
|
21
22
|
const WS_ROOT: Record<string, Workspace> = {};
|
|
22
23
|
|
|
@@ -52,14 +53,15 @@ function findPackage(dir: string): Pkg {
|
|
|
52
53
|
* Get workspace root
|
|
53
54
|
*/
|
|
54
55
|
function resolveWorkspace(base: string = process.cwd()): Workspace {
|
|
55
|
-
if (base in WS_ROOT) {
|
|
56
|
+
if (base in WS_ROOT) {
|
|
57
|
+
return WS_ROOT[base];
|
|
58
|
+
}
|
|
56
59
|
let folder = base;
|
|
57
|
-
let prev;
|
|
58
|
-
|
|
59
|
-
let prevPkg, pkg;
|
|
60
|
+
let prev: string | undefined;
|
|
61
|
+
let pkg: Pkg | undefined;
|
|
60
62
|
|
|
61
63
|
while (prev !== folder) {
|
|
62
|
-
|
|
64
|
+
prev = folder;
|
|
63
65
|
pkg = readPackage(folder) ?? pkg;
|
|
64
66
|
if (
|
|
65
67
|
(pkg && (!!pkg.workspaces || !!pkg.travetto?.build?.isolated)) || // if we have a monorepo root, or we are isolated
|
|
@@ -81,7 +83,7 @@ function resolveWorkspace(base: string = process.cwd()): Workspace {
|
|
|
81
83
|
manager: existsSync(path.resolve(pkg.path, 'yarn.lock')) ? 'yarn' : 'npm',
|
|
82
84
|
resolve: createRequire(`${pkg.path}/node_modules`).resolve.bind(null),
|
|
83
85
|
stripRoot: (full) => full === pkg.path ? '' : full.replace(`${pkg.path}/`, ''),
|
|
84
|
-
mono: !!pkg.workspaces
|
|
86
|
+
mono: !!pkg.workspaces
|
|
85
87
|
};
|
|
86
88
|
}
|
|
87
89
|
|
|
@@ -133,7 +135,6 @@ export function getManifestContext(folder?: string): ManifestContext {
|
|
|
133
135
|
const workspace = resolveWorkspace();
|
|
134
136
|
const mod = resolveModule(workspace, folder);
|
|
135
137
|
const build = workspace.travetto?.build ?? {};
|
|
136
|
-
const toolFolder = build.toolFolder ?? TOOL_FOLDER;
|
|
137
138
|
|
|
138
139
|
return {
|
|
139
140
|
workspace: {
|
|
@@ -149,7 +150,8 @@ export function getManifestContext(folder?: string): ManifestContext {
|
|
|
149
150
|
compilerUrl: build.compilerUrl ?? getCompilerUrl(workspace),
|
|
150
151
|
compilerModuleFolder: workspace.stripRoot(path.dirname(workspace.resolve('@travetto/compiler/package.json'))),
|
|
151
152
|
outputFolder: build.outputFolder ?? OUTPUT_FOLDER,
|
|
152
|
-
toolFolder
|
|
153
|
+
toolFolder: build.toolFolder ?? TOOL_FOLDER,
|
|
154
|
+
typesFolder: build.typesFolder ?? TYPES_FOLDER
|
|
153
155
|
},
|
|
154
156
|
main: {
|
|
155
157
|
name: mod.name ?? 'untitled',
|
package/src/types/context.ts
CHANGED