@teambit/react 0.0.707 → 0.0.710
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/env-template/public/{413.js → 624.js} +4 -4
- package/artifacts/env-template/public/750.js +6 -2
- package/artifacts/env-template/public/793.js +17 -17
- package/artifacts/env-template/public/assets-manifest.json +13 -15
- package/artifacts/env-template/public/compositions.4c4b53d83a278ebc6149.js +1 -0
- package/artifacts/env-template/public/compositions.html +1 -1
- package/artifacts/env-template/public/{overview.b1ef1597088bd5dc608b.js → overview.cc60900c8b0e4796d561.js} +2 -2
- package/artifacts/env-template/public/overview.html +1 -1
- package/artifacts/env-template/public/{preview-root.598f047e01605292ce77.js → preview-root.aa73a7325c772363fa2a.js} +1 -1
- package/artifacts/env-template/public/service-worker.js +1 -1
- package/artifacts/env-template/public/static/css/{compositions.cd8be53f.css → compositions.4138c069.css} +1 -1
- package/artifacts/env-template/public/static/css/{previewRoot.a16607da.css → previewRoot.c0db5bec.css} +1 -1
- package/artifacts/preview/teambit_react_react-preview.js +2 -2
- package/{compositions-1649733938651.js → compositions-1650252279523.js} +0 -0
- package/dist/templates/react-env/files/doc.js +15 -1
- package/dist/templates/react-env/files/doc.js.map +1 -1
- package/dist/templates/react-env/files/main.runtime.js +38 -29
- package/dist/templates/react-env/files/main.runtime.js.map +1 -1
- package/dist/templates/react-env/files/typescript/styles.d.ts +1 -0
- package/dist/templates/react-env/files/typescript/styles.js +16 -0
- package/dist/templates/react-env/files/typescript/styles.js.map +1 -0
- package/dist/templates/react-env/files/typescript/ts-transformer.d.ts +1 -0
- package/dist/templates/react-env/files/typescript/ts-transformer.js +59 -0
- package/dist/templates/react-env/files/typescript/ts-transformer.js.map +1 -0
- package/dist/templates/react-env/files/{typescript.config.d.ts → typescript/typescript.config.d.ts} +0 -0
- package/dist/templates/react-env/files/{typescript.config.js → typescript/typescript.config.js} +0 -0
- package/dist/templates/react-env/files/{typescript.config.js.map → typescript/typescript.config.js.map} +0 -0
- package/dist/templates/react-env/index.js +28 -2
- package/dist/templates/react-env/index.js.map +1 -1
- package/{overview-1649733938651.js → overview-1650252279523.js} +0 -0
- package/package-tar/teambit-react-0.0.710.tgz +0 -0
- package/package.json +31 -31
- package/{preview-1649733938651.js → preview-1650252279523.js} +2 -2
- package/templates/react-env/files/doc.ts +15 -1
- package/templates/react-env/files/main.runtime.ts +38 -29
- package/templates/react-env/files/typescript/styles.ts +7 -0
- package/templates/react-env/files/typescript/ts-transformer.ts +50 -0
- package/templates/react-env/files/{typescript.config.ts → typescript/typescript.config.ts} +0 -0
- package/templates/react-env/index.ts +12 -2
- package/artifacts/env-template/public/compositions.4b8ac7629e5a4427be2b.js +0 -1
- package/artifacts/env-template/public/static/css/overview.7bb7dce6.css +0 -1
- package/package-tar/teambit-react-0.0.707.tgz +0 -0
|
@@ -13,12 +13,14 @@ function mainRuntimeFile({
|
|
|
13
13
|
import { ReactAspect, ReactMain } from '@teambit/react';
|
|
14
14
|
import { EnvsAspect, EnvsMain } from '@teambit/envs';
|
|
15
15
|
import { ${Name}Aspect } from './${name}.aspect';
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
//
|
|
16
|
+
//import {
|
|
17
|
+
// previewConfigTransformer,
|
|
18
|
+
// devServerConfigTransformer
|
|
19
|
+
//} from './webpack/webpack-transformers';
|
|
20
|
+
//import {
|
|
21
|
+
// devConfigTransformer,
|
|
22
|
+
// buildConfigTransformer,
|
|
23
|
+
//} from "./typescript/ts-transformers";
|
|
22
24
|
|
|
23
25
|
export class ${Name}Main {
|
|
24
26
|
static slots = [];
|
|
@@ -27,18 +29,25 @@ export class ${Name}Main {
|
|
|
27
29
|
|
|
28
30
|
static runtime = MainRuntime;
|
|
29
31
|
|
|
32
|
+
//const webpackModifiers: UseWebpackModifiers = {
|
|
33
|
+
// previewConfig: [previewConfigTransformer],
|
|
34
|
+
// devServerConfig: [devServerConfigTransformer],
|
|
35
|
+
//};
|
|
36
|
+
|
|
37
|
+
//const tsModifiers: UseTypescriptModifiers = {
|
|
38
|
+
// devConfig: [devConfigTransformer],
|
|
39
|
+
// buildConfig: [buildConfigTransformer],
|
|
40
|
+
//};
|
|
41
|
+
|
|
30
42
|
static async provider([react, envs]: [ReactMain, EnvsMain]) {
|
|
31
|
-
const
|
|
43
|
+
const ${Name}Env = react.compose([
|
|
32
44
|
/**
|
|
33
45
|
* Uncomment to override the config files for TypeScript, Webpack or Jest
|
|
34
46
|
* Your config gets merged with the defaults
|
|
35
47
|
*/
|
|
36
48
|
|
|
37
|
-
// react.
|
|
38
|
-
// react.useWebpack(
|
|
39
|
-
// previewConfig: [previewConfigTransformer],
|
|
40
|
-
// devServerConfig: [devServerConfigTransformer],
|
|
41
|
-
// }),
|
|
49
|
+
// react.useTypescript(tsModifiers), // note: this cannot be used in conjunction with react.overrideCompiler
|
|
50
|
+
// react.useWebpack(webpackModifiers),
|
|
42
51
|
// react.overrideJestConfig(require.resolve('./jest/jest.config')),
|
|
43
52
|
|
|
44
53
|
/**
|
|
@@ -47,14 +56,14 @@ export class ${Name}Main {
|
|
|
47
56
|
* bit lint
|
|
48
57
|
* bit lint --fix
|
|
49
58
|
*/
|
|
50
|
-
react.useEslint({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}),
|
|
59
|
+
//react.useEslint({
|
|
60
|
+
// transformers: [
|
|
61
|
+
// (config) => {
|
|
62
|
+
// config.setRule('no-console', ['error']);
|
|
63
|
+
// return config;
|
|
64
|
+
// }
|
|
65
|
+
// ]
|
|
66
|
+
//}),
|
|
58
67
|
|
|
59
68
|
/**
|
|
60
69
|
* override the Prettier default config here the check your formatting
|
|
@@ -62,14 +71,14 @@ export class ${Name}Main {
|
|
|
62
71
|
* bit format --check
|
|
63
72
|
* bit format
|
|
64
73
|
*/
|
|
65
|
-
react.usePrettier({
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}),
|
|
74
|
+
//react.usePrettier({
|
|
75
|
+
// transformers: [
|
|
76
|
+
// (config) => {
|
|
77
|
+
// config.setKey('tabWidth', 2);
|
|
78
|
+
// return config;
|
|
79
|
+
// }
|
|
80
|
+
// ]
|
|
81
|
+
//}),
|
|
73
82
|
|
|
74
83
|
/**
|
|
75
84
|
* override dependencies here
|
|
@@ -82,7 +91,7 @@ export class ${Name}Main {
|
|
|
82
91
|
}
|
|
83
92
|
})
|
|
84
93
|
]);
|
|
85
|
-
envs.registerEnv(
|
|
94
|
+
envs.registerEnv(${Name}Env);
|
|
86
95
|
return new ${Name}Main();
|
|
87
96
|
}
|
|
88
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["main.runtime.ts"],"names":["mainRuntimeFile","namePascalCase","Name","name"],"mappings":";;;;;;;AAEO,SAASA,eAAT,CAAyB;AAAEC,EAAAA,cAAc,EAAEC,IAAlB;AAAwBC,EAAAA;AAAxB,CAAzB,EAA2E;AAChF,SAAQ;AACV;AACA;AACA,WAAWD,IAAK,oBAAmBC,IAAK;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeD,IAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBA,IAAK;AACtB;AACA;AACA;AACA,EAAEA,IAAK,qBAAoBA,IAAK;AAChC,
|
|
1
|
+
{"version":3,"sources":["main.runtime.ts"],"names":["mainRuntimeFile","namePascalCase","Name","name"],"mappings":";;;;;;;AAEO,SAASA,eAAT,CAAyB;AAAEC,EAAAA,cAAc,EAAEC,IAAlB;AAAwBC,EAAAA;AAAxB,CAAzB,EAA2E;AAChF,SAAQ;AACV;AACA;AACA,WAAWD,IAAK,oBAAmBC,IAAK;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeD,IAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAYA,IAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuBA,IAAK;AAC5B,iBAAiBA,IAAK;AACtB;AACA;AACA;AACA,EAAEA,IAAK,qBAAoBA,IAAK;AAChC,CAxFE;AAyFD","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function mainRuntimeFile({ namePascalCase: Name, name }: ComponentContext) {\n return `import { MainRuntime } from '@teambit/cli';\nimport { ReactAspect, ReactMain } from '@teambit/react';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { ${Name}Aspect } from './${name}.aspect';\n//import {\n// previewConfigTransformer,\n// devServerConfigTransformer\n//} from './webpack/webpack-transformers';\n//import {\n// devConfigTransformer,\n// buildConfigTransformer,\n//} from \"./typescript/ts-transformers\";\n\nexport class ${Name}Main {\n static slots = [];\n\n static dependencies = [ReactAspect, EnvsAspect];\n\n static runtime = MainRuntime;\n\n //const webpackModifiers: UseWebpackModifiers = {\n // previewConfig: [previewConfigTransformer],\n // devServerConfig: [devServerConfigTransformer],\n //};\n\n //const tsModifiers: UseTypescriptModifiers = {\n // devConfig: [devConfigTransformer],\n // buildConfig: [buildConfigTransformer],\n //};\n\n static async provider([react, envs]: [ReactMain, EnvsMain]) {\n const ${Name}Env = react.compose([\n /**\n * Uncomment to override the config files for TypeScript, Webpack or Jest\n * Your config gets merged with the defaults\n */\n\n // react.useTypescript(tsModifiers), // note: this cannot be used in conjunction with react.overrideCompiler\n // react.useWebpack(webpackModifiers),\n // react.overrideJestConfig(require.resolve('./jest/jest.config')),\n\n /**\n * override the ESLint default config here then check your files for lint errors\n * @example\n * bit lint\n * bit lint --fix\n */\n //react.useEslint({\n // transformers: [\n // (config) => {\n // config.setRule('no-console', ['error']);\n // return config;\n // }\n // ]\n //}),\n\n /**\n * override the Prettier default config here the check your formatting\n * @example\n * bit format --check\n * bit format\n */\n //react.usePrettier({\n // transformers: [\n // (config) => {\n // config.setKey('tabWidth', 2);\n // return config;\n // }\n // ]\n //}),\n\n /**\n * override dependencies here\n * @example\n * Uncomment types to include version 17.0.3 of the types package\n */\n react.overrideDependencies({\n devDependencies: {\n // '@types/react': '17.0.3'\n }\n })\n ]);\n envs.registerEnv(${Name}Env);\n return new ${Name}Main();\n }\n}\n\n${Name}Aspect.addRuntime(${Name}Main);\n`;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function globalStylesFile(): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.globalStylesFile = globalStylesFile;
|
|
7
|
+
|
|
8
|
+
function globalStylesFile() {
|
|
9
|
+
return `
|
|
10
|
+
/*
|
|
11
|
+
Add your global styles here to be added for any component using this env
|
|
12
|
+
*/
|
|
13
|
+
`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["styles.ts"],"names":["globalStylesFile"],"mappings":";;;;;;;AAAO,SAASA,gBAAT,GAA4B;AACjC,SAAQ;AACV;AACA;AACA;AACA,GAJE;AAKD","sourcesContent":["export function globalStylesFile() {\n return `\n /*\n Add your global styles here to be added for any component using this env\n */\n `\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tsTransformerFile(): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tsTransformerFile = tsTransformerFile;
|
|
7
|
+
|
|
8
|
+
function tsTransformerFile() {
|
|
9
|
+
return `
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import {
|
|
12
|
+
TsConfigTransformer,
|
|
13
|
+
TypescriptConfigMutator,
|
|
14
|
+
} from "@teambit/typescript";
|
|
15
|
+
|
|
16
|
+
const tsConfig = require('./tsconfig.json');
|
|
17
|
+
|
|
18
|
+
export const commonTransformer: TsConfigTransformer = (
|
|
19
|
+
config: TypescriptConfigMutator
|
|
20
|
+
) => {
|
|
21
|
+
const newConfig = config.addTypes([path.join(__dirname, 'styles.d.ts')])
|
|
22
|
+
newConfig.mergeTsConfig(tsConfig);
|
|
23
|
+
// Some examples of other built in mutator functions:
|
|
24
|
+
//newConfig.addExclude(['someExclude']);
|
|
25
|
+
//newConfig.setCompileJs(true)
|
|
26
|
+
return newConfig;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Transformation for the dev config only
|
|
31
|
+
* @param config
|
|
32
|
+
* @param context
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
export const devConfigTransformer: TsConfigTransformer = (
|
|
36
|
+
config: TypescriptConfigMutator,
|
|
37
|
+
) => {
|
|
38
|
+
const newConfig = commonTransformer(config, {});
|
|
39
|
+
return newConfig;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Transformation for the build only
|
|
44
|
+
* @param config
|
|
45
|
+
* @param context
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
export const buildConfigTransformer: TsConfigTransformer = (
|
|
49
|
+
config: TypescriptConfigMutator
|
|
50
|
+
) => {
|
|
51
|
+
const newConfig = commonTransformer(config, {});
|
|
52
|
+
newConfig.mergeTsConfig(tsConfig);
|
|
53
|
+
return newConfig;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=ts-transformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ts-transformer.ts"],"names":["tsTransformerFile"],"mappings":";;;;;;;AAAO,SAASA,iBAAT,GAA6B;AAClC,SAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CA/CE;AAgDD","sourcesContent":["export function tsTransformerFile() {\n return `\n import * as path from 'path';\nimport {\n TsConfigTransformer,\n TypescriptConfigMutator,\n} from \"@teambit/typescript\";\n\nconst tsConfig = require('./tsconfig.json');\n\nexport const commonTransformer: TsConfigTransformer = (\n config: TypescriptConfigMutator\n) => {\n const newConfig = config.addTypes([path.join(__dirname, 'styles.d.ts')])\n newConfig.mergeTsConfig(tsConfig);\n // Some examples of other built in mutator functions:\n //newConfig.addExclude(['someExclude']);\n //newConfig.setCompileJs(true)\n return newConfig;\n};\n\n/**\n * Transformation for the dev config only\n * @param config\n * @param context\n * @returns\n */\nexport const devConfigTransformer: TsConfigTransformer = (\n config: TypescriptConfigMutator,\n) => {\n const newConfig = commonTransformer(config, {});\n return newConfig;\n};\n\n/**\n * Transformation for the build only\n * @param config\n * @param context\n * @returns\n */\nexport const buildConfigTransformer: TsConfigTransformer = (\n config: TypescriptConfigMutator\n) => {\n const newConfig = commonTransformer(config, {});\n newConfig.mergeTsConfig(tsConfig);\n return newConfig;\n};\n\n`\n}\n"]}
|
package/dist/templates/react-env/files/{typescript.config.d.ts → typescript/typescript.config.d.ts}
RENAMED
|
File without changes
|
package/dist/templates/react-env/files/{typescript.config.js → typescript/typescript.config.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -66,7 +66,7 @@ function _webpack() {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
function _typescript() {
|
|
69
|
-
const data = require("./files/typescript.config");
|
|
69
|
+
const data = require("./files/typescript/typescript.config");
|
|
70
70
|
|
|
71
71
|
_typescript = function () {
|
|
72
72
|
return data;
|
|
@@ -75,6 +75,26 @@ function _typescript() {
|
|
|
75
75
|
return data;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
function _styles() {
|
|
79
|
+
const data = require("./files/typescript/styles");
|
|
80
|
+
|
|
81
|
+
_styles = function () {
|
|
82
|
+
return data;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return data;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function _tsTransformer() {
|
|
89
|
+
const data = require("./files/typescript/ts-transformer");
|
|
90
|
+
|
|
91
|
+
_tsTransformer = function () {
|
|
92
|
+
return data;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return data;
|
|
96
|
+
}
|
|
97
|
+
|
|
78
98
|
function _jest() {
|
|
79
99
|
const data = require("./files/jest.config");
|
|
80
100
|
|
|
@@ -111,13 +131,19 @@ const reactEnvTemplate = {
|
|
|
111
131
|
}, {
|
|
112
132
|
relativePath: `typescript/tsconfig.json`,
|
|
113
133
|
content: (0, _typescript().typescriptConfigFile)()
|
|
134
|
+
}, {
|
|
135
|
+
relativePath: `typescript/styles.d.ts`,
|
|
136
|
+
content: (0, _styles().globalStylesFile)()
|
|
137
|
+
}, {
|
|
138
|
+
relativePath: `typescript/ts-transformer.ts`,
|
|
139
|
+
content: (0, _tsTransformer().tsTransformerFile)()
|
|
114
140
|
}, {
|
|
115
141
|
relativePath: `jest/jest.config.js`,
|
|
116
142
|
content: (0, _jest().jestConfigFile)()
|
|
117
143
|
}];
|
|
118
144
|
},
|
|
119
145
|
config: {
|
|
120
|
-
'teambit.
|
|
146
|
+
'teambit.envs/env': {},
|
|
121
147
|
'teambit.envs/envs': {
|
|
122
148
|
env: 'teambit.envs/env'
|
|
123
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["reactEnvTemplate","name","description","generateFiles","context","relativePath","content","isMain","config","env"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,gBAAmC,GAAG;AACjDC,EAAAA,IAAI,EAAE,WAD2C;AAEjDC,EAAAA,WAAW,EAAE,0DAFoC;AAGjDC,EAAAA,aAAa,EAAGC,OAAD,IAA+B;AAC5C,WAAO,CACL;AACEC,MAAAA,YAAY,EAAE,UADhB;AAEEC,MAAAA,OAAO,EAAE,wBAAUF,OAAV,CAFX;AAGEG,MAAAA,MAAM,EAAE;AAHV,KADK,EAML;AACEF,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,WADhC;AAEEK,MAAAA,OAAO,EAAE,oBAAQF,OAAR;AAFX,KANK,EAUL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,kBADhC;AAEEK,MAAAA,OAAO,EAAE,6BAAgBF,OAAhB;AAFX,KAVK,EAcL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,qBADhC;AAEEK,MAAAA,OAAO,EAAE,mCAAmBF,OAAnB;AAFX,KAdK,EAkBL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,YADhC;AAEEK,MAAAA,OAAO,EAAE,0BAAWF,OAAX;AAFX,KAlBK,EAsBL;AACEC,MAAAA,YAAY,EAAG,iCADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KAtBK,EA0BL;AACED,MAAAA,YAAY,EAAG,0BADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KA1BK,EA8BL;AACED,MAAAA,YAAY,EAAG,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["reactEnvTemplate","name","description","generateFiles","context","relativePath","content","isMain","config","env"],"mappings":";;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,gBAAmC,GAAG;AACjDC,EAAAA,IAAI,EAAE,WAD2C;AAEjDC,EAAAA,WAAW,EAAE,0DAFoC;AAGjDC,EAAAA,aAAa,EAAGC,OAAD,IAA+B;AAC5C,WAAO,CACL;AACEC,MAAAA,YAAY,EAAE,UADhB;AAEEC,MAAAA,OAAO,EAAE,wBAAUF,OAAV,CAFX;AAGEG,MAAAA,MAAM,EAAE;AAHV,KADK,EAML;AACEF,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,WADhC;AAEEK,MAAAA,OAAO,EAAE,oBAAQF,OAAR;AAFX,KANK,EAUL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,kBADhC;AAEEK,MAAAA,OAAO,EAAE,6BAAgBF,OAAhB;AAFX,KAVK,EAcL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,qBADhC;AAEEK,MAAAA,OAAO,EAAE,mCAAmBF,OAAnB;AAFX,KAdK,EAkBL;AACEC,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,YADhC;AAEEK,MAAAA,OAAO,EAAE,0BAAWF,OAAX;AAFX,KAlBK,EAsBL;AACEC,MAAAA,YAAY,EAAG,iCADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KAtBK,EA0BL;AACED,MAAAA,YAAY,EAAG,0BADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KA1BK,EA8BL;AACED,MAAAA,YAAY,EAAG,wBADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KA9BK,EAkCL;AACED,MAAAA,YAAY,EAAG,8BADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KAlCK,EAsCL;AACED,MAAAA,YAAY,EAAG,qBADjB;AAEEC,MAAAA,OAAO,EAAE;AAFX,KAtCK,CAAP;AA2CD,GA/CgD;AAgDjDE,EAAAA,MAAM,EAAE;AACN,wBAAoB,EADd;AAEN,yBAAqB;AACnBC,MAAAA,GAAG,EAAE;AADc;AAFf;AAhDyC,CAA5C","sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { docFile } from './files/doc';\nimport { mainRuntimeFile } from './files/main.runtime';\nimport { previewRuntimeFile } from './files/preview.runtime';\nimport { aspectFile } from './files/aspect';\nimport { webpackConfigFile } from './files/webpack.config';\nimport { typescriptConfigFile } from './files/typescript/typescript.config';\nimport { globalStylesFile } from './files/typescript/styles';\nimport { tsTransformerFile } from './files/typescript/ts-transformer';\nimport { jestConfigFile } from './files/jest.config';\n\nexport const reactEnvTemplate: ComponentTemplate = {\n name: 'react-env',\n description: 'customize the base React env with your configs and tools',\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docFile(context),\n },\n {\n relativePath: `${context.name}.main.runtime.ts`,\n content: mainRuntimeFile(context),\n },\n {\n relativePath: `${context.name}.preview.runtime.ts`,\n content: previewRuntimeFile(context),\n },\n {\n relativePath: `${context.name}.aspect.ts`,\n content: aspectFile(context),\n },\n {\n relativePath: `webpack/webpack-transformers.ts`,\n content: webpackConfigFile(),\n },\n {\n relativePath: `typescript/tsconfig.json`,\n content: typescriptConfigFile(),\n },\n {\n relativePath: `typescript/styles.d.ts`,\n content: globalStylesFile(),\n },\n {\n relativePath: `typescript/ts-transformer.ts`,\n content: tsTransformerFile(),\n },\n {\n relativePath: `jest/jest.config.js`,\n content: jestConfigFile(),\n },\n ];\n },\n config: {\n 'teambit.envs/env': {},\n 'teambit.envs/envs': {\n env: 'teambit.envs/env',\n },\n },\n};\n"]}
|
|
File without changes
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.710",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/react/react",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.react",
|
|
8
8
|
"name": "react",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.710"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"react-error-boundary": "^3.0.0",
|
|
@@ -77,43 +77,43 @@
|
|
|
77
77
|
"@svgr/webpack": "5.5.0",
|
|
78
78
|
"core-js": "^3.0.0",
|
|
79
79
|
"@teambit/base-ui.utils.composer": "1.0.0",
|
|
80
|
+
"@teambit/design.ui.input.option-button": "1.0.0",
|
|
80
81
|
"@teambit/harmony": "0.3.3",
|
|
81
82
|
"@teambit/react.instructions.react.adding-compositions": "0.0.6",
|
|
82
83
|
"@teambit/react.instructions.react.adding-tests": "0.0.6",
|
|
83
84
|
"@teambit/design.ui.pages.standalone-not-found-page": "0.0.356",
|
|
84
|
-
"@teambit/preview": "0.0.
|
|
85
|
+
"@teambit/preview": "0.0.710",
|
|
85
86
|
"@teambit/react.ui.error-fallback": "0.0.111",
|
|
86
87
|
"@teambit/react.ui.loader-fallback": "0.0.89",
|
|
87
88
|
"@teambit/compositions.ui.hooks.use-composition": "0.0.163",
|
|
88
|
-
"@teambit/design.ui.input.option-button": "0.0.26",
|
|
89
89
|
"@teambit/design.ui.tooltip": "0.0.352",
|
|
90
|
-
"@teambit/builder": "0.0.
|
|
91
|
-
"@teambit/bundler": "0.0.
|
|
92
|
-
"@teambit/compiler": "0.0.
|
|
90
|
+
"@teambit/builder": "0.0.710",
|
|
91
|
+
"@teambit/bundler": "0.0.710",
|
|
92
|
+
"@teambit/compiler": "0.0.710",
|
|
93
93
|
"@teambit/component.modules.component-url": "0.0.124",
|
|
94
|
-
"@teambit/component": "0.0.
|
|
95
|
-
"@teambit/envs": "0.0.
|
|
96
|
-
"@teambit/eslint": "0.0.
|
|
97
|
-
"@teambit/formatter": "0.0.
|
|
98
|
-
"@teambit/jest": "0.0.
|
|
99
|
-
"@teambit/linter": "0.0.
|
|
100
|
-
"@teambit/pkg": "0.0.
|
|
101
|
-
"@teambit/prettier": "0.0.
|
|
94
|
+
"@teambit/component": "0.0.710",
|
|
95
|
+
"@teambit/envs": "0.0.710",
|
|
96
|
+
"@teambit/eslint": "0.0.710",
|
|
97
|
+
"@teambit/formatter": "0.0.261",
|
|
98
|
+
"@teambit/jest": "0.0.710",
|
|
99
|
+
"@teambit/linter": "0.0.710",
|
|
100
|
+
"@teambit/pkg": "0.0.710",
|
|
101
|
+
"@teambit/prettier": "0.0.261",
|
|
102
102
|
"@teambit/react.ui.highlighter.component-metadata.bit-component-meta": "0.0.21",
|
|
103
|
-
"@teambit/schema": "0.0.
|
|
104
|
-
"@teambit/tester": "0.0.
|
|
105
|
-
"@teambit/typescript": "0.0.
|
|
106
|
-
"@teambit/webpack": "0.0.
|
|
107
|
-
"@teambit/workspace": "0.0.
|
|
108
|
-
"@teambit/application": "0.0.
|
|
109
|
-
"@teambit/cli": "0.0.
|
|
110
|
-
"@teambit/dependency-resolver": "0.0.
|
|
111
|
-
"@teambit/generator": "0.0.
|
|
112
|
-
"@teambit/graphql": "0.0.
|
|
103
|
+
"@teambit/schema": "0.0.710",
|
|
104
|
+
"@teambit/tester": "0.0.710",
|
|
105
|
+
"@teambit/typescript": "0.0.710",
|
|
106
|
+
"@teambit/webpack": "0.0.710",
|
|
107
|
+
"@teambit/workspace": "0.0.710",
|
|
108
|
+
"@teambit/application": "0.0.352",
|
|
109
|
+
"@teambit/cli": "0.0.472",
|
|
110
|
+
"@teambit/dependency-resolver": "0.0.710",
|
|
111
|
+
"@teambit/generator": "0.0.710",
|
|
112
|
+
"@teambit/graphql": "0.0.710",
|
|
113
113
|
"@teambit/react.ui.highlighter-provider": "0.0.189",
|
|
114
|
-
"@teambit/compositions": "0.0.
|
|
115
|
-
"@teambit/ui": "0.0.
|
|
116
|
-
"@teambit/react.eslint-config-bit-react": "0.0.
|
|
114
|
+
"@teambit/compositions": "0.0.710",
|
|
115
|
+
"@teambit/ui": "0.0.710",
|
|
116
|
+
"@teambit/react.eslint-config-bit-react": "0.0.547",
|
|
117
117
|
"@teambit/webpack.modules.generate-expose-loaders": "0.0.3",
|
|
118
118
|
"@teambit/webpack.modules.generate-externals": "0.0.3",
|
|
119
119
|
"@teambit/webpack.modules.config-mutator": "0.0.137",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"@teambit/webpack.modules.style-regexps": "0.0.132",
|
|
124
124
|
"@teambit/component-id": "0.0.402",
|
|
125
125
|
"@teambit/toolbox.network.get-port": "0.0.113",
|
|
126
|
-
"@teambit/config": "0.0.
|
|
126
|
+
"@teambit/config": "0.0.485"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
129
|
"@types/react": "^17.0.8",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"@teambit/react.content.react-overview": "1.95.0"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
145
|
-
"@teambit/legacy": "1.0.
|
|
145
|
+
"@teambit/legacy": "1.0.251",
|
|
146
146
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
147
147
|
"react": "^16.8.0 || ^17.0.0"
|
|
148
148
|
},
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
"@types/jest": "^26.0.0"
|
|
207
207
|
},
|
|
208
208
|
"peerDependencies": {
|
|
209
|
-
"@teambit/legacy": "1.0.
|
|
209
|
+
"@teambit/legacy": "1.0.251",
|
|
210
210
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
211
211
|
"react": "^16.8.0 || ^17.0.0"
|
|
212
212
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.710/dist/react.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.710/dist/react.docs.mdx')]
|
|
@@ -8,10 +8,23 @@ labels: ['react', 'typescript', 'env', 'extension']
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
A customized version which extends the default React component development environment created by teambit.
|
|
11
|
+
A customized version which extends the default React component development environment created by teambit.
|
|
12
|
+
|
|
13
|
+
This environment can be applied to all your components or a set of components via the command \`bit env set <pattern or component_id> ${componentId}\`, or under the variants of your \`workspace.json\` file.
|
|
14
|
+
That means they will use your custom environment instead of the default environment. Environment components are just like any other Bit components in that they can be
|
|
15
|
+
exported and then shared and used in various projects which makes it easier to create standards when working with many teams.
|
|
12
16
|
|
|
13
17
|
### Usage instructions
|
|
14
18
|
|
|
19
|
+
#### Recommended usage:
|
|
20
|
+
|
|
21
|
+
Run the command \`bit env set <"pattern" or component_id> ${componentId}\` where the pattern is a glob pattern to select multiple components. This will put the env
|
|
22
|
+
config in your component's entry in the \`.bitmap\` file.
|
|
23
|
+
|
|
24
|
+
:::Note - this will override any variants policy that tries to set an env for this component in the workspace.jsonc
|
|
25
|
+
:::
|
|
26
|
+
|
|
27
|
+
#### Alternative Usage
|
|
15
28
|
Under the **variant** section of your \`workspace.json\` file choose which components you want to have the custom environment set. You can find the id of the extension in the \`${name}.aspect.ts\` file.
|
|
16
29
|
|
|
17
30
|
\`\`\`json
|
|
@@ -24,6 +37,7 @@ Under the **variant** section of your \`workspace.json\` file choose which compo
|
|
|
24
37
|
}
|
|
25
38
|
\`\`\`
|
|
26
39
|
|
|
40
|
+
This usage may be deprecated in future in favour of the recommended usage above
|
|
27
41
|
## Runtime Configurations
|
|
28
42
|
|
|
29
43
|
Extend the \`main.runtime\` file when you want to add custom configurations at runtime.
|
|
@@ -5,12 +5,14 @@ export function mainRuntimeFile({ namePascalCase: Name, name }: ComponentContext
|
|
|
5
5
|
import { ReactAspect, ReactMain } from '@teambit/react';
|
|
6
6
|
import { EnvsAspect, EnvsMain } from '@teambit/envs';
|
|
7
7
|
import { ${Name}Aspect } from './${name}.aspect';
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
//
|
|
8
|
+
//import {
|
|
9
|
+
// previewConfigTransformer,
|
|
10
|
+
// devServerConfigTransformer
|
|
11
|
+
//} from './webpack/webpack-transformers';
|
|
12
|
+
//import {
|
|
13
|
+
// devConfigTransformer,
|
|
14
|
+
// buildConfigTransformer,
|
|
15
|
+
//} from "./typescript/ts-transformers";
|
|
14
16
|
|
|
15
17
|
export class ${Name}Main {
|
|
16
18
|
static slots = [];
|
|
@@ -19,18 +21,25 @@ export class ${Name}Main {
|
|
|
19
21
|
|
|
20
22
|
static runtime = MainRuntime;
|
|
21
23
|
|
|
24
|
+
//const webpackModifiers: UseWebpackModifiers = {
|
|
25
|
+
// previewConfig: [previewConfigTransformer],
|
|
26
|
+
// devServerConfig: [devServerConfigTransformer],
|
|
27
|
+
//};
|
|
28
|
+
|
|
29
|
+
//const tsModifiers: UseTypescriptModifiers = {
|
|
30
|
+
// devConfig: [devConfigTransformer],
|
|
31
|
+
// buildConfig: [buildConfigTransformer],
|
|
32
|
+
//};
|
|
33
|
+
|
|
22
34
|
static async provider([react, envs]: [ReactMain, EnvsMain]) {
|
|
23
|
-
const
|
|
35
|
+
const ${Name}Env = react.compose([
|
|
24
36
|
/**
|
|
25
37
|
* Uncomment to override the config files for TypeScript, Webpack or Jest
|
|
26
38
|
* Your config gets merged with the defaults
|
|
27
39
|
*/
|
|
28
40
|
|
|
29
|
-
// react.
|
|
30
|
-
// react.useWebpack(
|
|
31
|
-
// previewConfig: [previewConfigTransformer],
|
|
32
|
-
// devServerConfig: [devServerConfigTransformer],
|
|
33
|
-
// }),
|
|
41
|
+
// react.useTypescript(tsModifiers), // note: this cannot be used in conjunction with react.overrideCompiler
|
|
42
|
+
// react.useWebpack(webpackModifiers),
|
|
34
43
|
// react.overrideJestConfig(require.resolve('./jest/jest.config')),
|
|
35
44
|
|
|
36
45
|
/**
|
|
@@ -39,14 +48,14 @@ export class ${Name}Main {
|
|
|
39
48
|
* bit lint
|
|
40
49
|
* bit lint --fix
|
|
41
50
|
*/
|
|
42
|
-
react.useEslint({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
51
|
+
//react.useEslint({
|
|
52
|
+
// transformers: [
|
|
53
|
+
// (config) => {
|
|
54
|
+
// config.setRule('no-console', ['error']);
|
|
55
|
+
// return config;
|
|
56
|
+
// }
|
|
57
|
+
// ]
|
|
58
|
+
//}),
|
|
50
59
|
|
|
51
60
|
/**
|
|
52
61
|
* override the Prettier default config here the check your formatting
|
|
@@ -54,14 +63,14 @@ export class ${Name}Main {
|
|
|
54
63
|
* bit format --check
|
|
55
64
|
* bit format
|
|
56
65
|
*/
|
|
57
|
-
react.usePrettier({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}),
|
|
66
|
+
//react.usePrettier({
|
|
67
|
+
// transformers: [
|
|
68
|
+
// (config) => {
|
|
69
|
+
// config.setKey('tabWidth', 2);
|
|
70
|
+
// return config;
|
|
71
|
+
// }
|
|
72
|
+
// ]
|
|
73
|
+
//}),
|
|
65
74
|
|
|
66
75
|
/**
|
|
67
76
|
* override dependencies here
|
|
@@ -74,7 +83,7 @@ export class ${Name}Main {
|
|
|
74
83
|
}
|
|
75
84
|
})
|
|
76
85
|
]);
|
|
77
|
-
envs.registerEnv(
|
|
86
|
+
envs.registerEnv(${Name}Env);
|
|
78
87
|
return new ${Name}Main();
|
|
79
88
|
}
|
|
80
89
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export function tsTransformerFile() {
|
|
2
|
+
return `
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import {
|
|
5
|
+
TsConfigTransformer,
|
|
6
|
+
TypescriptConfigMutator,
|
|
7
|
+
} from "@teambit/typescript";
|
|
8
|
+
|
|
9
|
+
const tsConfig = require('./tsconfig.json');
|
|
10
|
+
|
|
11
|
+
export const commonTransformer: TsConfigTransformer = (
|
|
12
|
+
config: TypescriptConfigMutator
|
|
13
|
+
) => {
|
|
14
|
+
const newConfig = config.addTypes([path.join(__dirname, 'styles.d.ts')])
|
|
15
|
+
newConfig.mergeTsConfig(tsConfig);
|
|
16
|
+
// Some examples of other built in mutator functions:
|
|
17
|
+
//newConfig.addExclude(['someExclude']);
|
|
18
|
+
//newConfig.setCompileJs(true)
|
|
19
|
+
return newConfig;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Transformation for the dev config only
|
|
24
|
+
* @param config
|
|
25
|
+
* @param context
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export const devConfigTransformer: TsConfigTransformer = (
|
|
29
|
+
config: TypescriptConfigMutator,
|
|
30
|
+
) => {
|
|
31
|
+
const newConfig = commonTransformer(config, {});
|
|
32
|
+
return newConfig;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Transformation for the build only
|
|
37
|
+
* @param config
|
|
38
|
+
* @param context
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
export const buildConfigTransformer: TsConfigTransformer = (
|
|
42
|
+
config: TypescriptConfigMutator
|
|
43
|
+
) => {
|
|
44
|
+
const newConfig = commonTransformer(config, {});
|
|
45
|
+
newConfig.mergeTsConfig(tsConfig);
|
|
46
|
+
return newConfig;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
`
|
|
50
|
+
}
|
|
File without changes
|