@teambit/component-writer 0.0.13 → 0.0.14
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/component-writer.main.runtime.d.ts +2 -1
- package/dist/component-writer.main.runtime.js +10 -15
- package/dist/component-writer.main.runtime.js.map +1 -1
- package/dist/{preview-1675679798116.js → preview-1675752700186.js} +0 -0
- package/package-tar/teambit-component-writer-0.0.14.tgz +0 -0
- package/package.json +9 -10
- package/package-tar/teambit-component-writer-0.0.13.tgz +0 -0
|
@@ -16,6 +16,7 @@ export interface ManyComponentsWriterParams {
|
|
|
16
16
|
}
|
|
17
17
|
export declare type ComponentWriterResults = {
|
|
18
18
|
installationError?: Error;
|
|
19
|
+
compilationError?: Error;
|
|
19
20
|
};
|
|
20
21
|
export declare class ComponentWriterMain {
|
|
21
22
|
private installer;
|
|
@@ -27,7 +28,7 @@ export declare class ComponentWriterMain {
|
|
|
27
28
|
get consumer(): Consumer;
|
|
28
29
|
writeMany(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults>;
|
|
29
30
|
private installPackagesGracefully;
|
|
30
|
-
private
|
|
31
|
+
private compileGracefully;
|
|
31
32
|
private persistComponentsData;
|
|
32
33
|
private populateComponentsFilesToWrite;
|
|
33
34
|
/**
|
|
@@ -49,13 +49,6 @@ function _workspace() {
|
|
|
49
49
|
};
|
|
50
50
|
return data;
|
|
51
51
|
}
|
|
52
|
-
function _bitError() {
|
|
53
|
-
const data = require("@teambit/bit-error");
|
|
54
|
-
_bitError = function () {
|
|
55
|
-
return data;
|
|
56
|
-
};
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
52
|
function _fsExtra() {
|
|
60
53
|
const data = _interopRequireDefault(require("fs-extra"));
|
|
61
54
|
_fsExtra = function () {
|
|
@@ -147,15 +140,17 @@ class ComponentWriterMain {
|
|
|
147
140
|
this.moveComponentsIfNeeded(opts);
|
|
148
141
|
await this.persistComponentsData(opts);
|
|
149
142
|
let installationError;
|
|
143
|
+
let compilationError;
|
|
150
144
|
if (!opts.skipDependencyInstallation) {
|
|
151
145
|
installationError = await this.installPackagesGracefully();
|
|
152
|
-
|
|
146
|
+
// no point to compile if the installation is not running. the environment is not ready.
|
|
147
|
+
compilationError = await this.compileGracefully();
|
|
153
148
|
}
|
|
154
|
-
|
|
155
149
|
await this.consumer.writeBitMap();
|
|
156
150
|
this.logger.debug('writeMany, completed!');
|
|
157
151
|
return {
|
|
158
|
-
installationError
|
|
152
|
+
installationError,
|
|
153
|
+
compilationError
|
|
159
154
|
};
|
|
160
155
|
}
|
|
161
156
|
async installPackagesGracefully() {
|
|
@@ -175,14 +170,14 @@ class ComponentWriterMain {
|
|
|
175
170
|
return err;
|
|
176
171
|
}
|
|
177
172
|
}
|
|
178
|
-
async
|
|
173
|
+
async compileGracefully() {
|
|
179
174
|
try {
|
|
180
175
|
await this.compiler.compileOnWorkspace();
|
|
176
|
+
return undefined;
|
|
181
177
|
} catch (err) {
|
|
182
|
-
this.logger.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
please use the '--log=error' flag for the full error.`);
|
|
178
|
+
this.logger.consoleFailure(`compilation failed with the following error: ${err.message}`);
|
|
179
|
+
this.logger.error('compileGracefully, compiler found an error', err);
|
|
180
|
+
return err;
|
|
186
181
|
}
|
|
187
182
|
}
|
|
188
183
|
async persistComponentsData(opts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentWriterMain","constructor","installer","compiler","workspace","logger","mover","consumer","writeMany","opts","debug","populateComponentsFilesToWrite","moveComponentsIfNeeded","persistComponentsData","installationError","skipDependencyInstallation","installPackagesGracefully","compile","writeBitMap","installOpts","dedupe","updateExisting","import","install","undefined","err","consoleFailure","message","error","compileOnWorkspace","BitError","dataToPersist","DataToPersist","componentsWithDependencies","forEach","componentWithDeps","allComponents","component","allDependencies","merge","componentsConfig","config","hasChanged","jsonFiles","toVinyl","getPath","addManyFiles","addBasePath","persistAllToFS","writeComponentsParams","map","getWriteParamsOfOneComponent","componentWriterInstances","writeParams","ComponentWriter","fixDirsIfNested","componentWriter","existingComponentMap","addComponentToBitMap","writeToPath","resetConfig","mapSeries","allDirs","c","parentsOfOthersComps","filter","find","d","startsWith","length","parentsOfOthersCompsDirs","incrementPath","p","number","existingRootDirs","Object","keys","bitMap","getAllTrackDirs","allPaths","incrementRecursively","num","newPath","includes","componentRootDir","pathNormalizeToLinux","getPathRelativeToConsumer","path","resolve","composeRelativeComponentPath","id","getParams","componentMap","getComponentIfExist","ignoreVersion","throwErrorWhenDirectoryNotEmpty","toAbsolutePath","writeConfig","rootDir","GeneralError","relativeWrittenPath","writtenPath","absoluteWrittenPath","absoluteWriteToPath","moveExistingComponent","componentDir","fs","pathExistsSync","isDir","isDirEmptySync","throwForExistingDir","provider","loggerMain","createLogger","ComponentWriterAspect","InstallAspect","CompilerAspect","LoggerAspect","WorkspaceAspect","MoverAspect","MainRuntime","addRuntime"],"sources":["component-writer.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport InstallAspect, { InstallMain } from '@teambit/install';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport fs from 'fs-extra';\nimport mapSeries from 'p-map-series';\nimport * as path from 'path';\nimport MoverAspect, { MoverMain } from '@teambit/mover';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { ComponentWithDependencies } from '@teambit/legacy/dist/scope';\nimport { isDir, isDirEmptySync } from '@teambit/legacy/dist/utils';\nimport { PathLinuxRelative, pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport Consumer from '@teambit/legacy/dist/consumer/consumer';\nimport ComponentWriter, { ComponentWriterProps } from './component-writer';\nimport { ComponentWriterAspect } from './component-writer.aspect';\n\nexport interface ManyComponentsWriterParams {\n componentsWithDependencies: ComponentWithDependencies[];\n writeToPath?: string;\n throwForExistingDir?: boolean;\n writeConfig?: boolean;\n skipDependencyInstallation?: boolean;\n verbose?: boolean;\n resetConfig?: boolean;\n}\n\nexport type ComponentWriterResults = { installationError?: Error };\n\nexport class ComponentWriterMain {\n constructor(\n private installer: InstallMain,\n private compiler: CompilerMain,\n private workspace: Workspace,\n private logger: Logger,\n private mover: MoverMain\n ) {}\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async writeMany(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults> {\n this.logger.debug('writeMany, started');\n await this.populateComponentsFilesToWrite(opts);\n this.moveComponentsIfNeeded(opts);\n await this.persistComponentsData(opts);\n let installationError: Error | undefined;\n if (!opts.skipDependencyInstallation) {\n installationError = await this.installPackagesGracefully();\n await this.compile(); // no point to compile if the installation is not running. the environment is not ready.\n }\n await this.consumer.writeBitMap();\n this.logger.debug('writeMany, completed!');\n return { installationError };\n }\n\n private async installPackagesGracefully() {\n this.logger.debug('installPackagesGracefully, start installing packages');\n try {\n const installOpts = {\n dedupe: true,\n updateExisting: false,\n import: false,\n };\n await this.installer.install(undefined, installOpts);\n this.logger.debug('installPackagesGracefully, completed installing packages successfully');\n return undefined;\n } catch (err: any) {\n this.logger.consoleFailure(`installation failed with the following error: ${err.message}`);\n this.logger.error('installPackagesGracefully, package-installer found an error', err);\n return err;\n }\n }\n private async compile() {\n try {\n await this.compiler.compileOnWorkspace();\n } catch (err: any) {\n this.logger.error('compile, compiler found an error', err);\n throw new BitError(`failed compiling the components. please run \"bit compile\" once the issue is fixed\nerror from the compiler: ${err.message}.\nplease use the '--log=error' flag for the full error.`);\n }\n }\n private async persistComponentsData(opts: ManyComponentsWriterParams) {\n const dataToPersist = new DataToPersist();\n opts.componentsWithDependencies.forEach((componentWithDeps) => {\n const allComponents = [componentWithDeps.component, ...componentWithDeps.allDependencies];\n allComponents.forEach((component) => dataToPersist.merge(component.dataToPersist));\n });\n const componentsConfig = this.consumer?.config?.componentsConfig;\n if (componentsConfig?.hasChanged) {\n const jsonFiles = await this.consumer?.config.toVinyl(this.consumer.getPath());\n if (jsonFiles) {\n dataToPersist.addManyFiles(jsonFiles);\n }\n }\n dataToPersist.addBasePath(this.consumer.getPath());\n await dataToPersist.persistAllToFS();\n }\n private async populateComponentsFilesToWrite(opts: ManyComponentsWriterParams) {\n const writeComponentsParams = opts.componentsWithDependencies.map((componentWithDeps: ComponentWithDependencies) =>\n this.getWriteParamsOfOneComponent(componentWithDeps, opts)\n );\n const componentWriterInstances = writeComponentsParams.map((writeParams) => new ComponentWriter(writeParams));\n this.fixDirsIfNested(componentWriterInstances);\n // add componentMap entries into .bitmap before starting the process because steps like writing package-json\n // rely on .bitmap to determine whether a dependency exists and what's its origin\n componentWriterInstances.forEach((componentWriter: ComponentWriter) => {\n componentWriter.existingComponentMap =\n componentWriter.existingComponentMap || componentWriter.addComponentToBitMap(componentWriter.writeToPath);\n });\n if (opts.resetConfig) {\n componentWriterInstances.forEach((componentWriter: ComponentWriter) => {\n delete componentWriter.existingComponentMap?.config;\n });\n }\n await mapSeries(componentWriterInstances, (componentWriter: ComponentWriter) =>\n componentWriter.populateComponentsFilesToWrite()\n );\n }\n /**\n * e.g. [bar, bar/foo] => [bar_1, bar/foo]\n * otherwise, the bar/foo component will be saved inside \"bar\" component.\n * in case bar_1 is taken, increment to bar_2 until the name is available.\n */\n private fixDirsIfNested(componentWriterInstances: ComponentWriter[]) {\n const allDirs = componentWriterInstances.map((c) => c.writeToPath);\n\n // get all components that their root-dir is a parent of other components root-dir.\n const parentsOfOthersComps = componentWriterInstances.filter(({ writeToPath }) =>\n allDirs.find((d) => d.startsWith(`${writeToPath}/`))\n );\n if (!parentsOfOthersComps.length) {\n return;\n }\n const parentsOfOthersCompsDirs = parentsOfOthersComps.map((c) => c.writeToPath);\n\n const incrementPath = (p: string, number: number) => `${p}_${number}`;\n const existingRootDirs = Object.keys(this.consumer.bitMap.getAllTrackDirs());\n const allPaths: PathLinuxRelative[] = [...existingRootDirs, ...parentsOfOthersCompsDirs];\n const incrementRecursively = (p: string) => {\n let num = 1;\n let newPath = incrementPath(p, num);\n while (allPaths.includes(newPath)) {\n newPath = incrementPath(p, (num += 1));\n }\n return newPath;\n };\n\n // change the paths of all these parents root-dir to not collide with the children root-dir\n parentsOfOthersComps.forEach((componentWriter) => {\n if (existingRootDirs.includes(componentWriter.writeToPath)) return; // component already exists.\n const newPath = incrementRecursively(componentWriter.writeToPath);\n componentWriter.writeToPath = newPath;\n });\n }\n\n private getWriteParamsOfOneComponent(\n componentWithDeps: ComponentWithDependencies,\n opts: ManyComponentsWriterParams\n ): ComponentWriterProps {\n const componentRootDir: PathLinuxRelative = opts.writeToPath\n ? pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(path.resolve(opts.writeToPath)))\n : this.consumer.composeRelativeComponentPath(componentWithDeps.component.id);\n const getParams = () => {\n if (!this.consumer) {\n return {};\n }\n // components can't be saved with multiple versions, so we can ignore the version to find the component in bit.map\n const componentMap = this.consumer.bitMap.getComponentIfExist(componentWithDeps.component.id, {\n ignoreVersion: true,\n });\n this.throwErrorWhenDirectoryNotEmpty(this.consumer.toAbsolutePath(componentRootDir), componentMap, opts);\n return {\n existingComponentMap: componentMap,\n };\n };\n return {\n consumer: this.consumer,\n bitMap: this.consumer.bitMap,\n component: componentWithDeps.component,\n writeToPath: componentRootDir,\n writeConfig: opts.writeConfig,\n ...getParams(),\n };\n }\n private moveComponentsIfNeeded(opts: ManyComponentsWriterParams) {\n if (opts.writeToPath && this.consumer) {\n opts.componentsWithDependencies.forEach((componentWithDeps) => {\n // @ts-ignore componentWithDeps.component.componentMap is set\n const componentMap: ComponentMap = componentWithDeps.component.componentMap;\n if (!componentMap.rootDir) {\n throw new GeneralError(`unable to use \"--path\" flag.\nto move individual files, use bit move.\nto move all component files to a different directory, run bit remove and then bit import --path`);\n }\n const relativeWrittenPath = componentWithDeps.component.writtenPath;\n // @ts-ignore relativeWrittenPath is set at this point\n const absoluteWrittenPath = this.consumer.toAbsolutePath(relativeWrittenPath);\n // @ts-ignore this.writeToPath is set at this point\n const absoluteWriteToPath = path.resolve(opts.writeToPath); // don't use consumer.toAbsolutePath, it might be an inner dir\n if (relativeWrittenPath && absoluteWrittenPath !== absoluteWriteToPath) {\n const component = componentWithDeps.component;\n this.mover.moveExistingComponent(component, absoluteWrittenPath, absoluteWriteToPath);\n }\n });\n }\n }\n private throwErrorWhenDirectoryNotEmpty(\n componentDir: PathOsBasedAbsolute,\n componentMap: ComponentMap | null | undefined,\n opts: ManyComponentsWriterParams\n ) {\n // if not writeToPath specified, it goes to the default directory. When componentMap exists, the\n // component is not new, and it's ok to override the existing directory.\n if (!opts.writeToPath && componentMap) return;\n // if writeToPath specified and that directory is already used for that component, it's ok to override\n if (opts.writeToPath && componentMap && componentMap.rootDir && componentMap.rootDir === opts.writeToPath) return;\n\n if (fs.pathExistsSync(componentDir)) {\n if (!isDir(componentDir)) {\n throw new GeneralError(`unable to import to ${componentDir} because it's a file`);\n }\n if (!isDirEmptySync(componentDir) && opts.throwForExistingDir) {\n throw new GeneralError(\n `unable to import to ${componentDir}, the directory is not empty. use --override flag to delete the directory and then import`\n );\n }\n }\n }\n\n static slots = [];\n static dependencies = [InstallAspect, CompilerAspect, LoggerAspect, WorkspaceAspect, MoverAspect];\n static runtime = MainRuntime;\n static async provider([install, compiler, loggerMain, workspace, mover]: [\n InstallMain,\n CompilerMain,\n LoggerMain,\n Workspace,\n MoverMain\n ]) {\n const logger = loggerMain.createLogger(ComponentWriterAspect.id);\n return new ComponentWriterMain(install, compiler, workspace, logger, mover);\n }\n}\n\nComponentWriterAspect.addRuntime(ComponentWriterMain);\n\nexport default ComponentWriterMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;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iler","workspace","logger","mover","consumer","writeMany","opts","debug","populateComponentsFilesToWrite","moveComponentsIfNeeded","persistComponentsData","installationError","compilationError","skipDependencyInstallation","installPackagesGracefully","compileGracefully","writeBitMap","installOpts","dedupe","updateExisting","import","install","undefined","err","consoleFailure","message","error","compileOnWorkspace","dataToPersist","DataToPersist","componentsWithDependencies","forEach","componentWithDeps","allComponents","component","allDependencies","merge","componentsConfig","config","hasChanged","jsonFiles","toVinyl","getPath","addManyFiles","addBasePath","persistAllToFS","writeComponentsParams","map","getWriteParamsOfOneComponent","componentWriterInstances","writeParams","ComponentWriter","fixDirsIfNested","componentWriter","existingComponentMap","addComponentToBitMap","writeToPath","resetConfig","mapSeries","allDirs","c","parentsOfOthersComps","filter","find","d","startsWith","length","parentsOfOthersCompsDirs","incrementPath","p","number","existingRootDirs","Object","keys","bitMap","getAllTrackDirs","allPaths","incrementRecursively","num","newPath","includes","componentRootDir","pathNormalizeToLinux","getPathRelativeToConsumer","path","resolve","composeRelativeComponentPath","id","getParams","componentMap","getComponentIfExist","ignoreVersion","throwErrorWhenDirectoryNotEmpty","toAbsolutePath","writeConfig","rootDir","GeneralError","relativeWrittenPath","writtenPath","absoluteWrittenPath","absoluteWriteToPath","moveExistingComponent","componentDir","fs","pathExistsSync","isDir","isDirEmptySync","throwForExistingDir","provider","loggerMain","createLogger","ComponentWriterAspect","InstallAspect","CompilerAspect","LoggerAspect","WorkspaceAspect","MoverAspect","MainRuntime","addRuntime"],"sources":["component-writer.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport InstallAspect, { InstallMain } from '@teambit/install';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport fs from 'fs-extra';\nimport mapSeries from 'p-map-series';\nimport * as path from 'path';\nimport MoverAspect, { MoverMain } from '@teambit/mover';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { ComponentWithDependencies } from '@teambit/legacy/dist/scope';\nimport { isDir, isDirEmptySync } from '@teambit/legacy/dist/utils';\nimport { PathLinuxRelative, pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport Consumer from '@teambit/legacy/dist/consumer/consumer';\nimport ComponentWriter, { ComponentWriterProps } from './component-writer';\nimport { ComponentWriterAspect } from './component-writer.aspect';\n\nexport interface ManyComponentsWriterParams {\n componentsWithDependencies: ComponentWithDependencies[];\n writeToPath?: string;\n throwForExistingDir?: boolean;\n writeConfig?: boolean;\n skipDependencyInstallation?: boolean;\n verbose?: boolean;\n resetConfig?: boolean;\n}\n\nexport type ComponentWriterResults = { installationError?: Error; compilationError?: Error };\n\nexport class ComponentWriterMain {\n constructor(\n private installer: InstallMain,\n private compiler: CompilerMain,\n private workspace: Workspace,\n private logger: Logger,\n private mover: MoverMain\n ) {}\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async writeMany(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults> {\n this.logger.debug('writeMany, started');\n await this.populateComponentsFilesToWrite(opts);\n this.moveComponentsIfNeeded(opts);\n await this.persistComponentsData(opts);\n let installationError: Error | undefined;\n let compilationError: Error | undefined;\n if (!opts.skipDependencyInstallation) {\n installationError = await this.installPackagesGracefully();\n // no point to compile if the installation is not running. the environment is not ready.\n compilationError = await this.compileGracefully();\n }\n await this.consumer.writeBitMap();\n this.logger.debug('writeMany, completed!');\n return { installationError, compilationError };\n }\n\n private async installPackagesGracefully(): Promise<Error | undefined> {\n this.logger.debug('installPackagesGracefully, start installing packages');\n try {\n const installOpts = {\n dedupe: true,\n updateExisting: false,\n import: false,\n };\n await this.installer.install(undefined, installOpts);\n this.logger.debug('installPackagesGracefully, completed installing packages successfully');\n return undefined;\n } catch (err: any) {\n this.logger.consoleFailure(`installation failed with the following error: ${err.message}`);\n this.logger.error('installPackagesGracefully, package-installer found an error', err);\n return err;\n }\n }\n private async compileGracefully(): Promise<Error | undefined> {\n try {\n await this.compiler.compileOnWorkspace();\n return undefined;\n } catch (err: any) {\n this.logger.consoleFailure(`compilation failed with the following error: ${err.message}`);\n this.logger.error('compileGracefully, compiler found an error', err);\n return err;\n }\n }\n private async persistComponentsData(opts: ManyComponentsWriterParams) {\n const dataToPersist = new DataToPersist();\n opts.componentsWithDependencies.forEach((componentWithDeps) => {\n const allComponents = [componentWithDeps.component, ...componentWithDeps.allDependencies];\n allComponents.forEach((component) => dataToPersist.merge(component.dataToPersist));\n });\n const componentsConfig = this.consumer?.config?.componentsConfig;\n if (componentsConfig?.hasChanged) {\n const jsonFiles = await this.consumer?.config.toVinyl(this.consumer.getPath());\n if (jsonFiles) {\n dataToPersist.addManyFiles(jsonFiles);\n }\n }\n dataToPersist.addBasePath(this.consumer.getPath());\n await dataToPersist.persistAllToFS();\n }\n private async populateComponentsFilesToWrite(opts: ManyComponentsWriterParams) {\n const writeComponentsParams = opts.componentsWithDependencies.map((componentWithDeps: ComponentWithDependencies) =>\n this.getWriteParamsOfOneComponent(componentWithDeps, opts)\n );\n const componentWriterInstances = writeComponentsParams.map((writeParams) => new ComponentWriter(writeParams));\n this.fixDirsIfNested(componentWriterInstances);\n // add componentMap entries into .bitmap before starting the process because steps like writing package-json\n // rely on .bitmap to determine whether a dependency exists and what's its origin\n componentWriterInstances.forEach((componentWriter: ComponentWriter) => {\n componentWriter.existingComponentMap =\n componentWriter.existingComponentMap || componentWriter.addComponentToBitMap(componentWriter.writeToPath);\n });\n if (opts.resetConfig) {\n componentWriterInstances.forEach((componentWriter: ComponentWriter) => {\n delete componentWriter.existingComponentMap?.config;\n });\n }\n await mapSeries(componentWriterInstances, (componentWriter: ComponentWriter) =>\n componentWriter.populateComponentsFilesToWrite()\n );\n }\n /**\n * e.g. [bar, bar/foo] => [bar_1, bar/foo]\n * otherwise, the bar/foo component will be saved inside \"bar\" component.\n * in case bar_1 is taken, increment to bar_2 until the name is available.\n */\n private fixDirsIfNested(componentWriterInstances: ComponentWriter[]) {\n const allDirs = componentWriterInstances.map((c) => c.writeToPath);\n\n // get all components that their root-dir is a parent of other components root-dir.\n const parentsOfOthersComps = componentWriterInstances.filter(({ writeToPath }) =>\n allDirs.find((d) => d.startsWith(`${writeToPath}/`))\n );\n if (!parentsOfOthersComps.length) {\n return;\n }\n const parentsOfOthersCompsDirs = parentsOfOthersComps.map((c) => c.writeToPath);\n\n const incrementPath = (p: string, number: number) => `${p}_${number}`;\n const existingRootDirs = Object.keys(this.consumer.bitMap.getAllTrackDirs());\n const allPaths: PathLinuxRelative[] = [...existingRootDirs, ...parentsOfOthersCompsDirs];\n const incrementRecursively = (p: string) => {\n let num = 1;\n let newPath = incrementPath(p, num);\n while (allPaths.includes(newPath)) {\n newPath = incrementPath(p, (num += 1));\n }\n return newPath;\n };\n\n // change the paths of all these parents root-dir to not collide with the children root-dir\n parentsOfOthersComps.forEach((componentWriter) => {\n if (existingRootDirs.includes(componentWriter.writeToPath)) return; // component already exists.\n const newPath = incrementRecursively(componentWriter.writeToPath);\n componentWriter.writeToPath = newPath;\n });\n }\n\n private getWriteParamsOfOneComponent(\n componentWithDeps: ComponentWithDependencies,\n opts: ManyComponentsWriterParams\n ): ComponentWriterProps {\n const componentRootDir: PathLinuxRelative = opts.writeToPath\n ? pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(path.resolve(opts.writeToPath)))\n : this.consumer.composeRelativeComponentPath(componentWithDeps.component.id);\n const getParams = () => {\n if (!this.consumer) {\n return {};\n }\n // components can't be saved with multiple versions, so we can ignore the version to find the component in bit.map\n const componentMap = this.consumer.bitMap.getComponentIfExist(componentWithDeps.component.id, {\n ignoreVersion: true,\n });\n this.throwErrorWhenDirectoryNotEmpty(this.consumer.toAbsolutePath(componentRootDir), componentMap, opts);\n return {\n existingComponentMap: componentMap,\n };\n };\n return {\n consumer: this.consumer,\n bitMap: this.consumer.bitMap,\n component: componentWithDeps.component,\n writeToPath: componentRootDir,\n writeConfig: opts.writeConfig,\n ...getParams(),\n };\n }\n private moveComponentsIfNeeded(opts: ManyComponentsWriterParams) {\n if (opts.writeToPath && this.consumer) {\n opts.componentsWithDependencies.forEach((componentWithDeps) => {\n // @ts-ignore componentWithDeps.component.componentMap is set\n const componentMap: ComponentMap = componentWithDeps.component.componentMap;\n if (!componentMap.rootDir) {\n throw new GeneralError(`unable to use \"--path\" flag.\nto move individual files, use bit move.\nto move all component files to a different directory, run bit remove and then bit import --path`);\n }\n const relativeWrittenPath = componentWithDeps.component.writtenPath;\n // @ts-ignore relativeWrittenPath is set at this point\n const absoluteWrittenPath = this.consumer.toAbsolutePath(relativeWrittenPath);\n // @ts-ignore this.writeToPath is set at this point\n const absoluteWriteToPath = path.resolve(opts.writeToPath); // don't use consumer.toAbsolutePath, it might be an inner dir\n if (relativeWrittenPath && absoluteWrittenPath !== absoluteWriteToPath) {\n const component = componentWithDeps.component;\n this.mover.moveExistingComponent(component, absoluteWrittenPath, absoluteWriteToPath);\n }\n });\n }\n }\n private throwErrorWhenDirectoryNotEmpty(\n componentDir: PathOsBasedAbsolute,\n componentMap: ComponentMap | null | undefined,\n opts: ManyComponentsWriterParams\n ) {\n // if not writeToPath specified, it goes to the default directory. When componentMap exists, the\n // component is not new, and it's ok to override the existing directory.\n if (!opts.writeToPath && componentMap) return;\n // if writeToPath specified and that directory is already used for that component, it's ok to override\n if (opts.writeToPath && componentMap && componentMap.rootDir && componentMap.rootDir === opts.writeToPath) return;\n\n if (fs.pathExistsSync(componentDir)) {\n if (!isDir(componentDir)) {\n throw new GeneralError(`unable to import to ${componentDir} because it's a file`);\n }\n if (!isDirEmptySync(componentDir) && opts.throwForExistingDir) {\n throw new GeneralError(\n `unable to import to ${componentDir}, the directory is not empty. use --override flag to delete the directory and then import`\n );\n }\n }\n }\n\n static slots = [];\n static dependencies = [InstallAspect, CompilerAspect, LoggerAspect, WorkspaceAspect, MoverAspect];\n static runtime = MainRuntime;\n static async provider([install, compiler, loggerMain, workspace, mover]: [\n InstallMain,\n CompilerMain,\n LoggerMain,\n Workspace,\n MoverMain\n ]) {\n const logger = loggerMain.createLogger(ComponentWriterAspect.id);\n return new ComponentWriterMain(install, compiler, workspace, logger, mover);\n }\n}\n\nComponentWriterAspect.addRuntime(ComponentWriterMain);\n\nexport default ComponentWriterMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAkE;AAAA;AAAA;AAAA;AAc3D,MAAMA,mBAAmB,CAAC;EAC/BC,WAAW,CACDC,SAAsB,EACtBC,QAAsB,EACtBC,SAAoB,EACpBC,MAAc,EACdC,KAAgB,EACxB;IAAA,KALQJ,SAAsB,GAAtBA,SAAsB;IAAA,KACtBC,QAAsB,GAAtBA,QAAsB;IAAA,KACtBC,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,MAAc,GAAdA,MAAc;IAAA,KACdC,KAAgB,GAAhBA,KAA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,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,CAAC;EAC7E;AACF;AAAC;AAAA,gCA1NYN,mBAAmB,WA6Mf,EAAE;AAAA,gCA7MNA,mBAAmB,kBA8MR,CAACmH,kBAAa,EAAEC,0BAAc,EAAEC,sBAAY,EAAEC,oBAAe,EAAEC,gBAAW,CAAC;AAAA,gCA9MtFvH,mBAAmB,aA+MbwH,kBAAW;AAa9BN,yCAAqB,CAACO,UAAU,CAACzH,mBAAmB,CAAC;AAAC,eAEvCA,mBAAmB;AAAA"}
|
|
File without changes
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component-writer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/component/component-writer",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component-writer",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.14"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"fs-extra": "10.0.0",
|
|
@@ -14,13 +14,12 @@
|
|
|
14
14
|
"core-js": "^3.0.0",
|
|
15
15
|
"@babel/runtime": "7.20.0",
|
|
16
16
|
"@teambit/harmony": "0.4.6",
|
|
17
|
-
"@teambit/
|
|
18
|
-
"@teambit/
|
|
19
|
-
"@teambit/
|
|
20
|
-
"@teambit/
|
|
21
|
-
"@teambit/
|
|
22
|
-
"@teambit/
|
|
23
|
-
"@teambit/workspace": "0.0.977"
|
|
17
|
+
"@teambit/cli": "0.0.657",
|
|
18
|
+
"@teambit/compiler": "0.0.978",
|
|
19
|
+
"@teambit/install": "0.0.104",
|
|
20
|
+
"@teambit/logger": "0.0.750",
|
|
21
|
+
"@teambit/mover": "0.0.9",
|
|
22
|
+
"@teambit/workspace": "0.0.978"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
25
|
"@types/fs-extra": "9.0.7",
|
|
@@ -32,7 +31,7 @@
|
|
|
32
31
|
"@types/testing-library__jest-dom": "5.9.5"
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
35
|
-
"@teambit/legacy": "1.0.
|
|
34
|
+
"@teambit/legacy": "1.0.439",
|
|
36
35
|
"react": "^16.8.0 || ^17.0.0",
|
|
37
36
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
38
37
|
},
|
|
Binary file
|