@teambit/node 0.0.554 → 0.0.558

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.
@@ -14,21 +14,72 @@ export declare class NodeMain {
14
14
  private envs;
15
15
  constructor(react: ReactMain, nodeEnv: NodeEnv, envs: EnvsMain);
16
16
  icon(): string;
17
+ /**
18
+ * @deprecated use useTypescript()
19
+ * override the TS config of the environment.
20
+ */
17
21
  overrideTsConfig: (tsconfig: TsConfigSourceFile, compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>, tsModule?: any) => EnvTransformer;
22
+ /**
23
+ * override the jest config of the environment.
24
+ */
18
25
  overrideJestConfig: (jestConfigPath: string, jestModulePath?: string | undefined) => EnvTransformer;
26
+ /**
27
+ * override the env build pipeline.
28
+ */
19
29
  overrideBuildPipe: (tasks: BuildTask[]) => EnvTransformer;
30
+ /**
31
+ * override the env compilers list.
32
+ */
20
33
  overrideCompiler: (compiler: Compiler) => EnvTransformer;
34
+ /**
35
+ * override the env compilers tasks in the build pipe.
36
+ */
21
37
  overrideCompilerTasks: (tasks: BuildTask[]) => EnvTransformer;
38
+ /**
39
+ * @deprecated use useTypescript()
40
+ * override the build ts config.
41
+ */
22
42
  overrideBuildTsConfig: (tsconfig: any, compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>) => EnvTransformer;
43
+ /**
44
+ * override package json properties.
45
+ */
23
46
  overridePackageJsonProps: (props: PackageJsonProps) => EnvTransformer;
47
+ /**
48
+ * @deprecated - use useWebpack
49
+ * override the preview config in the env.
50
+ */
24
51
  overridePreviewConfig: (config: import("webpack").Configuration) => EnvTransformer;
52
+ /**
53
+ * @deprecated - use useWebpack
54
+ * override the dev server configuration.
55
+ */
25
56
  overrideDevServerConfig: (config: import("webpack").Configuration) => EnvTransformer;
57
+ /**
58
+ * override the env's typescript config for both dev and build time.
59
+ * Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig)
60
+ */
26
61
  useTypescript: (modifiers?: import("@teambit/react").UseTypescriptModifiers | undefined, tsModule?: any) => EnvTransformer;
62
+ /**
63
+ * override the env's dev server and preview webpack configurations.
64
+ * Replaces both overrideDevServerConfig and overridePreviewConfig
65
+ */
27
66
  useWebpack: (modifiers?: import("@teambit/react").UseWebpackModifiers | undefined) => EnvTransformer;
67
+ /**
68
+ * An API to mutate the prettier config
69
+ */
28
70
  usePrettier: (modifiers?: import("@teambit/react/react.main.runtime").UsePrettierModifiers | undefined) => EnvTransformer;
71
+ /**
72
+ * An API to mutate the eslint config
73
+ */
29
74
  useEslint: (modifiers?: import("@teambit/react/react.main.runtime").UseEslintModifiers | undefined) => EnvTransformer;
75
+ /**
76
+ * override the dependency configuration of the component environment.
77
+ */
30
78
  overrideDependencies(dependencyPolicy: VariantPolicyConfigObject): EnvTransformer;
31
79
  overrideMounter: (mounterPath: string) => EnvTransformer;
80
+ /**
81
+ * create a new composition of the node environment.
82
+ */
32
83
  compose(transformers: EnvTransformer[], targetEnv?: Environment): Environment;
33
84
  static runtime: import("@teambit/harmony").RuntimeDefinition;
34
85
  static dependencies: import("@teambit/harmony").Aspect[];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/node",
3
- "version": "0.0.554",
3
+ "version": "0.0.558",
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.554"
9
+ "version": "0.0.558"
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.554",
18
- "@teambit/envs": "0.0.554",
19
- "@teambit/builder": "0.0.554",
20
- "@teambit/cli": "0.0.385",
21
- "@teambit/compiler": "0.0.554",
22
- "@teambit/generator": "0.0.554",
23
- "@teambit/pkg": "0.0.554",
24
- "@teambit/react": "0.0.554",
25
- "@teambit/typescript": "0.0.554",
26
- "@teambit/compositions": "0.0.554",
17
+ "@teambit/dependency-resolver": "0.0.558",
18
+ "@teambit/envs": "0.0.558",
19
+ "@teambit/builder": "0.0.558",
20
+ "@teambit/cli": "0.0.388",
21
+ "@teambit/compiler": "0.0.558",
22
+ "@teambit/generator": "0.0.558",
23
+ "@teambit/pkg": "0.0.558",
24
+ "@teambit/react": "0.0.558",
25
+ "@teambit/typescript": "0.0.558",
26
+ "@teambit/compositions": "0.0.558",
27
27
  "@teambit/design.ui.empty-box": "0.0.352",
28
- "@teambit/tester": "0.0.554",
29
- "@teambit/ui": "0.0.554"
28
+ "@teambit/tester": "0.0.558",
29
+ "@teambit/ui": "0.0.558"
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.104"
39
+ "@teambit/harmony.aspect-docs.node": "0.0.107"
40
40
  },
