@teambit/tracker 1.0.583 → 1.0.585

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/add-cmd.js CHANGED
@@ -35,7 +35,7 @@ class AddCmd {
35
35
  constructor(tracker) {
36
36
  this.tracker = tracker;
37
37
  _defineProperty(this, "name", 'add [path...]');
38
- _defineProperty(this, "description", 'Add any subset of files to be tracked as a component(s).');
38
+ _defineProperty(this, "description", 'track one or more directories as new components');
39
39
  _defineProperty(this, "group", 'development');
40
40
  _defineProperty(this, "extendedDescription", 'Learn the recommended workflow for tracking directories as components, in the link below.');
41
41
  _defineProperty(this, "helpUrl", 'reference/workspace/component-directory');
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","path","_interopRequireWildcard","_bitError","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","AddCmd","constructor","tracker","report","paths","addFlags","addedComponents","warnings","json","paintWarning","alreadyUsedOutput","alreadyUsedWarning","keys","alreadyUsed","map","key","chalk","yellow","bold","join","filter","x","emptyDirectoryOutput","emptyDirectory","length","green","result","files","underline","red","id","title","file","flat","main","namespace","scope","env","override","BitError","normalizedPaths","p","normalize","addForCLI","componentPaths","undefined","defaultScope","added","toString","f","relativePath","exports"],"sources":["add-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport * as path from 'path';\nimport { BitError } from '@teambit/bit-error';\nimport { PathLinux, PathOsBased } from '@teambit/legacy.utils';\nimport { AddActionResults, Warnings } from './add-components';\nimport { TrackerMain } from './tracker.main.runtime';\n\ntype AddFlags = {\n id: string | null | undefined;\n main: string | null | undefined;\n namespace: string | null | undefined;\n scope?: string;\n env?: string;\n override: boolean;\n};\n\ntype AddResults = {\n addedComponents: Array<{ id: string; files: PathLinux[] }>;\n warnings: Warnings;\n};\n\nexport class AddCmd implements Command {\n name = 'add [path...]';\n description = 'Add any subset of files to be tracked as a component(s).';\n group = 'development';\n extendedDescription = 'Learn the recommended workflow for tracking directories as components, in the link below.';\n helpUrl = 'reference/workspace/component-directory';\n alias = 'a';\n options = [\n ['i', 'id <name>', 'manually set component id'],\n ['m', 'main <file>', 'define component entry point'],\n ['n', 'namespace <namespace>', 'organize component in a namespace'],\n ['o', 'override <boolean>', 'override existing component if exists (default = false)'],\n [\n 's',\n 'scope <string>',\n `sets the component's scope. if not entered, the default-scope from workspace.jsonc will be used`,\n ],\n ['e', 'env <string>', \"set the component's environment. (overrides the env from variants if exists)\"],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private tracker: TrackerMain) {}\n\n async report([paths = []]: [string[]], addFlags: AddFlags) {\n const { addedComponents, warnings }: AddResults = await this.json([paths], addFlags);\n\n const paintWarning = () => {\n const alreadyUsedOutput = () => {\n const alreadyUsedWarning = Object.keys(warnings.alreadyUsed)\n .map((key) =>\n chalk.yellow(\n `warning: files ${chalk.bold(warnings.alreadyUsed[key].join(', '))} already used by component: ${key}`\n )\n )\n .filter((x) => x)\n .join('\\n');\n return alreadyUsedWarning ? `${alreadyUsedWarning}\\n` : '';\n };\n const emptyDirectoryOutput = () => {\n if (!warnings.emptyDirectory.length) return '';\n return chalk.yellow(\n `warning: the following directories are empty or all their files were excluded\\n${chalk.bold(\n warnings.emptyDirectory.join('\\n')\n )}\\n`\n );\n };\n return alreadyUsedOutput() + emptyDirectoryOutput();\n };\n\n if (addedComponents.length > 1) {\n return paintWarning() + chalk.green(`tracking ${addedComponents.length} new components`);\n }\n\n return (\n paintWarning() +\n addedComponents\n .map((result) => {\n if (result.files.length === 0) {\n return chalk.underline.red(`could not track component ${chalk.bold(result.id)}: no files to track`);\n }\n const title = chalk.underline(`tracking component ${chalk.bold(result.id)}:\\n`);\n const files = result.files.map((file) => chalk.green(`added ${file}`));\n return title + files.join('\\n');\n })\n .flat()\n .join('\\n\\n')\n );\n }\n\n async json(\n [paths = []]: [string[]],\n { id, main, namespace, scope, env, override = false }: AddFlags\n ): Promise<AddResults> {\n if (namespace && id) {\n throw new BitError(\n 'please use either [id] or [namespace] to add a particular component - they cannot be used together'\n );\n }\n\n const normalizedPaths: PathOsBased[] = paths.map((p) => path.normalize(p));\n const { addedComponents, warnings }: AddActionResults = await this.tracker.addForCLI({\n componentPaths: normalizedPaths,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n id,\n main: main ? path.normalize(main) : undefined,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n namespace,\n defaultScope: scope,\n override,\n env,\n });\n return {\n addedComponents: addedComponents.map((added) => ({\n id: added.id.toString(),\n files: added.files.map((f) => f.relativePath),\n })),\n warnings,\n };\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAF,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,C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EV,KAAK;MACnBE,QAAQ;MACRD;IACF,CAAC,CAAC;IACF,OAAO;MACL/B,eAAe,EAAEA,eAAe,CAACQ,GAAG,CAAEiC,KAAK,KAAM;QAC/CjB,EAAE,EAAEiB,KAAK,CAACjB,EAAE,CAACkB,QAAQ,CAAC,CAAC;QACvBrB,KAAK,EAAEoB,KAAK,CAACpB,KAAK,CAACb,GAAG,CAAEmC,CAAC,IAAKA,CAAC,CAACC,YAAY;MAC9C,CAAC,CAAC,CAAC;MACH3C;IACF,CAAC;EACH;AACF;AAAC4C,OAAA,CAAAnD,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","path","_interopRequireWildcard","_bitError","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","AddCmd","constructor","tracker","report","paths","addFlags","addedComponents","warnings","json","paintWarning","alreadyUsedOutput","alreadyUsedWarning","keys","alreadyUsed","map","key","chalk","yellow","bold","join","filter","x","emptyDirectoryOutput","emptyDirectory","length","green","result","files","underline","red","id","title","file","flat","main","namespace","scope","env","override","BitError","normalizedPaths","p","normalize","addForCLI","componentPaths","undefined","defaultScope","added","toString","f","relativePath","exports"],"sources":["add-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport * as path from 'path';\nimport { BitError } from '@teambit/bit-error';\nimport { PathLinux, PathOsBased } from '@teambit/legacy.utils';\nimport { AddActionResults, Warnings } from './add-components';\nimport { TrackerMain } from './tracker.main.runtime';\n\ntype AddFlags = {\n id: string | null | undefined;\n main: string | null | undefined;\n namespace: string | null | undefined;\n scope?: string;\n env?: string;\n override: boolean;\n};\n\ntype AddResults = {\n addedComponents: Array<{ id: string; files: PathLinux[] }>;\n warnings: Warnings;\n};\n\nexport class AddCmd implements Command {\n name = 'add [path...]';\n description = 'track one or more directories as new components';\n group = 'development';\n extendedDescription = 'Learn the recommended workflow for tracking directories as components, in the link below.';\n helpUrl = 'reference/workspace/component-directory';\n alias = 'a';\n options = [\n ['i', 'id <name>', 'manually set component id'],\n ['m', 'main <file>', 'define component entry point'],\n ['n', 'namespace <namespace>', 'organize component in a namespace'],\n ['o', 'override <boolean>', 'override existing component if exists (default = false)'],\n [\n 's',\n 'scope <string>',\n `sets the component's scope. if not entered, the default-scope from workspace.jsonc will be used`,\n ],\n ['e', 'env <string>', \"set the component's environment. (overrides the env from variants if exists)\"],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private tracker: TrackerMain) {}\n\n async report([paths = []]: [string[]], addFlags: AddFlags) {\n const { addedComponents, warnings }: AddResults = await this.json([paths], addFlags);\n\n const paintWarning = () => {\n const alreadyUsedOutput = () => {\n const alreadyUsedWarning = Object.keys(warnings.alreadyUsed)\n .map((key) =>\n chalk.yellow(\n `warning: files ${chalk.bold(warnings.alreadyUsed[key].join(', '))} already used by component: ${key}`\n )\n )\n .filter((x) => x)\n .join('\\n');\n return alreadyUsedWarning ? `${alreadyUsedWarning}\\n` : '';\n };\n const emptyDirectoryOutput = () => {\n if (!warnings.emptyDirectory.length) return '';\n return chalk.yellow(\n `warning: the following directories are empty or all their files were excluded\\n${chalk.bold(\n warnings.emptyDirectory.join('\\n')\n )}\\n`\n );\n };\n return alreadyUsedOutput() + emptyDirectoryOutput();\n };\n\n if (addedComponents.length > 1) {\n return paintWarning() + chalk.green(`tracking ${addedComponents.length} new components`);\n }\n\n return (\n paintWarning() +\n addedComponents\n .map((result) => {\n if (result.files.length === 0) {\n return chalk.underline.red(`could not track component ${chalk.bold(result.id)}: no files to track`);\n }\n const title = chalk.underline(`tracking component ${chalk.bold(result.id)}:\\n`);\n const files = result.files.map((file) => chalk.green(`added ${file}`));\n return title + files.join('\\n');\n })\n .flat()\n .join('\\n\\n')\n );\n }\n\n async json(\n [paths = []]: [string[]],\n { id, main, namespace, scope, env, override = false }: AddFlags\n ): Promise<AddResults> {\n if (namespace && id) {\n throw new BitError(\n 'please use either [id] or [namespace] to add a particular component - they cannot be used together'\n );\n }\n\n const normalizedPaths: PathOsBased[] = paths.map((p) => path.normalize(p));\n const { addedComponents, warnings }: AddActionResults = await this.tracker.addForCLI({\n componentPaths: normalizedPaths,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n id,\n main: main ? path.normalize(main) : undefined,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n namespace,\n defaultScope: scope,\n override,\n env,\n });\n return {\n addedComponents: addedComponents.map((added) => ({\n id: added.id.toString(),\n files: added.files.map((f) => f.relativePath),\n })),\n warnings,\n };\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAF,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAA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EA,eAAe,CAACQ,GAAG,CAAEiC,KAAK,KAAM;QAC/CjB,EAAE,EAAEiB,KAAK,CAACjB,EAAE,CAACkB,QAAQ,CAAC,CAAC;QACvBrB,KAAK,EAAEoB,KAAK,CAACpB,KAAK,CAACb,GAAG,CAAEmC,CAAC,IAAKA,CAAC,CAACC,YAAY;MAC9C,CAAC,CAAC,CAAC;MACH3C;IACF,CAAC;EACH;AACF;AAAC4C,OAAA,CAAAnD,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -3,6 +3,7 @@ import { BitMap, ComponentMap, ComponentMapFile, Config } from '@teambit/legacy.
3
3
  import { Consumer } from '@teambit/legacy.consumer';
4
4
  import { PathLinux, PathOsBased } from '@teambit/legacy.utils';
5
5
  import { Workspace } from '@teambit/workspace';
6
+ import { ResolvedTrackData } from './tracker.main.runtime';
6
7
  export type AddResult = {
7
8
  id: ComponentID;
8
9
  files: ComponentMapFile[];
@@ -62,6 +63,7 @@ export default class AddComponents {
62
63
  config?: Config;
63
64
  shouldHandleOutOfSync?: boolean;
64
65
  constructor(context: AddContext, addProps: AddProps);
66
+ add(): Promise<AddActionResults>;
65
67
  /**
66
68
  * @param {string[]} files - array of file-paths from which it should search for the dsl patterns.
67
69
  * @param {*} filesWithPotentialDsl - array of file-path which may have DSL patterns
@@ -124,7 +126,6 @@ export default class AddComponents {
124
126
  */
125
127
  addOneComponent(componentPath: PathOsBased): Promise<AddedComponent>;
126
128
  getIgnoreList(): Promise<string[]>;
127
- add(): Promise<AddActionResults>;
128
129
  linkComponents(ids: ComponentID[]): Promise<void>;
129
130
  addMultipleComponents(componentPathsStats: PathsStats): Promise<void>;
130
131
  /**
@@ -137,6 +138,6 @@ export default class AddComponents {
137
138
  _removeNamespaceIfNotNeeded(addedComponents: AddedComponent[]): Promise<void>;
138
139
  _tryAddingMultiple(componentPathsStats: PathsStats): Promise<AddedComponent[]>;
139
140
  _throwForOutsideConsumer(relativeToConsumerPath: PathOsBased): void;
140
- private throwForExistingParentDir;
141
141
  }
142
+ export declare function addMultipleFromResolvedTrackData(workspace: Workspace, trackData: ResolvedTrackData[]): Promise<ComponentID[]>;
142
143
  export {};
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.addMultipleFromResolvedTrackData = addMultipleFromResolvedTrackData;
6
7
  exports.default = void 0;
7
8
  function _arrayDifference() {
8
9
  const data = _interopRequireDefault(require("array-difference"));
@@ -218,6 +219,55 @@ class AddComponents {
218
219
  this.config = addProps.config;
219
220
  this.shouldHandleOutOfSync = addProps.shouldHandleOutOfSync;
220
221
  }
222
+ async add() {
223
+ this.ignoreList = await this.getIgnoreList();
224
+ this.gitIgnore = (0, _ignore().default)().add(this.ignoreList); // add ignore list
225
+
226
+ let componentPathsStats = {};
227
+ const resolvedComponentPathsWithoutGitIgnore = (await Promise.all(this.componentPaths.map(componentPath => (0, _legacy5().glob)(componentPath)))).flat();
228
+ const resolvedComponentPathsWithGitIgnore = this.gitIgnore.filter(resolvedComponentPathsWithoutGitIgnore);
229
+ // Run diff on both arrays to see what was filtered out because of the gitignore file
230
+ // this is not the same as "lodash.difference".
231
+ const diff = (0, _arrayDifference().default)(resolvedComponentPathsWithGitIgnore, resolvedComponentPathsWithoutGitIgnore);
232
+ if (!resolvedComponentPathsWithoutGitIgnore.length) {
233
+ throw new (_exceptions().PathsNotExist)(this.componentPaths);
234
+ }
235
+ if (resolvedComponentPathsWithGitIgnore.length) {
236
+ componentPathsStats = validatePaths(resolvedComponentPathsWithGitIgnore);
237
+ } else {
238
+ throw new (_exceptions().NoFiles)(diff);
239
+ }
240
+ Object.keys(componentPathsStats).forEach(compPath => {
241
+ if (!componentPathsStats[compPath].isDir) {
242
+ throw new (_addingIndividualFiles().AddingIndividualFiles)(compPath);
243
+ }
244
+ });
245
+ if (Object.keys(componentPathsStats).length > 1 && this.id) {
246
+ throw new (_bitError().BitError)(`the --id flag (${this.id}) is used for a single component only, however, got ${this.componentPaths.length} paths`);
247
+ }
248
+ // if a user entered multiple paths and entered an id, he wants all these paths to be one component
249
+ // conversely, if a user entered multiple paths without id, he wants each dir as an individual component
250
+ const isMultipleComponents = Object.keys(componentPathsStats).length > 1;
251
+ if (isMultipleComponents) {
252
+ await this.addMultipleComponents(componentPathsStats);
253
+ } else {
254
+ _legacy4().logger.debugAndAddBreadCrumb('add-components', 'adding one component');
255
+ // when a user enters more than one directory, he would like to keep the directories names
256
+ // so then when a component is imported, it will write the files into the original directories
257
+ const addedOne = await this.addOneComponent(Object.keys(componentPathsStats)[0]);
258
+ await this._removeNamespaceIfNotNeeded([addedOne]);
259
+ if (addedOne.files.length) {
260
+ const addedResult = await this.addOrUpdateComponentInBitMap(addedOne);
261
+ if (addedResult) this.addedComponents.push(addedResult);
262
+ }
263
+ }
264
+ await this.linkComponents(this.addedComponents.map(item => item.id));
265
+ _legacy().Analytics.setExtraData('num_components', this.addedComponents.length);
266
+ return {
267
+ addedComponents: this.addedComponents,
268
+ warnings: this.warnings
269
+ };
270
+ }
221
271
 
222
272
  /**
223
273
  * @param {string[]} files - array of file-paths from which it should search for the dsl patterns.
@@ -494,7 +544,6 @@ you can add the directory these files are located at and it'll change the root d
494
544
  }
495
545
  files.push({
496
546
  relativePath: (0, _legacy5().pathNormalizeToLinux)(generatedFile),
497
- test: false,
498
547
  name: path().basename(generatedFile)
499
548
  });
500
549
  mainFile = generatedFile;
@@ -516,7 +565,6 @@ you can add the directory these files are located at and it'll change the root d
516
565
  }
517
566
  files.push({
518
567
  relativePath: (0, _legacy5().pathNormalizeToLinux)(mainFileRelativeToConsumer),
519
- test: false,
520
568
  name: path().basename(mainFileRelativeToConsumer)
521
569
  });
522
570
  return mainFileRelativeToConsumer;
@@ -545,7 +593,7 @@ you can add the directory these files are located at and it'll change the root d
545
593
  }
546
594
  const relativeComponentPath = this.consumer.getPathRelativeToConsumer(componentPath);
547
595
  this._throwForOutsideConsumer(relativeComponentPath);
548
- this.throwForExistingParentDir(relativeComponentPath);
596
+ throwForExistingParentDir(this.bitMap, relativeComponentPath);
549
597
  const matches = await (0, _legacy5().glob)(path().join(relativeComponentPath, '**'), {
550
598
  cwd: this.consumer.getPath(),
551
599
  nodir: true
@@ -602,56 +650,6 @@ you can add the directory these files are located at and it'll change the root d
602
650
  const consumerPath = this.consumer.getPath();
603
651
  return (0, _legacy3().getIgnoreListHarmony)(consumerPath);
604
652
  }
605
- async add() {
606
- this.ignoreList = await this.getIgnoreList();
607
- this.gitIgnore = (0, _ignore().default)().add(this.ignoreList); // add ignore list
608
-
609
- let componentPathsStats = {};
610
- const resolvedComponentPathsWithoutGitIgnore = (await Promise.all(this.componentPaths.map(componentPath => (0, _legacy5().glob)(componentPath)))).flat();
611
- this.gitIgnore = (0, _ignore().default)().add(this.ignoreList); // add ignore list
612
-
613
- const resolvedComponentPathsWithGitIgnore = this.gitIgnore.filter(resolvedComponentPathsWithoutGitIgnore);
614
- // Run diff on both arrays to see what was filtered out because of the gitignore file
615
- const diff = (0, _arrayDifference().default)(resolvedComponentPathsWithGitIgnore, resolvedComponentPathsWithoutGitIgnore);
616
- if (!resolvedComponentPathsWithoutGitIgnore.length) {
617
- throw new (_exceptions().PathsNotExist)(this.componentPaths);
618
- }
619
- if (resolvedComponentPathsWithGitIgnore.length) {
620
- componentPathsStats = validatePaths(resolvedComponentPathsWithGitIgnore);
621
- } else {
622
- throw new (_exceptions().NoFiles)(diff);
623
- }
624
- Object.keys(componentPathsStats).forEach(compPath => {
625
- if (!componentPathsStats[compPath].isDir) {
626
- throw new (_addingIndividualFiles().AddingIndividualFiles)(compPath);
627
- }
628
- });
629
- if (Object.keys(componentPathsStats).length > 1 && this.id) {
630
- throw new (_bitError().BitError)(`the --id flag (${this.id}) is used for a single component only, however, got ${this.componentPaths.length} paths`);
631
- }
632
- // if a user entered multiple paths and entered an id, he wants all these paths to be one component
633
- // conversely, if a user entered multiple paths without id, he wants each dir as an individual component
634
- const isMultipleComponents = Object.keys(componentPathsStats).length > 1;
635
- if (isMultipleComponents) {
636
- await this.addMultipleComponents(componentPathsStats);
637
- } else {
638
- _legacy4().logger.debugAndAddBreadCrumb('add-components', 'adding one component');
639
- // when a user enters more than one directory, he would like to keep the directories names
640
- // so then when a component is imported, it will write the files into the original directories
641
- const addedOne = await this.addOneComponent(Object.keys(componentPathsStats)[0]);
642
- await this._removeNamespaceIfNotNeeded([addedOne]);
643
- if (addedOne.files.length) {
644
- const addedResult = await this.addOrUpdateComponentInBitMap(addedOne);
645
- if (addedResult) this.addedComponents.push(addedResult);
646
- }
647
- }
648
- await this.linkComponents(this.addedComponents.map(item => item.id));
649
- _legacy().Analytics.setExtraData('num_components', this.addedComponents.length);
650
- return {
651
- addedComponents: this.addedComponents,
652
- warnings: this.warnings
653
- };
654
- }
655
653
  async linkComponents(ids) {
656
654
  if (this.trackDirFeature) {
657
655
  // if trackDirFeature is set, it happens during the component-load and because we load the
@@ -738,18 +736,19 @@ you can add the directory these files are located at and it'll change the root d
738
736
  throw new (_pathOutsideConsumer().default)(relativeToConsumerPath);
739
737
  }
740
738
  }
741
- throwForExistingParentDir(relativeToConsumerPath) {
742
- const isParentDir = parent => {
743
- const relative = path().relative(parent, relativeToConsumerPath);
744
- return relative && !relative.startsWith('..') && !path().isAbsolute(relative);
745
- };
746
- this.bitMap.components.forEach(componentMap => {
747
- if (!componentMap.rootDir) return;
748
- if (isParentDir(componentMap.rootDir)) {
749
- throw new (_parentDirTracked().ParentDirTracked)(componentMap.rootDir, componentMap.id.toStringWithoutVersion(), relativeToConsumerPath);
750
- }
751
- });
752
- }
739
+ }
740
+ exports.default = AddComponents;
741
+ function throwForExistingParentDir(bitMap, relativeToConsumerPath) {
742
+ const isParentDir = parent => {
743
+ const relative = path().relative(parent, relativeToConsumerPath);
744
+ return relative && !relative.startsWith('..') && !path().isAbsolute(relative);
745
+ };
746
+ bitMap.components.forEach(componentMap => {
747
+ if (!componentMap.rootDir) return;
748
+ if (isParentDir(componentMap.rootDir)) {
749
+ throw new (_parentDirTracked().ParentDirTracked)(componentMap.rootDir, componentMap.id.toStringWithoutVersion(), relativeToConsumerPath);
750
+ }
751
+ });
753
752
  }
754
753
 
755
754
  /**
@@ -758,7 +757,6 @@ you can add the directory these files are located at and it'll change the root d
758
757
  * @param {string[]} fileArray - array of paths
759
758
  * @returns {PathsStats} componentPathsStats
760
759
  */
761
- exports.default = AddComponents;
762
760
  function validatePaths(fileArray) {
763
761
  const componentPathsStats = {};
764
762
  fileArray.forEach(componentPath => {
@@ -808,5 +806,46 @@ async function isAutoGeneratedFile(filePath) {
808
806
  const line = await (0, _firstline().default)(filePath);
809
807
  return line.includes(_legacy2().AUTO_GENERATED_STAMP);
810
808
  }
809
+ async function addMultipleFromResolvedTrackData(workspace, trackData) {
810
+ const bitMap = workspace.consumer.bitMap;
811
+ const ignoreList = await (0, _legacy3().getIgnoreListHarmony)(workspace.path);
812
+ const gitIgnore = (0, _ignore().default)().add(ignoreList);
813
+ const componentMaps = trackData.map(data => {
814
+ const {
815
+ rootDir,
816
+ files,
817
+ componentName,
818
+ defaultScope,
819
+ mainFile,
820
+ config
821
+ } = data;
822
+ if (path().isAbsolute(rootDir)) throw new (_bitError().BitError)(`path is absolute, got ${rootDir}`);
823
+ throwForExistingParentDir(bitMap, rootDir);
824
+ const filtered = gitIgnore.filter(files);
825
+ if (!filtered.length) {
826
+ throw new (_exceptions().NoFiles)(files);
827
+ }
828
+ const componentFiles = filtered.map(match => {
829
+ return {
830
+ relativePath: (0, _legacy5().pathNormalizeToLinux)(match),
831
+ name: path().basename(match)
832
+ };
833
+ });
834
+ const componentMap = bitMap.addComponent({
835
+ componentId: _componentId().ComponentID.fromObject({
836
+ name: componentName
837
+ }, defaultScope),
838
+ files: componentFiles,
839
+ defaultScope,
840
+ config,
841
+ mainFile,
842
+ rootDir
843
+ });
844
+ return componentMap;
845
+ });
846
+ const allIds = componentMaps.map(c => c.id);
847
+ await (0, _workspaceModules().linkToNodeModulesByIds)(workspace, allIds);
848
+ return allIds;
849
+ }
811
850
 
812
851
  //# sourceMappingURL=add-components.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_arrayDifference","data","_interopRequireDefault","require","_firstline","_fsExtra","_ignore","path","_interopRequireWildcard","_lodash","_stringFormat","_legacy","_componentId","_legacyBitId","_legacy2","_legacy3","_exceptions","_addingIndividualFiles","_missingMainFileMultipleComponents","_parentDirTracked","_pathOutsideConsumer","_versionShouldBeRemoved","_bitError","_legacy4","_legacy5","_workspaceModules","_determineMainFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","REGEX_DSL_PATTERN","AddComponents","constructor","context","addProps","workspace","consumer","bitMap","componentPaths","id","main","namespace","override","trackDirFeature","warnings","alreadyUsed","emptyDirectory","existInScope","addedComponents","defaultScope","config","shouldHandleOutOfSync","getFilesAccordingToDsl","files","filesWithPotentialDsl","filesListAllMatches","map","dsl","filesListMatch","file","fileInfo","calculateFileInfo","generatedFile","format","matches","glob","matchesAfterGitIgnore","gitIgnore","filter","match","fs","existsSync","Promise","all","filesListFlatten","flat","filesListUnique","uniq","fileNormalized","pathNormalizeToLinux","fileWithCorrectCase","find","f","toLowerCase","relativeToConsumer","getPathRelativeToConsumer","_isPackageJsonOnRootDir","pathRelativeToConsumerRoot","componentMap","rootDir","Error","join","PACKAGE_JSON","normalize","_isOutsideOfWrapDir","wrapDir","wrapDirRelativeToConsumerRoot","startsWith","addOrUpdateComponentInBitMap","component","consumerPath","getPath","parsedBitId","componentId","componentFromScope","scope","getModelComponentIfExist","foundComponentFromBitMap","getComponentIfExist","ignoreVersion","componentFilesP","filePath","relativePath","isAutoGenerated","isAutoGeneratedFile","caseSensitive","existingIdOfFile","getComponentIdByPath","idOfFileIsDifferent","isEqual","push","newId","toComponentIdWithLatestVersion","componentFiles","length","_updateFilesAccordingToExistingRootDir","_areFilesArraysEqual","_updateFilesWithCurrentLetterCases","_mergeFilesWithExistingComponentMapFiles","trackDir","mainFile","determineMainFile","getRootDir","fileNotInsideTrackDir","AddingIndividualFiles","getComponentMap","addFilesToComponent","getDefaultScope","hasScope","undefined","fullName","addComponent","ComponentID","changeRootDirAndUpdateFilesAccordingly","existingRootDir","areFilesInsideExistingRootDir","every","ComponentMap","changeFilesPathAccordingToItsRootDir","currentlyAddedDir","currentlyAddedDirParentOfRootDir","BitError","existingComponentMapFile","unionBy","currentComponentMap","newFiles","currentFiles","forEach","currentFile","sameFile","newFile","_getIdAccordingToExistingComponent","currentId","idWithScope","existingComponentId","getExistingBitId","includes","VERSION_DELIMITER","hasVersion","version","getVersionFromString","VersionShouldBeRemoved","_getIdAccordingToTrackDir","dir","dirNormalizedToLinux","trackDirs","getAllTrackDirs","_addMainFileToFiles","foundFile","_findMainFileInFiles","shouldIgnore","ignores","ExcludedMainFile","test","name","basename","mainFileRelativeToConsumer","mainPath","toAbsolutePath","isDir","MainFileIsDir","normalizedMainFile","componentName","componentDefaultScopeFromComponentDirAndName","addOneComponent","componentPath","finalBitId","idFromPath","relativeComponentPath","_throwForOutsideConsumer","throwForExistingParentDir","cwd","nodir","EmptyDirectory","filteredMatches","NoFiles","filteredMatchedFiles","resolvedMainFile","absoluteComponentPath","resolve","splitPath","split","sep","lastDir","idOfTrackDir","bitId","BitId","parse","nameSpaceOrDir","getValidIdChunk","getValidBitId","addedComp","immediateDir","getIgnoreList","getIgnoreListHarmony","add","ignoreList","ignore","componentPathsStats","resolvedComponentPathsWithoutGitIgnore","resolvedComponentPathsWithGitIgnore","diff","arrayDiff","PathsNotExist","validatePaths","keys","compPath","isMultipleComponents","addMultipleComponents","logger","debugAndAddBreadCrumb","addedOne","_removeNamespaceIfNotNeeded","addedResult","linkComponents","item","Analytics","setExtraData","ids","linkToNodeModulesByIds","_removeDirectoriesWhenTheirFilesAreAdded","added","_tryAddingMultiple","validateNoDuplicateIds","_addMultipleToBitMap","allPaths","foundDir","p","dirname","debug","missingMainFiles","addedComponent","err","MissingMainFile","MissingMainFileMultipleComponents","sort","allIds","getAllBitIdsFromAllLanes","componentsWithSameName","bitIdFromNameOnly","componentIdFromNameOnly","existingComponentWithSameName","searchWithoutScopeAndVersion","addedP","onePath","compact","relativeToConsumerPath","PathOutsideConsumer","isParentDir","parent","relative","isAbsolute","components","ParentDirTracked","toStringWithoutVersion","exports","fileArray","addComponents","duplicateIds","newGroupedComponents","groupBy","key","isEmpty","DuplicateIds","fullPath","parentDir","PARENT","FILE_NAME","line","firstline","AUTO_GENERATED_STAMP"],"sources":["add-components.ts"],"sourcesContent":["import arrayDiff from 'array-difference';\nimport firstline from 'firstline';\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport * as path from 'path';\nimport { compact, groupBy, isEmpty, unionBy, uniq } from 'lodash';\nimport format from 'string-format';\nimport { Analytics } from '@teambit/legacy.analytics';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitIdStr, BitId } from '@teambit/legacy-bit-id';\nimport { PACKAGE_JSON, VERSION_DELIMITER, AUTO_GENERATED_STAMP } from '@teambit/legacy.constants';\nimport {\n BitMap,\n ComponentMap,\n ComponentMapFile,\n Config,\n getIgnoreListHarmony,\n MissingMainFile,\n} from '@teambit/legacy.bit-map';\nimport { DuplicateIds, EmptyDirectory, ExcludedMainFile, MainFileIsDir, NoFiles, PathsNotExist } from './exceptions';\nimport { AddingIndividualFiles } from './exceptions/adding-individual-files';\nimport MissingMainFileMultipleComponents from './exceptions/missing-main-file-multiple-components';\nimport { ParentDirTracked } from './exceptions/parent-dir-tracked';\nimport PathOutsideConsumer from './exceptions/path-outside-consumer';\nimport VersionShouldBeRemoved from './exceptions/version-should-be-removed';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { BitError } from '@teambit/bit-error';\nimport { logger } from '@teambit/legacy.logger';\nimport { glob, isDir, pathNormalizeToLinux, PathLinux, PathLinuxRelative, PathOsBased } from '@teambit/legacy.utils';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport { Workspace } from '@teambit/workspace';\nimport determineMainFile from './determine-main-file';\n\nexport type AddResult = { id: ComponentID; files: ComponentMapFile[] };\nexport type Warnings = {\n alreadyUsed: Record<string, any>;\n emptyDirectory: string[];\n existInScope: ComponentID[];\n};\nexport type AddActionResults = { addedComponents: AddResult[]; warnings: Warnings };\nexport type PathOrDSL = PathOsBased | string; // can be a path or a DSL, e.g: tests/{PARENT}/{FILE_NAME}\n// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\ntype PathsStats = { [PathOsBased]: { isDir: boolean } };\nexport type AddedComponent = {\n componentId: ComponentID;\n files: ComponentMapFile[];\n mainFile?: PathOsBased | null | undefined;\n trackDir: PathOsBased;\n idFromPath:\n | {\n name: string;\n namespace: string;\n }\n | null\n | undefined;\n immediateDir?: string;\n};\nconst REGEX_DSL_PATTERN = /{([^}]+)}/g;\n\nexport type AddProps = {\n componentPaths: PathOsBased[];\n id?: string;\n main?: PathOsBased;\n namespace?: string;\n override: boolean;\n trackDirFeature?: boolean;\n defaultScope?: string;\n config?: Config;\n shouldHandleOutOfSync?: boolean;\n env?: string;\n};\n\nexport type AddContext = {\n workspace: Workspace;\n};\n\nexport default class AddComponents {\n workspace: Workspace;\n consumer: Consumer;\n bitMap: BitMap;\n componentPaths: PathOsBased[];\n id: string | null | undefined; // id entered by the user\n main: PathOsBased | null | undefined;\n namespace: string | null | undefined;\n override: boolean; // (default = false) replace the files array or only add files.\n trackDirFeature: boolean | null | undefined;\n warnings: Warnings;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n ignoreList: string[];\n gitIgnore: any;\n addedComponents: AddResult[];\n defaultScope?: string; // helpful for out-of-sync\n config?: Config;\n shouldHandleOutOfSync?: boolean; // only bit-add (not bit-create/new) should handle out-of-sync scenario\n constructor(context: AddContext, addProps: AddProps) {\n this.workspace = context.workspace;\n this.consumer = context.workspace.consumer;\n this.bitMap = this.consumer.bitMap;\n this.componentPaths = addProps.componentPaths;\n this.id = addProps.id;\n this.main = addProps.main;\n this.namespace = addProps.namespace;\n this.override = addProps.override;\n this.trackDirFeature = addProps.trackDirFeature;\n this.warnings = {\n alreadyUsed: {},\n emptyDirectory: [],\n existInScope: [],\n };\n this.addedComponents = [];\n this.defaultScope = addProps.defaultScope;\n this.config = addProps.config;\n this.shouldHandleOutOfSync = addProps.shouldHandleOutOfSync;\n }\n\n /**\n * @param {string[]} files - array of file-paths from which it should search for the dsl patterns.\n * @param {*} filesWithPotentialDsl - array of file-path which may have DSL patterns\n *\n * @returns array of file-paths from 'files' parameter that match the patterns from 'filesWithPotentialDsl' parameter\n */\n async getFilesAccordingToDsl(files: PathLinux[], filesWithPotentialDsl: PathOrDSL[]): Promise<PathLinux[]> {\n const filesListAllMatches = filesWithPotentialDsl.map(async (dsl) => {\n const filesListMatch = files.map(async (file) => {\n const fileInfo = calculateFileInfo(file);\n const generatedFile = format(dsl, fileInfo);\n const matches = await glob(generatedFile);\n const matchesAfterGitIgnore = this.gitIgnore.filter(matches);\n return matchesAfterGitIgnore.filter((match) => fs.existsSync(match));\n });\n return Promise.all(filesListMatch);\n });\n\n const filesListFlatten = (await Promise.all(filesListAllMatches)).flat();\n const filesListUnique = uniq(filesListFlatten);\n return filesListUnique.map((file) => {\n // when files array has the test file with different letter case, use the one from the file array\n const fileNormalized = pathNormalizeToLinux(file);\n const fileWithCorrectCase = files.find((f) => f.toLowerCase() === fileNormalized.toLowerCase()) || fileNormalized;\n const relativeToConsumer = this.consumer.getPathRelativeToConsumer(fileWithCorrectCase);\n return pathNormalizeToLinux(relativeToConsumer);\n });\n }\n\n /**\n * for imported component, the package.json in the root directory is a bit-generated file and as\n * such, it should be ignored\n */\n _isPackageJsonOnRootDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap) {\n if (!componentMap.rootDir) {\n throw new Error('_isPackageJsonOnRootDir should not get called on non imported components');\n }\n return path.join(componentMap.rootDir, PACKAGE_JSON) === path.normalize(pathRelativeToConsumerRoot);\n }\n\n /**\n * imported components might have wrapDir, when they do, files should not be added outside of\n * that wrapDir\n */\n _isOutsideOfWrapDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap) {\n if (!componentMap.rootDir) {\n throw new Error('_isOutsideOfWrapDir should not get called on non imported components');\n }\n if (!componentMap.wrapDir) return false;\n const wrapDirRelativeToConsumerRoot = path.join(componentMap.rootDir, componentMap.wrapDir);\n return !path.normalize(pathRelativeToConsumerRoot).startsWith(wrapDirRelativeToConsumerRoot);\n }\n\n /**\n * Add or update existing (imported and new) component according to bitmap\n * there are 3 options:\n * 1. a user is adding a new component. there is no record for this component in bit.map\n * 2. a user is updating an existing component. there is a record for this component in bit.map\n * 3. some or all the files of this component were previously added as another component-id.\n */\n async addOrUpdateComponentInBitMap(component: AddedComponent): Promise<AddResult | null | undefined> {\n const consumerPath = this.consumer.getPath();\n const parsedBitId = component.componentId;\n const componentFromScope = await this.consumer.scope.getModelComponentIfExist(parsedBitId);\n const files: ComponentMapFile[] = component.files;\n const foundComponentFromBitMap = this.bitMap.getComponentIfExist(component.componentId, {\n ignoreVersion: true,\n });\n const componentFilesP = files.map(async (file: ComponentMapFile) => {\n // $FlowFixMe null is removed later on\n const filePath = path.join(consumerPath, file.relativePath);\n const isAutoGenerated = await isAutoGeneratedFile(filePath);\n if (isAutoGenerated) {\n return null;\n }\n const caseSensitive = false;\n const existingIdOfFile = this.bitMap.getComponentIdByPath(file.relativePath, caseSensitive);\n const idOfFileIsDifferent = existingIdOfFile && !existingIdOfFile.isEqual(parsedBitId);\n if (idOfFileIsDifferent) {\n // not imported component file but exists in bitmap\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.warnings.alreadyUsed[existingIdOfFile]) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.warnings.alreadyUsed[existingIdOfFile].push(file.relativePath);\n } else {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.warnings.alreadyUsed[existingIdOfFile] = [file.relativePath];\n }\n return null;\n }\n if (!foundComponentFromBitMap && componentFromScope && this.shouldHandleOutOfSync) {\n const newId = componentFromScope.toComponentIdWithLatestVersion();\n if (!this.defaultScope || this.defaultScope === newId.scope) {\n // otherwise, if defaultScope !== newId.scope, they're different components,\n // and no need to change the id.\n // for more details about this scenario, see https://github.com/teambit/bit/issues/1543, last case.\n component.componentId = newId;\n this.warnings.existInScope.push(newId);\n }\n }\n return file;\n });\n // @ts-ignore it can't be null due to the filter function\n const componentFiles: ComponentMapFile[] = (await Promise.all(componentFilesP)).filter((file) => file);\n if (!componentFiles.length) return { id: component.componentId, files: [] };\n if (foundComponentFromBitMap) {\n this._updateFilesAccordingToExistingRootDir(foundComponentFromBitMap, componentFiles, component);\n }\n if (this.trackDirFeature) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.bitMap._areFilesArraysEqual(foundComponentFromBitMap.files, componentFiles)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return foundComponentFromBitMap;\n }\n }\n if (!this.override && foundComponentFromBitMap) {\n this._updateFilesWithCurrentLetterCases(foundComponentFromBitMap, componentFiles);\n component.files = this._mergeFilesWithExistingComponentMapFiles(componentFiles, foundComponentFromBitMap.files);\n } else {\n component.files = componentFiles;\n }\n\n const { componentId, trackDir } = component;\n const mainFile = determineMainFile(component, foundComponentFromBitMap);\n const getRootDir = (): PathLinuxRelative => {\n if (this.trackDirFeature) throw new Error('track dir should not calculate the rootDir');\n if (foundComponentFromBitMap) return foundComponentFromBitMap.rootDir;\n if (!trackDir) throw new Error(`addOrUpdateComponentInBitMap expect to have trackDir for non-legacy workspace`);\n const fileNotInsideTrackDir = componentFiles.find(\n (file) => !pathNormalizeToLinux(file.relativePath).startsWith(`${pathNormalizeToLinux(trackDir)}/`)\n );\n if (fileNotInsideTrackDir) {\n // we check for this error before. however, it's possible that a user have one trackDir\n // and another dir for the tests.\n throw new AddingIndividualFiles(fileNotInsideTrackDir.relativePath);\n }\n return pathNormalizeToLinux(trackDir);\n };\n const getComponentMap = async (): Promise<ComponentMap> => {\n if (this.trackDirFeature) {\n return this.bitMap.addFilesToComponent({ componentId, files: component.files });\n }\n const rootDir = getRootDir();\n const getDefaultScope = async () => {\n if (componentId.hasScope()) return undefined;\n return this.getDefaultScope(rootDir, componentId.fullName);\n };\n const defaultScope = await getDefaultScope();\n const componentMap = this.bitMap.addComponent({\n componentId: new ComponentID(componentId._legacy, defaultScope),\n files: component.files,\n defaultScope,\n config: this.config,\n mainFile,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n override: this.override,\n });\n componentMap.changeRootDirAndUpdateFilesAccordingly(rootDir);\n return componentMap;\n };\n const componentMap = await getComponentMap();\n return { id: componentId, files: componentMap.files };\n }\n\n /**\n * current componentFiles are relative to the workspace. we want them relative to the rootDir.\n */\n _updateFilesAccordingToExistingRootDir(\n foundComponentFromBitMap: ComponentMap,\n componentFiles: ComponentMapFile[],\n component: AddedComponent\n ) {\n const existingRootDir = foundComponentFromBitMap.rootDir;\n if (!existingRootDir) return; // nothing to do.\n const areFilesInsideExistingRootDir = componentFiles.every((file) =>\n pathNormalizeToLinux(file.relativePath).startsWith(`${existingRootDir}/`)\n );\n if (areFilesInsideExistingRootDir) {\n ComponentMap.changeFilesPathAccordingToItsRootDir(existingRootDir, componentFiles);\n return;\n }\n // some (or all) added files are outside the existing rootDir, the rootDir needs to be changed\n // if a directory was added and it's a parent of the existing rootDir, change the rootDir to\n // the currently added rootDir.\n const currentlyAddedDir = pathNormalizeToLinux(component.trackDir);\n const currentlyAddedDirParentOfRootDir = currentlyAddedDir && existingRootDir.startsWith(`${currentlyAddedDir}/`);\n if (currentlyAddedDirParentOfRootDir) {\n foundComponentFromBitMap.changeRootDirAndUpdateFilesAccordingly(currentlyAddedDir);\n ComponentMap.changeFilesPathAccordingToItsRootDir(currentlyAddedDir, componentFiles);\n return;\n }\n throw new BitError(`unable to add individual files outside the root dir (${existingRootDir}) of ${component.componentId}.\nyou can add the directory these files are located at and it'll change the root dir of the component accordingly`);\n // we might want to change the behavior here to not throw an error and only change the rootDir to \".\"\n // foundComponentFromBitMap.changeRootDirAndUpdateFilesAccordingly('.');\n }\n\n /**\n * the risk with merging the currently added files with the existing bitMap files is overriding\n * the `test` property. e.g. the component directory is re-added without adding the tests flag to\n * track new files in that directory. in this case, we want to preserve the `test` property.\n */\n _mergeFilesWithExistingComponentMapFiles(\n componentFiles: ComponentMapFile[],\n existingComponentMapFile: ComponentMapFile[]\n ) {\n return unionBy(existingComponentMapFile, componentFiles, 'relativePath');\n }\n\n /**\n * if an existing file is for example uppercase and the new file is lowercase it has different\n * behavior according to the OS. some OS are case sensitive, some are not.\n * it's safer to avoid saving both files and instead, replacing the old file with the new one.\n * in case a file has replaced and it is also a mainFile, replace the mainFile as well\n */\n _updateFilesWithCurrentLetterCases(currentComponentMap: ComponentMap, newFiles: ComponentMapFile[]) {\n const currentFiles = currentComponentMap.files;\n currentFiles.forEach((currentFile) => {\n const sameFile = newFiles.find(\n (newFile) => newFile.relativePath.toLowerCase() === currentFile.relativePath.toLowerCase()\n );\n if (sameFile && currentFile.relativePath !== sameFile.relativePath) {\n if (currentComponentMap.mainFile === currentFile.relativePath) {\n currentComponentMap.mainFile = sameFile.relativePath;\n }\n currentFile.relativePath = sameFile.relativePath;\n }\n });\n }\n\n /**\n * if the id is already saved in bitmap file, it might have more data (such as scope, version)\n * use that id instead.\n */\n private _getIdAccordingToExistingComponent(currentId: BitIdStr): ComponentID | undefined {\n const idWithScope = this.defaultScope ? `${this.defaultScope}/${currentId}` : currentId;\n const existingComponentId = this.bitMap.getExistingBitId(idWithScope, false);\n if (currentId.includes(VERSION_DELIMITER)) {\n if (\n !existingComponentId || // this id is new, it shouldn't have a version\n !existingComponentId.hasVersion() || // this component is new, it shouldn't have a version\n // user shouldn't add files to a an existing component with different version\n existingComponentId.version !== ComponentID.getVersionFromString(currentId)\n ) {\n throw new VersionShouldBeRemoved(currentId);\n }\n }\n return existingComponentId;\n }\n\n _getIdAccordingToTrackDir(dir: PathOsBased): ComponentID | null | undefined {\n const dirNormalizedToLinux = pathNormalizeToLinux(dir);\n const trackDirs = this.bitMap.getAllTrackDirs();\n if (!trackDirs) return null;\n return trackDirs[dirNormalizedToLinux];\n }\n\n /**\n * used for updating main file if exists or doesn't exists\n */\n _addMainFileToFiles(files: ComponentMapFile[]): PathOsBased | null | undefined {\n let mainFile = this.main;\n if (mainFile && mainFile.match(REGEX_DSL_PATTERN)) {\n // it's a DSL\n files.forEach((file) => {\n const fileInfo = calculateFileInfo(file.relativePath);\n const generatedFile = format(mainFile, fileInfo);\n const foundFile = this._findMainFileInFiles(generatedFile, files);\n if (foundFile) {\n mainFile = foundFile.relativePath;\n }\n if (fs.existsSync(generatedFile) && !foundFile) {\n const shouldIgnore = this.gitIgnore.ignores(generatedFile);\n if (shouldIgnore) {\n // check if file is in exclude list\n throw new ExcludedMainFile(generatedFile);\n }\n files.push({\n relativePath: pathNormalizeToLinux(generatedFile),\n test: false,\n name: path.basename(generatedFile),\n });\n mainFile = generatedFile;\n }\n });\n }\n if (!mainFile) return undefined;\n const mainFileRelativeToConsumer = this.consumer.getPathRelativeToConsumer(mainFile);\n const mainPath = this.consumer.toAbsolutePath(mainFileRelativeToConsumer);\n if (fs.existsSync(mainPath)) {\n const shouldIgnore = this.gitIgnore.ignores(mainFileRelativeToConsumer);\n if (shouldIgnore) throw new ExcludedMainFile(mainFileRelativeToConsumer);\n if (isDir(mainPath)) {\n throw new MainFileIsDir(mainPath);\n }\n const foundFile = this._findMainFileInFiles(mainFileRelativeToConsumer, files);\n if (foundFile) {\n return foundFile.relativePath;\n }\n files.push({\n relativePath: pathNormalizeToLinux(mainFileRelativeToConsumer),\n test: false,\n name: path.basename(mainFileRelativeToConsumer),\n });\n return mainFileRelativeToConsumer;\n }\n return mainFile;\n }\n\n _findMainFileInFiles(mainFile: string, files: ComponentMapFile[]) {\n const normalizedMainFile = pathNormalizeToLinux(mainFile).toLowerCase();\n return files.find((file) => file.relativePath.toLowerCase() === normalizedMainFile);\n }\n\n private async getDefaultScope(rootDir: string, componentName: string): Promise<string> {\n return (this.defaultScope ||\n (await this.workspace.componentDefaultScopeFromComponentDirAndName(rootDir, componentName))) as string;\n }\n\n /**\n * given the component paths, prepare the id, mainFile and files to be added later on to bitmap\n * the id of the component is either entered by the user or, if not entered, concluded by the path.\n * e.g. bar/foo.js, the id would be bar/foo.\n * in case bitmap has already the same id, the complete id is taken from bitmap (see _getIdAccordingToExistingComponent)\n */\n async addOneComponent(componentPath: PathOsBased): Promise<AddedComponent> {\n let finalBitId: ComponentID | undefined; // final id to use for bitmap file\n let idFromPath;\n if (this.id) {\n finalBitId = this._getIdAccordingToExistingComponent(this.id);\n }\n const relativeComponentPath = this.consumer.getPathRelativeToConsumer(componentPath);\n this._throwForOutsideConsumer(relativeComponentPath);\n this.throwForExistingParentDir(relativeComponentPath);\n const matches = await glob(path.join(relativeComponentPath, '**'), {\n cwd: this.consumer.getPath(),\n nodir: true,\n });\n\n if (!matches.length) throw new EmptyDirectory(componentPath);\n\n const filteredMatches = this.gitIgnore.filter(matches);\n\n if (!filteredMatches.length) {\n throw new NoFiles(matches);\n }\n\n const filteredMatchedFiles = filteredMatches.map((match: PathOsBased) => {\n return { relativePath: pathNormalizeToLinux(match), test: false, name: path.basename(match) };\n });\n const resolvedMainFile = this._addMainFileToFiles(filteredMatchedFiles);\n\n const absoluteComponentPath = path.resolve(componentPath);\n const splitPath = absoluteComponentPath.split(path.sep);\n const lastDir = splitPath[splitPath.length - 1];\n const idOfTrackDir = this._getIdAccordingToTrackDir(componentPath);\n if (!finalBitId) {\n if (this.id) {\n const bitId = BitId.parse(this.id, false);\n const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);\n finalBitId = new ComponentID(bitId, defaultScope);\n } else if (idOfTrackDir) {\n finalBitId = idOfTrackDir;\n } else {\n const nameSpaceOrDir = this.namespace || splitPath[splitPath.length - 2];\n if (!this.namespace) {\n idFromPath = { namespace: BitId.getValidIdChunk(nameSpaceOrDir), name: BitId.getValidIdChunk(lastDir) };\n }\n const bitId = BitId.getValidBitId(nameSpaceOrDir, lastDir);\n const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);\n finalBitId = new ComponentID(bitId, defaultScope);\n }\n }\n const trackDir = relativeComponentPath;\n const addedComp = {\n componentId: finalBitId,\n files: filteredMatchedFiles,\n mainFile: resolvedMainFile,\n trackDir,\n idFromPath,\n immediateDir: lastDir,\n };\n\n return addedComp;\n }\n\n async getIgnoreList(): Promise<string[]> {\n const consumerPath = this.consumer.getPath();\n return getIgnoreListHarmony(consumerPath);\n }\n\n async add(): Promise<AddActionResults> {\n this.ignoreList = await this.getIgnoreList();\n this.gitIgnore = ignore().add(this.ignoreList); // add ignore list\n\n let componentPathsStats: PathsStats = {};\n\n const resolvedComponentPathsWithoutGitIgnore = (\n await Promise.all(this.componentPaths.map((componentPath) => glob(componentPath)))\n ).flat();\n this.gitIgnore = ignore().add(this.ignoreList); // add ignore list\n\n const resolvedComponentPathsWithGitIgnore = this.gitIgnore.filter(resolvedComponentPathsWithoutGitIgnore);\n // Run diff on both arrays to see what was filtered out because of the gitignore file\n const diff = arrayDiff(resolvedComponentPathsWithGitIgnore, resolvedComponentPathsWithoutGitIgnore);\n\n if (!resolvedComponentPathsWithoutGitIgnore.length) {\n throw new PathsNotExist(this.componentPaths);\n }\n if (resolvedComponentPathsWithGitIgnore.length) {\n componentPathsStats = validatePaths(resolvedComponentPathsWithGitIgnore);\n } else {\n throw new NoFiles(diff);\n }\n Object.keys(componentPathsStats).forEach((compPath) => {\n if (!componentPathsStats[compPath].isDir) {\n throw new AddingIndividualFiles(compPath);\n }\n });\n if (Object.keys(componentPathsStats).length > 1 && this.id) {\n throw new BitError(\n `the --id flag (${this.id}) is used for a single component only, however, got ${this.componentPaths.length} paths`\n );\n }\n // if a user entered multiple paths and entered an id, he wants all these paths to be one component\n // conversely, if a user entered multiple paths without id, he wants each dir as an individual component\n const isMultipleComponents = Object.keys(componentPathsStats).length > 1;\n if (isMultipleComponents) {\n await this.addMultipleComponents(componentPathsStats);\n } else {\n logger.debugAndAddBreadCrumb('add-components', 'adding one component');\n // when a user enters more than one directory, he would like to keep the directories names\n // so then when a component is imported, it will write the files into the original directories\n const addedOne = await this.addOneComponent(Object.keys(componentPathsStats)[0]);\n await this._removeNamespaceIfNotNeeded([addedOne]);\n if (addedOne.files.length) {\n const addedResult = await this.addOrUpdateComponentInBitMap(addedOne);\n if (addedResult) this.addedComponents.push(addedResult);\n }\n }\n await this.linkComponents(this.addedComponents.map((item) => item.id));\n Analytics.setExtraData('num_components', this.addedComponents.length);\n return { addedComponents: this.addedComponents, warnings: this.warnings };\n }\n\n async linkComponents(ids: ComponentID[]) {\n if (this.trackDirFeature) {\n // if trackDirFeature is set, it happens during the component-load and because we load the\n // components in the next line, it gets into an infinite loop.\n return;\n }\n await linkToNodeModulesByIds(this.workspace, ids);\n }\n\n async addMultipleComponents(componentPathsStats: PathsStats): Promise<void> {\n logger.debugAndAddBreadCrumb('add-components', 'adding multiple components');\n this._removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats);\n const added = await this._tryAddingMultiple(componentPathsStats);\n validateNoDuplicateIds(added);\n await this._removeNamespaceIfNotNeeded(added);\n await this._addMultipleToBitMap(added);\n }\n\n /**\n * some uses of wildcards might add directories and their files at the same time, in such cases\n * only the files are needed and the directories can be ignored.\n * @see https://github.com/teambit/bit/issues/1406 for more details\n */\n _removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats: PathsStats) {\n const allPaths = Object.keys(componentPathsStats);\n allPaths.forEach((componentPath) => {\n const foundDir = allPaths.find((p) => p === path.dirname(componentPath));\n if (foundDir && componentPathsStats[foundDir]) {\n logger.debug(`add-components._removeDirectoriesWhenTheirFilesAreAdded, ignoring ${foundDir}`);\n delete componentPathsStats[foundDir];\n }\n });\n }\n\n async _addMultipleToBitMap(added: AddedComponent[]): Promise<void> {\n const missingMainFiles = [];\n await Promise.all(\n added.map(async (component) => {\n if (component.files.length) {\n try {\n const addedComponent = await this.addOrUpdateComponentInBitMap(component);\n if (addedComponent && addedComponent.files.length) this.addedComponents.push(addedComponent);\n } catch (err: any) {\n if (!(err instanceof MissingMainFile)) throw err;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n missingMainFiles.push(err);\n }\n }\n })\n );\n if (missingMainFiles.length) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n throw new MissingMainFileMultipleComponents(missingMainFiles.map((err) => err.componentId).sort());\n }\n }\n\n async _removeNamespaceIfNotNeeded(addedComponents: AddedComponent[]) {\n const allIds = this.bitMap.getAllBitIdsFromAllLanes();\n await Promise.all(\n addedComponents.map(async (addedComponent) => {\n if (!addedComponent.idFromPath) return; // when the id was not generated from the path do nothing.\n const componentsWithSameName = addedComponents.filter(\n (a) => a.idFromPath && a.idFromPath.name === addedComponent.idFromPath?.name\n );\n const bitIdFromNameOnly = new BitId({ name: addedComponent.idFromPath.name });\n const defaultScope = await this.getDefaultScope(addedComponent.trackDir, bitIdFromNameOnly.name);\n const componentIdFromNameOnly = new ComponentID(bitIdFromNameOnly, defaultScope);\n const existingComponentWithSameName = allIds.searchWithoutScopeAndVersion(componentIdFromNameOnly);\n if (componentsWithSameName.length === 1 && !existingComponentWithSameName) {\n addedComponent.componentId = componentIdFromNameOnly;\n }\n })\n );\n }\n\n async _tryAddingMultiple(componentPathsStats: PathsStats): Promise<AddedComponent[]> {\n const addedP = Object.keys(componentPathsStats).map(async (onePath) => {\n try {\n const addedComponent = await this.addOneComponent(onePath);\n return addedComponent;\n } catch (err: any) {\n if (!(err instanceof EmptyDirectory)) throw err;\n this.warnings.emptyDirectory.push(onePath);\n return null;\n }\n });\n const added = await Promise.all(addedP);\n return compact(added);\n }\n\n _throwForOutsideConsumer(relativeToConsumerPath: PathOsBased) {\n if (relativeToConsumerPath.startsWith('..')) {\n throw new PathOutsideConsumer(relativeToConsumerPath);\n }\n }\n\n private throwForExistingParentDir(relativeToConsumerPath: PathOsBased) {\n const isParentDir = (parent: string) => {\n const relative = path.relative(parent, relativeToConsumerPath);\n return relative && !relative.startsWith('..') && !path.isAbsolute(relative);\n };\n this.bitMap.components.forEach((componentMap) => {\n if (!componentMap.rootDir) return;\n if (isParentDir(componentMap.rootDir)) {\n throw new ParentDirTracked(\n componentMap.rootDir,\n componentMap.id.toStringWithoutVersion(),\n relativeToConsumerPath\n );\n }\n });\n }\n}\n\n/**\n * validatePaths - validate if paths entered by user exist and if not throw an error\n *\n * @param {string[]} fileArray - array of paths\n * @returns {PathsStats} componentPathsStats\n */\nfunction validatePaths(fileArray: string[]): PathsStats {\n const componentPathsStats = {};\n fileArray.forEach((componentPath) => {\n if (!fs.existsSync(componentPath)) {\n throw new PathsNotExist([componentPath]);\n }\n componentPathsStats[componentPath] = {\n isDir: isDir(componentPath),\n };\n });\n return componentPathsStats;\n}\n\n/**\n * validate that no two files where added with the same id in the same bit add command\n */\nfunction validateNoDuplicateIds(addComponents: Record<string, any>[]) {\n const duplicateIds = {};\n const newGroupedComponents = groupBy(addComponents, 'componentId');\n Object.keys(newGroupedComponents).forEach((key) => {\n if (newGroupedComponents[key].length > 1) duplicateIds[key] = newGroupedComponents[key];\n });\n if (!isEmpty(duplicateIds)) throw new DuplicateIds(duplicateIds);\n}\n\n/**\n * get the current working dir name of file and file name.\n * @name fileInfo\n * @param relativePath\n * @returns {object}\n * @example\n * ```js\n * currentDirName() // => 'bit'\n * ```\n */\nfunction calculateFileInfo(relativePath: string): { PARENT: string; FILE_NAME: string } {\n const fileInfo = path.parse(relativePath);\n const fullPath = path.dirname(relativePath);\n const rootDir = path.dirname(fullPath);\n const parentDir = path.relative(rootDir, fullPath);\n return { PARENT: parentDir, FILE_NAME: fileInfo.name };\n}\n\nasync function isAutoGeneratedFile(filePath: PathOsBased): Promise<boolean> {\n const line = await firstline(filePath);\n return line.includes(AUTO_GENERATED_STAMP);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,KAAA;EAAA,MAAAN,IAAA,GAAAO,uBAAA,CAAAL,OAAA;EAAAI,IAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,QAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,OAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,cAAA;EAAA,MAAAT,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAO,aAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,QAAA;EAAA,MAAAV,IAAA,GAAAE,OAAA;EAAAQ,OAAA,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AC,CAACpI,OAAO,CAAEsI,GAAG,IAAK;IACjD,IAAIF,oBAAoB,CAACE,GAAG,CAAC,CAACvK,MAAM,GAAG,CAAC,EAAEoK,YAAY,CAACG,GAAG,CAAC,GAAGF,oBAAoB,CAACE,GAAG,CAAC;EACzF,CAAC,CAAC;EACF,IAAI,CAAC,IAAAC,iBAAO,EAACJ,YAAY,CAAC,EAAE,MAAM,KAAIK,0BAAY,EAACL,YAAY,CAAC;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASnO,iBAAiBA,CAACmD,YAAoB,EAAyC;EACtF,MAAMpD,QAAQ,GAAGlF,IAAI,CAAD,CAAC,CAAC+O,KAAK,CAACzG,YAAY,CAAC;EACzC,MAAMsL,QAAQ,GAAG5T,IAAI,CAAD,CAAC,CAACwR,OAAO,CAAClJ,YAAY,CAAC;EAC3C,MAAMvB,OAAO,GAAG/G,IAAI,CAAD,CAAC,CAACwR,OAAO,CAACoC,QAAQ,CAAC;EACtC,MAAMC,SAAS,GAAG7T,IAAI,CAAD,CAAC,CAAC8S,QAAQ,CAAC/L,OAAO,EAAE6M,QAAQ,CAAC;EAClD,OAAO;IAAEE,MAAM,EAAED,SAAS;IAAEE,SAAS,EAAE7O,QAAQ,CAAC4H;EAAK,CAAC;AACxD;AAEA,eAAetE,mBAAmBA,CAACH,QAAqB,EAAoB;EAC1E,MAAM2L,IAAI,GAAG,MAAM,IAAAC,oBAAS,EAAC5L,QAAQ,CAAC;EACtC,OAAO2L,IAAI,CAACpI,QAAQ,CAACsI,+BAAoB,CAAC;AAC5C","ignoreList":[]}
1
+ {"version":3,"names":["_arrayDifference","data","_interopRequireDefault","require","_firstline","_fsExtra","_ignore","path","_interopRequireWildcard","_lodash","_stringFormat","_legacy","_componentId","_legacyBitId","_legacy2","_legacy3","_exceptions","_addingIndividualFiles","_missingMainFileMultipleComponents","_parentDirTracked","_pathOutsideConsumer","_versionShouldBeRemoved","_bitError","_legacy4","_legacy5","_workspaceModules","_determineMainFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","REGEX_DSL_PATTERN","AddComponents","constructor","context","addProps","workspace","consumer","bitMap","componentPaths","id","main","namespace","override","trackDirFeature","warnings","alreadyUsed","emptyDirectory","existInScope","addedComponents","defaultScope","config","shouldHandleOutOfSync","add","ignoreList","getIgnoreList","gitIgnore","ignore","componentPathsStats","resolvedComponentPathsWithoutGitIgnore","Promise","all","map","componentPath","glob","flat","resolvedComponentPathsWithGitIgnore","filter","diff","arrayDiff","length","PathsNotExist","validatePaths","NoFiles","keys","forEach","compPath","isDir","AddingIndividualFiles","BitError","isMultipleComponents","addMultipleComponents","logger","debugAndAddBreadCrumb","addedOne","addOneComponent","_removeNamespaceIfNotNeeded","files","addedResult","addOrUpdateComponentInBitMap","push","linkComponents","item","Analytics","setExtraData","getFilesAccordingToDsl","filesWithPotentialDsl","filesListAllMatches","dsl","filesListMatch","file","fileInfo","calculateFileInfo","generatedFile","format","matches","matchesAfterGitIgnore","match","fs","existsSync","filesListFlatten","filesListUnique","uniq","fileNormalized","pathNormalizeToLinux","fileWithCorrectCase","find","f","toLowerCase","relativeToConsumer","getPathRelativeToConsumer","_isPackageJsonOnRootDir","pathRelativeToConsumerRoot","componentMap","rootDir","Error","join","PACKAGE_JSON","normalize","_isOutsideOfWrapDir","wrapDir","wrapDirRelativeToConsumerRoot","startsWith","component","consumerPath","getPath","parsedBitId","componentId","componentFromScope","scope","getModelComponentIfExist","foundComponentFromBitMap","getComponentIfExist","ignoreVersion","componentFilesP","filePath","relativePath","isAutoGenerated","isAutoGeneratedFile","caseSensitive","existingIdOfFile","getComponentIdByPath","idOfFileIsDifferent","isEqual","newId","toComponentIdWithLatestVersion","componentFiles","_updateFilesAccordingToExistingRootDir","_areFilesArraysEqual","_updateFilesWithCurrentLetterCases","_mergeFilesWithExistingComponentMapFiles","trackDir","mainFile","determineMainFile","getRootDir","fileNotInsideTrackDir","getComponentMap","addFilesToComponent","getDefaultScope","hasScope","undefined","fullName","addComponent","ComponentID","changeRootDirAndUpdateFilesAccordingly","existingRootDir","areFilesInsideExistingRootDir","every","ComponentMap","changeFilesPathAccordingToItsRootDir","currentlyAddedDir","currentlyAddedDirParentOfRootDir","existingComponentMapFile","unionBy","currentComponentMap","newFiles","currentFiles","currentFile","sameFile","newFile","_getIdAccordingToExistingComponent","currentId","idWithScope","existingComponentId","getExistingBitId","includes","VERSION_DELIMITER","hasVersion","version","getVersionFromString","VersionShouldBeRemoved","_getIdAccordingToTrackDir","dir","dirNormalizedToLinux","trackDirs","getAllTrackDirs","_addMainFileToFiles","foundFile","_findMainFileInFiles","shouldIgnore","ignores","ExcludedMainFile","name","basename","mainFileRelativeToConsumer","mainPath","toAbsolutePath","MainFileIsDir","normalizedMainFile","componentName","componentDefaultScopeFromComponentDirAndName","finalBitId","idFromPath","relativeComponentPath","_throwForOutsideConsumer","throwForExistingParentDir","cwd","nodir","EmptyDirectory","filteredMatches","filteredMatchedFiles","test","resolvedMainFile","absoluteComponentPath","resolve","splitPath","split","sep","lastDir","idOfTrackDir","bitId","BitId","parse","nameSpaceOrDir","getValidIdChunk","getValidBitId","addedComp","immediateDir","getIgnoreListHarmony","ids","linkToNodeModulesByIds","_removeDirectoriesWhenTheirFilesAreAdded","added","_tryAddingMultiple","validateNoDuplicateIds","_addMultipleToBitMap","allPaths","foundDir","p","dirname","debug","missingMainFiles","addedComponent","err","MissingMainFile","MissingMainFileMultipleComponents","sort","allIds","getAllBitIdsFromAllLanes","componentsWithSameName","bitIdFromNameOnly","componentIdFromNameOnly","existingComponentWithSameName","searchWithoutScopeAndVersion","addedP","onePath","compact","relativeToConsumerPath","PathOutsideConsumer","exports","isParentDir","parent","relative","isAbsolute","components","ParentDirTracked","toStringWithoutVersion","fileArray","addComponents","duplicateIds","newGroupedComponents","groupBy","key","isEmpty","DuplicateIds","fullPath","parentDir","PARENT","FILE_NAME","line","firstline","AUTO_GENERATED_STAMP","addMultipleFromResolvedTrackData","trackData","componentMaps","filtered","fromObject","c"],"sources":["add-components.ts"],"sourcesContent":["import arrayDiff from 'array-difference';\nimport firstline from 'firstline';\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport * as path from 'path';\nimport { compact, groupBy, isEmpty, unionBy, uniq } from 'lodash';\nimport format from 'string-format';\nimport { Analytics } from '@teambit/legacy.analytics';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitIdStr, BitId } from '@teambit/legacy-bit-id';\nimport { PACKAGE_JSON, VERSION_DELIMITER, AUTO_GENERATED_STAMP } from '@teambit/legacy.constants';\nimport {\n BitMap,\n ComponentMap,\n ComponentMapFile,\n Config,\n getIgnoreListHarmony,\n MissingMainFile,\n} from '@teambit/legacy.bit-map';\nimport { DuplicateIds, EmptyDirectory, ExcludedMainFile, MainFileIsDir, NoFiles, PathsNotExist } from './exceptions';\nimport { AddingIndividualFiles } from './exceptions/adding-individual-files';\nimport MissingMainFileMultipleComponents from './exceptions/missing-main-file-multiple-components';\nimport { ParentDirTracked } from './exceptions/parent-dir-tracked';\nimport PathOutsideConsumer from './exceptions/path-outside-consumer';\nimport VersionShouldBeRemoved from './exceptions/version-should-be-removed';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { BitError } from '@teambit/bit-error';\nimport { logger } from '@teambit/legacy.logger';\nimport { glob, isDir, pathNormalizeToLinux, PathLinux, PathLinuxRelative, PathOsBased } from '@teambit/legacy.utils';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport { Workspace } from '@teambit/workspace';\nimport determineMainFile from './determine-main-file';\nimport { ResolvedTrackData } from './tracker.main.runtime';\n\nexport type AddResult = { id: ComponentID; files: ComponentMapFile[] };\nexport type Warnings = {\n alreadyUsed: Record<string, any>;\n emptyDirectory: string[];\n existInScope: ComponentID[];\n};\nexport type AddActionResults = { addedComponents: AddResult[]; warnings: Warnings };\nexport type PathOrDSL = PathOsBased | string; // can be a path or a DSL, e.g: tests/{PARENT}/{FILE_NAME}\n// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\ntype PathsStats = { [PathOsBased]: { isDir: boolean } };\nexport type AddedComponent = {\n componentId: ComponentID;\n files: ComponentMapFile[];\n mainFile?: PathOsBased | null | undefined;\n trackDir: PathOsBased;\n idFromPath:\n | {\n name: string;\n namespace: string;\n }\n | null\n | undefined;\n immediateDir?: string;\n};\nconst REGEX_DSL_PATTERN = /{([^}]+)}/g;\n\nexport type AddProps = {\n componentPaths: PathOsBased[];\n id?: string;\n main?: PathOsBased;\n namespace?: string;\n override: boolean;\n trackDirFeature?: boolean;\n defaultScope?: string;\n config?: Config;\n shouldHandleOutOfSync?: boolean;\n env?: string;\n};\n\nexport type AddContext = {\n workspace: Workspace;\n};\n\nexport default class AddComponents {\n workspace: Workspace;\n consumer: Consumer;\n bitMap: BitMap;\n componentPaths: PathOsBased[];\n id: string | null | undefined; // id entered by the user\n main: PathOsBased | null | undefined;\n namespace: string | null | undefined;\n override: boolean; // (default = false) replace the files array or only add files.\n trackDirFeature: boolean | null | undefined;\n warnings: Warnings;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n ignoreList: string[];\n gitIgnore: any;\n addedComponents: AddResult[];\n defaultScope?: string; // helpful for out-of-sync\n config?: Config;\n shouldHandleOutOfSync?: boolean; // only bit-add (not bit-create/new) should handle out-of-sync scenario\n constructor(context: AddContext, addProps: AddProps) {\n this.workspace = context.workspace;\n this.consumer = context.workspace.consumer;\n this.bitMap = this.consumer.bitMap;\n this.componentPaths = addProps.componentPaths;\n this.id = addProps.id;\n this.main = addProps.main;\n this.namespace = addProps.namespace;\n this.override = addProps.override;\n this.trackDirFeature = addProps.trackDirFeature;\n this.warnings = {\n alreadyUsed: {},\n emptyDirectory: [],\n existInScope: [],\n };\n this.addedComponents = [];\n this.defaultScope = addProps.defaultScope;\n this.config = addProps.config;\n this.shouldHandleOutOfSync = addProps.shouldHandleOutOfSync;\n }\n\n async add(): Promise<AddActionResults> {\n this.ignoreList = await this.getIgnoreList();\n this.gitIgnore = ignore().add(this.ignoreList); // add ignore list\n\n let componentPathsStats: PathsStats = {};\n\n const resolvedComponentPathsWithoutGitIgnore = (\n await Promise.all(this.componentPaths.map((componentPath) => glob(componentPath)))\n ).flat();\n\n const resolvedComponentPathsWithGitIgnore = this.gitIgnore.filter(resolvedComponentPathsWithoutGitIgnore);\n // Run diff on both arrays to see what was filtered out because of the gitignore file\n // this is not the same as \"lodash.difference\".\n const diff = arrayDiff(resolvedComponentPathsWithGitIgnore, resolvedComponentPathsWithoutGitIgnore);\n\n if (!resolvedComponentPathsWithoutGitIgnore.length) {\n throw new PathsNotExist(this.componentPaths);\n }\n if (resolvedComponentPathsWithGitIgnore.length) {\n componentPathsStats = validatePaths(resolvedComponentPathsWithGitIgnore);\n } else {\n throw new NoFiles(diff);\n }\n Object.keys(componentPathsStats).forEach((compPath) => {\n if (!componentPathsStats[compPath].isDir) {\n throw new AddingIndividualFiles(compPath);\n }\n });\n if (Object.keys(componentPathsStats).length > 1 && this.id) {\n throw new BitError(\n `the --id flag (${this.id}) is used for a single component only, however, got ${this.componentPaths.length} paths`\n );\n }\n // if a user entered multiple paths and entered an id, he wants all these paths to be one component\n // conversely, if a user entered multiple paths without id, he wants each dir as an individual component\n const isMultipleComponents = Object.keys(componentPathsStats).length > 1;\n if (isMultipleComponents) {\n await this.addMultipleComponents(componentPathsStats);\n } else {\n logger.debugAndAddBreadCrumb('add-components', 'adding one component');\n // when a user enters more than one directory, he would like to keep the directories names\n // so then when a component is imported, it will write the files into the original directories\n const addedOne = await this.addOneComponent(Object.keys(componentPathsStats)[0]);\n await this._removeNamespaceIfNotNeeded([addedOne]);\n if (addedOne.files.length) {\n const addedResult = await this.addOrUpdateComponentInBitMap(addedOne);\n if (addedResult) this.addedComponents.push(addedResult);\n }\n }\n await this.linkComponents(this.addedComponents.map((item) => item.id));\n Analytics.setExtraData('num_components', this.addedComponents.length);\n return { addedComponents: this.addedComponents, warnings: this.warnings };\n }\n\n /**\n * @param {string[]} files - array of file-paths from which it should search for the dsl patterns.\n * @param {*} filesWithPotentialDsl - array of file-path which may have DSL patterns\n *\n * @returns array of file-paths from 'files' parameter that match the patterns from 'filesWithPotentialDsl' parameter\n */\n async getFilesAccordingToDsl(files: PathLinux[], filesWithPotentialDsl: PathOrDSL[]): Promise<PathLinux[]> {\n const filesListAllMatches = filesWithPotentialDsl.map(async (dsl) => {\n const filesListMatch = files.map(async (file) => {\n const fileInfo = calculateFileInfo(file);\n const generatedFile = format(dsl, fileInfo);\n const matches = await glob(generatedFile);\n const matchesAfterGitIgnore = this.gitIgnore.filter(matches);\n return matchesAfterGitIgnore.filter((match) => fs.existsSync(match));\n });\n return Promise.all(filesListMatch);\n });\n\n const filesListFlatten = (await Promise.all(filesListAllMatches)).flat();\n const filesListUnique = uniq(filesListFlatten);\n return filesListUnique.map((file) => {\n // when files array has the test file with different letter case, use the one from the file array\n const fileNormalized = pathNormalizeToLinux(file);\n const fileWithCorrectCase = files.find((f) => f.toLowerCase() === fileNormalized.toLowerCase()) || fileNormalized;\n const relativeToConsumer = this.consumer.getPathRelativeToConsumer(fileWithCorrectCase);\n return pathNormalizeToLinux(relativeToConsumer);\n });\n }\n\n /**\n * for imported component, the package.json in the root directory is a bit-generated file and as\n * such, it should be ignored\n */\n _isPackageJsonOnRootDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap) {\n if (!componentMap.rootDir) {\n throw new Error('_isPackageJsonOnRootDir should not get called on non imported components');\n }\n return path.join(componentMap.rootDir, PACKAGE_JSON) === path.normalize(pathRelativeToConsumerRoot);\n }\n\n /**\n * imported components might have wrapDir, when they do, files should not be added outside of\n * that wrapDir\n */\n _isOutsideOfWrapDir(pathRelativeToConsumerRoot: PathLinux, componentMap: ComponentMap) {\n if (!componentMap.rootDir) {\n throw new Error('_isOutsideOfWrapDir should not get called on non imported components');\n }\n if (!componentMap.wrapDir) return false;\n const wrapDirRelativeToConsumerRoot = path.join(componentMap.rootDir, componentMap.wrapDir);\n return !path.normalize(pathRelativeToConsumerRoot).startsWith(wrapDirRelativeToConsumerRoot);\n }\n\n /**\n * Add or update existing (imported and new) component according to bitmap\n * there are 3 options:\n * 1. a user is adding a new component. there is no record for this component in bit.map\n * 2. a user is updating an existing component. there is a record for this component in bit.map\n * 3. some or all the files of this component were previously added as another component-id.\n */\n async addOrUpdateComponentInBitMap(component: AddedComponent): Promise<AddResult | null | undefined> {\n const consumerPath = this.consumer.getPath();\n const parsedBitId = component.componentId;\n const componentFromScope = await this.consumer.scope.getModelComponentIfExist(parsedBitId);\n const files: ComponentMapFile[] = component.files;\n const foundComponentFromBitMap = this.bitMap.getComponentIfExist(component.componentId, {\n ignoreVersion: true,\n });\n const componentFilesP = files.map(async (file: ComponentMapFile) => {\n // $FlowFixMe null is removed later on\n const filePath = path.join(consumerPath, file.relativePath);\n const isAutoGenerated = await isAutoGeneratedFile(filePath);\n if (isAutoGenerated) {\n return null;\n }\n const caseSensitive = false;\n const existingIdOfFile = this.bitMap.getComponentIdByPath(file.relativePath, caseSensitive);\n const idOfFileIsDifferent = existingIdOfFile && !existingIdOfFile.isEqual(parsedBitId);\n if (idOfFileIsDifferent) {\n // not imported component file but exists in bitmap\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.warnings.alreadyUsed[existingIdOfFile]) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.warnings.alreadyUsed[existingIdOfFile].push(file.relativePath);\n } else {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.warnings.alreadyUsed[existingIdOfFile] = [file.relativePath];\n }\n return null;\n }\n if (!foundComponentFromBitMap && componentFromScope && this.shouldHandleOutOfSync) {\n const newId = componentFromScope.toComponentIdWithLatestVersion();\n if (!this.defaultScope || this.defaultScope === newId.scope) {\n // otherwise, if defaultScope !== newId.scope, they're different components,\n // and no need to change the id.\n // for more details about this scenario, see https://github.com/teambit/bit/issues/1543, last case.\n component.componentId = newId;\n this.warnings.existInScope.push(newId);\n }\n }\n return file;\n });\n // @ts-ignore it can't be null due to the filter function\n const componentFiles: ComponentMapFile[] = (await Promise.all(componentFilesP)).filter((file) => file);\n if (!componentFiles.length) return { id: component.componentId, files: [] };\n if (foundComponentFromBitMap) {\n this._updateFilesAccordingToExistingRootDir(foundComponentFromBitMap, componentFiles, component);\n }\n if (this.trackDirFeature) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.bitMap._areFilesArraysEqual(foundComponentFromBitMap.files, componentFiles)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return foundComponentFromBitMap;\n }\n }\n if (!this.override && foundComponentFromBitMap) {\n this._updateFilesWithCurrentLetterCases(foundComponentFromBitMap, componentFiles);\n component.files = this._mergeFilesWithExistingComponentMapFiles(componentFiles, foundComponentFromBitMap.files);\n } else {\n component.files = componentFiles;\n }\n\n const { componentId, trackDir } = component;\n const mainFile = determineMainFile(component, foundComponentFromBitMap);\n const getRootDir = (): PathLinuxRelative => {\n if (this.trackDirFeature) throw new Error('track dir should not calculate the rootDir');\n if (foundComponentFromBitMap) return foundComponentFromBitMap.rootDir;\n if (!trackDir) throw new Error(`addOrUpdateComponentInBitMap expect to have trackDir for non-legacy workspace`);\n const fileNotInsideTrackDir = componentFiles.find(\n (file) => !pathNormalizeToLinux(file.relativePath).startsWith(`${pathNormalizeToLinux(trackDir)}/`)\n );\n if (fileNotInsideTrackDir) {\n // we check for this error before. however, it's possible that a user have one trackDir\n // and another dir for the tests.\n throw new AddingIndividualFiles(fileNotInsideTrackDir.relativePath);\n }\n return pathNormalizeToLinux(trackDir);\n };\n const getComponentMap = async (): Promise<ComponentMap> => {\n if (this.trackDirFeature) {\n return this.bitMap.addFilesToComponent({ componentId, files: component.files });\n }\n const rootDir = getRootDir();\n const getDefaultScope = async () => {\n if (componentId.hasScope()) return undefined;\n return this.getDefaultScope(rootDir, componentId.fullName);\n };\n const defaultScope = await getDefaultScope();\n const componentMap = this.bitMap.addComponent({\n componentId: new ComponentID(componentId._legacy, defaultScope),\n files: component.files,\n defaultScope,\n config: this.config,\n mainFile,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n override: this.override,\n });\n componentMap.changeRootDirAndUpdateFilesAccordingly(rootDir);\n return componentMap;\n };\n const componentMap = await getComponentMap();\n return { id: componentId, files: componentMap.files };\n }\n\n /**\n * current componentFiles are relative to the workspace. we want them relative to the rootDir.\n */\n _updateFilesAccordingToExistingRootDir(\n foundComponentFromBitMap: ComponentMap,\n componentFiles: ComponentMapFile[],\n component: AddedComponent\n ) {\n const existingRootDir = foundComponentFromBitMap.rootDir;\n if (!existingRootDir) return; // nothing to do.\n const areFilesInsideExistingRootDir = componentFiles.every((file) =>\n pathNormalizeToLinux(file.relativePath).startsWith(`${existingRootDir}/`)\n );\n if (areFilesInsideExistingRootDir) {\n ComponentMap.changeFilesPathAccordingToItsRootDir(existingRootDir, componentFiles);\n return;\n }\n // some (or all) added files are outside the existing rootDir, the rootDir needs to be changed\n // if a directory was added and it's a parent of the existing rootDir, change the rootDir to\n // the currently added rootDir.\n const currentlyAddedDir = pathNormalizeToLinux(component.trackDir);\n const currentlyAddedDirParentOfRootDir = currentlyAddedDir && existingRootDir.startsWith(`${currentlyAddedDir}/`);\n if (currentlyAddedDirParentOfRootDir) {\n foundComponentFromBitMap.changeRootDirAndUpdateFilesAccordingly(currentlyAddedDir);\n ComponentMap.changeFilesPathAccordingToItsRootDir(currentlyAddedDir, componentFiles);\n return;\n }\n throw new BitError(`unable to add individual files outside the root dir (${existingRootDir}) of ${component.componentId}.\nyou can add the directory these files are located at and it'll change the root dir of the component accordingly`);\n // we might want to change the behavior here to not throw an error and only change the rootDir to \".\"\n // foundComponentFromBitMap.changeRootDirAndUpdateFilesAccordingly('.');\n }\n\n /**\n * the risk with merging the currently added files with the existing bitMap files is overriding\n * the `test` property. e.g. the component directory is re-added without adding the tests flag to\n * track new files in that directory. in this case, we want to preserve the `test` property.\n */\n _mergeFilesWithExistingComponentMapFiles(\n componentFiles: ComponentMapFile[],\n existingComponentMapFile: ComponentMapFile[]\n ) {\n return unionBy(existingComponentMapFile, componentFiles, 'relativePath');\n }\n\n /**\n * if an existing file is for example uppercase and the new file is lowercase it has different\n * behavior according to the OS. some OS are case sensitive, some are not.\n * it's safer to avoid saving both files and instead, replacing the old file with the new one.\n * in case a file has replaced and it is also a mainFile, replace the mainFile as well\n */\n _updateFilesWithCurrentLetterCases(currentComponentMap: ComponentMap, newFiles: ComponentMapFile[]) {\n const currentFiles = currentComponentMap.files;\n currentFiles.forEach((currentFile) => {\n const sameFile = newFiles.find(\n (newFile) => newFile.relativePath.toLowerCase() === currentFile.relativePath.toLowerCase()\n );\n if (sameFile && currentFile.relativePath !== sameFile.relativePath) {\n if (currentComponentMap.mainFile === currentFile.relativePath) {\n currentComponentMap.mainFile = sameFile.relativePath;\n }\n currentFile.relativePath = sameFile.relativePath;\n }\n });\n }\n\n /**\n * if the id is already saved in bitmap file, it might have more data (such as scope, version)\n * use that id instead.\n */\n private _getIdAccordingToExistingComponent(currentId: BitIdStr): ComponentID | undefined {\n const idWithScope = this.defaultScope ? `${this.defaultScope}/${currentId}` : currentId;\n const existingComponentId = this.bitMap.getExistingBitId(idWithScope, false);\n if (currentId.includes(VERSION_DELIMITER)) {\n if (\n !existingComponentId || // this id is new, it shouldn't have a version\n !existingComponentId.hasVersion() || // this component is new, it shouldn't have a version\n // user shouldn't add files to a an existing component with different version\n existingComponentId.version !== ComponentID.getVersionFromString(currentId)\n ) {\n throw new VersionShouldBeRemoved(currentId);\n }\n }\n return existingComponentId;\n }\n\n _getIdAccordingToTrackDir(dir: PathOsBased): ComponentID | null | undefined {\n const dirNormalizedToLinux = pathNormalizeToLinux(dir);\n const trackDirs = this.bitMap.getAllTrackDirs();\n if (!trackDirs) return null;\n return trackDirs[dirNormalizedToLinux];\n }\n\n /**\n * used for updating main file if exists or doesn't exists\n */\n _addMainFileToFiles(files: ComponentMapFile[]): PathOsBased | null | undefined {\n let mainFile = this.main;\n if (mainFile && mainFile.match(REGEX_DSL_PATTERN)) {\n // it's a DSL\n files.forEach((file) => {\n const fileInfo = calculateFileInfo(file.relativePath);\n const generatedFile = format(mainFile, fileInfo);\n const foundFile = this._findMainFileInFiles(generatedFile, files);\n if (foundFile) {\n mainFile = foundFile.relativePath;\n }\n if (fs.existsSync(generatedFile) && !foundFile) {\n const shouldIgnore = this.gitIgnore.ignores(generatedFile);\n if (shouldIgnore) {\n // check if file is in exclude list\n throw new ExcludedMainFile(generatedFile);\n }\n files.push({\n relativePath: pathNormalizeToLinux(generatedFile),\n name: path.basename(generatedFile),\n });\n mainFile = generatedFile;\n }\n });\n }\n if (!mainFile) return undefined;\n const mainFileRelativeToConsumer = this.consumer.getPathRelativeToConsumer(mainFile);\n const mainPath = this.consumer.toAbsolutePath(mainFileRelativeToConsumer);\n if (fs.existsSync(mainPath)) {\n const shouldIgnore = this.gitIgnore.ignores(mainFileRelativeToConsumer);\n if (shouldIgnore) throw new ExcludedMainFile(mainFileRelativeToConsumer);\n if (isDir(mainPath)) {\n throw new MainFileIsDir(mainPath);\n }\n const foundFile = this._findMainFileInFiles(mainFileRelativeToConsumer, files);\n if (foundFile) {\n return foundFile.relativePath;\n }\n files.push({\n relativePath: pathNormalizeToLinux(mainFileRelativeToConsumer),\n name: path.basename(mainFileRelativeToConsumer),\n });\n return mainFileRelativeToConsumer;\n }\n return mainFile;\n }\n\n _findMainFileInFiles(mainFile: string, files: ComponentMapFile[]) {\n const normalizedMainFile = pathNormalizeToLinux(mainFile).toLowerCase();\n return files.find((file) => file.relativePath.toLowerCase() === normalizedMainFile);\n }\n\n private async getDefaultScope(rootDir: string, componentName: string): Promise<string> {\n return (this.defaultScope ||\n (await this.workspace.componentDefaultScopeFromComponentDirAndName(rootDir, componentName))) as string;\n }\n\n /**\n * given the component paths, prepare the id, mainFile and files to be added later on to bitmap\n * the id of the component is either entered by the user or, if not entered, concluded by the path.\n * e.g. bar/foo.js, the id would be bar/foo.\n * in case bitmap has already the same id, the complete id is taken from bitmap (see _getIdAccordingToExistingComponent)\n */\n async addOneComponent(componentPath: PathOsBased): Promise<AddedComponent> {\n let finalBitId: ComponentID | undefined; // final id to use for bitmap file\n let idFromPath;\n if (this.id) {\n finalBitId = this._getIdAccordingToExistingComponent(this.id);\n }\n const relativeComponentPath = this.consumer.getPathRelativeToConsumer(componentPath);\n this._throwForOutsideConsumer(relativeComponentPath);\n throwForExistingParentDir(this.bitMap, relativeComponentPath);\n const matches = await glob(path.join(relativeComponentPath, '**'), {\n cwd: this.consumer.getPath(),\n nodir: true,\n });\n\n if (!matches.length) throw new EmptyDirectory(componentPath);\n\n const filteredMatches = this.gitIgnore.filter(matches);\n\n if (!filteredMatches.length) {\n throw new NoFiles(matches);\n }\n\n const filteredMatchedFiles = filteredMatches.map((match: PathOsBased) => {\n return { relativePath: pathNormalizeToLinux(match), test: false, name: path.basename(match) };\n });\n const resolvedMainFile = this._addMainFileToFiles(filteredMatchedFiles);\n\n const absoluteComponentPath = path.resolve(componentPath);\n const splitPath = absoluteComponentPath.split(path.sep);\n const lastDir = splitPath[splitPath.length - 1];\n const idOfTrackDir = this._getIdAccordingToTrackDir(componentPath);\n if (!finalBitId) {\n if (this.id) {\n const bitId = BitId.parse(this.id, false);\n const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);\n finalBitId = new ComponentID(bitId, defaultScope);\n } else if (idOfTrackDir) {\n finalBitId = idOfTrackDir;\n } else {\n const nameSpaceOrDir = this.namespace || splitPath[splitPath.length - 2];\n if (!this.namespace) {\n idFromPath = { namespace: BitId.getValidIdChunk(nameSpaceOrDir), name: BitId.getValidIdChunk(lastDir) };\n }\n const bitId = BitId.getValidBitId(nameSpaceOrDir, lastDir);\n const defaultScope = await this.getDefaultScope(relativeComponentPath, bitId.name);\n finalBitId = new ComponentID(bitId, defaultScope);\n }\n }\n const trackDir = relativeComponentPath;\n const addedComp = {\n componentId: finalBitId,\n files: filteredMatchedFiles,\n mainFile: resolvedMainFile,\n trackDir,\n idFromPath,\n immediateDir: lastDir,\n };\n\n return addedComp;\n }\n\n async getIgnoreList(): Promise<string[]> {\n const consumerPath = this.consumer.getPath();\n return getIgnoreListHarmony(consumerPath);\n }\n\n async linkComponents(ids: ComponentID[]) {\n if (this.trackDirFeature) {\n // if trackDirFeature is set, it happens during the component-load and because we load the\n // components in the next line, it gets into an infinite loop.\n return;\n }\n await linkToNodeModulesByIds(this.workspace, ids);\n }\n\n async addMultipleComponents(componentPathsStats: PathsStats): Promise<void> {\n logger.debugAndAddBreadCrumb('add-components', 'adding multiple components');\n this._removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats);\n const added = await this._tryAddingMultiple(componentPathsStats);\n validateNoDuplicateIds(added);\n await this._removeNamespaceIfNotNeeded(added);\n await this._addMultipleToBitMap(added);\n }\n\n /**\n * some uses of wildcards might add directories and their files at the same time, in such cases\n * only the files are needed and the directories can be ignored.\n * @see https://github.com/teambit/bit/issues/1406 for more details\n */\n _removeDirectoriesWhenTheirFilesAreAdded(componentPathsStats: PathsStats) {\n const allPaths = Object.keys(componentPathsStats);\n allPaths.forEach((componentPath) => {\n const foundDir = allPaths.find((p) => p === path.dirname(componentPath));\n if (foundDir && componentPathsStats[foundDir]) {\n logger.debug(`add-components._removeDirectoriesWhenTheirFilesAreAdded, ignoring ${foundDir}`);\n delete componentPathsStats[foundDir];\n }\n });\n }\n\n async _addMultipleToBitMap(added: AddedComponent[]): Promise<void> {\n const missingMainFiles = [];\n await Promise.all(\n added.map(async (component) => {\n if (component.files.length) {\n try {\n const addedComponent = await this.addOrUpdateComponentInBitMap(component);\n if (addedComponent && addedComponent.files.length) this.addedComponents.push(addedComponent);\n } catch (err: any) {\n if (!(err instanceof MissingMainFile)) throw err;\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n missingMainFiles.push(err);\n }\n }\n })\n );\n if (missingMainFiles.length) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n throw new MissingMainFileMultipleComponents(missingMainFiles.map((err) => err.componentId).sort());\n }\n }\n\n async _removeNamespaceIfNotNeeded(addedComponents: AddedComponent[]) {\n const allIds = this.bitMap.getAllBitIdsFromAllLanes();\n await Promise.all(\n addedComponents.map(async (addedComponent) => {\n if (!addedComponent.idFromPath) return; // when the id was not generated from the path do nothing.\n const componentsWithSameName = addedComponents.filter(\n (a) => a.idFromPath && a.idFromPath.name === addedComponent.idFromPath?.name\n );\n const bitIdFromNameOnly = new BitId({ name: addedComponent.idFromPath.name });\n const defaultScope = await this.getDefaultScope(addedComponent.trackDir, bitIdFromNameOnly.name);\n const componentIdFromNameOnly = new ComponentID(bitIdFromNameOnly, defaultScope);\n const existingComponentWithSameName = allIds.searchWithoutScopeAndVersion(componentIdFromNameOnly);\n if (componentsWithSameName.length === 1 && !existingComponentWithSameName) {\n addedComponent.componentId = componentIdFromNameOnly;\n }\n })\n );\n }\n\n async _tryAddingMultiple(componentPathsStats: PathsStats): Promise<AddedComponent[]> {\n const addedP = Object.keys(componentPathsStats).map(async (onePath) => {\n try {\n const addedComponent = await this.addOneComponent(onePath);\n return addedComponent;\n } catch (err: any) {\n if (!(err instanceof EmptyDirectory)) throw err;\n this.warnings.emptyDirectory.push(onePath);\n return null;\n }\n });\n const added = await Promise.all(addedP);\n return compact(added);\n }\n\n _throwForOutsideConsumer(relativeToConsumerPath: PathOsBased) {\n if (relativeToConsumerPath.startsWith('..')) {\n throw new PathOutsideConsumer(relativeToConsumerPath);\n }\n }\n}\n\n\nfunction throwForExistingParentDir(bitMap: BitMap, relativeToConsumerPath: PathOsBased) {\n const isParentDir = (parent: string) => {\n const relative = path.relative(parent, relativeToConsumerPath);\n return relative && !relative.startsWith('..') && !path.isAbsolute(relative);\n };\n bitMap.components.forEach((componentMap) => {\n if (!componentMap.rootDir) return;\n if (isParentDir(componentMap.rootDir)) {\n throw new ParentDirTracked(\n componentMap.rootDir,\n componentMap.id.toStringWithoutVersion(),\n relativeToConsumerPath\n );\n }\n });\n}\n\n/**\n * validatePaths - validate if paths entered by user exist and if not throw an error\n *\n * @param {string[]} fileArray - array of paths\n * @returns {PathsStats} componentPathsStats\n */\nfunction validatePaths(fileArray: string[]): PathsStats {\n const componentPathsStats = {};\n fileArray.forEach((componentPath) => {\n if (!fs.existsSync(componentPath)) {\n throw new PathsNotExist([componentPath]);\n }\n componentPathsStats[componentPath] = {\n isDir: isDir(componentPath),\n };\n });\n return componentPathsStats;\n}\n\n/**\n * validate that no two files where added with the same id in the same bit add command\n */\nfunction validateNoDuplicateIds(addComponents: Record<string, any>[]) {\n const duplicateIds = {};\n const newGroupedComponents = groupBy(addComponents, 'componentId');\n Object.keys(newGroupedComponents).forEach((key) => {\n if (newGroupedComponents[key].length > 1) duplicateIds[key] = newGroupedComponents[key];\n });\n if (!isEmpty(duplicateIds)) throw new DuplicateIds(duplicateIds);\n}\n\n/**\n * get the current working dir name of file and file name.\n * @name fileInfo\n * @param relativePath\n * @returns {object}\n * @example\n * ```js\n * currentDirName() // => 'bit'\n * ```\n */\nfunction calculateFileInfo(relativePath: string): { PARENT: string; FILE_NAME: string } {\n const fileInfo = path.parse(relativePath);\n const fullPath = path.dirname(relativePath);\n const rootDir = path.dirname(fullPath);\n const parentDir = path.relative(rootDir, fullPath);\n return { PARENT: parentDir, FILE_NAME: fileInfo.name };\n}\n\nasync function isAutoGeneratedFile(filePath: PathOsBased): Promise<boolean> {\n const line = await firstline(filePath);\n return line.includes(AUTO_GENERATED_STAMP);\n}\n\nexport async function addMultipleFromResolvedTrackData(workspace: Workspace,\n trackData: ResolvedTrackData[]\n): Promise<ComponentID[]> {\n const bitMap = workspace.consumer.bitMap;\n const ignoreList = await getIgnoreListHarmony(workspace.path);\n const gitIgnore = ignore().add(ignoreList);\n const componentMaps = trackData.map(data => {\n const { rootDir, files, componentName, defaultScope, mainFile, config } = data;\n if (path.isAbsolute(rootDir)) throw new BitError(`path is absolute, got ${rootDir}`);\n throwForExistingParentDir(bitMap, rootDir);\n\n const filtered = gitIgnore.filter(files);\n if (!filtered.length) {\n throw new NoFiles(files);\n }\n\n const componentFiles = filtered.map((match: PathOsBased) => {\n return { relativePath: pathNormalizeToLinux(match), name: path.basename(match) };\n });\n\n const componentMap = bitMap.addComponent({\n componentId: ComponentID.fromObject({ name: componentName }, defaultScope),\n files: componentFiles,\n defaultScope,\n config,\n mainFile,\n rootDir\n });\n return componentMap;\n });\n\n const allIds = componentMaps.map(c => c.id);\n await linkToNodeModulesByIds(workspace, allIds);\n\n return allIds;\n}"],"mappings":";;;;;;;AAAA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,KAAA;EAAA,MAAAN,IAAA,GAAAO,uBAAA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sI,YAAY,CAAC;MACvCnC,WAAW,EAAEoC,0BAAW,CAACqI,UAAU,CAAC;QAAE9F,IAAI,EAAEO;MAAc,CAAC,EAAEzK,YAAY,CAAC;MAC1EqC,KAAK,EAAEqE,cAAc;MACrB1G,YAAY;MACZC,MAAM;MACN+G,QAAQ;MACRtC;IACF,CAAC,CAAC;IACF,OAAOD,YAAY;EACrB,CAAC,CAAC;EAEF,MAAMgJ,MAAM,GAAGqC,aAAa,CAAClP,GAAG,CAACqP,CAAC,IAAIA,CAAC,CAAC3Q,EAAE,CAAC;EAC3C,MAAM,IAAAkN,0CAAsB,EAACtN,SAAS,EAAEuO,MAAM,CAAC;EAE/C,OAAOA,MAAM;AACf","ignoreList":[]}
@@ -37,7 +37,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
37
37
  function determineMainFile(addedComponent, existingComponentMap) {
38
38
  const mainFile = addedComponent.mainFile;
39
39
  const componentIdStr = addedComponent.componentId.toString();
40
- const files = addedComponent.files.filter(file => !file.test);
40
+ const files = addedComponent.files;
41
41
  const rootDir = existingComponentMap && existingComponentMap.rootDir;
42
42
  const strategies = [getExistingIfNotChanged, getUserSpecifiedMainFile, onlyOneFileEnteredUseIt, searchForFileNameIndex, searchForSameFileNameAsImmediateDir, searchForAngularEntryPoint];
43
43
  for (const strategy of strategies) {
@@ -1 +1 @@
1
- {"version":3,"names":["path","data","_interopRequireWildcard","require","_legacy","_legacy2","_legacy3","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","determineMainFile","addedComponent","existingComponentMap","mainFile","componentIdStr","componentId","toString","files","filter","file","test","rootDir","strategies","getExistingIfNotChanged","getUserSpecifiedMainFile","onlyOneFileEnteredUseIt","searchForFileNameIndex","searchForSameFileNameAsImmediateDir","searchForAngularEntryPoint","strategy","foundMainFile","mainFileString","DEFAULT_INDEX_NAME","DEFAULT_INDEX_EXTS","join","MissingMainFile","map","normalize","relativePath","_searchMainFile","pathNormalizeToLinux","length","ext","mainFileNameToSearch","searchResult","immediateDir","entryPoint","ANGULAR_BIT_ENTRY_POINT_FILE","baseMainFile","mainFileFromFiles","find","mainFileUsingRootDir","pathJoinLinux","potentialMainFiles","name","sortByNumOfDirs","b","split","DEFAULT_SEPARATOR","sort"],"sources":["determine-main-file.ts"],"sourcesContent":["import * as path from 'path';\n\nimport {\n ANGULAR_BIT_ENTRY_POINT_FILE,\n DEFAULT_INDEX_EXTS,\n DEFAULT_INDEX_NAME,\n DEFAULT_SEPARATOR,\n} from '@teambit/legacy.constants';\nimport { pathJoinLinux, PathLinux, pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport { ComponentMap, MissingMainFile } from '@teambit/legacy.bit-map';\nimport { AddedComponent } from './add-components';\n\nexport default function determineMainFile(\n addedComponent: AddedComponent,\n existingComponentMap: ComponentMap | null | undefined\n): PathLinux {\n const mainFile = addedComponent.mainFile;\n const componentIdStr = addedComponent.componentId.toString();\n const files = addedComponent.files.filter((file) => !file.test);\n const rootDir = existingComponentMap && existingComponentMap.rootDir;\n const strategies: Function[] = [\n getExistingIfNotChanged,\n getUserSpecifiedMainFile,\n onlyOneFileEnteredUseIt,\n searchForFileNameIndex,\n searchForSameFileNameAsImmediateDir,\n searchForAngularEntryPoint,\n ];\n\n for (const strategy of strategies) {\n const foundMainFile = strategy();\n if (foundMainFile) {\n return foundMainFile;\n }\n }\n const mainFileString = `${DEFAULT_INDEX_NAME}.[${DEFAULT_INDEX_EXTS.join(', ')}]`;\n throw new MissingMainFile(\n componentIdStr,\n mainFileString,\n files.map((file) => path.normalize(file.relativePath))\n );\n\n /**\n * user didn't enter mainFile but the component already exists with mainFile\n */\n function getExistingIfNotChanged(): PathLinux | null | undefined {\n if (!mainFile && existingComponentMap) {\n return existingComponentMap.mainFile;\n }\n return null;\n }\n /**\n * user entered mainFile => search the mainFile in the files array, throw error if not found\n */\n function getUserSpecifiedMainFile(): PathLinux | null | undefined {\n if (mainFile) {\n const foundMainFile = _searchMainFile(pathNormalizeToLinux(mainFile));\n if (foundMainFile) return foundMainFile;\n throw new MissingMainFile(\n componentIdStr,\n mainFile,\n files.map((file) => path.normalize(file.relativePath))\n );\n }\n return null;\n }\n /**\n * user didn't enter mainFile and the component has only one file, use that file as the main file\n */\n function onlyOneFileEnteredUseIt(): PathLinux | null | undefined {\n if (files.length === 1) {\n return files[0].relativePath;\n }\n return null;\n }\n /**\n * user didn't enter mainFile and the component has multiple files, search for file name \"index\",\n * e.g. `index.js`, `index.css`, etc.\n */\n function searchForFileNameIndex(): PathLinux | null | undefined {\n for (const ext of DEFAULT_INDEX_EXTS) {\n const mainFileNameToSearch = `${DEFAULT_INDEX_NAME}.${ext}`;\n const searchResult = _searchMainFile(mainFileNameToSearch);\n if (searchResult) {\n return searchResult;\n }\n }\n return null;\n }\n /**\n * user didn't enter mainFile and the component has multiple files, search for file with the same\n * name as the directory (see #1714)\n */\n function searchForSameFileNameAsImmediateDir(): PathLinux | null | undefined {\n if (addedComponent.immediateDir) {\n for (const ext of DEFAULT_INDEX_EXTS) {\n const mainFileNameToSearch = `${addedComponent.immediateDir}.${ext}`;\n const searchResult = _searchMainFile(mainFileNameToSearch);\n if (searchResult) {\n return searchResult;\n }\n }\n }\n return null;\n }\n /**\n * The component is an angular component and uses the angular entry point\n */\n function searchForAngularEntryPoint(): PathLinux | null | undefined {\n for (const entryPoint of ANGULAR_BIT_ENTRY_POINT_FILE) {\n const searchResult = _searchMainFile(entryPoint);\n if (searchResult) {\n return searchResult;\n }\n }\n return null;\n }\n\n function _searchMainFile(baseMainFile: PathLinux): PathLinux | null | undefined {\n // search for an exact relative-path\n let mainFileFromFiles = files.find((file) => file.relativePath === baseMainFile);\n if (mainFileFromFiles) return baseMainFile;\n if (rootDir) {\n const mainFileUsingRootDir = files.find((file) => pathJoinLinux(rootDir, file.relativePath) === baseMainFile);\n if (mainFileUsingRootDir) return mainFileUsingRootDir.relativePath;\n }\n // search for a file-name\n const potentialMainFiles = files.filter((file) => file.name === baseMainFile);\n if (!potentialMainFiles.length) return null;\n // when there are several files that met the criteria, choose the closer to the root\n const sortByNumOfDirs = (a, b) =>\n a.relativePath.split(DEFAULT_SEPARATOR).length - b.relativePath.split(DEFAULT_SEPARATOR).length;\n potentialMainFiles.sort(sortByNumOfDirs);\n mainFileFromFiles = potentialMainFiles[0];\n return mainFileFromFiles.relativePath;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,IAAA,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;AAMA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwE,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,O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AACmC,IAAI,KAAKN,YAAY,CAAC;IAC7E,IAAI,CAACK,kBAAkB,CAACZ,MAAM,EAAE,OAAO,IAAI;IAC3C;IACA,MAAMc,eAAe,GAAGA,CAACtD,CAAC,EAAEuD,CAAC,KAC3BvD,CAAC,CAACqC,YAAY,CAACmB,KAAK,CAACC,2BAAiB,CAAC,CAACjB,MAAM,GAAGe,CAAC,CAAClB,YAAY,CAACmB,KAAK,CAACC,2BAAiB,CAAC,CAACjB,MAAM;IACjGY,kBAAkB,CAACM,IAAI,CAACJ,eAAe,CAAC;IACxCN,iBAAiB,GAAGI,kBAAkB,CAAC,CAAC,CAAC;IACzC,OAAOJ,iBAAiB,CAACX,YAAY;EACvC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["path","data","_interopRequireWildcard","require","_legacy","_legacy2","_legacy3","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","determineMainFile","addedComponent","existingComponentMap","mainFile","componentIdStr","componentId","toString","files","rootDir","strategies","getExistingIfNotChanged","getUserSpecifiedMainFile","onlyOneFileEnteredUseIt","searchForFileNameIndex","searchForSameFileNameAsImmediateDir","searchForAngularEntryPoint","strategy","foundMainFile","mainFileString","DEFAULT_INDEX_NAME","DEFAULT_INDEX_EXTS","join","MissingMainFile","map","file","normalize","relativePath","_searchMainFile","pathNormalizeToLinux","length","ext","mainFileNameToSearch","searchResult","immediateDir","entryPoint","ANGULAR_BIT_ENTRY_POINT_FILE","baseMainFile","mainFileFromFiles","find","mainFileUsingRootDir","pathJoinLinux","potentialMainFiles","filter","name","sortByNumOfDirs","b","split","DEFAULT_SEPARATOR","sort"],"sources":["determine-main-file.ts"],"sourcesContent":["import * as path from 'path';\n\nimport {\n ANGULAR_BIT_ENTRY_POINT_FILE,\n DEFAULT_INDEX_EXTS,\n DEFAULT_INDEX_NAME,\n DEFAULT_SEPARATOR,\n} from '@teambit/legacy.constants';\nimport { pathJoinLinux, PathLinux, pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport { ComponentMap, MissingMainFile } from '@teambit/legacy.bit-map';\nimport { AddedComponent } from './add-components';\n\nexport default function determineMainFile(\n addedComponent: AddedComponent,\n existingComponentMap: ComponentMap | null | undefined\n): PathLinux {\n const mainFile = addedComponent.mainFile;\n const componentIdStr = addedComponent.componentId.toString();\n const files = addedComponent.files;\n const rootDir = existingComponentMap && existingComponentMap.rootDir;\n const strategies: Function[] = [\n getExistingIfNotChanged,\n getUserSpecifiedMainFile,\n onlyOneFileEnteredUseIt,\n searchForFileNameIndex,\n searchForSameFileNameAsImmediateDir,\n searchForAngularEntryPoint,\n ];\n\n for (const strategy of strategies) {\n const foundMainFile = strategy();\n if (foundMainFile) {\n return foundMainFile;\n }\n }\n const mainFileString = `${DEFAULT_INDEX_NAME}.[${DEFAULT_INDEX_EXTS.join(', ')}]`;\n throw new MissingMainFile(\n componentIdStr,\n mainFileString,\n files.map((file) => path.normalize(file.relativePath))\n );\n\n /**\n * user didn't enter mainFile but the component already exists with mainFile\n */\n function getExistingIfNotChanged(): PathLinux | null | undefined {\n if (!mainFile && existingComponentMap) {\n return existingComponentMap.mainFile;\n }\n return null;\n }\n /**\n * user entered mainFile => search the mainFile in the files array, throw error if not found\n */\n function getUserSpecifiedMainFile(): PathLinux | null | undefined {\n if (mainFile) {\n const foundMainFile = _searchMainFile(pathNormalizeToLinux(mainFile));\n if (foundMainFile) return foundMainFile;\n throw new MissingMainFile(\n componentIdStr,\n mainFile,\n files.map((file) => path.normalize(file.relativePath))\n );\n }\n return null;\n }\n /**\n * user didn't enter mainFile and the component has only one file, use that file as the main file\n */\n function onlyOneFileEnteredUseIt(): PathLinux | null | undefined {\n if (files.length === 1) {\n return files[0].relativePath;\n }\n return null;\n }\n /**\n * user didn't enter mainFile and the component has multiple files, search for file name \"index\",\n * e.g. `index.js`, `index.css`, etc.\n */\n function searchForFileNameIndex(): PathLinux | null | undefined {\n for (const ext of DEFAULT_INDEX_EXTS) {\n const mainFileNameToSearch = `${DEFAULT_INDEX_NAME}.${ext}`;\n const searchResult = _searchMainFile(mainFileNameToSearch);\n if (searchResult) {\n return searchResult;\n }\n }\n return null;\n }\n /**\n * user didn't enter mainFile and the component has multiple files, search for file with the same\n * name as the directory (see #1714)\n */\n function searchForSameFileNameAsImmediateDir(): PathLinux | null | undefined {\n if (addedComponent.immediateDir) {\n for (const ext of DEFAULT_INDEX_EXTS) {\n const mainFileNameToSearch = `${addedComponent.immediateDir}.${ext}`;\n const searchResult = _searchMainFile(mainFileNameToSearch);\n if (searchResult) {\n return searchResult;\n }\n }\n }\n return null;\n }\n /**\n * The component is an angular component and uses the angular entry point\n */\n function searchForAngularEntryPoint(): PathLinux | null | undefined {\n for (const entryPoint of ANGULAR_BIT_ENTRY_POINT_FILE) {\n const searchResult = _searchMainFile(entryPoint);\n if (searchResult) {\n return searchResult;\n }\n }\n return null;\n }\n\n function _searchMainFile(baseMainFile: PathLinux): PathLinux | null | undefined {\n // search for an exact relative-path\n let mainFileFromFiles = files.find((file) => file.relativePath === baseMainFile);\n if (mainFileFromFiles) return baseMainFile;\n if (rootDir) {\n const mainFileUsingRootDir = files.find((file) => pathJoinLinux(rootDir, file.relativePath) === baseMainFile);\n if (mainFileUsingRootDir) return mainFileUsingRootDir.relativePath;\n }\n // search for a file-name\n const potentialMainFiles = files.filter((file) => file.name === baseMainFile);\n if (!potentialMainFiles.length) return null;\n // when there are several files that met the criteria, choose the closer to the root\n const sortByNumOfDirs = (a, b) =>\n a.relativePath.split(DEFAULT_SEPARATOR).length - b.relativePath.split(DEFAULT_SEPARATOR).length;\n potentialMainFiles.sort(sortByNumOfDirs);\n mainFileFromFiles = potentialMainFiles[0];\n return mainFileFromFiles.relativePath;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA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,6 +2,6 @@ import { TrackerAspect } from './tracker.aspect';
2
2
  export { AddingIndividualFiles } from './exceptions/adding-individual-files';
3
3
  export { ParentDirTracked } from './exceptions/parent-dir-tracked';
4
4
  export { MainFileIsDir, PathOutsideConsumer, VersionShouldBeRemoved } from './exceptions';
5
- export type { TrackerMain } from './tracker.main.runtime';
5
+ export type { TrackerMain, ResolvedTrackData, TrackData } from './tracker.main.runtime';
6
6
  export default TrackerAspect;
7
7
  export { TrackerAspect };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_tracker","data","require","_addingIndividualFiles","_parentDirTracked","_exceptions","_default","exports","default","TrackerAspect"],"sources":["index.ts"],"sourcesContent":["import { TrackerAspect } from './tracker.aspect';\nexport { AddingIndividualFiles } from './exceptions/adding-individual-files';\nexport { ParentDirTracked } from './exceptions/parent-dir-tracked';\nexport { MainFileIsDir, PathOutsideConsumer, VersionShouldBeRemoved } from './exceptions';\nexport type { TrackerMain } from './tracker.main.runtime';\nexport default TrackerAspect;\nexport { TrackerAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,uBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,sBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,kBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0F,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE3EC,wBAAa","ignoreList":[]}
1
+ {"version":3,"names":["_tracker","data","require","_addingIndividualFiles","_parentDirTracked","_exceptions","_default","exports","default","TrackerAspect"],"sources":["index.ts"],"sourcesContent":["import { TrackerAspect } from './tracker.aspect';\nexport { AddingIndividualFiles } from './exceptions/adding-individual-files';\nexport { ParentDirTracked } from './exceptions/parent-dir-tracked';\nexport { MainFileIsDir, PathOutsideConsumer, VersionShouldBeRemoved } from './exceptions';\nexport type { TrackerMain, ResolvedTrackData, TrackData } from './tracker.main.runtime';\nexport default TrackerAspect;\nexport { TrackerAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,uBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,sBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,kBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0F,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE3EC,wBAAa","ignoreList":[]}
@@ -2,13 +2,16 @@ import { CLIMain } from '@teambit/cli';
2
2
  import { ComponentID } from '@teambit/component-id';
3
3
  import { Workspace } from '@teambit/workspace';
4
4
  import { Logger, LoggerMain } from '@teambit/logger';
5
- import { PathOsBasedRelative, PathOsBasedAbsolute } from '@teambit/legacy.utils';
5
+ import { PathOsBasedRelative, PathOsBasedAbsolute, PathLinuxRelative } from '@teambit/legacy.utils';
6
6
  import { AddActionResults, AddProps, Warnings } from './add-components';
7
7
  export type TrackResult = {
8
8
  files: string[];
9
9
  warnings: Warnings;
10
10
  componentId: ComponentID;
11
11
  };
12
+ /**
13
+ * this is for "bit add", where some data, such as "componentName" are not necessarily known
14
+ */
12
15
  export type TrackData = {
13
16
  rootDir: PathOsBasedRelative | PathOsBasedAbsolute;
14
17
  componentName?: string;
@@ -18,6 +21,19 @@ export type TrackData = {
18
21
  [aspectName: string]: any;
19
22
  };
20
23
  };
24
+ /**
25
+ * this is for commands where we know all the data to enter into .bitmap, such as defaultScope, componentName and files.
26
+ */
27
+ export type ResolvedTrackData = {
28
+ rootDir: PathLinuxRelative;
29
+ componentName: string;
30
+ mainFile: string;
31
+ files: string[];
32
+ defaultScope: string;
33
+ config?: {
34
+ [aspectName: string]: any;
35
+ };
36
+ };
21
37
  export declare class TrackerMain {
22
38
  private workspace;
23
39
  private logger;
@@ -28,6 +44,7 @@ export declare class TrackerMain {
28
44
  * to write the .bitmap file once completed, run "await this.bitMap.write();"
29
45
  */
30
46
  track(trackData: TrackData): Promise<TrackResult>;
47
+ trackMany(manyTrackData: ResolvedTrackData[]): Promise<ComponentID[]>;
31
48
  addForCLI(addProps: AddProps): Promise<AddActionResults>;
32
49
  addEnvToConfig(env: string, config: {
33
50
  [aspectName: string]: any;
@@ -47,7 +47,7 @@ function _addCmd() {
47
47
  return data;
48
48
  }
49
49
  function _addComponents() {
50
- const data = _interopRequireDefault(require("./add-components"));
50
+ const data = _interopRequireWildcard(require("./add-components"));
51
51
  _addComponents = function () {
52
52
  return data;
53
53
  };
@@ -60,10 +60,20 @@ function _tracker() {
60
60
  };
61
61
  return data;
62
62
  }
63
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
64
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
63
65
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
64
66
  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; }
65
67
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
66
68
  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); }
69
+ /**
70
+ * this is for "bit add", where some data, such as "componentName" are not necessarily known
71
+ */
72
+
73
+ /**
74
+ * this is for commands where we know all the data to enter into .bitmap, such as defaultScope, componentName and files.
75
+ */
76
+
67
77
  class TrackerMain {
68
78
  constructor(workspace, logger) {
69
79
  this.workspace = workspace;
@@ -97,6 +107,9 @@ class TrackerMain {
97
107
  componentId: result.addedComponents[0].id
98
108
  };
99
109
  }
110
+ async trackMany(manyTrackData) {
111
+ return (0, _addComponents().addMultipleFromResolvedTrackData)(this.workspace, manyTrackData);
112
+ }
100
113
  async addForCLI(addProps) {
101
114
  if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
102
115
  const addContext = {
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_path","_interopRequireDefault","_envs","_workspace","_logger","_addCmd","_addComponents","_tracker","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","TrackerMain","constructor","workspace","logger","track","trackData","defaultScope","addOwnerToScopeName","undefined","compPath","path","isAbsolute","rootDir","join","addComponent","AddComponents","componentPaths","id","componentName","main","mainFile","override","config","result","add","addedComponent","addedComponents","files","map","f","relativePath","warnings","componentId","addForCLI","addProps","OutsideWorkspaceError","addContext","shouldHandleOutOfSync","env","addEnvToConfig","addComponents","addResults","consumer","onDestroy","userEnvId","resolveComponentId","userEnvIdWithPotentialVersion","resolveEnvIdWithPotentialVersionForConfig","toStringWithoutVersion","EnvsAspect","scopeName","includes","isSelfHosted","isHostedByBit","wsDefaultScope","warn","owner","split","remotes","scope","getRemoteScopes","isHub","provider","cli","loggerMain","createLogger","TrackerAspect","trackerMain","register","AddCmd","exports","CLIAspect","WorkspaceAspect","LoggerAspect","MainRuntime","addRuntime","_default"],"sources":["tracker.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport path from 'path';\nimport { ComponentID } from '@teambit/component-id';\nimport { EnvsAspect } from '@teambit/envs';\nimport { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { PathOsBasedRelative, PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport { AddCmd } from './add-cmd';\nimport AddComponents, { AddActionResults, AddContext, AddProps, Warnings } from './add-components';\nimport { TrackerAspect } from './tracker.aspect';\n\nexport type TrackResult = { files: string[]; warnings: Warnings; componentId: ComponentID };\n\nexport type TrackData = {\n rootDir: PathOsBasedRelative | PathOsBasedAbsolute; // path relative to the workspace or absolute path\n componentName?: string; // if empty, it'll be generated from the path\n mainFile?: string; // if empty, attempts will be made to guess the best candidate\n defaultScope?: string; // can be entered as part of \"bit create\" command, helpful for out-of-sync logic\n config?: { [aspectName: string]: any }; // config specific to this component, which overrides variants of workspace.jsonc\n};\n\nexport class TrackerMain {\n constructor(\n private workspace: Workspace,\n private logger: Logger\n ) {}\n\n /**\n * add a new component to the .bitmap file.\n * this method only adds the records in memory but doesn't persist to the filesystem.\n * to write the .bitmap file once completed, run \"await this.bitMap.write();\"\n */\n async track(trackData: TrackData): Promise<TrackResult> {\n const defaultScope = trackData.defaultScope ? await this.addOwnerToScopeName(trackData.defaultScope) : undefined;\n const compPath = path.isAbsolute(trackData.rootDir)\n ? trackData.rootDir\n : path.join(this.workspace.path, trackData.rootDir);\n const addComponent = new AddComponents(\n { workspace: this.workspace },\n {\n componentPaths: [compPath],\n id: trackData.componentName,\n main: trackData.mainFile,\n override: false,\n defaultScope,\n config: trackData.config,\n }\n );\n const result = await addComponent.add();\n const addedComponent = result.addedComponents[0];\n const files = addedComponent?.files.map((f) => f.relativePath) || [];\n return { files, warnings: result.warnings, componentId: result.addedComponents[0].id };\n }\n\n async addForCLI(addProps: AddProps): Promise<AddActionResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const addContext: AddContext = { workspace: this.workspace };\n addProps.shouldHandleOutOfSync = true;\n if (addProps.env) {\n const config = {};\n await this.addEnvToConfig(addProps.env, config);\n addProps.config = config;\n }\n const addComponents = new AddComponents(addContext, addProps);\n const addResults = await addComponents.add();\n await this.workspace.consumer.onDestroy('add');\n\n return addResults;\n }\n\n async addEnvToConfig(env: string, config: { [aspectName: string]: any }) {\n const userEnvId = await this.workspace.resolveComponentId(env);\n let userEnvIdWithPotentialVersion: string;\n try {\n userEnvIdWithPotentialVersion = await this.workspace.resolveEnvIdWithPotentialVersionForConfig(userEnvId);\n } catch {\n // the env needs to be without version\n userEnvIdWithPotentialVersion = userEnvId.toStringWithoutVersion();\n }\n config[userEnvIdWithPotentialVersion] = {};\n config[EnvsAspect.id] = config[EnvsAspect.id] || {};\n config[EnvsAspect.id].env = userEnvId.toStringWithoutVersion();\n }\n\n /**\n * scopes in bit.dev are \"owner.collection\".\n * we might have the scope-name only without the owner and we need to retrieve it from the defaultScope in the\n * workspace.jsonc file.\n *\n * @param scopeName scopeName that might not have the owner part.\n * @returns full scope name\n */\n private async addOwnerToScopeName(scopeName: string): Promise<string> {\n if (scopeName.includes('.')) return scopeName; // it has owner.\n const isSelfHosted = !(await this.isHostedByBit(scopeName));\n if (isSelfHosted) return scopeName;\n const wsDefaultScope = this.workspace.defaultScope;\n if (!wsDefaultScope.includes('.')) {\n this.logger.warn(`the entered scope ${scopeName} has no owner nor the defaultScope in workspace.jsonc`);\n // it's possible that the user entered a non-exist scope just to test the command and will change it later.\n return scopeName;\n }\n const [owner] = wsDefaultScope.split('.');\n return `${owner}.${scopeName}`;\n }\n\n /**\n * whether a scope is hosted by Bit cloud.\n * otherwise, it is self-hosted\n */\n private async isHostedByBit(scopeName: string): Promise<boolean> {\n const remotes = await this.workspace.scope.getRemoteScopes();\n return remotes.isHub(scopeName);\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace, loggerMain]: [CLIMain, Workspace, LoggerMain]) {\n const logger = loggerMain.createLogger(TrackerAspect.id);\n const trackerMain = new TrackerMain(workspace, logger);\n cli.register(new AddCmd(trackerMain));\n return trackerMain;\n }\n}\n\nTrackerAspect.addRuntime(TrackerMain);\n\nexport default TrackerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,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SAAS,EAAE8D,UAAU,CAAmC,EAAE;IACpF,MAAM7D,MAAM,GAAG6D,UAAU,CAACC,YAAY,CAACC,wBAAa,CAACjD,EAAE,CAAC;IACxD,MAAMkD,WAAW,GAAG,IAAInE,WAAW,CAACE,SAAS,EAAEC,MAAM,CAAC;IACtD4D,GAAG,CAACK,QAAQ,CAAC,KAAIC,gBAAM,EAACF,WAAW,CAAC,CAAC;IACrC,OAAOA,WAAW;EACpB;AACF;AAACG,OAAA,CAAAtE,WAAA,GAAAA,WAAA;AAAAlB,eAAA,CAvGYkB,WAAW,WA8FP,EAAE;AAAAlB,eAAA,CA9FNkB,WAAW,kBA+FA,CAACuE,gBAAS,EAAEC,4BAAe,EAAEC,sBAAY,CAAC;AAAA3F,eAAA,CA/FrDkB,WAAW,aAgGL0E,kBAAW;AAS9BR,wBAAa,CAACS,UAAU,CAAC3E,WAAW,CAAC;AAAC,IAAA4E,QAAA,GAAAN,OAAA,CAAAzF,OAAA,GAEvBmB,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_path","_interopRequireDefault","_envs","_workspace","_logger","_addCmd","_addComponents","_interopRequireWildcard","_tracker","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","TrackerMain","constructor","workspace","logger","track","trackData","defaultScope","addOwnerToScopeName","undefined","compPath","path","isAbsolute","rootDir","join","addComponent","AddComponents","componentPaths","id","componentName","main","mainFile","override","config","result","add","addedComponent","addedComponents","files","map","f","relativePath","warnings","componentId","trackMany","manyTrackData","addMultipleFromResolvedTrackData","addForCLI","addProps","OutsideWorkspaceError","addContext","shouldHandleOutOfSync","env","addEnvToConfig","addComponents","addResults","consumer","onDestroy","userEnvId","resolveComponentId","userEnvIdWithPotentialVersion","resolveEnvIdWithPotentialVersionForConfig","toStringWithoutVersion","EnvsAspect","scopeName","includes","isSelfHosted","isHostedByBit","wsDefaultScope","warn","owner","split","remotes","scope","getRemoteScopes","isHub","provider","cli","loggerMain","createLogger","TrackerAspect","trackerMain","register","AddCmd","exports","CLIAspect","WorkspaceAspect","LoggerAspect","MainRuntime","addRuntime","_default"],"sources":["tracker.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport path from 'path';\nimport { ComponentID } from '@teambit/component-id';\nimport { EnvsAspect } from '@teambit/envs';\nimport { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { PathOsBasedRelative, PathOsBasedAbsolute, PathLinuxRelative } from '@teambit/legacy.utils';\nimport { AddCmd } from './add-cmd';\nimport AddComponents, { AddActionResults, AddContext, addMultipleFromResolvedTrackData, AddProps, Warnings } from './add-components';\nimport { TrackerAspect } from './tracker.aspect';\n\nexport type TrackResult = { files: string[]; warnings: Warnings; componentId: ComponentID };\n\n/**\n * this is for \"bit add\", where some data, such as \"componentName\" are not necessarily known\n */\nexport type TrackData = {\n rootDir: PathOsBasedRelative | PathOsBasedAbsolute; // path relative to the workspace or absolute path\n componentName?: string; // if empty, it'll be generated from the path\n mainFile?: string; // if empty, attempts will be made to guess the best candidate\n defaultScope?: string; // can be entered as part of \"bit create\" command, helpful for out-of-sync logic\n config?: { [aspectName: string]: any }; // config specific to this component, which overrides variants of workspace.jsonc\n};\n\n/**\n * this is for commands where we know all the data to enter into .bitmap, such as defaultScope, componentName and files.\n */\nexport type ResolvedTrackData = {\n rootDir: PathLinuxRelative; // path relative to the workspace\n componentName: string;\n mainFile: string;\n files: string[]; // component files relative to the component rootDir\n defaultScope: string;\n config?: { [aspectName: string]: any }; // config specific to this component, which overrides variants of workspace.jsonc\n};\n\nexport class TrackerMain {\n constructor(\n private workspace: Workspace,\n private logger: Logger\n ) {}\n\n /**\n * add a new component to the .bitmap file.\n * this method only adds the records in memory but doesn't persist to the filesystem.\n * to write the .bitmap file once completed, run \"await this.bitMap.write();\"\n */\n async track(trackData: TrackData): Promise<TrackResult> {\n const defaultScope = trackData.defaultScope ? await this.addOwnerToScopeName(trackData.defaultScope) : undefined;\n const compPath = path.isAbsolute(trackData.rootDir)\n ? trackData.rootDir\n : path.join(this.workspace.path, trackData.rootDir);\n const addComponent = new AddComponents(\n { workspace: this.workspace },\n {\n componentPaths: [compPath],\n id: trackData.componentName,\n main: trackData.mainFile,\n override: false,\n defaultScope,\n config: trackData.config,\n }\n );\n const result = await addComponent.add();\n const addedComponent = result.addedComponents[0];\n const files = addedComponent?.files.map((f) => f.relativePath) || [];\n return { files, warnings: result.warnings, componentId: result.addedComponents[0].id };\n }\n\n async trackMany(manyTrackData: ResolvedTrackData[]): Promise<ComponentID[]> {\n return addMultipleFromResolvedTrackData(this.workspace, manyTrackData);\n }\n\n async addForCLI(addProps: AddProps): Promise<AddActionResults> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const addContext: AddContext = { workspace: this.workspace };\n addProps.shouldHandleOutOfSync = true;\n if (addProps.env) {\n const config = {};\n await this.addEnvToConfig(addProps.env, config);\n addProps.config = config;\n }\n const addComponents = new AddComponents(addContext, addProps);\n const addResults = await addComponents.add();\n await this.workspace.consumer.onDestroy('add');\n\n return addResults;\n }\n\n async addEnvToConfig(env: string, config: { [aspectName: string]: any }) {\n const userEnvId = await this.workspace.resolveComponentId(env);\n let userEnvIdWithPotentialVersion: string;\n try {\n userEnvIdWithPotentialVersion = await this.workspace.resolveEnvIdWithPotentialVersionForConfig(userEnvId);\n } catch {\n // the env needs to be without version\n userEnvIdWithPotentialVersion = userEnvId.toStringWithoutVersion();\n }\n config[userEnvIdWithPotentialVersion] = {};\n config[EnvsAspect.id] = config[EnvsAspect.id] || {};\n config[EnvsAspect.id].env = userEnvId.toStringWithoutVersion();\n }\n\n /**\n * scopes in bit.dev are \"owner.collection\".\n * we might have the scope-name only without the owner and we need to retrieve it from the defaultScope in the\n * workspace.jsonc file.\n *\n * @param scopeName scopeName that might not have the owner part.\n * @returns full scope name\n */\n private async addOwnerToScopeName(scopeName: string): Promise<string> {\n if (scopeName.includes('.')) return scopeName; // it has owner.\n const isSelfHosted = !(await this.isHostedByBit(scopeName));\n if (isSelfHosted) return scopeName;\n const wsDefaultScope = this.workspace.defaultScope;\n if (!wsDefaultScope.includes('.')) {\n this.logger.warn(`the entered scope ${scopeName} has no owner nor the defaultScope in workspace.jsonc`);\n // it's possible that the user entered a non-exist scope just to test the command and will change it later.\n return scopeName;\n }\n const [owner] = wsDefaultScope.split('.');\n return `${owner}.${scopeName}`;\n }\n\n /**\n * whether a scope is hosted by Bit cloud.\n * otherwise, it is self-hosted\n */\n private async isHostedByBit(scopeName: string): Promise<boolean> {\n const remotes = await this.workspace.scope.getRemoteScopes();\n return remotes.isHub(scopeName);\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace, loggerMain]: [CLIMain, Workspace, LoggerMain]) {\n const logger = loggerMain.createLogger(TrackerAspect.id);\n const trackerMain = new TrackerMain(workspace, logger);\n cli.register(new AddCmd(trackerMain));\n return trackerMain;\n }\n}\n\nTrackerAspect.addRuntime(TrackerMain);\n\nexport default TrackerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OA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iE,UAAU,CAAmC,EAAE;IACpF,MAAMhE,MAAM,GAAGgE,UAAU,CAACC,YAAY,CAACC,wBAAa,CAACpD,EAAE,CAAC;IACxD,MAAMqD,WAAW,GAAG,IAAItE,WAAW,CAACE,SAAS,EAAEC,MAAM,CAAC;IACtD+D,GAAG,CAACK,QAAQ,CAAC,KAAIC,gBAAM,EAACF,WAAW,CAAC,CAAC;IACrC,OAAOA,WAAW;EACpB;AACF;AAACG,OAAA,CAAAzE,WAAA,GAAAA,WAAA;AAAAZ,eAAA,CA3GYY,WAAW,WAkGP,EAAE;AAAAZ,eAAA,CAlGNY,WAAW,kBAmGA,CAAC0E,gBAAS,EAAEC,4BAAe,EAAEC,sBAAY,CAAC;AAAAxF,eAAA,CAnGrDY,WAAW,aAoGL6E,kBAAW;AAS9BR,wBAAa,CAACS,UAAU,CAAC9E,WAAW,CAAC;AAAC,IAAA+E,QAAA,GAAAN,OAAA,CAAAnG,OAAA,GAEvB0B,WAAW","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/tracker",
3
- "version": "1.0.583",
3
+ "version": "1.0.585",
4
4
  "homepage": "https://bit.cloud/teambit/component/tracker",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "tracker",
9
- "version": "1.0.583"
9
+ "version": "1.0.585"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -20,17 +20,17 @@
20
20
  "@teambit/component-id": "1.2.3",
21
21
  "@teambit/legacy-bit-id": "1.1.2",
22
22
  "@teambit/harmony": "0.4.7",
23
- "@teambit/cli": "0.0.1160",
23
+ "@teambit/cli": "0.0.1162",
24
24
  "@teambit/legacy.utils": "0.0.19",
25
25
  "@teambit/legacy.analytics": "0.0.73",
26
- "@teambit/legacy.bit-map": "0.0.102",
26
+ "@teambit/legacy.bit-map": "0.0.103",
27
27
  "@teambit/legacy.constants": "0.0.11",
28
- "@teambit/legacy.consumer": "0.0.45",
28
+ "@teambit/legacy.consumer": "0.0.46",
29
29
  "@teambit/legacy.logger": "0.0.17",
30
- "@teambit/workspace.modules.node-modules-linker": "0.0.273",
31
- "@teambit/workspace": "1.0.583",
32
- "@teambit/envs": "1.0.583",
33
- "@teambit/logger": "0.0.1253"
30
+ "@teambit/workspace.modules.node-modules-linker": "0.0.274",
31
+ "@teambit/workspace": "1.0.585",
32
+ "@teambit/envs": "1.0.585",
33
+ "@teambit/logger": "0.0.1255"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/fs-extra": "9.0.7",