@teambit/workspace 0.0.682 → 0.0.685
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/bit-map.d.ts +1 -0
- package/dist/bit-map.js +10 -0
- package/dist/bit-map.js.map +1 -1
- package/dist/tag-cmd.d.ts +1 -1
- package/dist/tag-cmd.js +19 -3
- package/dist/tag-cmd.js.map +1 -1
- package/dist/workspace.d.ts +1 -1
- package/dist/workspace.js +39 -21
- package/dist/workspace.js.map +1 -1
- package/package-tar/teambit-workspace-0.0.685.tgz +0 -0
- package/package.json +40 -40
- package/{preview-1647791556829.js → preview-1648006106088.js} +2 -2
- package/package-tar/teambit-workspace-0.0.682.tgz +0 -0
package/dist/bit-map.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare class BitMap {
|
|
|
18
18
|
*/
|
|
19
19
|
addComponentConfig(id: ComponentID, aspectId: string, config?: Record<string, any>): boolean;
|
|
20
20
|
removeComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist: boolean): boolean;
|
|
21
|
+
removeEntireConfig(id: ComponentID): boolean;
|
|
21
22
|
/**
|
|
22
23
|
* write .bitmap object to the filesystem
|
|
23
24
|
*/
|
package/dist/bit-map.js
CHANGED
|
@@ -84,6 +84,16 @@ class BitMap {
|
|
|
84
84
|
this.legacyBitMap.markAsChanged();
|
|
85
85
|
return true; // changes have been made
|
|
86
86
|
}
|
|
87
|
+
|
|
88
|
+
removeEntireConfig(id) {
|
|
89
|
+
const bitMapEntry = this.getBitmapEntry(id, {
|
|
90
|
+
ignoreScopeAndVersion: true
|
|
91
|
+
});
|
|
92
|
+
if (!bitMapEntry.config) return false;
|
|
93
|
+
delete bitMapEntry.config;
|
|
94
|
+
this.legacyBitMap.markAsChanged();
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
87
97
|
/**
|
|
88
98
|
* write .bitmap object to the filesystem
|
|
89
99
|
*/
|
package/dist/bit-map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["bit-map.ts"],"names":["BitMap","constructor","legacyBitMap","consumer","addComponentConfig","id","aspectId","config","Error","bitMapEntry","getBitmapEntry","ignoreScopeAndVersion","currentConfig","markAsChanged","removeComponentConfig","markWithMinusIfNotExist","REMOVE_EXTENSION_SPECIAL_SIGN","write","writeBitMap","ignoreVersion","getComponent","_legacy","renameNewComponent","sourceId","targetId","hasVersion","toString","removeComponent","setComponent"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AACA;AACA;AACA;AACO,MAAMA,MAAN,CAAa;AAClBC,EAAAA,WAAW,CAASC,YAAT,EAA6CC,QAA7C,EAAiE;AAAA,SAAxDD,YAAwD,GAAxDA,YAAwD;AAAA,SAApBC,QAAoB,GAApBA,QAAoB;AAAE;AAE9E;AACF;AACA;AACA;AACA;;;AACEC,EAAAA,kBAAkB,CAACC,EAAD,EAAkBC,QAAlB,EAAoCC,MAA2B,GAAG,EAAlE,EAA+E;AAC/F,QAAI,CAACD,QAAD,IAAa,OAAOA,QAAP,KAAoB,QAArC,EAA+C,MAAM,IAAIE,KAAJ,CAAW,qCAAoCF,QAAS,EAAxD,CAAN;AAC/C,UAAMG,WAAW,GAAG,KAAKC,cAAL,CAAoBL,EAApB,EAAwB;AAAEM,MAAAA,qBAAqB,EAAE;AAAzB,KAAxB,CAApB;AACA,UAAMC,aAAa,GAAG,CAACH,WAAW,CAACF,MAAb,KAACE,WAAW,CAACF,MAAb,GAAwB,EAAxB,GAA4BD,QAA5B,CAAtB;;AACA,QAAI,uBAAQM,aAAR,EAAuBL,MAAvB,CAAJ,EAAoC;AAClC,aAAO,KAAP,CADkC,CACpB;AACf;;AACD,QAAI,CAACA,MAAL,EAAa;AACX,aAAOE,WAAW,CAACF,MAAZ,CAAmBD,QAAnB,CAAP;AACD,KAFD,MAEO;AACLG,MAAAA,WAAW,CAACF,MAAZ,CAAmBD,QAAnB,IAA+BC,MAA/B;AACD;;AACD,SAAKL,YAAL,CAAkBW,aAAlB;AAEA,WAAO,IAAP,CAd+F,CAclF;AACd;;AAEDC,EAAAA,qBAAqB,CAACT,EAAD,EAAkBC,QAAlB,EAAoCS,uBAApC,EAA+E;AAClG,QAAI,CAACT,QAAD,IAAa,OAAOA,QAAP,KAAoB,QAArC,EAA+C,MAAM,IAAIE,KAAJ,CAAW,qCAAoCF,QAAS,EAAxD,CAAN;AAC/C,UAAMG,WAAW,GAAG,KAAKC,cAAL,CAAoBL,EAApB,EAAwB;AAAEM,MAAAA,qBAAqB,EAAE;AAAzB,KAAxB,CAApB;AACA,UAAMC,aAAa,GAAG,CAACH,WAAW,CAACF,MAAb,KAACE,WAAW,CAACF,MAAb,GAAwB,EAAxB,GAA4BD,QAA5B,CAAtB;;AACA,QAAIM,aAAJ,EAAmB;AACjB,aAAOH,WAAW,CAACF,MAAZ,CAAmBD,QAAnB,CAAP;AACD,KAFD,MAEO;AACL,UAAI,CAACS,uBAAL,EAA8B;AAC5B,eAAO,KAAP,CAD4B,CACd;AACf;;AACDN,MAAAA,WAAW,CAACF,MAAZ,CAAmBD,QAAnB,IAA+BU,uCAA/B;AACD;;AAED,SAAKd,YAAL,CAAkBW,aAAlB;AAEA,WAAO,IAAP,CAfkG,CAerF;AACd;AAED;AACF;AACA;;;AACa,
|
|
1
|
+
{"version":3,"sources":["bit-map.ts"],"names":["BitMap","constructor","legacyBitMap","consumer","addComponentConfig","id","aspectId","config","Error","bitMapEntry","getBitmapEntry","ignoreScopeAndVersion","currentConfig","markAsChanged","removeComponentConfig","markWithMinusIfNotExist","REMOVE_EXTENSION_SPECIAL_SIGN","removeEntireConfig","write","writeBitMap","ignoreVersion","getComponent","_legacy","renameNewComponent","sourceId","targetId","hasVersion","toString","removeComponent","setComponent"],"mappings":";;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMA;AAA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G,KAAKC,cAAL,CAAoBc,QAApB,CAApB;;AACA,QAAIf,WAAW,CAACJ,EAAZ,CAAeqB,UAAf,EAAJ,EAAiC;AAC/B,YAAM,IAAIlB,KAAJ,CAAW,kDAAiDC,WAAW,CAACJ,EAAZ,CAAesB,QAAf,EAA0B,EAAtF,CAAN;AACD;;AACD,SAAKzB,YAAL,CAAkB0B,eAAlB,CAAkCnB,WAAW,CAACJ,EAA9C;AACAI,IAAAA,WAAW,CAACJ,EAAZ,GAAiBoB,QAAQ,CAACH,OAA1B;AACA,SAAKpB,YAAL,CAAkB2B,YAAlB,CAA+BpB,WAAW,CAACJ,EAA3C,EAA+CI,WAA/C;AACD;;AA/EiB","sourcesContent":["import { isEqual } from 'lodash';\nimport { ComponentID } from '@teambit/component-id';\nimport LegacyBitMap from '@teambit/legacy/dist/consumer/bit-map';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport { REMOVE_EXTENSION_SPECIAL_SIGN } from '@teambit/legacy/dist/consumer/config';\n/**\n * consider extracting to a new component.\n * (pro: making Workspace aspect smaller. con: it's an implementation details of the workspace)\n */\nexport class BitMap {\n constructor(private legacyBitMap: LegacyBitMap, private consumer: Consumer) {}\n\n /**\n * adds component config to the .bitmap file.\n * later, upon `bit tag`, the data is saved in the scope.\n * returns a boolean indicating whether a change has been made.\n */\n addComponentConfig(id: ComponentID, aspectId: string, config: Record<string, any> = {}): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (isEqual(currentConfig, config)) {\n return false; // no changes\n }\n if (!config) {\n delete bitMapEntry.config[aspectId];\n } else {\n bitMapEntry.config[aspectId] = config;\n }\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n removeComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist: boolean): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (currentConfig) {\n delete bitMapEntry.config[aspectId];\n } else {\n if (!markWithMinusIfNotExist) {\n return false; // no changes\n }\n bitMapEntry.config[aspectId] = REMOVE_EXTENSION_SPECIAL_SIGN;\n }\n\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n removeEntireConfig(id: ComponentID): boolean {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n if (!bitMapEntry.config) return false;\n delete bitMapEntry.config;\n this.legacyBitMap.markAsChanged();\n return true;\n }\n\n /**\n * write .bitmap object to the filesystem\n */\n async write() {\n await this.consumer.writeBitMap();\n }\n\n /**\n * get the data saved in the .bitmap file for this component-id.\n */\n getBitmapEntry(\n id: ComponentID,\n { ignoreVersion, ignoreScopeAndVersion }: GetBitMapComponentOptions = {}\n ): ComponentMap {\n return this.legacyBitMap.getComponent(id._legacy, { ignoreVersion, ignoreScopeAndVersion });\n }\n\n /**\n * components that were not tagged yet are safe to rename them from the .bitmap file.\n */\n renameNewComponent(sourceId: ComponentID, targetId: ComponentID) {\n const bitMapEntry = this.getBitmapEntry(sourceId);\n if (bitMapEntry.id.hasVersion()) {\n throw new Error(`unable to rename tagged or exported component: ${bitMapEntry.id.toString()}`);\n }\n this.legacyBitMap.removeComponent(bitMapEntry.id);\n bitMapEntry.id = targetId._legacy;\n this.legacyBitMap.setComponent(bitMapEntry.id, bitMapEntry);\n }\n}\n"]}
|
package/dist/tag-cmd.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare class Tag implements Command {
|
|
|
20
20
|
minor?: boolean;
|
|
21
21
|
major?: boolean;
|
|
22
22
|
ignoreUnresolvedDependencies?: boolean;
|
|
23
|
-
ignoreIssues?:
|
|
23
|
+
ignoreIssues?: string;
|
|
24
24
|
scope?: string | boolean;
|
|
25
25
|
incrementBy?: number;
|
|
26
26
|
disableDeployPipeline?: boolean;
|
package/dist/tag-cmd.js
CHANGED
|
@@ -103,6 +103,16 @@ function _featureToggle() {
|
|
|
103
103
|
return data;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
function _componentIssues() {
|
|
107
|
+
const data = require("@teambit/component-issues");
|
|
108
|
+
|
|
109
|
+
_componentIssues = function () {
|
|
110
|
+
return data;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return data;
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
class Tag {
|
|
107
117
|
// In case a compiler / tester is not installed
|
|
108
118
|
constructor(docsDomain) {
|
|
@@ -113,7 +123,9 @@ class Tag {
|
|
|
113
123
|
(0, _defineProperty2().default)(this, "description", void 0);
|
|
114
124
|
(0, _defineProperty2().default)(this, "alias", 't');
|
|
115
125
|
(0, _defineProperty2().default)(this, "loader", true);
|
|
116
|
-
(0, _defineProperty2().default)(this, "options", [['m', 'message <message>', 'log message describing the user changes'], ['a', 'all [version]', 'tag all new and modified components'], ['s', 'scope [version]', 'tag all components of the current scope'], ['', 'editor [editor]', 'EXPERIMENTAL. open an editor to edit the tag messages per component, optionally specify the editor-name, default to vim'], ['', 'snapped [version]', 'tag components that their head is a snap (not a tag)'], ['', 'ver <version>', 'tag specified components with the given version'], ['p', 'patch', 'increment the patch version number'], ['', 'minor', 'increment the minor version number'], ['', 'major', 'increment the major version number'], ['', 'pre-release [identifier]', 'EXPERIMENTAL. increment a pre-release version (e.g. 1.0.0-dev.1)'], ['f', 'force', 'force-tag even if tests are failing and even when component has not changed'], ['v', 'verbose', 'show specs output on failure'], ['
|
|
126
|
+
(0, _defineProperty2().default)(this, "options", [['m', 'message <message>', 'log message describing the user changes'], ['a', 'all [version]', 'tag all new and modified components'], ['s', 'scope [version]', 'tag all components of the current scope'], ['', 'editor [editor]', 'EXPERIMENTAL. open an editor to edit the tag messages per component, optionally specify the editor-name, default to vim'], ['', 'snapped [version]', 'tag components that their head is a snap (not a tag)'], ['', 'ver <version>', 'tag specified components with the given version'], ['p', 'patch', 'increment the patch version number'], ['', 'minor', 'increment the minor version number'], ['', 'major', 'increment the major version number'], ['', 'pre-release [identifier]', 'EXPERIMENTAL. increment a pre-release version (e.g. 1.0.0-dev.1)'], ['f', 'force', 'force-tag even if tests are failing and even when component has not changed'], ['v', 'verbose', 'show specs output on failure'], ['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'], ['', 'skip-tests', 'skip running component tests during tag process'], ['', 'skip-auto-tag', 'skip auto tagging dependents'], ['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'], ['', 'soft', 'do not persist. only keep note of the changes to be made'], ['', 'persist', 'persist the changes generated by --soft tag'], ['', 'disable-deploy-pipeline', 'DEPRECATED. use --disable-tag-pipeline instead'], ['', 'disable-tag-pipeline', 'skip the tag pipeline to avoid publishing the components'], ['', 'force-deploy', 'run the tag pipeline although the build failed'], ['', 'increment-by <number>', '(default to 1) increment semver flag (patch/minor/major) by. e.g. incrementing patch by 2: 0.0.1 -> 0.0.3.'], ['i', 'ignore-issues [issues]', `ignore component issues (shown in "bit status" as "issues found"), issues to ignore:
|
|
127
|
+
[${Object.keys(_componentIssues().IssuesClasses).join(', ')}]
|
|
128
|
+
to ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify "*".`]]);
|
|
117
129
|
(0, _defineProperty2().default)(this, "migration", true);
|
|
118
130
|
(0, _defineProperty2().default)(this, "remoteOp", true);
|
|
119
131
|
this.description = `record component changes and lock versions.
|
|
@@ -136,7 +148,7 @@ ${(0, _constants().WILDCARD_HELP)('tag')}`;
|
|
|
136
148
|
force = false,
|
|
137
149
|
verbose = false,
|
|
138
150
|
ignoreUnresolvedDependencies,
|
|
139
|
-
ignoreIssues
|
|
151
|
+
ignoreIssues,
|
|
140
152
|
ignoreNewestVersion = false,
|
|
141
153
|
skipTests = false,
|
|
142
154
|
skipAutoTag = false,
|
|
@@ -168,7 +180,11 @@ ${(0, _constants().WILDCARD_HELP)('tag')}`;
|
|
|
168
180
|
}
|
|
169
181
|
|
|
170
182
|
if (typeof ignoreUnresolvedDependencies === 'boolean') {
|
|
171
|
-
|
|
183
|
+
throw new Error(`--ignore-unresolved-dependencies has been removed, please use --ignore-issues instead`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (ignoreIssues && typeof ignoreIssues === 'boolean') {
|
|
187
|
+
throw new Error(`--ignore-issues expects issues to be ignored, please run "bit tag -h" for the issues list`);
|
|
172
188
|
}
|
|
173
189
|
|
|
174
190
|
if (id.length === 2) {
|
package/dist/tag-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tag-cmd.ts"],"names":["Tag","constructor","docsDomain","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","secondArg","semver","valid","disableTagAndSnapPipelines","releaseFlags","filter","x","releaseType","DEFAULT_BIT_RELEASE_TYPE","includeImported","params","ids","exactVersion","results","chalk","yellow","NOTHING_TO_TAG_MSG","taggedComponents","autoTaggedResults","warnings","newComponents","changedComponents","component","searchWithoutVersion","addedComponents","autoTaggedCount","warningsOutput","join","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":";;;;;;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AMkD,eAAe,GAAGH,iBAAiB,CAAClB,IAAlB,CAAuB,IAAvB,CAAxB;AACA,YAAMsB,aAAa,GAAGD,eAAe,GAAGF,YAAY,GAAGE,eAAlB,GAAoC,EAAzE;AACA,aAAOC,aAAP;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,CAACxD,MAAhB,EAAwB,OAAO,EAAP;AACxB,aAAQ,KAAIgB,iBAAMyC,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,GACzBjB,iBAAM6C,IAAN,CACE,iHADF,CADyB,GAIzB,EAJJ;AAKA,WACEjC,cAAc,GACdZ,iBAAMiC,KAAN,CACG,GAAE9B,gBAAgB,CAACnB,MAAjB,GAA0B2B,eAAgB,iBAAgBZ,OAAO,CAACkB,SAAR,GAAoB,OAApB,GAA8B,EAAG,QADhG,CADA,GAIAD,cAJA,GAKAqB,cAAc,CAAC,gBAAD,EAAmBK,OAAnB,EAA4BhC,eAA5B,CALd,GAMA2B,cAAc,CAAC,oBAAD,EAAuBM,WAAvB,EAAoCpC,iBAApC,CANd,GAOAuB,aAAa,EAPb,GAQAc,oBATF;AAWD;;AAvPiC","sourcesContent":["import chalk from 'chalk';\nimport semver, { ReleaseType } from 'semver';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { tagAction } from '@teambit/legacy/dist/api/consumer';\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';\n\nexport class Tag 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 ['', 'ignore-unresolved-dependencies', 'DEPRECATED. use --ignore-issues instead'],\n ['i', 'ignore-issues', 'ignore component issues (shown in \"bit status\" as \"issues found\")'],\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 ] as CommandOptions;\n migration = true;\n remoteOp = true; // In case a compiler / tester is not installed\n\n constructor(private docsDomain: string) {\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 = false,\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?: boolean;\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 ignoreIssues = ignoreUnresolvedDependencies;\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 tagAction(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":["Tag","constructor","docsDomain","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","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;;AACA;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;;A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GAAGpC,OAAO,CAACiB,SAAR,GAAoB,cAApB,GAAqC,EAA3D;;AACA,UAAMoB,cAAc,GAAG,CAACC,KAAD,EAAQC,WAAR,EAAqBC,UAArB,KAAoC;AACzD,UAAI,CAACA,UAAU,CAACxD,MAAhB,EAAwB,OAAO,EAAP;AACxB,aAAQ,KAAIiB,iBAAMwC,SAAN,CAAgBL,aAAa,GAAGE,KAAhC,CAAuC,MAAKC,WAAY,MAAKrB,gBAAgB,CAACsB,UAAD,CAAa,IAAtG;AACD,KAHD;;AAKA,UAAME,OAAO,GAAG1C,OAAO,CAACiB,SAAR,GACZ,+CADY,GAEZ,8BAFJ;AAGA,UAAM0B,WAAW,GAAG3C,OAAO,CAACiB,SAAR,GAChB,2CADgB,GAEhB,oCAFJ;AAGA,UAAM2B,oBAAoB,GAAG5C,OAAO,CAACiB,SAAR,GACzBhB,iBAAM4C,IAAN,CACE,iHADF,CADyB,GAIzB,EAJJ;AAKA,WACEhC,cAAc,GACdZ,iBAAMgC,KAAN,CACG,GAAE7B,gBAAgB,CAACpB,MAAjB,GAA0B4B,eAAgB,iBAAgBZ,OAAO,CAACiB,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/PiC","sourcesContent":["import chalk from 'chalk';\nimport semver, { ReleaseType } from 'semver';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { tagAction } from '@teambit/legacy/dist/api/consumer';\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';\n\nexport class Tag 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(private docsDomain: string) {\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 tagAction(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"]}
|
package/dist/workspace.d.ts
CHANGED
|
@@ -375,7 +375,7 @@ export declare class Workspace implements ComponentFactory {
|
|
|
375
375
|
* defaults extensions from workspace config
|
|
376
376
|
* extensions from the model.
|
|
377
377
|
*/
|
|
378
|
-
componentExtensions(componentId: ComponentID, componentFromScope?: Component): Promise<{
|
|
378
|
+
componentExtensions(componentId: ComponentID, componentFromScope?: Component, excludeOrigins?: ExtensionsOrigin[]): Promise<{
|
|
379
379
|
extensions: ExtensionDataList;
|
|
380
380
|
beforeMerge: Array<{
|
|
381
381
|
extensions: ExtensionDataList;
|
package/dist/workspace.js
CHANGED
|
@@ -1071,15 +1071,22 @@ class Workspace {
|
|
|
1071
1071
|
|
|
1072
1072
|
async ejectConfig(id, options) {
|
|
1073
1073
|
const componentId = await this.resolveComponentId(id);
|
|
1074
|
-
const component = await this.
|
|
1075
|
-
const
|
|
1074
|
+
const component = await this.get(componentId);
|
|
1075
|
+
const componentFromScope = await this.scope.get(id);
|
|
1076
|
+
const {
|
|
1077
|
+
extensions
|
|
1078
|
+
} = await this.componentExtensions(component.id, componentFromScope, ['WorkspaceDefault', 'WorkspaceVariants']);
|
|
1079
|
+
const aspects = await this.createAspectList(extensions);
|
|
1076
1080
|
const componentDir = this.componentDir(id, {
|
|
1077
1081
|
ignoreVersion: true
|
|
1078
1082
|
});
|
|
1079
1083
|
const componentConfigFile = new (_componentConfigFile().ComponentConfigFile)(componentId, aspects, componentDir, options.propagate);
|
|
1080
1084
|
await componentConfigFile.write({
|
|
1081
1085
|
override: options.override
|
|
1082
|
-
});
|
|
1086
|
+
}); // remove config from the .bitmap as it's not needed anymore. it is replaced by the component.json
|
|
1087
|
+
|
|
1088
|
+
this.bitMap.removeEntireConfig(id);
|
|
1089
|
+
await this.bitMap.write();
|
|
1083
1090
|
return {
|
|
1084
1091
|
configPath: _componentConfigFile().ComponentConfigFile.composePath(componentDir)
|
|
1085
1092
|
};
|
|
@@ -1425,7 +1432,7 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1425
1432
|
*/
|
|
1426
1433
|
|
|
1427
1434
|
|
|
1428
|
-
async componentExtensions(componentId, componentFromScope) {
|
|
1435
|
+
async componentExtensions(componentId, componentFromScope, excludeOrigins = []) {
|
|
1429
1436
|
var _componentFromScope$c, _componentConfigFile$, _variantConfig$propag, _wsDefaultExtensions;
|
|
1430
1437
|
|
|
1431
1438
|
// TODO: consider caching this result
|
|
@@ -1433,17 +1440,16 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1433
1440
|
let variantsExtensions;
|
|
1434
1441
|
let wsDefaultExtensions;
|
|
1435
1442
|
const mergeFromScope = true;
|
|
1443
|
+
const bitMapEntry = this.consumer.bitMap.getComponentIfExist(componentId._legacy);
|
|
1444
|
+
const bitMapExtensions = bitMapEntry === null || bitMapEntry === void 0 ? void 0 : bitMapEntry.config;
|
|
1436
1445
|
const scopeExtensions = (componentFromScope === null || componentFromScope === void 0 ? void 0 : (_componentFromScope$c = componentFromScope.config) === null || _componentFromScope$c === void 0 ? void 0 : _componentFromScope$c.extensions) || new (_extensionData().ExtensionDataList)();
|
|
1437
1446
|
const [specific, nonSpecific] = (0, _lodash().partition)(scopeExtensions, entry => entry.config[AspectSpecificField] === true);
|
|
1438
1447
|
const scopeExtensionsNonSpecific = new (_extensionData().ExtensionDataList)(...nonSpecific);
|
|
1439
1448
|
const scopeExtensionsSpecific = new (_extensionData().ExtensionDataList)(...specific);
|
|
1440
|
-
const bitMapEntry = this.consumer.bitMap.getComponentIfExist(componentId._legacy);
|
|
1441
|
-
const bitMapExtensions = bitMapEntry === null || bitMapEntry === void 0 ? void 0 : bitMapEntry.config;
|
|
1442
1449
|
const componentConfigFile = await this.componentConfigFile(componentId);
|
|
1443
1450
|
|
|
1444
1451
|
if (componentConfigFile) {
|
|
1445
|
-
configFileExtensions = componentConfigFile.aspects.toLegacy();
|
|
1446
|
-
// mergeFromScope = false;
|
|
1452
|
+
configFileExtensions = componentConfigFile.aspects.toLegacy();
|
|
1447
1453
|
}
|
|
1448
1454
|
|
|
1449
1455
|
const relativeComponentDir = this.componentDir(componentId, {
|
|
@@ -1470,6 +1476,7 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1470
1476
|
|
|
1471
1477
|
const extensionsToMerge = [];
|
|
1472
1478
|
let envWasFoundPreviously = false;
|
|
1479
|
+
const loadedExtensionIds = [];
|
|
1473
1480
|
const removedExtensionIds = [];
|
|
1474
1481
|
|
|
1475
1482
|
const addAndLoadExtensions = async (extensions, origin, extraData) => {
|
|
@@ -1479,8 +1486,15 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1479
1486
|
|
|
1480
1487
|
removedExtensionIds.push(...extensions.filter(extData => extData.isRemoved).map(extData => extData.stringId));
|
|
1481
1488
|
const extsWithoutRemoved = extensions.filterRemovedExtensions();
|
|
1482
|
-
|
|
1483
|
-
const
|
|
1489
|
+
|
|
1490
|
+
const extsWithoutLoaded = _extensionData().ExtensionDataList.fromArray(extsWithoutRemoved.filter(ext => {
|
|
1491
|
+
var _ext$extensionId;
|
|
1492
|
+
|
|
1493
|
+
return !loadedExtensionIds.includes(((_ext$extensionId = ext.extensionId) === null || _ext$extensionId === void 0 ? void 0 : _ext$extensionId.toStringWithoutVersion()) || '');
|
|
1494
|
+
}));
|
|
1495
|
+
|
|
1496
|
+
const selfInMergedExtensions = extsWithoutLoaded.findExtension(componentId._legacy.toStringWithoutScopeAndVersion(), true, true);
|
|
1497
|
+
const extsWithoutSelf = selfInMergedExtensions !== null && selfInMergedExtensions !== void 0 && selfInMergedExtensions.extensionId ? extsWithoutLoaded.remove(selfInMergedExtensions.extensionId) : extsWithoutLoaded;
|
|
1484
1498
|
await this.loadExtensions(extsWithoutSelf, componentId);
|
|
1485
1499
|
const {
|
|
1486
1500
|
extensionDataListFiltered,
|
|
@@ -1492,29 +1506,36 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1492
1506
|
extensions: extensionDataListFiltered,
|
|
1493
1507
|
extraData
|
|
1494
1508
|
});
|
|
1509
|
+
loadedExtensionIds.push(...(0, _lodash().compact)(extensionDataListFiltered.map(e => {
|
|
1510
|
+
var _e$extensionId;
|
|
1511
|
+
|
|
1512
|
+
return (_e$extensionId = e.extensionId) === null || _e$extensionId === void 0 ? void 0 : _e$extensionId.toStringWithoutVersion();
|
|
1513
|
+
})));
|
|
1495
1514
|
};
|
|
1496
1515
|
|
|
1497
1516
|
const setDataListAsSpecific = extensions => {
|
|
1498
1517
|
extensions.forEach(dataEntry => dataEntry.config[AspectSpecificField] = true);
|
|
1499
1518
|
};
|
|
1500
1519
|
|
|
1501
|
-
if (bitMapExtensions) {
|
|
1520
|
+
if (bitMapExtensions && !excludeOrigins.includes('BitmapFile')) {
|
|
1502
1521
|
const extensionDataList = _extensionData().ExtensionDataList.fromConfigObject(bitMapExtensions);
|
|
1503
1522
|
|
|
1504
1523
|
setDataListAsSpecific(extensionDataList);
|
|
1505
1524
|
await addAndLoadExtensions(extensionDataList, 'BitmapFile');
|
|
1506
1525
|
}
|
|
1507
1526
|
|
|
1508
|
-
if (configFileExtensions) {
|
|
1527
|
+
if (configFileExtensions && !excludeOrigins.includes('ComponentJsonFile')) {
|
|
1509
1528
|
setDataListAsSpecific(configFileExtensions);
|
|
1510
1529
|
await addAndLoadExtensions(configFileExtensions, 'ComponentJsonFile');
|
|
1511
1530
|
}
|
|
1512
1531
|
|
|
1513
|
-
|
|
1532
|
+
if (!excludeOrigins.includes('ModelSpecific')) {
|
|
1533
|
+
await addAndLoadExtensions(_extensionData().ExtensionDataList.fromArray(scopeExtensionsSpecific), 'ModelSpecific');
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1514
1536
|
let continuePropagating = (_componentConfigFile$ = componentConfigFile === null || componentConfigFile === void 0 ? void 0 : componentConfigFile.propagate) !== null && _componentConfigFile$ !== void 0 ? _componentConfigFile$ : true;
|
|
1515
1537
|
|
|
1516
|
-
if (variantsExtensions && continuePropagating) {
|
|
1517
|
-
// Put it in the start to make sure the config file is stronger
|
|
1538
|
+
if (variantsExtensions && continuePropagating && !excludeOrigins.includes('WorkspaceVariants')) {
|
|
1518
1539
|
const appliedRules = variantConfig === null || variantConfig === void 0 ? void 0 : variantConfig.sortedMatches.map(({
|
|
1519
1540
|
pattern,
|
|
1520
1541
|
specificity
|
|
@@ -1531,14 +1552,11 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1531
1552
|
|
|
1532
1553
|
const isDefaultExtension = (_wsDefaultExtensions = wsDefaultExtensions) === null || _wsDefaultExtensions === void 0 ? void 0 : _wsDefaultExtensions.findExtension(componentId.toString(), true, true);
|
|
1533
1554
|
|
|
1534
|
-
if (wsDefaultExtensions && continuePropagating && !isDefaultExtension) {
|
|
1535
|
-
// Put it in the start to make sure the config file is stronger
|
|
1555
|
+
if (wsDefaultExtensions && continuePropagating && !isDefaultExtension && !excludeOrigins.includes('WorkspaceDefault')) {
|
|
1536
1556
|
await addAndLoadExtensions(wsDefaultExtensions, 'WorkspaceDefault');
|
|
1537
|
-
}
|
|
1538
|
-
// await Promise.all(extensionsToMerge.map((extensions) => this.resolveExtensionsList(extensions)));
|
|
1539
|
-
|
|
1557
|
+
}
|
|
1540
1558
|
|
|
1541
|
-
if (mergeFromScope && continuePropagating) {
|
|
1559
|
+
if (mergeFromScope && continuePropagating && !excludeOrigins.includes('ModelNonSpecific')) {
|
|
1542
1560
|
await addAndLoadExtensions(scopeExtensionsNonSpecific, 'ModelNonSpecific');
|
|
1543
1561
|
} // It's important to do this resolution before the merge, otherwise we have issues with extensions
|
|
1544
1562
|
// coming from scope with local scope name, as opposed to the same extension comes from the workspace with default scope name
|