@teambit/node 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.
Files changed (66) hide show
  1. package/artifacts/env-template/public/162.js +6 -2
  2. package/artifacts/env-template/public/{413.js → 624.js} +4 -4
  3. package/artifacts/env-template/public/793.js +17 -17
  4. package/artifacts/env-template/public/assets-manifest.json +13 -15
  5. package/artifacts/env-template/public/{compositions.60e7ad86acf6c3fc7258.js → compositions.e86ca82917601a50c1de.js} +1 -1
  6. package/artifacts/env-template/public/compositions.html +1 -1
  7. package/artifacts/env-template/public/{overview.7d2a3622759390957aaa.js → overview.c22cec3a6de6d04dd2d6.js} +2 -2
  8. package/artifacts/env-template/public/overview.html +1 -1
  9. package/artifacts/env-template/public/{preview-root.cd80fcaec61d81a584f1.js → preview-root.f8526a284a6e4a3e0885.js} +1 -1
  10. package/artifacts/env-template/public/service-worker.js +1 -1
  11. package/artifacts/env-template/public/static/css/{compositions.cd8be53f.css → compositions.4138c069.css} +1 -1
  12. package/artifacts/env-template/public/static/css/{previewRoot.a16607da.css → previewRoot.c0db5bec.css} +1 -1
  13. package/artifacts/preview/teambit_harmony_node-preview.js +2 -2
  14. package/{compositions-1649733938651.js → compositions-1650252279523.js} +0 -0
  15. package/dist/templates/node-env/files/aspect.d.ts +2 -0
  16. package/dist/templates/node-env/files/aspect.js +20 -0
  17. package/dist/templates/node-env/files/aspect.js.map +1 -0
  18. package/dist/templates/node-env/files/doc.d.ts +2 -1
  19. package/dist/templates/node-env/files/doc.js +173 -5
  20. package/dist/templates/node-env/files/doc.js.map +1 -1
  21. package/dist/templates/node-env/files/index.js +5 -3
  22. package/dist/templates/node-env/files/index.js.map +1 -1
  23. package/dist/templates/node-env/files/jest.config.d.ts +1 -0
  24. package/dist/templates/node-env/files/jest.config.js +30 -0
  25. package/dist/templates/node-env/files/jest.config.js.map +1 -0
  26. package/dist/templates/node-env/files/main.runtime.d.ts +2 -0
  27. package/dist/templates/node-env/files/main.runtime.js +103 -0
  28. package/dist/templates/node-env/files/main.runtime.js.map +1 -0
  29. package/dist/templates/node-env/files/preview.runtime.d.ts +2 -0
  30. package/dist/templates/node-env/files/preview.runtime.js +38 -0
  31. package/dist/templates/node-env/files/preview.runtime.js.map +1 -0
  32. package/dist/templates/node-env/files/typescript/styles.d.ts +1 -0
  33. package/dist/templates/node-env/files/typescript/styles.js +16 -0
  34. package/dist/templates/node-env/files/typescript/styles.js.map +1 -0
  35. package/dist/templates/node-env/files/typescript/ts-transformer.d.ts +1 -0
  36. package/dist/templates/node-env/files/typescript/ts-transformer.js +59 -0
  37. package/dist/templates/node-env/files/typescript/ts-transformer.js.map +1 -0
  38. package/dist/templates/node-env/files/typescript/typescript.config.d.ts +1 -0
  39. package/dist/templates/node-env/files/typescript/typescript.config.js +30 -0
  40. package/dist/templates/node-env/files/typescript/typescript.config.js.map +1 -0
  41. package/dist/templates/node-env/files/webpack.config.d.ts +1 -0
  42. package/dist/templates/node-env/files/webpack.config.js +57 -0
  43. package/dist/templates/node-env/files/webpack.config.js.map +1 -0
  44. package/dist/templates/node-env/index.js +99 -8
  45. package/dist/templates/node-env/index.js.map +1 -1
  46. package/{overview-1649733938651.js → overview-1650252279523.js} +0 -0
  47. package/package-tar/teambit-node-0.0.710.tgz +0 -0
  48. package/package.json +16 -16
  49. package/{preview-1649733938651.js → preview-1650252279523.js} +2 -2
  50. package/templates/node-env/files/aspect.ts +10 -0
  51. package/templates/node-env/files/doc.ts +172 -5
  52. package/templates/node-env/files/index.ts +5 -3
  53. package/templates/node-env/files/jest.config.ts +21 -0
  54. package/templates/node-env/files/main.runtime.ts +93 -0
  55. package/templates/node-env/files/preview.runtime.ts +27 -0
  56. package/templates/node-env/files/typescript/styles.ts +7 -0
  57. package/templates/node-env/files/typescript/ts-transformer.ts +50 -0
  58. package/templates/node-env/files/typescript/typescript.config.ts +21 -0
  59. package/templates/node-env/files/webpack.config.ts +48 -0
  60. package/templates/node-env/index.ts +41 -6
  61. package/artifacts/env-template/public/static/css/overview.7bb7dce6.css +0 -1
  62. package/dist/templates/node-env/files/extension.d.ts +0 -2
  63. package/dist/templates/node-env/files/extension.js +0 -34
  64. package/dist/templates/node-env/files/extension.js.map +0 -1
  65. package/package-tar/teambit-node-0.0.707.tgz +0 -0
  66. package/templates/node-env/files/extension.ts +0 -25
