@teambit/node 0.0.565 → 0.0.569

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.
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+
3
+ export const Logo = () => (
4
+ <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>
5
+ <img style={{ width: 70 }} src="https://static.bit.dev/brands/logo-nodejs.svg" />
6
+ </div>
7
+ );
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { CompositionsAspect, CompositionsUI } from '@teambit/compositions';
3
+ import { UIRuntime } from '@teambit/ui';
4
+ import { TesterAspect, TesterUI } from '@teambit/tester';
5
+ import { EmptyBox } from '@teambit/design.ui.empty-box';
6
+ import { NodeAspect } from './node.aspect';
7
+
8
+ export class NodeEnvUI {
9
+ static runtime = UIRuntime;
10
+ static slots = [];
11
+ static dependencies = [CompositionsAspect, TesterAspect];
12
+
13
+ static async provider([compositionsUI, testerUi]: [CompositionsUI, TesterUI]) {
14
+ const nodeEnvUI = new NodeEnvUI();
15
+
16
+ testerUi.registerEmptyState(() => {
17
+ return (
18
+ <EmptyBox
19
+ title="This component doesn’t have any tests."
20
+ linkText="Learn how to add tests to your node components"
21
+ link="https://harmony-docs.bit.dev/testing/overview/"
22
+ />
23
+ );
24
+ });
25
+
26
+ compositionsUI.registerEmptyState(() => {
27
+ return (
28
+ <EmptyBox
29
+ title="This component doesn’t have any compositions."
30
+ linkText="Learn how to add compositions to your node components"
31
+ link="https://harmony-docs.bit.dev/compositions/overview/"
32
+ />
33
+ );
34
+ });
35
+
36
+ return nodeEnvUI;
37
+ }
38
+ }
39
+
40
+ NodeAspect.addRuntime(NodeEnvUI);
41
+
42
+ export default NodeEnvUI;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/node",
3
- "version": "0.0.565",
3
+ "version": "0.0.569",
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.565"
9
+ "version": "0.0.569"
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.565",
18
- "@teambit/envs": "0.0.565",
19
- "@teambit/builder": "0.0.565",
20
- "@teambit/cli": "0.0.392",
21
- "@teambit/compiler": "0.0.565",
22
- "@teambit/generator": "0.0.565",
23
- "@teambit/pkg": "0.0.565",
24
- "@teambit/react": "0.0.565",
25
- "@teambit/typescript": "0.0.565",
26
- "@teambit/compositions": "0.0.565",
17
+ "@teambit/dependency-resolver": "0.0.569",
18
+ "@teambit/envs": "0.0.569",
19
+ "@teambit/builder": "0.0.569",
20
+ "@teambit/cli": "0.0.395",
21
+ "@teambit/compiler": "0.0.569",
22
+ "@teambit/generator": "0.0.569",
23
+ "@teambit/pkg": "0.0.569",
24
+ "@teambit/react": "0.0.569",
25
+ "@teambit/typescript": "0.0.569",
26
+ "@teambit/compositions": "0.0.569",
27
27
  "@teambit/design.ui.empty-box": "0.0.352",
28
- "@teambit/tester": "0.0.565",
29
- "@teambit/ui": "0.0.565"
28
+ "@teambit/tester": "0.0.569",
29
+ "@teambit/ui": "0.0.569"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "^17.0.8",
@@ -36,10 +36,10 @@
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.111"
39
+ "@teambit/harmony.aspect-docs.node": "0.0.115"
40
40
  },
41
41
  "peerDependencies": {
42
- "@teambit/legacy": "1.0.178",
42
+ "@teambit/legacy": "1.0.181",
43
43
  "react-dom": "^16.8.0 || ^17.0.0",
44
44
  "react": "^16.8.0 || ^17.0.0"
45
45
  },
@@ -67,27 +67,12 @@
67
67
  "react": "-"
68
68
  },
69
69
  "peerDependencies": {
70
- "@teambit/legacy": "1.0.178",
70
+ "@teambit/legacy": "1.0.181",
71
71
  "react-dom": "^16.8.0 || ^17.0.0",
72
72
  "react": "^16.8.0 || ^17.0.0"
73
73
  }
74
74
  }
75
75
  },
76
- "files": [
77
- "dist",
78
- "!dist/tsconfig.tsbuildinfo",
79
- "**/*.md",
80
- "**/*.mdx",
81
- "**/*.js",
82
- "**/*.json",
83
- "**/*.sass",
84
- "**/*.scss",
85
- "**/*.less",
86
- "**/*.css",
87
- "**/*.css",
88
- "**/*.jpeg",
89
- "**/*.gif"
90
- ],
91
76
  "private": false,
