@teambit/node 0.0.761 → 0.0.764

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 (85) hide show
  1. package/artifacts/env-template/public/875.js +6 -3
  2. package/artifacts/env-template/public/{91.js → 983.js} +2 -2
  3. package/artifacts/env-template/public/assets-manifest.json +11 -11
  4. package/artifacts/env-template/public/{compositions.7c156ebb9205d9994226.js → compositions.58b10202cff55b5dc7bd.js} +1 -1
  5. package/artifacts/env-template/public/compositions.html +1 -1
  6. package/artifacts/env-template/public/{overview.bb1cff31e98bb44b323b.js → overview.1220ac805e0c7de29d03.js} +1 -1
  7. package/artifacts/env-template/public/overview.html +1 -1
  8. package/artifacts/env-template/public/{preview-root.a03eeceb9e4617894d2b.js → preview-root.3321fc8dd0e9ab83be3d.js} +1 -1
  9. package/artifacts/env-template/public/static/css/{875.b96d1dd6.css → 875.f1507f80.css} +1 -1
  10. package/artifacts/preview/teambit_harmony_node-preview.js +2 -2
  11. package/{compositions-1655263660719.js → compositions-1655436530187.js} +0 -0
  12. package/dist/node.application.d.ts +1 -1
  13. package/dist/node.application.js +16 -1
  14. package/dist/node.application.js.map +1 -1
  15. package/dist/node.main.runtime.js +21 -1
  16. package/dist/node.main.runtime.js.map +1 -1
  17. package/dist/templates/express-app/files/app-root.d.ts +5 -0
  18. package/dist/templates/express-app/files/app-root.js +37 -0
  19. package/dist/templates/express-app/files/app-root.js.map +1 -0
  20. package/dist/templates/express-app/files/composition.d.ts +5 -0
  21. package/dist/templates/express-app/files/composition.js +21 -0
  22. package/dist/templates/express-app/files/composition.js.map +1 -0
  23. package/dist/templates/express-app/files/doc.d.ts +5 -0
  24. package/dist/templates/express-app/files/doc.js +36 -0
  25. package/dist/templates/express-app/files/doc.js.map +1 -0
  26. package/dist/templates/express-app/files/get-port.d.ts +4 -0
  27. package/dist/templates/express-app/files/get-port.js +22 -0
  28. package/dist/templates/express-app/files/get-port.js.map +1 -0
  29. package/dist/templates/express-app/files/index.d.ts +6 -0
  30. package/dist/templates/express-app/files/index.js +18 -0
  31. package/dist/templates/express-app/files/index.js.map +1 -0
  32. package/dist/templates/express-app/files/mock-route.d.ts +4 -0
  33. package/dist/templates/express-app/files/mock-route.js +24 -0
  34. package/dist/templates/express-app/files/mock-route.js.map +1 -0
  35. package/dist/templates/express-app/files/node-app.d.ts +5 -0
  36. package/dist/templates/express-app/files/node-app.js +24 -0
  37. package/dist/templates/express-app/files/node-app.js.map +1 -0
  38. package/dist/templates/express-app/files/route.d.ts +4 -0
  39. package/dist/templates/express-app/files/route.js +30 -0
  40. package/dist/templates/express-app/files/route.js.map +1 -0
  41. package/dist/templates/express-app/files/test.d.ts +5 -0
  42. package/dist/templates/express-app/files/test.js +20 -0
  43. package/dist/templates/express-app/files/test.js.map +1 -0
  44. package/dist/templates/express-app/index.d.ts +2 -0
  45. package/dist/templates/express-app/index.js +97 -0
  46. package/dist/templates/express-app/index.js.map +1 -0
  47. package/dist/templates/express-route/files/composition.d.ts +5 -0
  48. package/dist/templates/express-route/files/composition.js +21 -0
  49. package/dist/templates/express-route/files/composition.js.map +1 -0
  50. package/dist/templates/express-route/files/doc.d.ts +5 -0
  51. package/dist/templates/express-route/files/doc.js +25 -0
  52. package/dist/templates/express-route/files/doc.js.map +1 -0
  53. package/dist/templates/express-route/files/index.d.ts +6 -0
  54. package/dist/templates/express-route/files/index.js +17 -0
  55. package/dist/templates/express-route/files/index.js.map +1 -0
  56. package/dist/templates/express-route/files/main.d.ts +5 -0
  57. package/dist/templates/express-route/files/main.js +22 -0
  58. package/dist/templates/express-route/files/main.js.map +1 -0
  59. package/dist/templates/express-route/files/test.d.ts +5 -0
  60. package/dist/templates/express-route/files/test.js +20 -0
  61. package/dist/templates/express-route/files/test.js.map +1 -0
  62. package/dist/templates/express-route/index.d.ts +2 -0
  63. package/dist/templates/express-route/index.js +57 -0
  64. package/dist/templates/express-route/index.js.map +1 -0
  65. package/{overview-1655263660719.js → overview-1655436530187.js} +0 -0
  66. package/package-tar/teambit-node-0.0.764.tgz +0 -0
  67. package/package.json +17 -16
  68. package/{preview-1655263660719.js → preview-1655436530187.js} +2 -2
  69. package/templates/express-app/files/app-root.ts +30 -0
  70. package/templates/express-app/files/composition.ts +14 -0
  71. package/templates/express-app/files/doc.ts +26 -0
  72. package/templates/express-app/files/get-port.ts +13 -0
  73. package/templates/express-app/files/index.ts +11 -0
  74. package/templates/express-app/files/mock-route.ts +15 -0
  75. package/templates/express-app/files/node-app.ts +17 -0
  76. package/templates/express-app/files/route.ts +21 -0
  77. package/templates/express-app/files/test.ts +13 -0
  78. package/templates/express-app/index.ts +34 -0
  79. package/templates/express-route/files/composition.ts +14 -0
  80. package/templates/express-route/files/doc.ts +18 -0
  81. package/templates/express-route/files/index.ts +10 -0
  82. package/templates/express-route/files/main.ts +15 -0
  83. package/templates/express-route/files/test.ts +13 -0
  84. package/templates/express-route/index.ts +26 -0
  85. package/package-tar/teambit-node-0.0.761.tgz +0 -0
