@teambit/workspace-config-files 0.0.3 → 0.0.4
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/config-writer-entry.js.map +1 -1
- package/dist/dedup-paths.spec.js.map +1 -1
- package/dist/format-outputs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{preview-1679887855248.js → preview-1679974224627.js} +1 -1
- package/dist/workspace-config-files.aspect.js.map +1 -1
- package/dist/workspace-config-files.docs.mdx +2 -1
- package/dist/workspace-config-files.main.runtime.js.map +1 -1
- package/dist/ws-config.cmd.js.map +1 -1
- package/package-tar/teambit-workspace-config-files-0.0.4.tgz +0 -0
- package/package.json +7 -7
- package/workspace-config-files.docs.mdx +2 -1
- package/package-tar/teambit-workspace-config-files-0.0.3.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["config-writer-entry.ts"],"sourcesContent":["import { Environment, ExecutionContext } from '@teambit/envs';\nimport {
|
|
1
|
+
{"version":3,"names":[],"sources":["config-writer-entry.ts"],"sourcesContent":["import { Environment, ExecutionContext } from '@teambit/envs';\nimport {\n EnvCompsDirsMap,\n EnvMapValue,\n EnvsWrittenExtendingConfigFiles,\n WrittenConfigFile,\n} from './workspace-config-files.main.runtime';\n\nexport type ConfigFile = {\n /**\n * Name of the config file.\n * supports also using `{hash}` in the name, which will be replaced by the hash of the config file.\n */\n name: string;\n /**\n * Content of the config file.\n * I.E the content of the tsconfig.json file.\n */\n content: string;\n /**\n * Hash of the config file.\n */\n hash?: string;\n};\n\nexport type ExtendingConfigFile = ConfigFile & {\n /**\n * Name of the config file that this config file extends.\n */\n extendingTarget: string;\n};\n\nexport type PostProcessExtendingConfigFilesArgs = {\n workspaceDir: string;\n configsRootDir: string;\n writtenExtendingConfigFiles: EnvsWrittenExtendingConfigFiles;\n envCompsDirsMap: EnvCompsDirsMap;\n dryRun: boolean;\n};\n\nexport type PostProcessConfigFilesOptions = {\n dryRun: boolean;\n};\n\nexport interface ConfigWriterEntry {\n /**\n * Name of the config writer.\n * used for outputs and logging.\n */\n name: string;\n\n /**\n * Name that is used to filter the config writer by the cli when using --writers flag.\n */\n cliName: string;\n\n /**\n * Get's the component env and return the config file content\n * for example the eslint config to tsconfig.\n * This also enable to return a hash of the config file, which will be used to determine if\n * 2 config files are the same.\n * If the hash is not provided, the content will be used as the hash.\n * This enables the specific config type to ignore specific fields when calculating the\n * hash in order to ignore theses fields when determining if 2 config files are the same.\n * The calc function also get the target directory of the config file (calculated by this aspect) as sometime there\n * is a need to change the config file content based on the target directory.\n * for example, change the includes/excludes paths to be relative to the target directory.\n * The calc can return undefined if the config file is not relevant for the component. or not supported by the subscriber.\n * for example if the component uses babel to compile, then tsconfig is not relevant.\n * @param env\n */\n calcConfigFiles(executionContext: ExecutionContext, env: Environment, dir: string): ConfigFile[] | undefined;\n\n /**\n * This enables the writer to do some post processing after the config files were written.\n * this is important in case when we need to change a config file after it was written based on all\n * the environments in the ws\n * or based on other config files that were written.\n * @param writtenConfigFiles\n */\n postProcessConfigFiles?(\n writtenConfigFiles: WrittenConfigFile[],\n executionContext: ExecutionContext,\n envMapValue: EnvMapValue,\n options: PostProcessConfigFilesOptions\n ): Promise<void>;\n\n /**\n * This will be used to generate an extending file content.\n * For example, the tsconfig.json file will extend the real tsconfig.{hash}.json file (that were coming from the env).\n * That way we can avoid writing the same config file multiple times.\n * It also reduces the risk of the user manually change the config file and then the changes will be lost.\n */\n generateExtendingFile(writtenConfigFiles: WrittenConfigFile[]): ExtendingConfigFile | undefined;\n\n /**\n * This enables the writer to do some post processing after the extending config files were written.\n * this is important in case when we need to change a config file / extending config file after it was written based on all\n * the environments in the ws\n * or based on other config files that were written.\n * @param args\n */\n postProcessExtendingConfigFiles?(args: PostProcessExtendingConfigFilesArgs): Promise<void>;\n\n /**\n * Find all the files that are relevant for the config type.\n * This is used to clean / delete these files\n * This should return an array of glob patterns (that will passed to the globby/minimatch library)\n * @param dir\n */\n patterns: string[];\n\n /**\n * A function to determine if a file was generated by bit.\n * This is useful to check if the config file was generated by bit to prevent delete user's file.\n * @param filePath\n * @returns\n */\n isBitGenerated?: (filePath: string) => boolean;\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["envCompsDirsMap","id","paths","tsExtendingConfigFilesMap","extendingConfigFile","content","name","extendingTarget","hash","envIds","tsExpectedDedupedPaths","fileHash","eslintExtendingConfigFilesMap","ff6ea265e6f21ce25f7985570beef37dd957d0dc","f1743b227e588db0c59d4a43171653e6c4262816","eslintExpectedDedupedPaths","prettierExtendingConfigFilesMap","prettierExpectedDedupedPaths","describe","timeout","result","before","dedupePaths","it","expect","to","have","lengthOf","length","deep","equal"],"sources":["dedup-paths.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { DedupedPaths, dedupePaths } from './dedup-paths';\nimport { ExtendingConfigFilesMap } from './workspace-config-files.main.runtime';\n\nconst envCompsDirsMap = {\n 'teambit.harmony/node': {\n id: 'teambit.harmony/node',\n paths: [\n 'react/apps/react-app-types',\n 'compilation/babel-compiler',\n 'compilation/compiler-task',\n 'mdx/compilers/mdx-compiler',\n 'mdx/compilers/mdx-multi-compiler',\n 'compilation/compilers/multi-compiler',\n 'defender/eslint-linter',\n 'mdx/generator/mdx-starters',\n 'mdx/generator/mdx-templates',\n 'react/generator/react-starters',\n 'react/generator/react-templates',\n 'defender/jest-tester',\n 'react/jest/react-jest',\n 'defender/linter-task',\n 'defender/mocha-tester',\n 'compilation/modules/babel-file-transpiler',\n 'defender/prettier-formatter',\n 'preview/react-preview',\n 'defender/tester-task',\n 'typescript/typescript-compiler',\n 'webpack/webpack-bundler',\n 'webpack/webpack-dev-server',\n 'react/webpack/react-webpack',\n ],\n },\n 'teambit.react/react-env@0.0.44': {\n id: 'teambit.react/react-env@0.0.44',\n paths: ['test-new-envs-app/apps/test-app', 'test-new-env/ui/button2'],\n },\n 'teambit.react/react': {\n id: 'teambit.react/react',\n paths: ['docs/docs-template', 'react/mounter'],\n },\n 'teambit.envs/env': {\n id: 'teambit.envs/env',\n paths: [\n 'react/examples/my-react-env',\n 'mdx/mdx-env',\n 'node/node',\n 'node/node-env-extension',\n 'react/react-env',\n 'react/react-env-extension',\n ],\n },\n 'teambit.mdx/mdx-env@0.0.6': {\n id: 'teambit.mdx/mdx-env@0.0.6',\n paths: ['test-new-env/mdx/content-comp'],\n },\n 'teambit.node/node@0.0.16': {\n id: 'teambit.node/node@0.0.16',\n paths: ['test-new-env/node/node-comp1', 'test-new-env/node/node-comp2'],\n },\n 'teambit.react/examples/my-react-env@0.0.39': {\n id: 'teambit.react/examples/my-react-env@0.0.39',\n paths: ['test-new-env/ui/button'],\n },\n};\n\nconst tsExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '816b7f584991ff21a7682ef8a4229ebf312c457f': {\n extendingConfigFile: {\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json',\n hash: '816b7f584991ff21a7682ef8a4229ebf312c457f',\n },\n envIds: ['teambit.harmony/node', 'teambit.react/react'],\n },\n '00330a9c547353867d519c34f47e17ddc9f161d1': {\n extendingConfigFile: {\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json',\n hash: '00330a9c547353867d519c34f47e17ddc9f161d1',\n },\n envIds: ['teambit.react/react-env@0.0.44', 'teambit.react/examples/my-react-env@0.0.39'],\n },\n '3c5960bcad98570b98834a5c37f47dd4729dbef0': {\n extendingConfigFile: {\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json',\n hash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',\n },\n envIds: ['teambit.node/node@0.0.16'],\n },\n};\n\nconst tsExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: '00330a9c547353867d519c34f47e17ddc9f161d1',\n paths: ['test-new-envs-app', 'test-new-env/ui'],\n },\n {\n fileHash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',\n paths: ['test-new-env/node'],\n },\n {\n fileHash: '816b7f584991ff21a7682ef8a4229ebf312c457f',\n paths: ['.'],\n },\n];\n\nconst eslintExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '8810839e74a9c41694bb5a2a8587dcae71dc389d': {\n extendingConfigFile: {\n content: '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json',\n hash: '8810839e74a9c41694bb5a2a8587dcae71dc389d'\n },\n envIds: [\n 'teambit.harmony/node',\n 'teambit.react/react',\n 'teambit.envs/env'\n ]\n },\n ff6ea265e6f21ce25f7985570beef37dd957d0dc: {\n extendingConfigFile: {\n content: '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json',\n hash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc'\n },\n envIds: [ 'teambit.react/react-env@0.0.44' ]\n },\n '91021f2c973a2940c70b75447639e4ea2a799955': {\n extendingConfigFile: {\n content: '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json',\n hash: '91021f2c973a2940c70b75447639e4ea2a799955'\n },\n envIds: [\n 'teambit.mdx/mdx-env@0.0.6',\n 'teambit.react/examples/my-react-env@0.0.39'\n ]\n },\n f1743b227e588db0c59d4a43171653e6c4262816: {\n extendingConfigFile: {\n content: '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json',\n hash: 'f1743b227e588db0c59d4a43171653e6c4262816'\n },\n envIds: [ 'teambit.node/node@0.0.16' ]\n }\n}\n\nconst eslintExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc',\n paths: [ 'test-new-envs-app', 'test-new-env/ui/button2' ]\n },\n {\n fileHash: '91021f2c973a2940c70b75447639e4ea2a799955',\n paths: [ 'test-new-env/mdx', 'test-new-env/ui/button' ]\n },\n {\n fileHash: 'f1743b227e588db0c59d4a43171653e6c4262816',\n paths: [ 'test-new-env/node' ]\n },\n {\n fileHash: '8810839e74a9c41694bb5a2a8587dcae71dc389d',\n paths: [ '.' ]\n }\n]\n\nconst prettierExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '082f546b2555ea89e7063b20de47c039d387fc74': {\n extendingConfigFile: {\n content: '// bit-generated-prettier-config\\n' +\n 'module.exports = {\\n' +\n \" ...require('/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs')\\n\" +\n '}',\n name: '.prettierrc.cjs',\n extendingTarget: '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs',\n hash: '082f546b2555ea89e7063b20de47c039d387fc74'\n },\n envIds: [\n 'teambit.harmony/node',\n 'teambit.react/react-env@0.0.44',\n 'teambit.react/react',\n 'teambit.envs/env',\n 'teambit.mdx/mdx-env@0.0.6',\n 'teambit.node/node@0.0.16',\n 'teambit.react/examples/my-react-env@0.0.39'\n ]\n }\n}\n\nconst prettierExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: '082f546b2555ea89e7063b20de47c039d387fc74',\n paths: [ '.' ]\n }\n]\n\n\ndescribe('Workspace Config files - dedupe paths', function () {\n this.timeout(0);\n\n describe('dedupePaths', () => {\n describe('ts example', () => {\n let result: DedupedPaths;\n before(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(tsExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result).to.have.lengthOf(tsExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n expect(result).to.deep.equal(tsExpectedDedupedPaths);\n });\n });\n\n describe('eslint example', () => {\n let result: DedupedPaths;\n before(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(eslintExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result).to.have.lengthOf(eslintExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n expect(result).to.deep.equal(eslintExpectedDedupedPaths);\n });\n });\n\n describe('prettier example', () => {\n let result: DedupedPaths;\n before(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(prettierExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result).to.have.lengthOf(prettierExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n expect(result).to.deep.equal(prettierExpectedDedupedPaths);\n });\n });\n });\n});\n"],"mappings":";;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA,MAAMA,eAAe,GAAG;EACtB,sBAAsB,EAAE;IACtBC,EAAE,EAAE,sBAAsB;IAC1BC,KAAK,EAAE,CACL,4BAA4B,EAC5B,4BAA4B,EAC5B,2BAA2B,EAC3B,4BAA4B,EAC5B,kCAAkC,EAClC,sCAAsC,EACtC,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,iCAAiC,EACjC,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,2CAA2C,EAC3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AI,CAACC,KAAK,CAACf,0BAA0B,CAAC;MAC1D,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFG,QAAQ,CAAC,kBAAkB,EAAE,MAAM;MACjC,IAAIE,MAAoB;MACxBC,MAAM,CAAC,YAAY;QACjB;QACAD,MAAM,GAAG,IAAAE,yBAAW,EAACN,+BAA+B,EAAEhB,eAAe,CAAC;MACxE,CAAC,CAAC;MAEFuB,EAAE,CAAC,0CAA0C,EAAE,YAAY;QACzD,IAAAC,cAAM,EAACJ,MAAM,CAAC,CAACK,EAAE,CAACC,IAAI,CAACC,QAAQ,CAACV,4BAA4B,CAACW,MAAM,CAAC;MACtE,CAAC,CAAC;MAEFL,EAAE,CAAC,uCAAuC,EAAE,YAAY;QACtD,IAAAC,cAAM,EAACJ,MAAM,CAAC,CAACK,EAAE,CAACI,IAAI,CAACC,KAAK,CAACb,4BAA4B,CAAC;MAC5D,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["envCompsDirsMap","id","paths","tsExtendingConfigFilesMap","extendingConfigFile","content","name","extendingTarget","hash","envIds","tsExpectedDedupedPaths","fileHash","eslintExtendingConfigFilesMap","ff6ea265e6f21ce25f7985570beef37dd957d0dc","f1743b227e588db0c59d4a43171653e6c4262816","eslintExpectedDedupedPaths","prettierExtendingConfigFilesMap","prettierExpectedDedupedPaths","describe","timeout","result","before","dedupePaths","it","expect","to","have","lengthOf","length","deep","equal"],"sources":["dedup-paths.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { DedupedPaths, dedupePaths } from './dedup-paths';\nimport { ExtendingConfigFilesMap } from './workspace-config-files.main.runtime';\n\nconst envCompsDirsMap = {\n 'teambit.harmony/node': {\n id: 'teambit.harmony/node',\n paths: [\n 'react/apps/react-app-types',\n 'compilation/babel-compiler',\n 'compilation/compiler-task',\n 'mdx/compilers/mdx-compiler',\n 'mdx/compilers/mdx-multi-compiler',\n 'compilation/compilers/multi-compiler',\n 'defender/eslint-linter',\n 'mdx/generator/mdx-starters',\n 'mdx/generator/mdx-templates',\n 'react/generator/react-starters',\n 'react/generator/react-templates',\n 'defender/jest-tester',\n 'react/jest/react-jest',\n 'defender/linter-task',\n 'defender/mocha-tester',\n 'compilation/modules/babel-file-transpiler',\n 'defender/prettier-formatter',\n 'preview/react-preview',\n 'defender/tester-task',\n 'typescript/typescript-compiler',\n 'webpack/webpack-bundler',\n 'webpack/webpack-dev-server',\n 'react/webpack/react-webpack',\n ],\n },\n 'teambit.react/react-env@0.0.44': {\n id: 'teambit.react/react-env@0.0.44',\n paths: ['test-new-envs-app/apps/test-app', 'test-new-env/ui/button2'],\n },\n 'teambit.react/react': {\n id: 'teambit.react/react',\n paths: ['docs/docs-template', 'react/mounter'],\n },\n 'teambit.envs/env': {\n id: 'teambit.envs/env',\n paths: [\n 'react/examples/my-react-env',\n 'mdx/mdx-env',\n 'node/node',\n 'node/node-env-extension',\n 'react/react-env',\n 'react/react-env-extension',\n ],\n },\n 'teambit.mdx/mdx-env@0.0.6': {\n id: 'teambit.mdx/mdx-env@0.0.6',\n paths: ['test-new-env/mdx/content-comp'],\n },\n 'teambit.node/node@0.0.16': {\n id: 'teambit.node/node@0.0.16',\n paths: ['test-new-env/node/node-comp1', 'test-new-env/node/node-comp2'],\n },\n 'teambit.react/examples/my-react-env@0.0.39': {\n id: 'teambit.react/examples/my-react-env@0.0.39',\n paths: ['test-new-env/ui/button'],\n },\n};\n\nconst tsExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '816b7f584991ff21a7682ef8a4229ebf312c457f': {\n extendingConfigFile: {\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json',\n hash: '816b7f584991ff21a7682ef8a4229ebf312c457f',\n },\n envIds: ['teambit.harmony/node', 'teambit.react/react'],\n },\n '00330a9c547353867d519c34f47e17ddc9f161d1': {\n extendingConfigFile: {\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json',\n hash: '00330a9c547353867d519c34f47e17ddc9f161d1',\n },\n envIds: ['teambit.react/react-env@0.0.44', 'teambit.react/examples/my-react-env@0.0.39'],\n },\n '3c5960bcad98570b98834a5c37f47dd4729dbef0': {\n extendingConfigFile: {\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json',\n hash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',\n },\n envIds: ['teambit.node/node@0.0.16'],\n },\n};\n\nconst tsExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: '00330a9c547353867d519c34f47e17ddc9f161d1',\n paths: ['test-new-envs-app', 'test-new-env/ui'],\n },\n {\n fileHash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',\n paths: ['test-new-env/node'],\n },\n {\n fileHash: '816b7f584991ff21a7682ef8a4229ebf312c457f',\n paths: ['.'],\n },\n];\n\nconst eslintExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '8810839e74a9c41694bb5a2a8587dcae71dc389d': {\n extendingConfigFile: {\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json',\n hash: '8810839e74a9c41694bb5a2a8587dcae71dc389d',\n },\n envIds: ['teambit.harmony/node', 'teambit.react/react', 'teambit.envs/env'],\n },\n ff6ea265e6f21ce25f7985570beef37dd957d0dc: {\n extendingConfigFile: {\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json',\n hash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc',\n },\n envIds: ['teambit.react/react-env@0.0.44'],\n },\n '91021f2c973a2940c70b75447639e4ea2a799955': {\n extendingConfigFile: {\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json',\n hash: '91021f2c973a2940c70b75447639e4ea2a799955',\n },\n envIds: ['teambit.mdx/mdx-env@0.0.6', 'teambit.react/examples/my-react-env@0.0.39'],\n },\n f1743b227e588db0c59d4a43171653e6c4262816: {\n extendingConfigFile: {\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json',\n hash: 'f1743b227e588db0c59d4a43171653e6c4262816',\n },\n envIds: ['teambit.node/node@0.0.16'],\n },\n};\n\nconst eslintExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc',\n paths: ['test-new-envs-app', 'test-new-env/ui/button2'],\n },\n {\n fileHash: '91021f2c973a2940c70b75447639e4ea2a799955',\n paths: ['test-new-env/mdx', 'test-new-env/ui/button'],\n },\n {\n fileHash: 'f1743b227e588db0c59d4a43171653e6c4262816',\n paths: ['test-new-env/node'],\n },\n {\n fileHash: '8810839e74a9c41694bb5a2a8587dcae71dc389d',\n paths: ['.'],\n },\n];\n\nconst prettierExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '082f546b2555ea89e7063b20de47c039d387fc74': {\n extendingConfigFile: {\n content:\n '// bit-generated-prettier-config\\n' +\n 'module.exports = {\\n' +\n \" ...require('/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs')\\n\" +\n '}',\n name: '.prettierrc.cjs',\n extendingTarget:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs',\n hash: '082f546b2555ea89e7063b20de47c039d387fc74',\n },\n envIds: [\n 'teambit.harmony/node',\n 'teambit.react/react-env@0.0.44',\n 'teambit.react/react',\n 'teambit.envs/env',\n 'teambit.mdx/mdx-env@0.0.6',\n 'teambit.node/node@0.0.16',\n 'teambit.react/examples/my-react-env@0.0.39',\n ],\n },\n};\n\nconst prettierExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: '082f546b2555ea89e7063b20de47c039d387fc74',\n paths: ['.'],\n },\n];\n\ndescribe('Workspace Config files - dedupe paths', function () {\n this.timeout(0);\n\n describe('dedupePaths', () => {\n describe('ts example', () => {\n let result: DedupedPaths;\n before(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(tsExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result).to.have.lengthOf(tsExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n expect(result).to.deep.equal(tsExpectedDedupedPaths);\n });\n });\n\n describe('eslint example', () => {\n let result: DedupedPaths;\n before(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(eslintExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result).to.have.lengthOf(eslintExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n expect(result).to.deep.equal(eslintExpectedDedupedPaths);\n });\n });\n\n describe('prettier example', () => {\n let result: DedupedPaths;\n before(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(prettierExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result).to.have.lengthOf(prettierExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n expect(result).to.deep.equal(prettierExpectedDedupedPaths);\n });\n });\n });\n});\n"],"mappings":";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AM;MAC/B,IAAIE,MAAoB;MACxBC,MAAM,CAAC,YAAY;QACjB;QACAD,MAAM,GAAG,IAAAE,yBAAW,EAACV,6BAA6B,EAAEZ,eAAe,CAAC;MACtE,CAAC,CAAC;MAEFuB,EAAE,CAAC,0CAA0C,EAAE,YAAY;QACzD,IAAAC,cAAM,EAACJ,MAAM,CAAC,CAACK,EAAE,CAACC,IAAI,CAACC,QAAQ,CAACZ,0BAA0B,CAACa,MAAM,CAAC;MACpE,CAAC,CAAC;MAEFL,EAAE,CAAC,uCAAuC,EAAE,YAAY;QACtD,IAAAC,cAAM,EAACJ,MAAM,CAAC,CAACK,EAAE,CAACI,IAAI,CAACC,KAAK,CAACf,0BAA0B,CAAC;MAC1D,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFG,QAAQ,CAAC,kBAAkB,EAAE,MAAM;MACjC,IAAIE,MAAoB;MACxBC,MAAM,CAAC,YAAY;QACjB;QACAD,MAAM,GAAG,IAAAE,yBAAW,EAACN,+BAA+B,EAAEhB,eAAe,CAAC;MACxE,CAAC,CAAC;MAEFuB,EAAE,CAAC,0CAA0C,EAAE,YAAY;QACzD,IAAAC,cAAM,EAACJ,MAAM,CAAC,CAACK,EAAE,CAACC,IAAI,CAACC,QAAQ,CAACV,4BAA4B,CAACW,MAAM,CAAC;MACtE,CAAC,CAAC;MAEFL,EAAE,CAAC,uCAAuC,EAAE,YAAY;QACtD,IAAAC,cAAM,EAACJ,MAAM,CAAC,CAACK,EAAE,CAACI,IAAI,CAACC,KAAK,CAACb,4BAA4B,CAAC;MAC5D,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["formatListOutput","result","head","rows","map","entry","aspectId","configWriter","name","cliName","table","Table","style","push","toString","formatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","getCleanResultsOutput","writeResultsOutput","getWriteResultsOutput","formatCleanOutput","chalk","green","length","join","totalFiles","totalWrittenFiles","writeTitle","writeOutput","aspectsWritersResults","aspectWritersResults","getOneAspectOutput","title","blue","bold","writersOutput","writersResult","oneWritersResults","getOneWriterOutput","cyan","realConfigFilesOutput","getRealConfigFilesOutput","configFiles","extendingConfigFilesOutput","getExtendingConfigFilesOutput","extendingConfigFiles","envsWrittenConfigFiles","magenta","writtenConfigFilesOutput","envsWrittenConfigFile","getEnvGroupConfigFilesOutput","envIds","filePath","relative","configFile","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","extendingTarget"],"sources":["format-outputs.ts"],"sourcesContent":["import Table from 'cli-table';\nimport chalk from 'chalk';\nimport { relative } from 'path';\nimport {\n AspectWritersResults,\n ConfigWritersList,\n EnvsWrittenConfigFile,\n EnvsWrittenConfigFiles,\n EnvsWrittenExtendingConfigFile,\n EnvsWrittenExtendingConfigFiles,\n OneConfigFileWriterResult,\n WriteConfigFilesResult,\n} from './workspace-config-files.main.runtime';\nimport type { CleanConfigCmdFlags, WriteConfigCmdFlags } from './ws-config.cmd';\n\nexport function formatListOutput(result: ConfigWritersList): string {\n const head = ['Aspect ID', 'name', 'CLI name'];\n\n const rows = result.map((entry) => {\n return [\n entry.aspectId,\n entry.configWriter.name,\n entry.configWriter.cliName,\n ]\n });\n const table = new Table({ head, style: { head: ['cyan'] } });\n table.push(...rows)\n return table.toString();\n}\nexport function formatWriteOutput(writeConfigFilesResult: WriteConfigFilesResult, flags: WriteConfigCmdFlags): string {\n const { cleanResults, writeResults, wsDir } = writeConfigFilesResult;\n const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);\n const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);\n const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);\n\n return `${cleanResultsOutput}${writeResultsOutput}`;\n}\n\nexport function formatCleanOutput(cleanResults: string[] = [], flags: CleanConfigCmdFlags): string {\n const isDryRun = !!flags.dryRun;\n const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);\n\n return `${cleanResultsOutput}`;\n}\n\nfunction getCleanResultsOutput(cleanResults: string[] | undefined, isDryRun: boolean) {\n const cleanResultsOutput = cleanResults\n ? `${chalk.green(\n `the following ${cleanResults.length} paths ${isDryRun ? 'will be' : 'were'} deleted:`\n )}\\n ${cleanResults.join('\\n ')}\\n`\n : '';\n return cleanResultsOutput;\n}\nfunction getWriteResultsOutput(writeResults: WriteConfigFilesResult['writeResults'], wsDir: string, isDryRun: boolean) {\n const totalFiles = writeResults.totalWrittenFiles;\n\n const writeTitle = isDryRun\n ? chalk.green(`${totalFiles} files will be written`)\n : chalk.green(`${totalFiles} files have been written successfully`);\n const writeOutput = writeResults.aspectsWritersResults\n .map((aspectWritersResults) => getOneAspectOutput(aspectWritersResults, wsDir))\n .join('\\n\\n');\n return `${writeTitle}\\n${writeOutput}`;\n}\nfunction getOneAspectOutput(aspectWritersResults: AspectWritersResults, wsDir: string): string {\n const title = chalk.blue(\n `The following paths are according to aspect ${chalk.bold(aspectWritersResults.aspectId.toString())}`\n );\n const writersOutput = aspectWritersResults.writersResult\n .map((oneWritersResults) => getOneWriterOutput(oneWritersResults, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writersOutput}`;\n}\nfunction getOneWriterOutput(oneWritersResults: OneConfigFileWriterResult, wsDir: string): string {\n const title = chalk.cyan(` The following paths are according to writer ${chalk.bold(oneWritersResults.name)}`);\n const realConfigFilesOutput = getRealConfigFilesOutput(oneWritersResults.configFiles, wsDir);\n const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);\n return `${title}\\n${realConfigFilesOutput}\\n\\n${extendingConfigFilesOutput}`;\n}\n\nfunction getRealConfigFilesOutput(envsWrittenConfigFiles: EnvsWrittenConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Real config files`);\n const writtenConfigFilesOutput = envsWrittenConfigFiles\n .map((envsWrittenConfigFile) => getEnvGroupConfigFilesOutput(envsWrittenConfigFile, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writtenConfigFilesOutput}`;\n}\nfunction getEnvGroupConfigFilesOutput(envsWrittenConfigFile: EnvsWrittenConfigFile, wsDir: string): string {\n const title = ` The following paths are according to env(s) ${chalk.bold(\n envsWrittenConfigFile.envIds.join(', ')\n )}`;\n const filePath = relative(wsDir, envsWrittenConfigFile.configFile.filePath);\n return `${title}\\n ${filePath}`;\n}\nfunction getExtendingConfigFilesOutput(extendingConfigFiles: EnvsWrittenExtendingConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Extending config files`);\n\n const extendingConfigFilesOutput = extendingConfigFiles\n .map((envsWrittenExtendingConfigFile) =>\n getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir)\n )\n .join('\\n\\n');\n return `${title}\\n${extendingConfigFilesOutput}`;\n}\nfunction getEnvGroupExtendingConfigFilesOutput(\n envsWrittenExtendingConfigFile: EnvsWrittenExtendingConfigFile,\n wsDir: string\n): string {\n const title = ` The following paths are according to env(s) ${chalk.bold(\n envsWrittenExtendingConfigFile.envIds.join(', ')\n )}`;\n const extendingConfigFile = envsWrittenExtendingConfigFile.extendingConfigFile;\n const paths = extendingConfigFile.filePaths\n .map((p) => ` ${relative(wsDir, p)} --> ${relative(wsDir, extendingConfigFile.extendingTarget)}`)\n .join('\\n ');\n return `${title}\\n ${paths}`;\n}\n"],"mappings":";;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAaO,SAASA,gBAAgB,CAACC,MAAyB,EAAU;EAClE,MAAMC,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC;EAE9C,MAAMC,IAAI,GAAGF,MAAM,CAACG,GAAG,CAAEC,KAAK,IAA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ASa,qCAAqC,CAC5CD,8BAA8D,EAC9D3C,KAAa,EACL;EACR,MAAMoB,KAAK,GAAI,mDAAkDX,gBAAK,CAACa,IAAI,CACzEqB,8BAA8B,CAACJ,MAAM,CAAC3B,IAAI,CAAC,IAAI,CAAC,CAChD,EAAC;EACH,MAAMiC,mBAAmB,GAAGF,8BAA8B,CAACE,mBAAmB;EAC9E,MAAMC,KAAK,GAAGD,mBAAmB,CAACE,SAAS,CACxC/D,GAAG,CAAEgE,CAAC,IAAM,KAAI,IAAAP,gBAAQ,EAACzC,KAAK,EAAEgD,CAAC,CAAE,QAAO,IAAAP,gBAAQ,EAACzC,KAAK,EAAE6C,mBAAmB,CAACI,eAAe,CAAE,EAAC,CAAC,CACjGrC,IAAI,CAAC,QAAQ,CAAC;EACjB,OAAQ,GAAEQ,KAAM,SAAQ0B,KAAM,EAAC;AACjC"}
|
|
1
|
+
{"version":3,"names":["formatListOutput","result","head","rows","map","entry","aspectId","configWriter","name","cliName","table","Table","style","push","toString","formatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","getCleanResultsOutput","writeResultsOutput","getWriteResultsOutput","formatCleanOutput","chalk","green","length","join","totalFiles","totalWrittenFiles","writeTitle","writeOutput","aspectsWritersResults","aspectWritersResults","getOneAspectOutput","title","blue","bold","writersOutput","writersResult","oneWritersResults","getOneWriterOutput","cyan","realConfigFilesOutput","getRealConfigFilesOutput","configFiles","extendingConfigFilesOutput","getExtendingConfigFilesOutput","extendingConfigFiles","envsWrittenConfigFiles","magenta","writtenConfigFilesOutput","envsWrittenConfigFile","getEnvGroupConfigFilesOutput","envIds","filePath","relative","configFile","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","extendingTarget"],"sources":["format-outputs.ts"],"sourcesContent":["import Table from 'cli-table';\nimport chalk from 'chalk';\nimport { relative } from 'path';\nimport {\n AspectWritersResults,\n ConfigWritersList,\n EnvsWrittenConfigFile,\n EnvsWrittenConfigFiles,\n EnvsWrittenExtendingConfigFile,\n EnvsWrittenExtendingConfigFiles,\n OneConfigFileWriterResult,\n WriteConfigFilesResult,\n} from './workspace-config-files.main.runtime';\nimport type { CleanConfigCmdFlags, WriteConfigCmdFlags } from './ws-config.cmd';\n\nexport function formatListOutput(result: ConfigWritersList): string {\n const head = ['Aspect ID', 'name', 'CLI name'];\n\n const rows = result.map((entry) => {\n return [entry.aspectId, entry.configWriter.name, entry.configWriter.cliName];\n });\n const table = new Table({ head, style: { head: ['cyan'] } });\n table.push(...rows);\n return table.toString();\n}\nexport function formatWriteOutput(writeConfigFilesResult: WriteConfigFilesResult, flags: WriteConfigCmdFlags): string {\n const { cleanResults, writeResults, wsDir } = writeConfigFilesResult;\n const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);\n const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);\n const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);\n\n return `${cleanResultsOutput}${writeResultsOutput}`;\n}\n\nexport function formatCleanOutput(cleanResults: string[] = [], flags: CleanConfigCmdFlags): string {\n const isDryRun = !!flags.dryRun;\n const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);\n\n return `${cleanResultsOutput}`;\n}\n\nfunction getCleanResultsOutput(cleanResults: string[] | undefined, isDryRun: boolean) {\n const cleanResultsOutput = cleanResults\n ? `${chalk.green(\n `the following ${cleanResults.length} paths ${isDryRun ? 'will be' : 'were'} deleted:`\n )}\\n ${cleanResults.join('\\n ')}\\n`\n : '';\n return cleanResultsOutput;\n}\nfunction getWriteResultsOutput(writeResults: WriteConfigFilesResult['writeResults'], wsDir: string, isDryRun: boolean) {\n const totalFiles = writeResults.totalWrittenFiles;\n\n const writeTitle = isDryRun\n ? chalk.green(`${totalFiles} files will be written`)\n : chalk.green(`${totalFiles} files have been written successfully`);\n const writeOutput = writeResults.aspectsWritersResults\n .map((aspectWritersResults) => getOneAspectOutput(aspectWritersResults, wsDir))\n .join('\\n\\n');\n return `${writeTitle}\\n${writeOutput}`;\n}\nfunction getOneAspectOutput(aspectWritersResults: AspectWritersResults, wsDir: string): string {\n const title = chalk.blue(\n `The following paths are according to aspect ${chalk.bold(aspectWritersResults.aspectId.toString())}`\n );\n const writersOutput = aspectWritersResults.writersResult\n .map((oneWritersResults) => getOneWriterOutput(oneWritersResults, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writersOutput}`;\n}\nfunction getOneWriterOutput(oneWritersResults: OneConfigFileWriterResult, wsDir: string): string {\n const title = chalk.cyan(` The following paths are according to writer ${chalk.bold(oneWritersResults.name)}`);\n const realConfigFilesOutput = getRealConfigFilesOutput(oneWritersResults.configFiles, wsDir);\n const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);\n return `${title}\\n${realConfigFilesOutput}\\n\\n${extendingConfigFilesOutput}`;\n}\n\nfunction getRealConfigFilesOutput(envsWrittenConfigFiles: EnvsWrittenConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Real config files`);\n const writtenConfigFilesOutput = envsWrittenConfigFiles\n .map((envsWrittenConfigFile) => getEnvGroupConfigFilesOutput(envsWrittenConfigFile, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writtenConfigFilesOutput}`;\n}\nfunction getEnvGroupConfigFilesOutput(envsWrittenConfigFile: EnvsWrittenConfigFile, wsDir: string): string {\n const title = ` The following paths are according to env(s) ${chalk.bold(\n envsWrittenConfigFile.envIds.join(', ')\n )}`;\n const filePath = relative(wsDir, envsWrittenConfigFile.configFile.filePath);\n return `${title}\\n ${filePath}`;\n}\nfunction getExtendingConfigFilesOutput(extendingConfigFiles: EnvsWrittenExtendingConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Extending config files`);\n\n const extendingConfigFilesOutput = extendingConfigFiles\n .map((envsWrittenExtendingConfigFile) =>\n getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir)\n )\n .join('\\n\\n');\n return `${title}\\n${extendingConfigFilesOutput}`;\n}\nfunction getEnvGroupExtendingConfigFilesOutput(\n envsWrittenExtendingConfigFile: EnvsWrittenExtendingConfigFile,\n wsDir: string\n): string {\n const title = ` The following paths are according to env(s) ${chalk.bold(\n envsWrittenExtendingConfigFile.envIds.join(', ')\n )}`;\n const extendingConfigFile = envsWrittenExtendingConfigFile.extendingConfigFile;\n const paths = extendingConfigFile.filePaths\n .map((p) => ` ${relative(wsDir, p)} --> ${relative(wsDir, extendingConfigFile.extendingTarget)}`)\n .join('\\n ');\n return `${title}\\n ${paths}`;\n}\n"],"mappings":";;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAaO,SAASA,gBAAgB,CAACC,MAAyB,EAAU;EAClE,MAAMC,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC;EAE9C,MAAMC,IAAI,GAAGF,MAAM,CAACG,GAAG,CAAEC,KAAK,IAAK;IACjC,OAAO,CAACA,KAAK,CAACC,QAAQ,EAAED,KAAK,CAACE,YAAY,CAACC,IAAI,EAAEH,KAAK,CAACE,YAAY,CAACE,OAAO,CAAC;EAC9E,CAAC,CAAC;EACF,MAAMC,KAAK,GAAG,KAAIC,mBAAK,EAAC;IAAET,IAAI;IAAEU,KAAK,EAAE;MAAEV,IAAI,EAAE,CAAC,MAAM;IAAE;EAAE,CAAC,CAAC;EAC5DQ,KAAK,CAACG,IAAI,CAAC,GAAGV,IAAI,CAAC;EACnB,OAAOO,KAAK,CAACI,QAAQ,EAAE;AACzB;AACO,SAASC,iBAAiB,CAACC,sBAA8C,EAAEC,KAA0B,EAAU;EACpH,MAAM;IAAEC,YAAY;IAAEC,YAAY;IAAEC;EAAM,CAAC,GAAGJ,sBAAsB;EACpE,MAAMK,QAAQ,GAAG,CAAC,EA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AC;AACjC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkspaceConfigFilesAspect } from './workspace-config-files.aspect';
|
|
2
|
-
export type { WorkspaceConfigFilesMain, WrittenConfigFile, EnvCompsDirsMap, EnvMapValue } from './workspace-config-files.main.runtime';
|
|
3
|
-
export type { ConfigWriterEntry, ExtendingConfigFile, ConfigFile, PostProcessExtendingConfigFilesArgs } from './config-writer-entry';
|
|
2
|
+
export type { WorkspaceConfigFilesMain, WrittenConfigFile, EnvCompsDirsMap, EnvMapValue, } from './workspace-config-files.main.runtime';
|
|
3
|
+
export type { ConfigWriterEntry, ExtendingConfigFile, ConfigFile, PostProcessExtendingConfigFilesArgs, } from './config-writer-entry';
|
|
4
4
|
export default WorkspaceConfigFilesAspect;
|
|
5
5
|
export { WorkspaceConfigFilesAspect };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WorkspaceConfigFilesAspect"],"sources":["index.ts"],"sourcesContent":["import { WorkspaceConfigFilesAspect } from './workspace-config-files.aspect';\n\nexport type {
|
|
1
|
+
{"version":3,"names":["WorkspaceConfigFilesAspect"],"sources":["index.ts"],"sourcesContent":["import { WorkspaceConfigFilesAspect } from './workspace-config-files.aspect';\n\nexport type {\n WorkspaceConfigFilesMain,\n WrittenConfigFile,\n EnvCompsDirsMap,\n EnvMapValue,\n} from './workspace-config-files.main.runtime';\nexport type {\n ConfigWriterEntry,\n ExtendingConfigFile,\n ConfigFile,\n PostProcessExtendingConfigFilesArgs,\n} from './config-writer-entry';\nexport default WorkspaceConfigFilesAspect;\nexport { WorkspaceConfigFilesAspect };\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA6E,eAc9DA,kDAA0B;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace-config-files@0.0.
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace-config-files@0.0.4/dist/workspace-config-files.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WorkspaceConfigFilesAspect","Aspect","create","id"],"sources":["workspace-config-files.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const WorkspaceConfigFilesAspect = Aspect.create({\n id: 'teambit.workspace/workspace-config-files',\n});\n
|
|
1
|
+
{"version":3,"names":["WorkspaceConfigFilesAspect","Aspect","create","id"],"sources":["workspace-config-files.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const WorkspaceConfigFilesAspect = Aspect.create({\n id: 'teambit.workspace/workspace-config-files',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,0BAA0B,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACtDC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
|
|
@@ -15,7 +15,8 @@ See the exported interface for more details.
|
|
|
15
15
|
### Commands
|
|
16
16
|
|
|
17
17
|
Main command is `bit ws-config` which has the following sub commands:
|
|
18
|
+
|
|
18
19
|
- `bit ws-config write` - write configuration files according to the components' envs
|
|
19
20
|
- `bit ws-config clean` - remove all configuration files from the workspace
|
|
20
21
|
- `bit ws-config list` - list all registered configuration writers.
|
|
21
|
-
this is useful for filtering used configuration writers when using the `--writers` flag in the write/clean commands.
|
|
22
|
+
this is useful for filtering used configuration writers when using the `--writers` flag in the write/clean commands.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WorkspaceConfigFilesMain","constructor","configWriterSlot","workspace","envs","logger","writeConfigFiles","options","execContext","getExecContext","cleanResults","clean","aspectsWritersResults","write","err","info","WriteConfigFilesFailed","totalWrittenFiles","reduce","acc","curr","writeResults","wsDir","path","cleanConfigFiles","listConfigWriters","slotEntries","toArray","result","aspectId","configWriters","map","configWriter","concat","envsExecutionContext","opts","envCompDirsMap","getEnvComponentsDirsMap","configsRootDir","getConfigsRootDir","results","pMapSeries","aspectEntry","handleOneAspectWriter","envCompsDirsMap","writers","includes","name","cliName","undefined","handleOneConfigFileWriter","compactResults","compact","writersResult","writtenConfigFilesMap","extendingConfigFilesMap","Object","entries","envId","envMapValue","executionContext","find","context","id","Error","writtenConfigFiles","handleRealConfigFiles","buildExtendingConfigFilesMap","keys","length","configFiles","totalConfigFiles","extendingConfigFiles","totalExtendingConfigFiles","fileHashPerDedupedPaths","dedupePaths","writeExtendingConfigFiles","postProcessExtendingConfigFiles","workspaceDir","writtenExtendingConfigFiles","dryRun","extendingConfigFile","filePaths","values","calculatedConfigFiles","calcConfigFiles","env","Promise","all","configFile","writtenConfigFile","writeConfigFile","hash","envIds","push","postProcessConfigFiles","sha1","content","format","filePath","join","fs","outputFile","res","finalResult","fileHash","paths","envsConfigFile","writtenPaths","extendingTarget","generateExtendingFile","getCacheDir","rootDir","components","list","runtime","createEnvironment","getEnvExecutionContext","envExecution","envRuntime","toString","value","c","componentDir","relative","getConfigWriters","getFlatConfigWriters","silent","filteredConfigWriters","filter","patterns","currPaths","globby","sync","cwd","dot","onlyFiles","ignore","filteredPaths","fullPath","isBitGenerated","flat","promptForCleaning","deleteFiles","clearStatusLine","ok","yesno","question","chalk","underline","bold","PromptCanceled","f","remove","registerConfigWriter","configWriterEntries","register","provider","cli","loggerAspect","_config","createLogger","WorkspaceConfigFilesAspect","workspaceConfigFilesMain","wsConfigCmd","WsConfigCmd","commands","WsConfigWriteCmd","WsConfigCleanCmd","WsConfigListCmd","Slot","withType","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["workspace-config-files.main.runtime.ts"],"sourcesContent":["import format from 'string-format';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { join } from 'path';\nimport globby from 'globby';\nimport chalk from 'chalk';\nimport { PromptCanceled } from '@teambit/legacy/dist/prompts/exceptions';\nimport pMapSeries from 'p-map-series';\nimport yesno from 'yesno';\nimport { compact } from 'lodash';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { Workspace } from '@teambit/workspace';\nimport { Environment, EnvsAspect, ExecutionContext } from '@teambit/envs';\nimport type { EnvsMain } from '@teambit/envs';\nimport { Logger, LoggerAspect } from '@teambit/logger';\nimport type { LoggerMain } from '@teambit/logger';\nimport { WorkspaceConfigFilesAspect } from './workspace-config-files.aspect';\nimport { ConfigFile, ConfigWriterEntry, ExtendingConfigFile } from './config-writer-entry';\nimport { WsConfigCleanCmd, WsConfigCmd, WsConfigListCmd, WsConfigWriteCmd } from './ws-config.cmd';\nimport { DedupedPaths, dedupePaths } from './dedup-paths';\nimport WriteConfigFilesFailed from './exceptions/write-failed';\n\nexport type ConfigWriterSlot = SlotRegistry<ConfigWriterEntry[]>;\n\nexport type ConfigWritersList = Array<{\n aspectId: string;\n configWriter: ConfigWriterEntry;\n}>;\n\nexport type CleanConfigFilesOptions = {\n silent?: boolean; // no prompt\n dryRun?: boolean;\n writers?: string[];\n};\n\nexport type WriteConfigFilesOptions = {\n clean?: boolean;\n silent?: boolean; // no prompt\n dedupe?: boolean;\n dryRun?: boolean;\n writers?: string[];\n};\n\nexport type WrittenConfigFile = Required<ConfigFile> & {\n filePath: string;\n};\n\nexport type WrittenExtendingConfigFile = ExtendingConfigFile & {\n filePaths: string[];\n};\n\nexport type WrittenConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n configFile: WrittenConfigFile;\n };\n};\n\nexport type ExtendingConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n extendingConfigFile: Required<ExtendingConfigFile>;\n };\n};\n\nexport type CompPathExtendingHashMap = { [compPath: string]: string };\n\nexport type EnvMapValue = { env: Environment; id: string[]; paths: string[] };\nexport type EnvCompsDirsMap = { [envId: string]: EnvMapValue };\n\nexport type EnvsWrittenConfigFile = { envIds: string[]; configFile: WrittenConfigFile };\nexport type EnvsWrittenConfigFiles = Array<EnvsWrittenConfigFile>;\n\nexport type EnvsWrittenExtendingConfigFile = { envIds: string[]; extendingConfigFile: WrittenExtendingConfigFile };\nexport type EnvsWrittenExtendingConfigFiles = Array<EnvsWrittenExtendingConfigFile>;\n\nexport type OneConfigFileWriterResult = {\n name: string;\n totalWrittenFiles: number;\n configFiles: EnvsWrittenConfigFiles;\n totalConfigFiles: number;\n extendingConfigFiles: EnvsWrittenExtendingConfigFiles;\n totalExtendingConfigFiles: number;\n};\n\nexport type AspectWritersResults = {\n aspectId: string;\n writersResult: OneConfigFileWriterResult[];\n totalWrittenFiles: number;\n};\n\nexport type WriteConfigFilesResult = {\n cleanResults?: string[];\n writeResults: { totalWrittenFiles: number; aspectsWritersResults: AspectWritersResults[] };\n wsDir: string;\n};\n\nexport class WorkspaceConfigFilesMain {\n constructor(\n readonly configWriterSlot: ConfigWriterSlot,\n private workspace: Workspace,\n private envs: EnvsMain,\n private logger: Logger\n ) {}\n\n /**\n * It writes the configuration files for the workspace\n * for example: tsconfig, eslint config and prettier config files.\n * @param {WriteConfigFilesOptions} options - WriteConfigFilesOptions = {}\n * @returns An object with the following properties:\n * - writeResults: An object with the following properties:\n * - aspectsWritersResults: An array of objects with the following properties:\n * - aspect: The aspect that was written\n * - totalWrittenFiles: The number of files that were written\n * - totalWrittenFiles: The total number of files that were written\n * - cleanResults: array of deleted paths\n */\n async writeConfigFiles(options: WriteConfigFilesOptions = {}): Promise<WriteConfigFilesResult> {\n const execContext = await this.getExecContext();\n\n let cleanResults: string[] | undefined;\n if (options.clean) {\n cleanResults = await this.clean(options);\n }\n\n let aspectsWritersResults;\n try {\n aspectsWritersResults = await this.write(execContext, options);\n } catch (err) {\n this.logger.info('writeConfigFiles failed', err);\n throw new WriteConfigFilesFailed();\n }\n const totalWrittenFiles = aspectsWritersResults.reduce((acc, curr) => {\n return acc + curr.totalWrittenFiles;\n }, 0);\n const writeResults = { aspectsWritersResults, totalWrittenFiles };\n\n return { writeResults, cleanResults, wsDir: this.workspace.path };\n }\n\n /**\n * It cleans (delete) the config files from the workspace.\n * This will check each file and will only delete it in case it was generated by bit\n * @param {CleanConfigFilesOptions} options - CleanConfigFilesOptions = {}\n * @returns An array of strings.\n */\n async cleanConfigFiles(options: CleanConfigFilesOptions = {}): Promise<string[]> {\n // const execContext = await this.getExecContext();\n const cleanResults = await this.clean(options);\n return cleanResults;\n }\n\n /**\n * It returns a list of all the config writers that have been registered with the config writer slot\n * @returns An array of objects with aspectId and configWriter properties.\n */\n listConfigWriters(): ConfigWritersList {\n const slotEntries = this.configWriterSlot.toArray();\n const result: ConfigWritersList = slotEntries.reduce((acc, [aspectId, configWriters]) => {\n const curr = configWriters.map((configWriter) => ({ aspectId, configWriter }));\n return acc.concat(curr);\n }, [] as ConfigWritersList);\n return result;\n }\n\n private async write(\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<AspectWritersResults[]> {\n const envCompDirsMap = this.getEnvComponentsDirsMap(envsExecutionContext);\n const slotEntries = this.configWriterSlot.toArray();\n const configsRootDir = this.getConfigsRootDir();\n const results = await pMapSeries(slotEntries, async (aspectEntry) => {\n const [aspectId, configWriters] = aspectEntry;\n return this.handleOneAspectWriter(\n aspectId,\n configWriters,\n envCompDirsMap,\n configsRootDir,\n envsExecutionContext,\n opts\n );\n });\n return results;\n }\n\n private async handleOneAspectWriter(\n aspectId: string,\n configWriters: ConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<AspectWritersResults> {\n const results = await pMapSeries(configWriters, async (configWriter) => {\n if (opts.writers && !(opts.writers.includes(configWriter.name) || opts.writers.includes(configWriter.cliName)))\n return undefined;\n return this.handleOneConfigFileWriter(configWriter, envCompsDirsMap, configsRootDir, envsExecutionContext, opts);\n });\n const compactResults = compact(results);\n const totalWrittenFiles = compactResults.reduce((acc, curr) => {\n return acc + curr.totalWrittenFiles;\n }, 0);\n return { aspectId, writersResult: compactResults, totalWrittenFiles };\n }\n\n private async handleOneConfigFileWriter(\n configWriter: ConfigWriterEntry,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<OneConfigFileWriterResult> {\n const writtenConfigFilesMap: WrittenConfigFilesMap = {};\n const extendingConfigFilesMap: ExtendingConfigFilesMap = {};\n await pMapSeries(Object.entries(envCompsDirsMap), async ([envId, envMapValue]) => {\n const executionContext = envsExecutionContext.find((context) => context.id === envId);\n if (!executionContext) throw new Error(`failed finding execution context for env ${envId}`);\n const writtenConfigFiles = await this.handleRealConfigFiles(\n envId,\n envMapValue,\n executionContext,\n configWriter,\n configsRootDir,\n writtenConfigFilesMap,\n opts\n );\n if (writtenConfigFiles) {\n this.buildExtendingConfigFilesMap(configWriter, writtenConfigFiles, envId, extendingConfigFilesMap);\n }\n });\n if (!writtenConfigFilesMap || Object.keys(writtenConfigFilesMap).length === 0) {\n return {\n name: configWriter.name,\n configFiles: [],\n totalConfigFiles: 0,\n totalWrittenFiles: 0,\n extendingConfigFiles: [],\n totalExtendingConfigFiles: 0,\n };\n }\n\n const fileHashPerDedupedPaths = dedupePaths(extendingConfigFilesMap, envCompsDirsMap);\n const extendingConfigFiles = await this.writeExtendingConfigFiles(\n extendingConfigFilesMap,\n fileHashPerDedupedPaths,\n opts\n );\n if (configWriter.postProcessExtendingConfigFiles) {\n\n await configWriter.postProcessExtendingConfigFiles({\n workspaceDir: this.workspace.path,\n configsRootDir,\n writtenExtendingConfigFiles: extendingConfigFiles,\n envCompsDirsMap,\n dryRun: !!opts.dryRun,\n });\n }\n const totalExtendingConfigFiles = extendingConfigFiles.reduce(\n (acc, curr) => acc + curr.extendingConfigFile.filePaths.length,\n 0\n );\n const configFiles = Object.values(writtenConfigFilesMap);\n const totalConfigFiles = Object.keys(writtenConfigFilesMap).length;\n const totalWrittenFiles = totalConfigFiles + totalExtendingConfigFiles;\n const result: OneConfigFileWriterResult = {\n name: configWriter.name,\n configFiles,\n totalWrittenFiles,\n totalConfigFiles: Object.keys(writtenConfigFilesMap).length,\n extendingConfigFiles,\n totalExtendingConfigFiles,\n };\n return result;\n }\n\n private async handleRealConfigFiles(\n envId: string,\n envMapValue: EnvMapValue,\n executionContext: ExecutionContext,\n configWriter: ConfigWriterEntry,\n configsRootDir: string,\n writtenConfigFilesMap: WrittenConfigFilesMap,\n opts: WriteConfigFilesOptions\n ): Promise<WrittenConfigFile[] | undefined> {\n const calculatedConfigFiles = configWriter.calcConfigFiles(executionContext, envMapValue.env, configsRootDir);\n if (!calculatedConfigFiles) return undefined;\n const writtenConfigFiles = await Promise.all(\n calculatedConfigFiles.map(async (configFile) => {\n const writtenConfigFile = await this.writeConfigFile(configFile, configsRootDir, opts);\n if (!writtenConfigFilesMap[writtenConfigFile.hash]) {\n writtenConfigFilesMap[writtenConfigFile.hash] = { configFile: writtenConfigFile, envIds: [] };\n }\n writtenConfigFilesMap[writtenConfigFile.hash].envIds.push(envId);\n return writtenConfigFile;\n })\n );\n if (configWriter.postProcessConfigFiles) {\n await configWriter.postProcessConfigFiles(writtenConfigFiles, executionContext, envMapValue, {\n dryRun: !!opts.dryRun\n });\n }\n return writtenConfigFiles;\n }\n\n private async writeConfigFile(\n configFile: ConfigFile,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ): Promise<WrittenConfigFile> {\n const hash = configFile.hash || sha1(configFile.content);\n const name = format(configFile.name, { hash });\n const filePath = join(configsRootDir, name);\n if (!opts.dryRun) {\n // const exists = await fs.pathExists(filePath);\n // if (!exists) {\n await fs.outputFile(filePath, configFile.content);\n // }\n }\n const res = {\n name,\n hash,\n filePath,\n content: configFile.content,\n };\n return res;\n }\n\n private async writeExtendingConfigFiles(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n fileHashPerDedupedPaths: DedupedPaths,\n opts: WriteConfigFilesOptions\n ): Promise<EnvsWrittenExtendingConfigFiles> {\n const finalResult: EnvsWrittenExtendingConfigFiles = await Promise.all(\n fileHashPerDedupedPaths.map(async ({ fileHash, paths }) => {\n const envsConfigFile = extendingConfigFilesMap[fileHash];\n const configFile = envsConfigFile.extendingConfigFile;\n const hash = configFile.hash || sha1(configFile.content);\n const name = format(configFile.name, { hash });\n const writtenPaths = await Promise.all(\n paths.map(async (path) => {\n const filePath = join(this.workspace.path, path, name);\n if (!opts.dryRun) {\n await fs.outputFile(filePath, configFile.content);\n }\n return filePath;\n })\n );\n const res: EnvsWrittenExtendingConfigFile = {\n envIds: envsConfigFile.envIds,\n extendingConfigFile: {\n name,\n hash,\n content: configFile.content,\n extendingTarget: configFile.extendingTarget,\n filePaths: writtenPaths,\n },\n };\n return res;\n })\n );\n return finalResult;\n }\n\n private buildExtendingConfigFilesMap(\n configWriter: ConfigWriterEntry,\n writtenConfigFiles: WrittenConfigFile[],\n envId: string,\n extendingConfigFilesMap: ExtendingConfigFilesMap\n ) {\n const extendingConfigFile = this.generateExtendingFile(configWriter, writtenConfigFiles);\n if (!extendingConfigFile) return;\n if (!extendingConfigFilesMap[extendingConfigFile.hash]) {\n extendingConfigFilesMap[extendingConfigFile.hash] = { extendingConfigFile, envIds: [] };\n }\n extendingConfigFilesMap[extendingConfigFile.hash].envIds.push(envId);\n }\n\n private generateExtendingFile(\n configWriter: ConfigWriterEntry,\n writtenConfigFiles\n ): Required<ExtendingConfigFile> | undefined {\n const extendingConfigFile = configWriter.generateExtendingFile(writtenConfigFiles);\n if (!extendingConfigFile) return undefined;\n const hash = extendingConfigFile.hash || sha1(extendingConfigFile.content);\n return {\n ...extendingConfigFile,\n hash,\n };\n }\n\n private getConfigsRootDir() {\n return this.getCacheDir(this.workspace.path);\n }\n\n private getCacheDir(rootDir): string {\n return join(rootDir, 'node_modules', '.cache');\n }\n\n private async getExecContext(): Promise<ExecutionContext[]> {\n const components = await this.workspace.list();\n const runtime = await this.envs.createEnvironment(components);\n const execContext = runtime.getEnvExecutionContext();\n return execContext;\n }\n\n private getEnvComponentsDirsMap(envsExecutionContext: ExecutionContext[]): EnvCompsDirsMap {\n const envCompDirsMap = envsExecutionContext.reduce((acc, envExecution) => {\n const envRuntime = envExecution.envRuntime;\n const envId = envRuntime.id.toString();\n const value = {\n id: envRuntime.id,\n env: envRuntime.env,\n paths: envRuntime.components.map((c) => this.workspace.componentDir(c.id, undefined, { relative: true })),\n };\n acc[envId] = value;\n return acc;\n }, {});\n return envCompDirsMap;\n }\n\n private getConfigWriters(): [string, ConfigWriterEntry[]][] {\n return this.configWriterSlot.toArray();\n }\n\n private getFlatConfigWriters(): ConfigWriterEntry[] {\n return this.getConfigWriters().reduce((acc: ConfigWriterEntry[], [, value]) => {\n acc = acc.concat(value);\n return acc;\n }, []);\n }\n\n /**\n * Clean config files written by the config-writers\n * @param envsExecutionContext\n * @param param1\n * @returns Array of paths of deleted config files\n */\n async clean({ dryRun, silent, writers }: WriteConfigFilesOptions): Promise<string[]> {\n const configWriters = this.getFlatConfigWriters();\n const filteredConfigWriters = writers\n ? configWriters.filter(\n (configWriter) => writers.includes(configWriter.name) || writers.includes(configWriter.cliName)\n )\n : configWriters;\n const paths = filteredConfigWriters\n .map((configWriter) => {\n const patterns = configWriter.patterns;\n const currPaths = globby.sync(patterns, {\n cwd: this.workspace.path,\n dot: true,\n onlyFiles: true,\n ignore: ['**/node_modules/**'],\n });\n const filteredPaths = currPaths.filter((path) => {\n const fullPath = join(this.workspace.path, path);\n return configWriter.isBitGenerated ? configWriter.isBitGenerated(fullPath) : true;\n });\n return filteredPaths;\n })\n .flat();\n if (dryRun) return paths;\n if (!silent) await this.promptForCleaning(paths);\n await this.deleteFiles(paths);\n return paths;\n }\n\n private async promptForCleaning(paths: string[]) {\n this.logger.clearStatusLine();\n const ok = await yesno({\n question: `${chalk.underline('The following paths will be deleted:')}\n${paths.join('\\n')}\n${chalk.bold('Do you want to continue? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new PromptCanceled();\n }\n }\n\n private async deleteFiles(paths: string[]) {\n await Promise.all(paths.map((f) => fs.remove(join(this.workspace.path, f))));\n }\n\n registerConfigWriter(...configWriterEntries: ConfigWriterEntry[]) {\n this.configWriterSlot.register(configWriterEntries);\n }\n\n static slots = [Slot.withType<ConfigWriterEntry[]>()];\n // define your aspect dependencies here.\n // in case you need to use another aspect API.\n static dependencies = [CLIAspect, WorkspaceAspect, EnvsAspect, LoggerAspect];\n\n static runtime = MainRuntime;\n\n static async provider(\n [cli, workspace, envs, loggerAspect]: [CLIMain, Workspace, EnvsMain, LoggerMain],\n _config,\n [configWriterSlot]: [ConfigWriterSlot]\n ) {\n const logger = loggerAspect.createLogger(WorkspaceConfigFilesAspect.id);\n const workspaceConfigFilesMain = new WorkspaceConfigFilesMain(configWriterSlot, workspace, envs, logger);\n const wsConfigCmd = new WsConfigCmd();\n wsConfigCmd.commands = [\n new WsConfigWriteCmd(workspaceConfigFilesMain),\n new WsConfigCleanCmd(workspaceConfigFilesMain),\n new WsConfigListCmd(workspaceConfigFilesMain),\n ];\n cli.register(wsConfigCmd);\n return workspaceConfigFilesMain;\n }\n}\n\nWorkspaceConfigFilesAspect.addRuntime(WorkspaceConfigFilesMain);\n\nexport default WorkspaceConfigFilesMain;\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;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4BAAgB,EAACJ,wBAAwB,CAAC,EAC9C,KAAIK,4BAAgB,EAACL,wBAAwB,CAAC,EAC9C,KAAIM,2BAAe,EAACN,wBAAwB,CAAC,CAC9C;IACDL,GAAG,CAACF,QAAQ,CAACQ,WAAW,CAAC;IACzB,OAAOD,wBAAwB;EACjC;AACF;AAAC;AAAA,gCA7ZYnK,wBAAwB,WAsYpB,CAAC0K,eAAI,CAACC,QAAQ,EAAuB,CAAC;AAAA,gCAtY1C3K,wBAAwB,kBAyYb,CAAC4K,gBAAS,EAAEC,4BAAe,EAAEC,kBAAU,EAAEC,sBAAY,CAAC;AAAA,gCAzYjE/K,wBAAwB,aA2YlBgL,kBAAW;AAoB9Bd,kDAA0B,CAACe,UAAU,CAACjL,wBAAwB,CAAC;AAAC,eAEjDA,wBAAwB;AAAA"}
|
|
1
|
+
{"version":3,"names":["WorkspaceConfigFilesMain","constructor","configWriterSlot","workspace","envs","logger","writeConfigFiles","options","execContext","getExecContext","cleanResults","clean","aspectsWritersResults","write","err","info","WriteConfigFilesFailed","totalWrittenFiles","reduce","acc","curr","writeResults","wsDir","path","cleanConfigFiles","listConfigWriters","slotEntries","toArray","result","aspectId","configWriters","map","configWriter","concat","envsExecutionContext","opts","envCompDirsMap","getEnvComponentsDirsMap","configsRootDir","getConfigsRootDir","results","pMapSeries","aspectEntry","handleOneAspectWriter","envCompsDirsMap","writers","includes","name","cliName","undefined","handleOneConfigFileWriter","compactResults","compact","writersResult","writtenConfigFilesMap","extendingConfigFilesMap","Object","entries","envId","envMapValue","executionContext","find","context","id","Error","writtenConfigFiles","handleRealConfigFiles","buildExtendingConfigFilesMap","keys","length","configFiles","totalConfigFiles","extendingConfigFiles","totalExtendingConfigFiles","fileHashPerDedupedPaths","dedupePaths","writeExtendingConfigFiles","postProcessExtendingConfigFiles","workspaceDir","writtenExtendingConfigFiles","dryRun","extendingConfigFile","filePaths","values","calculatedConfigFiles","calcConfigFiles","env","Promise","all","configFile","writtenConfigFile","writeConfigFile","hash","envIds","push","postProcessConfigFiles","sha1","content","format","filePath","join","fs","outputFile","res","finalResult","fileHash","paths","envsConfigFile","writtenPaths","extendingTarget","generateExtendingFile","getCacheDir","rootDir","components","list","runtime","createEnvironment","getEnvExecutionContext","envExecution","envRuntime","toString","value","c","componentDir","relative","getConfigWriters","getFlatConfigWriters","silent","filteredConfigWriters","filter","patterns","currPaths","globby","sync","cwd","dot","onlyFiles","ignore","filteredPaths","fullPath","isBitGenerated","flat","promptForCleaning","deleteFiles","clearStatusLine","ok","yesno","question","chalk","underline","bold","PromptCanceled","f","remove","registerConfigWriter","configWriterEntries","register","provider","cli","loggerAspect","_config","createLogger","WorkspaceConfigFilesAspect","workspaceConfigFilesMain","wsConfigCmd","WsConfigCmd","commands","WsConfigWriteCmd","WsConfigCleanCmd","WsConfigListCmd","Slot","withType","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["workspace-config-files.main.runtime.ts"],"sourcesContent":["import format from 'string-format';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { join } from 'path';\nimport globby from 'globby';\nimport chalk from 'chalk';\nimport { PromptCanceled } from '@teambit/legacy/dist/prompts/exceptions';\nimport pMapSeries from 'p-map-series';\nimport yesno from 'yesno';\nimport { compact } from 'lodash';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { Workspace } from '@teambit/workspace';\nimport { Environment, EnvsAspect, ExecutionContext } from '@teambit/envs';\nimport type { EnvsMain } from '@teambit/envs';\nimport { Logger, LoggerAspect } from '@teambit/logger';\nimport type { LoggerMain } from '@teambit/logger';\nimport { WorkspaceConfigFilesAspect } from './workspace-config-files.aspect';\nimport { ConfigFile, ConfigWriterEntry, ExtendingConfigFile } from './config-writer-entry';\nimport { WsConfigCleanCmd, WsConfigCmd, WsConfigListCmd, WsConfigWriteCmd } from './ws-config.cmd';\nimport { DedupedPaths, dedupePaths } from './dedup-paths';\nimport WriteConfigFilesFailed from './exceptions/write-failed';\n\nexport type ConfigWriterSlot = SlotRegistry<ConfigWriterEntry[]>;\n\nexport type ConfigWritersList = Array<{\n aspectId: string;\n configWriter: ConfigWriterEntry;\n}>;\n\nexport type CleanConfigFilesOptions = {\n silent?: boolean; // no prompt\n dryRun?: boolean;\n writers?: string[];\n};\n\nexport type WriteConfigFilesOptions = {\n clean?: boolean;\n silent?: boolean; // no prompt\n dedupe?: boolean;\n dryRun?: boolean;\n writers?: string[];\n};\n\nexport type WrittenConfigFile = Required<ConfigFile> & {\n filePath: string;\n};\n\nexport type WrittenExtendingConfigFile = ExtendingConfigFile & {\n filePaths: string[];\n};\n\nexport type WrittenConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n configFile: WrittenConfigFile;\n };\n};\n\nexport type ExtendingConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n extendingConfigFile: Required<ExtendingConfigFile>;\n };\n};\n\nexport type CompPathExtendingHashMap = { [compPath: string]: string };\n\nexport type EnvMapValue = { env: Environment; id: string[]; paths: string[] };\nexport type EnvCompsDirsMap = { [envId: string]: EnvMapValue };\n\nexport type EnvsWrittenConfigFile = { envIds: string[]; configFile: WrittenConfigFile };\nexport type EnvsWrittenConfigFiles = Array<EnvsWrittenConfigFile>;\n\nexport type EnvsWrittenExtendingConfigFile = { envIds: string[]; extendingConfigFile: WrittenExtendingConfigFile };\nexport type EnvsWrittenExtendingConfigFiles = Array<EnvsWrittenExtendingConfigFile>;\n\nexport type OneConfigFileWriterResult = {\n name: string;\n totalWrittenFiles: number;\n configFiles: EnvsWrittenConfigFiles;\n totalConfigFiles: number;\n extendingConfigFiles: EnvsWrittenExtendingConfigFiles;\n totalExtendingConfigFiles: number;\n};\n\nexport type AspectWritersResults = {\n aspectId: string;\n writersResult: OneConfigFileWriterResult[];\n totalWrittenFiles: number;\n};\n\nexport type WriteConfigFilesResult = {\n cleanResults?: string[];\n writeResults: { totalWrittenFiles: number; aspectsWritersResults: AspectWritersResults[] };\n wsDir: string;\n};\n\nexport class WorkspaceConfigFilesMain {\n constructor(\n readonly configWriterSlot: ConfigWriterSlot,\n private workspace: Workspace,\n private envs: EnvsMain,\n private logger: Logger\n ) {}\n\n /**\n * It writes the configuration files for the workspace\n * for example: tsconfig, eslint config and prettier config files.\n * @param {WriteConfigFilesOptions} options - WriteConfigFilesOptions = {}\n * @returns An object with the following properties:\n * - writeResults: An object with the following properties:\n * - aspectsWritersResults: An array of objects with the following properties:\n * - aspect: The aspect that was written\n * - totalWrittenFiles: The number of files that were written\n * - totalWrittenFiles: The total number of files that were written\n * - cleanResults: array of deleted paths\n */\n async writeConfigFiles(options: WriteConfigFilesOptions = {}): Promise<WriteConfigFilesResult> {\n const execContext = await this.getExecContext();\n\n let cleanResults: string[] | undefined;\n if (options.clean) {\n cleanResults = await this.clean(options);\n }\n\n let aspectsWritersResults;\n try {\n aspectsWritersResults = await this.write(execContext, options);\n } catch (err) {\n this.logger.info('writeConfigFiles failed', err);\n throw new WriteConfigFilesFailed();\n }\n const totalWrittenFiles = aspectsWritersResults.reduce((acc, curr) => {\n return acc + curr.totalWrittenFiles;\n }, 0);\n const writeResults = { aspectsWritersResults, totalWrittenFiles };\n\n return { writeResults, cleanResults, wsDir: this.workspace.path };\n }\n\n /**\n * It cleans (delete) the config files from the workspace.\n * This will check each file and will only delete it in case it was generated by bit\n * @param {CleanConfigFilesOptions} options - CleanConfigFilesOptions = {}\n * @returns An array of strings.\n */\n async cleanConfigFiles(options: CleanConfigFilesOptions = {}): Promise<string[]> {\n // const execContext = await this.getExecContext();\n const cleanResults = await this.clean(options);\n return cleanResults;\n }\n\n /**\n * It returns a list of all the config writers that have been registered with the config writer slot\n * @returns An array of objects with aspectId and configWriter properties.\n */\n listConfigWriters(): ConfigWritersList {\n const slotEntries = this.configWriterSlot.toArray();\n const result: ConfigWritersList = slotEntries.reduce((acc, [aspectId, configWriters]) => {\n const curr = configWriters.map((configWriter) => ({ aspectId, configWriter }));\n return acc.concat(curr);\n }, [] as ConfigWritersList);\n return result;\n }\n\n private async write(\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<AspectWritersResults[]> {\n const envCompDirsMap = this.getEnvComponentsDirsMap(envsExecutionContext);\n const slotEntries = this.configWriterSlot.toArray();\n const configsRootDir = this.getConfigsRootDir();\n const results = await pMapSeries(slotEntries, async (aspectEntry) => {\n const [aspectId, configWriters] = aspectEntry;\n return this.handleOneAspectWriter(\n aspectId,\n configWriters,\n envCompDirsMap,\n configsRootDir,\n envsExecutionContext,\n opts\n );\n });\n return results;\n }\n\n private async handleOneAspectWriter(\n aspectId: string,\n configWriters: ConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<AspectWritersResults> {\n const results = await pMapSeries(configWriters, async (configWriter) => {\n if (opts.writers && !(opts.writers.includes(configWriter.name) || opts.writers.includes(configWriter.cliName)))\n return undefined;\n return this.handleOneConfigFileWriter(configWriter, envCompsDirsMap, configsRootDir, envsExecutionContext, opts);\n });\n const compactResults = compact(results);\n const totalWrittenFiles = compactResults.reduce((acc, curr) => {\n return acc + curr.totalWrittenFiles;\n }, 0);\n return { aspectId, writersResult: compactResults, totalWrittenFiles };\n }\n\n private async handleOneConfigFileWriter(\n configWriter: ConfigWriterEntry,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n envsExecutionContext: ExecutionContext[],\n opts: WriteConfigFilesOptions\n ): Promise<OneConfigFileWriterResult> {\n const writtenConfigFilesMap: WrittenConfigFilesMap = {};\n const extendingConfigFilesMap: ExtendingConfigFilesMap = {};\n await pMapSeries(Object.entries(envCompsDirsMap), async ([envId, envMapValue]) => {\n const executionContext = envsExecutionContext.find((context) => context.id === envId);\n if (!executionContext) throw new Error(`failed finding execution context for env ${envId}`);\n const writtenConfigFiles = await this.handleRealConfigFiles(\n envId,\n envMapValue,\n executionContext,\n configWriter,\n configsRootDir,\n writtenConfigFilesMap,\n opts\n );\n if (writtenConfigFiles) {\n this.buildExtendingConfigFilesMap(configWriter, writtenConfigFiles, envId, extendingConfigFilesMap);\n }\n });\n if (!writtenConfigFilesMap || Object.keys(writtenConfigFilesMap).length === 0) {\n return {\n name: configWriter.name,\n configFiles: [],\n totalConfigFiles: 0,\n totalWrittenFiles: 0,\n extendingConfigFiles: [],\n totalExtendingConfigFiles: 0,\n };\n }\n\n const fileHashPerDedupedPaths = dedupePaths(extendingConfigFilesMap, envCompsDirsMap);\n const extendingConfigFiles = await this.writeExtendingConfigFiles(\n extendingConfigFilesMap,\n fileHashPerDedupedPaths,\n opts\n );\n if (configWriter.postProcessExtendingConfigFiles) {\n await configWriter.postProcessExtendingConfigFiles({\n workspaceDir: this.workspace.path,\n configsRootDir,\n writtenExtendingConfigFiles: extendingConfigFiles,\n envCompsDirsMap,\n dryRun: !!opts.dryRun,\n });\n }\n const totalExtendingConfigFiles = extendingConfigFiles.reduce(\n (acc, curr) => acc + curr.extendingConfigFile.filePaths.length,\n 0\n );\n const configFiles = Object.values(writtenConfigFilesMap);\n const totalConfigFiles = Object.keys(writtenConfigFilesMap).length;\n const totalWrittenFiles = totalConfigFiles + totalExtendingConfigFiles;\n const result: OneConfigFileWriterResult = {\n name: configWriter.name,\n configFiles,\n totalWrittenFiles,\n totalConfigFiles: Object.keys(writtenConfigFilesMap).length,\n extendingConfigFiles,\n totalExtendingConfigFiles,\n };\n return result;\n }\n\n private async handleRealConfigFiles(\n envId: string,\n envMapValue: EnvMapValue,\n executionContext: ExecutionContext,\n configWriter: ConfigWriterEntry,\n configsRootDir: string,\n writtenConfigFilesMap: WrittenConfigFilesMap,\n opts: WriteConfigFilesOptions\n ): Promise<WrittenConfigFile[] | undefined> {\n const calculatedConfigFiles = configWriter.calcConfigFiles(executionContext, envMapValue.env, configsRootDir);\n if (!calculatedConfigFiles) return undefined;\n const writtenConfigFiles = await Promise.all(\n calculatedConfigFiles.map(async (configFile) => {\n const writtenConfigFile = await this.writeConfigFile(configFile, configsRootDir, opts);\n if (!writtenConfigFilesMap[writtenConfigFile.hash]) {\n writtenConfigFilesMap[writtenConfigFile.hash] = { configFile: writtenConfigFile, envIds: [] };\n }\n writtenConfigFilesMap[writtenConfigFile.hash].envIds.push(envId);\n return writtenConfigFile;\n })\n );\n if (configWriter.postProcessConfigFiles) {\n await configWriter.postProcessConfigFiles(writtenConfigFiles, executionContext, envMapValue, {\n dryRun: !!opts.dryRun,\n });\n }\n return writtenConfigFiles;\n }\n\n private async writeConfigFile(\n configFile: ConfigFile,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ): Promise<WrittenConfigFile> {\n const hash = configFile.hash || sha1(configFile.content);\n const name = format(configFile.name, { hash });\n const filePath = join(configsRootDir, name);\n if (!opts.dryRun) {\n // const exists = await fs.pathExists(filePath);\n // if (!exists) {\n await fs.outputFile(filePath, configFile.content);\n // }\n }\n const res = {\n name,\n hash,\n filePath,\n content: configFile.content,\n };\n return res;\n }\n\n private async writeExtendingConfigFiles(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n fileHashPerDedupedPaths: DedupedPaths,\n opts: WriteConfigFilesOptions\n ): Promise<EnvsWrittenExtendingConfigFiles> {\n const finalResult: EnvsWrittenExtendingConfigFiles = await Promise.all(\n fileHashPerDedupedPaths.map(async ({ fileHash, paths }) => {\n const envsConfigFile = extendingConfigFilesMap[fileHash];\n const configFile = envsConfigFile.extendingConfigFile;\n const hash = configFile.hash || sha1(configFile.content);\n const name = format(configFile.name, { hash });\n const writtenPaths = await Promise.all(\n paths.map(async (path) => {\n const filePath = join(this.workspace.path, path, name);\n if (!opts.dryRun) {\n await fs.outputFile(filePath, configFile.content);\n }\n return filePath;\n })\n );\n const res: EnvsWrittenExtendingConfigFile = {\n envIds: envsConfigFile.envIds,\n extendingConfigFile: {\n name,\n hash,\n content: configFile.content,\n extendingTarget: configFile.extendingTarget,\n filePaths: writtenPaths,\n },\n };\n return res;\n })\n );\n return finalResult;\n }\n\n private buildExtendingConfigFilesMap(\n configWriter: ConfigWriterEntry,\n writtenConfigFiles: WrittenConfigFile[],\n envId: string,\n extendingConfigFilesMap: ExtendingConfigFilesMap\n ) {\n const extendingConfigFile = this.generateExtendingFile(configWriter, writtenConfigFiles);\n if (!extendingConfigFile) return;\n if (!extendingConfigFilesMap[extendingConfigFile.hash]) {\n extendingConfigFilesMap[extendingConfigFile.hash] = { extendingConfigFile, envIds: [] };\n }\n extendingConfigFilesMap[extendingConfigFile.hash].envIds.push(envId);\n }\n\n private generateExtendingFile(\n configWriter: ConfigWriterEntry,\n writtenConfigFiles\n ): Required<ExtendingConfigFile> | undefined {\n const extendingConfigFile = configWriter.generateExtendingFile(writtenConfigFiles);\n if (!extendingConfigFile) return undefined;\n const hash = extendingConfigFile.hash || sha1(extendingConfigFile.content);\n return {\n ...extendingConfigFile,\n hash,\n };\n }\n\n private getConfigsRootDir() {\n return this.getCacheDir(this.workspace.path);\n }\n\n private getCacheDir(rootDir): string {\n return join(rootDir, 'node_modules', '.cache');\n }\n\n private async getExecContext(): Promise<ExecutionContext[]> {\n const components = await this.workspace.list();\n const runtime = await this.envs.createEnvironment(components);\n const execContext = runtime.getEnvExecutionContext();\n return execContext;\n }\n\n private getEnvComponentsDirsMap(envsExecutionContext: ExecutionContext[]): EnvCompsDirsMap {\n const envCompDirsMap = envsExecutionContext.reduce((acc, envExecution) => {\n const envRuntime = envExecution.envRuntime;\n const envId = envRuntime.id.toString();\n const value = {\n id: envRuntime.id,\n env: envRuntime.env,\n paths: envRuntime.components.map((c) => this.workspace.componentDir(c.id, undefined, { relative: true })),\n };\n acc[envId] = value;\n return acc;\n }, {});\n return envCompDirsMap;\n }\n\n private getConfigWriters(): [string, ConfigWriterEntry[]][] {\n return this.configWriterSlot.toArray();\n }\n\n private getFlatConfigWriters(): ConfigWriterEntry[] {\n return this.getConfigWriters().reduce((acc: ConfigWriterEntry[], [, value]) => {\n acc = acc.concat(value);\n return acc;\n }, []);\n }\n\n /**\n * Clean config files written by the config-writers\n * @param envsExecutionContext\n * @param param1\n * @returns Array of paths of deleted config files\n */\n async clean({ dryRun, silent, writers }: WriteConfigFilesOptions): Promise<string[]> {\n const configWriters = this.getFlatConfigWriters();\n const filteredConfigWriters = writers\n ? configWriters.filter(\n (configWriter) => writers.includes(configWriter.name) || writers.includes(configWriter.cliName)\n )\n : configWriters;\n const paths = filteredConfigWriters\n .map((configWriter) => {\n const patterns = configWriter.patterns;\n const currPaths = globby.sync(patterns, {\n cwd: this.workspace.path,\n dot: true,\n onlyFiles: true,\n ignore: ['**/node_modules/**'],\n });\n const filteredPaths = currPaths.filter((path) => {\n const fullPath = join(this.workspace.path, path);\n return configWriter.isBitGenerated ? configWriter.isBitGenerated(fullPath) : true;\n });\n return filteredPaths;\n })\n .flat();\n if (dryRun) return paths;\n if (!silent) await this.promptForCleaning(paths);\n await this.deleteFiles(paths);\n return paths;\n }\n\n private async promptForCleaning(paths: string[]) {\n this.logger.clearStatusLine();\n const ok = await yesno({\n question: `${chalk.underline('The following paths will be deleted:')}\n${paths.join('\\n')}\n${chalk.bold('Do you want to continue? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new PromptCanceled();\n }\n }\n\n private async deleteFiles(paths: string[]) {\n await Promise.all(paths.map((f) => fs.remove(join(this.workspace.path, f))));\n }\n\n registerConfigWriter(...configWriterEntries: ConfigWriterEntry[]) {\n this.configWriterSlot.register(configWriterEntries);\n }\n\n static slots = [Slot.withType<ConfigWriterEntry[]>()];\n // define your aspect dependencies here.\n // in case you need to use another aspect API.\n static dependencies = [CLIAspect, WorkspaceAspect, EnvsAspect, LoggerAspect];\n\n static runtime = MainRuntime;\n\n static async provider(\n [cli, workspace, envs, loggerAspect]: [CLIMain, Workspace, EnvsMain, LoggerMain],\n _config,\n [configWriterSlot]: [ConfigWriterSlot]\n ) {\n const logger = loggerAspect.createLogger(WorkspaceConfigFilesAspect.id);\n const workspaceConfigFilesMain = new WorkspaceConfigFilesMain(configWriterSlot, workspace, envs, logger);\n const wsConfigCmd = new WsConfigCmd();\n wsConfigCmd.commands = [\n new WsConfigWriteCmd(workspaceConfigFilesMain),\n new WsConfigCleanCmd(workspaceConfigFilesMain),\n new WsConfigListCmd(workspaceConfigFilesMain),\n ];\n cli.register(wsConfigCmd);\n return workspaceConfigFilesMain;\n }\n}\n\nWorkspaceConfigFilesAspect.addRuntime(WorkspaceConfigFilesMain);\n\nexport default WorkspaceConfigFilesMain;\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;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;AAEA;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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA+D;AAAA;AA6ExD,MAAMA,wBAAwB,CAAC;EACpCC,WAAW,CACAC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AEiI,CAAC,CAAC,CAAC,CAAC,CAAC;EAC9E;EAEAE,oBAAoB,CAAC,GAAGC,mBAAwC,EAAE;IAChE,IAAI,CAACzJ,gBAAgB,CAAC0J,QAAQ,CAACD,mBAAmB,CAAC;EACrD;EASA,aAAaE,QAAQ,CACnB,CAACC,GAAG,EAAE3J,SAAS,EAAEC,IAAI,EAAE2J,YAAY,CAA6C,EAChFC,OAAO,EACP,CAAC9J,gBAAgB,CAAqB,EACtC;IACA,MAAMG,MAAM,GAAG0J,YAAY,CAACE,YAAY,CAACC,kDAA0B,CAACnG,EAAE,CAAC;IACvE,MAAMoG,wBAAwB,GAAG,IAAInK,wBAAwB,CAACE,gBAAgB,EAAEC,SAAS,EAAEC,IAAI,EAAEC,MAAM,CAAC;IACxG,MAAM+J,WAAW,GAAG,KAAIC,uBAAW,GAAE;IACrCD,WAAW,CAACE,QAAQ,GAAG,CACrB,KAAIC,4BAAgB,EAACJ,wBAAwB,CAAC,EAC9C,KAAIK,4BAAgB,EAACL,wBAAwB,CAAC,EAC9C,KAAIM,2BAAe,EAACN,wBAAwB,CAAC,CAC9C;IACDL,GAAG,CAACF,QAAQ,CAACQ,WAAW,CAAC;IACzB,OAAOD,wBAAwB;EACjC;AACF;AAAC;AAAA,gCA5ZYnK,wBAAwB,WAqYpB,CAAC0K,eAAI,CAACC,QAAQ,EAAuB,CAAC;AAAA,gCArY1C3K,wBAAwB,kBAwYb,CAAC4K,gBAAS,EAAEC,4BAAe,EAAEC,kBAAU,EAAEC,sBAAY,CAAC;AAAA,gCAxYjE/K,wBAAwB,aA0YlBgL,kBAAW;AAoB9Bd,kDAA0B,CAACe,UAAU,CAACjL,wBAAwB,CAAC;AAAC,eAEjDA,wBAAwB;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["COMMAND_NAME","WsConfigCmd","report","unrecognizedSubcommand","chalk","red","WsConfigWriteCmd","constructor","workspaceConfigFilesMain","_args","flags","results","json","dryRunWithContent","Error","formatWriteOutput","clean","silent","noDedupe","writers","dryRun","cleanResults","writeResults","wsDir","writeConfigFiles","dedupe","split","aspectsWritersResults","map","s","omit","totalWrittenFiles","WsConfigCleanCmd","formatCleanOutput","cleanConfigFiles","WsConfigListCmd","formatListOutput","listConfigWriters"],"sources":["ws-config.cmd.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\n\nimport { omit } from 'lodash';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport {
|
|
1
|
+
{"version":3,"names":["COMMAND_NAME","WsConfigCmd","report","unrecognizedSubcommand","chalk","red","WsConfigWriteCmd","constructor","workspaceConfigFilesMain","_args","flags","results","json","dryRunWithContent","Error","formatWriteOutput","clean","silent","noDedupe","writers","dryRun","cleanResults","writeResults","wsDir","writeConfigFiles","dedupe","split","aspectsWritersResults","map","s","omit","totalWrittenFiles","WsConfigCleanCmd","formatCleanOutput","cleanConfigFiles","WsConfigListCmd","formatListOutput","listConfigWriters"],"sources":["ws-config.cmd.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\n\nimport { omit } from 'lodash';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { WorkspaceConfigFilesMain, WriteConfigFilesResult } from './workspace-config-files.main.runtime';\nimport { formatCleanOutput, formatListOutput, formatWriteOutput } from './format-outputs';\n\nexport type CleanConfigCmdFlags = {\n dryRun?: boolean;\n silent?: boolean;\n};\n\nexport type WriteConfigCmdFlags = {\n dryRun?: boolean;\n writers?: string;\n noDedupe?: boolean;\n dryRunWithContent?: boolean;\n clean?: boolean;\n silent?: boolean;\n};\n\nconst COMMAND_NAME = 'ws-config';\n\nexport class WsConfigCmd implements Command {\n name = `${COMMAND_NAME} <sub-command>`;\n alias = 'workspace-config';\n description = 'manage workspace config files';\n options = [];\n group = 'development';\n commands: Command[] = [];\n // helpUrl = '';\n\n async report([unrecognizedSubcommand]: [string]) {\n return chalk.red(\n `\"${unrecognizedSubcommand}\" is not a subcommand of \"ws-config\", please run \"bit ws-config --help\" to list the subcommands`\n );\n }\n}\n\nexport class WsConfigWriteCmd implements Command {\n name = 'write';\n description = 'EXPERIMENTAL. write config files in the workspace. useful for IDEs';\n alias = '';\n group = 'development';\n options = [\n [\n 'c',\n 'clean',\n 'delete existing config files from the workspace. highly recommended to run it with \"--dry-run\" first',\n ],\n [\n 'w',\n 'writers <writers>',\n `only write config files for the given writers. use comma to separate multiple writers. use ${COMMAND_NAME} list to see all writers`,\n ],\n ['s', 'silent', 'do not prompt for confirmation'],\n ['', 'no-dedupe', \"write configs inside each one of the component's dir, avoid deduping\"],\n ['', 'dry-run', 'show the paths that configs will be written per env'],\n [\n '',\n 'dry-run-with-content',\n 'use with --json flag. show the config content and the paths it will be written per env',\n ],\n ['j', 'json', 'json format'],\n ] as CommandOptions;\n\n constructor(private workspaceConfigFilesMain: WorkspaceConfigFilesMain) {}\n\n async report(_args, flags: WriteConfigCmdFlags) {\n const results = (await this.json(_args, flags)) as WriteConfigFilesResult;\n if (flags.dryRunWithContent) {\n throw new Error(`use --json flag along with --dry-run-with-content`);\n }\n return formatWriteOutput(results, flags);\n }\n\n async json(_args, flags: WriteConfigCmdFlags) {\n const { clean, silent, noDedupe, dryRunWithContent, writers } = flags;\n const dryRun = dryRunWithContent ? true : !!flags.dryRun;\n const { cleanResults, writeResults, wsDir } = await this.workspaceConfigFilesMain.writeConfigFiles({\n clean,\n dedupe: !noDedupe,\n dryRun,\n silent,\n writers: writers?.split(','),\n });\n\n if (dryRun) {\n const aspectsWritersResults = dryRunWithContent\n ? writeResults.aspectsWritersResults\n : writeResults.aspectsWritersResults.map((s) => omit(s, ['content']));\n // return JSON.stringify({ cleanResults, writeResults: writeJson }, undefined, 2);\n return {\n wsDir,\n cleanResults,\n writeResults: { totalWrittenFiles: writeResults.totalWrittenFiles, aspectsWritersResults },\n };\n }\n return { wsDir, cleanResults, writeResults };\n }\n}\n\nexport class WsConfigCleanCmd implements Command {\n name = 'clean';\n description = 'EXPERIMENTAL. clean (delete) written config files in the workspace. useful for IDEs';\n alias = '';\n group = 'development';\n options = [\n ['s', 'silent', 'do not prompt for confirmation'],\n [\n 'w',\n 'writers <writers>',\n `only write config files for the given writers. use comma to separate multiple writers. use ${COMMAND_NAME} list to see all writers`,\n ],\n ['', 'dry-run', 'show the paths that configs will be written per env'],\n ['j', 'json', 'json format'],\n ] as CommandOptions;\n\n constructor(private workspaceConfigFilesMain: WorkspaceConfigFilesMain) {}\n\n async report(_args, flags: CleanConfigCmdFlags) {\n const results = await this.json(_args, flags);\n return formatCleanOutput(results, flags);\n }\n\n async json(_args, flags: WriteConfigCmdFlags) {\n const { silent, dryRun } = flags;\n const cleanResults = await this.workspaceConfigFilesMain.cleanConfigFiles({\n dryRun,\n silent,\n writers: flags.writers?.split(','),\n });\n return cleanResults;\n }\n}\n\nexport class WsConfigListCmd implements Command {\n name = 'list';\n description = 'EXPERIMENTAL. list config writers';\n alias = '';\n group = 'development';\n options = [['j', 'json', 'json format']] as CommandOptions;\n\n constructor(private workspaceConfigFilesMain: WorkspaceConfigFilesMain) {}\n\n async report() {\n const results = await this.json();\n return formatListOutput(results);\n }\n\n async json() {\n const cleanResults = await this.workspaceConfigFilesMain.listConfigWriters();\n return cleanResults;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AANA;;AAsBA,MAAMA,YAAY,GAAG,WAAW;AAEzB,MAAMC,WAAW,CAAoB;EAAA;IAAA,8CAClC,GAAED,YAAa,gBAAe;IAAA,+CAC9B,kBAAkB;IAAA,qDACZ,+BAA+B;IAAA,iDACnC,EAAE;IAAA,+CACJ,aAAa;IAAA,kDACC,EAAE;EAAA;EACxB;;EAEA,MAAME,MAAM,CAAC,CAACC,sBAAsB,CAAW,EAAE;IAC/C,OAAOC,gBAAK,CAACC,G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AAK,CAAC;EAC1C;EAEA,MAAME,IAAI,CAACH,KAAK,EAAEC,KAA0B,EAAE;IAAA;IAC5C,MAAM;MAAEO,MAAM;MAAEG;IAAO,CAAC,GAAGV,KAAK;IAChC,MAAMW,YAAY,GAAG,MAAM,IAAI,CAACb,wBAAwB,CAAC0B,gBAAgB,CAAC;MACxEd,MAAM;MACNH,MAAM;MACNE,OAAO,oBAAET,KAAK,CAACS,OAAO,mDAAb,eAAeO,KAAK,CAAC,GAAG;IACnC,CAAC,CAAC;IACF,OAAOL,YAAY;EACrB;AACF;AAAC;AAEM,MAAMc,eAAe,CAAoB;EAO9C5B,WAAW,CAASC,wBAAkD,EAAE;IAAA,KAApDA,wBAAkD,GAAlDA,wBAAkD;IAAA,8CAN/D,MAAM;IAAA,qDACC,mCAAmC;IAAA,+CACzC,EAAE;IAAA,+CACF,aAAa;IAAA,iDACX,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;EAEiC;EAEzE,MAAMN,MAAM,GAAG;IACb,MAAMS,OAAO,GAAG,MAAM,IAAI,CAACC,IAAI,EAAE;IACjC,OAAO,IAAAwB,iCAAgB,EAACzB,OAAO,CAAC;EAClC;EAEA,MAAMC,IAAI,GAAG;IACX,MAAMS,YAAY,GAAG,MAAM,IAAI,CAACb,wBAAwB,CAAC6B,iBAAiB,EAAE;IAC5E,OAAOhB,YAAY;EACrB;AACF;AAAC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/workspace-config-files",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/workspace/workspace-config-files",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.workspace",
|
|
8
8
|
"name": "workspace-config-files",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.4"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"core-js": "^3.0.0",
|
|
21
21
|
"@babel/runtime": "7.20.0",
|
|
22
22
|
"@teambit/harmony": "0.4.6",
|
|
23
|
-
"@teambit/envs": "0.0.
|
|
24
|
-
"@teambit/cli": "0.0.
|
|
25
|
-
"@teambit/logger": "0.0.
|
|
26
|
-
"@teambit/workspace": "0.0.
|
|
23
|
+
"@teambit/envs": "0.0.1024",
|
|
24
|
+
"@teambit/cli": "0.0.687",
|
|
25
|
+
"@teambit/logger": "0.0.780",
|
|
26
|
+
"@teambit/workspace": "0.0.1024",
|
|
27
27
|
"@teambit/bit-error": "0.0.402"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/testing-library__jest-dom": "5.9.5"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@teambit/legacy": "1.0.
|
|
43
|
+
"@teambit/legacy": "1.0.467",
|
|
44
44
|
"react": "^16.8.0 || ^17.0.0",
|
|
45
45
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
46
46
|
},
|
|
@@ -15,7 +15,8 @@ See the exported interface for more details.
|
|
|
15
15
|
### Commands
|
|
16
16
|
|
|
17
17
|
Main command is `bit ws-config` which has the following sub commands:
|
|
18
|
+
|
|
18
19
|
- `bit ws-config write` - write configuration files according to the components' envs
|
|
19
20
|
- `bit ws-config clean` - remove all configuration files from the workspace
|
|
20
21
|
- `bit ws-config list` - list all registered configuration writers.
|
|
21
|
-
this is useful for filtering used configuration writers when using the `--writers` flag in the write/clean commands.
|
|
22
|
+
this is useful for filtering used configuration writers when using the `--writers` flag in the write/clean commands.
|
|
Binary file
|