@teambit/workspace-config-files 1.0.107 → 1.0.109
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 +11 -0
- package/artifacts/preview/teambit_workspace_workspace_config_files-preview.js +1 -0
- package/dist/config-writer-entry.d.ts +7 -7
- package/dist/config-writer-list.d.ts +1 -1
- package/dist/dedup-paths.d.ts +1 -1
- package/dist/dedup-paths.spec.js +12 -17
- package/dist/dedup-paths.spec.js.map +1 -1
- package/dist/outputs/format-clean-output.d.ts +1 -1
- package/dist/outputs/format-write-output.js +1 -1
- package/dist/outputs/format-write-output.js.map +1 -1
- package/dist/{preview-1703590665075.js → preview-1703698405864.js} +1 -1
- package/dist/workspace-config-files.main.runtime.d.ts +13 -13
- package/dist/workspace-config-files.service.d.ts +2 -2
- package/dist/workspace-config-files.service.js +2 -2
- package/dist/workspace-config-files.service.js.map +1 -1
- package/dist/writers/extending-config-files.d.ts +4 -4
- package/dist/writers/real-config-files.d.ts +4 -4
- package/dist/writers/real-config-files.js +1 -2
- package/dist/writers/real-config-files.js.map +1 -1
- package/dist/ws-config.cmd.d.ts +4 -4
- package/dist/ws-config.cmd.js +2 -3
- package/dist/ws-config.cmd.js.map +1 -1
- package/package.json +13 -24
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<testsuites>
|
|
3
|
+
<testsuite name="teambit.workspace/workspace-config-files@1.0.109" timestamp="2023-12-27T17:56:28.158Z" tests="6" failures="0" errors="0" skipped="0">
|
|
4
|
+
<testcase classname="dedup-paths.spec.js" name="should reduce files to minimum necessary" time="0.007"/>
|
|
5
|
+
<testcase classname="dedup-paths.spec.js" name="should place files in correct folders" time="0.002"/>
|
|
6
|
+
<testcase classname="dedup-paths.spec.js" name="should reduce files to minimum necessary"/>
|
|
7
|
+
<testcase classname="dedup-paths.spec.js" name="should place files in correct folders" time="0.001"/>
|
|
8
|
+
<testcase classname="dedup-paths.spec.js" name="should reduce files to minimum necessary" time="0.001"/>
|
|
9
|
+
<testcase classname="dedup-paths.spec.js" name="should place files in correct folders"/>
|
|
10
|
+
</testsuite>
|
|
11
|
+
</testsuites>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.workspace/workspace-config-files-preview"]=t():e["teambit.workspace/workspace-config-files-preview"]=t()}(self,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{compositions:()=>p,compositions_metadata:()=>m,overview:()=>d});var o={};e.r(o),e.d(o,{default:()=>c}),React;const n=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var r=["components"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},a.apply(this,arguments)}var s={},l="wrapper";function c(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,i=function(e,t){if(null==e)return{};var o,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}(e,r);return(0,n.mdx)(l,a({},s,o,{components:t,mdxType:"MDXLayout"}),(0,n.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,n.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,n.mdx)("h3",null,"Commands"),(0,n.mdx)("p",null,"Main command is ",(0,n.mdx)("inlineCode",{parentName:"p"},"bit ws-config")," which has the following sub commands:"),(0,n.mdx)("ul",null,(0,n.mdx)("li",{parentName:"ul"},(0,n.mdx)("inlineCode",{parentName:"li"},"bit ws-config write")," - write configuration files according to the components' envs"),(0,n.mdx)("li",{parentName:"ul"},(0,n.mdx)("inlineCode",{parentName:"li"},"bit ws-config clean")," - remove all configuration files from the workspace"),(0,n.mdx)("li",{parentName:"ul"},(0,n.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,n.mdx)("inlineCode",{parentName:"li"},"--writers")," flag in the write/clean commands."))))}c.isMDXComponent=!0;const p=[],d=[o],m={compositions:[]};return t})()));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Environment, ExecutionContext } from '@teambit/envs';
|
|
2
2
|
import { EnvMapValue } from './workspace-config-files.main.runtime';
|
|
3
3
|
import { WrittenConfigFile } from './writers';
|
|
4
|
-
export
|
|
4
|
+
export type ConfigFile = {
|
|
5
5
|
/**
|
|
6
6
|
* Name of the config file.
|
|
7
7
|
* supports also using `{hash}` in the name, which will be replaced by the hash of the config file.
|
|
@@ -17,7 +17,7 @@ export declare type ConfigFile = {
|
|
|
17
17
|
*/
|
|
18
18
|
hash?: string;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type ExtendingConfigFileAdditionalProp = {
|
|
21
21
|
/**
|
|
22
22
|
* the config file that this config file extends.
|
|
23
23
|
*/
|
|
@@ -27,8 +27,8 @@ export declare type ExtendingConfigFileAdditionalProp = {
|
|
|
27
27
|
*/
|
|
28
28
|
useAbsPaths?: boolean;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
31
|
-
export
|
|
30
|
+
export type ExtendingConfigFile = ConfigFile & ExtendingConfigFileAdditionalProp;
|
|
31
|
+
export type PostProcessExtendingConfigFilesArgs = {
|
|
32
32
|
workspaceDir: string;
|
|
33
33
|
configsRootDir: string;
|
|
34
34
|
extendingConfigFile: ExtendingConfigFile;
|
|
@@ -45,17 +45,17 @@ export declare type PostProcessExtendingConfigFilesArgs = {
|
|
|
45
45
|
*/
|
|
46
46
|
supportSpecificPathChange?: boolean;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type GenerateExtendingConfigFilesArgs = {
|
|
49
49
|
workspaceDir: string;
|
|
50
50
|
configsRootDir: string;
|
|
51
51
|
writtenConfigFiles: WrittenConfigFile[];
|
|
52
52
|
envMapValue: EnvMapValue;
|
|
53
53
|
};
|
|
54
|
-
export
|
|
54
|
+
export type PostProcessExtendingConfigFilesOneFile = {
|
|
55
55
|
path: string;
|
|
56
56
|
content: string;
|
|
57
57
|
};
|
|
58
|
-
export
|
|
58
|
+
export type MergeConfigFilesFunc = (configFile: ConfigFile, configFile2: ConfigFile) => string;
|
|
59
59
|
export interface ConfigWriterEntry {
|
|
60
60
|
/**
|
|
61
61
|
* Id is used for few things:
|
package/dist/dedup-paths.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompPathExtendingHashMap, EnvCompsDirsMap } from './workspace-config-files.main.runtime';
|
|
2
2
|
import { ExtendingConfigFilesMap } from './writers';
|
|
3
|
-
export
|
|
3
|
+
export type DedupedPaths = Array<{
|
|
4
4
|
fileHash: string;
|
|
5
5
|
paths: string[];
|
|
6
6
|
}>;
|
package/dist/dedup-paths.spec.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _chai() {
|
|
4
|
-
const data = require("chai");
|
|
5
|
-
_chai = function () {
|
|
6
|
-
return data;
|
|
7
|
-
};
|
|
8
|
-
return data;
|
|
9
|
-
}
|
|
10
3
|
function _dedupPaths() {
|
|
11
4
|
const data = require("./dedup-paths");
|
|
12
5
|
_dedupPaths = function () {
|
|
@@ -198,45 +191,47 @@ const prettierExpectedDedupedPaths = [{
|
|
|
198
191
|
paths: ['.']
|
|
199
192
|
}];
|
|
200
193
|
describe('Workspace Config files - dedupe paths', function () {
|
|
201
|
-
this.timeout(0);
|
|
202
194
|
describe('dedupePaths', () => {
|
|
203
195
|
describe('ts example', () => {
|
|
204
196
|
let result;
|
|
205
|
-
|
|
197
|
+
beforeAll(async () => {
|
|
206
198
|
// @ts-ignore (we don't really care about the env itself here)
|
|
207
199
|
result = (0, _dedupPaths().dedupePaths)(tsExtendingConfigFilesMap, envCompsDirsMap);
|
|
208
200
|
});
|
|
209
201
|
it('should reduce files to minimum necessary', async () => {
|
|
210
|
-
|
|
202
|
+
expect(result.length).toEqual(tsExpectedDedupedPaths.length);
|
|
211
203
|
});
|
|
212
204
|
it('should place files in correct folders', async () => {
|
|
213
|
-
|
|
205
|
+
// @ts-ignore
|
|
206
|
+
expect(result).toMatchObject(tsExpectedDedupedPaths);
|
|
214
207
|
});
|
|
215
208
|
});
|
|
216
209
|
describe('eslint example', () => {
|
|
217
210
|
let result;
|
|
218
|
-
|
|
211
|
+
beforeAll(async () => {
|
|
219
212
|
// @ts-ignore (we don't really care about the env itself here)
|
|
220
213
|
result = (0, _dedupPaths().dedupePaths)(eslintExtendingConfigFilesMap, envCompsDirsMap);
|
|
221
214
|
});
|
|
222
215
|
it('should reduce files to minimum necessary', async () => {
|
|
223
|
-
|
|
216
|
+
expect(result.length).toEqual(eslintExpectedDedupedPaths.length);
|
|
224
217
|
});
|
|
225
218
|
it('should place files in correct folders', async () => {
|
|
226
|
-
|
|
219
|
+
// @ts-ignore
|
|
220
|
+
expect(result).toMatchObject(eslintExpectedDedupedPaths);
|
|
227
221
|
});
|
|
228
222
|
});
|
|
229
223
|
describe('prettier example', () => {
|
|
230
224
|
let result;
|
|
231
|
-
|
|
225
|
+
beforeAll(async () => {
|
|
232
226
|
// @ts-ignore (we don't really care about the env itself here)
|
|
233
227
|
result = (0, _dedupPaths().dedupePaths)(prettierExtendingConfigFilesMap, envCompsDirsMap);
|
|
234
228
|
});
|
|
235
229
|
it('should reduce files to minimum necessary', async () => {
|
|
236
|
-
|
|
230
|
+
expect(result.length).toEqual(prettierExpectedDedupedPaths.length);
|
|
237
231
|
});
|
|
238
232
|
it('should place files in correct folders', async () => {
|
|
239
|
-
|
|
233
|
+
// @ts-ignore
|
|
234
|
+
expect(result).toMatchObject(prettierExpectedDedupedPaths);
|
|
240
235
|
});
|
|
241
236
|
});
|
|
242
237
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chai","data","require","_dedupPaths","envCompsDirsMap","id","paths","tsExtendingConfigFilesMap","extendingConfigFile","useAbsPaths","content","name","extendingTarget","hash","filePath","envIds","tsExpectedDedupedPaths","fileHash","eslintExtendingConfigFilesMap","ff6ea265e6f21ce25f7985570beef37dd957d0dc","f1743b227e588db0c59d4a43171653e6c4262816","eslintExpectedDedupedPaths","prettierExtendingConfigFilesMap","prettierExpectedDedupedPaths","describe","timeout","result","before","dedupePaths","it","expect","to","have","lengthOf","length","deep","equal"],"sources":["dedup-paths.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { DedupedPaths, dedupePaths } from './dedup-paths';\nimport { ExtendingConfigFilesMap } from './writers';\n\nconst envCompsDirsMap = {\n 'teambit.harmony/node': {\n id: 'teambit.harmony/node',\n paths: [\n 'react/apps/react-app-types',\n 'compilation/babel-compiler',\n 'compilation/compiler-task',\n 'mdx/compilers/mdx-compiler',\n 'mdx/compilers/mdx-multi-compiler',\n 'compilation/compilers/multi-compiler',\n 'defender/eslint-linter',\n 'mdx/generator/mdx-starters',\n 'mdx/generator/mdx-templates',\n 'react/generator/react-starters',\n 'react/generator/react-templates',\n 'defender/jest-tester',\n 'react/jest/react-jest',\n 'defender/linter-task',\n 'defender/mocha-tester',\n 'compilation/modules/babel-file-transpiler',\n 'defender/prettier-formatter',\n 'preview/react-preview',\n 'defender/tester-task',\n 'typescript/typescript-compiler',\n 'webpack/webpack-bundler',\n 'webpack/webpack-dev-server',\n 'react/webpack/react-webpack',\n ],\n },\n 'teambit.react/react-env@0.0.44': {\n id: 'teambit.react/react-env@0.0.44',\n paths: ['test-new-envs-app/apps/test-app', 'test-new-env/ui/button2'],\n },\n 'teambit.react/react': {\n id: 'teambit.react/react',\n paths: ['docs/docs-template', 'react/mounter'],\n },\n 'teambit.envs/env': {\n id: 'teambit.envs/env',\n paths: [\n 'react/examples/my-react-env',\n 'mdx/mdx-env',\n 'node/node',\n 'node/node-env-extension',\n 'react/react-env',\n 'react/react-env-extension',\n ],\n },\n 'teambit.mdx/mdx-env@0.0.6': {\n id: 'teambit.mdx/mdx-env@0.0.6',\n paths: ['test-new-env/mdx/content-comp'],\n },\n 'teambit.node/node@0.0.16': {\n id: 'teambit.node/node@0.0.16',\n paths: ['test-new-env/node/node-comp1', 'test-new-env/node/node-comp2'],\n },\n 'teambit.react/examples/my-react-env@0.0.39': {\n id: 'teambit.react/examples/my-react-env@0.0.39',\n paths: ['test-new-env/ui/button'],\n },\n};\n\nconst tsExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '816b7f584991ff21a7682ef8a4229ebf312c457f': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget: {\n hash: '4957ea3122e57ea3302aadd885eed84127d9c54b',\n content: 'does not matter',\n name: 'tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json',\n },\n\n hash: '816b7f584991ff21a7682ef8a4229ebf312c457f',\n },\n envIds: ['teambit.harmony/node', 'teambit.react/react'],\n },\n '00330a9c547353867d519c34f47e17ddc9f161d1': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget: {\n hash: '17b99a1071b1d2d86ed04ebce68903b82403f278',\n content: 'does not matter',\n name: 'tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json',\n },\n hash: '00330a9c547353867d519c34f47e17ddc9f161d1',\n },\n envIds: ['teambit.react/react-env@0.0.44', 'teambit.react/examples/my-react-env@0.0.39'],\n },\n '3c5960bcad98570b98834a5c37f47dd4729dbef0': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget: {\n hash: 'dab521d0914afe64de248743e05a169cf9b4b50c',\n content: 'does not matter',\n name: 'tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json',\n },\n hash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',\n },\n envIds: ['teambit.node/node@0.0.16'],\n },\n};\n\nconst tsExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: '00330a9c547353867d519c34f47e17ddc9f161d1',\n paths: ['test-new-envs-app', 'test-new-env/ui'],\n },\n {\n fileHash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',\n paths: ['test-new-env/node'],\n },\n {\n fileHash: '816b7f584991ff21a7682ef8a4229ebf312c457f',\n paths: ['.'],\n },\n];\n\nconst eslintExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '8810839e74a9c41694bb5a2a8587dcae71dc389d': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: {\n hash: 'be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c',\n content: 'does not matter',\n name: '.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json',\n },\n hash: '8810839e74a9c41694bb5a2a8587dcae71dc389d',\n },\n envIds: ['teambit.harmony/node', 'teambit.react/react', 'teambit.envs/env'],\n },\n ff6ea265e6f21ce25f7985570beef37dd957d0dc: {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: {\n hash: 'e5ca5528c64e0442b05b949fea42cdda4243d840',\n content: 'does not matter',\n name: '.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json',\n },\n hash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc',\n },\n envIds: ['teambit.react/react-env@0.0.44'],\n },\n '91021f2c973a2940c70b75447639e4ea2a799955': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: {\n hash: '7f229bf5ab41e8bfe61916de6c68f9c14c76f23e',\n content: 'does not matter',\n name: '.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json',\n },\n hash: '91021f2c973a2940c70b75447639e4ea2a799955',\n },\n envIds: ['teambit.mdx/mdx-env@0.0.6', 'teambit.react/examples/my-react-env@0.0.39'],\n },\n f1743b227e588db0c59d4a43171653e6c4262816: {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: {\n hash: 'c503f7386e2a637d91c74f7df90d8fafe79c4378',\n content: 'does not matter',\n name: '.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json',\n },\n hash: 'f1743b227e588db0c59d4a43171653e6c4262816',\n },\n envIds: ['teambit.node/node@0.0.16'],\n },\n};\n\nconst eslintExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc',\n paths: ['test-new-envs-app', 'test-new-env/ui/button2'],\n },\n {\n fileHash: '91021f2c973a2940c70b75447639e4ea2a799955',\n paths: ['test-new-env/mdx', 'test-new-env/ui/button'],\n },\n {\n fileHash: 'f1743b227e588db0c59d4a43171653e6c4262816',\n paths: ['test-new-env/node'],\n },\n {\n fileHash: '8810839e74a9c41694bb5a2a8587dcae71dc389d',\n paths: ['.'],\n },\n];\n\nconst prettierExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '082f546b2555ea89e7063b20de47c039d387fc74': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-prettier-config\\n' +\n 'module.exports = {\\n' +\n \" ...require('/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs')\\n\" +\n '}',\n name: '.prettierrc.cjs',\n extendingTarget: {\n hash: 'e4882af8861bcf5b0147891d8b70b40a10428881',\n content: 'does not matter',\n name: '.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs',\n },\n hash: '082f546b2555ea89e7063b20de47c039d387fc74',\n },\n envIds: [\n 'teambit.harmony/node',\n 'teambit.react/react-env@0.0.44',\n 'teambit.react/react',\n 'teambit.envs/env',\n 'teambit.mdx/mdx-env@0.0.6',\n 'teambit.node/node@0.0.16',\n 'teambit.react/examples/my-react-env@0.0.39',\n ],\n },\n};\n\nconst prettierExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: '082f546b2555ea89e7063b20de47c039d387fc74',\n paths: ['.'],\n },\n];\n\ndescribe('Workspace Config files - dedupe paths', function () {\n this.timeout(0);\n\n describe('dedupePaths', () => {\n describe('ts example', () => {\n let result: DedupedPaths;\n before(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(tsExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result).to.have.lengthOf(tsExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n expect(result).to.deep.equal(tsExpectedDedupedPaths);\n });\n });\n\n describe('eslint example', () => {\n let result: DedupedPaths;\n before(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(eslintExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result).to.have.lengthOf(eslintExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n expect(result).to.deep.equal(eslintExpectedDedupedPaths);\n });\n });\n\n describe('prettier example', () => {\n let result: DedupedPaths;\n before(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(prettierExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result).to.have.lengthOf(prettierExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n expect(result).to.deep.equal(prettierExpectedDedupedPaths);\n });\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,MAAMG,eAAe,GAAG;EACtB,sBAAsB,EAAE;IACtBC,EAAE,EAAE,sBAAsB;IA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,EAAE,YAAY;QACtD,IAAAC,cAAM,EAACJ,MAAM,CAAC,CAACK,EAAE,CAACI,IAAI,CAACC,KAAK,CAACf,0BAA0B,CAAC;MAC1D,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFG,QAAQ,CAAC,kBAAkB,EAAE,MAAM;MACjC,IAAIE,MAAoB;MACxBC,MAAM,CAAC,YAAY;QACjB;QACAD,MAAM,GAAG,IAAAE,yBAAW,EAACN,+BAA+B,EAAElB,eAAe,CAAC;MACxE,CAAC,CAAC;MAEFyB,EAAE,CAAC,0CAA0C,EAAE,YAAY;QACzD,IAAAC,cAAM,EAACJ,MAAM,CAAC,CAACK,EAAE,CAACC,IAAI,CAACC,QAAQ,CAACV,4BAA4B,CAACW,MAAM,CAAC;MACtE,CAAC,CAAC;MAEFL,EAAE,CAAC,uCAAuC,EAAE,YAAY;QACtD,IAAAC,cAAM,EAACJ,MAAM,CAAC,CAACK,EAAE,CAACI,IAAI,CAACC,KAAK,CAACb,4BAA4B,CAAC;MAC5D,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["_dedupPaths","data","require","envCompsDirsMap","id","paths","tsExtendingConfigFilesMap","extendingConfigFile","useAbsPaths","content","name","extendingTarget","hash","filePath","envIds","tsExpectedDedupedPaths","fileHash","eslintExtendingConfigFilesMap","ff6ea265e6f21ce25f7985570beef37dd957d0dc","f1743b227e588db0c59d4a43171653e6c4262816","eslintExpectedDedupedPaths","prettierExtendingConfigFilesMap","prettierExpectedDedupedPaths","describe","result","beforeAll","dedupePaths","it","expect","length","toEqual","toMatchObject"],"sources":["dedup-paths.spec.ts"],"sourcesContent":["import { DedupedPaths, dedupePaths } from './dedup-paths';\nimport { ExtendingConfigFilesMap } from './writers';\n\nconst envCompsDirsMap = {\n 'teambit.harmony/node': {\n id: 'teambit.harmony/node',\n paths: [\n 'react/apps/react-app-types',\n 'compilation/babel-compiler',\n 'compilation/compiler-task',\n 'mdx/compilers/mdx-compiler',\n 'mdx/compilers/mdx-multi-compiler',\n 'compilation/compilers/multi-compiler',\n 'defender/eslint-linter',\n 'mdx/generator/mdx-starters',\n 'mdx/generator/mdx-templates',\n 'react/generator/react-starters',\n 'react/generator/react-templates',\n 'defender/jest-tester',\n 'react/jest/react-jest',\n 'defender/linter-task',\n 'defender/mocha-tester',\n 'compilation/modules/babel-file-transpiler',\n 'defender/prettier-formatter',\n 'preview/react-preview',\n 'defender/tester-task',\n 'typescript/typescript-compiler',\n 'webpack/webpack-bundler',\n 'webpack/webpack-dev-server',\n 'react/webpack/react-webpack',\n ],\n },\n 'teambit.react/react-env@0.0.44': {\n id: 'teambit.react/react-env@0.0.44',\n paths: ['test-new-envs-app/apps/test-app', 'test-new-env/ui/button2'],\n },\n 'teambit.react/react': {\n id: 'teambit.react/react',\n paths: ['docs/docs-template', 'react/mounter'],\n },\n 'teambit.envs/env': {\n id: 'teambit.envs/env',\n paths: [\n 'react/examples/my-react-env',\n 'mdx/mdx-env',\n 'node/node',\n 'node/node-env-extension',\n 'react/react-env',\n 'react/react-env-extension',\n ],\n },\n 'teambit.mdx/mdx-env@0.0.6': {\n id: 'teambit.mdx/mdx-env@0.0.6',\n paths: ['test-new-env/mdx/content-comp'],\n },\n 'teambit.node/node@0.0.16': {\n id: 'teambit.node/node@0.0.16',\n paths: ['test-new-env/node/node-comp1', 'test-new-env/node/node-comp2'],\n },\n 'teambit.react/examples/my-react-env@0.0.39': {\n id: 'teambit.react/examples/my-react-env@0.0.39',\n paths: ['test-new-env/ui/button'],\n },\n};\n\nconst tsExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '816b7f584991ff21a7682ef8a4229ebf312c457f': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget: {\n hash: '4957ea3122e57ea3302aadd885eed84127d9c54b',\n content: 'does not matter',\n name: 'tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json',\n },\n\n hash: '816b7f584991ff21a7682ef8a4229ebf312c457f',\n },\n envIds: ['teambit.harmony/node', 'teambit.react/react'],\n },\n '00330a9c547353867d519c34f47e17ddc9f161d1': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget: {\n hash: '17b99a1071b1d2d86ed04ebce68903b82403f278',\n content: 'does not matter',\n name: 'tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json',\n },\n hash: '00330a9c547353867d519c34f47e17ddc9f161d1',\n },\n envIds: ['teambit.react/react-env@0.0.44', 'teambit.react/examples/my-react-env@0.0.39'],\n },\n '3c5960bcad98570b98834a5c37f47dd4729dbef0': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-typescript-config\\n' +\n '\\n' +\n '{\\n' +\n ' \"extends\": \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json\"\\n' +\n '}',\n name: 'tsconfig.json',\n extendingTarget: {\n hash: 'dab521d0914afe64de248743e05a169cf9b4b50c',\n content: 'does not matter',\n name: 'tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json',\n },\n hash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',\n },\n envIds: ['teambit.node/node@0.0.16'],\n },\n};\n\nconst tsExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: '00330a9c547353867d519c34f47e17ddc9f161d1',\n paths: ['test-new-envs-app', 'test-new-env/ui'],\n },\n {\n fileHash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',\n paths: ['test-new-env/node'],\n },\n {\n fileHash: '816b7f584991ff21a7682ef8a4229ebf312c457f',\n paths: ['.'],\n },\n];\n\nconst eslintExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '8810839e74a9c41694bb5a2a8587dcae71dc389d': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: {\n hash: 'be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c',\n content: 'does not matter',\n name: '.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json',\n },\n hash: '8810839e74a9c41694bb5a2a8587dcae71dc389d',\n },\n envIds: ['teambit.harmony/node', 'teambit.react/react', 'teambit.envs/env'],\n },\n ff6ea265e6f21ce25f7985570beef37dd957d0dc: {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: {\n hash: 'e5ca5528c64e0442b05b949fea42cdda4243d840',\n content: 'does not matter',\n name: '.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json',\n },\n hash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc',\n },\n envIds: ['teambit.react/react-env@0.0.44'],\n },\n '91021f2c973a2940c70b75447639e4ea2a799955': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: {\n hash: '7f229bf5ab41e8bfe61916de6c68f9c14c76f23e',\n content: 'does not matter',\n name: '.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json',\n },\n hash: '91021f2c973a2940c70b75447639e4ea2a799955',\n },\n envIds: ['teambit.mdx/mdx-env@0.0.6', 'teambit.react/examples/my-react-env@0.0.39'],\n },\n f1743b227e588db0c59d4a43171653e6c4262816: {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-eslint-config\\n' +\n '{\\n' +\n ' \"extends\": [\\n' +\n ' \"/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json\"\\n' +\n ' ]\\n' +\n '}',\n name: '.eslintrc.json',\n extendingTarget: {\n hash: 'c503f7386e2a637d91c74f7df90d8fafe79c4378',\n content: 'does not matter',\n name: '.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json',\n },\n hash: 'f1743b227e588db0c59d4a43171653e6c4262816',\n },\n envIds: ['teambit.node/node@0.0.16'],\n },\n};\n\nconst eslintExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc',\n paths: ['test-new-envs-app', 'test-new-env/ui/button2'],\n },\n {\n fileHash: '91021f2c973a2940c70b75447639e4ea2a799955',\n paths: ['test-new-env/mdx', 'test-new-env/ui/button'],\n },\n {\n fileHash: 'f1743b227e588db0c59d4a43171653e6c4262816',\n paths: ['test-new-env/node'],\n },\n {\n fileHash: '8810839e74a9c41694bb5a2a8587dcae71dc389d',\n paths: ['.'],\n },\n];\n\nconst prettierExtendingConfigFilesMap: ExtendingConfigFilesMap = {\n '082f546b2555ea89e7063b20de47c039d387fc74': {\n extendingConfigFile: {\n useAbsPaths: false,\n content:\n '// bit-generated-prettier-config\\n' +\n 'module.exports = {\\n' +\n \" ...require('/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs')\\n\" +\n '}',\n name: '.prettierrc.cjs',\n extendingTarget: {\n hash: 'e4882af8861bcf5b0147891d8b70b40a10428881',\n content: 'does not matter',\n name: '.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs',\n filePath:\n '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs',\n },\n hash: '082f546b2555ea89e7063b20de47c039d387fc74',\n },\n envIds: [\n 'teambit.harmony/node',\n 'teambit.react/react-env@0.0.44',\n 'teambit.react/react',\n 'teambit.envs/env',\n 'teambit.mdx/mdx-env@0.0.6',\n 'teambit.node/node@0.0.16',\n 'teambit.react/examples/my-react-env@0.0.39',\n ],\n },\n};\n\nconst prettierExpectedDedupedPaths: DedupedPaths = [\n {\n fileHash: '082f546b2555ea89e7063b20de47c039d387fc74',\n paths: ['.'],\n },\n];\n\ndescribe('Workspace Config files - dedupe paths', function () {\n describe('dedupePaths', () => {\n describe('ts example', () => {\n let result: DedupedPaths;\n beforeAll(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(tsExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result.length).toEqual(tsExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n // @ts-ignore\n expect(result).toMatchObject(tsExpectedDedupedPaths);\n });\n });\n\n describe('eslint example', () => {\n let result: DedupedPaths;\n beforeAll(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(eslintExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result.length).toEqual(eslintExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n // @ts-ignore\n expect(result).toMatchObject(eslintExpectedDedupedPaths);\n });\n });\n\n describe('prettier example', () => {\n let result: DedupedPaths;\n beforeAll(async () => {\n // @ts-ignore (we don't really care about the env itself here)\n result = dedupePaths(prettierExtendingConfigFilesMap, envCompsDirsMap);\n });\n\n it('should reduce files to minimum necessary', async () => {\n expect(result.length).toEqual(prettierExpectedDedupedPaths.length);\n });\n\n it('should place files in correct folders', async () => {\n // @ts-ignore\n expect(result).toMatchObject(prettierExpectedDedupedPaths);\n });\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CA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,EAAE,CAAC,uCAAuC,EAAE,YAAY;QACtD;QACAC,MAAM,CAACJ,MAAM,CAAC,CAACO,aAAa,CAACX,0BAA0B,CAAC;MAC1D,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFG,QAAQ,CAAC,kBAAkB,EAAE,MAAM;MACjC,IAAIC,MAAoB;MACxBC,SAAS,CAAC,YAAY;QACpB;QACAD,MAAM,GAAG,IAAAE,yBAAW,EAACL,+BAA+B,EAAElB,eAAe,CAAC;MACxE,CAAC,CAAC;MAEFwB,EAAE,CAAC,0CAA0C,EAAE,YAAY;QACzDC,MAAM,CAACJ,MAAM,CAACK,MAAM,CAAC,CAACC,OAAO,CAACR,4BAA4B,CAACO,MAAM,CAAC;MACpE,CAAC,CAAC;MAEFF,EAAE,CAAC,uCAAuC,EAAE,YAAY;QACtD;QACAC,MAAM,CAACJ,MAAM,CAAC,CAACO,aAAa,CAACT,4BAA4B,CAAC;MAC5D,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { CleanConfigCmdFlags } from '../ws-config.cmd';
|
|
2
|
-
export declare function formatCleanOutput(cleanResults: string[]
|
|
2
|
+
export declare function formatCleanOutput(cleanResults: string[], flags: CleanConfigCmdFlags): string;
|
|
@@ -40,7 +40,7 @@ function formatWriteOutput(writeConfigFilesResult, flags) {
|
|
|
40
40
|
wsDir
|
|
41
41
|
} = writeConfigFilesResult;
|
|
42
42
|
const isDryRun = !!(flags.dryRun || flags.dryRunWithContent);
|
|
43
|
-
const cleanResultsOutput = cleanResults
|
|
43
|
+
const cleanResultsOutput = cleanResults?.length ? (0, _formatCleanOutput().formatCleanOutput)(cleanResults, {
|
|
44
44
|
dryRun: isDryRun
|
|
45
45
|
}) : undefined;
|
|
46
46
|
const writeResultsOutput = getWriteResultsOutput(writeResults, wsDir, isDryRun);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_formatCleanOutput","_writeOutputsTexts","obj","__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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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,iBAAiB,CAAC;EAC5D,MAAMC,kBAAkB,GAAGN,YAAY,
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_path","_formatCleanOutput","_writeOutputsTexts","obj","__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.ext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xC;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,IAAM,KAAI,IAAAC,gBAAQ,EAACtC,KAAK,EAAEqC,CAAC,CAAE,EAAC,CAAC,CAACf,IAAI,CAAC,IAAI,CAAC;EAC5F,OAAQ,GAAEa,KAAM,EAAC;AACnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace-config-files@1.0.
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace-config-files@1.0.109/dist/workspace-config-files.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -9,27 +9,27 @@ import { EnvsWrittenExtendingConfigFiles, EnvsWrittenRealConfigFiles } from './w
|
|
|
9
9
|
/**
|
|
10
10
|
* Configs that can be configured in the workspace.jsonc file
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type WorkspaceConfigFilesAspectConfig = {
|
|
13
13
|
configsRootDir?: string;
|
|
14
14
|
enableWorkspaceConfigWrite?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type EnvConfigWriter = {
|
|
17
17
|
envId: string;
|
|
18
18
|
executionContext: ExecutionContext;
|
|
19
19
|
configWriters: ConfigWriterEntry[];
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type EnvConfigWriterEntry = {
|
|
22
22
|
envId: string;
|
|
23
23
|
configWriter: ConfigWriterEntry;
|
|
24
24
|
executionContext: ExecutionContext;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
27
|
-
export
|
|
26
|
+
export type EnvConfigWritersList = Array<EnvConfigWriter>;
|
|
27
|
+
export type CleanConfigFilesOptions = {
|
|
28
28
|
silent?: boolean;
|
|
29
29
|
dryRun?: boolean;
|
|
30
30
|
writers?: string[];
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type WriteConfigFilesOptions = {
|
|
33
33
|
clean?: boolean;
|
|
34
34
|
silent?: boolean;
|
|
35
35
|
dedupe?: boolean;
|
|
@@ -37,18 +37,18 @@ export declare type WriteConfigFilesOptions = {
|
|
|
37
37
|
throw?: boolean;
|
|
38
38
|
writers?: string[];
|
|
39
39
|
};
|
|
40
|
-
export
|
|
40
|
+
export type CompPathExtendingHashMap = {
|
|
41
41
|
[compPath: string]: string;
|
|
42
42
|
};
|
|
43
|
-
export
|
|
43
|
+
export type EnvMapValue = {
|
|
44
44
|
env: Environment;
|
|
45
45
|
id: string[];
|
|
46
46
|
paths: string[];
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type EnvCompsDirsMap = {
|
|
49
49
|
[envId: string]: EnvMapValue;
|
|
50
50
|
};
|
|
51
|
-
export
|
|
51
|
+
export type OneConfigWriterIdResult = {
|
|
52
52
|
writerId: string;
|
|
53
53
|
totalWrittenFiles: number;
|
|
54
54
|
realConfigFiles: EnvsWrittenRealConfigFiles;
|
|
@@ -56,13 +56,13 @@ export declare type OneConfigWriterIdResult = {
|
|
|
56
56
|
extendingConfigFiles: EnvsWrittenExtendingConfigFiles;
|
|
57
57
|
totalExtendingConfigFiles: number;
|
|
58
58
|
};
|
|
59
|
-
export
|
|
59
|
+
export type WriteResults = {
|
|
60
60
|
writersResult: OneConfigWriterIdResult[];
|
|
61
61
|
totalWrittenFiles: number;
|
|
62
62
|
totalRealConfigFiles: number;
|
|
63
63
|
totalExtendingConfigFiles: number;
|
|
64
64
|
};
|
|
65
|
-
export
|
|
65
|
+
export type WriteConfigFilesResult = {
|
|
66
66
|
cleanResults?: string[];
|
|
67
67
|
writeResults: WriteResults;
|
|
68
68
|
wsDir: string;
|
|
@@ -131,7 +131,7 @@ export declare class WorkspaceConfigFilesMain {
|
|
|
131
131
|
getEnvsNotImplementing(): string[];
|
|
132
132
|
private promptForCleaning;
|
|
133
133
|
private deleteFiles;
|
|
134
|
-
static slots:
|
|
134
|
+
static slots: any[];
|
|
135
135
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
136
136
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
137
137
|
static defaultConfig: Partial<WorkspaceConfigFilesAspectConfig>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Logger } from '@teambit/logger';
|
|
2
2
|
import { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';
|
|
3
3
|
import { ConfigWriterEntry } from './config-writer-entry';
|
|
4
|
-
export
|
|
4
|
+
export type PkgDescriptor = {
|
|
5
5
|
id: string;
|
|
6
6
|
displayName: string;
|
|
7
7
|
config?: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type PkgTransformationMap = ServiceTransformationMap & {
|
|
10
10
|
workspaceConfig: () => ConfigWriterEntry[];
|
|
11
11
|
};
|
|
12
12
|
export declare class WorkspaceConfigFilesService implements EnvService<any> {
|
|
@@ -14,7 +14,7 @@ class WorkspaceConfigFilesService {
|
|
|
14
14
|
}
|
|
15
15
|
transform(env, envContext) {
|
|
16
16
|
// Old env
|
|
17
|
-
if (!
|
|
17
|
+
if (!env?.workspaceConfig) {
|
|
18
18
|
return undefined;
|
|
19
19
|
}
|
|
20
20
|
return {
|
|
@@ -29,7 +29,7 @@ class WorkspaceConfigFilesService {
|
|
|
29
29
|
}
|
|
30
30
|
return [];
|
|
31
31
|
}
|
|
32
|
-
return configWriterList
|
|
32
|
+
return configWriterList?.compute(envContext);
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WorkspaceConfigFilesService","constructor","logger","_defineProperty","transform","env","envContext","workspaceConfig","undefined","configWriterList","compute","Array","isArray","length","calcConfigFiles","exports"],"sources":["workspace-config-files.service.tsx"],"sourcesContent":["import { Logger } from '@teambit/logger';\nimport { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { ConfigWriterList } from './config-writer-list';\nimport { ConfigWriterEntry } from './config-writer-entry';\n\nexport type PkgDescriptor = {\n id: string;\n displayName: string;\n config?: string;\n};\n\ntype PkgTransformationMap = ServiceTransformationMap & {\n workspaceConfig: () => ConfigWriterEntry[];\n};\n\nexport class WorkspaceConfigFilesService implements EnvService<any> {\n name = 'WorkspaceConfigFiles';\n\n constructor(private logger: Logger) {}\n\n transform(env: Env, envContext: EnvContext): PkgTransformationMap | undefined {\n // Old env\n if (!env?.workspaceConfig) {\n return undefined;\n }\n\n return {\n workspaceConfig: () => {\n const configWriterList: ConfigWriterList = env.workspaceConfig();\n if (!configWriterList) return [];\n if (!configWriterList.compute) {\n // This is a core env that doesn't use the ConfigWriterList but create the\n // ConfigWriterEntry directly.\n if (\n Array.isArray(configWriterList) &&\n configWriterList.length > 0 &&\n typeof configWriterList[0].calcConfigFiles === 'function'\n ) {\n return configWriterList;\n }\n return [];\n }\n return configWriterList?.compute(envContext);\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;AAeO,MAAMA,2BAA2B,CAA4B;EAGlEC,WAAWA,CAASC,MAAc,EAAE;IAAA,KAAhBA,MAAc,GAAdA,MAAc;IAAAC,eAAA,eAF3B,sBAAsB;EAEQ;EAErCC,SAASA,CAACC,GAAQ,EAAEC,UAAsB,EAAoC;IAC5E;IACA,IAAI,
|
|
1
|
+
{"version":3,"names":["WorkspaceConfigFilesService","constructor","logger","_defineProperty","transform","env","envContext","workspaceConfig","undefined","configWriterList","compute","Array","isArray","length","calcConfigFiles","exports"],"sources":["workspace-config-files.service.tsx"],"sourcesContent":["import { Logger } from '@teambit/logger';\nimport { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { ConfigWriterList } from './config-writer-list';\nimport { ConfigWriterEntry } from './config-writer-entry';\n\nexport type PkgDescriptor = {\n id: string;\n displayName: string;\n config?: string;\n};\n\ntype PkgTransformationMap = ServiceTransformationMap & {\n workspaceConfig: () => ConfigWriterEntry[];\n};\n\nexport class WorkspaceConfigFilesService implements EnvService<any> {\n name = 'WorkspaceConfigFiles';\n\n constructor(private logger: Logger) {}\n\n transform(env: Env, envContext: EnvContext): PkgTransformationMap | undefined {\n // Old env\n if (!env?.workspaceConfig) {\n return undefined;\n }\n\n return {\n workspaceConfig: () => {\n const configWriterList: ConfigWriterList = env.workspaceConfig();\n if (!configWriterList) return [];\n if (!configWriterList.compute) {\n // This is a core env that doesn't use the ConfigWriterList but create the\n // ConfigWriterEntry directly.\n if (\n Array.isArray(configWriterList) &&\n configWriterList.length > 0 &&\n typeof configWriterList[0].calcConfigFiles === 'function'\n ) {\n return configWriterList;\n }\n return [];\n }\n return configWriterList?.compute(envContext);\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;AAeO,MAAMA,2BAA2B,CAA4B;EAGlEC,WAAWA,CAASC,MAAc,EAAE;IAAA,KAAhBA,MAAc,GAAdA,MAAc;IAAAC,eAAA,eAF3B,sBAAsB;EAEQ;EAErCC,SAASA,CAACC,GAAQ,EAAEC,UAAsB,EAAoC;IAC5E;IACA,IAAI,CAACD,GAAG,EAAEE,eAAe,EAAE;MACzB,OAAOC,SAAS;IAClB;IAEA,OAAO;MACLD,eAAe,EAAEA,CAAA,KAAM;QACrB,MAAME,gBAAkC,GAAGJ,GAAG,CAACE,eAAe,CAAC,CAAC;QAChE,IAAI,CAACE,gBAAgB,EAAE,OAAO,EAAE;QAChC,IAAI,CAACA,gBAAgB,CAACC,OAAO,EAAE;UAC7B;UACA;UACA,IACEC,KAAK,CAACC,OAAO,CAACH,gBAAgB,CAAC,IAC/BA,gBAAgB,CAACI,MAAM,GAAG,CAAC,IAC3B,OAAOJ,gBAAgB,CAAC,CAAC,CAAC,CAACK,eAAe,KAAK,UAAU,EACzD;YACA,OAAOL,gBAAgB;UACzB;UACA,OAAO,EAAE;QACX;QACA,OAAOA,gBAAgB,EAAEC,OAAO,CAACJ,UAAU,CAAC;MAC9C;IACF,CAAC;EACH;AACF;AAACS,OAAA,CAAAf,2BAAA,GAAAA,2BAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ExtendingConfigFile } from '../config-writer-entry';
|
|
2
2
|
import { EnvCompsDirsMap, EnvConfigWriterEntry, WriteConfigFilesOptions } from '../workspace-config-files.main.runtime';
|
|
3
3
|
import { WrittenRealConfigFilesByHash } from './real-config-files';
|
|
4
|
-
export
|
|
4
|
+
export type WrittenExtendingConfigFile = ExtendingConfigFile & {
|
|
5
5
|
filePaths: string[];
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type EnvsWrittenExtendingConfigFile = {
|
|
8
8
|
envIds: string[];
|
|
9
9
|
extendingConfigFile: WrittenExtendingConfigFile;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type EnvsWrittenExtendingConfigFiles = Array<EnvsWrittenExtendingConfigFile>;
|
|
12
|
+
export type ExtendingConfigFilesMap = {
|
|
13
13
|
[configFileHash: string]: {
|
|
14
14
|
envIds: string[];
|
|
15
15
|
extendingConfigFile: Required<ExtendingConfigFile>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ConfigFile } from '../config-writer-entry';
|
|
2
2
|
import { EnvCompsDirsMap, EnvConfigWriterEntry, WriteConfigFilesOptions } from '../workspace-config-files.main.runtime';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type EnvsWrittenRealConfigFiles = Array<EnvsWrittenRealConfigFile>;
|
|
4
|
+
export type EnvsWrittenRealConfigFile = {
|
|
5
5
|
envIds: string[];
|
|
6
6
|
writtenRealConfigFile: WrittenConfigFile;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type WrittenRealConfigFilesByHash = {
|
|
9
9
|
[hash: string]: EnvsWrittenRealConfigFile;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type WrittenConfigFile = Required<ConfigFile> & {
|
|
12
12
|
filePath: string;
|
|
13
13
|
};
|
|
14
14
|
export declare function handleRealConfigFiles(envEntries: EnvConfigWriterEntry[], envCompsDirsMap: EnvCompsDirsMap, configsRootDir: string, opts: WriteConfigFilesOptions): Promise<WrittenRealConfigFilesByHash>;
|
|
@@ -53,7 +53,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
53
53
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(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, opts) {
|
|
56
|
-
var _envEntries$find;
|
|
57
56
|
const allEnvsCalculatedRealConfigFiles = await (0, _pMapSeries().default)(envEntries, async envConfigFileEntry => {
|
|
58
57
|
const envMapVal = envCompsDirsMap[envConfigFileEntry.envId];
|
|
59
58
|
const realConfigFiles = await calculateOneEnvRealConfigFiles(envConfigFileEntry, envMapVal, configsRootDir);
|
|
@@ -64,7 +63,7 @@ async function handleRealConfigFiles(envEntries, envCompsDirsMap, configsRootDir
|
|
|
64
63
|
};
|
|
65
64
|
});
|
|
66
65
|
// Find the first merge function exists
|
|
67
|
-
const mergeFunc =
|
|
66
|
+
const mergeFunc = envEntries.find(envEntry => !!envEntry.configWriter.mergeConfigFiles)?.configWriter.mergeConfigFiles;
|
|
68
67
|
const mergedRealConfigFiles = mergeRealConfigFiles(allEnvsCalculatedRealConfigFiles, mergeFunc);
|
|
69
68
|
const writtenConfigFilesMap = {};
|
|
70
69
|
await Promise.all(Object.entries(mergedRealConfigFiles).map(async ([hash, {
|
|
@@ -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","String","Symbol","toPrimitive","call","TypeError","Number","handleRealConfigFiles","envEntries","envCompsDirsMap","configsRootDir","opts","_envEntries$find","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 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(envConfigFileEntry, envMapVal, configsRootDir);\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) {\n const { configWriter, executionContext } = envConfigFileEntry;\n const calculatedConfigFiles = configWriter.calcConfigFiles(executionContext, envMapValue, configsRootDir);\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,IA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c,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,EACtBC,IAA6B,EACD;EAC5B,MAAMwB,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,CAAC5C,IAAI,CAACgD,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"}
|
|
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","String","Symbol","toPrimitive","call","TypeError","Number","handleRealConfigFiles","envEntries","envCompsDirsMap","configsRootDir","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 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(envConfigFileEntry, envMapVal, configsRootDir);\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) {\n const { configWriter, executionContext } = envConfigFileEntry;\n const calculatedConfigFiles = configWriter.calcConfigFiles(executionContext, envMapValue, configsRootDir);\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;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAA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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,EAAC/C,cAAc,EAAE4C,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"}
|
package/dist/ws-config.cmd.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
2
|
import { WorkspaceConfigFilesMain } from './workspace-config-files.main.runtime';
|
|
3
|
-
export
|
|
3
|
+
export type CleanConfigCmdFlags = {
|
|
4
4
|
dryRun?: boolean;
|
|
5
5
|
silent?: boolean;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type WriteConfigCmdFlags = {
|
|
8
8
|
dryRun?: boolean;
|
|
9
9
|
writers?: string;
|
|
10
10
|
noDedupe?: boolean;
|
|
@@ -17,7 +17,7 @@ export declare class WsConfigCmd implements Command {
|
|
|
17
17
|
name: string;
|
|
18
18
|
alias: string;
|
|
19
19
|
description: string;
|
|
20
|
-
options:
|
|
20
|
+
options: any[];
|
|
21
21
|
group: string;
|
|
22
22
|
commands: Command[];
|
|
23
23
|
report([unrecognizedSubcommand]: [string]): Promise<string>;
|
|
@@ -33,7 +33,7 @@ export declare class WsConfigWriteCmd implements Command {
|
|
|
33
33
|
report(_args: any, flags: WriteConfigCmdFlags): Promise<string>;
|
|
34
34
|
json(_args: any, flags: WriteConfigCmdFlags): Promise<{
|
|
35
35
|
wsDir: string;
|
|
36
|
-
cleanResults: string[]
|
|
36
|
+
cleanResults: string[];
|
|
37
37
|
writeResults: import("./workspace-config-files.main.runtime").WriteResults;
|
|
38
38
|
}>;
|
|
39
39
|
}
|
package/dist/ws-config.cmd.js
CHANGED
|
@@ -76,7 +76,7 @@ class WsConfigWriteCmd {
|
|
|
76
76
|
dedupe: !noDedupe,
|
|
77
77
|
dryRun,
|
|
78
78
|
silent,
|
|
79
|
-
writers: writers
|
|
79
|
+
writers: writers?.split(',')
|
|
80
80
|
});
|
|
81
81
|
if (dryRun) {
|
|
82
82
|
const updatedWriteResults = writeResults;
|
|
@@ -122,7 +122,6 @@ class WsConfigCleanCmd {
|
|
|
122
122
|
return warning + output;
|
|
123
123
|
}
|
|
124
124
|
async json(_args, flags) {
|
|
125
|
-
var _flags$writers;
|
|
126
125
|
const {
|
|
127
126
|
silent,
|
|
128
127
|
dryRun
|
|
@@ -130,7 +129,7 @@ class WsConfigCleanCmd {
|
|
|
130
129
|
const cleanResults = await this.workspaceConfigFilesMain.cleanConfigFiles({
|
|
131
130
|
dryRun,
|
|
132
131
|
silent,
|
|
133
|
-
writers:
|
|
132
|
+
writers: flags.writers?.split(',')
|
|
134
133
|
});
|
|
135
134
|
return cleanResults;
|
|
136
135
|
}
|
|
@@ -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","String","r","e","Symbol","toPrimitive","call","TypeError","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","_flags$writers","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,MAA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}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_outputs","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","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,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,CAAA,GAAAL,CAAA,CAAAM,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAJ,CAAA,GAAAI,CAAA,CAAAG,IAAA,CAAAR,CAAA,EAAAI,CAAA,uCAAAH,CAAA,SAAAA,CAAA,YAAAQ,SA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A6B,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"}
|
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.109",
|
|
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.109"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -17,32 +17,24 @@
|
|
|
17
17
|
"yesno": "0.4.0",
|
|
18
18
|
"normalize-path": "3.0.0",
|
|
19
19
|
"string-format": "0.5.0",
|
|
20
|
-
"core-js": "^3.0.0",
|
|
21
|
-
"@babel/runtime": "7.20.0",
|
|
22
20
|
"@teambit/harmony": "0.4.6",
|
|
23
21
|
"@teambit/bit-error": "0.0.404",
|
|
24
|
-
"@teambit/envs": "1.0.
|
|
25
|
-
"@teambit/cli": "0.0.
|
|
26
|
-
"@teambit/logger": "0.0.
|
|
27
|
-
"@teambit/workspace": "1.0.
|
|
22
|
+
"@teambit/envs": "1.0.109",
|
|
23
|
+
"@teambit/cli": "0.0.841",
|
|
24
|
+
"@teambit/logger": "0.0.934",
|
|
25
|
+
"@teambit/workspace": "1.0.109"
|
|
28
26
|
},
|
|
29
27
|
"devDependencies": {
|
|
30
28
|
"@types/lodash": "4.14.165",
|
|
31
|
-
"@types/chai": "4.2.15",
|
|
32
|
-
"chai": "4.3.0",
|
|
33
29
|
"@types/fs-extra": "9.0.7",
|
|
34
30
|
"@types/normalize-path": "^3.0.0",
|
|
35
31
|
"@types/mocha": "9.1.0",
|
|
36
|
-
"@types/
|
|
37
|
-
"@types/
|
|
38
|
-
"@
|
|
39
|
-
"@types/jest": "^26.0.0",
|
|
40
|
-
"@types/testing-library__jest-dom": "5.9.5"
|
|
32
|
+
"@types/jest": "^29.2.2",
|
|
33
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
34
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.14"
|
|
41
35
|
},
|
|
42
36
|
"peerDependencies": {
|
|
43
|
-
"@teambit/legacy": "1.0.624"
|
|
44
|
-
"react": "^16.8.0 || ^17.0.0",
|
|
45
|
-
"react-dom": "^16.8.0 || ^17.0.0"
|
|
37
|
+
"@teambit/legacy": "1.0.624"
|
|
46
38
|
},
|
|
47
39
|
"license": "Apache-2.0",
|
|
48
40
|
"optionalDependencies": {},
|
|
@@ -56,7 +48,7 @@
|
|
|
56
48
|
},
|
|
57
49
|
"private": false,
|
|
58
50
|
"engines": {
|
|
59
|
-
"node": ">=
|
|
51
|
+
"node": ">=16.0.0"
|
|
60
52
|
},
|
|
61
53
|
"repository": {
|
|
62
54
|
"type": "git",
|
|
@@ -65,12 +57,9 @@
|
|
|
65
57
|
"keywords": [
|
|
66
58
|
"bit",
|
|
67
59
|
"bit-aspect",
|
|
60
|
+
"bit-core-aspect",
|
|
68
61
|
"components",
|
|
69
62
|
"collaboration",
|
|
70
|
-
"web"
|
|
71
|
-
"react",
|
|
72
|
-
"react-components",
|
|
73
|
-
"angular",
|
|
74
|
-
"angular-components"
|
|
63
|
+
"web"
|
|
75
64
|
]
|
|
76
65
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
9
7
|
],
|
|
10
|
-
"target": "
|
|
11
|
-
"module": "
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"composite": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"declaration": true,
|
|
16
12
|
"sourceMap": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
13
|
"experimentalDecorators": true,
|
|
19
|
-
"
|
|
14
|
+
"skipLibCheck": true,
|
|
20
15
|
"moduleResolution": "node",
|
|
21
16
|
"esModuleInterop": true,
|
|
22
|
-
"rootDir": ".",
|
|
23
17
|
"resolveJsonModule": true,
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"emitDeclarationOnly": true
|
|
31
21
|
},
|
|
32
22
|
"exclude": [
|
|
23
|
+
"artifacts",
|
|
24
|
+
"public",
|
|
33
25
|
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"package.json",
|
|
34
28
|
"esm.mjs",
|
|
35
|
-
"
|
|
29
|
+
"**/*.cjs",
|
|
30
|
+
"./dist"
|
|
36
31
|
],
|
|
37
32
|
"include": [
|
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
29
|
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|