@teambit/node 0.0.706 → 0.0.709

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 (69) 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 +18 -18
  4. package/artifacts/env-template/public/assets-manifest.json +14 -16
  5. package/artifacts/env-template/public/compositions.85b7cc71e1e5bde42f83.js +1 -0
  6. package/artifacts/env-template/public/compositions.html +1 -1
  7. package/artifacts/env-template/public/{overview.ff1719cb4d0309121203.js → overview.567788979aa2b79c51e8.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/793.799c4293.css +1 -0
  12. package/artifacts/env-template/public/static/css/{compositions.cd8be53f.css → compositions.4138c069.css} +1 -1
  13. package/artifacts/env-template/public/static/css/{previewRoot.a16607da.css → previewRoot.c0db5bec.css} +1 -1
  14. package/artifacts/preview/teambit_harmony_node-preview.js +2 -2
  15. package/{compositions-1649647448813.js → compositions-1650243425150.js} +0 -0
  16. package/dist/templates/node-env/files/aspect.d.ts +2 -0
  17. package/dist/templates/node-env/files/aspect.js +20 -0
  18. package/dist/templates/node-env/files/aspect.js.map +1 -0
  19. package/dist/templates/node-env/files/doc.d.ts +2 -1
  20. package/dist/templates/node-env/files/doc.js +173 -5
  21. package/dist/templates/node-env/files/doc.js.map +1 -1
  22. package/dist/templates/node-env/files/index.js +5 -3
  23. package/dist/templates/node-env/files/index.js.map +1 -1
  24. package/dist/templates/node-env/files/jest.config.d.ts +1 -0
  25. package/dist/templates/node-env/files/jest.config.js +30 -0
  26. package/dist/templates/node-env/files/jest.config.js.map +1 -0
  27. package/dist/templates/node-env/files/main.runtime.d.ts +2 -0
  28. package/dist/templates/node-env/files/main.runtime.js +103 -0
  29. package/dist/templates/node-env/files/main.runtime.js.map +1 -0
  30. package/dist/templates/node-env/files/preview.runtime.d.ts +2 -0
  31. package/dist/templates/node-env/files/preview.runtime.js +38 -0
  32. package/dist/templates/node-env/files/preview.runtime.js.map +1 -0
  33. package/dist/templates/node-env/files/typescript/styles.d.ts +1 -0
  34. package/dist/templates/node-env/files/typescript/styles.js +16 -0
  35. package/dist/templates/node-env/files/typescript/styles.js.map +1 -0
  36. package/dist/templates/node-env/files/typescript/ts-transformer.d.ts +1 -0
  37. package/dist/templates/node-env/files/typescript/ts-transformer.js +59 -0
  38. package/dist/templates/node-env/files/typescript/ts-transformer.js.map +1 -0
  39. package/dist/templates/node-env/files/typescript/typescript.config.d.ts +1 -0
  40. package/dist/templates/node-env/files/typescript/typescript.config.js +30 -0
  41. package/dist/templates/node-env/files/typescript/typescript.config.js.map +1 -0
  42. package/dist/templates/node-env/files/webpack.config.d.ts +1 -0
  43. package/dist/templates/node-env/files/webpack.config.js +57 -0
  44. package/dist/templates/node-env/files/webpack.config.js.map +1 -0
  45. package/dist/templates/node-env/index.js +99 -8
  46. package/dist/templates/node-env/index.js.map +1 -1
  47. package/{overview-1649647448813.js → overview-1650243425150.js} +0 -0
  48. package/package-tar/teambit-node-0.0.709.tgz +0 -0
  49. package/package.json +16 -16
  50. package/{preview-1649647448813.js → preview-1650243425150.js} +2 -2
  51. package/templates/node-env/files/aspect.ts +10 -0
  52. package/templates/node-env/files/doc.ts +172 -5
  53. package/templates/node-env/files/index.ts +5 -3
  54. package/templates/node-env/files/jest.config.ts +21 -0
  55. package/templates/node-env/files/main.runtime.ts +93 -0
  56. package/templates/node-env/files/preview.runtime.ts +27 -0
  57. package/templates/node-env/files/typescript/styles.ts +7 -0
  58. package/templates/node-env/files/typescript/ts-transformer.ts +50 -0
  59. package/templates/node-env/files/typescript/typescript.config.ts +21 -0
  60. package/templates/node-env/files/webpack.config.ts +48 -0
  61. package/templates/node-env/index.ts +41 -6
  62. package/artifacts/env-template/public/compositions.17295699d92a4f6fbb0f.js +0 -1
  63. package/artifacts/env-template/public/static/css/793.ebb74038.css +0 -1
  64. package/artifacts/env-template/public/static/css/overview.7bb7dce6.css +0 -1
  65. package/dist/templates/node-env/files/extension.d.ts +0 -2
  66. package/dist/templates/node-env/files/extension.js +0 -34
  67. package/dist/templates/node-env/files/extension.js.map +0 -1
  68. package/package-tar/teambit-node-0.0.706.tgz +0 -0
  69. package/templates/node-env/files/extension.ts +0 -25
@@ -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"]}
@@ -25,10 +25,80 @@ function _doc() {
25
25
  return data;
26
26
  }
27
27
 
28
- function _extension() {
29
- const data = require("./files/extension");
28
+ function _main() {
29
+ const data = require("./files/main.runtime");
30
30
 
31
- _extension = function () {
31
+ _main = function () {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _preview() {
39
+ const data = require("./files/preview.runtime");
40
+
41
+ _preview = function () {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ function _aspect() {
49
+ const data = require("./files/aspect");
50
+
51
+ _aspect = function () {
52
+ return data;
53
+ };
54
+
55
+ return data;
56
+ }
57
+
58
+ function _webpack() {
59
+ const data = require("./files/webpack.config");
60
+
61
+ _webpack = function () {
62
+ return data;
63
+ };
64
+
65
+ return data;
66
+ }
67
+
68
+ function _typescript() {
69
+ const data = require("./files/typescript/typescript.config");
70
+
71
+ _typescript = function () {
72
+ return data;
73
+ };
74
+
75
+ return data;
76
+ }
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
+
98
+ function _jest() {
99
+ const data = require("./files/jest.config");
100
+
101
+ _jest = function () {
32
102
  return data;
33
103
  };
34
104
 
@@ -45,16 +115,37 @@ const nodeEnvTemplate = {
45
115
  isMain: true
46
116
  }, {
47
117
  relativePath: `${context.name}.docs.mdx`,
48
- content: (0, _doc().docFile)()
118
+ content: (0, _doc().docFile)(context)
119
+ }, {
120
+ relativePath: `${context.name}.main.runtime.ts`,
121
+ content: (0, _main().mainRuntimeFile)(context)
122
+ }, {
123
+ relativePath: `${context.name}.preview.runtime.ts`,
124
+ content: (0, _preview().previewRuntimeFile)(context)
125
+ }, {
126
+ relativePath: `${context.name}.aspect.ts`,
127
+ content: (0, _aspect().aspectFile)(context)
128
+ }, {
129
+ relativePath: `webpack/webpack-transformers.ts`,
130
+ content: (0, _webpack().webpackConfigFile)()
131
+ }, {
132
+ relativePath: `typescript/tsconfig.json`,
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)()
49
140
  }, {
50
- relativePath: `${context.name}.extension.ts`,
51
- content: (0, _extension().extensionFile)(context)
141
+ relativePath: `jest/jest.config.js`,
142
+ content: (0, _jest().jestConfigFile)()
52
143
  }];
53
144
  },
54
145
  config: {
55
- 'teambit.harmony/aspect': {},
146
+ 'teambit.envs/env': {},
56
147
  'teambit.envs/envs': {
57
- env: 'teambit.harmony/aspect'
148
+ env: 'teambit.envs/env'
58
149
  }
59
150
  }
60
151
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["nodeEnvTemplate","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;;AAEO,MAAMA,eAAkC,GAAG;AAChDC,EAAAA,IAAI,EAAE,UAD0C;AAEhDC,EAAAA,WAAW,EAAE,yDAFmC;AAGhDC,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;AAFX,KANK,EAUL;AACED,MAAAA,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,eADhC;AAEEK,MAAAA,OAAO,EAAE,gCAAcF,OAAd;AAFX,KAVK,CAAP;AAeD,GAnB+C;AAoBhDI,EAAAA,MAAM,EAAE;AACN,8BAA0B,EADpB;AAEN,yBAAqB;AACnBC,MAAAA,GAAG,EAAE;AADc;AAFf;AApBwC,CAA3C","sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { docFile } from './files/doc';\nimport { extensionFile } from './files/extension';\n\nexport const nodeEnvTemplate: ComponentTemplate = {\n name: 'node-env',\n description: 'customize the base Node 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(),\n },\n {\n relativePath: `${context.name}.extension.ts`,\n content: extensionFile(context),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["nodeEnvTemplate","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,eAAkC,GAAG;AAChDC,EAAAA,IAAI,EAAE,UAD0C;AAEhDC,EAAAA,WAAW,EAAE,yDAFmC;AAGhDC,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/C+C;AAgDhDE,EAAAA,MAAM,EAAE;AACN,wBAAoB,EADd;AAEN,yBAAqB;AACnBC,MAAAA,GAAG,EAAE;AADc;AAFf;AAhDwC,CAA3C","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 nodeEnvTemplate: ComponentTemplate = {\n name: 'node-env',\n description: 'customize the base Node 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"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/node",
3
- "version": "0.0.706",
3
+ "version": "0.0.709",
4
4
  "homepage": "https://bit.dev/teambit/harmony/node",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "node",
9
- "version": "0.0.706"
9
+ "version": "0.0.709"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -15,21 +15,21 @@
15
15
  "@babel/runtime": "7.12.18",
16
16
  "core-js": "^3.0.0",
17
17
  "@teambit/harmony": "0.3.3",
18
- "@teambit/application": "0.0.348",
19
- "@teambit/logger": "0.0.562",
20
- "@teambit/react": "0.0.706",
21
- "@teambit/builder": "0.0.706",
22
- "@teambit/dependency-resolver": "0.0.706",
23
- "@teambit/envs": "0.0.706",
24
- "@teambit/tester": "0.0.706",
25
- "@teambit/typescript": "0.0.706",
26
- "@teambit/cli": "0.0.470",
27
- "@teambit/compiler": "0.0.706",
28
- "@teambit/generator": "0.0.706",
29
- "@teambit/pkg": "0.0.706",
30
- "@teambit/compositions": "0.0.706",
18
+ "@teambit/application": "0.0.351",
19
+ "@teambit/logger": "0.0.564",
20
+ "@teambit/react": "0.0.709",
21
+ "@teambit/builder": "0.0.709",
22
+ "@teambit/dependency-resolver": "0.0.709",
23
+ "@teambit/envs": "0.0.709",
24
+ "@teambit/tester": "0.0.709",
25
+ "@teambit/typescript": "0.0.709",
26
+ "@teambit/cli": "0.0.472",
27
+ "@teambit/compiler": "0.0.709",
28
+ "@teambit/generator": "0.0.709",
29
+ "@teambit/pkg": "0.0.709",
30
+ "@teambit/compositions": "0.0.709",
31
31
  "@teambit/design.ui.empty-box": "0.0.353",
32
- "@teambit/ui": "0.0.706"
32
+ "@teambit/ui": "0.0.709"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/react": "^17.0.8",
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_node@0.0.706/dist/node.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_node@0.0.706/dist/node.docs.mdx')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_node@0.0.709/dist/node.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_node@0.0.709/dist/node.docs.mdx')]
@@ -0,0 +1,10 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+
3
+ export function aspectFile({ namePascalCase: Name, componentId }: ComponentContext) {
4
+ return `import { Aspect } from '@teambit/harmony';
5
+
6
+ export const ${Name}Aspect = Aspect.create({
7
+ id: '${componentId}',
8
+ });
9
+ `;
10
+ }
@@ -1,11 +1,178 @@
1
- export function docFile() {
1
+ import { ComponentContext } from '@teambit/generator';
2
+
3
+ export function docFile({ name, componentId }: ComponentContext) {
2
4
  return `---
3
- labels: ['extension', 'node', 'env', 'environment']
4
- description: 'A customized extension for Node environment.'
5
+ description: 'A standard Node component development environment'
6
+ labels: ['node', 'typescript', 'env', 'extension']
5
7
  ---
6
8
 
7
- This is a customized extension for Node, based of the [Node Aspect](https://bit.cloud/teambit/harmony/node).
9
+ ## Overview
10
+
11
+ A customized version which extends the default Node 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.
16
+
17
+ ### Usage instructions
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
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.
29
+
30
+ \`\`\`json
31
+ {
32
+ "teambit.workspace/variants": {
33
+ "{ui/**}, {pages/**}": {
34
+ "${componentId}": {}
35
+ }
36
+ }
37
+ }
38
+ \`\`\`
39
+
40
+ This usage may be deprecated in future in favour of the recommended usage above
41
+
42
+ ## Runtime Configurations
43
+
44
+ Extend the \`main.runtime\` file when you want to add custom configurations at runtime.
45
+
46
+ ### Compilation
47
+
48
+ By default, Component compilation is done with the TypeScript compiler. Target format is \`ES2015\` which
49
+ 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.
50
+
51
+ Example:
52
+
53
+ \`\`\`json
54
+ {
55
+ "compilerOptions": {
56
+ "target": "es2017",
57
+ "module": "es2015",
58
+ "moduleResolution": "node",
59
+ "lib": ["es2017", "dom"],
60
+ "experimentalDecorators": true,
61
+ "esModuleInterop": true,
62
+ "outDir": "dist",
63
+ "sourceMap": true,
64
+ "emitDecoratorMetadata": true,
65
+ "allowJs": true,
66
+ "baseUrl": ".",
67
+ "jsx": "react"
68
+ }
69
+ }
70
+ \`\`\`
71
+
72
+ ### Testing
73
+
74
+ 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.
75
+
76
+ Example:
77
+
78
+ To Override the Jest config to ignore transpiling from specific folders add this to the \`jestconfig.js\` file:
79
+
80
+ \`\`\`js
81
+ const reactJestConfig = require('@teambit/react/jest/jest.config');
82
+ module.exports = {
83
+ ...reactJestConfig,
84
+ transformIgnorePatterns: ['/node_modules/(?!(prop-types|@teambit))']
85
+ };
86
+ \`\`\`
87
+
88
+ ### Webpack
89
+
90
+ 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.
91
+
92
+ Example:
93
+
94
+ \`\`\`ts
95
+ module.exports = {
96
+ module: {
97
+ // add your custom rules here
98
+ rules: []
99
+ }
100
+ };
101
+ \`\`\`
102
+
103
+ ### ESLint
104
+
105
+ Bit uses ESLint to lint your components. You can add your own rules in the \`${name}.main.runtime\` file.
106
+
107
+ Example:
108
+
109
+ \`\`\`ts
110
+ react.useEslint({
111
+ transformers: [
112
+ (config) => {
113
+ config.setRule('no-console', ['error']);
114
+ // add more rules here
115
+ return config;
116
+ }
117
+ ]
118
+ }),
119
+ \`\`\`
120
+
121
+ To use ESLint:
122
+
123
+ \`\`\`bash
124
+ bit lint
125
+ bit lint --fix
126
+ \`\`\`
127
+
128
+ ### Formatting
129
+
130
+ Bit uses Prettier to format your components. You can add your own rules in the \`${name}.main.runtime\` file.
131
+
132
+ Example:
133
+
134
+ \`\`\`ts
135
+ react.usePrettier({
136
+ transformers: [
137
+ (config) => {
138
+ config.setKey('tabWidth', 2);
139
+ // add more rules here
140
+ return config;
141
+ }
142
+ ]
143
+ }),
144
+ \`\`\`
145
+
146
+ To use Prettier:
147
+
148
+ \`\`\`bash
149
+ bit format --check
150
+ bit format
151
+ \`\`\`
152
+
153
+ ### Dependencies
154
+
155
+ Override the default dependencies in the \`${name}.main.runtime\` file to include react types of a different version for example.
156
+
157
+ \`\`\`ts
158
+ react.overrideDependencies({
159
+ devDependencies: {
160
+ '@types/react': '17.0.3'
161
+ }
162
+ });
163
+ \`\`\`
164
+
165
+ ## Preview Configurations
166
+
167
+ Extend the \`${name}.preview.runtime\` file when you want to add your own customizations only for previewing in the Bit UI.
168
+
169
+ ### Adding a Theme
170
+
171
+ 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.
172
+
173
+ Example:
8
174
 
9
- Explain here the modified configurations and tools applied.
175
+ \`\`\`ts
176
+ react.registerProvider([ThemeCompositions]);
10
177
  `;
11
178
  }
@@ -1,8 +1,10 @@
1
1
  import { ComponentContext } from '@teambit/generator';
2
2
 
3
3
  export function indexFile({ namePascalCase: Name, name }: ComponentContext) {
4
- return `import { ${Name}Extension } from './${name}.extension';
5
- export { ${Name}Extension };
6
- export default ${Name}Extension;
4
+ return `import { ${Name}Aspect } from './${name}.aspect';
5
+
6
+ export type { ${Name}Main } from './${name}.main.runtime';
7
+ export default ${Name}Aspect;
8
+ export { ${Name}Aspect };
7
9
  `;
8
10
  }
@@ -0,0 +1,21 @@
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.cloud/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 = ['@my-org', 'my-package-name'];
12
+
13
+ // module.exports = {
14
+ // ...reactJestConfig,
15
+ // transformIgnorePatterns: [
16
+ // '^.+\\.module\\.(css|sass|scss)$',
17
+ // generateNodeModulesPattern({ packages: packagesToExclude }),
18
+ // ],
19
+ // };
20
+ `;
21
+ }