@@ -12,6 +12,6 @@ export declare class NodeApp implements Application {
12
12
  readonly deploy?: DeployFn | undefined;
13
13
  constructor(name: string, entry: string, portRange: number[], nodeEnv: NodeEnv & ReactEnv, logger: Logger, deploy?: DeployFn | undefined);
14
14
  applicationType: string;
15
- run(): Promise<void>;
15
+ run(): Promise<number | undefined>;
16
16
  build(context: AppBuildContext): Promise<DeployContext>;
17
17
  }
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ require("core-js/modules/es.array.iterator.js");
6
+
5
7
  require("core-js/modules/es.promise.js");
6
8
 
7
9
  Object.defineProperty(exports, "__esModule", {
@@ -39,6 +41,16 @@ function _path() {
39
41
  return data;
40
42
  }
41
43
 
44
+ function _toolboxNetwork() {
45
+ const data = require("@teambit/toolbox.network.get-port");
46
+
47
+ _toolboxNetwork = function () {
48
+ return data;
49
+ };
50
+
51
+ return data;
52
+ }
53
+
42
54
  class NodeApp {
43
55
  constructor(name, entry, portRange, nodeEnv, logger, deploy) {
44
56
  this.name = name;
@@ -54,7 +66,9 @@ class NodeApp {
54
66
  var _child$stdout;
55
67
 
56
68
  const logger = this.logger;
57
- const child = (0, _child_process().execFile)('node', [this.entry], error => {
69
+ const [from, to] = this.portRange;
70
+ const port = await _toolboxNetwork().Port.getPort(from, to);
71
+ const child = (0, _child_process().execFile)('node', [this.entry, port.toString()], error => {
58
72
  if (error) {
59
73
  throw error;
60
74
  }
@@ -62,6 +76,7 @@ class NodeApp {
62
76
  (_child$stdout = child.stdout) === null || _child$stdout === void 0 ? void 0 : _child$stdout.on('data', function (data) {
63
77
  logger.console(data.toString());
64
78
  });
79
+ return port;
65
80
  }
66
81
 
67
82
  async build(context) {
@@ -1 +1 @@
1
- {"version":3,"names":["NodeApp","constructor","name","entry","portRange","nodeEnv","logger","deploy","run","child","execFile","error","stdout","on","data","console","toString","build","context","base","parse","distDir","getCompiler","mainFile","join","_context","Object","assign"],"sources":["node.application.ts"],"sourcesContent":["import { execFile } from 'child_process';\nimport { parse, join } from 'path';\nimport { Logger } from '@teambit/logger';\nimport { ReactEnv } from '@teambit/react';\nimport { Application, DeployFn, AppBuildContext } from '@teambit/application';\nimport { NodeEnv } from './node.env';\nimport { DeployContext } from './node-app-options';\n\nexport class NodeApp implements Application {\n constructor(\n readonly name: string,\n readonly entry: string,\n readonly portRange: number[],\n readonly nodeEnv: NodeEnv & ReactEnv,\n readonly logger: Logger,\n readonly deploy?: DeployFn\n ) {}\n\n applicationType = 'node';\n\n async run(): Promise<void> {\n const logger = this.logger;\n const child = execFile('node', [this.entry], (error) => {\n if (error) {\n throw error;\n }\n });\n child.stdout?.on('data', function (data) {\n logger.console(data.toString());\n });\n }\n\n async build(context: AppBuildContext): Promise<DeployContext> {\n const { base } = parse(this.entry);\n const { distDir } = this.nodeEnv.getCompiler();\n const mainFile = join(distDir, base);\n const _context = Object.assign(context, { mainFile });\n return _context;\n }\n}\n"],"mappings":";;;;;;;;;;;;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,"names":["NodeApp","constructor","name","entry","portRange","nodeEnv","logger","deploy","run","from","to","port","Port","getPort","child","execFile","toString","error","stdout","on","data","console","build","context","base","parse","distDir","getCompiler","mainFile","join","_context","Object","assign"],"sources":["node.application.ts"],"sourcesContent":["import { execFile } from 'child_process';\nimport { parse, join } from 'path';\nimport { Logger } from '@teambit/logger';\nimport { ReactEnv } from '@teambit/react';\nimport { Application, DeployFn, AppBuildContext } from '@teambit/application';\nimport { Port } from '@teambit/toolbox.network.get-port';\nimport { NodeEnv } from './node.env';\nimport { DeployContext } from './node-app-options';\n\nexport class NodeApp implements Application {\n constructor(\n readonly name: string,\n readonly entry: string,\n readonly portRange: number[],\n readonly nodeEnv: NodeEnv & ReactEnv,\n readonly logger: Logger,\n readonly deploy?: DeployFn\n ) {}\n\n applicationType = 'node';\n\n async run(): Promise<number | undefined> {\n const logger = this.logger;\n const [from, to] = this.portRange;\n const port = await Port.getPort(from, to);\n const child = execFile('node', [this.entry, port.toString()], (error) => {\n if (error) {\n throw error;\n }\n });\n child.stdout?.on('data', function (data) {\n logger.console(data.toString());\n });\n return port;\n }\n\n async build(context: AppBuildContext): Promise<DeployContext> {\n const { base } = parse(this.entry);\n const { distDir } = this.nodeEnv.getCompiler();\n const mainFile = join(distDir, base);\n const _context = Object.assign(context, { mainFile });\n return _context;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIO,MAAMA,OAAN,CAAqC;EAC1CC,WAAW,CACAC,IADA,EAEAC,KAFA,EAGAC,SAHA,EAIAC,OAJA,EAKAC,MALA,EAMAC,MANA,EAOT;IAAA,KANSL,IAMT,GANSA,IAMT;IAAA,KALSC,KAKT,GALSA,KAKT;IAAA,KAJSC,SAIT,GAJSA,SAIT;IAAA,KAHSC,OAGT,GAHSA,OAGT;IAAA,KAFSC,MAET,GAFSA,MAET;IAAA,KADSC,MACT,GADSA,MACT;IAAA,yDAEgB,MAFhB;EAAE;;EAIK,MAAHC,GAAG,GAAgC;IAAA;;IACvC,MAAMF,MAAM,GAAG,KAAKA,MAApB;IACA,MAAM,CAACG,IAAD,EAAOC,EAAP,IAAa,KAAKN,SAAxB;IACA,MAAMO,IAAI,GAAG,MAAMC,sBAAA,CAAKC,OAAL,CAAaJ,IAAb,EAAmBC,EAAnB,CAAnB;IACA,MAAMI,KAAK,GAAG,IAAAC,yBAAA,EAAS,MAAT,EAAiB,CAAC,KAAKZ,KAAN,EAAaQ,IAAI,CAACK,QAAL,EAAb,CAAjB,EAAiDC,KAAD,IAAW;MACvE,IAAIA,KAAJ,EAAW;QACT,MAAMA,KAAN;MACD;IACF,CAJa,CAAd;IAKA,iBAAAH,KAAK,CAACI,MAAN,gEAAcC,EAAd,CAAiB,MAAjB,EAAyB,UAAUC,IAAV,EAAgB;MACvCd,MAAM,CAACe,OAAP,CAAeD,IAAI,CAACJ,QAAL,EAAf;IACD,CAFD;IAGA,OAAOL,IAAP;EACD;;EAEU,MAALW,KAAK,CAACC,OAAD,EAAmD;IAC5D,MAAM;MAAEC;IAAF,IAAW,IAAAC,aAAA,EAAM,KAAKtB,KAAX,CAAjB;IACA,MAAM;MAAEuB;IAAF,IAAc,KAAKrB,OAAL,CAAasB,WAAb,EAApB;IACA,MAAMC,QAAQ,GAAG,IAAAC,YAAA,EAAKH,OAAL,EAAcF,IAAd,CAAjB;;IACA,MAAMM,QAAQ,GAAGC,MAAM,CAACC,MAAP,CAAcT,OAAd,EAAuB;MAAEK;IAAF,CAAvB,CAAjB;;IACA,OAAOE,QAAP;EACD;;AAjCyC"}
@@ -151,6 +151,26 @@ function _node4() {
151
151
  return data;
152
152
  }
153
153
 
154
+ function _expressApp() {
155
+ const data = require("./templates/express-app");
156
+
157
+ _expressApp = function () {
158
+ return data;
159
+ };
160
+
161
+ return data;
162
+ }
163
+
164
+ function _expressRoute() {
165
+ const data = require("./templates/express-route");
166
+
167
+ _expressRoute = function () {
168
+ return data;
169
+ };
170
+
171
+ return data;
172
+ }
173
+
154
174
  class NodeMain {
155
175
  constructor(react, tsAspect, nodeEnv, envs) {
156
176
  this.react = react;
@@ -236,7 +256,7 @@ class NodeMain {
236
256
  envs.registerEnv(nodeEnv);
237
257
  const nodeAppType = new (_node4().NodeAppType)('node-app', nodeEnv, logger);
238
258
  application.registerAppType(nodeAppType);
239
- generator.registerComponentTemplate([_nodeEnv().nodeEnvTemplate, _node3().nodeTemplate]);
259
+ generator.registerComponentTemplate([_nodeEnv().nodeEnvTemplate, _node3().nodeTemplate, _expressApp().expressAppTemplate, _expressRoute().expressRouteTemplate]);
240
260
  return new NodeMain(react, tsAspect, nodeEnv, envs);
241
261
  }
242
262
 
@@ -1 +1 @@
1
- {"version":3,"names":["NodeMain","constructor","react","tsAspect","nodeEnv","envs","overrideTsConfig","bind","overrideJestConfig","overrideBuildPipe","overrideCompiler","overrideCompilerTasks","overrideBuildTsConfig","overridePackageJsonProps","overridePreviewConfig","overrideDevServerConfig","useWebpack","usePrettier","useEslint","overrideMounter","icon","useTypescript","modifiers","tsModule","overrides","devTransformers","devConfig","getCompiler","buildTransformers","buildConfig","buildPipeModifiers","tsModifier","transformers","module","getBuildPipe","override","overrideDependencies","dependencyPolicy","getDependencies","merge","compose","targetEnv","provider","loggerAspect","application","generator","logger","createLogger","NodeAspect","id","NodeEnv","reactEnv","registerEnv","nodeAppType","NodeAppType","registerAppType","registerComponentTemplate","nodeEnvTemplate","nodeTemplate","MainRuntime","LoggerAspect","EnvsAspect","ApplicationAspect","ReactAspect","GeneratorAspect","TypescriptAspect","addRuntime"],"sources":["node.main.runtime.ts"],"sourcesContent":["import { EnvPolicyConfigObject } from '@teambit/dependency-resolver';\nimport { merge } from 'lodash';\nimport { TsConfigSourceFile } from 'typescript';\nimport { TsCompilerOptionsWithoutTsConfig, TypescriptAspect, TypescriptMain } from '@teambit/typescript';\nimport { ApplicationAspect, ApplicationMain } from '@teambit/application';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\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, ReactEnv, ReactMain, UseTypescriptModifiers } from '@teambit/react';\nimport { NodeAspect } from './node.aspect';\nimport { NodeEnv } from './node.env';\nimport { nodeEnvTemplate } from './templates/node-env';\nimport { nodeTemplate } from './templates/node';\nimport { NodeAppType } from './node.app-type';\n\nexport class NodeMain {\n constructor(\n private react: ReactMain,\n\n private tsAspect: TypescriptMain,\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(modifiers?: UseTypescriptModifiers, tsModule?: any) {\n const overrides: any = {};\n const devTransformers = modifiers?.devConfig;\n if (devTransformers) {\n overrides.getCompiler = () => this.nodeEnv.getCompiler(devTransformers, tsModule);\n }\n const buildTransformers = modifiers?.buildConfig;\n if (buildTransformers) {\n const buildPipeModifiers = {\n tsModifier: {\n transformers: buildTransformers,\n module: tsModule,\n },\n };\n overrides.getBuildPipe = () => this.nodeEnv.getBuildPipe(buildPipeModifiers);\n }\n return this.envs.override(overrides);\n }\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: EnvPolicyConfigObject) {\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 = [LoggerAspect, EnvsAspect, ApplicationAspect, ReactAspect, GeneratorAspect, TypescriptAspect];\n\n static async provider([loggerAspect, envs, application, react, generator, tsAspect]: [\n LoggerMain,\n EnvsMain,\n ApplicationMain,\n ReactMain,\n GeneratorMain,\n TypescriptMain\n ]) {\n const logger = loggerAspect.createLogger(NodeAspect.id);\n const nodeEnv = envs.merge<NodeEnv, ReactEnv>(new NodeEnv(tsAspect, react), react.reactEnv);\n envs.registerEnv(nodeEnv);\n const nodeAppType = new NodeAppType('node-app', nodeEnv, logger);\n application.registerAppType(nodeAppType);\n generator.registerComponentTemplate([nodeEnvTemplate, nodeTemplate]);\n return new NodeMain(react, tsAspect, nodeEnv, envs);\n }\n}\n\nNodeAspect.addRuntime(NodeMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,QAAN,CAAe;EACpBC,WAAW,CACDC,KADC,EAGDC,QAHC,EAKAC,OALA,EAODC,IAPC,EAQT;IAAA,KAPQH,KAOR,GAPQA,KAOR;IAA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oB,aAARU,QAAQ,CAAC,CAACC,YAAD,EAAetC,IAAf,EAAqBuC,WAArB,EAAkC1C,KAAlC,EAAyC2C,SAAzC,EAAoD1C,QAApD,CAAD,EAOlB;IACD,MAAM2C,MAAM,GAAGH,YAAY,CAACI,YAAb,CAA0BC,kBAAA,CAAWC,EAArC,CAAf;IACA,MAAM7C,OAAO,GAAGC,IAAI,CAACkC,KAAL,CAA8B,KAAIW,gBAAJ,EAAY/C,QAAZ,EAAsBD,KAAtB,CAA9B,EAA4DA,KAAK,CAACiD,QAAlE,CAAhB;IACA9C,IAAI,CAAC+C,WAAL,CAAiBhD,OAAjB;IACA,MAAMiD,WAAW,GAAG,KAAIC,oBAAJ,EAAgB,UAAhB,EAA4BlD,OAA5B,EAAqC0C,MAArC,CAApB;IACAF,WAAW,CAACW,eAAZ,CAA4BF,WAA5B;IACAR,SAAS,CAACW,yBAAV,CAAoC,CAACC,0BAAD,EAAkBC,qBAAlB,CAApC;IACA,OAAO,IAAI1D,QAAJ,CAAaE,KAAb,EAAoBC,QAApB,EAA8BC,OAA9B,EAAuCC,IAAvC,CAAP;EACD;;AApJmB;;;gCAATL,Q,aAkIM2D,kB;gCAlIN3D,Q,kBAmIW,CAAC4D,sBAAD,EAAeC,kBAAf,EAA2BC,gCAA3B,EAA8CC,oBAA9C,EAA2DC,4BAA3D,EAA4EC,8BAA5E,C;;AAoBxBjB,kBAAA,CAAWkB,UAAX,CAAsBlE,QAAtB"}
1
+ {"version":3,"names":["NodeMain","constructor","react","tsAspect","nodeEnv","envs","overrideTsConfig","bind","overrideJestConfig","overrideBuildPipe","overrideCompiler","overrideCompilerTasks","overrideBuildTsConfig","overridePackageJsonProps","overridePreviewConfig","overrideDevServerConfig","useWebpack","usePrettier","useEslint","overrideMounter","icon","useTypescript","modifiers","tsModule","overrides","devTransformers","devConfig","getCompiler","buildTransformers","buildConfig","buildPipeModifiers","tsModifier","transformers","module","getBuildPipe","override","overrideDependencies","dependencyPolicy","getDependencies","merge","compose","targetEnv","provider","loggerAspect","application","generator","logger","createLogger","NodeAspect","id","NodeEnv","reactEnv","registerEnv","nodeAppType","NodeAppType","registerAppType","registerComponentTemplate","nodeEnvTemplate","nodeTemplate","expressAppTemplate","expressRouteTemplate","MainRuntime","LoggerAspect","EnvsAspect","ApplicationAspect","ReactAspect","GeneratorAspect","TypescriptAspect","addRuntime"],"sources":["node.main.runtime.ts"],"sourcesContent":["import { EnvPolicyConfigObject } from '@teambit/dependency-resolver';\nimport { merge } from 'lodash';\nimport { TsConfigSourceFile } from 'typescript';\nimport { TsCompilerOptionsWithoutTsConfig, TypescriptAspect, TypescriptMain } from '@teambit/typescript';\nimport { ApplicationAspect, ApplicationMain } from '@teambit/application';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\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, ReactEnv, ReactMain, UseTypescriptModifiers } from '@teambit/react';\nimport { NodeAspect } from './node.aspect';\nimport { NodeEnv } from './node.env';\nimport { nodeEnvTemplate } from './templates/node-env';\nimport { nodeTemplate } from './templates/node';\nimport { NodeAppType } from './node.app-type';\nimport { expressAppTemplate } from './templates/express-app';\nimport { expressRouteTemplate } from './templates/express-route';\n\nexport class NodeMain {\n constructor(\n private react: ReactMain,\n\n private tsAspect: TypescriptMain,\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(modifiers?: UseTypescriptModifiers, tsModule?: any) {\n const overrides: any = {};\n const devTransformers = modifiers?.devConfig;\n if (devTransformers) {\n overrides.getCompiler = () => this.nodeEnv.getCompiler(devTransformers, tsModule);\n }\n const buildTransformers = modifiers?.buildConfig;\n if (buildTransformers) {\n const buildPipeModifiers = {\n tsModifier: {\n transformers: buildTransformers,\n module: tsModule,\n },\n };\n overrides.getBuildPipe = () => this.nodeEnv.getBuildPipe(buildPipeModifiers);\n }\n return this.envs.override(overrides);\n }\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: EnvPolicyConfigObject) {\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 = [LoggerAspect, EnvsAspect, ApplicationAspect, ReactAspect, GeneratorAspect, TypescriptAspect];\n\n static async provider([loggerAspect, envs, application, react, generator, tsAspect]: [\n LoggerMain,\n EnvsMain,\n ApplicationMain,\n ReactMain,\n GeneratorMain,\n TypescriptMain\n ]) {\n const logger = loggerAspect.createLogger(NodeAspect.id);\n const nodeEnv = envs.merge<NodeEnv, ReactEnv>(new NodeEnv(tsAspect, react), react.reactEnv);\n envs.registerEnv(nodeEnv);\n const nodeAppType = new NodeAppType('node-app', nodeEnv, logger);\n application.registerAppType(nodeAppType);\n generator.registerComponentTemplate([nodeEnvTemplate, nodeTemplate, expressAppTemplate, expressRouteTemplate]);\n return new NodeMain(react, tsAspect, nodeEnv, envs);\n }\n}\n\nNodeAspect.addRuntime(NodeMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;E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AAoBC,QAApB,EAA8BC,OAA9B,EAAuCC,IAAvC,CAAP;EACD;;AApJmB;;;gCAATL,Q,aAkIM6D,kB;gCAlIN7D,Q,kBAmIW,CAAC8D,sBAAD,EAAeC,kBAAf,EAA2BC,gCAA3B,EAA8CC,oBAA9C,EAA2DC,4BAA3D,EAA4EC,8BAA5E,C;;AAoBxBnB,kBAAA,CAAWoB,UAAX,CAAsBpE,QAAtB"}
@@ -0,0 +1,5 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function appRoot(context: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.appRoot = appRoot;
7
+
8
+ function appRoot(context) {
9
+ return {
10
+ relativePath: `${context.name}.app-root.ts`,
11
+ content: `import Application from 'express';
12
+ import {getPort} from './get-port';
13
+ import {getMockRoute} from './mock-route';
14
+
15
+ export const expressApp = async () => {
16
+ const app = Application();
17
+ const port = await getPort();
18
+ registerRoutes(app);
19
+ app.listen(port, () => {
20
+ console.log(\`${context.name} app listening on port \${port}\`);
21
+ });
22
+ };
23
+
24
+ function registerRoutes(app: Application.Application) {
25
+ const mockRoute = getMockRoute();
26
+ const routes = [mockRoute];
27
+ routes.forEach(route => {
28
+ app[route.method](route.route, route.middlewares);
29
+ })
30
+ }
31
+
32
+ expressApp();
33
+ `
34
+ };
35
+ }
36
+
37
+ //# sourceMappingURL=app-root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["appRoot","context","relativePath","name","content"],"sources":["app-root.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function appRoot(context: ComponentContext) {\n return {\n relativePath: `${context.name}.app-root.ts`,\n content: `import Application from 'express';\nimport {getPort} from './get-port';\nimport {getMockRoute} from './mock-route';\n\nexport const expressApp = async () => {\n const app = Application();\n const port = await getPort();\n registerRoutes(app);\n app.listen(port, () => {\n console.log(\\`${context.name} app listening on port \\${port}\\`);\n });\n};\n\nfunction registerRoutes(app: Application.Application) {\n const mockRoute = getMockRoute();\n const routes = [mockRoute];\n routes.forEach(route => {\n app[route.method](route.route, route.middlewares);\n })\n}\n\nexpressApp();\n`,\n };\n}\n"],"mappings":";;;;;;;AAEO,SAASA,OAAT,CAAiBC,OAAjB,EAA4C;EACjD,OAAO;IACLC,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,cADzB;IAELC,OAAO,EAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoBH,OAAO,CAACE,IAAK;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAxBS,CAAP;AA0BD"}
@@ -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,"names":["compositionFile","context","relativePath","name","content","nameCamelCase"],"sources":["composition.ts"],"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"],"mappings":";;;;;;;AAEO,SAASA,eAAT,CAAyBC,OAAzB,EAAoD;EACzD,OAAO;IACLC,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,kBADzB;IAELC,OAAO,EAAG;AACd,WAAWH,OAAO,CAACI,aAAc,cAAaJ,OAAO,CAACE,IAAK;AAC3D;AACA;AACA,iBAAiBF,OAAO,CAACI,aAAc;AACvC;AACA;EARS,CAAP;AAUD"}
@@ -0,0 +1,5 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function docFile({ name, componentId }: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.docFile = docFile;
7
+
8
+ function docFile({
9
+ name,
10
+ componentId
11
+ }) {
12
+ return {
13
+ relativePath: `${name}.docs.mdx`,
14
+ content: `---
15
+ labels: ['express', 'node', 'service', 'app']
16
+ description: 'A general purpose bit express application'
17
+ ---
18
+
19
+ Configure the app plugin on your workspace:
20
+
21
+ \`\`\`json
22
+ "${componentId.toString()}": {},
23
+ \`\`\`
24
+
25
+ ### Run the application
26
+
27
+ You can run your application on a separate port to see it outside of the Bit workspace
28
+
29
+ \`\`\`bash
30
+ bit run ${name}
31
+ \`\`\`
32
+ `
33
+ };
34
+ }
35
+
36
+ //# sourceMappingURL=doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["docFile","name","componentId","relativePath","content","toString"],"sources":["doc.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function docFile({ name, componentId }: ComponentContext) {\n return {\n relativePath: `${name}.docs.mdx`,\n content: `---\nlabels: ['express', 'node', 'service', 'app']\ndescription: 'A general purpose bit express application'\n---\n\nConfigure the app plugin on your workspace:\n\n\\`\\`\\`json\n\"${componentId.toString()}\": {},\n\\`\\`\\`\n\n### Run the application\n\nYou can run your application on a separate port to see it outside of the Bit workspace\n\n\\`\\`\\`bash\nbit run ${name}\n\\`\\`\\`\n`,\n };\n}\n"],"mappings":";;;;;;;AAEO,SAASA,OAAT,CAAiB;EAAEC,IAAF;EAAQC;AAAR,CAAjB,EAA0D;EAC/D,OAAO;IACLC,YAAY,EAAG,GAAEF,IAAK,WADjB;IAELG,OAAO,EAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAGF,WAAW,CAACG,QAAZ,EAAuB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAUJ,IAAK;AACf;AACA;EApBS,CAAP;AAsBD"}
@@ -0,0 +1,4 @@
1
+ export declare function getPort(): {
2
+ relativePath: string;
3
+ content: string;
4
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPort = getPort;
7
+
8
+ function getPort() {
9
+ return {
10
+ relativePath: `get-port.ts`,
11
+ content: `export async function getPort() {
12
+ if (process.env.PORT){
13
+ return process.env.PORT;
14
+ }
15
+ const myArgs = process.argv.slice(2);
16
+ return myArgs[0] || 3000;
17
+ }
18
+ `
19
+ };
20
+ }
21
+
22
+ //# sourceMappingURL=get-port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getPort","relativePath","content"],"sources":["get-port.ts"],"sourcesContent":["export function getPort() {\n return {\n relativePath: `get-port.ts`,\n content: `export async function getPort() {\n if (process.env.PORT){\n return process.env.PORT;\n }\n const myArgs = process.argv.slice(2);\n return myArgs[0] || 3000;\n}\n`,\n };\n}\n"],"mappings":";;;;;;;AAAO,SAASA,OAAT,GAAmB;EACxB,OAAO;IACLC,YAAY,EAAG,aADV;IAELC,OAAO,EAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;EATS,CAAP;AAWD"}
@@ -0,0 +1,6 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function indexFile(context: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ isMain: boolean;
6
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.indexFile = indexFile;
7
+
8
+ function indexFile(context) {
9
+ return {
10
+ relativePath: 'index.ts',
11
+ content: `export { expressApp } from './${context.name}.app-root';
12
+ export type { Route } from './route';
13
+ `,
14
+ isMain: true
15
+ };
16
+ }
17
+
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["indexFile","context","relativePath","content","name","isMain"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile(context: ComponentContext) {\n return {\n relativePath: 'index.ts',\n content: `export { expressApp } from './${context.name}.app-root';\nexport type { Route } from './route';\n`,\n isMain: true,\n };\n}\n"],"mappings":";;;;;;;AAEO,SAASA,SAAT,CAAmBC,OAAnB,EAA8C;EACnD,OAAO;IACLC,YAAY,EAAE,UADT;IAELC,OAAO,EAAG,iCAAgCF,OAAO,CAACG,IAAK;AAC3D;AACA,CAJS;IAKLC,MAAM,EAAE;EALH,CAAP;AAOD"}
@@ -0,0 +1,4 @@
1
+ export declare function mockRoute(): {
2
+ relativePath: string;
3
+ content: string;
4
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mockRoute = mockRoute;
7
+
8
+ function mockRoute() {
9
+ return {
10
+ relativePath: `mock-route.ts`,
11
+ content: `import type { Route } from './route';
12
+
13
+ export function getMockRoute(): Route {
14
+ return {
15
+ method: 'get',
16
+ route: '/',
17
+ middlewares: [async (req, res) => res.send('hello world')]
18
+ }
19
+ }
20
+ `
21
+ };
22
+ }
23
+
24
+ //# sourceMappingURL=mock-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["mockRoute","relativePath","content"],"sources":["mock-route.ts"],"sourcesContent":["export function mockRoute() {\n return {\n relativePath: `mock-route.ts`,\n content: `import type { Route } from './route';\n\nexport function getMockRoute(): Route {\n return {\n method: 'get',\n route: '/',\n middlewares: [async (req, res) => res.send('hello world')]\n }\n}\n`,\n };\n}\n"],"mappings":";;;;;;;AAAO,SAASA,SAAT,GAAqB;EAC1B,OAAO;IACLC,YAAY,EAAG,eADV;IAELC,OAAO,EAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAXS,CAAP;AAaD"}
@@ -0,0 +1,5 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function nodeApp(context: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.nodeApp = nodeApp;
7
+
8
+ function nodeApp(context) {
9
+ return {
10
+ relativePath: `${context.name}.node-app.ts`,
11
+ content: `import { NodeAppOptions } from '@teambit/node';
12
+
13
+ export const ${context.nameCamelCase}: NodeAppOptions = {
14
+ name: '${context.name}',
15
+ entry: require.resolve('./${context.name}.app-root'),
16
+ portRange: [3000, 4000]
17
+ };
18
+
19
+ export default ${context.nameCamelCase};
20
+ `
21
+ };
22
+ }
23
+
24
+ //# sourceMappingURL=node-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["nodeApp","context","relativePath","name","content","nameCamelCase"],"sources":["node-app.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function nodeApp(context: ComponentContext) {\n return {\n relativePath: `${context.name}.node-app.ts`,\n content: `import { NodeAppOptions } from '@teambit/node';\n\nexport const ${context.nameCamelCase}: NodeAppOptions = {\n name: '${context.name}',\n entry: require.resolve('./${context.name}.app-root'),\n portRange: [3000, 4000]\n};\n\nexport default ${context.nameCamelCase};\n`,\n };\n}\n"],"mappings":";;;;;;;AAEO,SAASA,OAAT,CAAiBC,OAAjB,EAA4C;EACjD,OAAO;IACLC,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,cADzB;IAELC,OAAO,EAAG;AACd;AACA,eAAeH,OAAO,CAACI,aAAc;AACrC,WAAWJ,OAAO,CAACE,IAAK;AACxB,8BAA8BF,OAAO,CAACE,IAAK;AAC3C;AACA;AACA;AACA,iBAAiBF,OAAO,CAACI,aAAc;AACvC;EAXS,CAAP;AAaD"}
@@ -0,0 +1,4 @@
1
+ export declare function route(): {
2
+ relativePath: string;
3
+ content: string;
4
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.route = route;
7
+
8
+ function route() {
9
+ return {
10
+ relativePath: `route.ts`,
11
+ content: `import express, { Request, Response } from 'express';
12
+
13
+ /**
14
+ * define express Middleware
15
+ */
16
+ export type Middleware = (req: Request, res: Response, next: express.NextFunction) => Promise<any>;
17
+
18
+ /**
19
+ * express new Route
20
+ */
21
+ export interface Route {
22
+ method: string;
23
+ route: string | RegExp;
24
+ middlewares: Middleware[];
25
+ }
26
+ `
27
+ };
28
+ }
29
+
30
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["route","relativePath","content"],"sources":["route.ts"],"sourcesContent":["export function route() {\n return {\n relativePath: `route.ts`,\n content: `import express, { Request, Response } from 'express';\n\n/**\n * define express Middleware\n */\nexport type Middleware = (req: Request, res: Response, next: express.NextFunction) => Promise<any>;\n\n/**\n * express new Route\n */\nexport interface Route {\n method: string;\n route: string | RegExp;\n middlewares: Middleware[];\n}\n`,\n };\n}\n"],"mappings":";;;;;;;AAAO,SAASA,KAAT,GAAiB;EACtB,OAAO;IACLC,YAAY,EAAG,UADV;IAELC,OAAO,EAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAjBS,CAAP;AAmBD"}
@@ -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,"names":["testFile","context","relativePath","name","content","nameCamelCase"],"sources":["test.ts"],"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"],"mappings":";;;;;;;AAEO,SAASA,QAAT,CAAkBC,OAAlB,EAA6C;EAClD,OAAO;IACLC,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,UADzB;IAELC,OAAO,EAAG,YAAWH,OAAO,CAACI,aAAc,cAAaJ,OAAO,CAACE,IAAK;AACzE;AACA;AACA,WAAWF,OAAO,CAACI,aAAc;AACjC;AACA;EAPS,CAAP;AASD"}
@@ -0,0 +1,2 @@
1
+ import { ComponentTemplate } from '@teambit/generator';
2
+ export declare const expressAppTemplate: ComponentTemplate;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.expressAppTemplate = void 0;
7
+
8
+ function _index() {
9
+ const data = require("./files/index");
10
+
11
+ _index = function () {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _doc() {
19
+ const data = require("./files/doc");
20
+
21
+ _doc = function () {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _appRoot() {
29
+ const data = require("./files/app-root");
30
+
31
+ _appRoot = function () {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _nodeApp() {
39
+ const data = require("./files/node-app");
40
+
41
+ _nodeApp = function () {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ function _getPort() {
49
+ const data = require("./files/get-port");
50
+
51
+ _getPort = function () {
52
+ return data;
53
+ };
54
+
55
+ return data;
56
+ }
57
+
58
+ function _mockRoute() {
59
+ const data = require("./files/mock-route");
60
+
61
+ _mockRoute = function () {
62
+ return data;
63
+ };
64
+
65
+ return data;
66
+ }
67
+
68
+ function _route() {
69
+ const data = require("./files/route");
70
+
71
+ _route = function () {
72
+ return data;
73
+ };
74
+
75
+ return data;
76
+ }
77
+
78
+ // import { testFile } from './files/test';
79
+ // import { compositionFile } from './files/composition';
80
+ const expressAppTemplate = {
81
+ name: 'express-app',
82
+ description: 'a bit express application',
83
+ generateFiles: context => {
84
+ return [(0, _index().indexFile)(context), (0, _doc().docFile)(context), (0, _appRoot().appRoot)(context), (0, _nodeApp().nodeApp)(context), (0, _getPort().getPort)(), (0, _mockRoute().mockRoute)(), (0, _route().route)() // compositionFile(context),
85
+ // testFile(context),
86
+ ];
87
+ },
88
+ config: {
89
+ 'teambit.harmony/aspect': {},
90
+ 'teambit.envs/envs': {
91
+ env: 'teambit.harmony/aspect'
92
+ }
93
+ }
94
+ };
95
+ exports.expressAppTemplate = expressAppTemplate;
96
+
97
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["expressAppTemplate","name","description","generateFiles","context","indexFile","docFile","appRoot","nodeApp","getPort","mockRoute","route","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { docFile } from './files/doc';\nimport { appRoot } from './files/app-root';\nimport { nodeApp } from './files/node-app';\nimport { getPort } from './files/get-port';\nimport { mockRoute } from './files/mock-route';\nimport { route } from './files/route';\n// import { testFile } from './files/test';\n// import { compositionFile } from './files/composition';\n\nexport const expressAppTemplate: ComponentTemplate = {\n name: 'express-app',\n description: 'a bit express application',\n generateFiles: (context: ComponentContext) => {\n return [\n indexFile(context),\n docFile(context),\n appRoot(context),\n nodeApp(context),\n getPort(),\n mockRoute(),\n route(),\n // compositionFile(context),\n // testFile(context),\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;AACA;AAEO,MAAMA,kBAAqC,GAAG;EACnDC,IAAI,EAAE,aAD6C;EAEnDC,WAAW,EAAE,2BAFsC;EAGnDC,aAAa,EAAGC,OAAD,IAA+B;IAC5C,OAAO,CACL,IAAAC,kBAAA,EAAUD,OAAV,CADK,EAEL,IAAAE,cAAA,EAAQF,OAAR,CAFK,EAGL,IAAAG,kBAAA,EAAQH,OAAR,CAHK,EAIL,IAAAI,kBAAA,EAAQJ,OAAR,CAJK,EAKL,IAAAK,kBAAA,GALK,EAML,IAAAC,sBAAA,GANK,EAOL,IAAAC,cAAA,GAPK,CAQL;IACA;IATK,CAAP;EAWD,CAfkD;EAgBnDC,MAAM,EAAE;IACN,0BAA0B,EADpB;IAEN,qBAAqB;MACnBC,GAAG,EAAE;IADc;EAFf;AAhB2C,CAA9C"}
@@ -0,0 +1,5 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function compositionFile(context: ComponentContext): {
3
+ relativePath: string;
4
+ content: string;
5
+ };