@teambit/snapping 1.0.582 → 1.0.584
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/esm.mjs +0 -2
- package/dist/generate-comp-from-scope.d.ts +1 -2
- package/dist/generate-comp-from-scope.js.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +20 -21
- package/dist/index.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +19 -11
- package/dist/snapping.main.runtime.js +1 -118
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/snapping.spec.js.map +1 -1
- package/esm.mjs +0 -2
- package/package.json +34 -35
- package/dist/snap-from-scope.cmd.d.ts +0 -61
- package/dist/snap-from-scope.cmd.js +0 -195
- package/dist/snap-from-scope.cmd.js.map +0 -1
- package/dist/tag-from-scope.cmd.d.ts +0 -31
- package/dist/tag-from-scope.cmd.js +0 -128
- package/dist/tag-from-scope.cmd.js.map +0 -1
- /package/dist/{preview-1743650367252.js → preview-1743823045660.js} +0 -0
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TagFromScopeCmd = void 0;
|
|
7
|
-
function _chalk() {
|
|
8
|
-
const data = _interopRequireDefault(require("chalk"));
|
|
9
|
-
_chalk = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _tagCmd() {
|
|
15
|
-
const data = require("./tag-cmd");
|
|
16
|
-
_tagCmd = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _bit() {
|
|
22
|
-
const data = require("@teambit/bit.get-bit-version");
|
|
23
|
-
_bit = function () {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
30
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
31
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
32
|
-
const excludeOptions = ['unmodified', 'editor [editor]', 'snapped', 'unmerged', 'soft', 'persist [skip-build]'];
|
|
33
|
-
class TagFromScopeCmd {
|
|
34
|
-
// In case a compiler / tester is not installed
|
|
35
|
-
|
|
36
|
-
constructor(snapping, logger) {
|
|
37
|
-
this.snapping = snapping;
|
|
38
|
-
this.logger = logger;
|
|
39
|
-
_defineProperty(this, "name", '_tag <data>');
|
|
40
|
-
_defineProperty(this, "group", 'development');
|
|
41
|
-
_defineProperty(this, "private", true);
|
|
42
|
-
_defineProperty(this, "description", 'tag components from a bare-scope by using build artifacts from previous snap and running the deploy-pipeline only');
|
|
43
|
-
_defineProperty(this, "extendedDescription", `this command should be running from a new bare scope, it first imports the components it needs and then processes the tag.
|
|
44
|
-
the input data is a stringified JSON of an array of the following object.
|
|
45
|
-
{
|
|
46
|
-
componentId: string; // ids always have scope, so it's safe to parse them from string
|
|
47
|
-
dependencies?: string[]; // e.g. [teambit/compiler@1.0.0, teambit/tester^@1.0.0, teambit/linter~@0.0.1]
|
|
48
|
-
versionToTag?: string; // specific version (e.g. '1.0.0') or semver (e.g. 'minor', 'patch')
|
|
49
|
-
prereleaseId?: string; // applicable when versionToTag is a pre-release. (e.g. "dev", for 1.0.0-dev.1)
|
|
50
|
-
message?: string; // tag-message.
|
|
51
|
-
}
|
|
52
|
-
an example of the final data: '[{"componentId":"ci.remote2/comp-b","dependencies":["ci.remote/comp1@0.0.2"]}]'
|
|
53
|
-
`);
|
|
54
|
-
_defineProperty(this, "alias", '');
|
|
55
|
-
_defineProperty(this, "loader", true);
|
|
56
|
-
_defineProperty(this, "options", [['', 'push', 'export the updated objects to the original scopes once done'], ['', 'rebuild-artifacts', 'run the full build pipeline. do not use the saved artifacts from the last snap'], ['', 'ignore-last-pkg-json', 'ignore the package.json created by the last snap'], ['', 'override-head', 'opposite of detach-head. in case a component is checked out to an older version, change head to the newly created version'], ..._tagCmd().tagCmdOptions.filter(o => !excludeOptions.includes(o[1]))]);
|
|
57
|
-
_defineProperty(this, "remoteOp", true);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// eslint-disable-next-line complexity
|
|
61
|
-
async report([data], options) {
|
|
62
|
-
const {
|
|
63
|
-
releaseType,
|
|
64
|
-
preReleaseId
|
|
65
|
-
} = (0, _tagCmd().validateOptions)(options);
|
|
66
|
-
const {
|
|
67
|
-
push,
|
|
68
|
-
message = '',
|
|
69
|
-
ver,
|
|
70
|
-
ignoreIssues,
|
|
71
|
-
ignoreNewestVersion = false,
|
|
72
|
-
skipTests = false,
|
|
73
|
-
skipTasks,
|
|
74
|
-
disableTagPipeline = false,
|
|
75
|
-
ignoreBuildErrors = false,
|
|
76
|
-
rebuildArtifacts,
|
|
77
|
-
ignoreLastPkgJson,
|
|
78
|
-
rebuildDepsGraph,
|
|
79
|
-
incrementBy = 1,
|
|
80
|
-
detachHead,
|
|
81
|
-
overrideHead
|
|
82
|
-
} = options;
|
|
83
|
-
const params = {
|
|
84
|
-
push,
|
|
85
|
-
message,
|
|
86
|
-
releaseType,
|
|
87
|
-
preReleaseId,
|
|
88
|
-
ignoreIssues,
|
|
89
|
-
ignoreNewestVersion,
|
|
90
|
-
skipTests,
|
|
91
|
-
skipTasks,
|
|
92
|
-
build: true,
|
|
93
|
-
persist: true,
|
|
94
|
-
disableTagAndSnapPipelines: disableTagPipeline,
|
|
95
|
-
ignoreBuildErrors,
|
|
96
|
-
rebuildDepsGraph,
|
|
97
|
-
incrementBy,
|
|
98
|
-
version: ver,
|
|
99
|
-
rebuildArtifacts,
|
|
100
|
-
ignoreLastPkgJson,
|
|
101
|
-
detachHead,
|
|
102
|
-
overrideHead
|
|
103
|
-
};
|
|
104
|
-
const tagDataPerCompRaw = this.parseData(data);
|
|
105
|
-
this.logger.console(`tagging using ${(0, _bit().getBitVersion)()} version`);
|
|
106
|
-
const results = await this.snapping.tagFromScope(tagDataPerCompRaw, params);
|
|
107
|
-
if (!results) return _chalk().default.yellow(_tagCmd().NOTHING_TO_TAG_MSG);
|
|
108
|
-
return (0, _tagCmd().tagResultOutput)(results);
|
|
109
|
-
}
|
|
110
|
-
parseData(data) {
|
|
111
|
-
let dataParsed;
|
|
112
|
-
try {
|
|
113
|
-
dataParsed = JSON.parse(data);
|
|
114
|
-
} catch (err) {
|
|
115
|
-
throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);
|
|
116
|
-
}
|
|
117
|
-
if (!Array.isArray(dataParsed)) {
|
|
118
|
-
throw new Error('expect data to be an array');
|
|
119
|
-
}
|
|
120
|
-
dataParsed.forEach(dataItem => {
|
|
121
|
-
if (!dataItem.componentId) throw new Error('expect data item to have "componentId" prop');
|
|
122
|
-
});
|
|
123
|
-
return dataParsed;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
exports.TagFromScopeCmd = TagFromScopeCmd;
|
|
127
|
-
|
|
128
|
-
//# sourceMappingURL=tag-from-scope.cmd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_tagCmd","_bit","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","excludeOptions","TagFromScopeCmd","constructor","snapping","logger","tagCmdOptions","filter","o","includes","report","options","releaseType","preReleaseId","validateOptions","push","message","ver","ignoreIssues","ignoreNewestVersion","skipTests","skipTasks","disableTagPipeline","ignoreBuildErrors","rebuildArtifacts","ignoreLastPkgJson","rebuildDepsGraph","incrementBy","detachHead","overrideHead","params","build","persist","disableTagAndSnapPipelines","version","tagDataPerCompRaw","parseData","console","getBitVersion","results","tagFromScope","chalk","yellow","NOTHING_TO_TAG_MSG","tagResultOutput","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId","exports"],"sources":["tag-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { NOTHING_TO_TAG_MSG, tagCmdOptions, TagParams, validateOptions, tagResultOutput } from './tag-cmd';\nimport { getBitVersion } from '@teambit/bit.get-bit-version';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\n\nconst excludeOptions = ['unmodified', 'editor [editor]', 'snapped', 'unmerged', 'soft', 'persist [skip-build]'];\n\nexport type TagDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n versionToTag?: string;\n prereleaseId?: string;\n message?: string;\n};\n\nexport class TagFromScopeCmd implements Command {\n name = '_tag <data>';\n group = 'development';\n private = true;\n description =\n 'tag components from a bare-scope by using build artifacts from previous snap and running the deploy-pipeline only';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the tag.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // e.g. [teambit/compiler@1.0.0, teambit/tester^@1.0.0, teambit/linter~@0.0.1]\n versionToTag?: string; // specific version (e.g. '1.0.0') or semver (e.g. 'minor', 'patch')\n prereleaseId?: string; // applicable when versionToTag is a pre-release. (e.g. \"dev\", for 1.0.0-dev.1)\n message?: string; // tag-message.\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"dependencies\":[\"ci.remote/comp1@0.0.2\"]}]'\n`;\n alias = '';\n loader = true;\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['', 'rebuild-artifacts', 'run the full build pipeline. do not use the saved artifacts from the last snap'],\n ['', 'ignore-last-pkg-json', 'ignore the package.json created by the last snap'],\n [\n '',\n 'override-head',\n 'opposite of detach-head. in case a component is checked out to an older version, change head to the newly created version',\n ],\n ...tagCmdOptions.filter((o) => !excludeOptions.includes(o[1])),\n ] as CommandOptions;\n remoteOp = true; // In case a compiler / tester is not installed\n\n constructor(\n private snapping: SnappingMain,\n private logger: Logger\n ) {}\n\n // eslint-disable-next-line complexity\n async report(\n [data]: [string],\n options: {\n push?: boolean;\n rebuildArtifacts?: boolean;\n ignoreLastPkgJson?: boolean;\n } & Partial<TagParams>\n ): Promise<string> {\n const { releaseType, preReleaseId } = validateOptions(options);\n\n const {\n push,\n message = '',\n ver,\n ignoreIssues,\n ignoreNewestVersion = false,\n skipTests = false,\n skipTasks,\n disableTagPipeline = false,\n ignoreBuildErrors = false,\n rebuildArtifacts,\n ignoreLastPkgJson,\n rebuildDepsGraph,\n incrementBy = 1,\n detachHead,\n overrideHead,\n } = options;\n\n const params = {\n push,\n message,\n releaseType,\n preReleaseId,\n ignoreIssues,\n ignoreNewestVersion,\n skipTests,\n skipTasks,\n build: true,\n persist: true,\n disableTagAndSnapPipelines: disableTagPipeline,\n ignoreBuildErrors,\n rebuildDepsGraph,\n incrementBy,\n version: ver,\n rebuildArtifacts,\n ignoreLastPkgJson,\n detachHead,\n overrideHead,\n };\n\n const tagDataPerCompRaw = this.parseData(data);\n this.logger.console(`tagging using ${getBitVersion()} version`);\n const results = await this.snapping.tagFromScope(tagDataPerCompRaw, params);\n if (!results) return chalk.yellow(NOTHING_TO_TAG_MSG);\n return tagResultOutput(results);\n }\n private parseData(data: string): TagDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n });\n return dataParsed;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6D,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EA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