@teambit/workspace-root 0.0.1
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/.npmignore +18 -0
- package/dist/clone.cmd.d.ts +27 -0
- package/dist/clone.cmd.js +67 -0
- package/dist/clone.cmd.js.map +1 -0
- package/dist/clone.d.ts +103 -0
- package/dist/clone.js +548 -0
- package/dist/clone.js.map +1 -0
- package/dist/clone.spec.d.ts +1 -0
- package/dist/clone.spec.js +419 -0
- package/dist/clone.spec.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/preview-1790106115091.js +7 -0
- package/dist/workspace-root-data.d.ts +42 -0
- package/dist/workspace-root-data.js +82 -0
- package/dist/workspace-root-data.js.map +1 -0
- package/dist/workspace-root-data.spec.d.ts +1 -0
- package/dist/workspace-root-data.spec.js +159 -0
- package/dist/workspace-root-data.spec.js.map +1 -0
- package/dist/workspace-root.aspect.d.ts +3 -0
- package/dist/workspace-root.aspect.js +19 -0
- package/dist/workspace-root.aspect.js.map +1 -0
- package/dist/workspace-root.docs.mdx +62 -0
- package/dist/workspace-root.fragment.d.ts +21 -0
- package/dist/workspace-root.fragment.js +36 -0
- package/dist/workspace-root.fragment.js.map +1 -0
- package/dist/workspace-root.main.runtime.d.ts +51 -0
- package/dist/workspace-root.main.runtime.js +176 -0
- package/dist/workspace-root.main.runtime.js.map +1 -0
- package/package.json +68 -0
- package/types/asset.d.ts +41 -0
- package/types/style.d.ts +46 -0
- package/workspace-root.docs.mdx +62 -0
package/.npmignore
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
dist/tsconfig.tsbuildinfo
|
|
2
|
+
dist/tsconfig.json
|
|
3
|
+
/tsconfig.json
|
|
4
|
+
|
|
5
|
+
package-tar/
|
|
6
|
+
.bit-capsule-ready
|
|
7
|
+
/*.ts
|
|
8
|
+
artifacts/*
|
|
9
|
+
!artifacts/env-template
|
|
10
|
+
!artifacts/ui-bundle
|
|
11
|
+
!artifacts/preview-bundle
|
|
12
|
+
package-tar/
|
|
13
|
+
.bit-capsule-ready
|
|
14
|
+
/*.ts
|
|
15
|
+
artifacts/*
|
|
16
|
+
!artifacts/env-template
|
|
17
|
+
!artifacts/ui-bundle
|
|
18
|
+
!artifacts/preview-bundle
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import type { CloneResult } from './clone';
|
|
3
|
+
import type { WorkspaceRootMain } from './workspace-root.main.runtime';
|
|
4
|
+
type CloneCmdOptions = {
|
|
5
|
+
lane?: string;
|
|
6
|
+
remote?: string;
|
|
7
|
+
skipDependencyInstallation?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare class CloneCmd implements Command {
|
|
10
|
+
private workspaceRoot;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
extendedDescription: string;
|
|
14
|
+
arguments: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}[];
|
|
18
|
+
group: string;
|
|
19
|
+
skipWorkspace: boolean;
|
|
20
|
+
remoteOp: boolean;
|
|
21
|
+
loader: boolean;
|
|
22
|
+
options: CommandOptions;
|
|
23
|
+
constructor(workspaceRoot: WorkspaceRootMain);
|
|
24
|
+
report([id, dir]: [string, string], options: CloneCmdOptions): Promise<string>;
|
|
25
|
+
}
|
|
26
|
+
export declare function formatCloneResult(result: CloneResult, relativeDir: string): string;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CloneCmd = void 0;
|
|
7
|
+
exports.formatCloneResult = formatCloneResult;
|
|
8
|
+
function _path() {
|
|
9
|
+
const data = _interopRequireDefault(require("path"));
|
|
10
|
+
_path = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _cli() {
|
|
16
|
+
const data = require("@teambit/cli");
|
|
17
|
+
_cli = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
class CloneCmd {
|
|
27
|
+
constructor(workspaceRoot) {
|
|
28
|
+
this.workspaceRoot = workspaceRoot;
|
|
29
|
+
_defineProperty(this, "name", 'clone <component-id> [dir]');
|
|
30
|
+
_defineProperty(this, "description", 'create a workspace from its workspace-root component, with every component it lists');
|
|
31
|
+
_defineProperty(this, "extendedDescription", `the workspace-root component is the one tracked at a workspace root ("bit add ."). it versions the workspace's own files - workspace.jsonc, .bitmap, lockfile, configs - and this command makes a workspace out of it, the way "git clone" makes a working tree out of a repository: the root files land at the root, every component the root lists is imported into the directory it records, then the dependencies are installed.
|
|
32
|
+
the components come at their heads on main, or on the lane given with --lane. a version on the root id pins the root files only.
|
|
33
|
+
runs outside a workspace. the directory must be empty or not exist, and defaults to the component name.`);
|
|
34
|
+
_defineProperty(this, "arguments", [{
|
|
35
|
+
name: 'component-id',
|
|
36
|
+
description: 'the workspace-root component, with its scope. a version pins the root files'
|
|
37
|
+
}, {
|
|
38
|
+
name: 'dir',
|
|
39
|
+
description: 'where to create the workspace. defaults to the component name, must be empty or absent'
|
|
40
|
+
}]);
|
|
41
|
+
_defineProperty(this, "group", 'workspace-setup');
|
|
42
|
+
_defineProperty(this, "skipWorkspace", true);
|
|
43
|
+
_defineProperty(this, "remoteOp", true);
|
|
44
|
+
_defineProperty(this, "loader", true);
|
|
45
|
+
_defineProperty(this, "options", [['l', 'lane <lane-id>', 'clone the workspace as it is on this lane ("scope/name"): it comes out on the lane, with the components at their heads there'], ['', 'remote <url>', 'url of the scope hosting the components, when it is neither on bit.cloud nor in the global remotes'], ['x', 'skip-dependency-installation', 'do not install the dependencies, and so do not compile, after the clone']]);
|
|
46
|
+
}
|
|
47
|
+
async report([id, dir], options) {
|
|
48
|
+
// the clone changes the cwd to the new workspace, so the path is relative to where the user ran it
|
|
49
|
+
const cwd = process.cwd();
|
|
50
|
+
const result = await this.workspaceRoot.clone(id, dir, options);
|
|
51
|
+
return formatCloneResult(result, _path().default.relative(cwd, result.workspacePath) || '.');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.CloneCmd = CloneCmd;
|
|
55
|
+
function formatCloneResult(result, relativeDir) {
|
|
56
|
+
const count = result.components.length;
|
|
57
|
+
const summary = (0, _cli().formatSuccessSummary)(`cloned ${result.rootId.toString()} into "${relativeDir}" with ${count} component${count === 1 ? '' : 's'}`);
|
|
58
|
+
const lane = result.laneId ? (0, _cli().formatHint)(`(the workspace is on lane ${result.laneId.toString()})`) : '';
|
|
59
|
+
// missing state takes the error symbol, on the title as well as on the items - see the error
|
|
60
|
+
// sections of cli-output-style-guide.md. the clone itself succeeded, which the summary above says.
|
|
61
|
+
const missing = (0, _cli().formatSection)(`${_cli().errorSymbol} components the root lists that are not on their remote`, 'never exported, or exported elsewhere - the clone is without them', result.missing.map(missingId => (0, _cli().formatItem)(missingId, _cli().errorSymbol)));
|
|
62
|
+
const installation = result.installationError ? (0, _cli().formatWarningSummary)(`the dependencies were not installed: ${result.installationError.message}\nrun "bit install" in the workspace to retry`) : '';
|
|
63
|
+
const next = relativeDir === '.' ? '' : (0, _cli().formatHint)(`cd ${relativeDir}`);
|
|
64
|
+
return (0, _cli().joinSections)([summary, lane, missing, installation, next]);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=clone.cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_path","data","_interopRequireDefault","require","_cli","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CloneCmd","constructor","workspaceRoot","name","description","report","id","dir","options","cwd","process","result","clone","formatCloneResult","path","relative","workspacePath","exports","relativeDir","count","components","length","summary","formatSuccessSummary","rootId","toString","lane","laneId","formatHint","missing","formatSection","errorSymbol","map","missingId","formatItem","installation","installationError","formatWarningSummary","message","next","joinSections"],"sources":["clone.cmd.ts"],"sourcesContent":["import path from 'path';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport {\n errorSymbol,\n formatHint,\n formatItem,\n formatSection,\n formatSuccessSummary,\n formatWarningSummary,\n joinSections,\n} from '@teambit/cli';\nimport type { CloneResult } from './clone';\nimport type { WorkspaceRootMain } from './workspace-root.main.runtime';\n\ntype CloneCmdOptions = {\n lane?: string;\n remote?: string;\n skipDependencyInstallation?: boolean;\n};\n\nexport class CloneCmd implements Command {\n name = 'clone <component-id> [dir]';\n description = 'create a workspace from its workspace-root component, with every component it lists';\n extendedDescription = `the workspace-root component is the one tracked at a workspace root (\"bit add .\"). it versions the workspace's own files - workspace.jsonc, .bitmap, lockfile, configs - and this command makes a workspace out of it, the way \"git clone\" makes a working tree out of a repository: the root files land at the root, every component the root lists is imported into the directory it records, then the dependencies are installed.\nthe components come at their heads on main, or on the lane given with --lane. a version on the root id pins the root files only.\nruns outside a workspace. the directory must be empty or not exist, and defaults to the component name.`;\n arguments = [\n {\n name: 'component-id',\n description: 'the workspace-root component, with its scope. a version pins the root files',\n },\n {\n name: 'dir',\n description: 'where to create the workspace. defaults to the component name, must be empty or absent',\n },\n ];\n group = 'workspace-setup';\n skipWorkspace = true;\n remoteOp = true;\n loader = true;\n options = [\n [\n 'l',\n 'lane <lane-id>',\n 'clone the workspace as it is on this lane (\"scope/name\"): it comes out on the lane, with the components at their heads there',\n ],\n [\n '',\n 'remote <url>',\n 'url of the scope hosting the components, when it is neither on bit.cloud nor in the global remotes',\n ],\n ['x', 'skip-dependency-installation', 'do not install the dependencies, and so do not compile, after the clone'],\n ] as CommandOptions;\n\n constructor(private workspaceRoot: WorkspaceRootMain) {}\n\n async report([id, dir]: [string, string], options: CloneCmdOptions): Promise<string> {\n // the clone changes the cwd to the new workspace, so the path is relative to where the user ran it\n const cwd = process.cwd();\n const result = await this.workspaceRoot.clone(id, dir, options);\n return formatCloneResult(result, path.relative(cwd, result.workspacePath) || '.');\n }\n}\n\nexport function formatCloneResult(result: CloneResult, relativeDir: string): string {\n const count = result.components.length;\n const summary = formatSuccessSummary(\n `cloned ${result.rootId.toString()} into \"${relativeDir}\" with ${count} component${count === 1 ? '' : 's'}`\n );\n const lane = result.laneId ? formatHint(`(the workspace is on lane ${result.laneId.toString()})`) : '';\n // missing state takes the error symbol, on the title as well as on the items - see the error\n // sections of cli-output-style-guide.md. the clone itself succeeded, which the summary above says.\n const missing = formatSection(\n `${errorSymbol} components the root lists that are not on their remote`,\n 'never exported, or exported elsewhere - the clone is without them',\n result.missing.map((missingId) => formatItem(missingId, errorSymbol))\n );\n const installation = result.installationError\n ? formatWarningSummary(\n `the dependencies were not installed: ${result.installationError.message}\\nrun \"bit install\" in the workspace to retry`\n )\n : '';\n const next = relativeDir === '.' ? '' : formatHint(`cd ${relativeDir}`);\n return joinSections([summary, lane, missing, installation, next]);\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EA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AE;EACtG;EACA;EACA,MAAMI,OAAO,GAAG,IAAAC,oBAAa,EAC3B,GAAGC,kBAAW,yDAAyD,EACvE,mEAAmE,EACnEpB,MAAM,CAACkB,OAAO,CAACG,GAAG,CAAEC,SAAS,IAAK,IAAAC,iBAAU,EAACD,SAAS,EAAEF,kBAAW,CAAC,CACtE,CAAC;EACD,MAAMI,YAAY,GAAGxB,MAAM,CAACyB,iBAAiB,GACzC,IAAAC,2BAAoB,EAClB,wCAAwC1B,MAAM,CAACyB,iBAAiB,CAACE,OAAO,+CAC1E,CAAC,GACD,EAAE;EACN,MAAMC,IAAI,GAAGrB,WAAW,KAAK,GAAG,GAAG,EAAE,GAAG,IAAAU,iBAAU,EAAC,MAAMV,WAAW,EAAE,CAAC;EACvE,OAAO,IAAAsB,mBAAY,EAAC,CAAClB,OAAO,EAAEI,IAAI,EAAEG,OAAO,EAAEM,YAAY,EAAEI,IAAI,CAAC,CAAC;AACnE","ignoreList":[]}
|
package/dist/clone.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { ComponentID } from '@teambit/component-id';
|
|
2
|
+
import type { Harmony } from '@teambit/harmony';
|
|
3
|
+
import { LaneId } from '@teambit/lane-id';
|
|
4
|
+
import type { VersionedBitmapEntry } from '@teambit/legacy.bit-map';
|
|
5
|
+
export type LoadBit = (workspacePath?: string) => Promise<Harmony>;
|
|
6
|
+
export type CloneOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* clone the workspace as it is on this lane, "scope/name". the workspace comes out on the lane,
|
|
9
|
+
* and the components at their heads there; a component the lane does not have comes from main.
|
|
10
|
+
*/
|
|
11
|
+
lane?: string;
|
|
12
|
+
/**
|
|
13
|
+
* url of the scope hosting the components, for a scope that is neither on bit.cloud nor in the
|
|
14
|
+
* global remotes. it is registered in the new workspace.
|
|
15
|
+
*/
|
|
16
|
+
remote?: string;
|
|
17
|
+
skipDependencyInstallation?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type CloneResult = {
|
|
20
|
+
/** the root, at the version the workspace was made from */
|
|
21
|
+
rootId: ComponentID;
|
|
22
|
+
workspacePath: string;
|
|
23
|
+
/** the components the root lists, at the versions they were written with */
|
|
24
|
+
components: ComponentID[];
|
|
25
|
+
/**
|
|
26
|
+
* components the root lists that their remote does not have - never exported, or exported to
|
|
27
|
+
* another scope - so the clone is without them.
|
|
28
|
+
*/
|
|
29
|
+
missing: string[];
|
|
30
|
+
laneId?: LaneId;
|
|
31
|
+
/** the clone is complete without the install; the user re-runs it in the workspace */
|
|
32
|
+
installationError?: Error;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* makes a workspace out of a workspace-root component, the way `git clone` makes a working tree out of
|
|
36
|
+
* a repository: a fresh workspace in an empty directory, the root's files at its root, every component
|
|
37
|
+
* the root's `.bitmap` lists in the directory it records, then install. the versioned `.bitmap` has
|
|
38
|
+
* no versions on purpose (see normalizeBitmapContentForVersioning), so the components come at their
|
|
39
|
+
* heads - on main, or on the lane when one is given - and a root version pins the root files only.
|
|
40
|
+
*
|
|
41
|
+
* the directory must be empty or absent, and outside any workspace. there is no override: this is a
|
|
42
|
+
* new workspace, not an import into one, so nothing at the target is the user's.
|
|
43
|
+
*/
|
|
44
|
+
export declare function cloneWorkspace(rootId: ComponentID, dir: string | undefined, options: CloneOptions, loadBit: LoadBit): Promise<CloneResult>;
|
|
45
|
+
/**
|
|
46
|
+
* the directory of a component the root lists, inside the workspace. the list comes from a remote,
|
|
47
|
+
* so a root-dir that escapes the workspace - "../x", an absolute path - is refused, and so are the
|
|
48
|
+
* workspace root itself, which only the root component owns, a directory bit or git keeps for
|
|
49
|
+
* itself, and a missing root-dir, which no `.bitmap` of the current schema has.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveComponentDir(workspacePath: string, entry: VersionedBitmapEntry): string;
|
|
52
|
+
/**
|
|
53
|
+
* where each member the root lists is written to, by id.
|
|
54
|
+
*
|
|
55
|
+
* built through a Map rather than straight onto the object the importer takes, because an id read
|
|
56
|
+
* out of a remote `.bitmap` is an arbitrary string: assigning one that reads `__proto__` runs the
|
|
57
|
+
* inherited setter instead of creating an own property, and two entries can resolve to a single id
|
|
58
|
+
* (the key and the name/scope fields are independent, see readVersionedBitmapEntries) so the later
|
|
59
|
+
* one overwrites the earlier. either way that member leaves no trace here - it is absent from the
|
|
60
|
+
* import request, and absent from the missing-members report too, since that reports what the remote
|
|
61
|
+
* did not have. the clone comes out short of a component with nothing to say why, so a collision is
|
|
62
|
+
* refused instead.
|
|
63
|
+
*/
|
|
64
|
+
export declare function resolveWriteToPathPerId(workspacePath: string, entries: VersionedBitmapEntry[], rootId: ComponentID): Record<string, string>;
|
|
65
|
+
/**
|
|
66
|
+
* two members the root lists may not share a directory, nor sit one inside another. a `.bitmap` bit
|
|
67
|
+
* wrote holds neither - it refuses a duplicate root-dir, and a component under another component's
|
|
68
|
+
* directory - but this one came from a remote. left to the writer, a collision is relocated and then
|
|
69
|
+
* moved back to the path each component was asked for, so the later one lands on the earlier one's
|
|
70
|
+
* files and the clone comes out missing a component it reported as written.
|
|
71
|
+
*/
|
|
72
|
+
export declare function throwForOverlappingDirs(dirPerId: Record<string, string>): void;
|
|
73
|
+
/**
|
|
74
|
+
* where the clone lands: the directory given, or one named after the component, as `git clone` names
|
|
75
|
+
* the working tree after the repository. relative to the cwd, the clone runs outside a workspace.
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveClonePath(dir: string | undefined, rootId: ComponentID): string;
|
|
78
|
+
/**
|
|
79
|
+
* the destination with the directories above it resolved through any symbolic link, and its own last
|
|
80
|
+
* segment left as it is.
|
|
81
|
+
*
|
|
82
|
+
* a link above the target redirects everything that follows - the directory creation, the init, the
|
|
83
|
+
* files, and the cleanup of a failed clone - while the lexical path says nothing about it, so the
|
|
84
|
+
* workspace check would look in one place and the writes land in another, inside someone else's
|
|
85
|
+
* workspace. the last segment is deliberately not resolved: a link *at* the destination is refused
|
|
86
|
+
* rather than followed, which is ensureEmptyDir's rule.
|
|
87
|
+
*/
|
|
88
|
+
export declare function resolveThroughExistingAncestors(dirPath: string): Promise<string>;
|
|
89
|
+
/**
|
|
90
|
+
* the highest directory on the way to the destination that does not exist yet, or undefined when the
|
|
91
|
+
* destination is already there. what a failed clone removes, so that the levels made on the way to it
|
|
92
|
+
* go too rather than being left standing empty.
|
|
93
|
+
*/
|
|
94
|
+
export declare function topmostAbsentDir(dirPath: string): Promise<string | undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* the workspace is written into this directory and a failed clone empties it again, so it has to be
|
|
97
|
+
* the directory it appears to be: a symbolic link would put the workspace, and then the cleanup,
|
|
98
|
+
* wherever it points. the same rule the writer applies to the files of a root (see
|
|
99
|
+
* throwForSymlinksInTheWay).
|
|
100
|
+
*
|
|
101
|
+
* @returns whether the directory was created here, so a failed clone knows to remove it
|
|
102
|
+
*/
|
|
103
|
+
export declare function ensureEmptyDir(dirPath: string): Promise<boolean>;
|