@teambit/node 0.0.763 → 0.0.766
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/env-template/public/{860.js → 177.js} +2 -2
- package/artifacts/env-template/public/875.js +8 -8
- package/artifacts/env-template/public/assets-manifest.json +8 -8
- package/artifacts/env-template/public/{compositions.9256ff3c4e469b6f74ff.js → compositions.2c407bb7c34bc7d64512.js} +1 -1
- package/artifacts/env-template/public/compositions.html +1 -1
- package/artifacts/env-template/public/overview.65a32f1b04d9875542b4.js +5 -0
- package/artifacts/env-template/public/overview.html +1 -1
- package/artifacts/env-template/public/{preview-root.8d046235b2f5aa2700dd.js → preview-root.51231b284e3c62a69810.js} +1 -1
- package/artifacts/preview/teambit_harmony_node-preview.js +2 -2
- package/{compositions-1655373564849.js → compositions-1655695598583.js} +0 -0
- package/dist/node.application.d.ts +1 -1
- package/dist/node.application.js +16 -1
- package/dist/node.application.js.map +1 -1
- package/dist/node.main.runtime.js +21 -1
- package/dist/node.main.runtime.js.map +1 -1
- package/dist/templates/express-app/files/app-root.d.ts +5 -0
- package/dist/templates/express-app/files/app-root.js +37 -0
- package/dist/templates/express-app/files/app-root.js.map +1 -0
- package/dist/templates/express-app/files/composition.d.ts +5 -0
- package/dist/templates/express-app/files/composition.js +21 -0
- package/dist/templates/express-app/files/composition.js.map +1 -0
- package/dist/templates/express-app/files/doc.d.ts +5 -0
- package/dist/templates/express-app/files/doc.js +36 -0
- package/dist/templates/express-app/files/doc.js.map +1 -0
- package/dist/templates/express-app/files/get-port.d.ts +4 -0
- package/dist/templates/express-app/files/get-port.js +22 -0
- package/dist/templates/express-app/files/get-port.js.map +1 -0
- package/dist/templates/express-app/files/index.d.ts +6 -0
- package/dist/templates/express-app/files/index.js +18 -0
- package/dist/templates/express-app/files/index.js.map +1 -0
- package/dist/templates/express-app/files/mock-route.d.ts +4 -0
- package/dist/templates/express-app/files/mock-route.js +24 -0
- package/dist/templates/express-app/files/mock-route.js.map +1 -0
- package/dist/templates/express-app/files/node-app.d.ts +5 -0
- package/dist/templates/express-app/files/node-app.js +24 -0
- package/dist/templates/express-app/files/node-app.js.map +1 -0
- package/dist/templates/express-app/files/route.d.ts +4 -0
- package/dist/templates/express-app/files/route.js +30 -0
- package/dist/templates/express-app/files/route.js.map +1 -0
- package/dist/templates/express-app/files/test.d.ts +5 -0
- package/dist/templates/express-app/files/test.js +20 -0
- package/dist/templates/express-app/files/test.js.map +1 -0
- package/dist/templates/express-app/index.d.ts +2 -0
- package/dist/templates/express-app/index.js +97 -0
- package/dist/templates/express-app/index.js.map +1 -0
- package/dist/templates/express-route/files/composition.d.ts +5 -0
- package/dist/templates/express-route/files/composition.js +21 -0
- package/dist/templates/express-route/files/composition.js.map +1 -0
- package/dist/templates/express-route/files/doc.d.ts +5 -0
- package/dist/templates/express-route/files/doc.js +25 -0
- package/dist/templates/express-route/files/doc.js.map +1 -0
- package/dist/templates/express-route/files/index.d.ts +6 -0
- package/dist/templates/express-route/files/index.js +17 -0
- package/dist/templates/express-route/files/index.js.map +1 -0
- package/dist/templates/express-route/files/main.d.ts +5 -0
- package/dist/templates/express-route/files/main.js +22 -0
- package/dist/templates/express-route/files/main.js.map +1 -0
- package/dist/templates/express-route/files/test.d.ts +5 -0
- package/dist/templates/express-route/files/test.js +20 -0
- package/dist/templates/express-route/files/test.js.map +1 -0
- package/dist/templates/express-route/index.d.ts +2 -0
- package/dist/templates/express-route/index.js +57 -0
- package/dist/templates/express-route/index.js.map +1 -0
- package/{overview-1655373564849.js → overview-1655695598583.js} +0 -0
- package/package-tar/teambit-node-0.0.766.tgz +0 -0
- package/package.json +17 -16
- package/{preview-1655373564849.js → preview-1655695598583.js} +2 -2
- package/templates/express-app/files/app-root.ts +30 -0
- package/templates/express-app/files/composition.ts +14 -0
- package/templates/express-app/files/doc.ts +26 -0
- package/templates/express-app/files/get-port.ts +13 -0
- package/templates/express-app/files/index.ts +11 -0
- package/templates/express-app/files/mock-route.ts +15 -0
- package/templates/express-app/files/node-app.ts +17 -0
- package/templates/express-app/files/route.ts +21 -0
- package/templates/express-app/files/test.ts +13 -0
- package/templates/express-app/index.ts +34 -0
- package/templates/express-route/files/composition.ts +14 -0
- package/templates/express-route/files/doc.ts +18 -0
- package/templates/express-route/files/index.ts +10 -0
- package/templates/express-route/files/main.ts +15 -0
- package/templates/express-route/files/test.ts +13 -0
- package/templates/express-route/index.ts +26 -0
- package/artifacts/env-template/public/overview.ac2c2d6bb18d797aabab.js +0 -5
- package/package-tar/teambit-node-0.0.763.tgz +0 -0
|
@@ -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,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,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,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,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,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,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,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,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,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,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.docFile = docFile;
|
|
7
|
+
|
|
8
|
+
function docFile(context) {
|
|
9
|
+
return {
|
|
10
|
+
relativePath: `${context.name}.docs.mdx`,
|
|
11
|
+
content: `---
|
|
12
|
+
labels: ['express', 'node', 'route']
|
|
13
|
+
description: 'An express route'
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
API:
|
|
17
|
+
|
|
18
|
+
\`\`\`ts
|
|
19
|
+
function get${context.namePascalCase}Route()
|
|
20
|
+
\`\`\`
|
|
21
|
+
`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["docFile","context","relativePath","name","content","namePascalCase"],"sources":["doc.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function docFile(context: ComponentContext) {\n return {\n relativePath: `${context.name}.docs.mdx`,\n content: `---\nlabels: ['express', 'node', 'route']\ndescription: 'An express route'\n---\n\nAPI:\n\n\\`\\`\\`ts\nfunction get${context.namePascalCase}Route()\n\\`\\`\\`\n`,\n };\n}\n"],"mappings":";;;;;;;AAEO,SAASA,OAAT,CAAiBC,OAAjB,EAA4C;EACjD,OAAO;IACLC,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,WADzB;IAELC,OAAO,EAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcH,OAAO,CAACI,cAAe;AACrC;AACA;EAZS,CAAP;AAcD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { get${context.namePascalCase}Route } from './${context.name}';
|
|
12
|
+
`,
|
|
13
|
+
isMain: true
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["indexFile","context","relativePath","content","namePascalCase","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 { get${context.namePascalCase}Route } from './${context.name}';\n`,\n isMain: true,\n };\n}\n"],"mappings":";;;;;;;AAEO,SAASA,SAAT,CAAmBC,OAAnB,EAA8C;EACnD,OAAO;IACLC,YAAY,EAAE,UADT;IAELC,OAAO,EAAG,eAAcF,OAAO,CAACG,cAAe,mBAAkBH,OAAO,CAACI,IAAK;AAClF,CAHS;IAILC,MAAM,EAAE;EAJH,CAAP;AAMD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mainFile = mainFile;
|
|
7
|
+
|
|
8
|
+
function mainFile(context) {
|
|
9
|
+
return {
|
|
10
|
+
relativePath: `${context.name}.ts`,
|
|
11
|
+
content: `export function get${context.namePascalCase}Route() {
|
|
12
|
+
return {
|
|
13
|
+
method: 'get',
|
|
14
|
+
route: '/${context.name}',
|
|
15
|
+
middlewares: [async (req, res) => res.send('${context.name} response')]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["mainFile","context","relativePath","name","content","namePascalCase"],"sources":["main.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function mainFile(context: ComponentContext) {\n return {\n relativePath: `${context.name}.ts`,\n content: `export function get${context.namePascalCase}Route() {\n return {\n method: 'get',\n route: '/${context.name}',\n middlewares: [async (req, res) => res.send('${context.name} response')]\n }\n}\n`,\n };\n}\n"],"mappings":";;;;;;;AAEO,SAASA,QAAT,CAAkBC,OAAlB,EAA6C;EAClD,OAAO;IACLC,YAAY,EAAG,GAAED,OAAO,CAACE,IAAK,KADzB;IAELC,OAAO,EAAG,sBAAqBH,OAAO,CAACI,cAAe;AAC1D;AACA;AACA,eAAeJ,OAAO,CAACE,IAAK;AAC5B,kDAAkDF,OAAO,CAACE,IAAK;AAC/D;AACA;AACA;EATS,CAAP;AAWD"}
|
|
@@ -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,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.expressRouteTemplate = 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 _main() {
|
|
29
|
+
const data = require("./files/main");
|
|
30
|
+
|
|
31
|
+
_main = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// import { testFile } from './files/test';
|
|
39
|
+
// import { compositionFile } from './files/composition';
|
|
40
|
+
const expressRouteTemplate = {
|
|
41
|
+
name: 'express-route',
|
|
42
|
+
description: 'an express route',
|
|
43
|
+
generateFiles: context => {
|
|
44
|
+
return [(0, _index().indexFile)(context), (0, _doc().docFile)(context), (0, _main().mainFile)(context) // compositionFile(context),
|
|
45
|
+
// testFile(context)
|
|
46
|
+
];
|
|
47
|
+
},
|
|
48
|
+
config: {
|
|
49
|
+
'teambit.harmony/node': {},
|
|
50
|
+
'teambit.envs/envs': {
|
|
51
|
+
env: 'teambit.harmony/node'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.expressRouteTemplate = expressRouteTemplate;
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["expressRouteTemplate","name","description","generateFiles","context","indexFile","docFile","mainFile","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { docFile } from './files/doc';\nimport { mainFile } from './files/main';\n// import { testFile } from './files/test';\n// import { compositionFile } from './files/composition';\n\nexport const expressRouteTemplate: ComponentTemplate = {\n name: 'express-route',\n description: 'an express route',\n generateFiles: (context: ComponentContext) => {\n return [\n indexFile(context),\n docFile(context),\n mainFile(context),\n // compositionFile(context),\n // testFile(context)\n ];\n },\n config: {\n 'teambit.harmony/node': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/node',\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;AACA;AAEO,MAAMA,oBAAuC,GAAG;EACrDC,IAAI,EAAE,eAD+C;EAErDC,WAAW,EAAE,kBAFwC;EAGrDC,aAAa,EAAGC,OAAD,IAA+B;IAC5C,OAAO,CACL,IAAAC,kBAAA,EAAUD,OAAV,CADK,EAEL,IAAAE,cAAA,EAAQF,OAAR,CAFK,EAGL,IAAAG,gBAAA,EAASH,OAAT,CAHK,CAIL;IACA;IALK,CAAP;EAOD,CAXoD;EAYrDI,MAAM,EAAE;IACN,wBAAwB,EADlB;IAEN,qBAAqB;MACnBC,GAAG,EAAE;IADc;EAFf;AAZ6C,CAAhD"}
|
|
File without changes
|
|
Binary file
|