@teambit/snapping 1.0.102 → 1.0.103
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/dist/generate-comp-from-scope.d.ts +26 -0
- package/dist/generate-comp-from-scope.js +178 -0
- package/dist/generate-comp-from-scope.js.map +1 -0
- package/dist/snap-cmd.d.ts +1 -1
- package/dist/snap-cmd.js +3 -1
- package/dist/snap-cmd.js.map +1 -1
- package/dist/snap-from-scope.cmd.d.ts +9 -1
- package/dist/snap-from-scope.cmd.js +14 -4
- package/dist/snap-from-scope.cmd.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +26 -7
- package/dist/snapping.main.runtime.js +70 -21
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/tag-cmd.d.ts +1 -1
- package/dist/tag-cmd.js +3 -1
- package/dist/tag-cmd.js.map +1 -1
- package/dist/tag-from-scope.cmd.d.ts +1 -1
- package/dist/tag-from-scope.cmd.js +3 -1
- package/dist/tag-from-scope.cmd.js.map +1 -1
- package/dist/tag-model-component.d.ts +2 -1
- package/dist/tag-model-component.js +10 -4
- package/dist/tag-model-component.js.map +1 -1
- package/package.json +19 -18
- /package/dist/{preview-1703214934003.js → preview-1703301327107.js} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentID } from '@teambit/component-id';
|
|
2
|
+
import { ScopeMain } from '@teambit/scope';
|
|
3
|
+
import { Component } from '@teambit/component';
|
|
4
|
+
import { DependenciesMain } from '@teambit/dependencies';
|
|
5
|
+
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
6
|
+
import { FileData } from './snap-from-scope.cmd';
|
|
7
|
+
import { SnapDataParsed } from './snapping.main.runtime';
|
|
8
|
+
export declare type CompData = {
|
|
9
|
+
componentId: ComponentID;
|
|
10
|
+
dependencies: ComponentID[];
|
|
11
|
+
aspects: Record<string, any> | undefined;
|
|
12
|
+
message: string | undefined;
|
|
13
|
+
files: FileData[] | undefined;
|
|
14
|
+
mainFile?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* normally new components are created from a workspace. the files are in the filesystem and the ConsumerComponent
|
|
18
|
+
* object is created from the files.
|
|
19
|
+
* here, we need to create the ConsumerComponent object "on the fly". we don't have workspace, only scope. the files
|
|
20
|
+
* are in-memory (we got them from snap-from-scope command).
|
|
21
|
+
* the way how it is done is by creating a minimal ConsumerComponent object, then convert `Version` object from it,
|
|
22
|
+
* write the version and files into the scope as objects, so then it's possible to load Component object using the
|
|
23
|
+
* ConsumerComponent.
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateCompFromScope(scope: ScopeMain, compData: CompData): Promise<Component>;
|
|
26
|
+
export declare function addDeps(component: Component, snapData: SnapDataParsed, scope: ScopeMain, deps: DependenciesMain, depsResolver: DependencyResolverMain): Promise<void>;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.addDeps = addDeps;
|
|
7
|
+
exports.generateCompFromScope = generateCompFromScope;
|
|
8
|
+
function _componentId() {
|
|
9
|
+
const data = require("@teambit/component-id");
|
|
10
|
+
_componentId = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _component() {
|
|
16
|
+
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component"));
|
|
17
|
+
_component = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _dependencies() {
|
|
23
|
+
const data = require("@teambit/legacy/dist/consumer/component/dependencies");
|
|
24
|
+
_dependencies = function () {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
function _sources() {
|
|
30
|
+
const data = require("@teambit/legacy/dist/consumer/component/sources");
|
|
31
|
+
_sources = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
function _componentConfig() {
|
|
37
|
+
const data = require("@teambit/legacy/dist/consumer/config/component-config");
|
|
38
|
+
_componentConfig = function () {
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
function _componentOverrides() {
|
|
44
|
+
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/config/component-overrides"));
|
|
45
|
+
_componentOverrides = function () {
|
|
46
|
+
return data;
|
|
47
|
+
};
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
function _config() {
|
|
51
|
+
const data = require("@teambit/legacy/dist/consumer/config");
|
|
52
|
+
_config = function () {
|
|
53
|
+
return data;
|
|
54
|
+
};
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
function _componentSchema() {
|
|
58
|
+
const data = require("@teambit/legacy/dist/consumer/component/component-schema");
|
|
59
|
+
_componentSchema = function () {
|
|
60
|
+
return data;
|
|
61
|
+
};
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
function _dependencyResolver() {
|
|
65
|
+
const data = _interopRequireDefault(require("@teambit/dependency-resolver"));
|
|
66
|
+
_dependencyResolver = function () {
|
|
67
|
+
return data;
|
|
68
|
+
};
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
72
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
73
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
74
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
75
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
76
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
77
|
+
/**
|
|
78
|
+
* normally new components are created from a workspace. the files are in the filesystem and the ConsumerComponent
|
|
79
|
+
* object is created from the files.
|
|
80
|
+
* here, we need to create the ConsumerComponent object "on the fly". we don't have workspace, only scope. the files
|
|
81
|
+
* are in-memory (we got them from snap-from-scope command).
|
|
82
|
+
* the way how it is done is by creating a minimal ConsumerComponent object, then convert `Version` object from it,
|
|
83
|
+
* write the version and files into the scope as objects, so then it's possible to load Component object using the
|
|
84
|
+
* ConsumerComponent.
|
|
85
|
+
*/
|
|
86
|
+
async function generateCompFromScope(scope, compData) {
|
|
87
|
+
if (!compData.files) throw new Error('generateComp: files are missing');
|
|
88
|
+
const files = compData.files.map(file => {
|
|
89
|
+
return new (_sources().SourceFile)({
|
|
90
|
+
base: '.',
|
|
91
|
+
path: file.path,
|
|
92
|
+
contents: Buffer.from(file.content),
|
|
93
|
+
test: false
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
const id = compData.componentId;
|
|
97
|
+
const bindingPrefix = (0, _componentConfig().getBindingPrefixByDefaultScope)(id.scope);
|
|
98
|
+
const extensions = _config().ExtensionDataList.fromConfigObject(compData.aspects || {});
|
|
99
|
+
const consumerComponent = new (_component().default)({
|
|
100
|
+
mainFile: compData.mainFile || 'index.ts',
|
|
101
|
+
name: compData.componentId.fullName,
|
|
102
|
+
scope: compData.componentId.scope,
|
|
103
|
+
files,
|
|
104
|
+
bindingPrefix,
|
|
105
|
+
schema: _componentSchema().CURRENT_SCHEMA,
|
|
106
|
+
overrides: await _componentOverrides().default.loadNewFromScope(id, files, extensions),
|
|
107
|
+
defaultScope: compData.componentId.scope,
|
|
108
|
+
extensions,
|
|
109
|
+
// the dummy data here are not important. this Version object will be discarded later.
|
|
110
|
+
log: {
|
|
111
|
+
message: compData.message || '',
|
|
112
|
+
date: Date.now().toString(),
|
|
113
|
+
username: '',
|
|
114
|
+
email: ''
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const {
|
|
118
|
+
version,
|
|
119
|
+
files: filesBitObject
|
|
120
|
+
} = await scope.legacyScope.sources.consumerComponentToVersion(consumerComponent);
|
|
121
|
+
const modelComponent = scope.legacyScope.sources.findOrAddComponent(consumerComponent);
|
|
122
|
+
consumerComponent.version = version.hash().toString();
|
|
123
|
+
await scope.legacyScope.objects.writeObjectsToTheFS([version, modelComponent, ...filesBitObject.map(f => f.file)]);
|
|
124
|
+
const component = await scope.getManyByLegacy([consumerComponent]);
|
|
125
|
+
return component[0];
|
|
126
|
+
}
|
|
127
|
+
async function addDeps(component, snapData, scope, deps, depsResolver) {
|
|
128
|
+
const newDeps = snapData.newDependencies || [];
|
|
129
|
+
const compIdsData = newDeps.filter(dep => dep.isComponent);
|
|
130
|
+
const compIdsDataParsed = compIdsData.map(data => _objectSpread(_objectSpread({}, data), {}, {
|
|
131
|
+
id: _componentId().ComponentID.fromString(data.id)
|
|
132
|
+
}));
|
|
133
|
+
const compIds = compIdsDataParsed.map(dep => dep.version ? dep.id.changeVersion(dep.version) : dep.id);
|
|
134
|
+
const comps = await scope.getMany(compIds);
|
|
135
|
+
const toDependency = depId => {
|
|
136
|
+
const comp = comps.find(c => c.id.isEqualWithoutVersion(depId));
|
|
137
|
+
if (!comp) throw new Error(`unable to find the specified dependency ${depId.toString()} in the scope`);
|
|
138
|
+
const pkgName = depsResolver.getPackageName(comp);
|
|
139
|
+
return new (_dependencies().Dependency)(comp.id, [], pkgName);
|
|
140
|
+
};
|
|
141
|
+
const compDeps = compIdsDataParsed.filter(c => c.type === 'runtime').map(dep => toDependency(dep.id));
|
|
142
|
+
const compDevDeps = compIdsDataParsed.filter(c => c.type === 'dev').map(dep => toDependency(dep.id));
|
|
143
|
+
const packageDeps = newDeps.filter(dep => !dep.isComponent);
|
|
144
|
+
const toPackageObj = pkgs => {
|
|
145
|
+
return pkgs.reduce((acc, curr) => {
|
|
146
|
+
if (!curr.version) throw new Error(`please specify a version for the package dependency: "${curr.id}"`);
|
|
147
|
+
acc[curr.id] = curr.version;
|
|
148
|
+
return acc;
|
|
149
|
+
}, {});
|
|
150
|
+
};
|
|
151
|
+
const dependenciesData = {
|
|
152
|
+
allDependencies: {
|
|
153
|
+
dependencies: compDeps,
|
|
154
|
+
devDependencies: compDevDeps
|
|
155
|
+
},
|
|
156
|
+
allPackagesDependencies: {
|
|
157
|
+
packageDependencies: toPackageObj(packageDeps.filter(dep => dep.type === 'runtime')),
|
|
158
|
+
devPackageDependencies: toPackageObj(packageDeps.filter(dep => dep.type === 'dev')),
|
|
159
|
+
peerPackageDependencies: toPackageObj(packageDeps.filter(dep => dep.type === 'peer'))
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const consumerComponent = component.state._consumer;
|
|
163
|
+
// add the dependencies to the legacy ConsumerComponent object
|
|
164
|
+
// it takes care of both: given dependencies (from the cli) and the overrides, which are coming from the env.
|
|
165
|
+
await deps.loadDependenciesFromScope(consumerComponent, dependenciesData);
|
|
166
|
+
|
|
167
|
+
// add the dependencies data to the dependency-resolver aspect
|
|
168
|
+
const dependenciesListSerialized = (await depsResolver.extractDepsFromLegacy(component)).serialize();
|
|
169
|
+
const extId = _dependencyResolver().default.id;
|
|
170
|
+
const data = {
|
|
171
|
+
dependencies: dependenciesListSerialized
|
|
172
|
+
};
|
|
173
|
+
const existingExtension = component.config.extensions.findExtension(extId);
|
|
174
|
+
if (!existingExtension) throw new Error('unable to find DependencyResolver extension');
|
|
175
|
+
Object.assign(existingExtension.data, data);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=generate-comp-from-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_componentId","data","require","_component","_interopRequireDefault","_dependencies","_sources","_componentConfig","_componentOverrides","_config","_componentSchema","_dependencyResolver","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","generateCompFromScope","scope","compData","files","Error","map","file","SourceFile","base","path","contents","Buffer","from","content","test","id","componentId","bindingPrefix","getBindingPrefixByDefaultScope","extensions","ExtensionDataList","fromConfigObject","aspects","consumerComponent","ConsumerComponent","mainFile","name","fullName","schema","CURRENT_SCHEMA","overrides","ComponentOverrides","loadNewFromScope","defaultScope","log","message","date","Date","now","toString","username","email","version","filesBitObject","legacyScope","sources","consumerComponentToVersion","modelComponent","findOrAddComponent","hash","objects","writeObjectsToTheFS","f","component","getManyByLegacy","addDeps","snapData","deps","depsResolver","newDeps","newDependencies","compIdsData","dep","isComponent","compIdsDataParsed","ComponentID","fromString","compIds","changeVersion","comps","getMany","toDependency","depId","comp","find","c","isEqualWithoutVersion","pkgName","getPackageName","Dependency","compDeps","type","compDevDeps","packageDeps","toPackageObj","pkgs","reduce","acc","curr","dependenciesData","allDependencies","dependencies","devDependencies","allPackagesDependencies","packageDependencies","devPackageDependencies","peerPackageDependencies","state","_consumer","loadDependenciesFromScope","dependenciesListSerialized","extractDepsFromLegacy","serialize","extId","DependencyResolverAspect","existingExtension","config","findExtension","assign"],"sources":["generate-comp-from-scope.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { Dependency } from '@teambit/legacy/dist/consumer/component/dependencies';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { ScopeMain } from '@teambit/scope';\nimport { getBindingPrefixByDefaultScope } from '@teambit/legacy/dist/consumer/config/component-config';\nimport ComponentOverrides from '@teambit/legacy/dist/consumer/config/component-overrides';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';\nimport { Component } from '@teambit/component';\nimport { CURRENT_SCHEMA } from '@teambit/legacy/dist/consumer/component/component-schema';\nimport { DependenciesMain } from '@teambit/dependencies';\nimport DependencyResolverAspect, { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { FileData } from './snap-from-scope.cmd';\nimport { SnapDataParsed } from './snapping.main.runtime';\n\nexport type CompData = {\n componentId: ComponentID;\n dependencies: ComponentID[];\n aspects: Record<string, any> | undefined;\n message: string | undefined;\n files: FileData[] | undefined;\n mainFile?: string;\n};\n\n/**\n * normally new components are created from a workspace. the files are in the filesystem and the ConsumerComponent\n * object is created from the files.\n * here, we need to create the ConsumerComponent object \"on the fly\". we don't have workspace, only scope. the files\n * are in-memory (we got them from snap-from-scope command).\n * the way how it is done is by creating a minimal ConsumerComponent object, then convert `Version` object from it,\n * write the version and files into the scope as objects, so then it's possible to load Component object using the\n * ConsumerComponent.\n */\nexport async function generateCompFromScope(scope: ScopeMain, compData: CompData): Promise<Component> {\n if (!compData.files) throw new Error('generateComp: files are missing');\n const files = compData.files.map((file) => {\n return new SourceFile({ base: '.', path: file.path, contents: Buffer.from(file.content), test: false });\n });\n const id = compData.componentId;\n const bindingPrefix = getBindingPrefixByDefaultScope(id.scope);\n\n const extensions = ExtensionDataList.fromConfigObject(compData.aspects || {});\n\n const consumerComponent = new ConsumerComponent({\n mainFile: compData.mainFile || 'index.ts',\n name: compData.componentId.fullName,\n scope: compData.componentId.scope,\n files,\n bindingPrefix,\n schema: CURRENT_SCHEMA,\n overrides: await ComponentOverrides.loadNewFromScope(id, files, extensions),\n defaultScope: compData.componentId.scope,\n extensions,\n // the dummy data here are not important. this Version object will be discarded later.\n log: {\n message: compData.message || '',\n date: Date.now().toString(),\n username: '',\n email: '',\n },\n });\n const { version, files: filesBitObject } = await scope.legacyScope.sources.consumerComponentToVersion(\n consumerComponent\n );\n const modelComponent = scope.legacyScope.sources.findOrAddComponent(consumerComponent);\n consumerComponent.version = version.hash().toString();\n await scope.legacyScope.objects.writeObjectsToTheFS([version, modelComponent, ...filesBitObject.map((f) => f.file)]);\n const component = await scope.getManyByLegacy([consumerComponent]);\n\n return component[0];\n}\n\nexport async function addDeps(\n component: Component,\n snapData: SnapDataParsed,\n scope: ScopeMain,\n deps: DependenciesMain,\n depsResolver: DependencyResolverMain\n) {\n const newDeps = snapData.newDependencies || [];\n const compIdsData = newDeps.filter((dep) => dep.isComponent);\n const compIdsDataParsed = compIdsData.map((data) => ({\n ...data,\n id: ComponentID.fromString(data.id),\n }));\n const compIds = compIdsDataParsed.map((dep) => (dep.version ? dep.id.changeVersion(dep.version) : dep.id));\n const comps = await scope.getMany(compIds);\n const toDependency = (depId: ComponentID) => {\n const comp = comps.find((c) => c.id.isEqualWithoutVersion(depId));\n if (!comp) throw new Error(`unable to find the specified dependency ${depId.toString()} in the scope`);\n const pkgName = depsResolver.getPackageName(comp);\n return new Dependency(comp.id, [], pkgName);\n };\n const compDeps = compIdsDataParsed.filter((c) => c.type === 'runtime').map((dep) => toDependency(dep.id));\n const compDevDeps = compIdsDataParsed.filter((c) => c.type === 'dev').map((dep) => toDependency(dep.id));\n const packageDeps = newDeps.filter((dep) => !dep.isComponent);\n const toPackageObj = (pkgs: Array<{ id: string; version?: string }>) => {\n return pkgs.reduce((acc, curr) => {\n if (!curr.version) throw new Error(`please specify a version for the package dependency: \"${curr.id}\"`);\n acc[curr.id] = curr.version;\n return acc;\n }, {});\n };\n const dependenciesData = {\n allDependencies: {\n dependencies: compDeps,\n devDependencies: compDevDeps,\n },\n allPackagesDependencies: {\n packageDependencies: toPackageObj(packageDeps.filter((dep) => dep.type === 'runtime')),\n devPackageDependencies: toPackageObj(packageDeps.filter((dep) => dep.type === 'dev')),\n peerPackageDependencies: toPackageObj(packageDeps.filter((dep) => dep.type === 'peer')),\n },\n };\n\n const consumerComponent = component.state._consumer as ConsumerComponent;\n // add the dependencies to the legacy ConsumerComponent object\n // it takes care of both: given dependencies (from the cli) and the overrides, which are coming from the env.\n await deps.loadDependenciesFromScope(consumerComponent, dependenciesData);\n\n // add the dependencies data to the dependency-resolver aspect\n const dependenciesListSerialized = (await depsResolver.extractDepsFromLegacy(component)).serialize();\n const extId = DependencyResolverAspect.id;\n const data = { dependencies: dependenciesListSerialized };\n const existingExtension = component.config.extensions.findExtension(extId);\n if (!existingExtension) throw new Error('unable to find DependencyResolver extension');\n Object.assign(existingExtension.data, data);\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,iBAAA;EAAA,MA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AA2B,CAAC;EACzD,MAAMK,iBAAiB,GAAGpD,SAAS,CAACqD,MAAM,CAACvF,UAAU,CAACwF,aAAa,CAACJ,KAAK,CAAC;EAC1E,IAAI,CAACE,iBAAiB,EAAE,MAAM,IAAIrG,KAAK,CAAC,6CAA6C,CAAC;EACtFvC,MAAM,CAAC+I,MAAM,CAACH,iBAAiB,CAAC9J,IAAI,EAAEA,IAAI,CAAC;AAC7C"}
|
package/dist/snap-cmd.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare class SnapCmd implements Command {
|
|
|
21
21
|
loader: boolean;
|
|
22
22
|
migration: boolean;
|
|
23
23
|
constructor(snapping: SnappingMain, logger: Logger, globalConfig: GlobalConfigMain);
|
|
24
|
-
report([pattern]: string[], { message, all, force, unmerged, editor, ignoreIssues, build, skipTests, skipAutoSnap, disableSnapPipeline, forceDeploy, ignoreBuildErrors, unmodified, failFast, }: {
|
|
24
|
+
report([pattern]: string[], { message, all, force, unmerged, editor, ignoreIssues, build, skipTests, skipAutoSnap, disableSnapPipeline, forceDeploy, ignoreBuildErrors, rebuildDepsGraph, unmodified, failFast, }: {
|
|
25
25
|
all?: boolean;
|
|
26
26
|
force?: boolean;
|
|
27
27
|
unmerged?: boolean;
|
package/dist/snap-cmd.js
CHANGED
|
@@ -51,7 +51,7 @@ class SnapCmd {
|
|
|
51
51
|
}]);
|
|
52
52
|
_defineProperty(this, "helpUrl", 'reference/components/snaps');
|
|
53
53
|
_defineProperty(this, "alias", '');
|
|
54
|
-
_defineProperty(this, "options", [['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'], ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'], ['', 'unmerged', 'complete a merge process by snapping the unmerged components'], ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the snap'], ['', 'editor [editor]', 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'skip-auto-snap', 'skip auto snapping dependents'], ['', 'disable-snap-pipeline', 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
|
|
54
|
+
_defineProperty(this, "options", [['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'], ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'], ['', 'unmerged', 'complete a merge process by snapping the unmerged components'], ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the snap'], ['', 'editor [editor]', 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'skip-auto-snap', 'skip auto snapping dependents'], ['', 'disable-snap-pipeline', 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'], ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
|
|
55
55
|
[${Object.keys(_componentIssues().IssuesClasses).join(', ')}]
|
|
56
56
|
to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`], ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'], ['', 'fail-fast', 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)'], ['f', 'force', 'DEPRECATED (use "--skip-tests" or "--unmodified" instead). force-snap even if tests are failing and even when component has not changed']]);
|
|
57
57
|
_defineProperty(this, "loader", true);
|
|
@@ -70,6 +70,7 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
70
70
|
disableSnapPipeline = false,
|
|
71
71
|
forceDeploy = false,
|
|
72
72
|
ignoreBuildErrors = false,
|
|
73
|
+
rebuildDepsGraph,
|
|
73
74
|
unmodified = false,
|
|
74
75
|
failFast = false
|
|
75
76
|
}) {
|
|
@@ -100,6 +101,7 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
100
101
|
skipAutoSnap,
|
|
101
102
|
disableTagAndSnapPipelines,
|
|
102
103
|
ignoreBuildErrors,
|
|
104
|
+
rebuildDepsGraph,
|
|
103
105
|
unmodified,
|
|
104
106
|
exitOnFirstFailedTask: failFast
|
|
105
107
|
});
|
package/dist/snap-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_constants","_tagCmd","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapCmd","constructor","snapping","logger","globalConfig","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","all","force","unmerged","editor","ignoreIssues","build","skipTests","skipAutoSnap","disableSnapPipeline","forceDeploy","ignoreBuildErrors","unmodified","failFast","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","length","warningsOutput","snapExplanation","compInBold","version","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","outputIdsIfExists","green","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport {\n NOTHING_TO_SNAP_MSG,\n AUTO_SNAPPED_MSG,\n COMPONENT_PATTERN_HELP,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy/dist/constants';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists } from './tag-cmd';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create an immutable and exportable component snapshot (non-release version)';\n extendedDescription: string;\n group = 'development';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, only new and modified components are snapped (add --unmodified to snap all components in the workspace).`,\n },\n ];\n helpUrl = 'reference/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'],\n ['', 'unmerged', 'complete a merge process by snapping the unmerged components'],\n ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the snap'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'skip-auto-snap', 'skip auto snapping dependents'],\n [\n '',\n 'disable-snap-pipeline',\n 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment',\n ],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n [\n 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-snap even if tests are failing and even when component has not changed',\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger, private globalConfig: GlobalConfigMain) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n all = false,\n force = false,\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n forceDeploy = false,\n ignoreBuildErrors = false,\n unmodified = false,\n failFast = false,\n }: {\n all?: boolean;\n force?: boolean;\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n } & BasicTagSnapParams\n ) {\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. By default all new and modified components are snapped, to snap all components add --unmodified`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --ignore-build-errors depending on the use case`\n );\n if (pattern) unmodified = true;\n }\n if (!message && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your snap, will be displayed in the version history`\n );\n }\n if (forceDeploy) {\n this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);\n ignoreBuildErrors = true;\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n unmodified,\n exitOnFirstFailedTask: failFast,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n const { snappedComponents, autoSnappedResults, warnings, newComponents, laneName, removedComponents }: SnapResults =\n results;\n const changedComponents = snappedComponents.filter((component) => {\n return (\n !newComponents.searchWithoutVersion(component.id) && !removedComponents?.searchWithoutVersion(component.id)\n );\n });\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const snapExplanation = `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)`;\n\n const compInBold = (id: ComponentID) => {\n const version = id.hasVersion() ? `@${id.version}` : '';\n return `${chalk.bold(id.toStringWithoutVersion())}${version}`;\n };\n\n const outputComponents = (comps: ConsumerComponent[]) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${compInBold(component.id)}`;\n const autoTag = autoSnappedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => compInBold(a.component.id));\n componentOutput += `\\n ${AUTO_SNAPPED_MSG} (${autoTagComp.length} total):\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n\n return (\n outputIfExists('new components', 'first version for components', addedComponents) +\n outputIfExists('changed components', 'components that got a version bump', changedComponents) +\n outputIdsIfExists('removed components', removedComponents) +\n warningsOutput +\n chalk.green(`\\n${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC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C,GAC7F,IAAA+B,2BAAiB,EAAC,oBAAoB,EAAEhC,iBAAiB,CAAC,GAC1DS,cAAc,GACdjB,gBAAK,CAACyC,KAAK,CAAE,KAAItC,iBAAiB,CAACa,MAAM,GAAGD,eAAgB,wBAAuBwB,OAAQ,EAAC,CAAC,GAC7FrB,eAAe;EAEnB;AACF;AAACwB,OAAA,CAAA7E,OAAA,GAAAA,OAAA"}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_constants","_tagCmd","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapCmd","constructor","snapping","logger","globalConfig","name","description","COMPONENT_PATTERN_HELP","keys","IssuesClasses","join","report","pattern","message","all","force","unmerged","editor","ignoreIssues","build","skipTests","skipAutoSnap","disableSnapPipeline","forceDeploy","ignoreBuildErrors","rebuildDepsGraph","unmodified","failFast","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","disableTagAndSnapPipelines","consoleWarning","results","snap","exitOnFirstFailedTask","chalk","yellow","NOTHING_TO_SNAP_MSG","snappedComponents","autoSnappedResults","warnings","newComponents","laneName","removedComponents","changedComponents","filter","component","searchWithoutVersion","id","addedComponents","autoTaggedCount","length","warningsOutput","snapExplanation","compInBold","version","hasVersion","bold","toStringWithoutVersion","outputComponents","comps","map","componentOutput","autoTag","result","triggeredBy","autoTagComp","a","AUTO_SNAPPED_MSG","outputIfExists","label","explanation","components","underline","laneStr","outputIdsIfExists","green","exports"],"sources":["snap-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport {\n NOTHING_TO_SNAP_MSG,\n AUTO_SNAPPED_MSG,\n COMPONENT_PATTERN_HELP,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy/dist/constants';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain, SnapResults } from './snapping.main.runtime';\nimport { outputIdsIfExists } from './tag-cmd';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport class SnapCmd implements Command {\n name = 'snap [component-pattern]';\n description = 'create an immutable and exportable component snapshot (non-release version)';\n extendedDescription: string;\n group = 'development';\n arguments = [\n {\n name: 'component-pattern',\n description: `${COMPONENT_PATTERN_HELP}. By default, only new and modified components are snapped (add --unmodified to snap all components in the workspace).`,\n },\n ];\n helpUrl = 'reference/components/snaps';\n alias = '';\n options = [\n ['m', 'message <message>', 'snap message describing the latest changes - will appear in component history log'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are snapped)'],\n ['', 'unmerged', 'complete a merge process by snapping the unmerged components'],\n ['b', 'build', 'locally run the build pipeline (i.e. not via rippleCI) and complete the snap'],\n [\n '',\n 'editor [editor]',\n 'open an editor to write a snap message per component. optionally specify the editor-name (defaults to vim).',\n ],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'skip-auto-snap', 'skip auto snapping dependents'],\n [\n '',\n 'disable-snap-pipeline',\n 'skip the snap pipeline. this will for instance skip packing and publishing component version for install, and app deployment',\n ],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'proceed to snap pipeline even when build pipeline fails'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['a', 'all', 'DEPRECATED (not needed anymore, now the default). snap all new and modified components'],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n [\n 'f',\n 'force',\n 'DEPRECATED (use \"--skip-tests\" or \"--unmodified\" instead). force-snap even if tests are failing and even when component has not changed',\n ],\n ] as CommandOptions;\n loader = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger, private globalConfig: GlobalConfigMain) {}\n\n async report(\n [pattern]: string[],\n {\n message = '',\n all = false,\n force = false,\n unmerged = false,\n editor = '',\n ignoreIssues,\n build,\n skipTests = false,\n skipAutoSnap = false,\n disableSnapPipeline = false,\n forceDeploy = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n unmodified = false,\n failFast = false,\n }: {\n all?: boolean;\n force?: boolean;\n unmerged?: boolean;\n editor?: string;\n ignoreIssues?: string;\n skipAutoSnap?: boolean;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n unmodified?: boolean;\n failFast?: boolean;\n } & BasicTagSnapParams\n ) {\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (all) {\n this.logger.consoleWarning(\n `--all is deprecated, please omit it. By default all new and modified components are snapped, to snap all components add --unmodified`\n );\n }\n if (force) {\n this.logger.consoleWarning(\n `--force is deprecated, use either --skip-tests or --ignore-build-errors depending on the use case`\n );\n if (pattern) unmodified = true;\n }\n if (!message && !editor) {\n this.logger.consoleWarning(\n `--message will be mandatory in the next few releases. make sure to add a message with your snap, will be displayed in the version history`\n );\n }\n if (forceDeploy) {\n this.logger.consoleWarning(`--force-deploy is deprecated, use --ignore-build-errors instead`);\n ignoreBuildErrors = true;\n }\n\n const results = await this.snapping.snap({\n pattern,\n message,\n unmerged,\n editor,\n ignoreIssues,\n build,\n skipTests,\n skipAutoSnap,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n unmodified,\n exitOnFirstFailedTask: failFast,\n });\n\n if (!results) return chalk.yellow(NOTHING_TO_SNAP_MSG);\n const { snappedComponents, autoSnappedResults, warnings, newComponents, laneName, removedComponents }: SnapResults =\n results;\n const changedComponents = snappedComponents.filter((component) => {\n return (\n !newComponents.searchWithoutVersion(component.id) && !removedComponents?.searchWithoutVersion(component.id)\n );\n });\n const addedComponents = snappedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoSnappedResults ? autoSnappedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const snapExplanation = `\\n(use \"bit export\" to push these components to a remote\")\n(use \"bit reset\" to unstage all local versions, or \"bit reset --head\" to only unstage the latest local snap)`;\n\n const compInBold = (id: ComponentID) => {\n const version = id.hasVersion() ? `@${id.version}` : '';\n return `${chalk.bold(id.toStringWithoutVersion())}${version}`;\n };\n\n const outputComponents = (comps: ConsumerComponent[]) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${compInBold(component.id)}`;\n const autoTag = autoSnappedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => compInBold(a.component.id));\n componentOutput += `\\n ${AUTO_SNAPPED_MSG} (${autoTagComp.length} total):\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n const laneStr = laneName ? ` on \"${laneName}\" lane` : '';\n\n return (\n outputIfExists('new components', 'first version for components', addedComponents) +\n outputIfExists('changed components', 'components that got a version bump', changedComponents) +\n outputIdsIfExists('removed components', removedComponents) +\n warningsOutput +\n chalk.green(`\\n${snappedComponents.length + autoTaggedCount} component(s) snapped${laneStr}`) +\n snapExplanation\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,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cAAc,CAAC,oBAAoB,EAAE,oCAAoC,EAAEzB,iBAAiB,CAAC,GAC7F,IAAA+B,2BAAiB,EAAC,oBAAoB,EAAEhC,iBAAiB,CAAC,GAC1DS,cAAc,GACdjB,gBAAK,CAACyC,KAAK,CAAE,KAAItC,iBAAiB,CAACa,MAAM,GAAGD,eAAgB,wBAAuBwB,OAAQ,EAAC,CAAC,GAC7FrB,eAAe;EAEnB;AACF;AAACwB,OAAA,CAAA9E,OAAA,GAAAA,OAAA"}
|
|
@@ -13,6 +13,14 @@ export declare type SnapDataPerCompRaw = {
|
|
|
13
13
|
aspects?: Record<string, any>;
|
|
14
14
|
message?: string;
|
|
15
15
|
files?: FileData[];
|
|
16
|
+
isNew?: boolean;
|
|
17
|
+
mainFile?: string;
|
|
18
|
+
newDependencies?: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
version?: string;
|
|
21
|
+
isComponent?: boolean;
|
|
22
|
+
type?: 'runtime' | 'dev' | 'peer';
|
|
23
|
+
}>;
|
|
16
24
|
};
|
|
17
25
|
declare type SnapFromScopeOptions = {
|
|
18
26
|
push?: boolean;
|
|
@@ -34,7 +42,7 @@ export declare class SnapFromScopeCmd implements Command {
|
|
|
34
42
|
migration: boolean;
|
|
35
43
|
constructor(snapping: SnappingMain, logger: Logger);
|
|
36
44
|
report([data]: [string], options: SnapFromScopeOptions): Promise<string>;
|
|
37
|
-
json([data]: [string], { push, message, lane, ignoreIssues, build, skipTests, disableSnapPipeline, ignoreBuildErrors, forceDeploy, }: SnapFromScopeOptions): Promise<import("./snapping.main.runtime").SnapFromScopeResults>;
|
|
45
|
+
json([data]: [string], { push, message, lane, ignoreIssues, build, skipTests, disableSnapPipeline, ignoreBuildErrors, rebuildDepsGraph, forceDeploy, }: SnapFromScopeOptions): Promise<import("./snapping.main.runtime").SnapFromScopeResults>;
|
|
38
46
|
private parseData;
|
|
39
47
|
}
|
|
40
48
|
export {};
|
|
@@ -38,16 +38,24 @@ class SnapFromScopeCmd {
|
|
|
38
38
|
_defineProperty(this, "extendedDescription", `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.
|
|
39
39
|
the input data is a stringified JSON of an array of the following object.
|
|
40
40
|
{
|
|
41
|
-
componentId: string;
|
|
42
|
-
dependencies?: string[]; // e.g. [teambit/compiler@1.0.0, teambit/tester@1.0.0]
|
|
41
|
+
componentId: string; // ids always have scope, so it's safe to parse them from string
|
|
42
|
+
dependencies?: string[]; // dependencies to update their versions, e.g. [teambit/compiler@1.0.0, teambit/tester@1.0.0]
|
|
43
43
|
aspects?: Record<string,any> // e.g. { "teambit.react/react": {}, "teambit.envs/envs": { "env": "teambit.react/react" } }
|
|
44
44
|
message?: string; // tag-message.
|
|
45
45
|
files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.
|
|
46
|
+
isNew?: boolean; // if it's new, it'll be generated from the given files. otherwise, it'll be fetched from the scope and updated.
|
|
47
|
+
mainFile?: string; // relevant when isNew is true. default to "index.ts".
|
|
48
|
+
newDependencies?: Array<{ // new dependencies (components and packages) to add.
|
|
49
|
+
id: string; // component-id or package-name. e.g. "teambit.react/react" or "lodash".
|
|
50
|
+
version?: string; // version of the package. e.g. "2.0.3". for packages, it is mandatory.
|
|
51
|
+
isComponent?: boolean; // default true. if false, it's a package dependency
|
|
52
|
+
type?: 'runtime' | 'dev' | 'peer'; // default "runtime".
|
|
53
|
+
}>;
|
|
46
54
|
}
|
|
47
55
|
an example of the final data: '[{"componentId":"ci.remote2/comp-b","message": "first snap"}]'
|
|
48
56
|
`);
|
|
49
57
|
_defineProperty(this, "alias", '');
|
|
50
|
-
_defineProperty(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['m', 'message <message>', 'log message describing the latest changes'], ['', 'lane <lane-id>', 'fetch the components from the given lane'], ['', 'build', 'run the build pipeline'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'disable-snap-pipeline', 'skip the snap pipeline'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
|
|
58
|
+
_defineProperty(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['m', 'message <message>', 'log message describing the latest changes'], ['', 'lane <lane-id>', 'fetch the components from the given lane'], ['', 'build', 'run the build pipeline'], ['', 'skip-tests', 'skip running component tests during snap process'], ['', 'disable-snap-pipeline', 'skip the snap pipeline'], ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'], ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'], ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
|
|
51
59
|
[${Object.keys(_componentIssues().IssuesClasses).join(', ')}]
|
|
52
60
|
to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`], ['j', 'json', 'output as json format']]);
|
|
53
61
|
_defineProperty(this, "loader", true);
|
|
@@ -73,6 +81,7 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
73
81
|
skipTests = false,
|
|
74
82
|
disableSnapPipeline = false,
|
|
75
83
|
ignoreBuildErrors = false,
|
|
84
|
+
rebuildDepsGraph,
|
|
76
85
|
forceDeploy = false
|
|
77
86
|
}) {
|
|
78
87
|
const disableTagAndSnapPipelines = disableSnapPipeline;
|
|
@@ -91,7 +100,8 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
91
100
|
build,
|
|
92
101
|
skipTests,
|
|
93
102
|
disableTagAndSnapPipelines,
|
|
94
|
-
ignoreBuildErrors
|
|
103
|
+
ignoreBuildErrors,
|
|
104
|
+
rebuildDepsGraph
|
|
95
105
|
});
|
|
96
106
|
return results;
|
|
97
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapFromScopeCmd","constructor","snapping","logger","keys","IssuesClasses","join","report","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","length","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","forceDeploy","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","_dataItem$files","componentId","files","file","path","content","Buffer","from","toString","exports"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport type FileData = { path: string; content: string; delete?: boolean };\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n files?: FileData[];\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n} & BasicTagSnapParams;\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // e.g. [teambit/compiler@1.0.0, teambit/tester@1.0.0]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'\n`;\n alias = '';\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report([data]: [string], options: SnapFromScopeOptions) {\n const results = await this.json([data], options);\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}`;\n const exportedOutput =\n exportedIds && exportedIds.length ? `\\n\\n${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return `${snappedOutput}${exportedOutput}`;\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n forceDeploy = false,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (forceDeploy) {\n ignoreBuildErrors = true;\n }\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n });\n\n return results;\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n dataItem.files?.forEach((file) => {\n if (!file.path) throw new Error('expect file to have \"path\" prop');\n if (file.content) {\n file.content = Buffer.from(file.content, 'base64').toString();\n }\n });\n });\n\n return dataParsed;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,Q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,CAAC,CAAC;QAC/D;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAOjB,UAAU;EACnB;AACF;AAACkB,OAAA,CAAAlD,gBAAA,GAAAA,gBAAA"}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","SnapFromScopeCmd","constructor","snapping","logger","keys","IssuesClasses","join","report","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","length","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","forceDeploy","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","_dataItem$files","componentId","files","file","path","content","Buffer","from","toString","exports"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport type FileData = { path: string; content: string; delete?: boolean };\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n files?: FileData[];\n isNew?: boolean;\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n} & BasicTagSnapParams;\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // dependencies to update their versions, e.g. [teambit/compiler@1.0.0, teambit/tester@1.0.0]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.\n isNew?: boolean; // if it's new, it'll be generated from the given files. otherwise, it'll be fetched from the scope and updated.\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{ // new dependencies (components and packages) to add.\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'\n`;\n alias = '';\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report([data]: [string], options: SnapFromScopeOptions) {\n const results = await this.json([data], options);\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}`;\n const exportedOutput =\n exportedIds && exportedIds.length ? `\\n\\n${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return `${snappedOutput}${exportedOutput}`;\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n forceDeploy = false,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (forceDeploy) {\n ignoreBuildErrors = true;\n }\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n });\n\n return results;\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n dataItem.files?.forEach((file) => {\n if (!file.path) throw new Error('expect file to have \"path\" prop');\n if (file.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AY;MACZC,KAAK;MACLC,SAAS;MACTK,0BAA0B;MAC1BH,iBAAiB;MACjBC;IACF,CAAC,CAAC;IAEF,OAAOjB,OAAO;EAChB;EACQsB,SAASA,CAAC7D,IAAY,EAAwB;IACpD,IAAI+D,UAAmB;IACvB,IAAI;MACFA,UAAU,GAAGC,IAAI,CAACC,KAAK,CAACjE,IAAI,CAAC;IAC/B,CAAC,CAAC,OAAOkE,GAAQ,EAAE;MACjB,MAAM,IAAIC,KAAK,CAAE,gDAA+CD,GAAG,CAACjB,OAAQ,EAAC,CAAC;IAChF;IACA,IAAI,CAACmB,KAAK,CAACC,OAAO,CAACN,UAAU,CAAC,EAAE;MAC9B,MAAM,IAAII,KAAK,CAAC,4BAA4B,CAAC;IAC/C;IACAJ,UAAU,CAACO,OAAO,CAAEC,QAAQ,IAAK;MAAA,IAAAC,eAAA;MAC/B,IAAI,CAACD,QAAQ,CAACE,WAAW,EAAE,MAAM,IAAIN,KAAK,CAAC,6CAA6C,CAAC;MACzF,CAAAK,eAAA,GAAAD,QAAQ,CAACG,KAAK,cAAAF,eAAA,eAAdA,eAAA,CAAgBF,OAAO,CAAEK,IAAI,IAAK;QAChC,IAAI,CAACA,IAAI,CAACC,IAAI,EAAE,MAAM,IAAIT,KAAK,CAAC,iCAAiC,CAAC;QAClE,IAAIQ,IAAI,CAACE,OAAO,EAAE;UAChBF,IAAI,CAACE,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACJ,IAAI,CAACE,OAAO,EAAE,QAAQ,CAAC,CAACG,QAAQ,CAAC,CAAC;QAC/D;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAOjB,UAAU;EACnB;AACF;AAACkB,OAAA,CAAAnD,gBAAA,GAAAA,gBAAA"}
|
|
@@ -19,16 +19,32 @@ import { ExportMain } from '@teambit/export';
|
|
|
19
19
|
import { BitObject } from '@teambit/legacy/dist/scope/objects';
|
|
20
20
|
import { GlobalConfigMain } from '@teambit/global-config';
|
|
21
21
|
import { AutoTagResult } from '@teambit/legacy/dist/scope/component-ops/auto-tag';
|
|
22
|
+
import { DependenciesMain } from '@teambit/dependencies';
|
|
22
23
|
import Version, { Log } from '@teambit/legacy/dist/scope/models/version';
|
|
23
24
|
import { BasicTagParams } from './tag-model-component';
|
|
24
25
|
import { TagDataPerCompRaw } from './tag-from-scope.cmd';
|
|
25
|
-
import { SnapDataPerCompRaw } from './snap-from-scope.cmd';
|
|
26
|
+
import { SnapDataPerCompRaw, FileData } from './snap-from-scope.cmd';
|
|
26
27
|
export declare type TagDataPerComp = {
|
|
27
28
|
componentId: ComponentID;
|
|
28
29
|
dependencies: ComponentID[];
|
|
29
30
|
versionToTag?: string;
|
|
30
31
|
prereleaseId?: string;
|
|
31
32
|
message?: string;
|
|
33
|
+
isNew?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare type SnapDataParsed = {
|
|
36
|
+
componentId: ComponentID;
|
|
37
|
+
dependencies: ComponentID[];
|
|
38
|
+
aspects?: Record<string, any>;
|
|
39
|
+
message?: string;
|
|
40
|
+
files?: FileData[];
|
|
41
|
+
isNew?: boolean;
|
|
42
|
+
newDependencies?: {
|
|
43
|
+
id: string;
|
|
44
|
+
version?: string;
|
|
45
|
+
isComponent: boolean;
|
|
46
|
+
type: 'runtime' | 'dev' | 'peer';
|
|
47
|
+
}[];
|
|
32
48
|
};
|
|
33
49
|
export declare type SnapResults = BasicTagResults & {
|
|
34
50
|
snappedComponents: ConsumerComponent[];
|
|
@@ -60,15 +76,16 @@ export declare class SnappingMain {
|
|
|
60
76
|
private exporter;
|
|
61
77
|
private builder;
|
|
62
78
|
private importer;
|
|
79
|
+
private deps;
|
|
63
80
|
private objectsRepo;
|
|
64
|
-
constructor(workspace: Workspace, logger: Logger, issues: IssuesMain, insights: InsightsMain, dependencyResolver: DependencyResolverMain, scope: ScopeMain, exporter: ExportMain, builder: BuilderMain, importer: ImporterMain);
|
|
81
|
+
constructor(workspace: Workspace, logger: Logger, issues: IssuesMain, insights: InsightsMain, dependencyResolver: DependencyResolverMain, scope: ScopeMain, exporter: ExportMain, builder: BuilderMain, importer: ImporterMain, deps: DependenciesMain);
|
|
65
82
|
/**
|
|
66
83
|
* tag the given component ids or all modified/new components if "all" param is set.
|
|
67
84
|
* tag is a similar operation as a snap, which saves the changes into the local scope, but it also creates an alias
|
|
68
85
|
* with a valid semver to that version.
|
|
69
86
|
* tag can be done only on main, not on a lane.
|
|
70
87
|
*/
|
|
71
|
-
tag({ ids, message, version, editor, snapped, unmerged, releaseType, preReleaseId, ignoreIssues, ignoreNewestVersion, skipTests, skipAutoTag, build, unmodified, soft, persist, ignoreBuildErrors, incrementBy, disableTagAndSnapPipelines, failFast, }: {
|
|
88
|
+
tag({ ids, message, version, editor, snapped, unmerged, releaseType, preReleaseId, ignoreIssues, ignoreNewestVersion, skipTests, skipAutoTag, build, unmodified, soft, persist, ignoreBuildErrors, rebuildDepsGraph, incrementBy, disableTagAndSnapPipelines, failFast, }: {
|
|
72
89
|
ids?: string[];
|
|
73
90
|
all?: boolean | string;
|
|
74
91
|
snapped?: boolean;
|
|
@@ -97,7 +114,7 @@ export declare class SnappingMain {
|
|
|
97
114
|
* once a component is snapped on a lane, it becomes part of it.
|
|
98
115
|
*/
|
|
99
116
|
snap({ pattern, legacyBitIds, // @todo: change to ComponentID[]. pass only if have the ids already parsed.
|
|
100
|
-
unmerged, editor, message, ignoreIssues, skipTests, skipAutoSnap, build, disableTagAndSnapPipelines, ignoreBuildErrors, unmodified, exitOnFirstFailedTask, }: {
|
|
117
|
+
unmerged, editor, message, ignoreIssues, skipTests, skipAutoSnap, build, disableTagAndSnapPipelines, ignoreBuildErrors, rebuildDepsGraph, unmodified, exitOnFirstFailedTask, }: {
|
|
101
118
|
pattern?: string;
|
|
102
119
|
legacyBitIds?: ComponentIdList;
|
|
103
120
|
unmerged?: boolean;
|
|
@@ -109,6 +126,7 @@ export declare class SnappingMain {
|
|
|
109
126
|
skipAutoSnap?: boolean;
|
|
110
127
|
disableTagAndSnapPipelines?: boolean;
|
|
111
128
|
ignoreBuildErrors?: boolean;
|
|
129
|
+
rebuildDepsGraph?: boolean;
|
|
112
130
|
unmodified?: boolean;
|
|
113
131
|
exitOnFirstFailedTask?: boolean;
|
|
114
132
|
}): Promise<SnapResults | null>;
|
|
@@ -121,7 +139,7 @@ export declare class SnappingMain {
|
|
|
121
139
|
isSoftUntag: boolean;
|
|
122
140
|
}>;
|
|
123
141
|
resetNeverExported(): Promise<ComponentID[]>;
|
|
124
|
-
_addFlattenedDependenciesToComponents(components: ConsumerComponent[]): Promise<void>;
|
|
142
|
+
_addFlattenedDependenciesToComponents(components: ConsumerComponent[], rebuildDepsGraph?: boolean): Promise<void>;
|
|
125
143
|
throwForDepsFromAnotherLane(components: ConsumerComponent[]): Promise<void>;
|
|
126
144
|
private throwForVariousIssues;
|
|
127
145
|
private throwForDepsFromAnotherLaneForComp;
|
|
@@ -158,7 +176,7 @@ export declare class SnappingMain {
|
|
|
158
176
|
static slots: never[];
|
|
159
177
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
160
178
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
161
|
-
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig,]: [
|
|
179
|
+
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps,]: [
|
|
162
180
|
Workspace,
|
|
163
181
|
CLIMain,
|
|
164
182
|
LoggerMain,
|
|
@@ -169,7 +187,8 @@ export declare class SnappingMain {
|
|
|
169
187
|
ExportMain,
|
|
170
188
|
BuilderMain,
|
|
171
189
|
ImporterMain,
|
|
172
|
-
GlobalConfigMain
|
|
190
|
+
GlobalConfigMain,
|
|
191
|
+
DependenciesMain
|
|
173
192
|
]): Promise<SnappingMain>;
|
|
174
193
|
}
|
|
175
194
|
export default SnappingMain;
|