@teambit/node 0.0.521 → 0.0.525

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 (34) hide show
  1. package/dist/node.main.runtime.js +11 -1
  2. package/dist/node.main.runtime.js.map +1 -1
  3. package/dist/templates/node/files/composition.d.ts +5 -0
  4. package/dist/templates/node/files/composition.js +21 -0
  5. package/dist/templates/node/files/composition.js.map +1 -0
  6. package/dist/templates/node/files/doc.d.ts +5 -1
  7. package/dist/templates/node/files/doc.js +11 -6
  8. package/dist/templates/node/files/doc.js.map +1 -1
  9. package/dist/templates/node/files/index.d.ts +6 -1
  10. package/dist/templates/node/files/index.js +7 -4
  11. package/dist/templates/node/files/index.js.map +1 -1
  12. package/dist/templates/node/files/main.d.ts +5 -1
  13. package/dist/templates/node/files/main.js +8 -5
  14. package/dist/templates/node/files/main.js.map +1 -1
  15. package/dist/templates/node/files/test.d.ts +5 -0
  16. package/dist/templates/node/files/test.js +20 -0
  17. package/dist/templates/node/files/test.js.map +1 -0
  18. package/dist/templates/node/index.d.ts +1 -1
  19. package/dist/templates/node/index.js +26 -16
  20. package/dist/templates/node/index.js.map +1 -1
  21. package/node.main.runtime.ts +2 -1
  22. package/package-tar/teambit-node-0.0.525.tgz +0 -0
  23. package/package.json +17 -17
  24. package/templates/node/files/composition.ts +14 -0
  25. package/templates/node/files/doc.ts +13 -6
  26. package/templates/node/files/index.ts +8 -4
  27. package/templates/node/files/main.ts +10 -5
  28. package/templates/node/files/test.ts +13 -0
  29. package/templates/node/index.ts +6 -18
  30. package/dist/templates/node/files/compositions.d.ts +0 -1
  31. package/dist/templates/node/files/compositions.js +0 -12
  32. package/dist/templates/node/files/compositions.js.map +0 -1
  33. package/package-tar/teambit-node-0.0.521.tgz +0 -0
  34. package/templates/node/files/compositions.ts +0 -3
@@ -101,6 +101,16 @@ function _nodeEnv() {
101
101
  return data;
102
102
  }
103
103
 
