@teambit/workspace-config-files 1.0.282 → 1.0.283
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/artifacts/__bit_junit.xml +3 -3
- package/artifacts/preview/teambit_workspace_workspace_config_files-preview.js +1 -1
- package/artifacts/schema.json +1 -1
- package/dist/dedup-paths.js.map +1 -1
- package/dist/outputs/format-clean-output.js +1 -1
- package/dist/outputs/format-clean-output.js.map +1 -1
- package/dist/outputs/format-list-output.js +1 -1
- package/dist/outputs/format-list-output.js.map +1 -1
- package/dist/outputs/format-write-output.js +1 -1
- package/dist/outputs/format-write-output.js.map +1 -1
- package/dist/outputs/verbose-format-write-output.js +1 -1
- package/dist/outputs/verbose-format-write-output.js.map +1 -1
- package/dist/outputs/write-outputs-texts.js.map +1 -1
- package/dist/{preview-1716520879631.js → preview-1716607230882.js} +1 -1
- package/dist/workspace-config-files.main.runtime.js +2 -2
- package/dist/workspace-config-files.main.runtime.js.map +1 -1
- package/dist/workspace-config-files.service.js +1 -1
- package/dist/writers/extending-config-files.js +2 -2
- package/dist/writers/extending-config-files.js.map +1 -1
- package/dist/writers/real-config-files.js +2 -2
- package/dist/writers/real-config-files.js.map +1 -1
- package/dist/ws-config.cmd.js +2 -2
- package/dist/ws-config.cmd.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="6" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.workspace/workspace-config-files@1.0.
|
|
4
|
-
<testcase classname="dist/dedup-paths.spec.js" name="should reduce files to minimum necessary"/>
|
|
3
|
+
<testsuite name="teambit.workspace/workspace-config-files@1.0.283" tests="6" failures="0" errors="0" skipped="0">
|
|
4
|
+
<testcase classname="dist/dedup-paths.spec.js" name="should reduce files to minimum necessary" time="0.001"/>
|
|
5
5
|
<testcase classname="dist/dedup-paths.spec.js" name="should place files in correct folders"/>
|
|
6
6
|
<testcase classname="dist/dedup-paths.spec.js" name="should reduce files to minimum necessary"/>
|
|
7
7
|
<testcase classname="dist/dedup-paths.spec.js" name="should place files in correct folders"/>
|
|
8
|
-
<testcase classname="dist/dedup-paths.spec.js" name="should reduce files to minimum necessary"/>
|
|
8
|
+
<testcase classname="dist/dedup-paths.spec.js" name="should reduce files to minimum necessary" time="0.001"/>
|
|
9
9
|
<testcase classname="dist/dedup-paths.spec.js" name="should place files in correct folders"/>
|
|
10
10
|
</testsuite>
|
|
11
11
|
</testsuites>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.workspace/workspace-config-files-preview"]=n():e["teambit.workspace/workspace-config-files-preview"]=n()}(self,(()=>(()=>{"use strict";var e={d:(n,o)=>{for(var t in o)e.o(o,t)&&!e.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:o[t]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{compositions:()=>p,compositions_metadata:()=>f,overview:()=>d});var o={};e.r(o),e.d(o,{default:()=>c}),React;const t=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var r=["components"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)({}).hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},a.apply(null,arguments)}var l={},s="wrapper";function c(e){var n=e.components,o=function(e,n){if(null==e)return{};var o,t,i=function(e,n){if(null==e)return{};var o={};for(var t in e)if({}.hasOwnProperty.call(e,t)){if(n.indexOf(t)>=0)continue;o[t]=e[t]}return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t<r.length;t++)o=r[t],n.indexOf(o)>=0||{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}(e,r);return(0,t.mdx)(s,a({},l,o,{components:n,mdxType:"MDXLayout"}),(0,t.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,t.mdx)("p",null,"This aspect provides the ability to write configuration files in the workspace.\nIt provides an API to write configuration files in the workspace, and also provides cli commands to write configuration files."),(0,t.mdx)("h3",null,"Commands"),(0,t.mdx)("p",null,"Main command is ",(0,t.mdx)("inlineCode",{parentName:"p"},"bit ws-config")," which has the following sub commands:"),(0,t.mdx)("ul",null,(0,t.mdx)("li",{parentName:"ul"},(0,t.mdx)("inlineCode",{parentName:"li"},"bit ws-config write")," - write configuration files according to the components' envs"),(0,t.mdx)("li",{parentName:"ul"},(0,t.mdx)("inlineCode",{parentName:"li"},"bit ws-config clean")," - remove all configuration files from the workspace"),(0,t.mdx)("li",{parentName:"ul"},(0,t.mdx)("inlineCode",{parentName:"li"},"bit ws-config list")," - list all registered configuration writers.\nthis is useful for filtering used configuration writers when using the ",(0,t.mdx)("inlineCode",{parentName:"li"},"--writers")," flag in the write/clean commands."))))}c.isMDXComponent=!0;const p=[],d=[o],f={compositions:[]};return n})()));
|
package/artifacts/schema.json
CHANGED
package/dist/dedup-paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","data","require","_path","getAllPossibleDirsFromPaths","paths","dirs","map","p","getAllParentsDirOfPath","flat","push","uniq","all","current","dirname","buildCompPathExtendingHashMap","extendingConfigFilesMap","envCompsDirsMap","Object","entries","reduce","acc","hash","envIds","forEach","envId","envCompDirs","compPath","dedupePaths","rootDir","compPathExtendingHashMap","allPaths","keys","allPossibleDirs","allPathsPerFileHash","calculateBestFileForDir","dir","allPathsShareSameDir","filter","startsWith","countPerFileHash","fileHash","max","Math","values","fileHashWithMax","length","Error","dirPath","dedupedPathsPerFileHash","fileHashPerDedupedPaths","invertBy","dedupedPaths"],"sources":["dedup-paths.ts"],"sourcesContent":["import { invertBy, uniq } from 'lodash';\nimport { dirname } from 'path';\nimport { PathLinuxRelative } from '@teambit/legacy/dist/utils/path';\nimport { CompPathExtendingHashMap, EnvCompsDirsMap } from './workspace-config-files.main.runtime';\nimport { ExtendingConfigFilesMap } from './writers';\n\nexport type DedupedPaths = Array<{\n fileHash: string;\n paths: string[];\n}>;\n\nfunction getAllPossibleDirsFromPaths(paths: PathLinuxRelative[]): PathLinuxRelative[] {\n const dirs = paths.map((p) => getAllParentsDirOfPath(p)).flat();\n dirs.push('.'); // add the root dir\n return uniq(dirs);\n}\n\nfunction getAllParentsDirOfPath(p: PathLinuxRelative): PathLinuxRelative[] {\n const all: string[] = [];\n let current = p;\n while (current !== '.') {\n all.push(current);\n current = dirname(current);\n }\n return all;\n}\n\nexport function buildCompPathExtendingHashMap(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n envCompsDirsMap: EnvCompsDirsMap\n): CompPathExtendingHashMap {\n const map = Object.entries(extendingConfigFilesMap).reduce((acc, [hash, { envIds }]) => {\n envIds.forEach((envId) => {\n const envCompDirs = envCompsDirsMap[envId];\n envCompDirs.paths.forEach((compPath) => {\n acc[compPath] = hash;\n });\n });\n return acc;\n }, {});\n return map;\n}\n\n/**\n * easier to understand by an example:\n * input:\n * [\n * { fileHash: hash1, paths: [ui/button, ui/form] },\n * { fileHash: hash2, paths: [p/a1, p/a2] },\n * { fileHash: hash3, paths: [p/n1] },\n * ]\n *\n * output:\n * [\n * { fileHash: hash1, paths: [ui] },\n * { fileHash: hash2, paths: [p] },\n * { fileHash: hash3, paths: [p/n1] },\n * ]\n *\n * the goal is to minimize the amount of files to write per env if possible.\n * when multiple components of the same env share a root-dir, then, it's enough to write a file in that shared dir.\n * if in a shared-dir, some components using env1 and some env2, it finds the env that has the max number of\n * components, this env will be optimized. other components, will have the files written inside their dirs.\n */\nexport function dedupePaths(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n envCompsDirsMap: EnvCompsDirsMap\n): DedupedPaths {\n const rootDir = '.';\n\n const compPathExtendingHashMap = buildCompPathExtendingHashMap(extendingConfigFilesMap, envCompsDirsMap);\n const allPaths = Object.keys(compPathExtendingHashMap);\n const allPossibleDirs = getAllPossibleDirsFromPaths(allPaths);\n\n const allPathsPerFileHash: { [path: string]: string | null } = {}; // null when parent-dir has same amount of comps per env.\n\n const calculateBestFileForDir = (dir: string) => {\n if (compPathExtendingHashMap[dir]) {\n // it's the component dir, so it's the file that should be written.\n allPathsPerFileHash[dir] = compPathExtendingHashMap[dir];\n return;\n }\n const allPathsShareSameDir = dir === rootDir ? allPaths : allPaths.filter((p) => p.startsWith(`${dir}/`));\n const countPerFileHash: { [fileHash: string]: number } = {};\n allPathsShareSameDir.forEach((p) => {\n const fileHash = compPathExtendingHashMap[p];\n if (countPerFileHash[fileHash]) countPerFileHash[fileHash] += 1;\n else countPerFileHash[fileHash] = 1;\n });\n const max = Math.max(...Object.values(countPerFileHash));\n const fileHashWithMax = Object.keys(countPerFileHash).filter((fileHash) => countPerFileHash[fileHash] === max);\n if (!fileHashWithMax.length) throw new Error(`must be at least one fileHash related to path \"${dir}\"`);\n if (fileHashWithMax.length > 1) allPathsPerFileHash[dir] = null;\n else allPathsPerFileHash[dir] = fileHashWithMax[0];\n };\n\n allPossibleDirs.forEach((dirPath) => {\n calculateBestFileForDir(dirPath);\n });\n\n // this is the actual deduping. if found a shorter path with the same env, then no need for this path.\n // in other words, return only the paths that their parent is null or has a different env.\n const dedupedPathsPerFileHash = Object.keys(allPathsPerFileHash).reduce((acc, current) => {\n if (allPathsPerFileHash[current] && allPathsPerFileHash[dirname(current)] !== allPathsPerFileHash[current]) {\n acc[current] = allPathsPerFileHash[current];\n }\n\n return acc;\n }, {});\n // rootDir parent is always rootDir, so leave it as is.\n if (allPathsPerFileHash[rootDir]) dedupedPathsPerFileHash[rootDir] = allPathsPerFileHash[rootDir];\n\n const fileHashPerDedupedPaths = invertBy(dedupedPathsPerFileHash);\n\n const dedupedPaths = Object.keys(fileHashPerDedupedPaths).map((fileHash) => ({\n fileHash,\n paths: fileHashPerDedupedPaths[fileHash],\n }));\n return dedupedPaths;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAASG,2BAA2BA,CAACC,KAA0B,EAAuB;EACpF,MAAMC,IAAI,GAAGD,KAAK,CAACE,GAAG,CAAEC,CAAC,IAAKC,sBAAsB,CAACD,CAAC,CAAC,CAAC,CAACE,IAAI,CAAC,CAAC;EAC/DJ,IAAI,CAACK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;EAChB,OAAO,IAAAC,cAAI,EAACN,IAAI,CAAC;AACnB;AAEA,SAASG,sBAAsBA,CAACD,CAAoB,EAAuB;EACzE,MAAMK,GAAa,GAAG,EAAE;EACxB,IAAIC,OAAO,GAAGN,CAAC;EACf,OAAOM,OAAO,KAAK,GAAG,EAAE;IACtBD,GAAG,CAACF,IAAI,CAACG,OAAO,CAAC;IACjBA,OAAO,GAAG,IAAAC,eAAO,EAACD,OAAO,CAAC;EAC5B;EACA,OAAOD,GAAG;AACZ;AAEO,SAASG,6BAA6BA,CAC3CC,uBAAgD,EAChDC,eAAgC,EACN;EAC1B,MAAMX,GAAG,GAAGY,MAAM,CAACC,OAAO,CAACH,uBAAuB,CAAC,CAACI,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,IAAI,EAAE;IAAEC;EAAO,CAAC,CAAC,KAAK;IACtFA,MAAM,CAACC,OAAO,CAAEC,KAAK,IAAK;MACxB,MAAMC,WAAW,GAAGT,eAAe,CAACQ,KAAK,CAAC;MAC1CC,WAAW,CAACtB,KAAK,CAACoB,OAAO,CAAEG,QAAQ,IAAK;QACtCN,GAAG,CAACM,QAAQ,CAAC,GAAGL,IAAI;MACtB,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,OAAOD,GAAG;EACZ,CAAC,EAAE,CAAC,CAAC,CAAC;EACN,OAAOf,GAAG;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASsB,WAAWA,CACzBZ,uBAAgD,EAChDC,eAAgC,EAClB;EACd,MAAMY,OAAO,GAAG,GAAG;EAEnB,MAAMC,wBAAwB,GAAGf,6BAA6B,CAACC,uBAAuB,EAAEC,eAAe,CAAC;EACxG,MAAMc,QAAQ,GAAGb,MAAM,CAACc,IAAI,CAACF,wBAAwB,CAAC;EACtD,MAAMG,eAAe,GAAG9B,2BAA2B,CAAC4B,QAAQ,CAAC;EAE7D,MAAMG,mBAAsD,GAAG,CAAC,CAAC,CAAC,CAAC;;EAEnE,MAAMC,uBAAuB,GAAIC,GAAW,IAAK;IAC/C,IAAIN,wBAAwB,CAACM,GAAG,CAAC,EAAE;MACjC;MACAF,mBAAmB,CAACE,GAAG,CAAC,GAAGN,wBAAwB,CAACM,GAAG,CAAC;MACxD;IACF;IACA,MAAMC,oBAAoB,GAAGD,GAAG,KAAKP,OAAO,GAAGE,QAAQ,GAAGA,QAAQ,CAACO,MAAM,CAAE/B,CAAC,IAAKA,CAAC,CAACgC,UAAU,
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","_path","getAllPossibleDirsFromPaths","paths","dirs","map","p","getAllParentsDirOfPath","flat","push","uniq","all","current","dirname","buildCompPathExtendingHashMap","extendingConfigFilesMap","envCompsDirsMap","Object","entries","reduce","acc","hash","envIds","forEach","envId","envCompDirs","compPath","dedupePaths","rootDir","compPathExtendingHashMap","allPaths","keys","allPossibleDirs","allPathsPerFileHash","calculateBestFileForDir","dir","allPathsShareSameDir","filter","startsWith","countPerFileHash","fileHash","max","Math","values","fileHashWithMax","length","Error","dirPath","dedupedPathsPerFileHash","fileHashPerDedupedPaths","invertBy","dedupedPaths"],"sources":["dedup-paths.ts"],"sourcesContent":["import { invertBy, uniq } from 'lodash';\nimport { dirname } from 'path';\nimport { PathLinuxRelative } from '@teambit/legacy/dist/utils/path';\nimport { CompPathExtendingHashMap, EnvCompsDirsMap } from './workspace-config-files.main.runtime';\nimport { ExtendingConfigFilesMap } from './writers';\n\nexport type DedupedPaths = Array<{\n fileHash: string;\n paths: string[];\n}>;\n\nfunction getAllPossibleDirsFromPaths(paths: PathLinuxRelative[]): PathLinuxRelative[] {\n const dirs = paths.map((p) => getAllParentsDirOfPath(p)).flat();\n dirs.push('.'); // add the root dir\n return uniq(dirs);\n}\n\nfunction getAllParentsDirOfPath(p: PathLinuxRelative): PathLinuxRelative[] {\n const all: string[] = [];\n let current = p;\n while (current !== '.') {\n all.push(current);\n current = dirname(current);\n }\n return all;\n}\n\nexport function buildCompPathExtendingHashMap(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n envCompsDirsMap: EnvCompsDirsMap\n): CompPathExtendingHashMap {\n const map = Object.entries(extendingConfigFilesMap).reduce((acc, [hash, { envIds }]) => {\n envIds.forEach((envId) => {\n const envCompDirs = envCompsDirsMap[envId];\n envCompDirs.paths.forEach((compPath) => {\n acc[compPath] = hash;\n });\n });\n return acc;\n }, {});\n return map;\n}\n\n/**\n * easier to understand by an example:\n * input:\n * [\n * { fileHash: hash1, paths: [ui/button, ui/form] },\n * { fileHash: hash2, paths: [p/a1, p/a2] },\n * { fileHash: hash3, paths: [p/n1] },\n * ]\n *\n * output:\n * [\n * { fileHash: hash1, paths: [ui] },\n * { fileHash: hash2, paths: [p] },\n * { fileHash: hash3, paths: [p/n1] },\n * ]\n *\n * the goal is to minimize the amount of files to write per env if possible.\n * when multiple components of the same env share a root-dir, then, it's enough to write a file in that shared dir.\n * if in a shared-dir, some components using env1 and some env2, it finds the env that has the max number of\n * components, this env will be optimized. other components, will have the files written inside their dirs.\n */\nexport function dedupePaths(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n envCompsDirsMap: EnvCompsDirsMap\n): DedupedPaths {\n const rootDir = '.';\n\n const compPathExtendingHashMap = buildCompPathExtendingHashMap(extendingConfigFilesMap, envCompsDirsMap);\n const allPaths = Object.keys(compPathExtendingHashMap);\n const allPossibleDirs = getAllPossibleDirsFromPaths(allPaths);\n\n const allPathsPerFileHash: { [path: string]: string | null } = {}; // null when parent-dir has same amount of comps per env.\n\n const calculateBestFileForDir = (dir: string) => {\n if (compPathExtendingHashMap[dir]) {\n // it's the component dir, so it's the file that should be written.\n allPathsPerFileHash[dir] = compPathExtendingHashMap[dir];\n return;\n }\n const allPathsShareSameDir = dir === rootDir ? allPaths : allPaths.filter((p) => p.startsWith(`${dir}/`));\n const countPerFileHash: { [fileHash: string]: number } = {};\n allPathsShareSameDir.forEach((p) => {\n const fileHash = compPathExtendingHashMap[p];\n if (countPerFileHash[fileHash]) countPerFileHash[fileHash] += 1;\n else countPerFileHash[fileHash] = 1;\n });\n const max = Math.max(...Object.values(countPerFileHash));\n const fileHashWithMax = Object.keys(countPerFileHash).filter((fileHash) => countPerFileHash[fileHash] === max);\n if (!fileHashWithMax.length) throw new Error(`must be at least one fileHash related to path \"${dir}\"`);\n if (fileHashWithMax.length > 1) allPathsPerFileHash[dir] = null;\n else allPathsPerFileHash[dir] = fileHashWithMax[0];\n };\n\n allPossibleDirs.forEach((dirPath) => {\n calculateBestFileForDir(dirPath);\n });\n\n // this is the actual deduping. if found a shorter path with the same env, then no need for this path.\n // in other words, return only the paths that their parent is null or has a different env.\n const dedupedPathsPerFileHash = Object.keys(allPathsPerFileHash).reduce((acc, current) => {\n if (allPathsPerFileHash[current] && allPathsPerFileHash[dirname(current)] !== allPathsPerFileHash[current]) {\n acc[current] = allPathsPerFileHash[current];\n }\n\n return acc;\n }, {});\n // rootDir parent is always rootDir, so leave it as is.\n if (allPathsPerFileHash[rootDir]) dedupedPathsPerFileHash[rootDir] = allPathsPerFileHash[rootDir];\n\n const fileHashPerDedupedPaths = invertBy(dedupedPathsPerFileHash);\n\n const dedupedPaths = Object.keys(fileHashPerDedupedPaths).map((fileHash) => ({\n fileHash,\n paths: fileHashPerDedupedPaths[fileHash],\n }));\n return dedupedPaths;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAASG,2BAA2BA,CAACC,KAA0B,EAAuB;EACpF,MAAMC,IAAI,GAAGD,KAAK,CAACE,GAAG,CAAEC,CAAC,IAAKC,sBAAsB,CAACD,CAAC,CAAC,CAAC,CAACE,IAAI,CAAC,CAAC;EAC/DJ,IAAI,CAACK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;EAChB,OAAO,IAAAC,cAAI,EAACN,IAAI,CAAC;AACnB;AAEA,SAASG,sBAAsBA,CAACD,CAAoB,EAAuB;EACzE,MAAMK,GAAa,GAAG,EAAE;EACxB,IAAIC,OAAO,GAAGN,CAAC;EACf,OAAOM,OAAO,KAAK,GAAG,EAAE;IACtBD,GAAG,CAACF,IAAI,CAACG,OAAO,CAAC;IACjBA,OAAO,GAAG,IAAAC,eAAO,EAACD,OAAO,CAAC;EAC5B;EACA,OAAOD,GAAG;AACZ;AAEO,SAASG,6BAA6BA,CAC3CC,uBAAgD,EAChDC,eAAgC,EACN;EAC1B,MAAMX,GAAG,GAAGY,MAAM,CAACC,OAAO,CAACH,uBAAuB,CAAC,CAACI,MAAM,CAAC,CAACC,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AAC,EAAE,CAAC,CAAC,CAAC;EACN;EACA,IAAIa,mBAAmB,CAACL,OAAO,CAAC,EAAEoB,uBAAuB,CAACpB,OAAO,CAAC,GAAGK,mBAAmB,CAACL,OAAO,CAAC;EAEjG,MAAMqB,uBAAuB,GAAG,IAAAC,kBAAQ,EAACF,uBAAuB,CAAC;EAEjE,MAAMG,YAAY,GAAGlC,MAAM,CAACc,IAAI,CAACkB,uBAAuB,CAAC,CAAC5C,GAAG,CAAEmC,QAAQ,KAAM;IAC3EA,QAAQ;IACRrC,KAAK,EAAE8C,uBAAuB,CAACT,QAAQ;EACzC,CAAC,CAAC,CAAC;EACH,OAAOW,YAAY;AACrB","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ function _chalk() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function formatCleanOutput(cleanResults = [], flags) {
|
|
16
16
|
const isDryRun = !!flags.dryRun;
|
|
17
17
|
const cleanResultsOutput = getCleanResultsOutput(cleanResults, isDryRun);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","formatCleanOutput","cleanResults","flags","isDryRun","dryRun","cleanResultsOutput","getCleanResultsOutput","chalk","green","length","join"],"sources":["format-clean-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CleanConfigCmdFlags } from '../ws-config.cmd';\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 `${cleanResults.length} config files ${isDryRun ? 'will be' : 'were'} deleted`\n )}\\n ${cleanResults.join('\\n ')}\\n`\n : '';\n return cleanResultsOutput;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGnB,SAASG,iBAAiBA,CAACC,YAAsB,GAAG,EAAE,EAAEC,KAA0B,EAAU;EACjG,MAAMC,QAAQ,GAAG,CAAC,CAACD,KAAK,CAACE,MAAM;EAC/B,MAAMC,kBAAkB,GAAGC,qBAAqB,CAACL,YAAY,EAAEE,QAAQ,CAAC;EAExE,OAAO,GAAGE,kBAAkB,EAAE;AAChC;AAEA,SAASC,qBAAqBA,CAACL,YAAkC,EAAEE,QAAiB,EAAE;EACpF,MAAME,kBAAkB,GAAGJ,YAAY,GACnC,GAAGM,gBAAK,CAACC,KAAK,CACZ,GAAGP,YAAY,CAACQ,MAAM,iBAAiBN,QAAQ,GAAG,SAAS,GAAG,MAAM,UACtE,CAAC,OAAOF,YAAY,CAACS,IAAI,CAAC,MAAM,CAAC,IAAI,GACrC,EAAE;EACN,OAAOL,kBAAkB;AAC3B","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ function _chalk() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function formatListOutput(result) {
|
|
16
16
|
return Object.values(result).map(item => getEnvOutput(item.envId, item.configWriters)).join('\n\n');
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","formatListOutput","result","Object","values","map","item","getEnvOutput","envId","configWriters","join","title","chalk","bold","space","length","yellow","entries","configWriter","name","id"],"sources":["format-list-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { EnvConfigWritersList } from '../workspace-config-files.main.runtime';\nimport { ConfigWriterEntry } from '../config-writer-entry';\n\nexport function formatListOutput(result: EnvConfigWritersList): string {\n return Object.values(result)\n .map((item) => getEnvOutput(item.envId, item.configWriters))\n .join('\\n\\n');\n}\n\nfunction getEnvOutput(envId: string, configWriters: ConfigWriterEntry[]): string {\n const title = chalk.bold(envId);\n const space = ' ';\n if (!configWriters.length) return `${title}\\n${space}${chalk.yellow('no config writers found')}`;\n const entries = configWriters\n .map((configWriter) => {\n return `${configWriter.name} (${configWriter.id})`;\n })\n .join(`\\n${space}`);\n return `${title}\\n${space}${entries}`;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAInB,SAASG,gBAAgBA,CAACC,MAA4B,EAAU;EACrE,OAAOC,MAAM,CAACC,MAAM,CAACF,MAAM,CAAC,CACzBG,GAAG,CAAEC,IAAI,IAAKC,YAAY,CAACD,IAAI,CAACE,KAAK,EAAEF,IAAI,CAACG,aAAa,CAAC,CAAC,CAC3DC,IAAI,CAAC,MAAM,CAAC;AACjB;AAEA,SAASH,YAAYA,CAACC,KAAa,EAAEC,aAAkC,EAAU;EAC/E,MAAME,KAAK,GAAGC,gBAAK,CAACC,IAAI,CAACL,KAAK,CAAC;EAC/B,MAAMM,KAAK,GAAG,IAAI;EAClB,IAAI,CAACL,aAAa,CAACM,MAAM,EAAE,OAAO,GAAGJ,KAAK,KAAKG,KAAK,GAAGF,gBAAK,CAACI,MAAM,CAAC,yBAAyB,CAAC,EAAE;EAChG,MAAMC,OAAO,GAAGR,aAAa,CAC1BJ,GAAG,CAAEa,YAAY,IAAK;IACrB,OAAO,GAAGA,YAAY,CAACC,IAAI,KAAKD,YAAY,CAACE,EAAE,GAAG;EACpD,CAAC,CAAC,CACDV,IAAI,CAAC,KAAKI,KAAK,EAAE,CAAC;EACrB,OAAO,GAAGH,KAAK,KAAKG,KAAK,GAAGG,OAAO,EAAE;AACvC","ignoreList":[]}
|
|
@@ -32,7 +32,7 @@ function _writeOutputsTexts() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
function _interopRequireDefault(
|
|
35
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
36
|
function formatWriteOutput(writeConfigFilesResult, flags) {
|
|
37
37
|
const {
|
|
38
38
|
cleanResults,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_formatCleanOutput","_writeOutputsTexts","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_formatCleanOutput","_writeOutputsTexts","e","__esModule","default","formatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","length","formatCleanOutput","undefined","writeResultsOutput","getWriteResultsOutput","cleanWriteOutput","SUMMARY","totalExtendingConfigFiles","writeTitle","chalk","green","WRITE_TITLE","writeOutput","writersResult","map","writerResult","getOneWriterOutput","join","title","blue","bold","writerId","toString","writersOutput","getExtendingConfigFilesOutput","extendingConfigFiles","extendingConfigFilesOutput","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","relative"],"sources":["format-write-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { relative } from 'path';\nimport { OneConfigWriterIdResult, WriteConfigFilesResult, WriteResults } from '../workspace-config-files.main.runtime';\nimport type { WriteConfigCmdFlags } from '../ws-config.cmd';\nimport { formatCleanOutput } from './format-clean-output';\nimport { SUMMARY, WRITE_TITLE } from './write-outputs-texts';\nimport { EnvsWrittenExtendingConfigFile, EnvsWrittenExtendingConfigFiles } from '../writers';\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 = cleanResults?.length ? formatCleanOutput(cleanResults, { dryRun: isDryRun }) : undefined;\n const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);\n\n const cleanWriteOutput = cleanResultsOutput ? `${cleanResultsOutput}\\n${writeResultsOutput}` : writeResultsOutput;\n\n return `${cleanWriteOutput}\\n\\n${SUMMARY}`;\n}\n\nfunction getWriteResultsOutput(writeResults: WriteResults, wsDir: string, isDryRun: boolean) {\n const totalExtendingConfigFiles = writeResults.totalExtendingConfigFiles;\n\n const writeTitle = isDryRun\n ? chalk.green(`${totalExtendingConfigFiles} files will be written`)\n : chalk.green(WRITE_TITLE(totalExtendingConfigFiles));\n const writeOutput = writeResults.writersResult\n .map((writerResult) => getOneWriterOutput(writerResult, wsDir))\n .join('\\n\\n');\n return `${writeTitle}\\n${writeOutput}`;\n}\nfunction getOneWriterOutput(writerResult: OneConfigWriterIdResult, wsDir: string): string {\n const title = chalk.blue(\n `${writerResult.totalExtendingConfigFiles} ${chalk.bold(writerResult.writerId.toString())} configurations added`\n );\n const writersOutput = getExtendingConfigFilesOutput(writerResult.extendingConfigFiles, wsDir);\n return `${title}\\n${writersOutput}`;\n}\n\nfunction getExtendingConfigFilesOutput(extendingConfigFiles: EnvsWrittenExtendingConfigFiles, wsDir: string): string {\n const extendingConfigFilesOutput = extendingConfigFiles\n .map((envsWrittenExtendingConfigFile) =>\n getEnvGroupExtendingConfigFilesOutput(envsWrittenExtendingConfigFile, wsDir)\n )\n .join('\\n');\n return `${extendingConfigFilesOutput}`;\n}\nfunction getEnvGroupExtendingConfigFilesOutput(\n envsWrittenExtendingConfigFile: EnvsWrittenExtendingConfigFile,\n wsDir: string\n): string {\n const extendingConfigFile = envsWrittenExtendingConfigFile.extendingConfigFile;\n const paths = extendingConfigFile.filePaths.map((p) => ` ${relative(wsDir, p)}`).join('\\n');\n return `${paths}`;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,mBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,mBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,kBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6D,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGtD,SAASG,iBAAiBA,CAACC,sBAA8C,EAAEC,KAA0B,EAAU;EACpH,MAAM;IAAEC,YAAY;IAAEC,YAAY;IAAEC;EAAM,CAAC,GAAGJ,sBAAsB;EACpE,MAAMK,QAAQ,GAAG,CAAC,EAAEJ,KAAK,CAACK,MAAM,IAAIL,KAAK,CAACM,iB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,KAAKK,aAAa,EAAE;AACrC;AAEA,SAASC,6BAA6BA,CAACC,oBAAqD,EAAE9B,KAAa,EAAU;EACnH,MAAM+B,0BAA0B,GAAGD,oBAAoB,CACpDX,GAAG,CAAEa,8BAA8B,IAClCC,qCAAqC,CAACD,8BAA8B,EAAEhC,KAAK,CAC7E,CAAC,CACAsB,IAAI,CAAC,IAAI,CAAC;EACb,OAAO,GAAGS,0BAA0B,EAAE;AACxC;AACA,SAASE,qCAAqCA,CAC5CD,8BAA8D,EAC9DhC,KAAa,EACL;EACR,MAAMkC,mBAAmB,GAAGF,8BAA8B,CAACE,mBAAmB;EAC9E,MAAMC,KAAK,GAAGD,mBAAmB,CAACE,SAAS,CAACjB,GAAG,CAAEkB,CAAC,IAAK,KAAK,IAAAC,gBAAQ,EAACtC,KAAK,EAAEqC,CAAC,CAAC,EAAE,CAAC,CAACf,IAAI,CAAC,IAAI,CAAC;EAC5F,OAAO,GAAGa,KAAK,EAAE;AACnB","ignoreList":[]}
|
|
@@ -32,7 +32,7 @@ function _writeOutputsTexts() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
function _interopRequireDefault(
|
|
35
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
36
|
function verboseFormatWriteOutput(writeConfigFilesResult, flags) {
|
|
37
37
|
const {
|
|
38
38
|
cleanResults,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_formatCleanOutput","_writeOutputsTexts","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_formatCleanOutput","_writeOutputsTexts","e","__esModule","default","verboseFormatWriteOutput","writeConfigFilesResult","flags","cleanResults","writeResults","wsDir","isDryRun","dryRun","dryRunWithContent","cleanResultsOutput","formatCleanOutput","writeResultsOutput","getWriteResultsOutput","SUMMARY","totalFiles","totalWrittenFiles","writeTitle","chalk","green","WRITE_TITLE","writeOutput","writersResult","map","writerResult","getOneWriterOutput","join","oneWritersResults","title","cyan","bold","writerId","realConfigFilesOutput","getRealConfigFilesOutput","realConfigFiles","extendingConfigFilesOutput","getExtendingConfigFilesOutput","extendingConfigFiles","envsWrittenRealConfigFiles","magenta","writtenConfigFilesOutput","envsWrittenConfigFile","getEnvGroupConfigFilesOutput","envIds","filePath","relative","writtenRealConfigFile","envsWrittenExtendingConfigFile","getEnvGroupExtendingConfigFilesOutput","extendingConfigFile","paths","filePaths","p","extendingTarget"],"sources":["verbose-format-write-output.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { relative } from 'path';\nimport { OneConfigWriterIdResult, WriteConfigFilesResult, WriteResults } from '../workspace-config-files.main.runtime';\nimport type { WriteConfigCmdFlags } from '../ws-config.cmd';\nimport { formatCleanOutput } from './format-clean-output';\nimport { SUMMARY, WRITE_TITLE } from './write-outputs-texts';\nimport {\n EnvsWrittenExtendingConfigFile,\n EnvsWrittenExtendingConfigFiles,\n EnvsWrittenRealConfigFile,\n EnvsWrittenRealConfigFiles,\n} from '../writers';\n\nexport function verboseFormatWriteOutput(\n writeConfigFilesResult: WriteConfigFilesResult,\n flags: WriteConfigCmdFlags\n): string {\n const { cleanResults, writeResults, wsDir } = writeConfigFilesResult;\n const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);\n const cleanResultsOutput = formatCleanOutput(cleanResults, { dryRun: isDryRun });\n const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);\n\n return `${cleanResultsOutput}\\n${writeResultsOutput}\\n\\n${SUMMARY}`;\n}\n\nfunction getWriteResultsOutput(writeResults: 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(WRITE_TITLE(totalFiles));\n const writeOutput = writeResults.writersResult\n .map((writerResult) => getOneWriterOutput(writerResult, wsDir))\n .join('\\n\\n');\n return `${writeTitle}\\n${writeOutput}`;\n}\n\nfunction getOneWriterOutput(oneWritersResults: OneConfigWriterIdResult, wsDir: string): string {\n const title = chalk.cyan(` The following paths are according to writer ${chalk.bold(oneWritersResults.writerId)}`);\n const realConfigFilesOutput = getRealConfigFilesOutput(oneWritersResults.realConfigFiles, wsDir);\n const extendingConfigFilesOutput = getExtendingConfigFilesOutput(oneWritersResults.extendingConfigFiles, wsDir);\n return `${title}\\n${realConfigFilesOutput}\\n\\n${extendingConfigFilesOutput}`;\n}\n\nfunction getRealConfigFilesOutput(envsWrittenRealConfigFiles: EnvsWrittenRealConfigFiles, wsDir: string): string {\n const title = chalk.magenta(` Real config files`);\n const writtenConfigFilesOutput = envsWrittenRealConfigFiles\n .map((envsWrittenConfigFile) => getEnvGroupConfigFilesOutput(envsWrittenConfigFile, wsDir))\n .join('\\n\\n');\n return `${title}\\n${writtenConfigFilesOutput}`;\n}\nfunction getEnvGroupConfigFilesOutput(envsWrittenConfigFile: EnvsWrittenRealConfigFile, 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.writtenRealConfigFile.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.filePath)}`)\n .join('\\n ');\n return `${title}\\n ${paths}`;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,mBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,mBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,kBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6D,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQtD,SAASG,wBAAwBA,CACtCC,sBAA8C,EAC9CC,KAA0B,EAClB;EACR,MAAM;IAAEC,YAAY;IAAEC,YAAY;IAAEC;EAAM,CAAC,GAAGJ,sBAAsB;EACpE,MAAMK,QAAQ,GAAG,CAAC,EAAEJ,KAAK,CAACK,MAAM,IAAIL,KAAK,CAACM,iBAAiB,CAAC;EAC5D,MAAMC,kBAAkB,GAAG,IAAAC,sCAAiB,EAACP,YAAY,EAAE;IAAEI,MAAM,EAAED;EAAS,CAAC,CAAC;EAChF,MAAMK,kBAAkB,GAAGC,qBAAqB,CAACR,YAAY,EAAEC,KAAK,EAAEC,QAAQ,CAAC;EAE/E,OAAO,GAAGG,kBAAkB,KAA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AAC,QAAQ,CAAC;EACjB,OAAO,GAAGE,KAAK,SAASsB,KAAK,EAAE;AACjC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WRITE_TITLE","total","exports","SUMMARY"],"sources":["write-outputs-texts.ts"],"sourcesContent":["export const WRITE_TITLE = (total: number) => `${total} config files added to workspace`;\n\nexport const SUMMARY = `bit writes configuration files in different nested locations in your workspace to meet the configuration needs of different components.\nIDE is now in-sync with component configuration`;\n"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAIC,KAAa,
|
|
1
|
+
{"version":3,"names":["WRITE_TITLE","total","exports","SUMMARY"],"sources":["write-outputs-texts.ts"],"sourcesContent":["export const WRITE_TITLE = (total: number) => `${total} config files added to workspace`;\n\nexport const SUMMARY = `bit writes configuration files in different nested locations in your workspace to meet the configuration needs of different components.\nIDE is now in-sync with component configuration`;\n"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAIC,KAAa,IAAK,GAAGA,KAAK,kCAAkC;AAACC,OAAA,CAAAF,WAAA,GAAAA,WAAA;AAElF,MAAMG,OAAO,GAAAD,OAAA,CAAAC,OAAA,GAAG;AACvB,gDAAgD","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace-config-files@1.0.
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace-config-files@1.0.283/dist/workspace-config-files.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -130,8 +130,8 @@ function _writers() {
|
|
|
130
130
|
};
|
|
131
131
|
return data;
|
|
132
132
|
}
|
|
133
|
-
function _interopRequireDefault(
|
|
134
|
-
function _defineProperty(
|
|
133
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
134
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
135
135
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
136
136
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
137
137
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_globby","_chalk","_exceptions","_pMapSeries","_exceptions2","_yesno","_lodash","_cli","_workspace","_envs","_logger","_workspaceConfigFiles","_wsConfig","_writeFailed","_workspaceConfigFiles2","_writers","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","WorkspaceConfigFilesMain","constructor","workspace","envs","logger","config","writeConfigFiles","options","ConsumerNotFound","defaultOpts","clean","dedupe","silent","dryRun","throw","optionsWithDefaults","defaults","execContext","getExecContext","pathsToClean","writeErr","writeResults","calcPathsToClean","writers","write","allWrittenFiles","writersResult","flatMap","writerResult","extendingConfigFiles","extendingConfigFile","filePaths","filter","pathToClean","includes","join","path","deleteFiles","err","info","WriteConfigFilesFailed","cleanResults","wsDir","writeConfigFilesIfEnabled","shouldWrite","isWorkspaceConfigWriteEnabled","undefined","cleanConfigFiles","enableWorkspaceConfigWrite","listConfigWriters","execContexts","result","map","executionContext","configWriters","getConfigWriters","envId","envRuntime","id","groupByWriterId","writerList","reduce","acc","envConfigWriter","forEach","configWriter","push","envsExecutionContext","opts","envCompDirsMap","getEnvComponentsDirsMap","configsRootDir","getConfigsRootDir","writerIdsToEnvEntriesMap","filteredWriterIdsToEnvEntriesMap","pick","totalRealConfigFiles","totalExtendingConfigFiles","results","pMapSeries","entries","writerId","envEntries","oneResult","handleOneIdWriter","totalWrittenFiles","envCompsDirsMap","writtenRealConfigFilesMap","handleRealConfigFiles","writtenExtendingConfigFiles","handleExtendingConfigFiles","writtenRealConfigFiles","values","length","curr","realConfigFiles","userConfiguredDir","getCacheDir","rootDir","components","list","runtime","createEnvironment","getEnvExecutionContext","envExecution","toString","env","paths","c","componentDir","relative","envExecutionContext","workspaceConfig","isFunction","addToEnvsNotImplementing","getFlatConfigWriters","promptForCleaning","filteredConfigWriters","uniq","patterns","currPaths","globby","sync","cwd","dot","onlyFiles","ignore","filteredPaths","fullPath","isBitGenerated","flat","envsNotImplementing","getEnvsNotImplementing","keys","clearStatusLine","ok","yesno","question","chalk","underline","bold","PromptCanceled","Promise","all","f","fs","remove","provider","cli","loggerAspect","createLogger","WorkspaceConfigFilesAspect","registerService","WorkspaceConfigFilesService","workspaceConfigFilesMain","wsConfigCmd","WsConfigCmd","commands","WsConfigWriteCmd","WsConfigCleanCmd","WsConfigListCmd","register","exports","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","MainRuntime","addRuntime","_default"],"sources":["workspace-config-files.main.runtime.ts"],"sourcesContent":["import 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 { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport yesno from 'yesno';\nimport { defaults, flatMap, isFunction, pick, uniq } from 'lodash';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\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 { ConfigWriterEntry } from './config-writer-entry';\nimport { WsConfigCleanCmd, WsConfigCmd, WsConfigListCmd, WsConfigWriteCmd } from './ws-config.cmd';\nimport WriteConfigFilesFailed from './exceptions/write-failed';\nimport { WorkspaceConfigFilesService } from './workspace-config-files.service';\nimport {\n handleRealConfigFiles,\n handleExtendingConfigFiles,\n EnvsWrittenExtendingConfigFiles,\n EnvsWrittenRealConfigFiles,\n} from './writers';\n\n/**\n * Configs that can be configured in the workspace.jsonc file\n */\nexport type WorkspaceConfigFilesAspectConfig = {\n configsRootDir?: string;\n enableWorkspaceConfigWrite?: boolean;\n};\n\nexport type EnvConfigWriter = {\n envId: string;\n executionContext: ExecutionContext;\n configWriters: ConfigWriterEntry[];\n};\n\nexport type EnvConfigWriterEntry = {\n envId: string;\n configWriter: ConfigWriterEntry;\n executionContext: ExecutionContext;\n};\n\ntype WriterIdsToEnvEntriesMap = {\n [writerId: string]: EnvConfigWriterEntry[];\n};\n\nexport type EnvConfigWritersList = Array<EnvConfigWriter>;\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 throw?: boolean;\n writers?: string[];\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 OneConfigWriterIdResult = {\n writerId: string;\n totalWrittenFiles: number;\n realConfigFiles: EnvsWrittenRealConfigFiles;\n totalRealConfigFiles: number;\n extendingConfigFiles: EnvsWrittenExtendingConfigFiles;\n totalExtendingConfigFiles: number;\n};\n\nexport type WriteResults = {\n writersResult: OneConfigWriterIdResult[];\n totalWrittenFiles: number;\n totalRealConfigFiles: number;\n totalExtendingConfigFiles: number;\n};\n\nexport type WriteConfigFilesResult = {\n cleanResults?: string[];\n writeResults: WriteResults;\n wsDir: string;\n err?: Error;\n};\n\nexport class WorkspaceConfigFilesMain {\n private envsNotImplementing = {};\n\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private logger: Logger,\n private config: WorkspaceConfigFilesAspectConfig\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 if (!this.workspace) {\n throw new ConsumerNotFound();\n }\n const defaultOpts: WriteConfigFilesOptions = {\n clean: false,\n dedupe: false,\n silent: false,\n dryRun: false,\n throw: true,\n };\n const optionsWithDefaults = defaults(options, defaultOpts);\n const execContext = await this.getExecContext();\n\n let pathsToClean: string[] | undefined = [];\n let writeErr;\n let writeResults;\n try {\n if (optionsWithDefaults.clean) {\n pathsToClean = await this.calcPathsToClean({ writers: optionsWithDefaults.writers });\n }\n\n writeResults = await this.write(execContext, optionsWithDefaults);\n const allWrittenFiles = writeResults.writersResult.flatMap((writerResult) => {\n return writerResult.extendingConfigFiles.flatMap((extendingConfigFile) => {\n return extendingConfigFile.extendingConfigFile.filePaths;\n });\n });\n // Avoid delete and re-create files that were written by other config writers\n // instead of deleting at the beginning then write all\n // we write all and then delete the files that were not written by the config writers\n // This reduces the config files that re-created (as many times no changes needed)\n // which prevent issues with needing to restart the ts-server in the ide\n pathsToClean = pathsToClean.filter(\n (pathToClean) => !allWrittenFiles.includes(join(this.workspace.path, pathToClean))\n );\n await this.deleteFiles(pathsToClean);\n } catch (err) {\n this.logger.info('writeConfigFiles failed', err);\n if (optionsWithDefaults.throw) {\n throw new WriteConfigFilesFailed();\n }\n writeErr = err;\n }\n\n return { writeResults, cleanResults: pathsToClean, wsDir: this.workspace.path, err: writeErr };\n }\n\n /**\n * This will check the config.enableWorkspaceConfigWrite before writing the config files.\n */\n async writeConfigFilesIfEnabled(options: WriteConfigFilesOptions = {}): Promise<WriteConfigFilesResult | undefined> {\n const shouldWrite = this.isWorkspaceConfigWriteEnabled();\n if (!shouldWrite) return undefined;\n return this.writeConfigFiles(options);\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 if (!this.workspace) {\n throw new ConsumerNotFound();\n }\n const cleanResults = await this.clean(options);\n return cleanResults;\n }\n\n /**\n * The function checks if the auto writing of workspace configuration is enabled.\n * if it's enabled we will re-generate the configuration files upon bit create\n * @returns the boolean value of `!!this.config.enableWorkspaceConfigWrite`.\n */\n isWorkspaceConfigWriteEnabled() {\n return !!this.config.enableWorkspaceConfigWrite;\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 async listConfigWriters(): Promise<EnvConfigWritersList> {\n if (!this.workspace) {\n throw new ConsumerNotFound();\n }\n const execContexts = await this.getExecContext();\n\n const result: EnvConfigWritersList = execContexts.map((executionContext) => {\n const configWriters = this.getConfigWriters(executionContext);\n return { envId: executionContext.envRuntime.id, executionContext, configWriters };\n });\n return result;\n }\n\n private groupByWriterId(writerList: EnvConfigWritersList): WriterIdsToEnvEntriesMap {\n return writerList.reduce((acc, envConfigWriter: EnvConfigWriter) => {\n envConfigWriter.configWriters.forEach((configWriter: ConfigWriterEntry) => {\n acc[configWriter.id] = acc[configWriter.id] || [];\n acc[configWriter.id].push({ configWriter, envId: envConfigWriter.envId });\n });\n return acc;\n }, {});\n }\n\n private async write(envsExecutionContext: ExecutionContext[], opts: WriteConfigFilesOptions): Promise<WriteResults> {\n const envCompDirsMap = this.getEnvComponentsDirsMap(envsExecutionContext);\n const configsRootDir = this.getConfigsRootDir();\n const configWriters = await this.listConfigWriters();\n const writerIdsToEnvEntriesMap = this.groupByWriterId(configWriters);\n const filteredWriterIdsToEnvEntriesMap = opts.writers\n ? pick(writerIdsToEnvEntriesMap, opts.writers)\n : writerIdsToEnvEntriesMap;\n let totalRealConfigFiles = 0;\n let totalExtendingConfigFiles = 0;\n const results = await pMapSeries(\n Object.entries(filteredWriterIdsToEnvEntriesMap),\n async ([writerId, envEntries]) => {\n const oneResult = await this.handleOneIdWriter(writerId, envEntries, envCompDirsMap, configsRootDir, opts);\n totalRealConfigFiles += oneResult.totalRealConfigFiles;\n totalExtendingConfigFiles += oneResult.totalExtendingConfigFiles;\n return oneResult;\n }\n );\n\n const totalWrittenFiles = totalRealConfigFiles + totalExtendingConfigFiles;\n return { writersResult: results, totalWrittenFiles, totalRealConfigFiles, totalExtendingConfigFiles };\n }\n\n private async handleOneIdWriter(\n writerId: string,\n envEntries: EnvConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ): Promise<OneConfigWriterIdResult> {\n const writtenRealConfigFilesMap = await handleRealConfigFiles(\n envEntries,\n envCompsDirsMap,\n configsRootDir,\n this.workspace.path,\n opts\n );\n const writtenExtendingConfigFiles = await handleExtendingConfigFiles(\n envEntries,\n envCompsDirsMap,\n writtenRealConfigFilesMap,\n configsRootDir,\n this.workspace.path,\n opts\n );\n\n const writtenRealConfigFiles = Object.values(writtenRealConfigFilesMap);\n const totalRealConfigFiles = writtenRealConfigFiles.length;\n const totalExtendingConfigFiles = writtenExtendingConfigFiles.reduce(\n (acc, curr) => acc + curr.extendingConfigFile.filePaths.length,\n 0\n );\n const totalWrittenFiles = totalRealConfigFiles + totalExtendingConfigFiles;\n return {\n writerId,\n totalWrittenFiles,\n realConfigFiles: writtenRealConfigFiles,\n totalRealConfigFiles,\n extendingConfigFiles: writtenExtendingConfigFiles,\n totalExtendingConfigFiles,\n };\n }\n\n private getConfigsRootDir(): string {\n const userConfiguredDir = this.config.configsRootDir;\n return userConfiguredDir ? join(this.workspace.path, userConfiguredDir) : 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(envExecutionContext: ExecutionContext): ConfigWriterEntry[] {\n if (envExecutionContext.env.workspaceConfig && isFunction(envExecutionContext.env.workspaceConfig)) {\n return envExecutionContext.env.workspaceConfig();\n }\n this.addToEnvsNotImplementing(envExecutionContext.env.id);\n return [];\n }\n\n private getFlatConfigWriters(envsExecutionContext: ExecutionContext[]): ConfigWriterEntry[] {\n return flatMap(envsExecutionContext, (envExecutionContext) => {\n return this.getConfigWriters(envExecutionContext);\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 paths = await this.calcPathsToClean({ writers });\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 calcPathsToClean({ writers }: WriteConfigFilesOptions): Promise<string[]> {\n const execContext = await this.getExecContext();\n const configWriters = this.getFlatConfigWriters(execContext);\n const filteredConfigWriters = writers\n ? configWriters.filter((configWriter) => writers.includes(configWriter.id))\n : configWriters;\n\n const paths = uniq(\n 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 );\n return paths;\n }\n\n private addToEnvsNotImplementing(envId: string) {\n this.envsNotImplementing[envId] = true;\n }\n\n getEnvsNotImplementing() {\n return Object.keys(this.envsNotImplementing);\n }\n\n private async promptForCleaning(paths: string[]) {\n this.logger.clearStatusLine();\n const ok = await yesno({\n question: `${chalk.underline('The following files 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 static slots = [];\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 defaultConfig: Partial<WorkspaceConfigFilesAspectConfig> = {\n enableWorkspaceConfigWrite: false,\n };\n\n static async provider(\n [cli, workspace, envs, loggerAspect]: [CLIMain, Workspace, EnvsMain, LoggerMain],\n config: WorkspaceConfigFilesAspectConfig\n ) {\n const logger = loggerAspect.createLogger(WorkspaceConfigFilesAspect.id);\n envs.registerService(new WorkspaceConfigFilesService(logger));\n\n const workspaceConfigFilesMain = new WorkspaceConfigFilesMain(workspace, envs, logger, config);\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,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,YAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,aAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,YAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AA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AAI1J,wBAAwB,CAACE,SAAS,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,CAAC;IAC9F,MAAMsJ,WAAW,GAAG,KAAIC,uBAAW,EAAC,CAAC;IACrCD,WAAW,CAACE,QAAQ,GAAG,CACrB,KAAIC,4BAAgB,EAACJ,wBAAwB,CAAC,EAC9C,KAAIK,4BAAgB,EAACL,wBAAwB,CAAC,EAC9C,KAAIM,2BAAe,EAACN,wBAAwB,CAAC,CAC9C;IACDN,GAAG,CAACa,QAAQ,CAACN,WAAW,CAAC;IACzB,OAAOD,wBAAwB;EACjC;AACF;AAACQ,OAAA,CAAAlK,wBAAA,GAAAA,wBAAA;AAAApB,eAAA,CA7UYoB,wBAAwB,WAiTpB,EAAE;AACjB;AACA;AAAApB,eAAA,CAnTWoB,wBAAwB,kBAoTb,CAACmK,gBAAS,EAAEC,4BAAe,EAAEC,kBAAU,EAAEC,sBAAY,CAAC;AAAA1L,eAAA,CApTjEoB,wBAAwB,aAsTlBuK,kBAAW;AAAA3L,eAAA,CAtTjBoB,wBAAwB,mBAwT+B;EAChEgD,0BAA0B,EAAE;AAC9B,CAAC;AAqBHuG,kDAA0B,CAACiB,UAAU,CAACxK,wBAAwB,CAAC;AAAC,IAAAyK,QAAA,GAAAP,OAAA,CAAAvL,OAAA,GAEjDqB,wBAAwB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_globby","_chalk","_exceptions","_pMapSeries","_exceptions2","_yesno","_lodash","_cli","_workspace","_envs","_logger","_workspaceConfigFiles","_wsConfig","_writeFailed","_workspaceConfigFiles2","_writers","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WorkspaceConfigFilesMain","constructor","workspace","envs","logger","config","writeConfigFiles","options","ConsumerNotFound","defaultOpts","clean","dedupe","silent","dryRun","throw","optionsWithDefaults","defaults","execContext","getExecContext","pathsToClean","writeErr","writeResults","calcPathsToClean","writers","write","allWrittenFiles","writersResult","flatMap","writerResult","extendingConfigFiles","extendingConfigFile","filePaths","filter","pathToClean","includes","join","path","deleteFiles","err","info","WriteConfigFilesFailed","cleanResults","wsDir","writeConfigFilesIfEnabled","shouldWrite","isWorkspaceConfigWriteEnabled","undefined","cleanConfigFiles","enableWorkspaceConfigWrite","listConfigWriters","execContexts","result","map","executionContext","configWriters","getConfigWriters","envId","envRuntime","id","groupByWriterId","writerList","reduce","acc","envConfigWriter","forEach","configWriter","push","envsExecutionContext","opts","envCompDirsMap","getEnvComponentsDirsMap","configsRootDir","getConfigsRootDir","writerIdsToEnvEntriesMap","filteredWriterIdsToEnvEntriesMap","pick","totalRealConfigFiles","totalExtendingConfigFiles","results","pMapSeries","entries","writerId","envEntries","oneResult","handleOneIdWriter","totalWrittenFiles","envCompsDirsMap","writtenRealConfigFilesMap","handleRealConfigFiles","writtenExtendingConfigFiles","handleExtendingConfigFiles","writtenRealConfigFiles","values","length","curr","realConfigFiles","userConfiguredDir","getCacheDir","rootDir","components","list","runtime","createEnvironment","getEnvExecutionContext","envExecution","toString","env","paths","c","componentDir","relative","envExecutionContext","workspaceConfig","isFunction","addToEnvsNotImplementing","getFlatConfigWriters","promptForCleaning","filteredConfigWriters","uniq","patterns","currPaths","globby","sync","cwd","dot","onlyFiles","ignore","filteredPaths","fullPath","isBitGenerated","flat","envsNotImplementing","getEnvsNotImplementing","keys","clearStatusLine","ok","yesno","question","chalk","underline","bold","PromptCanceled","Promise","all","f","fs","remove","provider","cli","loggerAspect","createLogger","WorkspaceConfigFilesAspect","registerService","WorkspaceConfigFilesService","workspaceConfigFilesMain","wsConfigCmd","WsConfigCmd","commands","WsConfigWriteCmd","WsConfigCleanCmd","WsConfigListCmd","register","exports","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","MainRuntime","addRuntime","_default"],"sources":["workspace-config-files.main.runtime.ts"],"sourcesContent":["import 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 { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport yesno from 'yesno';\nimport { defaults, flatMap, isFunction, pick, uniq } from 'lodash';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\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 { ConfigWriterEntry } from './config-writer-entry';\nimport { WsConfigCleanCmd, WsConfigCmd, WsConfigListCmd, WsConfigWriteCmd } from './ws-config.cmd';\nimport WriteConfigFilesFailed from './exceptions/write-failed';\nimport { WorkspaceConfigFilesService } from './workspace-config-files.service';\nimport {\n handleRealConfigFiles,\n handleExtendingConfigFiles,\n EnvsWrittenExtendingConfigFiles,\n EnvsWrittenRealConfigFiles,\n} from './writers';\n\n/**\n * Configs that can be configured in the workspace.jsonc file\n */\nexport type WorkspaceConfigFilesAspectConfig = {\n configsRootDir?: string;\n enableWorkspaceConfigWrite?: boolean;\n};\n\nexport type EnvConfigWriter = {\n envId: string;\n executionContext: ExecutionContext;\n configWriters: ConfigWriterEntry[];\n};\n\nexport type EnvConfigWriterEntry = {\n envId: string;\n configWriter: ConfigWriterEntry;\n executionContext: ExecutionContext;\n};\n\ntype WriterIdsToEnvEntriesMap = {\n [writerId: string]: EnvConfigWriterEntry[];\n};\n\nexport type EnvConfigWritersList = Array<EnvConfigWriter>;\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 throw?: boolean;\n writers?: string[];\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 OneConfigWriterIdResult = {\n writerId: string;\n totalWrittenFiles: number;\n realConfigFiles: EnvsWrittenRealConfigFiles;\n totalRealConfigFiles: number;\n extendingConfigFiles: EnvsWrittenExtendingConfigFiles;\n totalExtendingConfigFiles: number;\n};\n\nexport type WriteResults = {\n writersResult: OneConfigWriterIdResult[];\n totalWrittenFiles: number;\n totalRealConfigFiles: number;\n totalExtendingConfigFiles: number;\n};\n\nexport type WriteConfigFilesResult = {\n cleanResults?: string[];\n writeResults: WriteResults;\n wsDir: string;\n err?: Error;\n};\n\nexport class WorkspaceConfigFilesMain {\n private envsNotImplementing = {};\n\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private logger: Logger,\n private config: WorkspaceConfigFilesAspectConfig\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 if (!this.workspace) {\n throw new ConsumerNotFound();\n }\n const defaultOpts: WriteConfigFilesOptions = {\n clean: false,\n dedupe: false,\n silent: false,\n dryRun: false,\n throw: true,\n };\n const optionsWithDefaults = defaults(options, defaultOpts);\n const execContext = await this.getExecContext();\n\n let pathsToClean: string[] | undefined = [];\n let writeErr;\n let writeResults;\n try {\n if (optionsWithDefaults.clean) {\n pathsToClean = await this.calcPathsToClean({ writers: optionsWithDefaults.writers });\n }\n\n writeResults = await this.write(execContext, optionsWithDefaults);\n const allWrittenFiles = writeResults.writersResult.flatMap((writerResult) => {\n return writerResult.extendingConfigFiles.flatMap((extendingConfigFile) => {\n return extendingConfigFile.extendingConfigFile.filePaths;\n });\n });\n // Avoid delete and re-create files that were written by other config writers\n // instead of deleting at the beginning then write all\n // we write all and then delete the files that were not written by the config writers\n // This reduces the config files that re-created (as many times no changes needed)\n // which prevent issues with needing to restart the ts-server in the ide\n pathsToClean = pathsToClean.filter(\n (pathToClean) => !allWrittenFiles.includes(join(this.workspace.path, pathToClean))\n );\n await this.deleteFiles(pathsToClean);\n } catch (err) {\n this.logger.info('writeConfigFiles failed', err);\n if (optionsWithDefaults.throw) {\n throw new WriteConfigFilesFailed();\n }\n writeErr = err;\n }\n\n return { writeResults, cleanResults: pathsToClean, wsDir: this.workspace.path, err: writeErr };\n }\n\n /**\n * This will check the config.enableWorkspaceConfigWrite before writing the config files.\n */\n async writeConfigFilesIfEnabled(options: WriteConfigFilesOptions = {}): Promise<WriteConfigFilesResult | undefined> {\n const shouldWrite = this.isWorkspaceConfigWriteEnabled();\n if (!shouldWrite) return undefined;\n return this.writeConfigFiles(options);\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 if (!this.workspace) {\n throw new ConsumerNotFound();\n }\n const cleanResults = await this.clean(options);\n return cleanResults;\n }\n\n /**\n * The function checks if the auto writing of workspace configuration is enabled.\n * if it's enabled we will re-generate the configuration files upon bit create\n * @returns the boolean value of `!!this.config.enableWorkspaceConfigWrite`.\n */\n isWorkspaceConfigWriteEnabled() {\n return !!this.config.enableWorkspaceConfigWrite;\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 async listConfigWriters(): Promise<EnvConfigWritersList> {\n if (!this.workspace) {\n throw new ConsumerNotFound();\n }\n const execContexts = await this.getExecContext();\n\n const result: EnvConfigWritersList = execContexts.map((executionContext) => {\n const configWriters = this.getConfigWriters(executionContext);\n return { envId: executionContext.envRuntime.id, executionContext, configWriters };\n });\n return result;\n }\n\n private groupByWriterId(writerList: EnvConfigWritersList): WriterIdsToEnvEntriesMap {\n return writerList.reduce((acc, envConfigWriter: EnvConfigWriter) => {\n envConfigWriter.configWriters.forEach((configWriter: ConfigWriterEntry) => {\n acc[configWriter.id] = acc[configWriter.id] || [];\n acc[configWriter.id].push({ configWriter, envId: envConfigWriter.envId });\n });\n return acc;\n }, {});\n }\n\n private async write(envsExecutionContext: ExecutionContext[], opts: WriteConfigFilesOptions): Promise<WriteResults> {\n const envCompDirsMap = this.getEnvComponentsDirsMap(envsExecutionContext);\n const configsRootDir = this.getConfigsRootDir();\n const configWriters = await this.listConfigWriters();\n const writerIdsToEnvEntriesMap = this.groupByWriterId(configWriters);\n const filteredWriterIdsToEnvEntriesMap = opts.writers\n ? pick(writerIdsToEnvEntriesMap, opts.writers)\n : writerIdsToEnvEntriesMap;\n let totalRealConfigFiles = 0;\n let totalExtendingConfigFiles = 0;\n const results = await pMapSeries(\n Object.entries(filteredWriterIdsToEnvEntriesMap),\n async ([writerId, envEntries]) => {\n const oneResult = await this.handleOneIdWriter(writerId, envEntries, envCompDirsMap, configsRootDir, opts);\n totalRealConfigFiles += oneResult.totalRealConfigFiles;\n totalExtendingConfigFiles += oneResult.totalExtendingConfigFiles;\n return oneResult;\n }\n );\n\n const totalWrittenFiles = totalRealConfigFiles + totalExtendingConfigFiles;\n return { writersResult: results, totalWrittenFiles, totalRealConfigFiles, totalExtendingConfigFiles };\n }\n\n private async handleOneIdWriter(\n writerId: string,\n envEntries: EnvConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n opts: WriteConfigFilesOptions\n ): Promise<OneConfigWriterIdResult> {\n const writtenRealConfigFilesMap = await handleRealConfigFiles(\n envEntries,\n envCompsDirsMap,\n configsRootDir,\n this.workspace.path,\n opts\n );\n const writtenExtendingConfigFiles = await handleExtendingConfigFiles(\n envEntries,\n envCompsDirsMap,\n writtenRealConfigFilesMap,\n configsRootDir,\n this.workspace.path,\n opts\n );\n\n const writtenRealConfigFiles = Object.values(writtenRealConfigFilesMap);\n const totalRealConfigFiles = writtenRealConfigFiles.length;\n const totalExtendingConfigFiles = writtenExtendingConfigFiles.reduce(\n (acc, curr) => acc + curr.extendingConfigFile.filePaths.length,\n 0\n );\n const totalWrittenFiles = totalRealConfigFiles + totalExtendingConfigFiles;\n return {\n writerId,\n totalWrittenFiles,\n realConfigFiles: writtenRealConfigFiles,\n totalRealConfigFiles,\n extendingConfigFiles: writtenExtendingConfigFiles,\n totalExtendingConfigFiles,\n };\n }\n\n private getConfigsRootDir(): string {\n const userConfiguredDir = this.config.configsRootDir;\n return userConfiguredDir ? join(this.workspace.path, userConfiguredDir) : 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(envExecutionContext: ExecutionContext): ConfigWriterEntry[] {\n if (envExecutionContext.env.workspaceConfig && isFunction(envExecutionContext.env.workspaceConfig)) {\n return envExecutionContext.env.workspaceConfig();\n }\n this.addToEnvsNotImplementing(envExecutionContext.env.id);\n return [];\n }\n\n private getFlatConfigWriters(envsExecutionContext: ExecutionContext[]): ConfigWriterEntry[] {\n return flatMap(envsExecutionContext, (envExecutionContext) => {\n return this.getConfigWriters(envExecutionContext);\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 paths = await this.calcPathsToClean({ writers });\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 calcPathsToClean({ writers }: WriteConfigFilesOptions): Promise<string[]> {\n const execContext = await this.getExecContext();\n const configWriters = this.getFlatConfigWriters(execContext);\n const filteredConfigWriters = writers\n ? configWriters.filter((configWriter) => writers.includes(configWriter.id))\n : configWriters;\n\n const paths = uniq(\n 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 );\n return paths;\n }\n\n private addToEnvsNotImplementing(envId: string) {\n this.envsNotImplementing[envId] = true;\n }\n\n getEnvsNotImplementing() {\n return Object.keys(this.envsNotImplementing);\n }\n\n private async promptForCleaning(paths: string[]) {\n this.logger.clearStatusLine();\n const ok = await yesno({\n question: `${chalk.underline('The following files 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 static slots = [];\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 defaultConfig: Partial<WorkspaceConfigFilesAspectConfig> = {\n enableWorkspaceConfigWrite: false,\n };\n\n static async provider(\n [cli, workspace, envs, loggerAspect]: [CLIMain, Workspace, EnvsMain, LoggerMain],\n config: WorkspaceConfigFilesAspectConfig\n ) {\n const logger = loggerAspect.createLogger(WorkspaceConfigFilesAspect.id);\n envs.registerService(new WorkspaceConfigFilesService(logger));\n\n const workspaceConfigFilesMain = new WorkspaceConfigFilesMain(workspace, envs, logger, config);\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,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL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AA,GAEjDmB,wBAAwB","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.WorkspaceConfigFilesService = void 0;
|
|
7
|
-
function _defineProperty(
|
|
7
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
class WorkspaceConfigFilesService {
|
|
@@ -60,10 +60,10 @@ function _dedupPaths() {
|
|
|
60
60
|
};
|
|
61
61
|
return data;
|
|
62
62
|
}
|
|
63
|
-
function _interopRequireDefault(
|
|
63
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
64
64
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
65
65
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
66
|
-
function _defineProperty(
|
|
66
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
67
67
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
68
68
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
69
69
|
async function handleExtendingConfigFiles(envEntries, envCompsDirsMap, writtenRealConfigFiles, configsRootDir, workspaceDir, opts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_normalizePath","data","_interopRequireDefault","require","_stringFormat","_utils","_fsExtra","_path","_pMapSeries","_lodash","_dedupPaths","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","handleExtendingConfigFiles","envEntries","envCompsDirsMap","writtenRealConfigFiles","configsRootDir","workspaceDir","opts","extendingConfigFilesMap","buildExtendingConfigFilesMap","fileHashPerDedupedPaths","dedupePaths","postProcessExtendingConfigFiles","envsWrittenExtendingConfigFiles","writeExtendingConfigFiles","allEnvsCalculatedExtendingConfigFiles","compact","pMapSeries","envConfigFileEntry","envMapVal","envId","writtenConfigFilesForEnv","getEnvOnlyWrittenRealConfigFiles","extendingConfigFile","generateOneExtendingConfigFile","undefined","indexExtendingConfigFiles","values","reduce","acc","envIds","writtenRealConfigFile","includes","writtenConfigFiles","envMapValue","configWriter","executionContext","args","generateExtendingFile","hash","sha1","content","useAbsPaths","multiEnvCalculatedExtendingConfigFiles","mergedConfigFiles","curr","currentValue","postProcessFunc","extendingConfigFileEntry","find","entry","dedupEntry","fileHashPerDedupedPath","fileHash","postProcessRes","paths","supportSpecificPathChange","path","currPath","newHash","JSON","parse","stringify","foundNewHash","finalResult","Promise","all","map","envsConfigFile","configFile","name","format","writtenPaths","filePath","join","targetPath","extendingTarget","normalize","relative","dirname","replace","dryRun","fs","outputFile","res","filePaths"],"sources":["extending-config-files.ts"],"sourcesContent":["import normalize from 'normalize-path';\nimport format from 'string-format';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { dirname, join, relative } from 'path';\nimport pMapSeries from 'p-map-series';\nimport { compact } from 'lodash';\nimport { ExtendingConfigFile } from '../config-writer-entry';\nimport { DedupedPaths, dedupePaths } from '../dedup-paths';\nimport {\n EnvCompsDirsMap,\n EnvConfigWriterEntry,\n EnvMapValue,\n WriteConfigFilesOptions,\n} from '../workspace-config-files.main.runtime';\nimport { WrittenConfigFile, WrittenRealConfigFilesByHash } from './real-config-files';\n\ntype EnvCalculatedExtendingConfigFile = {\n envId: string;\n extendingConfigFile: Required<ExtendingConfigFile>;\n};\nexport type WrittenExtendingConfigFile = ExtendingConfigFile & {\n filePaths: string[];\n};\nexport type EnvsWrittenExtendingConfigFile = { envIds: string[]; extendingConfigFile: WrittenExtendingConfigFile };\nexport type EnvsWrittenExtendingConfigFiles = Array<EnvsWrittenExtendingConfigFile>;\nexport type ExtendingConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n extendingConfigFile: Required<ExtendingConfigFile>;\n };\n};\n\nexport async function handleExtendingConfigFiles(\n envEntries: EnvConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n writtenRealConfigFiles: WrittenRealConfigFilesByHash,\n configsRootDir: string,\n workspaceDir: string,\n opts: WriteConfigFilesOptions\n): Promise<EnvsWrittenExtendingConfigFiles> {\n const extendingConfigFilesMap = await buildExtendingConfigFilesMap(\n envEntries,\n writtenRealConfigFiles,\n envCompsDirsMap,\n configsRootDir,\n workspaceDir\n );\n const fileHashPerDedupedPaths = dedupePaths(extendingConfigFilesMap, envCompsDirsMap);\n await postProcessExtendingConfigFiles(\n envEntries,\n envCompsDirsMap,\n extendingConfigFilesMap,\n fileHashPerDedupedPaths,\n configsRootDir,\n workspaceDir\n );\n const envsWrittenExtendingConfigFiles = await writeExtendingConfigFiles(\n extendingConfigFilesMap,\n fileHashPerDedupedPaths,\n workspaceDir,\n opts\n );\n return envsWrittenExtendingConfigFiles;\n}\n\nasync function buildExtendingConfigFilesMap(\n envEntries: EnvConfigWriterEntry[],\n writtenRealConfigFiles: WrittenRealConfigFilesByHash,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n workspaceDir: string\n): Promise<ExtendingConfigFilesMap> {\n const allEnvsCalculatedExtendingConfigFiles: EnvCalculatedExtendingConfigFile[] = compact(\n await pMapSeries(envEntries, async (envConfigFileEntry) => {\n const envMapVal = envCompsDirsMap[envConfigFileEntry.envId];\n const writtenConfigFilesForEnv: WrittenConfigFile[] = getEnvOnlyWrittenRealConfigFiles(\n envConfigFileEntry.envId,\n writtenRealConfigFiles\n );\n const extendingConfigFile = generateOneExtendingConfigFile(\n writtenConfigFilesForEnv,\n envConfigFileEntry,\n envMapVal,\n configsRootDir,\n workspaceDir\n );\n if (!extendingConfigFile) {\n return undefined;\n }\n return {\n envId: envConfigFileEntry.envId,\n extendingConfigFile,\n };\n })\n );\n const extendingConfigFilesMap: ExtendingConfigFilesMap = indexExtendingConfigFiles(\n allEnvsCalculatedExtendingConfigFiles\n );\n return extendingConfigFilesMap;\n}\n\nfunction getEnvOnlyWrittenRealConfigFiles(\n envId: string,\n writtenRealConfigFiles: WrittenRealConfigFilesByHash\n): WrittenConfigFile[] {\n return Object.values(writtenRealConfigFiles).reduce((acc, { envIds, writtenRealConfigFile }) => {\n if (envIds.includes(envId)) {\n acc.push(writtenRealConfigFile);\n }\n return acc;\n }, [] as WrittenConfigFile[]);\n}\n\nfunction generateOneExtendingConfigFile(\n writtenConfigFiles: WrittenConfigFile[],\n envConfigFileEntry: EnvConfigWriterEntry,\n envMapValue: EnvMapValue,\n configsRootDir: string,\n workspaceDir: string\n): Required<ExtendingConfigFile> | undefined {\n const { configWriter, executionContext } = envConfigFileEntry;\n const args = {\n workspaceDir,\n configsRootDir,\n writtenConfigFiles,\n executionContext,\n envMapValue,\n };\n const extendingConfigFile = configWriter.generateExtendingFile(args);\n if (!extendingConfigFile) return undefined;\n const hash = extendingConfigFile.hash || sha1(extendingConfigFile.content);\n return {\n ...extendingConfigFile,\n useAbsPaths: !!extendingConfigFile.useAbsPaths,\n hash,\n };\n}\n\nfunction indexExtendingConfigFiles(\n multiEnvCalculatedExtendingConfigFiles: EnvCalculatedExtendingConfigFile[]\n): ExtendingConfigFilesMap {\n const mergedConfigFiles = multiEnvCalculatedExtendingConfigFiles.reduce(\n (acc, curr: EnvCalculatedExtendingConfigFile) => {\n const extendingConfigFile = curr.extendingConfigFile;\n const currentValue = acc[extendingConfigFile.hash];\n if (currentValue) {\n currentValue.envIds.push(curr.envId);\n } else {\n acc[extendingConfigFile.hash] = { envIds: [curr.envId], extendingConfigFile };\n }\n return acc;\n },\n {}\n );\n return mergedConfigFiles;\n}\n\nasync function postProcessExtendingConfigFiles(\n envEntries: EnvConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n fileHashPerDedupedPaths: DedupedPaths,\n configsRootDir: string,\n workspaceDir: string\n) {\n await pMapSeries(envEntries, async (envConfigFileEntry) => {\n const postProcessFunc = envConfigFileEntry.configWriter.postProcessExtendingConfigFiles;\n if (!postProcessFunc) {\n return undefined;\n }\n const envMapVal = envCompsDirsMap[envConfigFileEntry.envId];\n const extendingConfigFileEntry = Object.values(extendingConfigFilesMap).find((entry) => {\n return entry.envIds.includes(envConfigFileEntry.envId);\n });\n if (!extendingConfigFileEntry) {\n return undefined;\n }\n const dedupEntry = fileHashPerDedupedPaths.find((fileHashPerDedupedPath) => {\n return fileHashPerDedupedPath.fileHash === extendingConfigFileEntry.extendingConfigFile.hash;\n });\n if (!dedupEntry) {\n return undefined;\n }\n\n const postProcessRes = await postProcessFunc({\n configsRootDir,\n extendingConfigFile: extendingConfigFileEntry.extendingConfigFile,\n envMapValue: envMapVal,\n workspaceDir,\n paths: dedupEntry.paths,\n supportSpecificPathChange: true,\n });\n if (!postProcessRes) {\n return undefined;\n }\n if (typeof postProcessRes === 'string') {\n extendingConfigFileEntry.extendingConfigFile.content = postProcessRes;\n return undefined;\n }\n postProcessRes.forEach(({ path, content }) => {\n // Remove it from the current entry\n dedupEntry.paths = dedupEntry.paths.filter((currPath) => currPath !== path);\n const newHash = sha1(content);\n extendingConfigFilesMap[newHash] = JSON.parse(JSON.stringify(extendingConfigFileEntry));\n extendingConfigFilesMap[newHash].extendingConfigFile.content = content;\n const foundNewHash = fileHashPerDedupedPaths.find((entry) => entry.fileHash === newHash);\n if (foundNewHash) {\n foundNewHash.paths.push(path);\n } else {\n fileHashPerDedupedPaths.push({ fileHash: newHash, paths: [path] });\n }\n });\n return undefined;\n });\n}\n\nasync function writeExtendingConfigFiles(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n fileHashPerDedupedPaths: DedupedPaths,\n workspaceDir: string,\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(workspaceDir, path, name);\n const targetPath = configFile.useAbsPaths\n ? configFile.extendingTarget.filePath\n : normalize(`./${relative(dirname(filePath), configFile.extendingTarget.filePath)}`);\n const content = configFile.content.replace(`{${configFile.extendingTarget.name}}`, targetPath);\n if (!opts.dryRun) {\n await fs.outputFile(filePath, 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"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,QAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,OAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAS,YAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,WAA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C,YAAY,GAAG,MAAMP,OAAO,CAACC,GAAG,CACpCX,KAAK,CAACY,GAAG,CAAC,MAAOV,IAAI,IAAK;MACxB,MAAMgB,QAAQ,GAAG,IAAAC,YAAI,EAACpE,YAAY,EAAEmD,IAAI,EAAEa,IAAI,CAAC;MAC/C,MAAMK,UAAU,GAAGN,UAAU,CAAC3B,WAAW,GACrC2B,UAAU,CAACO,eAAe,CAACH,QAAQ,GACnC,IAAAI,wBAAS,EAAE,KAAI,IAAAC,gBAAQ,EAAC,IAAAC,eAAO,EAACN,QAAQ,CAAC,EAAEJ,UAAU,CAACO,eAAe,CAACH,QAAQ,CAAE,EAAC,CAAC;MACtF,MAAMhC,OAAO,GAAG4B,UAAU,CAAC5B,OAAO,CAACuC,OAAO,CAAE,IAAGX,UAAU,CAACO,eAAe,CAACN,IAAK,GAAE,EAAEK,UAAU,CAAC;MAC9F,IAAI,CAACpE,IAAI,CAAC0E,MAAM,EAAE;QAChB,MAAMC,kBAAE,CAACC,UAAU,CAACV,QAAQ,EAAEhC,OAAO,CAAC;MACxC;MACA,OAAOgC,QAAQ;IACjB,CAAC,CACH,CAAC;IACD,MAAMW,GAAmC,GAAG;MAC1CtD,MAAM,EAAEsC,cAAc,CAACtC,MAAM;MAC7BP,mBAAmB,EAAE;QACnB+C,IAAI;QACJ/B,IAAI;QACJE,OAAO,EAAE4B,UAAU,CAAC5B,OAAO;QAC3BmC,eAAe,EAAEP,UAAU,CAACO,eAAe;QAC3CS,SAAS,EAAEb;MACb;IACF,CAAC;IACD,OAAOY,GAAG;EACZ,CAAC,CACH,CAAC;EACD,OAAOpB,WAAW;AACpB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_normalizePath","data","_interopRequireDefault","require","_stringFormat","_utils","_fsExtra","_path","_pMapSeries","_lodash","_dedupPaths","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","handleExtendingConfigFiles","envEntries","envCompsDirsMap","writtenRealConfigFiles","configsRootDir","workspaceDir","opts","extendingConfigFilesMap","buildExtendingConfigFilesMap","fileHashPerDedupedPaths","dedupePaths","postProcessExtendingConfigFiles","envsWrittenExtendingConfigFiles","writeExtendingConfigFiles","allEnvsCalculatedExtendingConfigFiles","compact","pMapSeries","envConfigFileEntry","envMapVal","envId","writtenConfigFilesForEnv","getEnvOnlyWrittenRealConfigFiles","extendingConfigFile","generateOneExtendingConfigFile","undefined","indexExtendingConfigFiles","values","reduce","acc","envIds","writtenRealConfigFile","includes","writtenConfigFiles","envMapValue","configWriter","executionContext","args","generateExtendingFile","hash","sha1","content","useAbsPaths","multiEnvCalculatedExtendingConfigFiles","mergedConfigFiles","curr","currentValue","postProcessFunc","extendingConfigFileEntry","find","entry","dedupEntry","fileHashPerDedupedPath","fileHash","postProcessRes","paths","supportSpecificPathChange","path","currPath","newHash","JSON","parse","stringify","foundNewHash","finalResult","Promise","all","map","envsConfigFile","configFile","name","format","writtenPaths","filePath","join","targetPath","extendingTarget","normalize","relative","dirname","replace","dryRun","fs","outputFile","res","filePaths"],"sources":["extending-config-files.ts"],"sourcesContent":["import normalize from 'normalize-path';\nimport format from 'string-format';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { dirname, join, relative } from 'path';\nimport pMapSeries from 'p-map-series';\nimport { compact } from 'lodash';\nimport { ExtendingConfigFile } from '../config-writer-entry';\nimport { DedupedPaths, dedupePaths } from '../dedup-paths';\nimport {\n EnvCompsDirsMap,\n EnvConfigWriterEntry,\n EnvMapValue,\n WriteConfigFilesOptions,\n} from '../workspace-config-files.main.runtime';\nimport { WrittenConfigFile, WrittenRealConfigFilesByHash } from './real-config-files';\n\ntype EnvCalculatedExtendingConfigFile = {\n envId: string;\n extendingConfigFile: Required<ExtendingConfigFile>;\n};\nexport type WrittenExtendingConfigFile = ExtendingConfigFile & {\n filePaths: string[];\n};\nexport type EnvsWrittenExtendingConfigFile = { envIds: string[]; extendingConfigFile: WrittenExtendingConfigFile };\nexport type EnvsWrittenExtendingConfigFiles = Array<EnvsWrittenExtendingConfigFile>;\nexport type ExtendingConfigFilesMap = {\n [configFileHash: string]: {\n envIds: string[];\n extendingConfigFile: Required<ExtendingConfigFile>;\n };\n};\n\nexport async function handleExtendingConfigFiles(\n envEntries: EnvConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n writtenRealConfigFiles: WrittenRealConfigFilesByHash,\n configsRootDir: string,\n workspaceDir: string,\n opts: WriteConfigFilesOptions\n): Promise<EnvsWrittenExtendingConfigFiles> {\n const extendingConfigFilesMap = await buildExtendingConfigFilesMap(\n envEntries,\n writtenRealConfigFiles,\n envCompsDirsMap,\n configsRootDir,\n workspaceDir\n );\n const fileHashPerDedupedPaths = dedupePaths(extendingConfigFilesMap, envCompsDirsMap);\n await postProcessExtendingConfigFiles(\n envEntries,\n envCompsDirsMap,\n extendingConfigFilesMap,\n fileHashPerDedupedPaths,\n configsRootDir,\n workspaceDir\n );\n const envsWrittenExtendingConfigFiles = await writeExtendingConfigFiles(\n extendingConfigFilesMap,\n fileHashPerDedupedPaths,\n workspaceDir,\n opts\n );\n return envsWrittenExtendingConfigFiles;\n}\n\nasync function buildExtendingConfigFilesMap(\n envEntries: EnvConfigWriterEntry[],\n writtenRealConfigFiles: WrittenRealConfigFilesByHash,\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n workspaceDir: string\n): Promise<ExtendingConfigFilesMap> {\n const allEnvsCalculatedExtendingConfigFiles: EnvCalculatedExtendingConfigFile[] = compact(\n await pMapSeries(envEntries, async (envConfigFileEntry) => {\n const envMapVal = envCompsDirsMap[envConfigFileEntry.envId];\n const writtenConfigFilesForEnv: WrittenConfigFile[] = getEnvOnlyWrittenRealConfigFiles(\n envConfigFileEntry.envId,\n writtenRealConfigFiles\n );\n const extendingConfigFile = generateOneExtendingConfigFile(\n writtenConfigFilesForEnv,\n envConfigFileEntry,\n envMapVal,\n configsRootDir,\n workspaceDir\n );\n if (!extendingConfigFile) {\n return undefined;\n }\n return {\n envId: envConfigFileEntry.envId,\n extendingConfigFile,\n };\n })\n );\n const extendingConfigFilesMap: ExtendingConfigFilesMap = indexExtendingConfigFiles(\n allEnvsCalculatedExtendingConfigFiles\n );\n return extendingConfigFilesMap;\n}\n\nfunction getEnvOnlyWrittenRealConfigFiles(\n envId: string,\n writtenRealConfigFiles: WrittenRealConfigFilesByHash\n): WrittenConfigFile[] {\n return Object.values(writtenRealConfigFiles).reduce((acc, { envIds, writtenRealConfigFile }) => {\n if (envIds.includes(envId)) {\n acc.push(writtenRealConfigFile);\n }\n return acc;\n }, [] as WrittenConfigFile[]);\n}\n\nfunction generateOneExtendingConfigFile(\n writtenConfigFiles: WrittenConfigFile[],\n envConfigFileEntry: EnvConfigWriterEntry,\n envMapValue: EnvMapValue,\n configsRootDir: string,\n workspaceDir: string\n): Required<ExtendingConfigFile> | undefined {\n const { configWriter, executionContext } = envConfigFileEntry;\n const args = {\n workspaceDir,\n configsRootDir,\n writtenConfigFiles,\n executionContext,\n envMapValue,\n };\n const extendingConfigFile = configWriter.generateExtendingFile(args);\n if (!extendingConfigFile) return undefined;\n const hash = extendingConfigFile.hash || sha1(extendingConfigFile.content);\n return {\n ...extendingConfigFile,\n useAbsPaths: !!extendingConfigFile.useAbsPaths,\n hash,\n };\n}\n\nfunction indexExtendingConfigFiles(\n multiEnvCalculatedExtendingConfigFiles: EnvCalculatedExtendingConfigFile[]\n): ExtendingConfigFilesMap {\n const mergedConfigFiles = multiEnvCalculatedExtendingConfigFiles.reduce(\n (acc, curr: EnvCalculatedExtendingConfigFile) => {\n const extendingConfigFile = curr.extendingConfigFile;\n const currentValue = acc[extendingConfigFile.hash];\n if (currentValue) {\n currentValue.envIds.push(curr.envId);\n } else {\n acc[extendingConfigFile.hash] = { envIds: [curr.envId], extendingConfigFile };\n }\n return acc;\n },\n {}\n );\n return mergedConfigFiles;\n}\n\nasync function postProcessExtendingConfigFiles(\n envEntries: EnvConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n fileHashPerDedupedPaths: DedupedPaths,\n configsRootDir: string,\n workspaceDir: string\n) {\n await pMapSeries(envEntries, async (envConfigFileEntry) => {\n const postProcessFunc = envConfigFileEntry.configWriter.postProcessExtendingConfigFiles;\n if (!postProcessFunc) {\n return undefined;\n }\n const envMapVal = envCompsDirsMap[envConfigFileEntry.envId];\n const extendingConfigFileEntry = Object.values(extendingConfigFilesMap).find((entry) => {\n return entry.envIds.includes(envConfigFileEntry.envId);\n });\n if (!extendingConfigFileEntry) {\n return undefined;\n }\n const dedupEntry = fileHashPerDedupedPaths.find((fileHashPerDedupedPath) => {\n return fileHashPerDedupedPath.fileHash === extendingConfigFileEntry.extendingConfigFile.hash;\n });\n if (!dedupEntry) {\n return undefined;\n }\n\n const postProcessRes = await postProcessFunc({\n configsRootDir,\n extendingConfigFile: extendingConfigFileEntry.extendingConfigFile,\n envMapValue: envMapVal,\n workspaceDir,\n paths: dedupEntry.paths,\n supportSpecificPathChange: true,\n });\n if (!postProcessRes) {\n return undefined;\n }\n if (typeof postProcessRes === 'string') {\n extendingConfigFileEntry.extendingConfigFile.content = postProcessRes;\n return undefined;\n }\n postProcessRes.forEach(({ path, content }) => {\n // Remove it from the current entry\n dedupEntry.paths = dedupEntry.paths.filter((currPath) => currPath !== path);\n const newHash = sha1(content);\n extendingConfigFilesMap[newHash] = JSON.parse(JSON.stringify(extendingConfigFileEntry));\n extendingConfigFilesMap[newHash].extendingConfigFile.content = content;\n const foundNewHash = fileHashPerDedupedPaths.find((entry) => entry.fileHash === newHash);\n if (foundNewHash) {\n foundNewHash.paths.push(path);\n } else {\n fileHashPerDedupedPaths.push({ fileHash: newHash, paths: [path] });\n }\n });\n return undefined;\n });\n}\n\nasync function writeExtendingConfigFiles(\n extendingConfigFilesMap: ExtendingConfigFilesMap,\n fileHashPerDedupedPaths: DedupedPaths,\n workspaceDir: string,\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(workspaceDir, path, name);\n const targetPath = configFile.useAbsPaths\n ? configFile.extendingTarget.filePath\n : normalize(`./${relative(dirname(filePath), configFile.extendingTarget.filePath)}`);\n const content = configFile.content.replace(`{${configFile.extendingTarget.name}}`, targetPath);\n if (!opts.dryRun) {\n await fs.outputFile(filePath, 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"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA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OAAOgC,QAAQ;IACjB,CAAC,CACH,CAAC;IACD,MAAMW,GAAmC,GAAG;MAC1CtD,MAAM,EAAEsC,cAAc,CAACtC,MAAM;MAC7BP,mBAAmB,EAAE;QACnB+C,IAAI;QACJ/B,IAAI;QACJE,OAAO,EAAE4B,UAAU,CAAC5B,OAAO;QAC3BmC,eAAe,EAAEP,UAAU,CAACO,eAAe;QAC3CS,SAAS,EAAEb;MACb;IACF,CAAC;IACD,OAAOY,GAAG;EACZ,CAAC,CACH,CAAC;EACD,OAAOpB,WAAW;AACpB","ignoreList":[]}
|
|
@@ -46,10 +46,10 @@ function _lodash() {
|
|
|
46
46
|
};
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
|
-
function _interopRequireDefault(
|
|
49
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
50
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
51
51
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
52
|
-
function _defineProperty(
|
|
52
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
53
53
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
54
54
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
55
55
|
async function handleRealConfigFiles(envEntries, envCompsDirsMap, configsRootDir, workspaceDir, opts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_stringFormat","data","_interopRequireDefault","require","_utils","_fsExtra","_path","_pMapSeries","_lodash","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","handleRealConfigFiles","envEntries","envCompsDirsMap","configsRootDir","workspaceDir","opts","allEnvsCalculatedRealConfigFiles","pMapSeries","envConfigFileEntry","envMapVal","envId","realConfigFiles","calculateOneEnvRealConfigFiles","realConfigFilesWithHash","ensureHashOnConfigFiles","compact","mergeFunc","find","envEntry","configWriter","mergeConfigFiles","mergedRealConfigFiles","mergeRealConfigFiles","writtenConfigFilesMap","Promise","all","entries","map","hash","envIds","realConfigFile","writtenRealConfigFile","writeConfigFile","configFiles","configFile","sha1","content","envMapValue","executionContext","calculatedConfigFiles","calcConfigFiles","multiEnvCalculatedRealConfigFiles","mergedConfigFiles","reduce","acc","curr","currentValue","mergedConfigFileContent","name","format","filePath","join","dryRun","fs","outputFile","res"],"sources":["real-config-files.ts"],"sourcesContent":["import format from 'string-format';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { join } from 'path';\nimport pMapSeries from 'p-map-series';\nimport { compact } from 'lodash';\nimport { ConfigFile, MergeConfigFilesFunc } from '../config-writer-entry';\nimport {\n EnvCompsDirsMap,\n EnvConfigWriterEntry,\n EnvMapValue,\n WriteConfigFilesOptions,\n} from '../workspace-config-files.main.runtime';\n\ntype MergedRealConfigFilesByHash = {\n [hash: string]: {\n envIds: string[];\n realConfigFile: Required<ConfigFile>;\n };\n};\n\nexport type EnvsWrittenRealConfigFiles = Array<EnvsWrittenRealConfigFile>;\n\nexport type EnvsWrittenRealConfigFile = {\n envIds: string[];\n writtenRealConfigFile: WrittenConfigFile;\n};\n\nexport type WrittenRealConfigFilesByHash = {\n [hash: string]: EnvsWrittenRealConfigFile;\n};\n\nexport type WrittenConfigFile = Required<ConfigFile> & {\n filePath: string;\n};\n\ntype EnvCalculatedRealConfigFiles = {\n envId: string;\n realConfigFiles: Required<ConfigFile>[];\n};\n\nexport async function handleRealConfigFiles(\n envEntries: EnvConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n workspaceDir: string,\n opts: WriteConfigFilesOptions\n): Promise<WrittenRealConfigFilesByHash> {\n const allEnvsCalculatedRealConfigFiles: EnvCalculatedRealConfigFiles[] = await pMapSeries(\n envEntries,\n async (envConfigFileEntry) => {\n const envMapVal = envCompsDirsMap[envConfigFileEntry.envId];\n const realConfigFiles = await calculateOneEnvRealConfigFiles(\n envConfigFileEntry,\n envMapVal,\n configsRootDir,\n workspaceDir\n );\n const realConfigFilesWithHash = ensureHashOnConfigFiles(compact(realConfigFiles));\n return {\n envId: envConfigFileEntry.envId,\n realConfigFiles: realConfigFilesWithHash,\n };\n }\n );\n // Find the first merge function exists\n const mergeFunc = envEntries.find((envEntry) => !!envEntry.configWriter.mergeConfigFiles)?.configWriter\n .mergeConfigFiles;\n const mergedRealConfigFiles = mergeRealConfigFiles(allEnvsCalculatedRealConfigFiles, mergeFunc);\n const writtenConfigFilesMap: WrittenRealConfigFilesByHash = {};\n await Promise.all(\n Object.entries(mergedRealConfigFiles).map(async ([hash, { envIds, realConfigFile }]) => {\n const writtenRealConfigFile = await writeConfigFile(realConfigFile, configsRootDir, opts);\n writtenConfigFilesMap[hash] = {\n envIds,\n writtenRealConfigFile,\n };\n })\n );\n\n return writtenConfigFilesMap;\n}\n\nfunction ensureHashOnConfigFiles(configFiles: ConfigFile[]): Array<Required<ConfigFile>> {\n return configFiles.map((configFile): Required<ConfigFile> => {\n if (!configFile.hash) {\n const hash = sha1(configFile.content);\n return { ...configFile, hash };\n }\n return configFile as Required<ConfigFile>;\n });\n}\n\nasync function calculateOneEnvRealConfigFiles(\n envConfigFileEntry: EnvConfigWriterEntry,\n envMapValue: EnvMapValue,\n configsRootDir: string,\n workspaceDir: string\n) {\n const { configWriter, executionContext } = envConfigFileEntry;\n const calculatedConfigFiles = configWriter.calcConfigFiles(\n executionContext,\n envMapValue,\n configsRootDir,\n workspaceDir\n );\n return calculatedConfigFiles;\n}\n\nfunction mergeRealConfigFiles(\n multiEnvCalculatedRealConfigFiles: EnvCalculatedRealConfigFiles[],\n mergeFunc?: MergeConfigFilesFunc\n): MergedRealConfigFilesByHash {\n const mergedConfigFiles = multiEnvCalculatedRealConfigFiles.reduce((acc, curr: EnvCalculatedRealConfigFiles) => {\n curr.realConfigFiles.forEach((realConfigFile) => {\n const currentValue = acc[realConfigFile.hash];\n if (currentValue) {\n currentValue.envIds.push(curr.envId);\n if (currentValue && mergeFunc) {\n const mergedConfigFileContent = mergeFunc(currentValue.realConfigFile, realConfigFile);\n currentValue.realConfigFile.content = mergedConfigFileContent;\n realConfigFile.content = mergedConfigFileContent;\n acc[realConfigFile.hash].realConfigFile = realConfigFile;\n }\n } else {\n acc[realConfigFile.hash] = { envIds: [curr.envId], realConfigFile };\n }\n });\n return acc;\n }, {});\n return mergedConfigFiles;\n}\n\nasync function 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.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uB,GAAG/B,SAAS,CAAC8B,YAAY,CAAChB,cAAc,EAAEA,cAAc,CAAC;UACtFgB,YAAY,CAAChB,cAAc,CAACM,OAAO,GAAGW,uBAAuB;UAC7DjB,cAAc,CAACM,OAAO,GAAGW,uBAAuB;UAChDH,GAAG,CAACd,cAAc,CAACF,IAAI,CAAC,CAACE,cAAc,GAAGA,cAAc;QAC1D;MACF,CAAC,MAAM;QACLc,GAAG,CAACd,cAAc,CAACF,IAAI,CAAC,GAAG;UAAEC,MAAM,EAAE,CAACgB,IAAI,CAACnC,KAAK,CAAC;UAAEoB;QAAe,CAAC;MACrE;IACF,CAAC,CAAC;IACF,OAAOc,GAAG;EACZ,CAAC,EAAE,CAAC,CAAC,CAAC;EACN,OAAOF,iBAAiB;AAC1B;AAEA,eAAeV,eAAeA,CAC5BE,UAAsB,EACtB/B,cAAsB,EACtBE,IAA6B,EACD;EAC5B,MAAMuB,IAAI,GAAGM,UAAU,CAACN,IAAI,IAAI,IAAAO,aAAI,EAACD,UAAU,CAACE,OAAO,CAAC;EACxD,MAAMY,IAAI,GAAG,IAAAC,uBAAM,EAACf,UAAU,CAACc,IAAI,EAAE;IAAEpB;EAAK,CAAC,CAAC;EAC9C,MAAMsB,QAAQ,GAAG,IAAAC,YAAI,EAAChD,cAAc,EAAE6C,IAAI,CAAC;EAC3C,IAAI,CAAC3C,IAAI,CAAC+C,MAAM,EAAE;IAChB;IACA;IACA,MAAMC,kBAAE,CAACC,UAAU,CAACJ,QAAQ,EAAEhB,UAAU,CAACE,OAAO,CAAC;IACjD;EACF;EACA,MAAMmB,GAAG,GAAG;IACVP,IAAI;IACJpB,IAAI;IACJsB,QAAQ;IACRd,OAAO,EAAEF,UAAU,CAACE;EACtB,CAAC;EACD,OAAOmB,GAAG;AACZ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_stringFormat","data","_interopRequireDefault","require","_utils","_fsExtra","_path","_pMapSeries","_lodash","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","handleRealConfigFiles","envEntries","envCompsDirsMap","configsRootDir","workspaceDir","opts","allEnvsCalculatedRealConfigFiles","pMapSeries","envConfigFileEntry","envMapVal","envId","realConfigFiles","calculateOneEnvRealConfigFiles","realConfigFilesWithHash","ensureHashOnConfigFiles","compact","mergeFunc","find","envEntry","configWriter","mergeConfigFiles","mergedRealConfigFiles","mergeRealConfigFiles","writtenConfigFilesMap","Promise","all","entries","map","hash","envIds","realConfigFile","writtenRealConfigFile","writeConfigFile","configFiles","configFile","sha1","content","envMapValue","executionContext","calculatedConfigFiles","calcConfigFiles","multiEnvCalculatedRealConfigFiles","mergedConfigFiles","reduce","acc","curr","currentValue","mergedConfigFileContent","name","format","filePath","join","dryRun","fs","outputFile","res"],"sources":["real-config-files.ts"],"sourcesContent":["import format from 'string-format';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { join } from 'path';\nimport pMapSeries from 'p-map-series';\nimport { compact } from 'lodash';\nimport { ConfigFile, MergeConfigFilesFunc } from '../config-writer-entry';\nimport {\n EnvCompsDirsMap,\n EnvConfigWriterEntry,\n EnvMapValue,\n WriteConfigFilesOptions,\n} from '../workspace-config-files.main.runtime';\n\ntype MergedRealConfigFilesByHash = {\n [hash: string]: {\n envIds: string[];\n realConfigFile: Required<ConfigFile>;\n };\n};\n\nexport type EnvsWrittenRealConfigFiles = Array<EnvsWrittenRealConfigFile>;\n\nexport type EnvsWrittenRealConfigFile = {\n envIds: string[];\n writtenRealConfigFile: WrittenConfigFile;\n};\n\nexport type WrittenRealConfigFilesByHash = {\n [hash: string]: EnvsWrittenRealConfigFile;\n};\n\nexport type WrittenConfigFile = Required<ConfigFile> & {\n filePath: string;\n};\n\ntype EnvCalculatedRealConfigFiles = {\n envId: string;\n realConfigFiles: Required<ConfigFile>[];\n};\n\nexport async function handleRealConfigFiles(\n envEntries: EnvConfigWriterEntry[],\n envCompsDirsMap: EnvCompsDirsMap,\n configsRootDir: string,\n workspaceDir: string,\n opts: WriteConfigFilesOptions\n): Promise<WrittenRealConfigFilesByHash> {\n const allEnvsCalculatedRealConfigFiles: EnvCalculatedRealConfigFiles[] = await pMapSeries(\n envEntries,\n async (envConfigFileEntry) => {\n const envMapVal = envCompsDirsMap[envConfigFileEntry.envId];\n const realConfigFiles = await calculateOneEnvRealConfigFiles(\n envConfigFileEntry,\n envMapVal,\n configsRootDir,\n workspaceDir\n );\n const realConfigFilesWithHash = ensureHashOnConfigFiles(compact(realConfigFiles));\n return {\n envId: envConfigFileEntry.envId,\n realConfigFiles: realConfigFilesWithHash,\n };\n }\n );\n // Find the first merge function exists\n const mergeFunc = envEntries.find((envEntry) => !!envEntry.configWriter.mergeConfigFiles)?.configWriter\n .mergeConfigFiles;\n const mergedRealConfigFiles = mergeRealConfigFiles(allEnvsCalculatedRealConfigFiles, mergeFunc);\n const writtenConfigFilesMap: WrittenRealConfigFilesByHash = {};\n await Promise.all(\n Object.entries(mergedRealConfigFiles).map(async ([hash, { envIds, realConfigFile }]) => {\n const writtenRealConfigFile = await writeConfigFile(realConfigFile, configsRootDir, opts);\n writtenConfigFilesMap[hash] = {\n envIds,\n writtenRealConfigFile,\n };\n })\n );\n\n return writtenConfigFilesMap;\n}\n\nfunction ensureHashOnConfigFiles(configFiles: ConfigFile[]): Array<Required<ConfigFile>> {\n return configFiles.map((configFile): Required<ConfigFile> => {\n if (!configFile.hash) {\n const hash = sha1(configFile.content);\n return { ...configFile, hash };\n }\n return configFile as Required<ConfigFile>;\n });\n}\n\nasync function calculateOneEnvRealConfigFiles(\n envConfigFileEntry: EnvConfigWriterEntry,\n envMapValue: EnvMapValue,\n configsRootDir: string,\n workspaceDir: string\n) {\n const { configWriter, executionContext } = envConfigFileEntry;\n const calculatedConfigFiles = configWriter.calcConfigFiles(\n executionContext,\n envMapValue,\n configsRootDir,\n workspaceDir\n );\n return calculatedConfigFiles;\n}\n\nfunction mergeRealConfigFiles(\n multiEnvCalculatedRealConfigFiles: EnvCalculatedRealConfigFiles[],\n mergeFunc?: MergeConfigFilesFunc\n): MergedRealConfigFilesByHash {\n const mergedConfigFiles = multiEnvCalculatedRealConfigFiles.reduce((acc, curr: EnvCalculatedRealConfigFiles) => {\n curr.realConfigFiles.forEach((realConfigFile) => {\n const currentValue = acc[realConfigFile.hash];\n if (currentValue) {\n currentValue.envIds.push(curr.envId);\n if (currentValue && mergeFunc) {\n const mergedConfigFileContent = mergeFunc(currentValue.realConfigFile, realConfigFile);\n currentValue.realConfigFile.content = mergedConfigFileContent;\n realConfigFile.content = mergedConfigFileContent;\n acc[realConfigFile.hash].realConfigFile = realConfigFile;\n }\n } else {\n acc[realConfigFile.hash] = { envIds: [curr.envId], realConfigFile };\n }\n });\n return acc;\n }, {});\n return mergedConfigFiles;\n}\n\nasync function 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"],"mappings":";;;;;;AAAA,SAAAA,cAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,aAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA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AACnC,KAAK,CAAC;UAAEoB;QAAe,CAAC;MACrE;IACF,CAAC,CAAC;IACF,OAAOc,GAAG;EACZ,CAAC,EAAE,CAAC,CAAC,CAAC;EACN,OAAOF,iBAAiB;AAC1B;AAEA,eAAeV,eAAeA,CAC5BE,UAAsB,EACtB/B,cAAsB,EACtBE,IAA6B,EACD;EAC5B,MAAMuB,IAAI,GAAGM,UAAU,CAACN,IAAI,IAAI,IAAAO,aAAI,EAACD,UAAU,CAACE,OAAO,CAAC;EACxD,MAAMY,IAAI,GAAG,IAAAC,uBAAM,EAACf,UAAU,CAACc,IAAI,EAAE;IAAEpB;EAAK,CAAC,CAAC;EAC9C,MAAMsB,QAAQ,GAAG,IAAAC,YAAI,EAAChD,cAAc,EAAE6C,IAAI,CAAC;EAC3C,IAAI,CAAC3C,IAAI,CAAC+C,MAAM,EAAE;IAChB;IACA;IACA,MAAMC,kBAAE,CAACC,UAAU,CAACJ,QAAQ,EAAEhB,UAAU,CAACE,OAAO,CAAC;IACjD;EACF;EACA,MAAMmB,GAAG,GAAG;IACVP,IAAI;IACJpB,IAAI;IACJsB,QAAQ;IACRd,OAAO,EAAEF,UAAU,CAACE;EACtB,CAAC;EACD,OAAOmB,GAAG;AACZ","ignoreList":[]}
|
package/dist/ws-config.cmd.js
CHANGED
|
@@ -18,8 +18,8 @@ function _outputs() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function _interopRequireDefault(
|
|
22
|
-
function _defineProperty(
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
24
24
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable max-classes-per-file */
|
|
25
25
|
const COMMAND_NAME = 'ws-config';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_outputs","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","WsConfigCmd","constructor","report","unrecognizedSubcommand","chalk","red","exports","WsConfigWriteCmd","workspaceConfigFilesMain","_args","flags","results","json","dryRunWithContent","Error","envsNotImplementing","getEnvsNotImplementing","warning","getWarningForNonImplementingEnvs","output","verbose","verboseFormatWriteOutput","formatWriteOutput","clean","silent","noDedupe","writers","dryRun","cleanResults","writeResults","wsDir","writeConfigFiles","dedupe","split","updatedWriteResults","writersResult","map","oneWriterResult","realConfigFiles","forEach","realConfigFile","writtenRealConfigFile","content","extendingConfigFiles","extendingConfigFile","WsConfigCleanCmd","formatCleanOutput","cleanConfigFiles","WsConfigListCmd","formatListOutput","listConfigWriters","length","message","yellow","cyan","join"],"sources":["ws-config.cmd.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\n\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { WorkspaceConfigFilesMain, WriteConfigFilesResult } from './workspace-config-files.main.runtime';\nimport { formatCleanOutput, formatListOutput, formatWriteOutput, verboseFormatWriteOutput } from './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 verbose?: 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 = '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 that will be written per env',\n ],\n ['v', 'verbose', 'showing verbose output for writing'],\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 const envsNotImplementing = this.workspaceConfigFilesMain.getEnvsNotImplementing();\n const warning = getWarningForNonImplementingEnvs(envsNotImplementing);\n const output = flags.verbose ? verboseFormatWriteOutput(results, flags) : formatWriteOutput(results, flags);\n return warning + output;\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 updatedWriteResults = writeResults;\n if (!dryRunWithContent) {\n updatedWriteResults.writersResult = updatedWriteResults.writersResult.map((oneWriterResult) => {\n oneWriterResult.realConfigFiles.forEach((realConfigFile) => {\n realConfigFile.writtenRealConfigFile.content = '';\n });\n oneWriterResult.extendingConfigFiles.forEach((extendingConfigFile) => {\n extendingConfigFile.extendingConfigFile.content = '';\n });\n return oneWriterResult;\n });\n }\n\n return {\n wsDir,\n cleanResults,\n writeResults: updatedWriteResults,\n };\n }\n return { wsDir, cleanResults, writeResults };\n }\n}\n\nexport class WsConfigCleanCmd implements Command {\n name = 'clean';\n description = '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 clean 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 of configs that will be cleaned'],\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 const envsNotImplementing = this.workspaceConfigFilesMain.getEnvsNotImplementing();\n const warning = getWarningForNonImplementingEnvs(envsNotImplementing);\n const output = formatCleanOutput(results, flags);\n return warning + output;\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 = '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 const envsNotImplementing = this.workspaceConfigFilesMain.getEnvsNotImplementing();\n const warning = getWarningForNonImplementingEnvs(envsNotImplementing);\n const output = formatListOutput(results);\n return warning + output;\n }\n\n async json() {\n const cleanResults = await this.workspaceConfigFilesMain.listConfigWriters();\n return cleanResults;\n }\n}\n\nfunction getWarningForNonImplementingEnvs(envsNotImplementing: string[]) {\n if (!envsNotImplementing.length) return '';\n const message =\n chalk.yellow(`Bit cannot determine the correct contents for the config files to write. this may result in incorrect content.\nThe following environments need to add support for config files: ${chalk.cyan(envsNotImplementing.join(', '))}.\nRead here how to correct and improve dev-ex - LINK\n\n`);\n return message;\n}\n"],"mappings":";;;;;;AAGA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6G,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAA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AMgB,YAAY,GAAG,MAAM,IAAI,CAACpB,wBAAwB,CAAC0C,iBAAiB,CAAC,CAAC;IAC5E,OAAOtB,YAAY;EACrB;AACF;AAACtB,OAAA,CAAA0C,eAAA,GAAAA,eAAA;AAED,SAAS9B,gCAAgCA,CAACH,mBAA6B,EAAE;EACvE,IAAI,CAACA,mBAAmB,CAACoC,MAAM,EAAE,OAAO,EAAE;EAC1C,MAAMC,OAAO,GACXhD,gBAAK,CAACiD,MAAM,CAAE;AAClB,mEAAmEjD,gBAAK,CAACkD,IAAI,CAACvC,mBAAmB,CAACwC,IAAI,CAAC,IAAI,CAAC,CAAE;AAC9G;AACA;AACA,CAAC,CAAC;EACA,OAAOH,OAAO;AAChB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_outputs","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMMAND_NAME","WsConfigCmd","constructor","report","unrecognizedSubcommand","chalk","red","exports","WsConfigWriteCmd","workspaceConfigFilesMain","_args","flags","results","json","dryRunWithContent","Error","envsNotImplementing","getEnvsNotImplementing","warning","getWarningForNonImplementingEnvs","output","verbose","verboseFormatWriteOutput","formatWriteOutput","clean","silent","noDedupe","writers","dryRun","cleanResults","writeResults","wsDir","writeConfigFiles","dedupe","split","updatedWriteResults","writersResult","map","oneWriterResult","realConfigFiles","forEach","realConfigFile","writtenRealConfigFile","content","extendingConfigFiles","extendingConfigFile","WsConfigCleanCmd","formatCleanOutput","cleanConfigFiles","WsConfigListCmd","formatListOutput","listConfigWriters","length","message","yellow","cyan","join"],"sources":["ws-config.cmd.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\n\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { WorkspaceConfigFilesMain, WriteConfigFilesResult } from './workspace-config-files.main.runtime';\nimport { formatCleanOutput, formatListOutput, formatWriteOutput, verboseFormatWriteOutput } from './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 verbose?: 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 = '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 that will be written per env',\n ],\n ['v', 'verbose', 'showing verbose output for writing'],\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 const envsNotImplementing = this.workspaceConfigFilesMain.getEnvsNotImplementing();\n const warning = getWarningForNonImplementingEnvs(envsNotImplementing);\n const output = flags.verbose ? verboseFormatWriteOutput(results, flags) : formatWriteOutput(results, flags);\n return warning + output;\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 updatedWriteResults = writeResults;\n if (!dryRunWithContent) {\n updatedWriteResults.writersResult = updatedWriteResults.writersResult.map((oneWriterResult) => {\n oneWriterResult.realConfigFiles.forEach((realConfigFile) => {\n realConfigFile.writtenRealConfigFile.content = '';\n });\n oneWriterResult.extendingConfigFiles.forEach((extendingConfigFile) => {\n extendingConfigFile.extendingConfigFile.content = '';\n });\n return oneWriterResult;\n });\n }\n\n return {\n wsDir,\n cleanResults,\n writeResults: updatedWriteResults,\n };\n }\n return { wsDir, cleanResults, writeResults };\n }\n}\n\nexport class WsConfigCleanCmd implements Command {\n name = 'clean';\n description = '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 clean 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 of configs that will be cleaned'],\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 const envsNotImplementing = this.workspaceConfigFilesMain.getEnvsNotImplementing();\n const warning = getWarningForNonImplementingEnvs(envsNotImplementing);\n const output = formatCleanOutput(results, flags);\n return warning + output;\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 = '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 const envsNotImplementing = this.workspaceConfigFilesMain.getEnvsNotImplementing();\n const warning = getWarningForNonImplementingEnvs(envsNotImplementing);\n const output = formatListOutput(results);\n return warning + output;\n }\n\n async json() {\n const cleanResults = await this.workspaceConfigFilesMain.listConfigWriters();\n return cleanResults;\n }\n}\n\nfunction getWarningForNonImplementingEnvs(envsNotImplementing: string[]) {\n if (!envsNotImplementing.length) return '';\n const message =\n chalk.yellow(`Bit cannot determine the correct contents for the config files to write. this may result in incorrect content.\nThe following environments need to add support for config files: ${chalk.cyan(envsNotImplementing.join(', '))}.\nRead here how to correct and improve dev-ex - LINK\n\n`);\n return message;\n}\n"],"mappings":";;;;;;AAGA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6G,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAA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GAAG,IAAI,CAACP,wBAAwB,CAACQ,sBAAsB,CAAC,CAAC;IAClF,MAAMC,OAAO,GAAGC,gCAAgC,CAACH,mBAAmB,CAAC;IACrE,MAAMI,MAAM,GAAG,IAAA8B,2BAAgB,EAACtC,OAAO,CAAC;IACxC,OAAOM,OAAO,GAAGE,MAAM;EACzB;EAEA,MAAMP,IAAIA,CAAA,EAAG;IACX,MAAMgB,YAAY,GAAG,MAAM,IAAI,CAACpB,wBAAwB,CAAC0C,iBAAiB,CAAC,CAAC;IAC5E,OAAOtB,YAAY;EACrB;AACF;AAACtB,OAAA,CAAA0C,eAAA,GAAAA,eAAA;AAED,SAAS9B,gCAAgCA,CAACH,mBAA6B,EAAE;EACvE,IAAI,CAACA,mBAAmB,CAACoC,MAAM,EAAE,OAAO,EAAE;EAC1C,MAAMC,OAAO,GACXhD,gBAAK,CAACiD,MAAM,CAAC;AACjB,mEAAmEjD,gBAAK,CAACkD,IAAI,CAACvC,mBAAmB,CAACwC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7G;AACA;AACA,CAAC,CAAC;EACA,OAAOH,OAAO;AAChB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/workspace-config-files",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.283",
|
|
4
4
|
"homepage": "https://bit.cloud/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": "1.0.
|
|
9
|
+
"version": "1.0.283"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"string-format": "0.5.0",
|
|
20
20
|
"@teambit/harmony": "0.4.6",
|
|
21
21
|
"@teambit/bit-error": "0.0.404",
|
|
22
|
-
"@teambit/envs": "1.0.
|
|
22
|
+
"@teambit/envs": "1.0.283",
|
|
23
23
|
"@teambit/cli": "0.0.865",
|
|
24
24
|
"@teambit/logger": "0.0.958",
|
|
25
|
-
"@teambit/workspace": "1.0.
|
|
25
|
+
"@teambit/workspace": "1.0.283"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/lodash": "4.14.165",
|