92
77
  "engines": {
93
78
  "node": ">=12.22.0"
File without changes
@@ -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
+ }
@@ -0,0 +1,18 @@
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']
8
+ description: 'A general purpose node module'
9
+ ---
10
+
11
+ API:
12
+
13
+ \`\`\`ts
14
+ function ${context.nameCamelCase}(): string;
15
+ \`\`\`
16
+ `,
17
+ };
18
+ }
@@ -0,0 +1,10 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+
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
+ };
10
+ }
@@ -0,0 +1,11 @@
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
+ };
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
+ }
@@ -0,0 +1,14 @@
1
+ import { ComponentContext, ComponentTemplate } from '@teambit/generator';
2
+ import { indexFile } from './files/index';
3
+ import { docFile } from './files/doc';
4
+ import { mainFile } from './files/main';
5
+ import { testFile } from './files/test';
6
+ import { compositionFile } from './files/composition';
7
+
8
+ export const nodeTemplate: ComponentTemplate = {
9
+ name: 'node',
10
+ description: 'a Node.js module',
11
+ generateFiles: (context: ComponentContext) => {
12
+ return [indexFile(context), docFile(context), mainFile(context), compositionFile(context), testFile(context)];
13
+ },
14
+ };
@@ -0,0 +1,11 @@
1
+ export function docFile() {
2
+ return `---
3
+ labels: ['extension', 'node', 'env', 'environment']
4
+ description: 'A customized extension for Node environment.'
5
+ ---
6
+
7
+ This is a customized extension for Node, based of the [Node Aspect](https://bit.dev/teambit/harmony/node).
8
+
9
+ Explain here the modified configurations and tools applied.
10
+ `;
11
+ }
@@ -0,0 +1,25 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+
3
+ export function extensionFile({ namePascalCase: Name }: ComponentContext) {
4
+ return `import { EnvsMain, EnvsAspect } from '@teambit/envs'
5
+ import { NodeAspect, NodeMain } from '@teambit/node'
6
+
7
+ export class ${Name}Extension {
8
+ constructor(private node: NodeMain) {}
9
+
10
+ static dependencies: any = [EnvsAspect, NodeAspect]
11
+
12
+ static async provider([envs, node]: [EnvsMain, NodeMain]) {
13
+ const ${Name}Env = node.compose([
14
+ /*
15
+ Use any of the "node.override..." transformers to
16
+ */
17
+ ])
18
+
19
+ envs.registerEnv(${Name}Env)
20
+
21
+ return new ${Name}Extension(node)
22
+ }
23
+ }
24
+ `;
25
+ }
@@ -0,0 +1,8 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+
3
+ export function indexFile({ namePascalCase: Name, name }: ComponentContext) {
4
+ return `import { ${Name}Extension } from './${name}.extension';
5
+ export { ${Name}Extension };
6
+ export default ${Name}Extension;
7
+ `;
8
+ }
@@ -0,0 +1,26 @@
1
+ import { ComponentContext, ComponentTemplate } from '@teambit/generator';
2
+ import { indexFile } from './files/index';
3
+ import { docFile } from './files/doc';
4
+ import { extensionFile } from './files/extension';
5
+
6
+ export const nodeEnvTemplate: ComponentTemplate = {
7
+ name: 'node-env',
8
+ description: 'customize the base Node env with your configs and tools',
9
+ generateFiles: (context: ComponentContext) => {
10
+ return [
11
+ {
12
+ relativePath: 'index.ts',
13
+ content: indexFile(context),
14
+ isMain: true,
15
+ },
16
+ {
17
+ relativePath: `${context.name}.docs.mdx`,
18
+ content: docFile(),
19
+ },
20
+ {
21
+ relativePath: `${context.name}.extension.ts`,
22
+ content: extensionFile(context),
23
+ },
24
+ ];
25
+ },
26
+ };
@@ -0,0 +1,29 @@
1
+ declare module '*.png' {
2
+ const value: any;
3
+ export = value;
4
+ }
5
+ declare module '*.svg' {
6
+ import type { FunctionComponent, SVGProps } from 'react';
7
+
8
+ export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
9
+ const src: string;
10
+ export default src;
11
+ }
12
+
13
+ // @TODO Gilad
14
+ declare module '*.jpg' {
15
+ const value: any;
16
+ export = value;
17
+ }
18
+ declare module '*.jpeg' {
19
+ const value: any;
20
+ export = value;
21
+ }
22
+ declare module '*.gif' {
23
+ const value: any;
24
+ export = value;
25
+ }
26
+ declare module '*.bmp' {
27
+ const value: any;
28
+ export = value;
29
+ }
@@ -0,0 +1,42 @@
1
+ declare module '*.module.css' {
2
+ const classes: { readonly [key: string]: string };
3
+ export default classes;
4
+ }
5
+ declare module '*.module.scss' {
6
+ const classes: { readonly [key: string]: string };
7
+ export default classes;
8
+ }
9
+ declare module '*.module.sass' {
10
+ const classes: { readonly [key: string]: string };
11
+ export default classes;
12
+ }
13
+
14
+ declare module '*.module.less' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+
19
+ declare module '*.less' {
20
+ const classes: { readonly [key: string]: string };
21
+ export default classes;
22
+ }
23
+
24
+ declare module '*.css' {
25
+ const classes: { readonly [key: string]: string };
26
+ export default classes;
27
+ }
28
+
29
+ declare module '*.sass' {
30
+ const classes: { readonly [key: string]: string };
31
+ export default classes;
32
+ }
33
+
34
+ declare module '*.scss' {
35
+ const classes: { readonly [key: string]: string };
36
+ export default classes;
37
+ }
38
+
39
+ declare module '*.mdx' {
40
+ const component: any;
41
+ export default component;
42
+ }