104
+ function _node3() {
105
+ const data = require("./templates/node");
106
+
107
+ _node3 = function () {
108
+ return data;
109
+ };
110
+
111
+ return data;
112
+ }
113
+
104
114
  class NodeMain {
105
115
  constructor(react, nodeEnv, envs) {
106
116
  this.react = react;
@@ -150,7 +160,7 @@ class NodeMain {
150
160
  static async provider([envs, react, generator]) {
151
161
  const nodeEnv = envs.merge(new (_node2().NodeEnv)(), react.reactEnv);
152
162
  envs.registerEnv(nodeEnv);
153
- generator.registerComponentTemplate([_nodeEnv().nodeEnvTemplate]);
163
+ generator.registerComponentTemplate([_nodeEnv().nodeEnvTemplate, _node3().nodeTemplate]);
154
164
  return new NodeMain(react, nodeEnv, envs);
155
165
  }
156
166
 
@@ -1 +1 @@
1
- {"version":3,"sources":["node.main.runtime.ts"],"names":["NodeMain","constructor","react","nodeEnv","envs","overrideTsConfig","bind","overrideJestConfig","overrideBuildPipe","overrideCompiler","overrideCompilerTasks","overrideBuildTsConfig","overridePackageJsonProps","overridePreviewConfig","overrideDevServerConfig","useTypescript","useWebpack","usePrettier","useEslint","overrideMounter","icon","overrideDependencies","dependencyPolicy","override","getDependencies","compose","transformers","targetEnv","merge","provider","generator","NodeEnv","reactEnv","registerEnv","registerComponentTemplate","nodeEnvTemplate","MainRuntime","EnvsAspect","ReactAspect","GeneratorAspect","NodeAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;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,QAAN,CAAe;AACpBC,EAAAA,WAAW,C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PolicyConfigObject } from '@teambit/dependency-resolver';\nimport { merge } from 'lodash';\nimport { TsConfigSourceFile } from 'typescript';\nimport type { TsCompilerOptionsWithoutTsConfig } from '@teambit/typescript';\nimport { MainRuntime } from '@teambit/cli';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { BuildTask } from '@teambit/builder';\nimport { Compiler } from '@teambit/compiler';\nimport { PackageJsonProps } from '@teambit/pkg';\nimport { EnvsAspect, EnvsMain, EnvTransformer, Environment } from '@teambit/envs';\nimport { ReactAspect, ReactMain } from '@teambit/react';\nimport { NodeAspect } from './node.aspect';\nimport { NodeEnv } from './node.env';\nimport { nodeEnvTemplate } from './templates/node-env';\n\nexport class NodeMain {\n constructor(\n private react: ReactMain,\n\n readonly nodeEnv: NodeEnv,\n\n private envs: EnvsMain\n ) {}\n\n icon() {\n return 'https://static.bit.dev/extensions-icons/nodejs.svg';\n }\n\n /**\n * @deprecated use useTypescript()\n * override the TS config of the environment.\n */\n overrideTsConfig: (\n tsconfig: TsConfigSourceFile,\n compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>,\n tsModule?: any\n ) => EnvTransformer = this.react.overrideTsConfig.bind(this.react);\n\n /**\n * override the jest config of the environment.\n */\n overrideJestConfig = this.react.overrideJestConfig.bind(this.react);\n\n /**\n * override the env build pipeline.\n */\n overrideBuildPipe: (tasks: BuildTask[]) => EnvTransformer = this.react.overrideBuildPipe.bind(this.react);\n\n /**\n * override the env compilers list.\n */\n overrideCompiler: (compiler: Compiler) => EnvTransformer = this.react.overrideCompiler.bind(this.react);\n\n /**\n * override the env compilers tasks in the build pipe.\n */\n overrideCompilerTasks: (tasks: BuildTask[]) => EnvTransformer = this.react.overrideCompilerTasks.bind(this.react);\n\n /**\n * @deprecated use useTypescript()\n * override the build ts config.\n */\n overrideBuildTsConfig: (\n tsconfig: any,\n compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>\n ) => EnvTransformer = this.react.overrideBuildTsConfig.bind(this.react);\n\n /**\n * override package json properties.\n */\n overridePackageJsonProps: (props: PackageJsonProps) => EnvTransformer = this.react.overridePackageJsonProps.bind(\n this.react\n );\n\n /**\n * @deprecated - use useWebpack\n * override the preview config in the env.\n */\n overridePreviewConfig = this.react.overridePreviewConfig.bind(this.react);\n\n /**\n * @deprecated - use useWebpack\n * override the dev server configuration.\n */\n overrideDevServerConfig = this.react.overrideDevServerConfig.bind(this.react);\n\n /**\n * override the env's typescript config for both dev and build time.\n * Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig)\n */\n useTypescript = this.react.useTypescript.bind(this.react);\n\n /**\n * override the env's dev server and preview webpack configurations.\n * Replaces both overrideDevServerConfig and overridePreviewConfig\n */\n useWebpack = this.react.useWebpack.bind(this.react);\n\n /**\n * An API to mutate the prettier config\n */\n usePrettier = this.react.usePrettier.bind(this.react);\n\n /**\n * An API to mutate the eslint config\n */\n useEslint = this.react.useEslint.bind(this.react);\n\n /**\n * override the dependency configuration of the component environment.\n */\n overrideDependencies(dependencyPolicy: VariantPolicyConfigObject) {\n return this.envs.override({\n getDependencies: () => merge(dependencyPolicy, this.nodeEnv.getDependencies()),\n });\n }\n\n overrideMounter = this.react.overrideMounter.bind(this.react);\n\n /**\n * create a new composition of the node environment.\n */\n compose(transformers: EnvTransformer[], targetEnv: Environment = {}) {\n return this.envs.compose(this.envs.merge(targetEnv, this.nodeEnv), transformers);\n }\n\n static runtime = MainRuntime;\n static dependencies = [EnvsAspect, ReactAspect, GeneratorAspect];\n\n static async provider([envs, react, generator]: [EnvsMain, ReactMain, GeneratorMain]) {\n const nodeEnv: NodeEnv = envs.merge(new NodeEnv(), react.reactEnv);\n envs.registerEnv(nodeEnv);\n generator.registerComponentTemplate([nodeEnvTemplate]);\n return new NodeMain(react, nodeEnv, envs);\n }\n}\n\nNodeAspect.addRuntime(NodeMain);\n"]}
1
+ {"version":3,"sources":["node.main.runtime.ts"],"names":["NodeMain","constructor","react","nodeEnv","envs","overrideTsConfig","bind","overrideJestConfig","overrideBuildPipe","overrideCompiler","overrideCompilerTasks","overrideBuildTsConfig","overridePackageJsonProps","overridePreviewConfig","overrideDevServerConfig","useTypescript","useWebpack","usePrettier","useEslint","overrideMounter","icon","overrideDependencies","dependencyPolicy","override","getDependencies","compose","transformers","targetEnv","merge","provider","generator","NodeEnv","reactEnv","registerEnv","registerComponentTemplate","nodeEnvTemplate","nodeTemplate","MainRuntime","EnvsAspect","ReactAspect","GeneratorAspect","NodeAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;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,QAAN,CAAe;AACpBC,EAAAA,WAAW,CACDC,KADC,EAGAC,OAHA,EAKDC,IALC,EAMT;AAAA,SALQF,KAKR,GALQA,KAKR;AAAA,SAHSC,OAGT,GAHSA,OAGT;AAAA,SADQC,IACR,GADQA,IACR;AAAA,8DAcoB,KAAKF,KAAL,CAAWG,gBAAX,CAA4BC,IAA5B,CAAiC,KAAKJ,KAAtC,CAdpB;AAAA,gEAmBmB,KAAKA,KAAL,CAAWK,kBAAX,CAA8BD,IAA9B,CAAmC,KAAKJ,KAAxC,CAnBnB;AAAA,+DAwB0D,KAAKA,KAAL,CAAWM,iBAAX,CAA6BF,IAA7B,CAAkC,KAAKJ,KAAvC,CAxB1D;AAAA,8DA6ByD,KAAKA,KAAL,CAAWO,gBAAX,CA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;;AAID;AACF;AACA;AACEC,EAAAA,OAAO,CAACC,YAAD,EAAiCC,SAAsB,GAAG,EAA1D,EAA8D;AACnE,WAAO,KAAKvB,IAAL,CAAUqB,OAAV,CAAkB,KAAKrB,IAAL,CAAUwB,KAAV,CAAgBD,SAAhB,EAA2B,KAAKxB,OAAhC,CAAlB,EAA4DuB,YAA5D,CAAP;AACD;;AAKoB,eAARG,QAAQ,CAAC,CAACzB,IAAD,EAAOF,KAAP,EAAc4B,SAAd,CAAD,EAAiE;AACpF,UAAM3B,OAAgB,GAAGC,IAAI,CAACwB,KAAL,CAAW,KAAIG,gBAAJ,GAAX,EAA0B7B,KAAK,CAAC8B,QAAhC,CAAzB;AACA5B,IAAAA,IAAI,CAAC6B,WAAL,CAAiB9B,OAAjB;AACA2B,IAAAA,SAAS,CAACI,yBAAV,CAAoC,CAACC,0BAAD,EAAkBC,qBAAlB,CAApC;AACA,WAAO,IAAIpC,QAAJ,CAAaE,KAAb,EAAoBC,OAApB,EAA6BC,IAA7B,CAAP;AACD;;AAvHmB;;;gCAATJ,Q,aA+GMqC,kB;gCA/GNrC,Q,kBAgHW,CAACsC,kBAAD,EAAaC,oBAAb,EAA0BC,4BAA1B,C;;AAUxBC,mBAAWC,UAAX,CAAsB1C,QAAtB","sourcesContent":["import { VariantPolicyConfigObject } from '@teambit/dependency-resolver';\nimport { merge } from 'lodash';\nimport { TsConfigSourceFile } from 'typescript';\nimport type { TsCompilerOptionsWithoutTsConfig } from '@teambit/typescript';\nimport { MainRuntime } from '@teambit/cli';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { BuildTask } from '@teambit/builder';\nimport { Compiler } from '@teambit/compiler';\nimport { PackageJsonProps } from '@teambit/pkg';\nimport { EnvsAspect, EnvsMain, EnvTransformer, Environment } from '@teambit/envs';\nimport { ReactAspect, ReactMain } from '@teambit/react';\nimport { NodeAspect } from './node.aspect';\nimport { NodeEnv } from './node.env';\nimport { nodeEnvTemplate } from './templates/node-env';\nimport { nodeTemplate } from './templates/node';\n\nexport class NodeMain {\n constructor(\n private react: ReactMain,\n\n readonly nodeEnv: NodeEnv,\n\n private envs: EnvsMain\n ) {}\n\n icon() {\n return 'https://static.bit.dev/extensions-icons/nodejs.svg';\n }\n\n /**\n * @deprecated use useTypescript()\n * override the TS config of the environment.\n */\n overrideTsConfig: (\n tsconfig: TsConfigSourceFile,\n compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>,\n tsModule?: any\n ) => EnvTransformer = this.react.overrideTsConfig.bind(this.react);\n\n /**\n * override the jest config of the environment.\n */\n overrideJestConfig = this.react.overrideJestConfig.bind(this.react);\n\n /**\n * override the env build pipeline.\n */\n overrideBuildPipe: (tasks: BuildTask[]) => EnvTransformer = this.react.overrideBuildPipe.bind(this.react);\n\n /**\n * override the env compilers list.\n */\n overrideCompiler: (compiler: Compiler) => EnvTransformer = this.react.overrideCompiler.bind(this.react);\n\n /**\n * override the env compilers tasks in the build pipe.\n */\n overrideCompilerTasks: (tasks: BuildTask[]) => EnvTransformer = this.react.overrideCompilerTasks.bind(this.react);\n\n /**\n * @deprecated use useTypescript()\n * override the build ts config.\n */\n overrideBuildTsConfig: (\n tsconfig: any,\n compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>\n ) => EnvTransformer = this.react.overrideBuildTsConfig.bind(this.react);\n\n /**\n * override package json properties.\n */\n overridePackageJsonProps: (props: PackageJsonProps) => EnvTransformer = this.react.overridePackageJsonProps.bind(\n this.react\n );\n\n /**\n * @deprecated - use useWebpack\n * override the preview config in the env.\n */\n overridePreviewConfig = this.react.overridePreviewConfig.bind(this.react);\n\n /**\n * @deprecated - use useWebpack\n * override the dev server configuration.\n */\n overrideDevServerConfig = this.react.overrideDevServerConfig.bind(this.react);\n\n /**\n * override the env's typescript config for both dev and build time.\n * Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig)\n */\n useTypescript = this.react.useTypescript.bind(this.react);\n\n /**\n * override the env's dev server and preview webpack configurations.\n * Replaces both overrideDevServerConfig and overridePreviewConfig\n */\n useWebpack = this.react.useWebpack.bind(this.react);\n\n /**\n * An API to mutate the prettier config\n */\n usePrettier = this.react.usePrettier.bind(this.react);\n\n /**\n * An API to mutate the eslint config\n */\n useEslint = this.react.useEslint.bind(this.react);\n\n /**\n * override the dependency configuration of the component environment.\n */\n overrideDependencies(dependencyPolicy: VariantPolicyConfigObject) {\n return this.envs.override({\n getDependencies: () => merge(dependencyPolicy, this.nodeEnv.getDependencies()),\n });\n }\n\n overrideMounter = this.react.overrideMounter.bind(this.react);\n\n /**\n * create a new composition of the node environment.\n */\n compose(transformers: EnvTransformer[], targetEnv: Environment = {}) {\n return this.envs.compose(this.envs.merge(targetEnv, this.nodeEnv), transformers);\n }\n\n static runtime = MainRuntime;\n static dependencies = [EnvsAspect, ReactAspect, GeneratorAspect];\n\n static async provider([envs, react, generator]: [EnvsMain, ReactMain, GeneratorMain]) {\n const nodeEnv: NodeEnv = envs.merge(new NodeEnv(), react.reactEnv);\n envs.registerEnv(nodeEnv);\n generator.registerComponentTemplate([nodeEnvTemplate, nodeTemplate]);\n return new NodeMain(react, nodeEnv, envs);\n }\n}\n\nNodeAspect.addRuntime(NodeMain);\n"]}
@@ -0,0 +1,5 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function compositionFile(context: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.compositionFile = compositionFile;
7
+
8
+ function compositionFile(context) {
9
+ return {
10
+ relativePath: `${context.name}.composition.tsx`,
11
+ content: `import React from 'react';
12
+ import { ${context.nameCamelCase} } from './${context.name}';
13
+
14
+ export function ReturnsCorrectValue() {
15
+ return <div>{${context.nameCamelCase}()}</div>;
16
+ }
17
+ `
18
+ };
19
+ }
20
+
21
+ //# sourceMappingURL=composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["composition.ts"],"names":["compositionFile","context","relativePath","name","content","nameCamelCase"],"mappings":";;;;;;;AAEO,SAASA,eAAT,CAAyBC,OAAzB,EAAoD;AACzD,SAAO;AACLC,IAAAA,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,kBADzB;AAELC,IAAAA,OAAO,EAAG;AACd,WAAWH,OAAO,CAACI,aAAc,cAAaJ,OAAO,CAACE,IAAK;AAC3D;AACA;AACA,iBAAiBF,OAAO,CAACI,aAAc;AACvC;AACA;AARS,GAAP;AAUD","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function compositionFile(context: ComponentContext) {\n return {\n relativePath: `${context.name}.composition.tsx`,\n content: `import React from 'react';\nimport { ${context.nameCamelCase} } from './${context.name}';\n\nexport function ReturnsCorrectValue() {\n return <div>{${context.nameCamelCase}()}</div>;\n}\n`,\n };\n}\n"]}
@@ -1 +1,5 @@
1
- export declare function docFile(): string;
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function docFile(context: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ };
@@ -5,16 +5,21 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.docFile = docFile;
7
7
 
8
- function docFile() {
9
- return `---
10
- labels: ['module', 'paths', 'filesystem']
8
+ function docFile(context) {
9
+ return {
10
+ relativePath: `${context.name}.docs.mdx`,
11
+ content: `---
12
+ labels: ['module']
11
13
  description: 'A general purpose node module'
12
14
  ---
13
15
 
14
- This is a customized extension for Node, based of the [Node Aspect](https://bit.dev/teambit/harmony/node).
16
+ API:
15
17
 
16
- Explain here the modified configurations and tools applied.
17
- `;
18
+ \`\`\`ts
19
+ function ${context.nameCamelCase}(): string;
20
+ \`\`\`
21
+ `
22
+ };
18
23
  }
19
24
 
20
25
  //# sourceMappingURL=doc.js.map
@@ -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: ['module', 'paths', 'filesystem']\ndescription: 'A general purpose node module'\n---\n\nThis is a customized extension for Node, based of the [Node Aspect](https://bit.dev/teambit/harmony/node).\n\nExplain here the modified configurations and tools applied.\n`;\n}\n"]}
1
+ {"version":3,"sources":["doc.ts"],"names":["docFile","context","relativePath","name","content","nameCamelCase"],"mappings":";;;;;;;AAEO,SAASA,OAAT,CAAiBC,OAAjB,EAA4C;AACjD,SAAO;AACLC,IAAAA,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,WADzB;AAELC,IAAAA,OAAO,EAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAWH,OAAO,CAACI,aAAc;AACjC;AACA;AAZS,GAAP;AAcD","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function docFile(context: ComponentContext) {\n return {\n relativePath: `${context.name}.docs.mdx`,\n content: `---\nlabels: ['module']\ndescription: 'A general purpose node module'\n---\n\nAPI:\n\n\\`\\`\\`ts\nfunction ${context.nameCamelCase}(): string;\n\\`\\`\\`\n`,\n };\n}\n"]}
@@ -1 +1,6 @@
1
- export declare function indexFile(): string;
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function indexFile(context: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ isMain: boolean;
6
+ };
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.indexFile = indexFile;
7
7
 
8
- // import { ComponentContext } from '@teambit/generator';
9
- function indexFile() {
10
- return `
11
- `;
8
+ function indexFile(context) {
9
+ return {
10
+ relativePath: 'index.ts',
11
+ content: `export { ${context.nameCamelCase} } from './${context.name}';
12
+ `,
13
+ isMain: true
14
+ };
12
15
  }
13
16
 
14
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["indexFile"],"mappings":";;;;;;;AAAA;AAEO,SAASA,SAAT,GAAqB;AAC1B,SAAQ;AACV,GADE;AAED","sourcesContent":["// import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile() {\n return `\n `;\n}\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["indexFile","context","relativePath","content","nameCamelCase","name","isMain"],"mappings":";;;;;;;AAEO,SAASA,SAAT,CAAmBC,OAAnB,EAA8C;AACnD,SAAO;AACLC,IAAAA,YAAY,EAAE,UADT;AAELC,IAAAA,OAAO,EAAG,YAAWF,OAAO,CAACG,aAAc,cAAaH,OAAO,CAACI,IAAK;AACzE,CAHS;AAILC,IAAAA,MAAM,EAAE;AAJH,GAAP;AAMD","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile(context: ComponentContext) {\n return {\n relativePath: 'index.ts',\n content: `export { ${context.nameCamelCase} } from './${context.name}';\n`,\n isMain: true,\n };\n}\n"]}
@@ -1 +1,5 @@
1
- export declare function mainFile(): string;
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function mainFile(context: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ };
@@ -5,11 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.mainFile = mainFile;
7
7
 
8
- function mainFile() {
9
- return `
10
-
11
-
12
- `;
8
+ function mainFile(context) {
9
+ return {
10
+ relativePath: `${context.name}.ts`,
11
+ content: `export function ${context.nameCamelCase}() {
12
+ return 'Hello world!';
13
+ }
14
+ `
15
+ };
13
16
  }
14
17
 
15
18
  //# sourceMappingURL=main.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["main.ts"],"names":["mainFile"],"mappings":";;;;;;;AAAO,SAASA,QAAT,GAAoB;AACzB,SAAQ;AACV;AACA;AACA,GAHE;AAID","sourcesContent":["export function mainFile() {\n return `\n \n \n `;\n}\n"]}
1
+ {"version":3,"sources":["main.ts"],"names":["mainFile","context","relativePath","name","content","nameCamelCase"],"mappings":";;;;;;;AAEO,SAASA,QAAT,CAAkBC,OAAlB,EAA6C;AAClD,SAAO;AACLC,IAAAA,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,KADzB;AAELC,IAAAA,OAAO,EAAG,mBAAkBH,OAAO,CAACI,aAAc;AACtD;AACA;AACA;AALS,GAAP;AAOD","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function mainFile(context: ComponentContext) {\n return {\n relativePath: `${context.name}.ts`,\n content: `export function ${context.nameCamelCase}() {\n return 'Hello world!';\n}\n`,\n };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function testFile(context: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.testFile = testFile;
7
+
8
+ function testFile(context) {
9
+ return {
10
+ relativePath: `${context.name}.spec.ts`,
11
+ content: `import { ${context.nameCamelCase} } from './${context.name}';
12
+
13
+ it('should return the correct value', () => {
14
+ expect(${context.nameCamelCase}()).toBe('Hello world!');
15
+ });
16
+ `
17
+ };
18
+ }
19
+
20
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["test.ts"],"names":["testFile","context","relativePath","name","content","nameCamelCase"],"mappings":";;;;;;;AAEO,SAASA,QAAT,CAAkBC,OAAlB,EAA6C;AAClD,SAAO;AACLC,IAAAA,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,UADzB;AAELC,IAAAA,OAAO,EAAG,YAAWH,OAAO,CAACI,aAAc,cAAaJ,OAAO,CAACE,IAAK;AACzE;AACA;AACA,WAAWF,OAAO,CAACI,aAAc;AACjC;AACA;AAPS,GAAP;AASD","sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function testFile(context: ComponentContext) {\n return {\n relativePath: `${context.name}.spec.ts`,\n content: `import { ${context.nameCamelCase} } from './${context.name}';\n\nit('should return the correct value', () => {\n expect(${context.nameCamelCase}()).toBe('Hello world!');\n});\n`,\n };\n}\n"]}
@@ -1,2 +1,2 @@
1
1
  import { ComponentTemplate } from '@teambit/generator';
2
- export declare const nodeEnvTemplate: ComponentTemplate;
2
+ export declare const nodeTemplate: ComponentTemplate;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.nodeEnvTemplate = void 0;
6
+ exports.nodeTemplate = void 0;
7
7
 
8
8
  function _index() {
9
9
  const data = require("./files/index");
@@ -35,23 +35,33 @@ function _main() {
35
35
  return data;
36
36
  }
37
37
 
38
- const nodeEnvTemplate = {
39
- name: 'node-env',
40
- description: 'customize the base Node env with your configs and tools',
38
+ function _test() {
39
+ const data = require("./files/test");
40
+
41
+ _test = function () {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ function _composition() {
49
+ const data = require("./files/composition");
50
+
51
+ _composition = function () {
52
+ return data;
53
+ };
54
+
55
+ return data;
56
+ }
57
+
58
+ const nodeTemplate = {
59
+ name: 'node',
60
+ description: 'a Node.js module',
41
61
  generateFiles: context => {
42
- return [{
43
- relativePath: 'index.ts',
44
- content: (0, _index().indexFile)(),
45
- isMain: true
46
- }, {
47
- relativePath: `${context.name}.docs.mdx`,
48
- content: (0, _doc().docFile)()
49
- }, {
50
- relativePath: `${context.name}.extension.ts`,
51
- content: (0, _main().mainFile)()
52
- }];
62
+ return [(0, _index().indexFile)(context), (0, _doc().docFile)(context), (0, _main().mainFile)(context), (0, _composition().compositionFile)(context), (0, _test().testFile)(context)];
53
63
  }
54
64
  };
55
- exports.nodeEnvTemplate = nodeEnvTemplate;
65
+ exports.nodeTemplate = nodeTemplate;
56
66
 
57
67
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["nodeEnvTemplate","name","description","generateFiles","context","relativePath","content","isMain"],"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,yBAFX;AAGEC,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;AAFX,KAVK,CAAP;AAeD;AAnB+C,CAA3C","sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { docFile } from './files/doc';\nimport { mainFile } from './files/main';\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(),\n isMain: true,\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docFile(),\n },\n {\n relativePath: `${context.name}.extension.ts`,\n content: mainFile(),\n },\n ];\n },\n};\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["nodeTemplate","name","description","generateFiles","context"],"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;;AAEO,MAAMA,YAA+B,GAAG;AAC7CC,EAAAA,IAAI,EAAE,MADuC;AAE7CC,EAAAA,WAAW,EAAE,kBAFgC;AAG7CC,EAAAA,aAAa,EAAGC,OAAD,IAA+B;AAC5C,WAAO,CAAC,wBAAUA,OAAV,CAAD,EAAqB,oBAAQA,OAAR,CAArB,EAAuC,sBAASA,OAAT,CAAvC,EAA0D,oCAAgBA,OAAhB,CAA1D,EAAoF,sBAASA,OAAT,CAApF,CAAP;AACD;AAL4C,CAAxC","sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { docFile } from './files/doc';\nimport { mainFile } from './files/main';\nimport { testFile } from './files/test';\nimport { compositionFile } from './files/composition';\n\nexport const nodeTemplate: ComponentTemplate = {\n name: 'node',\n description: 'a Node.js module',\n generateFiles: (context: ComponentContext) => {\n return [indexFile(context), docFile(context), mainFile(context), compositionFile(context), testFile(context)];\n },\n};\n"]}
@@ -12,6 +12,7 @@ import { ReactAspect, ReactMain } from '@teambit/react';
12
12
  import { NodeAspect } from './node.aspect';
13
13
  import { NodeEnv } from './node.env';
14
14
  import { nodeEnvTemplate } from './templates/node-env';
15
+ import { nodeTemplate } from './templates/node';
15
16
 
16
17
  export class NodeMain {
17
18
  constructor(
@@ -130,7 +131,7 @@ export class NodeMain {
130
131
  static async provider([envs, react, generator]: [EnvsMain, ReactMain, GeneratorMain]) {
131
132
  const nodeEnv: NodeEnv = envs.merge(new NodeEnv(), react.reactEnv);
132
133
  envs.registerEnv(nodeEnv);
133
- generator.registerComponentTemplate([nodeEnvTemplate]);
134
+ generator.registerComponentTemplate([nodeEnvTemplate, nodeTemplate]);
134
135
  return new NodeMain(react, nodeEnv, envs);
135
136
  }
136
137
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/node",
3
- "version": "0.0.521",
3
+ "version": "0.0.525",
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.521"
9
+ "version": "0.0.525"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -14,19 +14,19 @@
14
14
  "typescript": "4.4.2",
15
15
  "@babel/runtime": "7.12.18",
16
16
  "core-js": "^3.0.0",
17
- "@teambit/dependency-resolver": "0.0.521",
18
- "@teambit/envs": "0.0.521",
19
- "@teambit/builder": "0.0.521",
20
- "@teambit/cli": "0.0.379",
21
- "@teambit/compiler": "0.0.521",
22
- "@teambit/generator": "0.0.521",
23
- "@teambit/pkg": "0.0.521",
24
- "@teambit/react": "0.0.521",
25
- "@teambit/typescript": "0.0.521",
26
- "@teambit/compositions": "0.0.521",
27
- "@teambit/design.ui.empty-box": "0.0.351",
28
- "@teambit/tester": "0.0.521",
29
- "@teambit/ui": "0.0.521"
17
+ "@teambit/dependency-resolver": "0.0.525",
18
+ "@teambit/envs": "0.0.525",
19
+ "@teambit/builder": "0.0.525",
20
+ "@teambit/cli": "0.0.380",
21
+ "@teambit/compiler": "0.0.525",
22
+ "@teambit/generator": "0.0.525",
23
+ "@teambit/pkg": "0.0.525",
24
+ "@teambit/react": "0.0.525",
25
+ "@teambit/typescript": "0.0.525",
26
+ "@teambit/compositions": "0.0.525",
27
+ "@teambit/design.ui.empty-box": "0.0.352",
28
+ "@teambit/tester": "0.0.525",
29
+ "@teambit/ui": "0.0.525"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/lodash": "4.14.165",
@@ -36,14 +36,14 @@
36
36
  "@types/jest": "^26.0.0",
37
37
  "@types/react-dom": "^17.0.5",
38
38
  "@types/node": "12.20.4",
39
- "@teambit/harmony.aspect-docs.node": "0.0.85"
39
+ "@teambit/harmony.aspect-docs.node": "0.0.87"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@teambit/legacy": "1.0.76",
43
43
  "react-dom": "^16.8.0 || ^17.0.0",
44
44
  "react": "^16.8.0 || ^17.0.0"
45
45
  },
46
- "license": "SEE LICENSE IN LICENSE",
46
+ "license": "Apache-2.0",
47
47
  "bit": {
48
48
  "bindingPrefix": "@teambit",
49
49
  "env": {},
@@ -0,0 +1,14 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+
3
+ export function compositionFile(context: ComponentContext) {
4
+ return {
5
+ relativePath: `${context.name}.composition.tsx`,
6
+ content: `import React from 'react';
7
+ import { ${context.nameCamelCase} } from './${context.name}';
8
+
9
+ export function ReturnsCorrectValue() {
10
+ return <div>{${context.nameCamelCase}()}</div>;
11
+ }
12
+ `,
13
+ };
14
+ }
@@ -1,11 +1,18 @@
1
- export function docFile() {
2
- return `---
3
- labels: ['module', 'paths', 'filesystem']
1
+ import { ComponentContext } from '@teambit/generator';
2
+
3
+ export function docFile(context: ComponentContext) {
4
+ return {
5
+ relativePath: `${context.name}.docs.mdx`,
6
+ content: `---
7
+ labels: ['module']
4
8
  description: 'A general purpose node module'
5
9
  ---
6
10
 
7
- This is a customized extension for Node, based of the [Node Aspect](https://bit.dev/teambit/harmony/node).
11
+ API:
8
12
 
9
- Explain here the modified configurations and tools applied.
10
- `;
13
+ \`\`\`ts
14
+ function ${context.nameCamelCase}(): string;
15
+ \`\`\`
16
+ `,
17
+ };
11
18
  }
@@ -1,6 +1,10 @@
1
- // import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '@teambit/generator';
2
2
 
3
- export function indexFile() {
4
- return `
5
- `;
3
+ export function indexFile(context: ComponentContext) {
4
+ return {
5
+ relativePath: 'index.ts',
6
+ content: `export { ${context.nameCamelCase} } from './${context.name}';
7
+ `,
8
+ isMain: true,
9
+ };
6
10
  }
@@ -1,6 +1,11 @@
1
- export function mainFile() {
2
- return `
3
-
4
-
5
- `;
1
+ import { ComponentContext } from '@teambit/generator';
2
+
3
+ export function mainFile(context: ComponentContext) {
4
+ return {
5
+ relativePath: `${context.name}.ts`,
6
+ content: `export function ${context.nameCamelCase}() {
7
+ return 'Hello world!';
8
+ }
9
+ `,
10
+ };
6
11
  }
@@ -0,0 +1,13 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+
3
+ export function testFile(context: ComponentContext) {
4
+ return {
5
+ relativePath: `${context.name}.spec.ts`,
6
+ content: `import { ${context.nameCamelCase} } from './${context.name}';
7
+
8
+ it('should return the correct value', () => {
9
+ expect(${context.nameCamelCase}()).toBe('Hello world!');
10
+ });
11
+ `,
12
+ };
13
+ }
@@ -2,25 +2,13 @@ import { ComponentContext, ComponentTemplate } from '@teambit/generator';
2
2
  import { indexFile } from './files/index';
3
3
  import { docFile } from './files/doc';
4
4
  import { mainFile } from './files/main';
5
+ import { testFile } from './files/test';
6
+ import { compositionFile } from './files/composition';
5
7
 
6
- export const nodeEnvTemplate: ComponentTemplate = {
7
- name: 'node-env',
8
- description: 'customize the base Node env with your configs and tools',
8
+ export const nodeTemplate: ComponentTemplate = {
9
+ name: 'node',
10
+ description: 'a Node.js module',
9
11
  generateFiles: (context: ComponentContext) => {
10
- return [
11
- {
12
- relativePath: 'index.ts',
13
- content: indexFile(),
14
- isMain: true,
15
- },
16
- {
17
- relativePath: `${context.name}.docs.mdx`,
18
- content: docFile(),
19
- },
20
- {
21
- relativePath: `${context.name}.extension.ts`,
22
- content: mainFile(),
23
- },
24
- ];
12
+ return [indexFile(context), docFile(context), mainFile(context), compositionFile(context), testFile(context)];
25
13
  },
26
14
  };
@@ -1 +0,0 @@
1
- export declare function compositionsFile(): string;
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.compositionsFile = compositionsFile;
7
-
8
- function compositionsFile() {
9
- return ``;
10
- }
11
-
12
- //# sourceMappingURL=compositions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compositions.ts"],"names":["compositionsFile"],"mappings":";;;;;;;AAAO,SAASA,gBAAT,GAA4B;AACjC,SAAQ,EAAR;AACD","sourcesContent":["export function compositionsFile() {\n return ``;\n}\n"]}
@@ -1,3 +0,0 @@
1
- export function compositionsFile() {
2
- return ``;
3
- }