@teambit/react 0.0.551 → 0.0.556
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mount.d.ts +5 -0
- package/dist/react-app-options.d.ts +25 -0
- package/dist/react.env.d.ts +87 -1
- package/dist/react.main.runtime.d.ts +89 -1
- package/package.json +49 -43
- package/compositions-app.tsx +0 -31
- package/eslint/eslintrc.js +0 -12
- package/highlighter-widget.tsx +0 -19
- package/index.ts +0 -9
- package/jest/css-transform.js +0 -12
- package/jest/file-transform.js +0 -38
- package/jest/jest.config.js +0 -30
- package/jest/setupTests.js +0 -7
- package/jest/transformer.js +0 -41
- package/mount.tsx +0 -17
- package/package-tar/teambit-react-0.0.551.tgz +0 -0
- package/prettier/prettier.config.js +0 -5
- package/react-app-options.ts +0 -45
- package/react.app-type.ts +0 -19
- package/react.application.ts +0 -96
- package/react.aspect.ts +0 -5
- package/react.composition.tsx +0 -7
- package/react.docs.mdx +0 -8
- package/react.env.ts +0 -363
- package/react.graphql.ts +0 -52
- package/react.main.runtime.ts +0 -437
- package/react.preview.runtime.ts +0 -44
- package/react.templates.ts +0 -29
- package/react.ui.runtime.tsx +0 -35
- package/templates/react-app/files/app-root.ts +0 -10
- package/templates/react-app/files/app.ts +0 -30
- package/templates/react-app/files/aspect.ts +0 -10
- package/templates/react-app/files/compositions.ts +0 -11
- package/templates/react-app/files/doc.ts +0 -29
- package/templates/react-app/files/index.ts +0 -10
- package/templates/react-app/files/main.runtime.ts +0 -22
- package/templates/react-app/index.ts +0 -47
- package/templates/react-component/files/component.ts +0 -25
- package/templates/react-component/files/composition.ts +0 -16
- package/templates/react-component/files/docs.ts +0 -32
- package/templates/react-component/files/test.ts +0 -19
- package/templates/react-component/index.ts +0 -40
- package/templates/react-component-js/files/component.ts +0 -18
- package/templates/react-component-js/files/composition.ts +0 -16
- package/templates/react-component-js/files/docs.ts +0 -32
- package/templates/react-component-js/files/test.ts +0 -21
- package/templates/react-component-js/index.ts +0 -38
- package/templates/react-context/files/composition.ts +0 -27
- package/templates/react-context/files/context-provider.ts +0 -27
- package/templates/react-context/files/context.ts +0 -21
- package/templates/react-context/files/docs.ts +0 -51
- package/templates/react-context/files/test.ts +0 -18
- package/templates/react-context/index.ts +0 -32
- package/templates/react-env/files/aspect.ts +0 -10
- package/templates/react-env/files/doc.ts +0 -163
- package/templates/react-env/files/index.ts +0 -10
- package/templates/react-env/files/jest.config.ts +0 -21
- package/templates/react-env/files/main.runtime.ts +0 -84
- package/templates/react-env/files/preview.runtime.ts +0 -27
- package/templates/react-env/files/typescript.config.ts +0 -21
- package/templates/react-env/files/webpack.config.ts +0 -48
- package/templates/react-env/index.ts +0 -51
- package/templates/react-hook/files/component.ts +0 -16
- package/templates/react-hook/files/composition.ts +0 -23
- package/templates/react-hook/files/docs.ts +0 -33
- package/templates/react-hook/files/test.ts +0 -20
- package/templates/react-hook/index.ts +0 -21
- package/templates/react-workspace/index.ts +0 -27
- package/templates/react-workspace-app/index.ts +0 -20
- package/templates/react-workspace-deprecated/index.ts +0 -28
- package/templates/react-workspace-lib/index.ts +0 -21
- package/templates/workspace-common/files/eslint-config.ts +0 -6
- package/templates/workspace-common/files/git-ignore.ts +0 -113
- package/templates/workspace-common/files/prettier-config.ts +0 -5
- package/templates/workspace-common/files/readme-file.ts +0 -36
- package/templates/workspace-common/files/ts-config.ts +0 -7
- package/templates/workspace-common/files/types/asset.ts +0 -28
- package/templates/workspace-common/files/types/style.ts +0 -43
- package/templates/workspace-common/files/workspace-config.ts +0 -58
- package/templates/workspace-common/generate-files.ts +0 -51
- package/templates/workspace-common/index.ts +0 -1
- package/tsconfig.json +0 -35
- package/types/asset.d.ts +0 -29
- package/types/style.d.ts +0 -42
- package/typescript/asset.d.ts +0 -29
- package/typescript/style.d.ts +0 -42
- package/typescript/tsconfig.build.json +0 -22
- package/typescript/tsconfig.json +0 -18
- package/webpack/format-webpack-messages.js +0 -102
- package/webpack/launch-editor-endpoint.js +0 -8
- package/webpack/postcss.config.ts +0 -21
- package/webpack/react-hot-dev-client.js +0 -274
- package/webpack/refresh.js +0 -16
- package/webpack/webpack.config.base.prod.ts +0 -123
- package/webpack/webpack.config.base.ts +0 -365
- package/webpack/webpack.config.component.dev.ts +0 -104
- package/webpack/webpack.config.component.prod.ts +0 -39
- package/webpack/webpack.config.env.dev.ts +0 -21
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function jestConfigFile() {
|
|
2
|
-
return `
|
|
3
|
-
// Override the Jest config to ignore transpiling from specific folders
|
|
4
|
-
// See the base Jest config: https://bit.dev/teambit/react/react/~code/jest/jest.config.js
|
|
5
|
-
|
|
6
|
-
// const reactJestConfig = require('@teambit/react/jest/jest.config');
|
|
7
|
-
// uncomment the line below and install the package if you want to use this function
|
|
8
|
-
// const {
|
|
9
|
-
// generateNodeModulesPattern,
|
|
10
|
-
// } = require('@teambit/dependencies.modules.packages-excluder');
|
|
11
|
-
// const packagesToExclude = ['prop-types', '@teambit'];
|
|
12
|
-
|
|
13
|
-
// module.exports = {
|
|
14
|
-
// ...reactJestConfig,
|
|
15
|
-
// transformIgnorePatterns: [
|
|
16
|
-
// ...reactJestConfig.transformIgnorePatterns,
|
|
17
|
-
// '/' + generateNodeModulesPattern({ packages: packagesToExclude }),
|
|
18
|
-
// ],
|
|
19
|
-
// };
|
|
20
|
-
`;
|
|
21
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { ComponentContext } from '@teambit/generator';
|
|
2
|
-
|
|
3
|
-
export function mainRuntimeFile({ namePascalCase: Name, name }: ComponentContext) {
|
|
4
|
-
return `import { MainRuntime } from '@teambit/cli';
|
|
5
|
-
import { ReactAspect, ReactMain } from '@teambit/react';
|
|
6
|
-
import { EnvsAspect, EnvsMain } from '@teambit/envs';
|
|
7
|
-
import { ${Name}Aspect } from './${name}.aspect';
|
|
8
|
-
// import { previewConfigTransformer, devServerConfigTransformer } from './webpack/webpack-transformers';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Uncomment to include config files for overrides of Typescript or Webpack
|
|
12
|
-
*/
|
|
13
|
-
// const tsconfig = require('./typescript/tsconfig');
|
|
14
|
-
|
|
15
|
-
export class ${Name}Main {
|
|
16
|
-
static slots = [];
|
|
17
|
-
|
|
18
|
-
static dependencies = [ReactAspect, EnvsAspect];
|
|
19
|
-
|
|
20
|
-
static runtime = MainRuntime;
|
|
21
|
-
|
|
22
|
-
static async provider([react, envs]: [ReactMain, EnvsMain]) {
|
|
23
|
-
const templatesReactEnv = envs.compose(react.reactEnv, [
|
|
24
|
-
/**
|
|
25
|
-
* Uncomment to override the config files for TypeScript, Webpack or Jest
|
|
26
|
-
* Your config gets merged with the defaults
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
// react.overrideTsConfig(tsconfig),
|
|
30
|
-
// react.useWebpack({
|
|
31
|
-
// previewConfig: [previewConfigTransformer],
|
|
32
|
-
// devServerConfig: [devServerConfigTransformer],
|
|
33
|
-
// }),
|
|
34
|
-
// react.overrideJestConfig(require.resolve('./jest/jest.config')),
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* override the ESLint default config here then check your files for lint errors
|
|
38
|
-
* @example
|
|
39
|
-
* bit lint
|
|
40
|
-
* bit lint --fix
|
|
41
|
-
*/
|
|
42
|
-
react.useEslint({
|
|
43
|
-
transformers: [
|
|
44
|
-
(config) => {
|
|
45
|
-
config.setRule('no-console', ['error']);
|
|
46
|
-
return config;
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* override the Prettier default config here the check your formatting
|
|
53
|
-
* @example
|
|
54
|
-
* bit format --check
|
|
55
|
-
* bit format
|
|
56
|
-
*/
|
|
57
|
-
react.usePrettier({
|
|
58
|
-
transformers: [
|
|
59
|
-
(config) => {
|
|
60
|
-
config.setKey('tabWidth', 2);
|
|
61
|
-
return config;
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}),
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* override dependencies here
|
|
68
|
-
* @example
|
|
69
|
-
* Uncomment types to include version 17.0.3 of the types package
|
|
70
|
-
*/
|
|
71
|
-
react.overrideDependencies({
|
|
72
|
-
devDependencies: {
|
|
73
|
-
// '@types/react': '17.0.3'
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
]);
|
|
77
|
-
envs.registerEnv(templatesReactEnv);
|
|
78
|
-
return new ${Name}Main();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
${Name}Aspect.addRuntime(${Name}Main);
|
|
83
|
-
`;
|
|
84
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ComponentContext } from '@teambit/generator';
|
|
2
|
-
|
|
3
|
-
export function previewRuntimeFile({ namePascalCase: Name, nameCamelCase: nameCamel, name }: ComponentContext) {
|
|
4
|
-
return `import { PreviewRuntime } from '@teambit/preview';
|
|
5
|
-
import { ReactAspect, ReactPreview } from '@teambit/react';
|
|
6
|
-
// uncomment the line below and install the theme if you want to use our theme or create your own and import it here
|
|
7
|
-
// import { ThemeCompositions } from '@teambit/documenter.theme.theme-compositions';
|
|
8
|
-
|
|
9
|
-
import { ${Name}Aspect } from './${name}.aspect';
|
|
10
|
-
|
|
11
|
-
export class ${Name}PreviewMain {
|
|
12
|
-
static runtime = PreviewRuntime;
|
|
13
|
-
|
|
14
|
-
static dependencies = [ReactAspect];
|
|
15
|
-
|
|
16
|
-
static async provider([react]: [ReactPreview]) {
|
|
17
|
-
const ${nameCamel}PreviewMain = new ${Name}PreviewMain();
|
|
18
|
-
// uncomment the line below to register a new provider to wrap all compositions using this environment with a custom theme.
|
|
19
|
-
// react.registerProvider([ThemeCompositions]);
|
|
20
|
-
|
|
21
|
-
return ${nameCamel}PreviewMain;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
${Name}Aspect.addRuntime(${Name}PreviewMain);
|
|
26
|
-
`;
|
|
27
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function typescriptConfigFile() {
|
|
2
|
-
return `{
|
|
3
|
-
// add your compiler options here
|
|
4
|
-
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
// "target": "es2017",
|
|
7
|
-
// "module": "es2015",
|
|
8
|
-
// "moduleResolution": "node",
|
|
9
|
-
// "lib": ["es2017", "dom"],
|
|
10
|
-
// "experimentalDecorators": true,
|
|
11
|
-
// "esModuleInterop": true,
|
|
12
|
-
// "outDir": "dist",
|
|
13
|
-
// "sourceMap": true,
|
|
14
|
-
// "emitDecoratorMetadata": true,
|
|
15
|
-
// "allowJs": true,
|
|
16
|
-
// "baseUrl": ".",
|
|
17
|
-
// "jsx": "react"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export function webpackConfigFile() {
|
|
2
|
-
return `
|
|
3
|
-
import { WebpackConfigTransformer, WebpackConfigMutator, WebpackConfigTransformContext } from '@teambit/webpack';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Transformation to apply for both preview and dev server
|
|
7
|
-
* @param config
|
|
8
|
-
* @param _context
|
|
9
|
-
*/
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
-
function commonTransformation(config: WebpackConfigMutator, _context: WebpackConfigTransformContext) {
|
|
12
|
-
// Merge config with the webpack.config.js file if you choose to import a module export format config.
|
|
13
|
-
// config.merge([webpackConfig]);
|
|
14
|
-
// config.addAliases({});
|
|
15
|
-
// config.addModuleRule(youRuleHere);
|
|
16
|
-
return config;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Transformation for the preview only
|
|
21
|
-
* @param config
|
|
22
|
-
* @param context
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
export const previewConfigTransformer: WebpackConfigTransformer = (
|
|
26
|
-
config: WebpackConfigMutator,
|
|
27
|
-
context: WebpackConfigTransformContext
|
|
28
|
-
) => {
|
|
29
|
-
const newConfig = commonTransformation(config, context);
|
|
30
|
-
return newConfig;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Transformation for the dev server only
|
|
35
|
-
* @param config
|
|
36
|
-
* @param context
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
export const devServerConfigTransformer: WebpackConfigTransformer = (
|
|
40
|
-
config: WebpackConfigMutator,
|
|
41
|
-
context: WebpackConfigTransformContext
|
|
42
|
-
) => {
|
|
43
|
-
const newConfig = commonTransformation(config, context);
|
|
44
|
-
return newConfig;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ComponentContext, ComponentTemplate } from '@teambit/generator';
|
|
2
|
-
import { indexFile } from './files/index';
|
|
3
|
-
import { docFile } from './files/doc';
|
|
4
|
-
import { mainRuntimeFile } from './files/main.runtime';
|
|
5
|
-
import { previewRuntimeFile } from './files/preview.runtime';
|
|
6
|
-
import { aspectFile } from './files/aspect';
|
|
7
|
-
import { webpackConfigFile } from './files/webpack.config';
|
|
8
|
-
import { typescriptConfigFile } from './files/typescript.config';
|
|
9
|
-
import { jestConfigFile } from './files/jest.config';
|
|
10
|
-
|
|
11
|
-
export const reactEnvTemplate: ComponentTemplate = {
|
|
12
|
-
name: 'react-env',
|
|
13
|
-
description: 'customize the base React env with your configs and tools',
|
|
14
|
-
generateFiles: (context: ComponentContext) => {
|
|
15
|
-
return [
|
|
16
|
-
{
|
|
17
|
-
relativePath: 'index.ts',
|
|
18
|
-
content: indexFile(context),
|
|
19
|
-
isMain: true,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
relativePath: `${context.name}.docs.mdx`,
|
|
23
|
-
content: docFile(context),
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
relativePath: `${context.name}.main.runtime.ts`,
|
|
27
|
-
content: mainRuntimeFile(context),
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
relativePath: `${context.name}.preview.runtime.ts`,
|
|
31
|
-
content: previewRuntimeFile(context),
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
relativePath: `${context.name}.aspect.ts`,
|
|
35
|
-
content: aspectFile(context),
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
relativePath: `webpack/webpack-transformers.ts`,
|
|
39
|
-
content: webpackConfigFile(),
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
relativePath: `typescript/tsconfig.json`,
|
|
43
|
-
content: typescriptConfigFile(),
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
relativePath: `jest/jest.config.js`,
|
|
47
|
-
content: jestConfigFile(),
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
},
|
|
51
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ComponentContext } from '@teambit/generator';
|
|
2
|
-
|
|
3
|
-
export const componentFile = (context: ComponentContext) => {
|
|
4
|
-
const { name, nameCamelCase: Name } = context;
|
|
5
|
-
return {
|
|
6
|
-
relativePath: `${name}.tsx`,
|
|
7
|
-
content: `import { useState } from 'react';
|
|
8
|
-
|
|
9
|
-
export function ${Name}() {
|
|
10
|
-
const [count, setCount] = useState(0)
|
|
11
|
-
const increment = () => setCount((c) => c + 1)
|
|
12
|
-
return { count, increment }
|
|
13
|
-
}
|
|
14
|
-
`,
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentContext } from '@teambit/generator';
|
|
2
|
-
|
|
3
|
-
export const compositionFile = (context: ComponentContext) => {
|
|
4
|
-
const { name, nameCamelCase: Name } = context;
|
|
5
|
-
|
|
6
|
-
return {
|
|
7
|
-
relativePath: `${name}.composition.tsx`,
|
|
8
|
-
content: `import React from 'react';
|
|
9
|
-
import { ${Name} } from './${name}';
|
|
10
|
-
|
|
11
|
-
export const Basic${Name} = () => {
|
|
12
|
-
const { count, increment } = ${Name}();
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<>
|
|
16
|
-
<h1>The count is {count}</h1>
|
|
17
|
-
<button onClick={increment}>increment</button>
|
|
18
|
-
</>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
`,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ComponentContext } from '@teambit/generator';
|
|
2
|
-
|
|
3
|
-
export const docsFile = (context: ComponentContext) => {
|
|
4
|
-
const { name, nameCamelCase: Name } = context;
|
|
5
|
-
|
|
6
|
-
return {
|
|
7
|
-
relativePath: `${name}.docs.mdx`,
|
|
8
|
-
content: `---
|
|
9
|
-
description: 'A React Hook that increments a count by 1 each time it is called.'
|
|
10
|
-
labels: ['hook', 'counter']
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
import { ${Name} } from './${name}';
|
|
14
|
-
|
|
15
|
-
## A React Hook to increment a count
|
|
16
|
-
|
|
17
|
-
Increments the state of \`count\` by 1 each time \`increment\` is called
|
|
18
|
-
|
|
19
|
-
### Component usage
|
|
20
|
-
|
|
21
|
-
In this example clicking the button calls \`increment\` which increments the \`count\` by 1
|
|
22
|
-
|
|
23
|
-
\`\`\`js
|
|
24
|
-
import { ${Name} } from './${name}';
|
|
25
|
-
|
|
26
|
-
const { count, increment } = ${Name}();
|
|
27
|
-
|
|
28
|
-
<h1>The count is {count}</h1>
|
|
29
|
-
<button onClick={increment}>increment</button>
|
|
30
|
-
\`\`\`
|
|
31
|
-
`,
|
|
32
|
-
};
|
|
33
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ComponentContext } from '@teambit/generator';
|
|
2
|
-
|
|
3
|
-
export const testFile = (context: ComponentContext) => {
|
|
4
|
-
const { name, nameCamelCase: Name } = context;
|
|
5
|
-
|
|
6
|
-
return {
|
|
7
|
-
relativePath: `${name}.spec.tsx`,
|
|
8
|
-
content: `import { renderHook, act } from '@testing-library/react-hooks';
|
|
9
|
-
import { ${Name} } from './${name}';
|
|
10
|
-
|
|
11
|
-
it('should increment counter', () => {
|
|
12
|
-
const { result } = renderHook(() => ${Name}())
|
|
13
|
-
act(() => {
|
|
14
|
-
result.current.increment()
|
|
15
|
-
})
|
|
16
|
-
expect(result.current.count).toBe(1)
|
|
17
|
-
})
|
|
18
|
-
`,
|
|
19
|
-
};
|
|
20
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentTemplate, ComponentContext } from '@teambit/generator';
|
|
2
|
-
import { componentFile } from './files/component';
|
|
3
|
-
import { compositionFile } from './files/composition';
|
|
4
|
-
import { docsFile } from './files/docs';
|
|
5
|
-
import { testFile } from './files/test';
|
|
6
|
-
|
|
7
|
-
export const reactHook: ComponentTemplate = {
|
|
8
|
-
name: 'react-hook',
|
|
9
|
-
description: 'a react hook component',
|
|
10
|
-
|
|
11
|
-
generateFiles: (context: ComponentContext) => {
|
|
12
|
-
const { name, nameCamelCase: Name } = context;
|
|
13
|
-
const indexFile = {
|
|
14
|
-
relativePath: 'index.ts',
|
|
15
|
-
content: `export { ${Name} } from './${name}';
|
|
16
|
-
`,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return [indexFile, componentFile(context), compositionFile(context), docsFile(context), testFile(context)];
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator';
|
|
2
|
-
import { generateFiles as generateCommonFiles } from '../workspace-common';
|
|
3
|
-
|
|
4
|
-
export const reactWorkspaceTemplate: WorkspaceTemplate = {
|
|
5
|
-
name: 'react',
|
|
6
|
-
description: 'React workspace with demo components',
|
|
7
|
-
generateFiles: async (context: WorkspaceContext) => {
|
|
8
|
-
return generateCommonFiles(context);
|
|
9
|
-
},
|
|
10
|
-
importComponents: () => {
|
|
11
|
-
return [
|
|
12
|
-
{
|
|
13
|
-
id: 'teambit.react/templates/envs/my-react',
|
|
14
|
-
targetName: 'envs/my-react',
|
|
15
|
-
path: 'demo/envs/my-react',
|
|
16
|
-
},
|
|
17
|
-
{ id: 'teambit.react/templates/ui/text', targetName: 'ui/text', path: 'demo/ui/text' },
|
|
18
|
-
{ id: 'teambit.react/templates/ui/heading', targetName: 'ui/heading', path: 'demo/ui/heading' },
|
|
19
|
-
{ id: 'teambit.react/templates/ui/card', targetName: 'ui/card', path: 'demo/ui/card' },
|
|
20
|
-
{
|
|
21
|
-
id: 'teambit.react/templates/pages/welcome',
|
|
22
|
-
targetName: 'pages/welcome',
|
|
23
|
-
path: 'demo/pages/welcome',
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
},
|
|
27
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator';
|
|
2
|
-
import { generateFiles as generateCommonFiles } from '../workspace-common';
|
|
3
|
-
|
|
4
|
-
export const reactWorkspaceAppTemplate: WorkspaceTemplate = {
|
|
5
|
-
name: 'react-app',
|
|
6
|
-
description: 'EXPERIMENTAL. react workspace for an app',
|
|
7
|
-
hidden: true,
|
|
8
|
-
generateFiles: async (context: WorkspaceContext) => {
|
|
9
|
-
return generateCommonFiles(context);
|
|
10
|
-
},
|
|
11
|
-
importComponents: () => {
|
|
12
|
-
return [
|
|
13
|
-
{ id: 'teambit.react/templates/apps/my-app', path: 'apps/my-app' },
|
|
14
|
-
{ id: 'teambit.react/templates/envs/my-react', path: 'envs/my-react' },
|
|
15
|
-
{ id: 'teambit.react/templates/themes/theme', path: 'themes/theme' },
|
|
16
|
-
{ id: 'teambit.react/templates/styles/colors', path: 'styles/colors' },
|
|
17
|
-
{ id: 'teambit.react/templates/ui/heading', path: 'ui/heading' },
|
|
18
|
-
];
|
|
19
|
-
},
|
|
20
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator';
|
|
2
|
-
import { generateFiles as generateCommonFiles } from '../workspace-common';
|
|
3
|
-
|
|
4
|
-
export const deprecatedReactWorkspaceTemplate: WorkspaceTemplate = {
|
|
5
|
-
name: 'react-workspace',
|
|
6
|
-
description: 'React workspace with demo components',
|
|
7
|
-
hidden: true,
|
|
8
|
-
generateFiles: async (context: WorkspaceContext) => {
|
|
9
|
-
return generateCommonFiles(context);
|
|
10
|
-
},
|
|
11
|
-
importComponents: () => {
|
|
12
|
-
return [
|
|
13
|
-
{
|
|
14
|
-
id: 'teambit.react/templates/envs/my-react',
|
|
15
|
-
targetName: 'envs/my-react',
|
|
16
|
-
path: 'demo/envs/my-react',
|
|
17
|
-
},
|
|
18
|
-
{ id: 'teambit.react/templates/ui/text', targetName: 'ui/text', path: 'demo/ui/text' },
|
|
19
|
-
{ id: 'teambit.react/templates/ui/heading', targetName: 'ui/heading', path: 'demo/ui/heading' },
|
|
20
|
-
{ id: 'teambit.react/templates/ui/card', targetName: 'ui/card', path: 'demo/ui/card' },
|
|
21
|
-
{
|
|
22
|
-
id: 'teambit.react/templates/pages/welcome',
|
|
23
|
-
targetName: 'pages/welcome',
|
|
24
|
-
path: 'demo/pages/welcome',
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
},
|
|
28
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator';
|
|
2
|
-
import { generateFiles as generateCommonFiles } from '../workspace-common';
|
|
3
|
-
|
|
4
|
-
export const reactWorkspaceLibTemplate: WorkspaceTemplate = {
|
|
5
|
-
name: 'react-lib',
|
|
6
|
-
description: 'EXPERIMENTAL. react workspace for a component library',
|
|
7
|
-
hidden: true,
|
|
8
|
-
generateFiles: async (context: WorkspaceContext) => {
|
|
9
|
-
return generateCommonFiles(context);
|
|
10
|
-
},
|
|
11
|
-
importComponents: () => {
|
|
12
|
-
return [
|
|
13
|
-
{ id: 'teambit.react/templates/envs/my-react', targetName: 'envs/my-react', path: 'demo/envs/my-react' },
|
|
14
|
-
{ id: 'teambit.react/templates/ui/text', targetName: 'ui/text', path: 'demo/ui/text' },
|
|
15
|
-
{ id: 'teambit.react/templates/ui/heading', targetName: 'ui/heading', path: 'demo/ui/heading' },
|
|
16
|
-
{ id: 'teambit.react/templates/ui/card', targetName: 'ui/card', path: 'demo/ui/card' },
|
|
17
|
-
{ id: 'teambit.react/templates/styles/colors', targetName: 'styles/colors', path: 'demo/styles/colors' },
|
|
18
|
-
{ id: 'teambit.react/templates/themes/theme', targetName: 'themes/theme', path: 'demo/themes/theme' },
|
|
19
|
-
];
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
export function gitIgnore() {
|
|
2
|
-
return `# Bit
|
|
3
|
-
.bit
|
|
4
|
-
public
|
|
5
|
-
|
|
6
|
-
# Logs
|
|
7
|
-
logs
|
|
8
|
-
*.log
|
|
9
|
-
npm-debug.log*
|
|
10
|
-
yarn-debug.log*
|
|
11
|
-
yarn-error.log*
|
|
12
|
-
lerna-debug.log*
|
|
13
|
-
|
|
14
|
-
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
15
|
-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
16
|
-
|
|
17
|
-
# Runtime data
|
|
18
|
-
pids
|
|
19
|
-
*.pid
|
|
20
|
-
*.seed
|
|
21
|
-
*.pid.lock
|
|
22
|
-
|
|
23
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
24
|
-
lib-cov
|
|
25
|
-
|
|
26
|
-
# Coverage directory used by tools like istanbul
|
|
27
|
-
coverage
|
|
28
|
-
*.lcov
|
|
29
|
-
|
|
30
|
-
# nyc test coverage
|
|
31
|
-
.nyc_output
|
|
32
|
-
|
|
33
|
-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
34
|
-
.grunt
|
|
35
|
-
|
|
36
|
-
# Bower dependency directory (https://bower.io/)
|
|
37
|
-
bower_components
|
|
38
|
-
|
|
39
|
-
# node-waf configuration
|
|
40
|
-
.lock-wscript
|
|
41
|
-
|
|
42
|
-
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
43
|
-
build/Release
|
|
44
|
-
|
|
45
|
-
# Dependency directories
|
|
46
|
-
node_modules/
|
|
47
|
-
jspm_packages/
|
|
48
|
-
|
|
49
|
-
# TypeScript v1 declaration files
|
|
50
|
-
typings/
|
|
51
|
-
|
|
52
|
-
# TypeScript cache
|
|
53
|
-
*.tsbuildinfo
|
|
54
|
-
|
|
55
|
-
# Optional npm cache directory
|
|
56
|
-
.npm
|
|
57
|
-
|
|
58
|
-
# Optional eslint cache
|
|
59
|
-
.eslintcache
|
|
60
|
-
|
|
61
|
-
# Microbundle cache
|
|
62
|
-
.rpt2_cache/
|
|
63
|
-
.rts2_cache_cjs/
|
|
64
|
-
.rts2_cache_es/
|
|
65
|
-
.rts2_cache_umd/
|
|
66
|
-
|
|
67
|
-
# Optional REPL history
|
|
68
|
-
.node_repl_history
|
|
69
|
-
|
|
70
|
-
# Output of 'npm pack'
|
|
71
|
-
*.tgz
|
|
72
|
-
|
|
73
|
-
# Yarn Integrity file
|
|
74
|
-
.yarn-integrity
|
|
75
|
-
|
|
76
|
-
# dotenv environment variables file
|
|
77
|
-
.env
|
|
78
|
-
.env.test
|
|
79
|
-
|
|
80
|
-
# parcel-bundler cache (https://parceljs.org/)
|
|
81
|
-
.cache
|
|
82
|
-
|
|
83
|
-
# Next.js build output
|
|
84
|
-
.next
|
|
85
|
-
|
|
86
|
-
# Nuxt.js build / generate output
|
|
87
|
-
.nuxt
|
|
88
|
-
dist
|
|
89
|
-
|
|
90
|
-
# Gatsby files
|
|
91
|
-
.cache/
|
|
92
|
-
|
|
93
|
-
# vuepress build output
|
|
94
|
-
.vuepress/dist
|
|
95
|
-
|
|
96
|
-
# Serverless directories
|
|
97
|
-
.serverless/
|
|
98
|
-
|
|
99
|
-
# FuseBox cache
|
|
100
|
-
.fusebox/
|
|
101
|
-
|
|
102
|
-
# DynamoDB Local files
|
|
103
|
-
.dynamodb/
|
|
104
|
-
|
|
105
|
-
# TernJS port file
|
|
106
|
-
.tern-port
|
|
107
|
-
|
|
108
|
-
.history
|
|
109
|
-
|
|
110
|
-
.DS_Store
|
|
111
|
-
|
|
112
|
-
`;
|
|
113
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export function readme() {
|
|
2
|
-
return `# Welcome to your Bit Workspace
|
|
3
|
-
|
|
4
|
-
To get started straight away run \`bit start\` and open [localhost:3000](http://localhost:3000). It may take a while to build the first time you run this command as it is building the whole User Interface for your development environment.
|
|
5
|
-
|
|
6
|
-
\`\`\`bash
|
|
7
|
-
bit start
|
|
8
|
-
\`\`\`
|
|
9
|
-
|
|
10
|
-
## What's included
|
|
11
|
-
|
|
12
|
-
- **workspace.jsonc**
|
|
13
|
-
|
|
14
|
-
This is the main configuration file of your bit workspace. Here you can modify the workspace name and icon as well as default directory and scope. It is where dependencies are found when you install anything. It is also where you register aspects, bit extensions as well as apply the environments for your components. This workspace has been setup so that all components use the React env. However you can create other components and apply other envs to them such as node, html, angular and aspect envs.
|
|
15
|
-
|
|
16
|
-
- **.bitmap**
|
|
17
|
-
|
|
18
|
-
This is an auto-generated file and includes the mapping of your components. There is one component included here. In order to remove this component you can run the following command.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- **Demo Components**
|
|
22
|
-
|
|
23
|
-
A folder (unless the --empty flag was used) containing demo components are included in this workspace. These components are used to demonstrate the different features of Bit. If you would like to remove these components you can run the following command.
|
|
24
|
-
|
|
25
|
-
\`\`\`jsx
|
|
26
|
-
bit remove "ui/*" --delete files
|
|
27
|
-
\`\`\`
|
|
28
|
-
|
|
29
|
-
This removes the components from the bitmap as well as removes the files.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- **.gitignore**
|
|
33
|
-
|
|
34
|
-
Ignoring any files from version control
|
|
35
|
-
`;
|
|
36
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export const assetTypes = `declare module '*.png' {
|
|
2
|
-
const value: any;
|
|
3
|
-
export = value;
|
|
4
|
-
}
|
|
5
|
-
declare module '*.svg' {
|
|
6
|
-
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
|
-
|
|
8
|
-
export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
|
|
9
|
-
const src: string;
|
|
10
|
-
export default src;
|
|
11
|
-
}
|
|
12
|
-
declare module '*.jpg' {
|
|
13
|
-
const value: any;
|
|
14
|
-
export = value;
|
|
15
|
-
}
|
|
16
|
-
declare module '*.jpeg' {
|
|
17
|
-
const value: any;
|
|
18
|
-
export = value;
|
|
19
|
-
}
|
|
20
|
-
declare module '*.gif' {
|
|
21
|
-
const value: any;
|
|
22
|
-
export = value;
|
|
23
|
-
}
|
|
24
|
-
declare module '*.bmp' {
|
|
25
|
-
const value: any;
|
|
26
|
-
export = value;
|
|
27
|
-
}
|
|
28
|
-
`;
|