@teambit/workspace-config-files 1.0.108 → 1.0.110

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.
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuites>
3
+ <testsuite name="teambit.workspace/workspace-config-files@1.0.110" timestamp="2023-12-28T03:49:10.905Z" 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" time="0.001"/>
7
+ <testcase classname="dedup-paths.spec.js" name="should place files in correct folders" time="0.002"/>
8
+ <testcase classname="dedup-paths.spec.js" name="should reduce files to minimum necessary"/>
9
+ <testcase classname="dedup-paths.spec.js" name="should place files in correct folders" time="0.001"/>
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,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.108/dist/workspace-config-files.docs.mdx';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace-config-files@1.0.110/dist/workspace-config-files.docs.mdx';
3
3
 
4
4
  export const compositions = [];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace-config-files",
3
- "version": "1.0.108",
3
+ "version": "1.0.110",
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.108"
9
+ "version": "1.0.110"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -19,10 +19,10 @@
19
19
  "string-format": "0.5.0",
20
20
  "@teambit/harmony": "0.4.6",
21
21
  "@teambit/bit-error": "0.0.404",
22
- "@teambit/envs": "1.0.108",
23
- "@teambit/cli": "0.0.840",
24
- "@teambit/logger": "0.0.933",
25
- "@teambit/workspace": "1.0.108"
22
+ "@teambit/envs": "1.0.110",
23
+ "@teambit/cli": "0.0.842",
24
+ "@teambit/logger": "0.0.935",
25
+ "@teambit/workspace": "1.0.110"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/lodash": "4.14.165",
@@ -31,7 +31,7 @@
31
31
  "@types/mocha": "9.1.0",
32
32
  "@types/jest": "^29.2.2",
33
33
  "@types/testing-library__jest-dom": "^5.9.5",
34
- "@teambit/harmony.envs.core-aspect-env": "0.0.13"
34
+ "@teambit/harmony.envs.core-aspect-env": "0.0.15"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@teambit/legacy": "1.0.624"
@@ -40,11 +40,15 @@
40
40
  "optionalDependencies": {},
41
41
  "peerDependenciesMeta": {},
