@teambit/snapping 0.0.3 → 0.0.6
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/components-have-issues.d.ts +5 -0
- package/dist/components-have-issues.js +61 -0
- package/dist/components-have-issues.js.map +1 -0
- package/dist/snapping.main.runtime.d.ts +24 -4
- package/dist/snapping.main.runtime.js +161 -33
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/snapping.spec.d.ts +1 -0
- package/dist/snapping.spec.js +140 -0
- package/dist/snapping.spec.js.map +1 -0
- package/dist/tag-cmd.js +9 -103
- package/dist/tag-cmd.js.map +1 -1
- package/package-tar/teambit-snapping-0.0.6.tgz +0 -0
- package/package.json +16 -9
- /package/{preview-1648142274038.js → preview-1648386827284.js} +0 -0
- package/package-tar/teambit-snapping-0.0.3.tgz +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ComponentsHaveIssues = void 0;
|
|
9
|
+
|
|
10
|
+
function _bitError() {
|
|
11
|
+
const data = require("@teambit/bit-error");
|
|
12
|
+
|
|
13
|
+
_bitError = function () {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function _issues() {
|
|
21
|
+
const data = _interopRequireDefault(require("@teambit/issues"));
|
|
22
|
+
|
|
23
|
+
_issues = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function _componentIssuesTemplate() {
|
|
31
|
+
const data = _interopRequireDefault(require("@teambit/legacy/dist/cli/templates/component-issues-template"));
|
|
32
|
+
|
|
33
|
+
_componentIssuesTemplate = function () {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
class ComponentsHaveIssues extends _bitError().BitError {
|
|
41
|
+
constructor(components) {
|
|
42
|
+
const issuesColored = (0, _componentIssuesTemplate().default)(components);
|
|
43
|
+
super(`error: issues found with the following components
|
|
44
|
+
${issuesColored}
|
|
45
|
+
|
|
46
|
+
to get the list of component-issues names and suggestions how to resolve them, run "bit component-issues".
|
|
47
|
+
|
|
48
|
+
while highly not recommended, it's possible to ignore issues in two ways:
|
|
49
|
+
1) temporarily ignore for this tag/snap command by entering "--ignore-issues" flag, e.g. \`bit tag --ignore-issues "MultipleEnvs, ImportNonMainFiles" \`
|
|
50
|
+
2) ignore the issue completely by configuring it in the workspace.jsonc file. e.g:
|
|
51
|
+
"${_issues().default.id}": {
|
|
52
|
+
"ignoreIssues": ["ParseErrors", "MissingPackagesDependenciesOnFs"]
|
|
53
|
+
}
|
|
54
|
+
`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
exports.ComponentsHaveIssues = ComponentsHaveIssues;
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=components-have-issues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components-have-issues.ts"],"names":["ComponentsHaveIssues","BitError","constructor","components","issuesColored","IssuesAspect","id"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,oBAAN,SAAmCC,oBAAnC,CAA4C;AACjDC,EAAAA,WAAW,CAACC,UAAD,EAAkC;AAC3C,UAAMC,aAAa,GAAG,wCAAwBD,UAAxB,CAAtB;AACA,UAAO;AACX,EAAEC,aAAc;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,GAAGC,kBAAaC,EAAG;AACnB;AACA;AACA,CAXI;AAYD;;AAfgD","sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport IssuesAspect from '@teambit/issues';\nimport componentIssuesTemplate from '@teambit/legacy/dist/cli/templates/component-issues-template';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\n\nexport class ComponentsHaveIssues extends BitError {\n constructor(components: ConsumerComponent[]) {\n const issuesColored = componentIssuesTemplate(components);\n super(`error: issues found with the following components\n${issuesColored}\n\nto get the list of component-issues names and suggestions how to resolve them, run \"bit component-issues\".\n\nwhile highly not recommended, it's possible to ignore issues in two ways:\n1) temporarily ignore for this tag/snap command by entering \"--ignore-issues\" flag, e.g. \\`bit tag --ignore-issues \"MultipleEnvs, ImportNonMainFiles\" \\`\n2) ignore the issue completely by configuring it in the workspace.jsonc file. e.g:\n\"${IssuesAspect.id}\": {\n \"ignoreIssues\": [\"ParseErrors\", \"MissingPackagesDependenciesOnFs\"]\n}\n`);\n }\n}\n"]}
|
|
@@ -2,20 +2,33 @@ import { CLIMain } from '@teambit/cli';
|
|
|
2
2
|
import { CommunityMain } from '@teambit/community';
|
|
3
3
|
import { Workspace } from '@teambit/workspace';
|
|
4
4
|
import { BitIds } from '@teambit/legacy/dist/bit-id';
|
|
5
|
-
import {
|
|
5
|
+
import { TagResults, BasicTagParams } from '@teambit/legacy/dist/api/consumer/lib/tag';
|
|
6
6
|
import { SnapResults } from '@teambit/legacy/dist/api/consumer/lib/snap';
|
|
7
7
|
import { Logger, LoggerMain } from '@teambit/logger';
|
|
8
|
+
import { IssuesMain } from '@teambit/issues';
|
|
8
9
|
export declare class SnappingMain {
|
|
9
10
|
private workspace;
|
|
10
11
|
private logger;
|
|
11
|
-
|
|
12
|
+
private issues;
|
|
13
|
+
constructor(workspace: Workspace, logger: Logger, issues: IssuesMain);
|
|
12
14
|
/**
|
|
13
15
|
* tag the given component ids or all modified/new components if "all" param is set.
|
|
14
16
|
* tag is a similar operation as a snap, which saves the changes into the local scope, but it also creates an alias
|
|
15
17
|
* with a valid semver to that version.
|
|
16
18
|
* tag can be done only on main, not on a lane.
|
|
17
19
|
*/
|
|
18
|
-
tag(
|
|
20
|
+
tag({ ids, message, ver, all, editor, snapped, patch, minor, major, preRelease, force, verbose, ignoreIssues, ignoreNewestVersion, skipTests, skipAutoTag, scope, build, soft, persist, forceDeploy, incrementBy, disableTagAndSnapPipelines, }: {
|
|
21
|
+
ids?: string[];
|
|
22
|
+
all?: boolean | string;
|
|
23
|
+
snapped?: boolean | string;
|
|
24
|
+
ver?: string;
|
|
25
|
+
patch?: boolean;
|
|
26
|
+
minor?: boolean;
|
|
27
|
+
major?: boolean;
|
|
28
|
+
ignoreIssues?: string;
|
|
29
|
+
scope?: string | boolean;
|
|
30
|
+
incrementBy?: number;
|
|
31
|
+
} & Partial<BasicTagParams>): Promise<TagResults | null>;
|
|
19
32
|
/**
|
|
20
33
|
* save the local changes of a component(s) into the scope. snap can be done on main or on a lane.
|
|
21
34
|
* once a component is snapped on a lane, it becomes part of it.
|
|
@@ -42,5 +55,12 @@ export declare class SnappingMain {
|
|
|
42
55
|
static slots: never[];
|
|
43
56
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
44
57
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
45
|
-
static provider([workspace, cli, community, loggerMain
|
|
58
|
+
static provider([workspace, cli, community, loggerMain, issues]: [
|
|
59
|
+
Workspace,
|
|
60
|
+
CLIMain,
|
|
61
|
+
CommunityMain,
|
|
62
|
+
LoggerMain,
|
|
63
|
+
IssuesMain
|
|
64
|
+
]): Promise<SnappingMain>;
|
|
46
65
|
}
|
|
66
|
+
export default SnappingMain;
|
|
@@ -19,7 +19,7 @@ require("core-js/modules/es.string.trim.js");
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", {
|
|
20
20
|
value: true
|
|
21
21
|
});
|
|
22
|
-
exports.SnappingMain = void 0;
|
|
22
|
+
exports.default = exports.SnappingMain = void 0;
|
|
23
23
|
|
|
24
24
|
function _defineProperty2() {
|
|
25
25
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -41,6 +41,26 @@ function _cli() {
|
|
|
41
41
|
return data;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
function _utils() {
|
|
45
|
+
const data = require("@teambit/legacy/dist/utils");
|
|
46
|
+
|
|
47
|
+
_utils = function () {
|
|
48
|
+
return data;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return data;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function _featureToggle() {
|
|
55
|
+
const data = require("@teambit/legacy/dist/api/consumer/lib/feature-toggle");
|
|
56
|
+
|
|
57
|
+
_featureToggle = function () {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
44
64
|
function _componentIssues() {
|
|
45
65
|
const data = require("@teambit/component-issues");
|
|
46
66
|
|
|
@@ -231,6 +251,16 @@ function _logger() {
|
|
|
231
251
|
return data;
|
|
232
252
|
}
|
|
233
253
|
|
|
254
|
+
function _bitError() {
|
|
255
|
+
const data = require("@teambit/bit-error");
|
|
256
|
+
|
|
257
|
+
_bitError = function () {
|
|
258
|
+
return data;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
return data;
|
|
262
|
+
}
|
|
263
|
+
|
|
234
264
|
function _failedLoadForTag() {
|
|
235
265
|
const data = require("@teambit/legacy/dist/consumer/component/exceptions/failed-load-for-tag");
|
|
236
266
|
|
|
@@ -241,6 +271,16 @@ function _failedLoadForTag() {
|
|
|
241
271
|
return data;
|
|
242
272
|
}
|
|
243
273
|
|
|
274
|
+
function _issues() {
|
|
275
|
+
const data = _interopRequireDefault(require("@teambit/issues"));
|
|
276
|
+
|
|
277
|
+
_issues = function () {
|
|
278
|
+
return data;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
return data;
|
|
282
|
+
}
|
|
283
|
+
|
|
244
284
|
function _snapCmd() {
|
|
245
285
|
const data = require("./snap-cmd");
|
|
246
286
|
|
|
@@ -271,16 +311,23 @@ function _tagCmd() {
|
|
|
271
311
|
return data;
|
|
272
312
|
}
|
|
273
313
|
|
|
274
|
-
function
|
|
314
|
+
function _componentsHaveIssues() {
|
|
315
|
+
const data = require("./components-have-issues");
|
|
275
316
|
|
|
276
|
-
|
|
317
|
+
_componentsHaveIssues = function () {
|
|
318
|
+
return data;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
return data;
|
|
322
|
+
}
|
|
277
323
|
|
|
278
324
|
const HooksManagerInstance = _hooks().default.getInstance();
|
|
279
325
|
|
|
280
326
|
class SnappingMain {
|
|
281
|
-
constructor(workspace, logger) {
|
|
327
|
+
constructor(workspace, logger, issues) {
|
|
282
328
|
this.workspace = workspace;
|
|
283
329
|
this.logger = logger;
|
|
330
|
+
this.issues = issues;
|
|
284
331
|
}
|
|
285
332
|
/**
|
|
286
333
|
* tag the given component ids or all modified/new components if "all" param is set.
|
|
@@ -288,26 +335,86 @@ class SnappingMain {
|
|
|
288
335
|
* with a valid semver to that version.
|
|
289
336
|
* tag can be done only on main, not on a lane.
|
|
290
337
|
*/
|
|
338
|
+
// eslint-disable-next-line complexity
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
async tag({
|
|
342
|
+
ids = [],
|
|
343
|
+
message = '',
|
|
344
|
+
ver,
|
|
345
|
+
all = false,
|
|
346
|
+
editor = '',
|
|
347
|
+
snapped = false,
|
|
348
|
+
patch,
|
|
349
|
+
minor,
|
|
350
|
+
major,
|
|
351
|
+
preRelease,
|
|
352
|
+
force = false,
|
|
353
|
+
verbose = false,
|
|
354
|
+
ignoreIssues,
|
|
355
|
+
ignoreNewestVersion = false,
|
|
356
|
+
skipTests = false,
|
|
357
|
+
skipAutoTag = false,
|
|
358
|
+
scope,
|
|
359
|
+
build,
|
|
360
|
+
soft = false,
|
|
361
|
+
persist = false,
|
|
362
|
+
forceDeploy = false,
|
|
363
|
+
incrementBy = 1,
|
|
364
|
+
disableTagAndSnapPipelines = false
|
|
365
|
+
}) {
|
|
366
|
+
build = (0, _featureToggle().isFeatureEnabled)(_featureToggle().BUILD_ON_CI) ? Boolean(build) : true;
|
|
367
|
+
if (soft) build = false;
|
|
368
|
+
|
|
369
|
+
function getVersion() {
|
|
370
|
+
if (scope && (0, _utils().isString)(scope)) return scope;
|
|
371
|
+
if (all && (0, _utils().isString)(all)) return all;
|
|
372
|
+
if (snapped && (0, _utils().isString)(snapped)) return snapped;
|
|
373
|
+
return ver;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (!ids.length && !all && !snapped && !scope && !persist) {
|
|
377
|
+
throw new (_bitError().BitError)('missing [id]. to tag all components, please use --all flag');
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (ids.length && all) {
|
|
381
|
+
throw new (_bitError().BitError)('you can use either a specific component [id] to tag a particular component or --all flag to tag them all');
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (disableTagAndSnapPipelines && forceDeploy) {
|
|
385
|
+
throw new (_bitError().BitError)('you can use either force-deploy or disable-tag-pipeline, but not both');
|
|
386
|
+
}
|
|
291
387
|
|
|
388
|
+
if (all && persist) {
|
|
389
|
+
throw new (_bitError().BitError)('you can use either --all or --persist, but not both');
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (editor && persist) {
|
|
393
|
+
throw new (_bitError().BitError)('you can use either --editor or --persist, but not both');
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if (editor && message) {
|
|
397
|
+
throw new (_bitError().BitError)('you can use either --editor or --message, but not both');
|
|
398
|
+
}
|
|
292
399
|
|
|
293
|
-
|
|
400
|
+
const releaseFlags = [patch, minor, major, preRelease].filter(x => x);
|
|
401
|
+
|
|
402
|
+
if (releaseFlags.length > 1) {
|
|
403
|
+
throw new (_bitError().BitError)('you can use only one of the following - patch, minor, major, pre-release');
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
let releaseType = _constants().DEFAULT_BIT_RELEASE_TYPE;
|
|
407
|
+
|
|
408
|
+
const includeImported = Boolean(scope && all);
|
|
409
|
+
if (major) releaseType = 'major';else if (minor) releaseType = 'minor';else if (patch) releaseType = 'patch';else if (preRelease) releaseType = 'prerelease';
|
|
410
|
+
const exactVersion = getVersion();
|
|
411
|
+
all = Boolean(all);
|
|
412
|
+
snapped = Boolean(snapped);
|
|
413
|
+
preRelease = typeof preRelease === 'string' ? preRelease : '';
|
|
294
414
|
if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
|
|
295
|
-
const {
|
|
296
|
-
ids,
|
|
297
|
-
all,
|
|
298
|
-
exactVersion,
|
|
299
|
-
force,
|
|
300
|
-
scope,
|
|
301
|
-
includeImported,
|
|
302
|
-
persist,
|
|
303
|
-
snapped,
|
|
304
|
-
soft
|
|
305
|
-
} = tagParams;
|
|
306
415
|
const idsHasWildcard = (0, _hasWildcard().default)(ids);
|
|
307
416
|
const isAll = Boolean(all || scope || idsHasWildcard);
|
|
308
417
|
const validExactVersion = (0, _semverHelper().validateVersion)(exactVersion);
|
|
309
|
-
const preHook = isAll ? _constants().PRE_TAG_ALL_HOOK : _constants().PRE_TAG_HOOK;
|
|
310
|
-
HooksManagerInstance.triggerHook(preHook, tagParams);
|
|
311
418
|
const consumer = this.workspace.consumer;
|
|
312
419
|
const componentsList = new (_componentsList().default)(consumer);
|
|
313
420
|
|
|
@@ -323,7 +430,7 @@ class SnappingMain {
|
|
|
323
430
|
const legacyBitIds = _bitId().BitIds.fromArray(bitIds);
|
|
324
431
|
|
|
325
432
|
if (this.workspace.isLegacy) {
|
|
326
|
-
|
|
433
|
+
persist = true;
|
|
327
434
|
}
|
|
328
435
|
|
|
329
436
|
this.logger.debug(`tagging the following components: ${legacyBitIds.toString()}`);
|
|
@@ -335,7 +442,7 @@ class SnappingMain {
|
|
|
335
442
|
}
|
|
336
443
|
|
|
337
444
|
const components = await this.loadComponentsForTag(legacyBitIds);
|
|
338
|
-
this.throwForComponentIssues(components,
|
|
445
|
+
this.throwForComponentIssues(components, ignoreIssues);
|
|
339
446
|
const areComponentsMissingFromScope = components.some(c => !c.componentFromModel && c.id.hasScope());
|
|
340
447
|
|
|
341
448
|
if (areComponentsMissingFromScope) {
|
|
@@ -346,17 +453,33 @@ class SnappingMain {
|
|
|
346
453
|
taggedComponents,
|
|
347
454
|
autoTaggedResults,
|
|
348
455
|
publishedPackages
|
|
349
|
-
} = await (0, _tagModelComponent().default)(
|
|
350
|
-
exactVersion: validExactVersion,
|
|
351
|
-
ids: legacyBitIds,
|
|
456
|
+
} = await (0, _tagModelComponent().default)({
|
|
352
457
|
consumerComponents: components,
|
|
458
|
+
ids: legacyBitIds,
|
|
353
459
|
scope: this.workspace.scope.legacyScope,
|
|
354
|
-
|
|
355
|
-
|
|
460
|
+
message,
|
|
461
|
+
editor,
|
|
462
|
+
exactVersion: validExactVersion,
|
|
463
|
+
releaseType,
|
|
464
|
+
preRelease,
|
|
465
|
+
force,
|
|
466
|
+
consumer: this.workspace.consumer,
|
|
467
|
+
ignoreNewestVersion,
|
|
468
|
+
skipTests,
|
|
469
|
+
verbose,
|
|
470
|
+
skipAutoTag,
|
|
471
|
+
soft,
|
|
472
|
+
build,
|
|
473
|
+
persist,
|
|
474
|
+
resolveUnmerged: false,
|
|
475
|
+
disableTagAndSnapPipelines,
|
|
476
|
+
forceDeploy,
|
|
477
|
+
incrementBy
|
|
478
|
+
});
|
|
356
479
|
const tagResults = {
|
|
357
480
|
taggedComponents,
|
|
358
481
|
autoTaggedResults,
|
|
359
|
-
isSoftTag:
|
|
482
|
+
isSoftTag: soft,
|
|
360
483
|
publishedPackages
|
|
361
484
|
}; // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
362
485
|
|
|
@@ -364,7 +487,7 @@ class SnappingMain {
|
|
|
364
487
|
|
|
365
488
|
tagResults.newComponents = newComponents;
|
|
366
489
|
const postHook = isAll ? _constants().POST_TAG_ALL_HOOK : _constants().POST_TAG_HOOK;
|
|
367
|
-
HooksManagerInstance.triggerHook(postHook, tagResults);
|
|
490
|
+
HooksManagerInstance === null || HooksManagerInstance === void 0 ? void 0 : HooksManagerInstance.triggerHook(postHook, tagResults);
|
|
368
491
|
|
|
369
492
|
_analytics().Analytics.setExtraData('num_components', // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
370
493
|
_ramda().default.concat(tagResults.taggedComponents, tagResults.autoTaggedResults, tagResults.newComponents).length);
|
|
@@ -533,8 +656,10 @@ class SnappingMain {
|
|
|
533
656
|
return;
|
|
534
657
|
}
|
|
535
658
|
|
|
536
|
-
const
|
|
537
|
-
|
|
659
|
+
const issuesToIgnoreFromFlag = (ignoreIssues === null || ignoreIssues === void 0 ? void 0 : ignoreIssues.split(',').map(issue => issue.trim())) || [];
|
|
660
|
+
const issuesToIgnoreFromConfig = this.issues.getIssuesToIgnore();
|
|
661
|
+
const issuesToIgnore = [...issuesToIgnoreFromFlag, ...issuesToIgnoreFromConfig];
|
|
662
|
+
issuesToIgnore.forEach(issue => {
|
|
538
663
|
const issueClass = _componentIssues().IssuesClasses[issue];
|
|
539
664
|
|
|
540
665
|
if (!issueClass) {
|
|
@@ -552,7 +677,7 @@ class SnappingMain {
|
|
|
552
677
|
});
|
|
553
678
|
|
|
554
679
|
if (!_ramda().default.isEmpty(componentsWithBlockingIssues)) {
|
|
555
|
-
throw new (
|
|
680
|
+
throw new (_componentsHaveIssues().ComponentsHaveIssues)(componentsWithBlockingIssues);
|
|
556
681
|
}
|
|
557
682
|
}
|
|
558
683
|
|
|
@@ -622,9 +747,9 @@ class SnappingMain {
|
|
|
622
747
|
};
|
|
623
748
|
}
|
|
624
749
|
|
|
625
|
-
static async provider([workspace, cli, community, loggerMain]) {
|
|
750
|
+
static async provider([workspace, cli, community, loggerMain, issues]) {
|
|
626
751
|
const logger = loggerMain.createLogger(_snapping().SnappingAspect.id);
|
|
627
|
-
const snapping = new SnappingMain(workspace, logger);
|
|
752
|
+
const snapping = new SnappingMain(workspace, logger, issues);
|
|
628
753
|
const snapCmd = new (_snapCmd().SnapCmd)(community.getBaseDomain(), snapping);
|
|
629
754
|
const tagCmd = new (_tagCmd().TagCmd)(community.getBaseDomain(), snapping);
|
|
630
755
|
cli.register(tagCmd, snapCmd);
|
|
@@ -635,9 +760,12 @@ class SnappingMain {
|
|
|
635
760
|
|
|
636
761
|
exports.SnappingMain = SnappingMain;
|
|
637
762
|
(0, _defineProperty2().default)(SnappingMain, "slots", []);
|
|
638
|
-
(0, _defineProperty2().default)(SnappingMain, "dependencies", [_workspace().default, _cli().CLIAspect, _community().default, _logger().LoggerAspect]);
|
|
763
|
+
(0, _defineProperty2().default)(SnappingMain, "dependencies", [_workspace().default, _cli().CLIAspect, _community().default, _logger().LoggerAspect, _issues().default]);
|
|
639
764
|
(0, _defineProperty2().default)(SnappingMain, "runtime", _cli().MainRuntime);
|
|
640
765
|
|
|
641
766
|
_snapping().SnappingAspect.addRuntime(SnappingMain);
|
|
642
767
|
|
|
768
|
+
var _default = SnappingMain;
|
|
769
|
+
exports.default = _default;
|
|
770
|
+
|
|
643
771
|
//# sourceMappingURL=snapping.main.runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["snapping.main.runtime.ts"],"names":["HooksManagerInstance","HooksManager","getInstance","SnappingMain","constructor","workspace","logger","tag","tagParams","ConsumerNotFound","ids","all","exactVersion","force","scope","includeImported","persist","snapped","soft","idsHasWildcard","isAll","Boolean","validExactVersion","preHook","PRE_TAG_ALL_HOOK","PRE_TAG_HOOK","triggerHook","consumer","componentsList","ComponentsList","loader","start","newComponents","listNewComponents","bitIds","warnings","getComponentsToTag","R","isEmpty","legacyBitIds","BitIds","fromArray","isLegacy","debug","toString","Analytics","addBreadCrumb","hashData","componentFsCache","deleteAllDependenciesDataCache","components","loadComponentsForTag","throwForComponentIssues","ignoreIssues","areComponentsMissingFromScope","some","c","componentFromModel","id","hasScope","ComponentsPendingImport","taggedComponents","autoTaggedResults","publishedPackages","consumerComponents","legacyScope","tagResults","isSoftTag","postHook","POST_TAG_ALL_HOOK","POST_TAG_HOOK","setExtraData","concat","length","onDestroy","snap","resolveUnmerged","message","verbose","skipTests","skipAutoSnap","build","disableTagAndSnapPipelines","forceDeploy","Error","LanesIsDisabled","getIdsToSnap","ignoreNewestVersion","skipAutoTag","isSnap","snapResults","snappedComponents","autoSnappedResults","currentLane","getCurrentLaneId","laneName","isDefault","name","idHasWildcard","bitId","getParsedId","componentStatus","getComponentStatusById","modified","tagPendingComponents","listTagPendingComponents","filterComponentsByWildcard","loadComponents","toVersionLatest","shouldReloadComponents","componentsWithRelativePaths","componentsWithFilesNotDir","componentsWithCustomModuleResolution","forEach","component","componentMap","rootDir","hasRelativePaths","issues","getIssue","IssuesClasses","RelativeComponentsAuthored","hasCustomModuleResolutions","MissingCustomModuleResolutionLinks","trackDir","changeRootDirAndUpdateFilesAccordingly","push","toStringWithoutVersion","FailedLoadForTag","sort","clearCache","reloadedComponents","delete","issuesToIgnore","split","map","issue","trim","issueClass","Object","keys","join","componentsWithBlockingIssues","filter","shouldBlockTagging","ComponentsHaveIssues","isAllScope","softTaggedComponents","listSoftTaggedComponents","listTagPendingOfAllScope","listSnappedComponentsOnMain","snappedComponentsIds","toBitId","Promise","idWithoutVer","version","allIds","changeVersion","flat","tagPendingComponentsLatest","latestVersions","componentId","semver","valid","gt","undefined","provider","cli","community","loggerMain","createLogger","SnappingAspect","snapping","snapCmd","SnapCmd","getBaseDomain","tagCmd","TagCmd","register","WorkspaceAspect","CLIAspect","CommunityAspect","LoggerAspect","MainRuntime","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA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AJ,CAAaF,MAAb,EAAqBH,OAArB;AACA,WAAOD,QAAP;AACD;;AAhUuB;;;gCAAbzK,Y,WAsTI,E;gCAtTJA,Y,kBAuTW,CAACgL,oBAAD,EAAkBC,gBAAlB,EAA6BC,oBAA7B,EAA8CC,sBAA9C,C;gCAvTXnL,Y,aAwTMoL,kB;;AAWnBZ,2BAAea,UAAf,CAA0BrL,YAA1B","sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport CommunityAspect, { CommunityMain } from '@teambit/community';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport R from 'ramda';\nimport semver from 'semver';\nimport { compact } from 'lodash';\nimport { Analytics } from '@teambit/legacy/dist/analytics/analytics';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { POST_TAG_ALL_HOOK, POST_TAG_HOOK, PRE_TAG_ALL_HOOK, PRE_TAG_HOOK } from '@teambit/legacy/dist/constants';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport HooksManager from '@teambit/legacy/dist/hooks';\nimport { TagParams, TagResults } from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport { validateVersion } from '@teambit/legacy/dist/utils/semver-helper';\nimport { ConsumerNotFound, ComponentsHaveIssues } from '@teambit/legacy/dist/consumer/exceptions';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport tagModelComponent from '@teambit/legacy/dist/scope/component-ops/tag-model-component';\nimport { LanesIsDisabled } from '@teambit/legacy/dist/consumer/lanes/exceptions/lanes-is-disabled';\nimport { SnapResults } from '@teambit/legacy/dist/api/consumer/lib/snap';\nimport ComponentsPendingImport from '@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-import';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport { FailedLoadForTag } from '@teambit/legacy/dist/consumer/component/exceptions/failed-load-for-tag';\nimport { SnapCmd } from './snap-cmd';\nimport { SnappingAspect } from './snapping.aspect';\nimport { TagCmd } from './tag-cmd';\n\nconst HooksManagerInstance = HooksManager.getInstance();\n\nexport class SnappingMain {\n constructor(private workspace: Workspace, private logger: Logger) {}\n\n /**\n * tag the given component ids or all modified/new components if \"all\" param is set.\n * tag is a similar operation as a snap, which saves the changes into the local scope, but it also creates an alias\n * with a valid semver to that version.\n * tag can be done only on main, not on a lane.\n */\n async tag(tagParams: TagParams): Promise<TagResults | null> {\n if (!this.workspace) throw new ConsumerNotFound();\n const { ids, all, exactVersion, force, scope, includeImported, persist, snapped, soft } = tagParams;\n const idsHasWildcard = hasWildcard(ids);\n const isAll = Boolean(all || scope || idsHasWildcard);\n const validExactVersion = validateVersion(exactVersion);\n const preHook = isAll ? PRE_TAG_ALL_HOOK : PRE_TAG_HOOK;\n HooksManagerInstance.triggerHook(preHook, tagParams);\n const consumer = this.workspace.consumer;\n const componentsList = new ComponentsList(consumer);\n loader.start('determine components to tag...');\n const newComponents = await componentsList.listNewComponents();\n const { bitIds, warnings } = await this.getComponentsToTag(\n Boolean(scope),\n exactVersion,\n includeImported,\n persist,\n force,\n ids,\n snapped\n );\n if (R.isEmpty(bitIds)) return null;\n\n const legacyBitIds = BitIds.fromArray(bitIds);\n\n if (this.workspace.isLegacy) {\n tagParams.persist = true;\n }\n this.logger.debug(`tagging the following components: ${legacyBitIds.toString()}`);\n Analytics.addBreadCrumb('tag', `tagging the following components: ${Analytics.hashData(legacyBitIds)}`);\n if (!soft) {\n await this.workspace.consumer.componentFsCache.deleteAllDependenciesDataCache();\n }\n const components = await this.loadComponentsForTag(legacyBitIds);\n this.throwForComponentIssues(components, tagParams.ignoreIssues);\n const areComponentsMissingFromScope = components.some((c) => !c.componentFromModel && c.id.hasScope());\n if (areComponentsMissingFromScope) {\n throw new ComponentsPendingImport();\n }\n\n const { taggedComponents, autoTaggedResults, publishedPackages } = await tagModelComponent({\n ...tagParams,\n exactVersion: validExactVersion,\n ids: legacyBitIds,\n consumerComponents: components,\n scope: this.workspace.scope.legacyScope,\n consumer: this.workspace.consumer,\n });\n\n const tagResults = { taggedComponents, autoTaggedResults, isSoftTag: tagParams.soft, publishedPackages };\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n tagResults.warnings = warnings;\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n tagResults.newComponents = newComponents;\n const postHook = isAll ? POST_TAG_ALL_HOOK : POST_TAG_HOOK;\n HooksManagerInstance.triggerHook(postHook, tagResults);\n Analytics.setExtraData(\n 'num_components',\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n R.concat(tagResults.taggedComponents, tagResults.autoTaggedResults, tagResults.newComponents).length\n );\n await consumer.onDestroy();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return tagResults;\n }\n\n /**\n * save the local changes of a component(s) into the scope. snap can be done on main or on a lane.\n * once a component is snapped on a lane, it becomes part of it.\n */\n async snap({\n id, // @todo: rename to \"patterns\"\n legacyBitIds, // @todo: change to ComponentID[]. pass only if have the ids already parsed.\n resolveUnmerged = false,\n message = '',\n force = false,\n verbose = false,\n ignoreIssues,\n skipTests = false,\n skipAutoSnap = false,\n build,\n disableTagAndSnapPipelines = false,\n forceDeploy = false,\n }: {\n id?: string;\n legacyBitIds?: BitIds;\n resolveUnmerged?: boolean;\n message?: string;\n force?: boolean;\n verbose?: boolean;\n ignoreIssues?: string;\n build: boolean;\n skipTests?: boolean;\n skipAutoSnap?: boolean;\n disableTagAndSnapPipelines?: boolean;\n forceDeploy?: boolean;\n }): Promise<SnapResults | null> {\n if (!this.workspace) throw new ConsumerNotFound();\n if (id && legacyBitIds) throw new Error(`please pass either id or legacyBitIds, not both`);\n const consumer: Consumer = this.workspace.consumer;\n if (consumer.isLegacy) throw new LanesIsDisabled();\n const componentsList = new ComponentsList(consumer);\n const newComponents = (await componentsList.listNewComponents()) as BitIds;\n const ids = legacyBitIds || (await getIdsToSnap());\n if (!ids) return null;\n this.logger.debug(`snapping the following components: ${ids.toString()}`);\n await this.workspace.consumer.componentFsCache.deleteAllDependenciesDataCache();\n const components = await this.loadComponentsForTag(ids);\n this.throwForComponentIssues(components, ignoreIssues);\n const areComponentsMissingFromScope = components.some((c) => !c.componentFromModel && c.id.hasScope());\n if (areComponentsMissingFromScope) {\n throw new ComponentsPendingImport();\n }\n\n const { taggedComponents, autoTaggedResults } = await tagModelComponent({\n consumerComponents: components,\n ids,\n ignoreNewestVersion: false,\n scope: this.workspace.scope.legacyScope,\n message,\n force,\n consumer: this.workspace.consumer,\n skipTests,\n verbose,\n skipAutoTag: skipAutoSnap,\n persist: true,\n soft: false,\n build,\n resolveUnmerged,\n isSnap: true,\n disableTagAndSnapPipelines,\n forceDeploy,\n });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const snapResults: SnapResults = { snappedComponents: taggedComponents, autoSnappedResults: autoTaggedResults };\n\n snapResults.newComponents = newComponents;\n const currentLane = consumer.getCurrentLaneId();\n snapResults.laneName = currentLane.isDefault() ? null : currentLane.name;\n await consumer.onDestroy();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return snapResults;\n\n async function getIdsToSnap(): Promise<BitIds> {\n const idHasWildcard = id && hasWildcard(id);\n if (id && !idHasWildcard) {\n const bitId = consumer.getParsedId(id);\n if (!force) {\n const componentStatus = await consumer.getComponentStatusById(bitId);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (componentStatus.modified === false) return null;\n }\n return new BitIds(bitId);\n }\n const tagPendingComponents = await componentsList.listTagPendingComponents();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (R.isEmpty(tagPendingComponents)) return null;\n return idHasWildcard ? ComponentsList.filterComponentsByWildcard(tagPendingComponents, id) : tagPendingComponents;\n }\n }\n\n private async loadComponentsForTag(ids: BitIds): Promise<Component[]> {\n const { components } = await this.workspace.consumer.loadComponents(ids.toVersionLatest());\n if (this.workspace.isLegacy) {\n return components;\n }\n let shouldReloadComponents = false;\n const componentsWithRelativePaths: string[] = [];\n const componentsWithFilesNotDir: string[] = [];\n const componentsWithCustomModuleResolution: string[] = [];\n components.forEach((component) => {\n const componentMap = component.componentMap as ComponentMap;\n if (componentMap.rootDir) return;\n const hasRelativePaths = component.issues?.getIssue(IssuesClasses.RelativeComponentsAuthored);\n const hasCustomModuleResolutions = component.issues?.getIssue(IssuesClasses.MissingCustomModuleResolutionLinks);\n // leaving this because it can be helpful for users upgrade from legacy\n if (componentMap.trackDir && !hasRelativePaths) {\n componentMap.changeRootDirAndUpdateFilesAccordingly(componentMap.trackDir);\n shouldReloadComponents = true;\n return;\n }\n if (hasRelativePaths) {\n componentsWithRelativePaths.push(component.id.toStringWithoutVersion());\n }\n if (!componentMap.trackDir) {\n componentsWithFilesNotDir.push(component.id.toStringWithoutVersion());\n }\n if (hasCustomModuleResolutions) {\n componentsWithCustomModuleResolution.push(component.id.toStringWithoutVersion());\n }\n });\n if (componentsWithRelativePaths.length || componentsWithFilesNotDir.length) {\n throw new FailedLoadForTag(\n componentsWithRelativePaths.sort(),\n componentsWithFilesNotDir.sort(),\n componentsWithCustomModuleResolution.sort()\n );\n }\n if (!shouldReloadComponents) return components;\n this.workspace.clearCache();\n const { components: reloadedComponents } = await this.workspace.consumer.loadComponents(ids);\n return reloadedComponents;\n }\n\n private throwForComponentIssues(components: Component[], ignoreIssues?: string) {\n components.forEach((component) => {\n if (this.workspace.isLegacy && component.issues) {\n component.issues.delete(IssuesClasses.RelativeComponentsAuthored);\n }\n });\n if (ignoreIssues === '*') {\n // ignore all issues\n return;\n }\n const issuesToIgnore = ignoreIssues?.split(',').map((issue) => issue.trim());\n issuesToIgnore?.forEach((issue) => {\n const issueClass = IssuesClasses[issue];\n if (!issueClass) {\n throw new Error(\n `unrecognized component-issue \"${issue}\". please specify one of the following:\\n${Object.keys(\n IssuesClasses\n ).join('\\n')}`\n );\n }\n components.forEach((component) => {\n component.issues.delete(issueClass);\n });\n });\n const componentsWithBlockingIssues = components.filter((component) => component.issues?.shouldBlockTagging());\n if (!R.isEmpty(componentsWithBlockingIssues)) {\n throw new ComponentsHaveIssues(componentsWithBlockingIssues);\n }\n }\n\n private async getComponentsToTag(\n isAllScope: boolean,\n exactVersion: string | undefined,\n includeImported: boolean,\n persist: boolean,\n force: boolean,\n ids: string[],\n snapped: boolean\n ): Promise<{ bitIds: BitId[]; warnings: string[] }> {\n const warnings: string[] = [];\n const componentsList = new ComponentsList(this.workspace.consumer);\n if (persist) {\n const softTaggedComponents = componentsList.listSoftTaggedComponents();\n return { bitIds: softTaggedComponents, warnings: [] };\n }\n\n const tagPendingComponents = isAllScope\n ? await componentsList.listTagPendingOfAllScope(includeImported)\n : await componentsList.listTagPendingComponents();\n\n const snappedComponents = await componentsList.listSnappedComponentsOnMain();\n const snappedComponentsIds = snappedComponents.map((c) => c.toBitId());\n\n if (ids.length) {\n const bitIds = await Promise.all(\n ids.map(async (id) => {\n const [idWithoutVer, version] = id.split('@');\n const idHasWildcard = hasWildcard(id);\n if (idHasWildcard) {\n const allIds = ComponentsList.filterComponentsByWildcard(tagPendingComponents, idWithoutVer);\n return allIds.map((bitId) => bitId.changeVersion(version));\n }\n const bitId = this.workspace.consumer.getParsedId(idWithoutVer);\n if (!force) {\n const componentStatus = await this.workspace.consumer.getComponentStatusById(bitId);\n if (componentStatus.modified === false) return null;\n }\n return bitId.changeVersion(version);\n })\n );\n\n return { bitIds: compact(bitIds.flat()), warnings };\n }\n\n if (snapped) {\n return { bitIds: snappedComponentsIds, warnings };\n }\n\n tagPendingComponents.push(...snappedComponentsIds);\n\n if (isAllScope && exactVersion) {\n const tagPendingComponentsLatest = await this.workspace.scope.legacyScope.latestVersions(\n tagPendingComponents,\n false\n );\n tagPendingComponentsLatest.forEach((componentId) => {\n if (componentId.version && semver.valid(componentId.version) && semver.gt(componentId.version, exactVersion)) {\n warnings.push(`warning: ${componentId.toString()} has a version greater than ${exactVersion}`);\n }\n });\n }\n\n return { bitIds: tagPendingComponents.map((id) => id.changeVersion(undefined)), warnings };\n }\n\n static slots = [];\n static dependencies = [WorkspaceAspect, CLIAspect, CommunityAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([workspace, cli, community, loggerMain]: [Workspace, CLIMain, CommunityMain, LoggerMain]) {\n const logger = loggerMain.createLogger(SnappingAspect.id);\n const snapping = new SnappingMain(workspace, logger);\n const snapCmd = new SnapCmd(community.getBaseDomain(), snapping);\n const tagCmd = new TagCmd(community.getBaseDomain(), snapping);\n cli.register(tagCmd, snapCmd);\n return snapping;\n }\n}\n\nSnappingAspect.addRuntime(SnappingMain);\n"]}
|
|
1
|
+
{"version":3,"sources":["snapping.main.runtime.ts"],"names":["HooksManagerInstance","HooksManager","getInstance","SnappingMain","constructor","workspace","logger","issues","tag","ids","message","ver","all","editor","snapped","patch","minor","major","preRelease","force","verbose","ignoreIssues","ignoreNewestVersion","skipTests","skipAutoTag","scope","build","soft","persist","forceDeploy","incrementBy","disableTagAndSnapPipelines","BUILD_ON_CI","Boolean","getVersion","length","BitError","releaseFlags","filter","x","releaseType","DEFAULT_BIT_RELEASE_TYPE","includeImported","exactVersion","ConsumerNotFound","idsHasWildcard","isAll","validExactVersion","consumer","componentsList","ComponentsList","loader","start","newComponents","listNewComponents","bitIds","warnings","getComponentsToTag","R","isEmpty","legacyBitIds","BitIds","fromArray","isLegacy","debug","toString","Analytics","addBreadCrumb","hashData","componentFsCache","deleteAllDependenciesDataCache","components","loadComponentsForTag","throwForComponentIssues","areComponentsMissingFromScope","some","c","componentFromModel","id","hasScope","ComponentsPendingImport","taggedComponents","autoTaggedResults","publishedPackages","consumerComponents","legacyScope","resolveUnmerged","tagResults","isSoftTag","postHook","POST_TAG_ALL_HOOK","POST_TAG_HOOK","triggerHook","setExtraData","concat","onDestroy","snap","skipAutoSnap","Error","LanesIsDisabled","getIdsToSnap","isSnap","snapResults","snappedComponents","autoSnappedResults","currentLane","getCurrentLaneId","laneName","isDefault","name","idHasWildcard","bitId","getParsedId","componentStatus","getComponentStatusById","modified","tagPendingComponents","listTagPendingComponents","filterComponentsByWildcard","loadComponents","toVersionLatest","shouldReloadComponents","componentsWithRelativePaths","componentsWithFilesNotDir","componentsWithCustomModuleResolution","forEach","component","componentMap","rootDir","hasRelativePaths","getIssue","IssuesClasses","RelativeComponentsAuthored","hasCustomModuleResolutions","MissingCustomModuleResolutionLinks","trackDir","changeRootDirAndUpdateFilesAccordingly","push","toStringWithoutVersion","FailedLoadForTag","sort","clearCache","reloadedComponents","delete","issuesToIgnoreFromFlag","split","map","issue","trim","issuesToIgnoreFromConfig","getIssuesToIgnore","issuesToIgnore","issueClass","Object","keys","join","componentsWithBlockingIssues","shouldBlockTagging","ComponentsHaveIssues","isAllScope","softTaggedComponents","listSoftTaggedComponents","listTagPendingOfAllScope","listSnappedComponentsOnMain","snappedComponentsIds","toBitId","Promise","idWithoutVer","version","allIds","changeVersion","flat","tagPendingComponentsLatest","latestVersions","componentId","semver","valid","gt","undefined","provider","cli","community","loggerMain","createLogger","SnappingAspect","snapping","snapCmd","SnapCmd","getBaseDomain","tagCmd","TagCmd","register","WorkspaceAspect","CLIAspect","CommunityAspect","LoggerAspect","IssuesAspect","MainRuntime","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAA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EAA4BC,UAA5B,EAAwC/K,MAAxC,CAAD,EAMlB;AACD,UAAMD,MAAM,GAAGgL,UAAU,CAACC,YAAX,CAAwBC,2BAAe1G,EAAvC,CAAf;AACA,UAAM2G,QAAQ,GAAG,IAAItL,YAAJ,CAAiBE,SAAjB,EAA4BC,MAA5B,EAAoCC,MAApC,CAAjB;AACA,UAAMmL,OAAO,GAAG,KAAIC,kBAAJ,EAAYN,SAAS,CAACO,aAAV,EAAZ,EAAuCH,QAAvC,CAAhB;AACA,UAAMI,MAAM,GAAG,KAAIC,gBAAJ,EAAWT,SAAS,CAACO,aAAV,EAAX,EAAsCH,QAAtC,CAAf;AACAL,IAAAA,GAAG,CAACW,QAAJ,CAAaF,MAAb,EAAqBH,OAArB;AACA,WAAOD,QAAP;AACD;;AAvauB;;;gCAAbtL,Y,WAuZI,E;gCAvZJA,Y,kBAwZW,CAAC6L,oBAAD,EAAkBC,gBAAlB,EAA6BC,oBAA7B,EAA8CC,sBAA9C,EAA4DC,iBAA5D,C;gCAxZXjM,Y,aAyZMkM,kB;;AAiBnBb,2BAAec,UAAf,CAA0BnM,YAA1B;;eAEeA,Y","sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { isString } from '@teambit/legacy/dist/utils';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport CommunityAspect, { CommunityMain } from '@teambit/community';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport R from 'ramda';\nimport semver, { ReleaseType } from 'semver';\nimport { compact } from 'lodash';\nimport { Analytics } from '@teambit/legacy/dist/analytics/analytics';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { POST_TAG_ALL_HOOK, POST_TAG_HOOK, DEFAULT_BIT_RELEASE_TYPE } from '@teambit/legacy/dist/constants';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport HooksManager from '@teambit/legacy/dist/hooks';\nimport { TagResults, BasicTagParams } from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport { validateVersion } from '@teambit/legacy/dist/utils/semver-helper';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport tagModelComponent from '@teambit/legacy/dist/scope/component-ops/tag-model-component';\nimport { LanesIsDisabled } from '@teambit/legacy/dist/consumer/lanes/exceptions/lanes-is-disabled';\nimport { SnapResults } from '@teambit/legacy/dist/api/consumer/lib/snap';\nimport ComponentsPendingImport from '@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-import';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport { FailedLoadForTag } from '@teambit/legacy/dist/consumer/component/exceptions/failed-load-for-tag';\nimport IssuesAspect, { IssuesMain } from '@teambit/issues';\nimport { SnapCmd } from './snap-cmd';\nimport { SnappingAspect } from './snapping.aspect';\nimport { TagCmd } from './tag-cmd';\nimport { ComponentsHaveIssues } from './components-have-issues';\n\nconst HooksManagerInstance = HooksManager.getInstance();\n\nexport class SnappingMain {\n constructor(private workspace: Workspace, private logger: Logger, private issues: IssuesMain) {}\n\n /**\n * tag the given component ids or all modified/new components if \"all\" param is set.\n * tag is a similar operation as a snap, which saves the changes into the local scope, but it also creates an alias\n * with a valid semver to that version.\n * tag can be done only on main, not on a lane.\n */\n // eslint-disable-next-line complexity\n async tag({\n ids = [],\n message = '',\n ver,\n all = false,\n editor = '',\n snapped = false,\n patch,\n minor,\n major,\n preRelease,\n force = false,\n verbose = false,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipAutoTag = false,\n scope,\n build,\n soft = false,\n persist = false,\n forceDeploy = false,\n incrementBy = 1,\n disableTagAndSnapPipelines = false,\n }: {\n ids?: string[];\n all?: boolean | string;\n snapped?: boolean | string;\n ver?: string;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n ignoreIssues?: string;\n scope?: string | boolean;\n incrementBy?: number;\n } & Partial<BasicTagParams>): Promise<TagResults | null> {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n if (soft) build = false;\n function getVersion(): string | undefined {\n if (scope && isString(scope)) return scope;\n if (all && isString(all)) return all;\n if (snapped && isString(snapped)) return snapped;\n return ver;\n }\n\n if (!ids.length && !all && !snapped && !scope && !persist) {\n throw new BitError('missing [id]. to tag all components, please use --all flag');\n }\n if (ids.length && all) {\n throw new BitError(\n 'you can use either a specific component [id] to tag a particular component or --all flag to tag them all'\n );\n }\n if (disableTagAndSnapPipelines && forceDeploy) {\n throw new BitError('you can use either force-deploy or disable-tag-pipeline, but not both');\n }\n if (all && persist) {\n throw new BitError('you can use either --all or --persist, but not both');\n }\n if (editor && persist) {\n throw new BitError('you can use either --editor or --persist, but not both');\n }\n if (editor && message) {\n throw new BitError('you can use either --editor or --message, but not both');\n }\n\n const releaseFlags = [patch, minor, major, preRelease].filter((x) => x);\n if (releaseFlags.length > 1) {\n throw new BitError('you can use only one of the following - patch, minor, major, pre-release');\n }\n\n let releaseType: ReleaseType = DEFAULT_BIT_RELEASE_TYPE;\n const includeImported = Boolean(scope && all);\n\n if (major) releaseType = 'major';\n else if (minor) releaseType = 'minor';\n else if (patch) releaseType = 'patch';\n else if (preRelease) releaseType = 'prerelease';\n\n const exactVersion = getVersion();\n all = Boolean(all);\n snapped = Boolean(snapped);\n preRelease = typeof preRelease === 'string' ? preRelease : '';\n\n if (!this.workspace) throw new ConsumerNotFound();\n const idsHasWildcard = hasWildcard(ids);\n const isAll = Boolean(all || scope || idsHasWildcard);\n const validExactVersion = validateVersion(exactVersion);\n const consumer = this.workspace.consumer;\n const componentsList = new ComponentsList(consumer);\n loader.start('determine components to tag...');\n const newComponents = await componentsList.listNewComponents();\n const { bitIds, warnings } = await this.getComponentsToTag(\n Boolean(scope),\n exactVersion,\n includeImported,\n persist,\n force,\n ids,\n snapped\n );\n if (R.isEmpty(bitIds)) return null;\n\n const legacyBitIds = BitIds.fromArray(bitIds);\n\n if (this.workspace.isLegacy) {\n persist = true;\n }\n this.logger.debug(`tagging the following components: ${legacyBitIds.toString()}`);\n Analytics.addBreadCrumb('tag', `tagging the following components: ${Analytics.hashData(legacyBitIds)}`);\n if (!soft) {\n await this.workspace.consumer.componentFsCache.deleteAllDependenciesDataCache();\n }\n const components = await this.loadComponentsForTag(legacyBitIds);\n this.throwForComponentIssues(components, ignoreIssues);\n const areComponentsMissingFromScope = components.some((c) => !c.componentFromModel && c.id.hasScope());\n if (areComponentsMissingFromScope) {\n throw new ComponentsPendingImport();\n }\n\n const { taggedComponents, autoTaggedResults, publishedPackages } = await tagModelComponent({\n consumerComponents: components,\n ids: legacyBitIds,\n scope: this.workspace.scope.legacyScope,\n message,\n editor,\n exactVersion: validExactVersion,\n releaseType,\n preRelease,\n force,\n consumer: this.workspace.consumer,\n ignoreNewestVersion,\n skipTests,\n verbose,\n skipAutoTag,\n soft,\n build,\n persist,\n resolveUnmerged: false,\n disableTagAndSnapPipelines,\n forceDeploy,\n incrementBy,\n });\n\n const tagResults = { taggedComponents, autoTaggedResults, isSoftTag: soft, publishedPackages };\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n tagResults.warnings = warnings;\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n tagResults.newComponents = newComponents;\n const postHook = isAll ? POST_TAG_ALL_HOOK : POST_TAG_HOOK;\n HooksManagerInstance?.triggerHook(postHook, tagResults);\n Analytics.setExtraData(\n 'num_components',\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n R.concat(tagResults.taggedComponents, tagResults.autoTaggedResults, tagResults.newComponents).length\n );\n await consumer.onDestroy();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return tagResults;\n }\n\n /**\n * save the local changes of a component(s) into the scope. snap can be done on main or on a lane.\n * once a component is snapped on a lane, it becomes part of it.\n */\n async snap({\n id, // @todo: rename to \"patterns\"\n legacyBitIds, // @todo: change to ComponentID[]. pass only if have the ids already parsed.\n resolveUnmerged = false,\n message = '',\n force = false,\n verbose = false,\n ignoreIssues,\n skipTests = false,\n skipAutoSnap = false,\n build,\n disableTagAndSnapPipelines = false,\n forceDeploy = false,\n }: {\n id?: string;\n legacyBitIds?: BitIds;\n resolveUnmerged?: boolean;\n message?: string;\n force?: boolean;\n verbose?: boolean;\n ignoreIssues?: string;\n build: boolean;\n skipTests?: boolean;\n skipAutoSnap?: boolean;\n disableTagAndSnapPipelines?: boolean;\n forceDeploy?: boolean;\n }): Promise<SnapResults | null> {\n if (!this.workspace) throw new ConsumerNotFound();\n if (id && legacyBitIds) throw new Error(`please pass either id or legacyBitIds, not both`);\n const consumer: Consumer = this.workspace.consumer;\n if (consumer.isLegacy) throw new LanesIsDisabled();\n const componentsList = new ComponentsList(consumer);\n const newComponents = (await componentsList.listNewComponents()) as BitIds;\n const ids = legacyBitIds || (await getIdsToSnap());\n if (!ids) return null;\n this.logger.debug(`snapping the following components: ${ids.toString()}`);\n await this.workspace.consumer.componentFsCache.deleteAllDependenciesDataCache();\n const components = await this.loadComponentsForTag(ids);\n this.throwForComponentIssues(components, ignoreIssues);\n const areComponentsMissingFromScope = components.some((c) => !c.componentFromModel && c.id.hasScope());\n if (areComponentsMissingFromScope) {\n throw new ComponentsPendingImport();\n }\n\n const { taggedComponents, autoTaggedResults } = await tagModelComponent({\n consumerComponents: components,\n ids,\n ignoreNewestVersion: false,\n scope: this.workspace.scope.legacyScope,\n message,\n force,\n consumer: this.workspace.consumer,\n skipTests,\n verbose,\n skipAutoTag: skipAutoSnap,\n persist: true,\n soft: false,\n build,\n resolveUnmerged,\n isSnap: true,\n disableTagAndSnapPipelines,\n forceDeploy,\n });\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const snapResults: SnapResults = { snappedComponents: taggedComponents, autoSnappedResults: autoTaggedResults };\n\n snapResults.newComponents = newComponents;\n const currentLane = consumer.getCurrentLaneId();\n snapResults.laneName = currentLane.isDefault() ? null : currentLane.name;\n await consumer.onDestroy();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return snapResults;\n\n async function getIdsToSnap(): Promise<BitIds> {\n const idHasWildcard = id && hasWildcard(id);\n if (id && !idHasWildcard) {\n const bitId = consumer.getParsedId(id);\n if (!force) {\n const componentStatus = await consumer.getComponentStatusById(bitId);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (componentStatus.modified === false) return null;\n }\n return new BitIds(bitId);\n }\n const tagPendingComponents = await componentsList.listTagPendingComponents();\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (R.isEmpty(tagPendingComponents)) return null;\n return idHasWildcard ? ComponentsList.filterComponentsByWildcard(tagPendingComponents, id) : tagPendingComponents;\n }\n }\n\n private async loadComponentsForTag(ids: BitIds): Promise<Component[]> {\n const { components } = await this.workspace.consumer.loadComponents(ids.toVersionLatest());\n if (this.workspace.isLegacy) {\n return components;\n }\n let shouldReloadComponents = false;\n const componentsWithRelativePaths: string[] = [];\n const componentsWithFilesNotDir: string[] = [];\n const componentsWithCustomModuleResolution: string[] = [];\n components.forEach((component) => {\n const componentMap = component.componentMap as ComponentMap;\n if (componentMap.rootDir) return;\n const hasRelativePaths = component.issues?.getIssue(IssuesClasses.RelativeComponentsAuthored);\n const hasCustomModuleResolutions = component.issues?.getIssue(IssuesClasses.MissingCustomModuleResolutionLinks);\n // leaving this because it can be helpful for users upgrade from legacy\n if (componentMap.trackDir && !hasRelativePaths) {\n componentMap.changeRootDirAndUpdateFilesAccordingly(componentMap.trackDir);\n shouldReloadComponents = true;\n return;\n }\n if (hasRelativePaths) {\n componentsWithRelativePaths.push(component.id.toStringWithoutVersion());\n }\n if (!componentMap.trackDir) {\n componentsWithFilesNotDir.push(component.id.toStringWithoutVersion());\n }\n if (hasCustomModuleResolutions) {\n componentsWithCustomModuleResolution.push(component.id.toStringWithoutVersion());\n }\n });\n if (componentsWithRelativePaths.length || componentsWithFilesNotDir.length) {\n throw new FailedLoadForTag(\n componentsWithRelativePaths.sort(),\n componentsWithFilesNotDir.sort(),\n componentsWithCustomModuleResolution.sort()\n );\n }\n if (!shouldReloadComponents) return components;\n this.workspace.clearCache();\n const { components: reloadedComponents } = await this.workspace.consumer.loadComponents(ids);\n return reloadedComponents;\n }\n\n private throwForComponentIssues(components: Component[], ignoreIssues?: string) {\n components.forEach((component) => {\n if (this.workspace.isLegacy && component.issues) {\n component.issues.delete(IssuesClasses.RelativeComponentsAuthored);\n }\n });\n if (ignoreIssues === '*') {\n // ignore all issues\n return;\n }\n const issuesToIgnoreFromFlag = ignoreIssues?.split(',').map((issue) => issue.trim()) || [];\n const issuesToIgnoreFromConfig = this.issues.getIssuesToIgnore();\n const issuesToIgnore = [...issuesToIgnoreFromFlag, ...issuesToIgnoreFromConfig];\n issuesToIgnore.forEach((issue) => {\n const issueClass = IssuesClasses[issue];\n if (!issueClass) {\n throw new Error(\n `unrecognized component-issue \"${issue}\". please specify one of the following:\\n${Object.keys(\n IssuesClasses\n ).join('\\n')}`\n );\n }\n components.forEach((component) => {\n component.issues.delete(issueClass);\n });\n });\n const componentsWithBlockingIssues = components.filter((component) => component.issues?.shouldBlockTagging());\n if (!R.isEmpty(componentsWithBlockingIssues)) {\n throw new ComponentsHaveIssues(componentsWithBlockingIssues);\n }\n }\n\n private async getComponentsToTag(\n isAllScope: boolean,\n exactVersion: string | undefined,\n includeImported: boolean,\n persist: boolean,\n force: boolean,\n ids: string[],\n snapped: boolean\n ): Promise<{ bitIds: BitId[]; warnings: string[] }> {\n const warnings: string[] = [];\n const componentsList = new ComponentsList(this.workspace.consumer);\n if (persist) {\n const softTaggedComponents = componentsList.listSoftTaggedComponents();\n return { bitIds: softTaggedComponents, warnings: [] };\n }\n\n const tagPendingComponents = isAllScope\n ? await componentsList.listTagPendingOfAllScope(includeImported)\n : await componentsList.listTagPendingComponents();\n\n const snappedComponents = await componentsList.listSnappedComponentsOnMain();\n const snappedComponentsIds = snappedComponents.map((c) => c.toBitId());\n\n if (ids.length) {\n const bitIds = await Promise.all(\n ids.map(async (id) => {\n const [idWithoutVer, version] = id.split('@');\n const idHasWildcard = hasWildcard(id);\n if (idHasWildcard) {\n const allIds = ComponentsList.filterComponentsByWildcard(tagPendingComponents, idWithoutVer);\n return allIds.map((bitId) => bitId.changeVersion(version));\n }\n const bitId = this.workspace.consumer.getParsedId(idWithoutVer);\n if (!force) {\n const componentStatus = await this.workspace.consumer.getComponentStatusById(bitId);\n if (componentStatus.modified === false) return null;\n }\n return bitId.changeVersion(version);\n })\n );\n\n return { bitIds: compact(bitIds.flat()), warnings };\n }\n\n if (snapped) {\n return { bitIds: snappedComponentsIds, warnings };\n }\n\n tagPendingComponents.push(...snappedComponentsIds);\n\n if (isAllScope && exactVersion) {\n const tagPendingComponentsLatest = await this.workspace.scope.legacyScope.latestVersions(\n tagPendingComponents,\n false\n );\n tagPendingComponentsLatest.forEach((componentId) => {\n if (componentId.version && semver.valid(componentId.version) && semver.gt(componentId.version, exactVersion)) {\n warnings.push(`warning: ${componentId.toString()} has a version greater than ${exactVersion}`);\n }\n });\n }\n\n return { bitIds: tagPendingComponents.map((id) => id.changeVersion(undefined)), warnings };\n }\n\n static slots = [];\n static dependencies = [WorkspaceAspect, CLIAspect, CommunityAspect, LoggerAspect, IssuesAspect];\n static runtime = MainRuntime;\n static async provider([workspace, cli, community, loggerMain, issues]: [\n Workspace,\n CLIMain,\n CommunityMain,\n LoggerMain,\n IssuesMain\n ]) {\n const logger = loggerMain.createLogger(SnappingAspect.id);\n const snapping = new SnappingMain(workspace, logger, issues);\n const snapCmd = new SnapCmd(community.getBaseDomain(), snapping);\n const tagCmd = new TagCmd(community.getBaseDomain(), snapping);\n cli.register(tagCmd, snapCmd);\n return snapping;\n }\n}\n\nSnappingAspect.addRuntime(SnappingMain);\n\nexport default SnappingMain;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.promise.js");
|
|
6
|
+
|
|
7
|
+
function _fsExtra() {
|
|
8
|
+
const data = _interopRequireDefault(require("fs-extra"));
|
|
9
|
+
|
|
10
|
+
_fsExtra = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function _path() {
|
|
18
|
+
const data = _interopRequireDefault(require("path"));
|
|
19
|
+
|
|
20
|
+
_path = function () {
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _harmonyTesting() {
|
|
28
|
+
const data = require("@teambit/harmony.testing.load-aspect");
|
|
29
|
+
|
|
30
|
+
_harmonyTesting = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function _workspaceTesting() {
|
|
38
|
+
const data = require("@teambit/workspace.testing.mock-workspace");
|
|
39
|
+
|
|
40
|
+
_workspaceTesting = function () {
|
|
41
|
+
return data;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function _issues() {
|
|
48
|
+
const data = _interopRequireDefault(require("@teambit/issues"));
|
|
49
|
+
|
|
50
|
+
_issues = function () {
|
|
51
|
+
return data;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function _compiler() {
|
|
58
|
+
const data = require("@teambit/compiler");
|
|
59
|
+
|
|
60
|
+
_compiler = function () {
|
|
61
|
+
return data;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function _componentTesting() {
|
|
68
|
+
const data = require("@teambit/component.testing.mock-components");
|
|
69
|
+
|
|
70
|
+
_componentTesting = function () {
|
|
71
|
+
return data;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function _snapping() {
|
|
78
|
+
const data = require("./snapping.aspect");
|
|
79
|
+
|
|
80
|
+
_snapping = function () {
|
|
81
|
+
return data;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return data;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function _componentsHaveIssues() {
|
|
88
|
+
const data = require("./components-have-issues");
|
|
89
|
+
|
|
90
|
+
_componentsHaveIssues = function () {
|
|
91
|
+
return data;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return data;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
describe('Snapping aspect', () => {
|
|
98
|
+
let workspaceData;
|
|
99
|
+
let snapping;
|
|
100
|
+
describe('components with issues', () => {
|
|
101
|
+
beforeAll(async () => {
|
|
102
|
+
workspaceData = (0, _workspaceTesting().mockWorkspace)();
|
|
103
|
+
const {
|
|
104
|
+
workspacePath
|
|
105
|
+
} = workspaceData; // eslint-disable-next-line no-console
|
|
106
|
+
|
|
107
|
+
console.log('workspace created at ', workspacePath);
|
|
108
|
+
await (0, _componentTesting().mockComponents)(workspacePath);
|
|
109
|
+
await _fsExtra().default.writeFile(_path().default.join(workspacePath, 'comp1/index.js'), `const nonExist = require("non-exist");`);
|
|
110
|
+
const compiler = await (0, _harmonyTesting().loadAspect)(_compiler().CompilerAspect, workspacePath);
|
|
111
|
+
await compiler.compileOnWorkspace();
|
|
112
|
+
snapping = await (0, _harmonyTesting().loadAspect)(_snapping().SnappingAspect, workspacePath);
|
|
113
|
+
});
|
|
114
|
+
it('tag should throw an ComponentsHaveIssues error', async () => {
|
|
115
|
+
try {
|
|
116
|
+
await snapping.tag({
|
|
117
|
+
ids: ['comp1']
|
|
118
|
+
});
|
|
119
|
+
} catch (err) {
|
|
120
|
+
expect(err.constructor.name).toEqual(_componentsHaveIssues().ComponentsHaveIssues.name);
|
|
121
|
+
}
|
|
122
|
+
}); // @todo: this test fails during "bit build" for some reason. It passes on "bit test";
|
|
123
|
+
|
|
124
|
+
it.skip('should not throw an error if the config was set to ignore MissingPackagesDependenciesOnFs error', async () => {
|
|
125
|
+
await (0, _workspaceTesting().setWorkspaceConfig)(workspaceData.workspacePath, _issues().default.id, {
|
|
126
|
+
ignoreIssues: ['MissingPackagesDependenciesOnFs']
|
|
127
|
+
});
|
|
128
|
+
snapping = await (0, _harmonyTesting().loadAspect)(_snapping().SnappingAspect, workspaceData.workspacePath);
|
|
129
|
+
const results = await snapping.tag({
|
|
130
|
+
ids: ['comp1']
|
|
131
|
+
});
|
|
132
|
+
expect(results === null || results === void 0 ? void 0 : results.taggedComponents.length).toEqual(1);
|
|
133
|
+
});
|
|
134
|
+
afterAll(async () => {
|
|
135
|
+
await (0, _workspaceTesting().destroyWorkspace)(workspaceData);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=snapping.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["snapping.spec.ts"],"names":["describe","workspaceData","snapping","beforeAll","workspacePath","console","log","fs","writeFile","path","join","compiler","CompilerAspect","compileOnWorkspace","SnappingAspect","it","tag","ids","err","expect","constructor","name","toEqual","ComponentsHaveIssues","skip","IssuesAspect","id","ignoreIss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SAAb,CAAN;AACD,OAFD,CAEE,OAAOC,GAAP,EAAiB;AACjBC,QAAAA,MAAM,CAACD,GAAG,CAACE,WAAJ,CAAgBC,IAAjB,CAAN,CAA6BC,OAA7B,CAAqCC,6CAAqBF,IAA1D;AACD;AACF,KANC,CAAF,CAZuC,CAmBvC;;AACAN,IAAAA,EAAE,CAACS,IAAH,CAAQ,iGAAR,EAA2G,YAAY;AACrH,YAAM,4CAAmBvB,aAAa,CAACG,aAAjC,EAAgDqB,kBAAaC,EAA7D,EAAiE;AACrEC,QAAAA,YAAY,EAAE,CAAC,iCAAD;AADuD,OAAjE,CAAN;AAGAzB,MAAAA,QAAQ,GAAG,MAAM,kCAAWY,0BAAX,EAA2Bb,aAAa,CAACG,aAAzC,CAAjB;AACA,YAAMwB,OAAO,GAAG,MAAM1B,QAAQ,CAACc,GAAT,CAAa;AAAEC,QAAAA,GAAG,EAAE,CAAC,OAAD;AAAP,OAAb,CAAtB;AACAE,MAAAA,MAAM,CAACS,OAAD,aAACA,OAAD,uBAACA,OAAO,CAAEC,gBAAT,CAA0BC,MAA3B,CAAN,CAAyCR,OAAzC,CAAiD,CAAjD;AACD,KAPD;AAQAS,IAAAA,QAAQ,CAAC,YAAY;AACnB,YAAM,0CAAiB9B,aAAjB,CAAN;AACD,KAFO,CAAR;AAGD,GA/BO,CAAR;AAgCD,CAnCO,CAAR","sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport { loadAspect } from '@teambit/harmony.testing.load-aspect';\nimport {\n mockWorkspace,\n destroyWorkspace,\n WorkspaceData,\n setWorkspaceConfig,\n} from '@teambit/workspace.testing.mock-workspace';\nimport IssuesAspect from '@teambit/issues';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { mockComponents } from '@teambit/component.testing.mock-components';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { SnappingAspect } from './snapping.aspect';\nimport { ComponentsHaveIssues } from './components-have-issues';\n\ndescribe('Snapping aspect', () => {\n let workspaceData: WorkspaceData;\n let snapping: SnappingMain;\n describe('components with issues', () => {\n beforeAll(async () => {\n workspaceData = mockWorkspace();\n const { workspacePath } = workspaceData;\n // eslint-disable-next-line no-console\n console.log('workspace created at ', workspacePath);\n await mockComponents(workspacePath);\n await fs.writeFile(path.join(workspacePath, 'comp1/index.js'), `const nonExist = require(\"non-exist\");`);\n const compiler: CompilerMain = await loadAspect(CompilerAspect, workspacePath);\n await compiler.compileOnWorkspace();\n snapping = await loadAspect(SnappingAspect, workspacePath);\n });\n it('tag should throw an ComponentsHaveIssues error', async () => {\n try {\n await snapping.tag({ ids: ['comp1'] });\n } catch (err: any) {\n expect(err.constructor.name).toEqual(ComponentsHaveIssues.name);\n }\n });\n // @todo: this test fails during \"bit build\" for some reason. It passes on \"bit test\";\n it.skip('should not throw an error if the config was set to ignore MissingPackagesDependenciesOnFs error', async () => {\n await setWorkspaceConfig(workspaceData.workspacePath, IssuesAspect.id, {\n ignoreIssues: ['MissingPackagesDependenciesOnFs'],\n });\n snapping = await loadAspect(SnappingAspect, workspaceData.workspacePath);\n const results = await snapping.tag({ ids: ['comp1'] });\n expect(results?.taggedComponents.length).toEqual(1);\n });\n afterAll(async () => {\n await destroyWorkspace(workspaceData);\n });\n });\n});\n"]}
|
package/dist/tag-cmd.js
CHANGED
|
@@ -33,16 +33,6 @@ function _chalk() {
|
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function _semver() {
|
|
37
|
-
const data = _interopRequireDefault(require("semver"));
|
|
38
|
-
|
|
39
|
-
_semver = function () {
|
|
40
|
-
return data;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return data;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
36
|
function _tag() {
|
|
47
37
|
const data = require("@teambit/legacy/dist/api/consumer/lib/tag");
|
|
48
38
|
|
|
@@ -53,16 +43,6 @@ function _tag() {
|
|
|
53
43
|
return data;
|
|
54
44
|
}
|
|
55
45
|
|
|
56
|
-
function _utils() {
|
|
57
|
-
const data = require("@teambit/legacy/dist/utils");
|
|
58
|
-
|
|
59
|
-
_utils = function () {
|
|
60
|
-
return data;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return data;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
46
|
function _constants() {
|
|
67
47
|
const data = require("@teambit/legacy/dist/constants");
|
|
68
48
|
|
|
@@ -73,26 +53,6 @@ function _constants() {
|
|
|
73
53
|
return data;
|
|
74
54
|
}
|
|
75
55
|
|
|
76
|
-
function _generalError() {
|
|
77
|
-
const data = _interopRequireDefault(require("@teambit/legacy/dist/error/general-error"));
|
|
78
|
-
|
|
79
|
-
_generalError = function () {
|
|
80
|
-
return data;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return data;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function _featureToggle() {
|
|
87
|
-
const data = require("@teambit/legacy/dist/api/consumer/lib/feature-toggle");
|
|
88
|
-
|
|
89
|
-
_featureToggle = function () {
|
|
90
|
-
return data;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
return data;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
56
|
function _componentIssues() {
|
|
97
57
|
const data = require("@teambit/component-issues");
|
|
98
58
|
|
|
@@ -122,8 +82,7 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
|
|
|
122
82
|
if component ids are entered, you can specify a version per id using "@" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major
|
|
123
83
|
https://${docsDomain}/components/tags
|
|
124
84
|
${(0, _constants().WILDCARD_HELP)('tag')}`;
|
|
125
|
-
}
|
|
126
|
-
|
|
85
|
+
}
|
|
127
86
|
|
|
128
87
|
async report([id = []], {
|
|
129
88
|
message = '',
|
|
@@ -151,24 +110,6 @@ ${(0, _constants().WILDCARD_HELP)('tag')}`;
|
|
|
151
110
|
forceDeploy = false,
|
|
152
111
|
incrementBy = 1
|
|
153
112
|
}) {
|
|
154
|
-
build = (0, _featureToggle().isFeatureEnabled)(_featureToggle().BUILD_ON_CI) ? Boolean(build) : true;
|
|
155
|
-
if (soft) build = false;
|
|
156
|
-
|
|
157
|
-
function getVersion() {
|
|
158
|
-
if (scope && (0, _utils().isString)(scope)) return scope;
|
|
159
|
-
if (all && (0, _utils().isString)(all)) return all;
|
|
160
|
-
if (snapped && (0, _utils().isString)(snapped)) return snapped;
|
|
161
|
-
return ver;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (!id.length && !all && !snapped && !scope && !persist) {
|
|
165
|
-
throw new (_generalError().default)('missing [id]. to tag all components, please use --all flag');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (id.length && all) {
|
|
169
|
-
throw new (_generalError().default)('you can use either a specific component [id] to tag a particular component or --all flag to tag them all');
|
|
170
|
-
}
|
|
171
|
-
|
|
172
113
|
if (typeof ignoreUnresolvedDependencies === 'boolean') {
|
|
173
114
|
throw new Error(`--ignore-unresolved-dependencies has been removed, please use --ignore-issues instead`);
|
|
174
115
|
}
|
|
@@ -177,52 +118,14 @@ ${(0, _constants().WILDCARD_HELP)('tag')}`;
|
|
|
177
118
|
throw new Error(`--ignore-issues expects issues to be ignored, please run "bit tag -h" for the issues list`);
|
|
178
119
|
}
|
|
179
120
|
|
|
180
|
-
if (id.length === 2) {
|
|
181
|
-
const secondArg = id[1]; // previously, the synopsis of this command was `bit tag [id] [version]`, show a descriptive
|
|
182
|
-
// error when users still use it.
|
|
183
|
-
|
|
184
|
-
if (_semver().default.valid(secondArg)) {
|
|
185
|
-
throw new (_generalError().default)(`seems like you entered a version as the second arg, this is not supported anymore, please use "@" sign or --ver flag instead`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
121
|
const disableTagAndSnapPipelines = disableTagPipeline || disableDeployPipeline;
|
|
190
|
-
|
|
191
|
-
if (disableTagAndSnapPipelines && forceDeploy) {
|
|
192
|
-
throw new (_generalError().default)('you can use either force-deploy or disable-tag-pipeline, but not both');
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (all && persist) {
|
|
196
|
-
throw new (_generalError().default)('you can use either --all or --persist, but not both');
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (editor && persist) {
|
|
200
|
-
throw new (_generalError().default)('you can use either --editor or --persist, but not both');
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (editor && message) {
|
|
204
|
-
throw new (_generalError().default)('you can use either --editor or --message, but not both');
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const releaseFlags = [patch, minor, major, preRelease].filter(x => x);
|
|
208
|
-
|
|
209
|
-
if (releaseFlags.length > 1) {
|
|
210
|
-
throw new (_generalError().default)('you can use only one of the following - patch, minor, major, pre-release');
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
let releaseType = _constants().DEFAULT_BIT_RELEASE_TYPE;
|
|
214
|
-
|
|
215
|
-
const includeImported = Boolean(scope && all);
|
|
216
|
-
if (major) releaseType = 'major';else if (minor) releaseType = 'minor';else if (patch) releaseType = 'patch';else if (preRelease) releaseType = 'prerelease';
|
|
217
122
|
const params = {
|
|
218
123
|
ids: id,
|
|
219
|
-
all
|
|
220
|
-
snapped
|
|
124
|
+
all,
|
|
125
|
+
snapped,
|
|
221
126
|
editor,
|
|
222
127
|
message,
|
|
223
|
-
|
|
224
|
-
releaseType,
|
|
225
|
-
preRelease: typeof preRelease === 'string' ? preRelease : '',
|
|
128
|
+
preRelease,
|
|
226
129
|
force,
|
|
227
130
|
verbose,
|
|
228
131
|
ignoreIssues,
|
|
@@ -233,10 +136,13 @@ ${(0, _constants().WILDCARD_HELP)('tag')}`;
|
|
|
233
136
|
soft,
|
|
234
137
|
persist,
|
|
235
138
|
scope,
|
|
236
|
-
includeImported,
|
|
237
139
|
disableTagAndSnapPipelines,
|
|
238
140
|
forceDeploy,
|
|
239
|
-
incrementBy
|
|
141
|
+
incrementBy,
|
|
142
|
+
ver,
|
|
143
|
+
patch,
|
|
144
|
+
minor,
|
|
145
|
+
major
|
|
240
146
|
};
|
|
241
147
|
const results = await this.snapping.tag(params);
|
|
242
148
|
if (!results) return _chalk().default.yellow(_tag().NOTHING_TO_TAG_MSG);
|
package/dist/tag-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tag-cmd.ts"],"names":["TagCmd","constructor","docsDomain","snapping","Object","keys","IssuesClasses","join","description","report","id","message","ver","all","editor","snapped","patch","minor","major","preRelease","force","verbose","ignoreUnresolvedDependencies","ignoreIssues","ignoreNewestVersion","skipTests","skipAutoTag","scope","build","soft","persist","disableDeployPipeline","disableTagPipeline","forceDeploy","incrementBy","BUILD_ON_CI","Boolean","getVersion","length","GeneralError","Error","secondArg","semver","valid","disableTagAndSnapPipelines","releaseFlags","filter","x","releaseType","DEFAULT_BIT_RELEASE_TYPE","includeImported","params","ids","exactVersion","results","tag","chalk","yellow","NOTHING_TO_TAG_MSG","taggedComponents","autoTaggedResults","warnings","newComponents","changedComponents","component","searchWithoutVersion","addedComponents","autoTaggedCount","warningsOutput","tagExplanationPersist","tagExplanationSoft","tagExplanation","isSoftTag","outputComponents","comps","map","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_TAGGED_MSG","publishOutput","publishedPackages","successTitle","green","successCompsStr","successOutput","softTagPrefix","outputIfExists","label","explanation","components","underline","newDesc","changedDesc","softTagClarification","bold"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;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AP;AACD,KATD;;AAWA,UAAMC,aAAa,GAAGrC,OAAO,CAACkB,SAAR,GAAoB,cAApB,GAAqC,EAA3D;;AACA,UAAMoB,cAAc,GAAG,CAACC,KAAD,EAAQC,WAAR,EAAqBC,UAArB,KAAoC;AACzD,UAAI,CAACA,UAAU,CAACzD,MAAhB,EAAwB,OAAO,EAAP;AACxB,aAAQ,KAAIkB,iBAAMwC,SAAN,CAAgBL,aAAa,GAAGE,KAAhC,CAAuC,MAAKC,WAAY,MAAKrB,gBAAgB,CAACsB,UAAD,CAAa,IAAtG;AACD,KAHD;;AAKA,UAAME,OAAO,GAAG3C,OAAO,CAACkB,SAAR,GACZ,+CADY,GAEZ,8BAFJ;AAGA,UAAM0B,WAAW,GAAG5C,OAAO,CAACkB,SAAR,GAChB,2CADgB,GAEhB,oCAFJ;AAGA,UAAM2B,oBAAoB,GAAG7C,OAAO,CAACkB,SAAR,GACzBhB,iBAAM4C,IAAN,CACE,iHADF,CADyB,GAIzB,EAJJ;AAKA,WACEhC,cAAc,GACdZ,iBAAMgC,KAAN,CACG,GAAE7B,gBAAgB,CAACrB,MAAjB,GAA0B6B,eAAgB,iBAAgBb,OAAO,CAACkB,SAAR,GAAoB,OAApB,GAA8B,EAAG,QADhG,CADA,GAIAD,cAJA,GAKAqB,cAAc,CAAC,gBAAD,EAAmBK,OAAnB,EAA4B/B,eAA5B,CALd,GAMA0B,cAAc,CAAC,oBAAD,EAAuBM,WAAvB,EAAoCnC,iBAApC,CANd,GAOAsB,aAAa,EAPb,GAQAc,oBATF;AAWD;;AA/PoC","sourcesContent":["import chalk from 'chalk';\nimport semver, { ReleaseType } from 'semver';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport {\n TagResults,\n NOTHING_TO_TAG_MSG,\n AUTO_TAGGED_MSG,\n BasicTagParams,\n} from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport { isString } from '@teambit/legacy/dist/utils';\nimport { DEFAULT_BIT_RELEASE_TYPE, WILDCARD_HELP } from '@teambit/legacy/dist/constants';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { SnappingMain } from './snapping.main.runtime';\n\nexport class TagCmd implements Command {\n name = 'tag [id...]';\n group = 'development';\n shortDescription = 'record component changes and lock versions';\n description: string;\n alias = 't';\n loader = true;\n options = [\n ['m', 'message <message>', 'log message describing the user changes'],\n ['a', 'all [version]', 'tag all new and modified components'],\n ['s', 'scope [version]', 'tag all components of the current scope'],\n [\n '',\n 'editor [editor]',\n 'EXPERIMENTAL. open an editor to edit the tag messages per component, optionally specify the editor-name, default to vim',\n ],\n ['', 'snapped [version]', 'tag components that their head is a snap (not a tag)'],\n ['', 'ver <version>', 'tag specified components with the given version'],\n ['p', 'patch', 'increment the patch version number'],\n ['', 'minor', 'increment the minor version number'],\n ['', 'major', 'increment the major version number'],\n ['', 'pre-release [identifier]', 'EXPERIMENTAL. increment a pre-release version (e.g. 1.0.0-dev.1)'],\n ['f', 'force', 'force-tag even if tests are failing and even when component has not changed'],\n ['v', 'verbose', 'show specs output on failure'],\n ['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'],\n ['', 'skip-tests', 'skip running component tests during tag process'],\n ['', 'skip-auto-tag', 'skip auto tagging dependents'],\n ['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'],\n ['', 'soft', 'do not persist. only keep note of the changes to be made'],\n ['', 'persist', 'persist the changes generated by --soft tag'],\n ['', 'disable-deploy-pipeline', 'DEPRECATED. use --disable-tag-pipeline instead'],\n ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'],\n ['', 'force-deploy', 'run the tag pipeline although the build failed'],\n [\n '',\n 'increment-by <number>',\n '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.',\n ],\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 ] as CommandOptions;\n migration = true;\n remoteOp = true; // In case a compiler / tester is not installed\n\n constructor(docsDomain: string, private snapping: SnappingMain) {\n this.description = `record component changes and lock versions.\nif component ids are entered, you can specify a version per id using \"@\" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major\nhttps://${docsDomain}/components/tags\n${WILDCARD_HELP('tag')}`;\n }\n\n // eslint-disable-next-line complexity\n async report(\n [id = []]: [string[]],\n {\n message = '',\n ver,\n all = false,\n editor = '',\n snapped = false,\n patch,\n minor,\n major,\n preRelease,\n force = false,\n verbose = false,\n ignoreUnresolvedDependencies,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipAutoTag = false,\n scope,\n build,\n soft = false,\n persist = false,\n disableDeployPipeline = false,\n disableTagPipeline = false,\n forceDeploy = false,\n incrementBy = 1,\n }: {\n all?: boolean | string;\n snapped?: boolean | string;\n ver?: string;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n ignoreUnresolvedDependencies?: boolean;\n ignoreIssues?: string;\n scope?: string | boolean;\n incrementBy?: number;\n disableDeployPipeline?: boolean;\n disableTagPipeline?: boolean;\n } & Partial<BasicTagParams>\n ): Promise<string> {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n if (soft) build = false;\n function getVersion(): string | undefined {\n if (scope && isString(scope)) return scope;\n if (all && isString(all)) return all;\n if (snapped && isString(snapped)) return snapped;\n return ver;\n }\n\n if (!id.length && !all && !snapped && !scope && !persist) {\n throw new GeneralError('missing [id]. to tag all components, please use --all flag');\n }\n if (id.length && all) {\n throw new GeneralError(\n 'you can use either a specific component [id] to tag a particular component or --all flag to tag them all'\n );\n }\n if (typeof ignoreUnresolvedDependencies === 'boolean') {\n throw new Error(`--ignore-unresolved-dependencies has been removed, please use --ignore-issues instead`);\n }\n if (ignoreIssues && typeof ignoreIssues === 'boolean') {\n throw new Error(`--ignore-issues expects issues to be ignored, please run \"bit tag -h\" for the issues list`);\n }\n if (id.length === 2) {\n const secondArg = id[1];\n // previously, the synopsis of this command was `bit tag [id] [version]`, show a descriptive\n // error when users still use it.\n if (semver.valid(secondArg)) {\n throw new GeneralError(\n `seems like you entered a version as the second arg, this is not supported anymore, please use \"@\" sign or --ver flag instead`\n );\n }\n }\n const disableTagAndSnapPipelines = disableTagPipeline || disableDeployPipeline;\n if (disableTagAndSnapPipelines && forceDeploy) {\n throw new GeneralError('you can use either force-deploy or disable-tag-pipeline, but not both');\n }\n if (all && persist) {\n throw new GeneralError('you can use either --all or --persist, but not both');\n }\n if (editor && persist) {\n throw new GeneralError('you can use either --editor or --persist, but not both');\n }\n if (editor && message) {\n throw new GeneralError('you can use either --editor or --message, but not both');\n }\n\n const releaseFlags = [patch, minor, major, preRelease].filter((x) => x);\n if (releaseFlags.length > 1) {\n throw new GeneralError('you can use only one of the following - patch, minor, major, pre-release');\n }\n\n let releaseType: ReleaseType = DEFAULT_BIT_RELEASE_TYPE;\n const includeImported = Boolean(scope && all);\n\n if (major) releaseType = 'major';\n else if (minor) releaseType = 'minor';\n else if (patch) releaseType = 'patch';\n else if (preRelease) releaseType = 'prerelease';\n\n const params = {\n ids: id,\n all: Boolean(all),\n snapped: Boolean(snapped),\n editor,\n message,\n exactVersion: getVersion(),\n releaseType,\n preRelease: typeof preRelease === 'string' ? preRelease : '',\n force,\n verbose,\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipAutoTag,\n build,\n soft,\n persist,\n scope,\n includeImported,\n disableTagAndSnapPipelines,\n forceDeploy,\n incrementBy,\n };\n\n const results = await this.snapping.tag(params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n const { taggedComponents, autoTaggedResults, warnings, newComponents }: TagResults = results;\n const changedComponents = taggedComponents.filter((component) => !newComponents.searchWithoutVersion(component.id));\n const addedComponents = taggedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const tagExplanationPersist = `\\n(use \"bit export [collection]\" to push these components to a remote\")\n(use \"bit untag\" to unstage versions)\\n`;\n const tagExplanationSoft = `\\n(use \"bit tag --persist\" to persist the changes\")\n(use \"bit untag --soft\" to remove the soft-tags)\\n`;\n\n const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;\n\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoTaggedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_TAGGED_MSG}:\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const publishOutput = () => {\n const { publishedPackages } = results;\n if (!publishedPackages || !publishedPackages.length) return '';\n const successTitle = `\\n\\n${chalk.green(\n `published the following ${publishedPackages.length} component(s) successfully\\n`\n )}`;\n const successCompsStr = publishedPackages.join('\\n');\n const successOutput = successCompsStr ? successTitle + successCompsStr : '';\n return successOutput;\n };\n\n const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(softTagPrefix + label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n\n const newDesc = results.isSoftTag\n ? 'set to be tagged first version for components'\n : 'first version for components';\n const changedDesc = results.isSoftTag\n ? 'components that set to get a version bump'\n : 'components that got a version bump';\n const softTagClarification = results.isSoftTag\n ? chalk.bold(\n 'keep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag'\n )\n : '';\n return (\n warningsOutput +\n chalk.green(\n `${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged`\n ) +\n tagExplanation +\n outputIfExists('new components', newDesc, addedComponents) +\n outputIfExists('changed components', changedDesc, changedComponents) +\n publishOutput() +\n softTagClarification\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["tag-cmd.ts"],"names":["TagCmd","constructor","docsDomain","snapping","Object","keys","IssuesClasses","join","description","report","id","message","ver","all","editor","snapped","patch","minor","major","preRelease","force","verbose","ignoreUnresolvedDependencies","ignoreIssues","ignoreNewestVersion","skipTests","skipAutoTag","scope","build","soft","persist","disableDeployPipeline","disableTagPipeline","forceDeploy","incrementBy","Error","disableTagAndSnapPipelines","params","ids","results","tag","chalk","yellow","NOTHING_TO_TAG_MSG","taggedComponents","autoTaggedResults","warnings","newComponents","changedComponents","filter","component","searchWithoutVersion","addedComponents","autoTaggedCount","length","warningsOutput","tagExplanationPersist","tagExplanationSoft","tagExplanation","isSoftTag","outputComponents","comps","map","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_TAGGED_MSG","publishOutput","publishedPackages","successTitle","green","successCompsStr","successOutput","softTagPrefix","outputIfExists","label","explanation","components","underline","newDesc","changedDesc","softTagClarification","bold"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,MAAN,CAAgC;AA+CpB;AAEjBC,EAAAA,WAAW,CAACC,UAAD,EAA6BC,QAA7B,EAAqD;AAAA,SAAxBA,QAAwB,GAAxBA,QAAwB;AAAA,kDAhDzD,aAgDyD;AAAA,mDA/CxD,aA+CwD;AAAA,8DA9C7C,4CA8C6C;AAAA;AAAA,mD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{\n TagResults,\n NOTHING_TO_TAG_MSG,\n AUTO_TAGGED_MSG,\n BasicTagParams,\n} from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport { WILDCARD_HELP } from '@teambit/legacy/dist/constants';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { SnappingMain } from './snapping.main.runtime';\n\nexport class TagCmd implements Command {\n name = 'tag [id...]';\n group = 'development';\n shortDescription = 'record component changes and lock versions';\n description: string;\n alias = 't';\n loader = true;\n options = [\n ['m', 'message <message>', 'log message describing the user changes'],\n ['a', 'all [version]', 'tag all new and modified components'],\n ['s', 'scope [version]', 'tag all components of the current scope'],\n [\n '',\n 'editor [editor]',\n 'EXPERIMENTAL. open an editor to edit the tag messages per component, optionally specify the editor-name, default to vim',\n ],\n ['', 'snapped [version]', 'tag components that their head is a snap (not a tag)'],\n ['', 'ver <version>', 'tag specified components with the given version'],\n ['p', 'patch', 'increment the patch version number'],\n ['', 'minor', 'increment the minor version number'],\n ['', 'major', 'increment the major version number'],\n ['', 'pre-release [identifier]', 'EXPERIMENTAL. increment a pre-release version (e.g. 1.0.0-dev.1)'],\n ['f', 'force', 'force-tag even if tests are failing and even when component has not changed'],\n ['v', 'verbose', 'show specs output on failure'],\n ['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'],\n ['', 'skip-tests', 'skip running component tests during tag process'],\n ['', 'skip-auto-tag', 'skip auto tagging dependents'],\n ['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'],\n ['', 'soft', 'do not persist. only keep note of the changes to be made'],\n ['', 'persist', 'persist the changes generated by --soft tag'],\n ['', 'disable-deploy-pipeline', 'DEPRECATED. use --disable-tag-pipeline instead'],\n ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'],\n ['', 'force-deploy', 'run the tag pipeline although the build failed'],\n [\n '',\n 'increment-by <number>',\n '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.',\n ],\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 ] as CommandOptions;\n migration = true;\n remoteOp = true; // In case a compiler / tester is not installed\n\n constructor(docsDomain: string, private snapping: SnappingMain) {\n this.description = `record component changes and lock versions.\nif component ids are entered, you can specify a version per id using \"@\" sign, e.g. bit tag foo@1.0.0 bar@minor baz@major\nhttps://${docsDomain}/components/tags\n${WILDCARD_HELP('tag')}`;\n }\n\n async report(\n [id = []]: [string[]],\n {\n message = '',\n ver,\n all = false,\n editor = '',\n snapped = false,\n patch,\n minor,\n major,\n preRelease,\n force = false,\n verbose = false,\n ignoreUnresolvedDependencies,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipAutoTag = false,\n scope,\n build,\n soft = false,\n persist = false,\n disableDeployPipeline = false,\n disableTagPipeline = false,\n forceDeploy = false,\n incrementBy = 1,\n }: {\n all?: boolean | string;\n snapped?: boolean | string;\n ver?: string;\n patch?: boolean;\n minor?: boolean;\n major?: boolean;\n ignoreUnresolvedDependencies?: boolean;\n ignoreIssues?: string;\n scope?: string | boolean;\n incrementBy?: number;\n disableDeployPipeline?: boolean;\n disableTagPipeline?: boolean;\n } & Partial<BasicTagParams>\n ): Promise<string> {\n if (typeof ignoreUnresolvedDependencies === 'boolean') {\n throw new Error(`--ignore-unresolved-dependencies has been removed, please use --ignore-issues instead`);\n }\n if (ignoreIssues && typeof ignoreIssues === 'boolean') {\n throw new Error(`--ignore-issues expects issues to be ignored, please run \"bit tag -h\" for the issues list`);\n }\n const disableTagAndSnapPipelines = disableTagPipeline || disableDeployPipeline;\n\n const params = {\n ids: id,\n all,\n snapped,\n editor,\n message,\n preRelease,\n force,\n verbose,\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipAutoTag,\n build,\n soft,\n persist,\n scope,\n disableTagAndSnapPipelines,\n forceDeploy,\n incrementBy,\n ver,\n patch,\n minor,\n major,\n };\n\n const results = await this.snapping.tag(params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n const { taggedComponents, autoTaggedResults, warnings, newComponents }: TagResults = results;\n const changedComponents = taggedComponents.filter((component) => !newComponents.searchWithoutVersion(component.id));\n const addedComponents = taggedComponents.filter((component) => newComponents.searchWithoutVersion(component.id));\n const autoTaggedCount = autoTaggedResults ? autoTaggedResults.length : 0;\n\n const warningsOutput = warnings && warnings.length ? `${chalk.yellow(warnings.join('\\n'))}\\n\\n` : '';\n const tagExplanationPersist = `\\n(use \"bit export [collection]\" to push these components to a remote\")\n(use \"bit untag\" to unstage versions)\\n`;\n const tagExplanationSoft = `\\n(use \"bit tag --persist\" to persist the changes\")\n(use \"bit untag --soft\" to remove the soft-tags)\\n`;\n\n const tagExplanation = results.isSoftTag ? tagExplanationSoft : tagExplanationPersist;\n\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoTaggedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_TAGGED_MSG}:\n ${autoTagComp.join('\\n ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n const publishOutput = () => {\n const { publishedPackages } = results;\n if (!publishedPackages || !publishedPackages.length) return '';\n const successTitle = `\\n\\n${chalk.green(\n `published the following ${publishedPackages.length} component(s) successfully\\n`\n )}`;\n const successCompsStr = publishedPackages.join('\\n');\n const successOutput = successCompsStr ? successTitle + successCompsStr : '';\n return successOutput;\n };\n\n const softTagPrefix = results.isSoftTag ? 'soft-tagged ' : '';\n const outputIfExists = (label, explanation, components) => {\n if (!components.length) return '';\n return `\\n${chalk.underline(softTagPrefix + label)}\\n(${explanation})\\n${outputComponents(components)}\\n`;\n };\n\n const newDesc = results.isSoftTag\n ? 'set to be tagged first version for components'\n : 'first version for components';\n const changedDesc = results.isSoftTag\n ? 'components that set to get a version bump'\n : 'components that got a version bump';\n const softTagClarification = results.isSoftTag\n ? chalk.bold(\n 'keep in mind that this is a soft-tag (changes recorded to be tagged), to persist the changes use --persist flag'\n )\n : '';\n return (\n warningsOutput +\n chalk.green(\n `${taggedComponents.length + autoTaggedCount} component(s) ${results.isSoftTag ? 'soft-' : ''}tagged`\n ) +\n tagExplanation +\n outputIfExists('new components', newDesc, addedComponents) +\n outputIfExists('changed components', changedDesc, changedComponents) +\n publishOutput() +\n softTagClarification\n );\n }\n}\n"]}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/snapping",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/component/snapping",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "snapping",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.6"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -17,24 +17,31 @@
|
|
|
17
17
|
"@babel/runtime": "7.12.18",
|
|
18
18
|
"core-js": "^3.0.0",
|
|
19
19
|
"@teambit/bit-error": "0.0.394",
|
|
20
|
-
"@teambit/
|
|
20
|
+
"@teambit/issues": "0.0.2",
|
|
21
|
+
"@teambit/cli": "0.0.463",
|
|
21
22
|
"@teambit/component-issues": "0.0.48",
|
|
22
|
-
"@teambit/community": "0.0.
|
|
23
|
-
"@teambit/logger": "0.0.
|
|
24
|
-
"@teambit/workspace": "0.0.
|
|
23
|
+
"@teambit/community": "0.0.11",
|
|
24
|
+
"@teambit/logger": "0.0.555",
|
|
25
|
+
"@teambit/workspace": "0.0.691"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"@types/lodash": "4.14.165",
|
|
28
29
|
"@types/semver": "7.3.4",
|
|
30
|
+
"fs-extra": "10.0.0",
|
|
31
|
+
"@types/fs-extra": "9.0.7",
|
|
29
32
|
"@types/mocha": "9.1.0",
|
|
30
33
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
31
34
|
"@types/jest": "^26.0.0",
|
|
32
35
|
"@types/react-dom": "^17.0.5",
|
|
33
36
|
"@types/react": "^17.0.8",
|
|
34
|
-
"@types/node": "12.20.4"
|
|
37
|
+
"@types/node": "12.20.4",
|
|
38
|
+
"@teambit/compiler": "0.0.691",
|
|
39
|
+
"@teambit/component.testing.mock-components": "0.0.4",
|
|
40
|
+
"@teambit/harmony.testing.load-aspect": "0.0.4",
|
|
41
|
+
"@teambit/workspace.testing.mock-workspace": "0.0.4"
|
|
35
42
|
},
|
|
36
43
|
"peerDependencies": {
|
|
37
|
-
"@teambit/legacy": "1.0.
|
|
44
|
+
"@teambit/legacy": "1.0.241",
|
|
38
45
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
39
46
|
"react": "^16.8.0 || ^17.0.0"
|
|
40
47
|
},
|
|
@@ -62,7 +69,7 @@
|
|
|
62
69
|
"react": "-"
|
|
63
70
|
},
|
|
64
71
|
"peerDependencies": {
|
|
65
|
-
"@teambit/legacy": "1.0.
|
|
72
|
+
"@teambit/legacy": "1.0.241",
|
|
66
73
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
67
74
|
"react": "^16.8.0 || ^17.0.0"
|
|
68
75
|
}
|
|
File without changes
|
|
Binary file
|