@@ -5,15 +5,183 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.docFile = docFile;
7
7
 
8
- function docFile() {
8
+ function docFile({
9
+ name,
10
+ componentId
11
+ }) {
9
12
  return `---
10
- labels: ['extension', 'node', 'env', 'environment']
11
- description: 'A customized extension for Node environment.'
13
+ description: 'A standard Node component development environment'
14
+ labels: ['node', 'typescript', 'env', 'extension']
12
15
  ---
13
16
 
14
- This is a customized extension for Node, based of the [Node Aspect](https://bit.cloud/teambit/harmony/node).
17
+ ## Overview
15
18
 
16
- Explain here the modified configurations and tools applied.
19
+ A customized version which extends the default Node component development environment created by teambit.
20
+
21
+ 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.
22
+ 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
23
+ exported and then shared and used in various projects which makes it easier to create standards when working with many teams.
24
+
25
+ ### Usage instructions
26
+
27
+ #### Recommended usage:
28
+
29
+ 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
30
+ config in your component's entry in the \`.bitmap\` file.
31
+
32
+ :::Note - this will override any variants policy that tries to set an env for this component in the workspace.jsonc
33
+ :::
34
+
35
+ #### Alternative Usage
36
+ 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.
37
+
38
+ \`\`\`json
39
+ {
40
+ "teambit.workspace/variants": {
41
+ "{ui/**}, {pages/**}": {
42
+ "${componentId}": {}
43
+ }
44
+ }
45
+ }
46
+ \`\`\`
47
+
48
+ This usage may be deprecated in future in favour of the recommended usage above
49
+
50
+ ## Runtime Configurations
51
+
52
+ Extend the \`main.runtime\` file when you want to add custom configurations at runtime.
53
+
54
+ ### Compilation
55
+
56
+ By default, Component compilation is done with the TypeScript compiler. Target format is \`ES2015\` which
57
+ supports execution from both NodeJS and browser runtimes for server-side rendering. You can modify the \`tsconfig.json\` file to add your own compiler options which will then be merged with the default configs set by teambit.
58
+
59
+ Example:
60
+
61
+ \`\`\`json
62
+ {
63
+ "compilerOptions": {
64
+ "target": "es2017",
65
+ "module": "es2015",
66
+ "moduleResolution": "node",
67
+ "lib": ["es2017", "dom"],
68
+ "experimentalDecorators": true,
69
+ "esModuleInterop": true,
70
+ "outDir": "dist",
71
+ "sourceMap": true,
72
+ "emitDecoratorMetadata": true,
73
+ "allowJs": true,
74
+ "baseUrl": ".",
75
+ "jsx": "react"
76
+ }
77
+ }
78
+ \`\`\`
79
+
80
+ ### Testing
81
+
82
+ Component testing is done through [Jest](https://jestjs.io/) with the default \`teambit.react/react\` environment. You can modify the \`jestconfig.js\` file to add your own configurations which will then be merged with the default configs set by teambit.
83
+
84
+ Example:
85
+
86
+ To Override the Jest config to ignore transpiling from specific folders add this to the \`jestconfig.js\` file:
87
+
88
+ \`\`\`js
89
+ const reactJestConfig = require('@teambit/react/jest/jest.config');
90
+ module.exports = {
91
+ ...reactJestConfig,
92
+ transformIgnorePatterns: ['/node_modules/(?!(prop-types|@teambit))']
93
+ };
94
+ \`\`\`
95
+
96
+ ### Webpack
97
+
98
+ Bit uses webpack 5 to bundle components. You can modify the \`webpack.config.js\` file to add your own configurations which will then be merged with the default configs set by teambit.
99
+
100
+ Example:
101
+
102
+ \`\`\`ts
103
+ module.exports = {
104
+ module: {
105
+ // add your custom rules here
106
+ rules: []
107
+ }
108
+ };
109
+ \`\`\`
110
+
111
+ ### ESLint
112
+
113
+ Bit uses ESLint to lint your components. You can add your own rules in the \`${name}.main.runtime\` file.
114
+
115
+ Example:
116
+
117
+ \`\`\`ts
118
+ react.useEslint({
119
+ transformers: [
120
+ (config) => {
121
+ config.setRule('no-console', ['error']);
122
+ // add more rules here
123
+ return config;
124
+ }
125
+ ]
126
+ }),
127
+ \`\`\`
128
+
129
+ To use ESLint:
130
+
131
+ \`\`\`bash
132
+ bit lint
133
+ bit lint --fix
134
+ \`\`\`
135
+
136
+ ### Formatting
137
+
138
+ Bit uses Prettier to format your components. You can add your own rules in the \`${name}.main.runtime\` file.
139
+
140
+ Example:
141
+
142
+ \`\`\`ts
143
+ react.usePrettier({
144
+ transformers: [
145
+ (config) => {
146
+ config.setKey('tabWidth', 2);
147
+ // add more rules here
148
+ return config;
149
+ }
150
+ ]
151
+ }),
152
+ \`\`\`
153
+
154
+ To use Prettier:
155
+
156
+ \`\`\`bash
157
+ bit format --check
158
+ bit format
159
+ \`\`\`
160
+
161
+ ### Dependencies
162
+
163
+ Override the default dependencies in the \`${name}.main.runtime\` file to include react types of a different version for example.
164
+
165
+ \`\`\`ts
166
+ react.overrideDependencies({
167
+ devDependencies: {
168
+ '@types/react': '17.0.3'
169
+ }
170
+ });
171
+ \`\`\`
172
+
173
+ ## Preview Configurations
174
+
175
+ Extend the \`${name}.preview.runtime\` file when you want to add your own customizations only for previewing in the Bit UI.
176
+
177
+ ### Adding a Theme
178
+
179
+ A custom theme has been added to the env which wraps all the composition files with the required theme so they can be developed with the correct themeing rather than the browsers default. This is added only in the preview runtime and not in the main runtime meaning it is only applied to compositions and not when consuming components. Adding a theme when consuming should be done at App level as you component may be consumed in various apps and have different themes applied depending on where it is consumed.
180
+
181
+ Example:
182
+
183
+ \`\`\`ts
184
+ react.registerProvider([ThemeCompositions]);
17
185
  `;
18
186
  }
19
187
 
@@ -1 +1 @@
1
- {"version":3,"sources":["doc.ts"],"names":["docFile"],"mappings":";;;;;;;AAAO,SAASA,OAAT,GAAmB;AACxB,SAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CARE;AASD","sourcesContent":["export function docFile() {\n return `---\nlabels: ['extension', 'node', 'env', 'environment']\ndescription: 'A customized extension for Node environment.'\n---\n\nThis is a customized extension for Node, based of the [Node Aspect](https://bit.cloud/teambit/harmony/node).\n\nExplain here the modified configurations and tools applied.\n`;\n}\n"]}
1
+ {"version":3,"sources":["doc.ts"],"names":["docFile","name","componentId"],"mappings":";;;;;;;AAEO,SAASA,OAAT,CAAiB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAAjB,EAA0D;AAC/D,SAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wIAAwIA,WAAY;AACpJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4DA,WAAY;AACxE;AACA;AACA;AACA;AACA;AACA;AACA,mLAAmLD,IAAK;AACxL;AACA;AACA;AACA;AACA;AACA,SAASC,WAAY;AACrB;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+EAA+ED,IAAK;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmFA,IAAK;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6CA,IAAK;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeA,IAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CA7KE;AA8KD","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function docFile({ name, componentId }: ComponentContext) {\n return `---\ndescription: 'A standard Node component development environment'\nlabels: ['node', 'typescript', 'env', 'extension']\n---\n\n## Overview\n\nA customized version which extends the default Node component development environment created by teambit.\n\nThis 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.\nThat 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\nexported and then shared and used in various projects which makes it easier to create standards when working with many teams.\n\n### Usage instructions\n\n#### Recommended usage:\n\nRun 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\nconfig in your component's entry in the \\`.bitmap\\` file.\n\n:::Note - this will override any variants policy that tries to set an env for this component in the workspace.jsonc\n:::\n\n#### Alternative Usage\nUnder 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.\n\n\\`\\`\\`json\n{\n \"teambit.workspace/variants\": {\n \"{ui/**}, {pages/**}\": {\n \"${componentId}\": {}\n }\n }\n}\n\\`\\`\\`\n\nThis usage may be deprecated in future in favour of the recommended usage above\n\n## Runtime Configurations\n\nExtend the \\`main.runtime\\` file when you want to add custom configurations at runtime.\n\n### Compilation\n\nBy default, Component compilation is done with the TypeScript compiler. Target format is \\`ES2015\\` which\nsupports execution from both NodeJS and browser runtimes for server-side rendering. You can modify the \\`tsconfig.json\\` file to add your own compiler options which will then be merged with the default configs set by teambit.\n\nExample:\n\n\\`\\`\\`json\n{\n \"compilerOptions\": {\n \"target\": \"es2017\",\n \"module\": \"es2015\",\n \"moduleResolution\": \"node\",\n \"lib\": [\"es2017\", \"dom\"],\n \"experimentalDecorators\": true,\n \"esModuleInterop\": true,\n \"outDir\": \"dist\",\n \"sourceMap\": true,\n \"emitDecoratorMetadata\": true,\n \"allowJs\": true,\n \"baseUrl\": \".\",\n \"jsx\": \"react\"\n }\n}\n\\`\\`\\`\n\n### Testing\n\nComponent testing is done through [Jest](https://jestjs.io/) with the default \\`teambit.react/react\\` environment. You can modify the \\`jestconfig.js\\` file to add your own configurations which will then be merged with the default configs set by teambit.\n\nExample:\n\nTo Override the Jest config to ignore transpiling from specific folders add this to the \\`jestconfig.js\\` file:\n\n\\`\\`\\`js\nconst reactJestConfig = require('@teambit/react/jest/jest.config');\nmodule.exports = {\n ...reactJestConfig,\n transformIgnorePatterns: ['/node_modules/(?!(prop-types|@teambit))']\n};\n\\`\\`\\`\n\n### Webpack\n\nBit uses webpack 5 to bundle components. You can modify the \\`webpack.config.js\\` file to add your own configurations which will then be merged with the default configs set by teambit.\n\nExample:\n\n\\`\\`\\`ts\nmodule.exports = {\n module: {\n // add your custom rules here\n rules: []\n }\n};\n\\`\\`\\`\n\n### ESLint\n\nBit uses ESLint to lint your components. You can add your own rules in the \\`${name}.main.runtime\\` file.\n\nExample:\n\n\\`\\`\\`ts\nreact.useEslint({\n transformers: [\n (config) => {\n config.setRule('no-console', ['error']);\n // add more rules here\n return config;\n }\n ]\n}),\n\\`\\`\\`\n\nTo use ESLint:\n\n\\`\\`\\`bash\nbit lint\nbit lint --fix\n\\`\\`\\`\n\n### Formatting\n\nBit uses Prettier to format your components. You can add your own rules in the \\`${name}.main.runtime\\` file.\n\nExample:\n\n\\`\\`\\`ts\nreact.usePrettier({\n transformers: [\n (config) => {\n config.setKey('tabWidth', 2);\n // add more rules here\n return config;\n }\n ]\n}),\n\\`\\`\\`\n\nTo use Prettier:\n\n\\`\\`\\`bash\nbit format --check\nbit format\n\\`\\`\\`\n\n### Dependencies\n\nOverride the default dependencies in the \\`${name}.main.runtime\\` file to include react types of a different version for example.\n\n\\`\\`\\`ts\nreact.overrideDependencies({\n devDependencies: {\n '@types/react': '17.0.3'\n }\n});\n\\`\\`\\`\n\n## Preview Configurations\n\nExtend the \\`${name}.preview.runtime\\` file when you want to add your own customizations only for previewing in the Bit UI.\n\n### Adding a Theme\n\nA custom theme has been added to the env which wraps all the composition files with the required theme so they can be developed with the correct themeing rather than the browsers default. This is added only in the preview runtime and not in the main runtime meaning it is only applied to compositions and not when consuming components. Adding a theme when consuming should be done at App level as you component may be consumed in various apps and have different themes applied depending on where it is consumed.\n\nExample:\n\n\\`\\`\\`ts\nreact.registerProvider([ThemeCompositions]);\n`;\n}\n"]}
@@ -9,9 +9,11 @@ function indexFile({
9
9
  namePascalCase: Name,
10
10
  name
11
11
  }) {
12
- return `import { ${Name}Extension } from './${name}.extension';
13
- export { ${Name}Extension };
14
- export default ${Name}Extension;
12
+ return `import { ${Name}Aspect } from './${name}.aspect';
13
+
14
+ export type { ${Name}Main } from './${name}.main.runtime';
15
+ export default ${Name}Aspect;
16
+ export { ${Name}Aspect };
15
17
  `;
16
18
  }
17
19
 
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["indexFile","namePascalCase","Name","name"],"mappings":";;;;;;;AAEO,SAASA,SAAT,CAAmB;AAAEC,EAAAA,cAAc,EAAEC,IAAlB;AAAwBC,EAAAA;AAAxB,CAAnB,EAAqE;AAC1E,SAAQ,YAAWD,IAAK,uBAAsBC,IAAK;AACrD,WAAWD,IAAK;AAChB,iBAAiBA,IAAK;AACtB,CAHE;AAID","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase: Name, name }: ComponentContext) {\n return `import { ${Name}Extension } from './${name}.extension';\nexport { ${Name}Extension };\nexport default ${Name}Extension;\n`;\n}\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["indexFile","namePascalCase","Name","name"],"mappings":";;;;;;;AAEO,SAASA,SAAT,CAAmB;AAAEC,EAAAA,cAAc,EAAEC,IAAlB;AAAwBC,EAAAA;AAAxB,CAAnB,EAAqE;AAC1E,SAAQ,YAAWD,IAAK,oBAAmBC,IAAK;AAClD;AACA,gBAAgBD,IAAK,kBAAiBC,IAAK;AAC3C,iBAAiBD,IAAK;AACtB,WAAWA,IAAK;AAChB,CALE;AAMD","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase: Name, name }: ComponentContext) {\n return `import { ${Name}Aspect } from './${name}.aspect';\n\nexport type { ${Name}Main } from './${name}.main.runtime';\nexport default ${Name}Aspect;\nexport { ${Name}Aspect };\n`;\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function jestConfigFile(): string;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.jestConfigFile = jestConfigFile;
7
+
8
+ function jestConfigFile() {
9
+ return `
10
+ // Override the Jest config to ignore transpiling from specific folders
11
+ // See the base Jest config: https://bit.cloud/teambit/react/react/~code/jest/jest.config.js
12
+
13
+ // const reactJestConfig = require('@teambit/react/jest/jest.config');
14
+ // uncomment the line below and install the package if you want to use this function
15
+ // const {
16
+ // generateNodeModulesPattern,
17
+ // } = require('@teambit/dependencies.modules.packages-excluder');
18
+ // const packagesToExclude = ['@my-org', 'my-package-name'];
19
+
20
+ // module.exports = {
21
+ // ...reactJestConfig,
22
+ // transformIgnorePatterns: [
23
+ // '^.+\\.module\\.(css|sass|scss)$',
24
+ // generateNodeModulesPattern({ packages: packagesToExclude }),
25
+ // ],
26
+ // };
27
+ `;
28
+ }
29
+
30
+ //# sourceMappingURL=jest.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["jest.config.ts"],"names":["jestConfigFile"],"mappings":";;;;;;;AAAO,SAASA,cAAT,GAA0B;AAC/B,SAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAlBE;AAmBD","sourcesContent":["export function jestConfigFile() {\n return `\n // Override the Jest config to ignore transpiling from specific folders\n // See the base Jest config: https://bit.cloud/teambit/react/react/~code/jest/jest.config.js\n\n // const reactJestConfig = require('@teambit/react/jest/jest.config');\n // uncomment the line below and install the package if you want to use this function\n // const {\n // generateNodeModulesPattern,\n // } = require('@teambit/dependencies.modules.packages-excluder');\n // const packagesToExclude = ['@my-org', 'my-package-name'];\n\n // module.exports = {\n // ...reactJestConfig,\n // transformIgnorePatterns: [\n // '^.+\\\\.module\\\\.(css|sass|scss)$',\n // generateNodeModulesPattern({ packages: packagesToExclude }),\n // ],\n // };\n `;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function mainRuntimeFile({ namePascalCase: Name, name }: ComponentContext): string;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mainRuntimeFile = mainRuntimeFile;
7
+
8
+ function mainRuntimeFile({
9
+ namePascalCase: Name,
10
+ name
11
+ }) {
12
+ return `import { MainRuntime } from '@teambit/cli';
13
+ import { NodeAspect, NodeMain } from '@teambit/node'
14
+ import { EnvsAspect, EnvsMain } from '@teambit/envs';
15
+ import { ${Name}Aspect } from './${name}.aspect';
16
+ //import {
17
+ // previewConfigTransformer,
18
+ // devServerConfigTransformer
19
+ //} from './webpack/webpack-transformers';
20
+ //import {
21
+ // devConfigTransformer,
22
+ // buildConfigTransformer,
23
+ //} from "./typescript/ts-transformers";
24
+
25
+ export class ${Name}Main {
26
+ static slots = [];
27
+
28
+ static dependencies = [NodeAspect, EnvsAspect];
29
+
30
+ static runtime = MainRuntime;
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
+
42
+ static async provider([node, envs]: [NodeMain, EnvsMain]) {
43
+ const ${Name}Env = node.compose([
44
+ /**
45
+ * Uncomment to override the config files for TypeScript, Webpack or Jest
46
+ * Your config gets merged with the defaults
47
+ */
48
+
49
+ // node.useTypescript(tsModifiers), // note: this cannot be used in conjunction with node.overrideCompiler
50
+ // node.useWebpack(webpackModifiers),
51
+ // node.overrideJestConfig(require.resolve('./jest/jest.config')),
52
+
53
+ /**
54
+ * override the ESLint default config here then check your files for lint errors
55
+ * @example
56
+ * bit lint
57
+ * bit lint --fix
58
+ */
59
+ node.useEslint({
60
+ transformers: [
61
+ (config) => {
62
+ config.setRule('no-console', ['error']);
63
+ return config;
64
+ }
65
+ ]
66
+ }),
67
+
68
+ /**
69
+ * override the Prettier default config here the check your formatting
70
+ * @example
71
+ * bit format --check
72
+ * bit format
73
+ */
74
+ node.usePrettier({
75
+ transformers: [
76
+ (config) => {
77
+ config.setKey('tabWidth', 2);
78
+ return config;
79
+ }
80
+ ]
81
+ }),
82
+
83
+ /**
84
+ * override dependencies here
85
+ * @example
86
+ * Uncomment types to include version 17.0.3 of the types package
87
+ */
88
+ node.overrideDependencies({
89
+ devDependencies: {
90
+ // '@types/node': '16.11.7'
91
+ }
92
+ })
93
+ ]);
94
+ envs.registerEnv(${Name}Env);
95
+ return new ${Name}Main();
96
+ }
97
+ }
98
+
99
+ ${Name}Aspect.addRuntime(${Name}Main);
100
+ `;
101
+ }
102
+
103
+ //# sourceMappingURL=main.runtime.js.map
@@ -0,0 +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;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 { NodeAspect, NodeMain } from '@teambit/node'\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 = [NodeAspect, 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([node, envs]: [NodeMain, EnvsMain]) {\n const ${Name}Env = node.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 // node.useTypescript(tsModifiers), // note: this cannot be used in conjunction with node.overrideCompiler\n // node.useWebpack(webpackModifiers),\n // node.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 node.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 node.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 node.overrideDependencies({\n devDependencies: {\n // '@types/node': '16.11.7'\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,2 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function previewRuntimeFile({ namePascalCase: Name, nameCamelCase: nameCamel, name }: ComponentContext): string;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.previewRuntimeFile = previewRuntimeFile;
7
+
8
+ function previewRuntimeFile({
9
+ namePascalCase: Name,
10
+ nameCamelCase: nameCamel,
11
+ name
12
+ }) {
13
+ return `import { PreviewRuntime } from '@teambit/preview';
14
+ import { ReactAspect, ReactPreview } from '@teambit/react'; // the node env uses the react env's preview feature
15
+ // uncomment the line below and install the theme if you want to use our theme or create your own and import it here
16
+ // import { ThemeCompositions } from '@teambit/documenter.theme.theme-compositions';
17
+
18
+ import { ${Name}Aspect } from './${name}.aspect';
19
+
20
+ export class ${Name}PreviewMain {
21
+ static runtime = PreviewRuntime;
22
+
23
+ static dependencies = [ReactAspect];
24
+
25
+ static async provider([react]: [ReactPreview]) {
26
+ const ${nameCamel}PreviewMain = new ${Name}PreviewMain();
27
+ // uncomment the line below to register a new provider to wrap all compositions using this environment with a custom theme.
28
+ // react.registerProvider([ThemeCompositions]);
29
+
30
+ return ${nameCamel}PreviewMain;
31
+ }
32
+ }
33
+
34
+ ${Name}Aspect.addRuntime(${Name}PreviewMain);
35
+ `;
36
+ }
37
+
38
+ //# sourceMappingURL=preview.runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["preview.runtime.ts"],"names":["previewRuntimeFile","namePascalCase","Name","nameCamelCase","nameCamel","name"],"mappings":";;;;;;;AAEO,SAASA,kBAAT,CAA4B;AAAEC,EAAAA,cAAc,EAAEC,IAAlB;AAAwBC,EAAAA,aAAa,EAAEC,SAAvC;AAAkDC,EAAAA;AAAlD,CAA5B,EAAwG;AAC7G,SAAQ;AACV;AACA;AACA;AACA;AACA,WAAWH,IAAK,oBAAmBG,IAAK;AACxC;AACA,eAAeH,IAAK;AACpB;AACA;AACA;AACA;AACA;AACA,YAAYE,SAAU,qBAAoBF,IAAK;AAC/C;AACA;AACA;AACA,aAAaE,SAAU;AACvB;AACA;AACA;AACA,EAAEF,IAAK,qBAAoBA,IAAK;AAChC,CAtBE;AAuBD","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function previewRuntimeFile({ namePascalCase: Name, nameCamelCase: nameCamel, name }: ComponentContext) {\n return `import { PreviewRuntime } from '@teambit/preview';\nimport { ReactAspect, ReactPreview } from '@teambit/react'; // the node env uses the react env's preview feature\n// uncomment the line below and install the theme if you want to use our theme or create your own and import it here\n// import { ThemeCompositions } from '@teambit/documenter.theme.theme-compositions';\n\nimport { ${Name}Aspect } from './${name}.aspect';\n\nexport class ${Name}PreviewMain {\n static runtime = PreviewRuntime;\n\n static dependencies = [ReactAspect];\n\n static async provider([react]: [ReactPreview]) {\n const ${nameCamel}PreviewMain = new ${Name}PreviewMain();\n // uncomment the line below to register a new provider to wrap all compositions using this environment with a custom theme.\n // react.registerProvider([ThemeCompositions]);\n\n return ${nameCamel}PreviewMain;\n }\n}\n\n${Name}Aspect.addRuntime(${Name}PreviewMain);\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"]}
@@ -0,0 +1 @@
1
+ export declare function typescriptConfigFile(): string;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.typescriptConfigFile = typescriptConfigFile;
7
+
8
+ function typescriptConfigFile() {
9
+ return `{
10
+ // add your compiler options here
11
+
12
+ "compilerOptions": {
13
+ // "target": "es2017",
14
+ // "module": "es2015",
15
+ // "moduleResolution": "node",
16
+ // "lib": ["es2017", "dom"],
17
+ // "experimentalDecorators": true,
18
+ // "esModuleInterop": true,
19
+ // "outDir": "dist",
20
+ // "sourceMap": true,
21
+ // "emitDecoratorMetadata": true,
22
+ // "allowJs": true,
23
+ // "baseUrl": ".",
24
+ // "jsx": "react"
25
+ }
26
+ }
27
+ `;
28
+ }
29
+
30
+ //# sourceMappingURL=typescript.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["typescript.config.ts"],"names":["typescriptConfigFile"],"mappings":";;;;;;;AAAO,SAASA,oBAAT,GAAgC;AACrC,SAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAlBE;AAmBD","sourcesContent":["export function typescriptConfigFile() {\n return `{\n // add your compiler options here\n\n \"compilerOptions\": {\n // \"target\": \"es2017\",\n // \"module\": \"es2015\",\n // \"moduleResolution\": \"node\",\n // \"lib\": [\"es2017\", \"dom\"],\n // \"experimentalDecorators\": true,\n // \"esModuleInterop\": true,\n // \"outDir\": \"dist\",\n // \"sourceMap\": true,\n // \"emitDecoratorMetadata\": true,\n // \"allowJs\": true,\n // \"baseUrl\": \".\",\n // \"jsx\": \"react\"\n }\n}\n`;\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function webpackConfigFile(): string;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.webpackConfigFile = webpackConfigFile;
7
+
8
+ function webpackConfigFile() {
9
+ return `
10
+ import { WebpackConfigTransformer, WebpackConfigMutator, WebpackConfigTransformContext } from '@teambit/webpack';
11
+
12
+ /**
13
+ * Transformation to apply for both preview and dev server
14
+ * @param config
15
+ * @param _context
16
+ */
17
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
+ function commonTransformation(config: WebpackConfigMutator, _context: WebpackConfigTransformContext) {
19
+ // Merge config with the webpack.config.js file if you choose to import a module export format config.
20
+ // config.merge([webpackConfig]);
21
+ // config.addAliases({});
22
+ // config.addModuleRule(youRuleHere);
23
+ return config;
24
+ }
25
+
26
+ /**
27
+ * Transformation for the preview only
28
+ * @param config
29
+ * @param context
30
+ * @returns
31
+ */
32
+ export const previewConfigTransformer: WebpackConfigTransformer = (
33
+ config: WebpackConfigMutator,
34
+ context: WebpackConfigTransformContext
35
+ ) => {
36
+ const newConfig = commonTransformation(config, context);
37
+ return newConfig;
38
+ };
39
+
40
+ /**
41
+ * Transformation for the dev server only
42
+ * @param config
43
+ * @param context
44
+ * @returns
45
+ */
46
+ export const devServerConfigTransformer: WebpackConfigTransformer = (
47
+ config: WebpackConfigMutator,
48
+ context: WebpackConfigTransformContext
49
+ ) => {
50
+ const newConfig = commonTransformation(config, context);
51
+ return newConfig;
52
+ };
53
+
54
+ `;
55
+ }
56
+
57
+ //# sourceMappingURL=webpack.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack.config.ts"],"names":["webpackConfigFile"],"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,CA7CE;AA8CD","sourcesContent":["export function webpackConfigFile() {\n return `\n import { WebpackConfigTransformer, WebpackConfigMutator, WebpackConfigTransformContext } from '@teambit/webpack';\n\n /**\n * Transformation to apply for both preview and dev server\n * @param config\n * @param _context\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n function commonTransformation(config: WebpackConfigMutator, _context: WebpackConfigTransformContext) {\n // Merge config with the webpack.config.js file if you choose to import a module export format config.\n // config.merge([webpackConfig]);\n // config.addAliases({});\n // config.addModuleRule(youRuleHere);\n return config;\n }\n\n /**\n * Transformation for the preview only\n * @param config\n * @param context\n * @returns\n */\n export const previewConfigTransformer: WebpackConfigTransformer = (\n config: WebpackConfigMutator,\n context: WebpackConfigTransformContext\n ) => {\n const newConfig = commonTransformation(config, context);\n return newConfig;\n };\n\n /**\n * Transformation for the dev server only\n * @param config\n * @param context\n * @returns\n */\n export const devServerConfigTransformer: WebpackConfigTransformer = (\n config: WebpackConfigMutator,\n context: WebpackConfigTransformContext\n ) => {\n const newConfig = commonTransformation(config, context);\n return newConfig;\n };\n\n`;\n}\n"]}