41
41
  "peerDependencies": {
42
- "@teambit/legacy": "1.0.171",
42
+ "@teambit/legacy": "1.0.174",
43
43
  "react-dom": "^16.8.0 || ^17.0.0",
44
44
  "react": "^16.8.0 || ^17.0.0"
45
45
  },
@@ -67,12 +67,20 @@
67
67
  "react": "-"
68
68
  },
69
69
  "peerDependencies": {
70
- "@teambit/legacy": "1.0.171",
70
+ "@teambit/legacy": "1.0.174",
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
+ "README.md",
80
+ "README.mdx",
81
+ "*.js",
82
+ "*.json"
83
+ ],
76
84
  "private": false,
77
85
  "engines": {
78
86
  "node": ">=12.22.0"
package/tsconfig.json CHANGED
@@ -15,9 +15,9 @@
15
15
  "skipLibCheck": true,
16
16
  "moduleResolution": "node",
17
17
  "esModuleInterop": true,
18
- "outDir": "dist",
19
18
  "composite": true,
20
19
  "emitDeclarationOnly": true,
20
+ "outDir": "dist",
21
21
  "experimentalDecorators": true,
22
22
  "emitDecoratorMetadata": true,
23
23
  "allowSyntheticDefaultImports": true,
@@ -25,7 +25,6 @@
25
25
  "strict": true,
26
26
  "noImplicitAny": false,
27
27
  "rootDir": ".",
28
- "removeComments": true,
29
28
  "preserveConstEnums": true,
30
29
  "resolveJsonModule": true
31
30
  },