42
42
  "exports": {
43
- "node": {
44
- "require": "./dist/index.js",
45
- "import": "./dist/esm.mjs"
43
+ ".": {
44
+ "node": {
45
+ "require": "./dist/index.js",
46
+ "import": "./dist/esm.mjs"
47
+ },
48
+ "default": "./dist/index.js"
46
49
  },
47
- "default": "./dist/index.js"
50
+ "./dist/*": "./dist/*",
51
+ "./artifacts/*": "./artifacts/*"
48
52
  },
49
53
  "private": false,
50
54
  "engines": {
@@ -1,146 +0,0 @@
1
- import { Environment, ExecutionContext } from '@teambit/envs';
2
- import { EnvMapValue } from './workspace-config-files.main.runtime';
3
- import { WrittenConfigFile } from './writers';
4
-
5
- export type ConfigFile = {
6
- /**
7
- * Name of the config file.
8
- * supports also using `{hash}` in the name, which will be replaced by the hash of the config file.
9
- */
10
- name: string;
11
- /**
12
- * Content of the config file.
13
- * I.E the content of the tsconfig.json file.
14
- */
15
- content: string;
16
- /**
17
- * Hash of the config file.
18
- */
19
- hash?: string;
20
- };
21
-
22
- export type ExtendingConfigFileAdditionalProp = {
23
- /**
24
- * the config file that this config file extends.
25
- */
26
- extendingTarget: WrittenConfigFile;
27
-
28
- /**
29
- * When replacing the config file name with the actual path of the config file, use absolute paths.
30
- */
31
- useAbsPaths?: boolean;
32
- };
33
-
34
- export type ExtendingConfigFile = ConfigFile & ExtendingConfigFileAdditionalProp;
35
-
36
- export type PostProcessExtendingConfigFilesArgs = {
37
- workspaceDir: string;
38
- configsRootDir: string;
39
- extendingConfigFile: ExtendingConfigFile;
40
- /**
41
- * Paths that the file will be written to.
42
- */
43
- paths: string[];
44
- envMapValue: EnvMapValue;
45
- /**
46
- * This is a flag for backward compatibility
47
- * We used to return string from the post process, so old versions of bit only knows to handle string results
48
- * while in new version we support getting array of objects
49
- * we need to know if bit the user is using support the new format or not
50
- */
51
- supportSpecificPathChange?: boolean;
52
- };
53
-
54
- export type GenerateExtendingConfigFilesArgs = {
55
- workspaceDir: string;
56
- configsRootDir: string;
57
- writtenConfigFiles: WrittenConfigFile[];
58
- envMapValue: EnvMapValue;
59
- };
60
-
61
- export type PostProcessExtendingConfigFilesOneFile = {
62
- path: string;
63
- content: string;
64
- };
65
-
66
- export type MergeConfigFilesFunc = (configFile: ConfigFile, configFile2: ConfigFile) => string;
67
- export interface ConfigWriterEntry {
68
- /**
69
- * Id is used for few things:
70
- * 1. merge/post process different configs files (from different envs) together.
71
- * 2. filter the config writer by the cli when using --writers flag.
72
- */
73
- id: string;
74
-
75
- /**
76
- * Name of the config writer.
77
- * used for outputs and logging.
78
- */
79
- name: string;
80
-
81
- /**
82
- * Get's the component env and return the config file content
83
- * for example the eslint config to tsconfig.
84
- * This also enable to return a hash of the config file, which will be used to determine if
85
- * 2 config files are the same.
86
- * If the hash is not provided, the content will be used as the hash.
87
- * This enables the specific config type to ignore specific fields when calculating the
88
- * hash in order to ignore theses fields when determining if 2 config files are the same.
89
- * The calc function also get the target directory of the config file (calculated by this aspect) as sometime there
90
- * is a need to change the config file content based on the target directory.
91
- * for example, change the includes/excludes paths to be relative to the target directory.
92
- * The calc can return undefined if the config file is not relevant for the component. or not supported by the subscriber.
93
- * for example if the component uses babel to compile, then tsconfig is not relevant.
94
- * @param env
95
- */
96
- calcConfigFiles(executionContext: ExecutionContext, env: Environment, dir: string): ConfigFile[] | undefined;
97
-
98
- /**
99
- * Provide a function that knows how to merge 2 config files together.
100
- * This is used when 2 different envs generate the same config file hash.
101
- * sometime we want to merge the 2 config files together.
102
- * @param configFile
103
- * @param configFile2
104
- */
105
- mergeConfigFiles?: MergeConfigFilesFunc;
106
-
107
- /**
108
- * This will be used to generate an extending file content.
109
- * For example, the tsconfig.json file will extend the real tsconfig.{hash}.json file (that were coming from the env).
110
- * That way we can avoid writing the same config file multiple times.
111
- * It also reduces the risk of the user manually change the config file and then the changes will be lost.
112
- * This function support returning a file with content with a dsl using `{}` to replace the config file name.
113
- * for example:
114
- * content = `{
115
- * "extends": {configFile.name},
116
- * }`
117
- */
118
- generateExtendingFile(args: GenerateExtendingConfigFilesArgs): ExtendingConfigFile | undefined;
119
-
120
- /**
121
- * This enables the writer to do some post processing after the extending config files were calculated and deduped.
122
- * this is important in case when we need to change a config file / extending config file after it was calculated
123
- * based on all the environments in the ws
124
- * or based on other config files that were written.
125
- * @param args
126
- */
127
- postProcessExtendingConfigFiles?(
128
- args: PostProcessExtendingConfigFilesArgs
129
- ): Promise<string | Array<PostProcessExtendingConfigFilesOneFile> | undefined>;
130
-
131
- /**
132
- * Find all the files that are relevant for the config type.
133
- * This is used to clean / delete these files
134
- * This should return an array of glob patterns (that will passed to the globby/minimatch library)
135
- * @param dir
136
- */
137
- patterns: string[];
138
-
139
- /**
140
- * A function to determine if a file was generated by bit.
141
- * This is useful to check if the config file was generated by bit to prevent delete user's file.
142
- * @param filePath
143
- * @returns
144
- */
145
- isBitGenerated?: (filePath: string) => boolean;
146
- }
@@ -1,84 +0,0 @@
1
- import { EnvContext, EnvHandler } from '@teambit/envs';
2
- import { findIndex } from 'lodash';
3
- import { ConfigWriterEntry } from './config-writer-entry';
4
-
5
- export type ConfigWriterHandler = {
6
- handler: EnvHandler<ConfigWriterEntry>;
7
- name: string;
8
- };
9
-
10
- /**
11
- * create and maintain config writer list for component dev environments.
12
- */
13
- export class ConfigWriterList {
14
- constructor(private _writers: ConfigWriterHandler[]) {}
15
-
16
- /**
17
- * list all congig writer handlers in the list.
18
- */
19
- get writers() {
20
- return this._writers;
21
- }
22
-
23
- private initiateWriters(writers: ConfigWriterHandler[], context: EnvContext): ConfigWriterEntry[] {
24
- return writers.map((task) => {
25
- return task.handler(context);
26
- });
27
- }
28
-
29
- /**
30
- * add writers to the list.
31
- */
32
- add(writers: ConfigWriterHandler[]) {
33
- this._writers = this._writers.concat(writers);
34
- return this;
35
- }
36
-
37
- /**
38
- * remove writers from the list.
39
- */
40
- remove(writerNames: string[]) {
41
- this._writers = this._writers.filter((writer) => {
42
- return !writerNames.includes(writer.name);
43
- });
44
- return this;
45
- }
46
-
47
- /**
48
- * replace writers in the list.
49
- */
50
- replace(writers: ConfigWriterHandler[]) {
51
- writers.forEach((writer) => {
52
- // Find Writer index using _.findIndex
53
- const matchIndex = findIndex(this._writers, (origWriter) => {
54
- return origWriter.name === writer.name;
55
- });
56
- if (matchIndex !== -1) {
57
- // Replace Writer at index using native splice
58
- this._writers.splice(matchIndex, 1, writer);
59
- }
60
- });
61
- return this;
62
- }
63
-
64
- /**
65
- * return a new list with the writers from the args added.
66
- * @param pipeline
67
- * @returns
68
- */
69
- concat(writerList: ConfigWriterList) {
70
- return new ConfigWriterList(this._writers.concat(writerList.writers));
71
- }
72
-
73
- /**
74
- * compute the list.
75
- */
76
- compute(context: EnvContext): ConfigWriterEntry[] {
77
- const writerEntries = this.initiateWriters(this._writers, context);
78
- return writerEntries;
79
- }
80
-
81
- static from(writersHandlers: ConfigWriterHandler[]): ConfigWriterList {
82
- return new ConfigWriterList(writersHandlers);
83
- }
84
- }
@@ -1,349 +0,0 @@
1
- import { DedupedPaths, dedupePaths } from './dedup-paths';
2
- import { ExtendingConfigFilesMap } from './writers';
3
-
4
- const envCompsDirsMap = {
5
- 'teambit.harmony/node': {
6
- id: 'teambit.harmony/node',
7
- paths: [
8
- 'react/apps/react-app-types',
9
- 'compilation/babel-compiler',
10
- 'compilation/compiler-task',
11
- 'mdx/compilers/mdx-compiler',
12
- 'mdx/compilers/mdx-multi-compiler',
13
- 'compilation/compilers/multi-compiler',
14
- 'defender/eslint-linter',
15
- 'mdx/generator/mdx-starters',
16
- 'mdx/generator/mdx-templates',
17
- 'react/generator/react-starters',
18
- 'react/generator/react-templates',
19
- 'defender/jest-tester',
20
- 'react/jest/react-jest',
21
- 'defender/linter-task',
22
- 'defender/mocha-tester',
23
- 'compilation/modules/babel-file-transpiler',
24
- 'defender/prettier-formatter',
25
- 'preview/react-preview',
26
- 'defender/tester-task',
27
- 'typescript/typescript-compiler',
28
- 'webpack/webpack-bundler',
29
- 'webpack/webpack-dev-server',
30
- 'react/webpack/react-webpack',
31
- ],
32
- },
33
- 'teambit.react/react-env@0.0.44': {
34
- id: 'teambit.react/react-env@0.0.44',
35
- paths: ['test-new-envs-app/apps/test-app', 'test-new-env/ui/button2'],
36
- },
37
- 'teambit.react/react': {
38
- id: 'teambit.react/react',
39
- paths: ['docs/docs-template', 'react/mounter'],
40
- },
41
- 'teambit.envs/env': {
42
- id: 'teambit.envs/env',
43
- paths: [
44
- 'react/examples/my-react-env',
45
- 'mdx/mdx-env',
46
- 'node/node',
47
- 'node/node-env-extension',
48
- 'react/react-env',
49
- 'react/react-env-extension',
50
- ],
51
- },
52
- 'teambit.mdx/mdx-env@0.0.6': {
53
- id: 'teambit.mdx/mdx-env@0.0.6',
54
- paths: ['test-new-env/mdx/content-comp'],
55
- },
56
- 'teambit.node/node@0.0.16': {
57
- id: 'teambit.node/node@0.0.16',
58
- paths: ['test-new-env/node/node-comp1', 'test-new-env/node/node-comp2'],
59
- },
60
- 'teambit.react/examples/my-react-env@0.0.39': {
61
- id: 'teambit.react/examples/my-react-env@0.0.39',
62
- paths: ['test-new-env/ui/button'],
63
- },
64
- };
65
-
66
- const tsExtendingConfigFilesMap: ExtendingConfigFilesMap = {
67
- '816b7f584991ff21a7682ef8a4229ebf312c457f': {
68
- extendingConfigFile: {
69
- useAbsPaths: false,
70
- content:
71
- '// bit-generated-typescript-config\n' +
72
- '\n' +
73
- '{\n' +
74
- ' "extends": "/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json"\n' +
75
- '}',
76
- name: 'tsconfig.json',
77
- extendingTarget: {
78
- hash: '4957ea3122e57ea3302aadd885eed84127d9c54b',
79
- content: 'does not matter',
80
- name: 'tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json',
81
- filePath:
82
- '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.4957ea3122e57ea3302aadd885eed84127d9c54b.json',
83
- },
84
-
85
- hash: '816b7f584991ff21a7682ef8a4229ebf312c457f',
86
- },
87
- envIds: ['teambit.harmony/node', 'teambit.react/react'],
88
- },
89
- '00330a9c547353867d519c34f47e17ddc9f161d1': {
90
- extendingConfigFile: {
91
- useAbsPaths: false,
92
- content:
93
- '// bit-generated-typescript-config\n' +
94
- '\n' +
95
- '{\n' +
96
- ' "extends": "/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json"\n' +
97
- '}',
98
- name: 'tsconfig.json',
99
- extendingTarget: {
100
- hash: '17b99a1071b1d2d86ed04ebce68903b82403f278',
101
- content: 'does not matter',
102
- name: 'tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json',
103
- filePath:
104
- '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.17b99a1071b1d2d86ed04ebce68903b82403f278.json',
105
- },
106
- hash: '00330a9c547353867d519c34f47e17ddc9f161d1',
107
- },
108
- envIds: ['teambit.react/react-env@0.0.44', 'teambit.react/examples/my-react-env@0.0.39'],
109
- },
110
- '3c5960bcad98570b98834a5c37f47dd4729dbef0': {
111
- extendingConfigFile: {
112
- useAbsPaths: false,
113
- content:
114
- '// bit-generated-typescript-config\n' +
115
- '\n' +
116
- '{\n' +
117
- ' "extends": "/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json"\n' +
118
- '}',
119
- name: 'tsconfig.json',
120
- extendingTarget: {
121
- hash: 'dab521d0914afe64de248743e05a169cf9b4b50c',
122
- content: 'does not matter',
123
- name: 'tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json',
124
- filePath:
125
- '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/tsconfig.bit.dab521d0914afe64de248743e05a169cf9b4b50c.json',
126
- },
127
- hash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',
128
- },
129
- envIds: ['teambit.node/node@0.0.16'],
130
- },
131
- };
132
-
133
- const tsExpectedDedupedPaths: DedupedPaths = [
134
- {
135
- fileHash: '00330a9c547353867d519c34f47e17ddc9f161d1',
136
- paths: ['test-new-envs-app', 'test-new-env/ui'],
137
- },
138
- {
139
- fileHash: '3c5960bcad98570b98834a5c37f47dd4729dbef0',
140
- paths: ['test-new-env/node'],
141
- },
142
- {
143
- fileHash: '816b7f584991ff21a7682ef8a4229ebf312c457f',
144
- paths: ['.'],
145
- },
146
- ];
147
-
148
- const eslintExtendingConfigFilesMap: ExtendingConfigFilesMap = {
149
- '8810839e74a9c41694bb5a2a8587dcae71dc389d': {
150
- extendingConfigFile: {
151
- useAbsPaths: false,
152
- content:
153
- '// bit-generated-eslint-config\n' +
154
- '{\n' +
155
- ' "extends": [\n' +
156
- ' "/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json"\n' +
157
- ' ]\n' +
158
- '}',
159
- name: '.eslintrc.json',
160
- extendingTarget: {
161
- hash: 'be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c',
162
- content: 'does not matter',
163
- name: '.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json',
164
- filePath:
165
- '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.be8facfbdcf1db685d5020f8612d8c2c3ac2eb7c.json',
166
- },
167
- hash: '8810839e74a9c41694bb5a2a8587dcae71dc389d',
168
- },
169
- envIds: ['teambit.harmony/node', 'teambit.react/react', 'teambit.envs/env'],
170
- },
171
- ff6ea265e6f21ce25f7985570beef37dd957d0dc: {
172
- extendingConfigFile: {
173
- useAbsPaths: false,
174
- content:
175
- '// bit-generated-eslint-config\n' +
176
- '{\n' +
177
- ' "extends": [\n' +
178
- ' "/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json"\n' +
179
- ' ]\n' +
180
- '}',
181
- name: '.eslintrc.json',
182
- extendingTarget: {
183
- hash: 'e5ca5528c64e0442b05b949fea42cdda4243d840',
184
- content: 'does not matter',
185
- name: '.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json',
186
- filePath:
187
- '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.e5ca5528c64e0442b05b949fea42cdda4243d840.json',
188
- },
189
- hash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc',
190
- },
191
- envIds: ['teambit.react/react-env@0.0.44'],
192
- },
193
- '91021f2c973a2940c70b75447639e4ea2a799955': {
194
- extendingConfigFile: {
195
- useAbsPaths: false,
196
- content:
197
- '// bit-generated-eslint-config\n' +
198
- '{\n' +
199
- ' "extends": [\n' +
200
- ' "/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json"\n' +
201
- ' ]\n' +
202
- '}',
203
- name: '.eslintrc.json',
204
- extendingTarget: {
205
- hash: '7f229bf5ab41e8bfe61916de6c68f9c14c76f23e',
206
- content: 'does not matter',
207
- name: '.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json',
208
- filePath:
209
- '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.7f229bf5ab41e8bfe61916de6c68f9c14c76f23e.json',
210
- },
211
- hash: '91021f2c973a2940c70b75447639e4ea2a799955',
212
- },
213
- envIds: ['teambit.mdx/mdx-env@0.0.6', 'teambit.react/examples/my-react-env@0.0.39'],
214
- },
215
- f1743b227e588db0c59d4a43171653e6c4262816: {
216
- extendingConfigFile: {
217
- useAbsPaths: false,
218
- content:
219
- '// bit-generated-eslint-config\n' +
220
- '{\n' +
221
- ' "extends": [\n' +
222
- ' "/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json"\n' +
223
- ' ]\n' +
224
- '}',
225
- name: '.eslintrc.json',
226
- extendingTarget: {
227
- hash: 'c503f7386e2a637d91c74f7df90d8fafe79c4378',
228
- content: 'does not matter',
229
- name: '.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json',
230
- filePath:
231
- '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.eslintrc.bit.c503f7386e2a637d91c74f7df90d8fafe79c4378.json',
232
- },
233
- hash: 'f1743b227e588db0c59d4a43171653e6c4262816',
234
- },
235
- envIds: ['teambit.node/node@0.0.16'],
236
- },
237
- };
238
-
239
- const eslintExpectedDedupedPaths: DedupedPaths = [
240
- {
241
- fileHash: 'ff6ea265e6f21ce25f7985570beef37dd957d0dc',
242
- paths: ['test-new-envs-app', 'test-new-env/ui/button2'],
243
- },
244
- {
245
- fileHash: '91021f2c973a2940c70b75447639e4ea2a799955',
246
- paths: ['test-new-env/mdx', 'test-new-env/ui/button'],
247
- },
248
- {
249
- fileHash: 'f1743b227e588db0c59d4a43171653e6c4262816',
250
- paths: ['test-new-env/node'],
251
- },
252
- {
253
- fileHash: '8810839e74a9c41694bb5a2a8587dcae71dc389d',
254
- paths: ['.'],
255
- },
256
- ];
257
-
258
- const prettierExtendingConfigFilesMap: ExtendingConfigFilesMap = {
259
- '082f546b2555ea89e7063b20de47c039d387fc74': {
260
- extendingConfigFile: {
261
- useAbsPaths: false,
262
- content:
263
- '// bit-generated-prettier-config\n' +
264
- 'module.exports = {\n' +
265
- " ...require('/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs')\n" +
266
- '}',
267
- name: '.prettierrc.cjs',
268
- extendingTarget: {
269
- hash: 'e4882af8861bcf5b0147891d8b70b40a10428881',
270
- content: 'does not matter',
271
- name: '.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs',
272
- filePath:
273
- '/Users/giladshoham/dev/temp/new-react-18-config-files/node_modules/.cache/.prettierrc.bit.e4882af8861bcf5b0147891d8b70b40a10428881.cjs',
274
- },
275
- hash: '082f546b2555ea89e7063b20de47c039d387fc74',
276
- },
277
- envIds: [
278
- 'teambit.harmony/node',
279
- 'teambit.react/react-env@0.0.44',
280
- 'teambit.react/react',
281
- 'teambit.envs/env',
282
- 'teambit.mdx/mdx-env@0.0.6',
283
- 'teambit.node/node@0.0.16',
284
- 'teambit.react/examples/my-react-env@0.0.39',
285
- ],
286
- },
287
- };
288
-
289
- const prettierExpectedDedupedPaths: DedupedPaths = [
290
- {
291
- fileHash: '082f546b2555ea89e7063b20de47c039d387fc74',
292
- paths: ['.'],
293
- },
294
- ];
295
-
296
- describe('Workspace Config files - dedupe paths', function () {
297
- describe('dedupePaths', () => {
298
- describe('ts example', () => {
299
- let result: DedupedPaths;
300
- beforeAll(async () => {
301
- // @ts-ignore (we don't really care about the env itself here)
302
- result = dedupePaths(tsExtendingConfigFilesMap, envCompsDirsMap);
303
- });
304
-
305
- it('should reduce files to minimum necessary', async () => {
306
- expect(result.length).toEqual(tsExpectedDedupedPaths.length);
307
- });
308
-
309
- it('should place files in correct folders', async () => {
310
- // @ts-ignore
311
- expect(result).toMatchObject(tsExpectedDedupedPaths);
312
- });
313
- });
314
-
315
- describe('eslint example', () => {
316
- let result: DedupedPaths;
317
- beforeAll(async () => {
318
- // @ts-ignore (we don't really care about the env itself here)
319
- result = dedupePaths(eslintExtendingConfigFilesMap, envCompsDirsMap);
320
- });
321
-
322
- it('should reduce files to minimum necessary', async () => {
323
- expect(result.length).toEqual(eslintExpectedDedupedPaths.length);
324
- });
325
-
326
- it('should place files in correct folders', async () => {
327
- // @ts-ignore
328
- expect(result).toMatchObject(eslintExpectedDedupedPaths);
329
- });
330
- });
331
-
332
- describe('prettier example', () => {
333
- let result: DedupedPaths;
334
- beforeAll(async () => {
335
- // @ts-ignore (we don't really care about the env itself here)
336
- result = dedupePaths(prettierExtendingConfigFilesMap, envCompsDirsMap);
337
- });
338
-
339
- it('should reduce files to minimum necessary', async () => {
340
- expect(result.length).toEqual(prettierExpectedDedupedPaths.length);
341
- });
342
-
343
- it('should place files in correct folders', async () => {
344
- // @ts-ignore
345
- expect(result).toMatchObject(prettierExpectedDedupedPaths);
346
- });
347
- });
348
- });
349
- });