package/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export type { NodeMain } from './node.main.runtime';
2
- export { NodeAspect, NodeAspect as default } from './node.aspect';
package/node.aspect.ts DELETED
@@ -1,7 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const NodeAspect = Aspect.create({
4
- id: 'teambit.harmony/node',
5
- dependencies: [],
6
- defaultConfig: {},
7
- });
@@ -1,7 +0,0 @@
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
- );
package/node.docs.mdx DELETED
@@ -1,8 +0,0 @@
1
- ---
2
- description: A Bit development environment for Node Components
3
- labels: ['node', 'environment', 'env', 'aspect', 'extension']
4
- ---
5
-
6
- import { Node } from '@teambit/harmony.aspect-docs.node';
7
-
8
- <Node />
package/node.env.ts DELETED
@@ -1,17 +0,0 @@
1
- import { DependenciesEnv } from '@teambit/envs';
2
- import { VariantPolicyConfigObject } from '@teambit/dependency-resolver';
3
-
4
- export class NodeEnv implements DependenciesEnv {
5
- icon = 'https://static.bit.dev/extensions-icons/nodejs.svg';
6
-
7
- getDependencies(): VariantPolicyConfigObject {
8
- return {
9
- devDependencies: {
10
- '@types/jest': '26.0.20',
11
- '@types/node': '12.20.4',
12
- // This is added as dev dep since our jest file transformer uses babel plugins that require this to be installed
13
- '@babel/runtime': '7.12.18',
14
- },
15
- };
16
- }
17
- }
@@ -1,139 +0,0 @@
1
- import { VariantPolicyConfigObject } from '@teambit/dependency-resolver';
2
- import { merge } from 'lodash';
3
- import { TsConfigSourceFile } from 'typescript';
4
- import type { TsCompilerOptionsWithoutTsConfig } from '@teambit/typescript';
5
- import { MainRuntime } from '@teambit/cli';
6
- import { GeneratorAspect, GeneratorMain } from '@teambit/generator';
7
- import { BuildTask } from '@teambit/builder';
8
- import { Compiler } from '@teambit/compiler';
9
- import { PackageJsonProps } from '@teambit/pkg';
10
- import { EnvsAspect, EnvsMain, EnvTransformer, Environment } from '@teambit/envs';
11
- import { ReactAspect, ReactMain } from '@teambit/react';
12
- import { NodeAspect } from './node.aspect';
13
- import { NodeEnv } from './node.env';
14
- import { nodeEnvTemplate } from './templates/node-env';
15
- import { nodeTemplate } from './templates/node';
16
-
17
- export class NodeMain {
18
- constructor(
19
- private react: ReactMain,
20
-
21
- readonly nodeEnv: NodeEnv,
22
-
23
- private envs: EnvsMain
24
- ) {}
25
-
26
- icon() {
27
- return 'https://static.bit.dev/extensions-icons/nodejs.svg';
28
- }
29
-
30
- /**
31
- * @deprecated use useTypescript()
32
- * override the TS config of the environment.
33
- */
34
- overrideTsConfig: (
35
- tsconfig: TsConfigSourceFile,
36
- compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>,
37
- tsModule?: any
38
- ) => EnvTransformer = this.react.overrideTsConfig.bind(this.react);
39
-
40
- /**
41
- * override the jest config of the environment.
42
- */
43
- overrideJestConfig = this.react.overrideJestConfig.bind(this.react);
44
-
45
- /**
46
- * override the env build pipeline.
47
- */
48
- overrideBuildPipe: (tasks: BuildTask[]) => EnvTransformer = this.react.overrideBuildPipe.bind(this.react);
49
-
50
- /**
51
- * override the env compilers list.
52
- */
53
- overrideCompiler: (compiler: Compiler) => EnvTransformer = this.react.overrideCompiler.bind(this.react);
54
-
55
- /**
56
- * override the env compilers tasks in the build pipe.
57
- */
58
- overrideCompilerTasks: (tasks: BuildTask[]) => EnvTransformer = this.react.overrideCompilerTasks.bind(this.react);
59
-
60
- /**
61
- * @deprecated use useTypescript()
62
- * override the build ts config.
63
- */
64
- overrideBuildTsConfig: (
65
- tsconfig: any,
66
- compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>
67
- ) => EnvTransformer = this.react.overrideBuildTsConfig.bind(this.react);
68
-
69
- /**
70
- * override package json properties.
71
- */
72
- overridePackageJsonProps: (props: PackageJsonProps) => EnvTransformer = this.react.overridePackageJsonProps.bind(
73
- this.react
74
- );
75
-
76
- /**
77
- * @deprecated - use useWebpack
78
- * override the preview config in the env.
79
- */
80
- overridePreviewConfig = this.react.overridePreviewConfig.bind(this.react);
81
-
82
- /**
83
- * @deprecated - use useWebpack
84
- * override the dev server configuration.
85
- */
86
- overrideDevServerConfig = this.react.overrideDevServerConfig.bind(this.react);
87
-
88
- /**
89
- * override the env's typescript config for both dev and build time.
90
- * Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig)
91
- */
92
- useTypescript = this.react.useTypescript.bind(this.react);
93
-
94
- /**
95
- * override the env's dev server and preview webpack configurations.
96
- * Replaces both overrideDevServerConfig and overridePreviewConfig
97
- */
98
- useWebpack = this.react.useWebpack.bind(this.react);
99
-
100
- /**
101
- * An API to mutate the prettier config
102
- */
103
- usePrettier = this.react.usePrettier.bind(this.react);
104
-
105
- /**
106
- * An API to mutate the eslint config
107
- */
108
- useEslint = this.react.useEslint.bind(this.react);
109
-
110
- /**
111
- * override the dependency configuration of the component environment.
112
- */
113
- overrideDependencies(dependencyPolicy: VariantPolicyConfigObject) {
114
- return this.envs.override({
115
- getDependencies: () => merge(dependencyPolicy, this.nodeEnv.getDependencies()),
116
- });
117
- }
118
-
119
- overrideMounter = this.react.overrideMounter.bind(this.react);
120
-
121
- /**
122
- * create a new composition of the node environment.
123
- */
124
- compose(transformers: EnvTransformer[], targetEnv: Environment = {}) {
125
- return this.envs.compose(this.envs.merge(targetEnv, this.nodeEnv), transformers);
126
- }
127
-
128
- static runtime = MainRuntime;
129
- static dependencies = [EnvsAspect, ReactAspect, GeneratorAspect];
130
-
131
- static async provider([envs, react, generator]: [EnvsMain, ReactMain, GeneratorMain]) {
132
- const nodeEnv: NodeEnv = envs.merge(new NodeEnv(), react.reactEnv);
133
- envs.registerEnv(nodeEnv);
134
- generator.registerComponentTemplate([nodeEnvTemplate, nodeTemplate]);
135
- return new NodeMain(react, nodeEnv, envs);
136
- }
137
- }
138
-
139
- NodeAspect.addRuntime(NodeMain);
@@ -1,42 +0,0 @@
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;
File without changes
@@ -1,14 +0,0 @@
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,18 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,13 +0,0 @@
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
- }
@@ -1,14 +0,0 @@
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
- };
@@ -1,11 +0,0 @@
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
- }
@@ -1,25 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
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
- }
@@ -1,26 +0,0 @@
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
- };
package/types/asset.d.ts DELETED
@@ -1,29 +0,0 @@
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
- }
package/types/style.d.ts DELETED
@@ -1,42 +0,0 @@
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
- }