Skip to content

Commit 7b8565a

Browse files
committed
feat: exporting CommonJS and ESM forms of a package
1 parent 6d352c1 commit 7b8565a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3626
-2798
lines changed

.eslintrc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,20 @@
44
"env": {
55
"node": true,
66
"jest": true
7-
}
7+
},
8+
"overrides": [
9+
{
10+
"files": ["src/**/*"],
11+
"rules": {
12+
"no-restricted-syntax": [
13+
"error",
14+
{
15+
"selector": "Identifier[name='__dirname']",
16+
"message": "__dirname is not supported, use import {sourceDir} from '<src>/utils/source-dir.js' instead"
17+
}
18+
]
19+
},
20+
"excludedFiles": ["*.test.*"]
21+
}
22+
]
823
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ npm-debug.log
1616
.DS_Store
1717
.env
1818
.vscode
19+
.tshy*
1920

2021
node_modules
2122

2223
build
2324
build-integration
25+
dist

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@gravity-ui/prettier-config"

.prettierrc.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

commitlint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {extends: ['@commitlint/config-conventional']};
1+
export default {extends: ['@commitlint/config-conventional']};

integration-test/build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
tsc -p integration-test
4-
mkdir -p build-integration/integration-test/proto/
5-
cp -rf integration-test/proto/* build-integration/integration-test/proto/
6-
node_modules/.bin/grpc_tools_node_protoc --descriptor_set_out=build-integration/integration-test/proto/descriptor_set.bin --include_imports integration-test/proto/*.proto
3+
tsc -p integration-test/tsconfig.server.json
4+
mkdir -p build-integration/proto/
5+
cp -rf integration-test/proto/* build-integration/proto/
6+
node_modules/.bin/grpc_tools_node_protoc --descriptor_set_out=build-integration/proto/descriptor_set.bin --include_imports integration-test/proto/*.proto

integration-test/client/create-core-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Console} from 'console';
22

3-
import {Dict, GatewayContext, GatewayContextParams} from '../../lib';
3+
import {Dict, GatewayContext, GatewayContextParams} from '../../src/index.js';
44

55
const logger = new Console({stdout: process.stdout});
66
const logFactory = (type: string) => (message: string, _params: any) => {

integration-test/client/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {getGatewayControllers} from '../../lib';
1+
import {getGatewayControllers} from '../../src/index.js';
22

3-
import {ErrorConstructor, createCoreContext} from './create-core-context';
4-
import {schema} from './schema/meta';
3+
import {ErrorConstructor, createCoreContext} from './create-core-context.js';
4+
import {schema} from './schema/meta.js';
55

66
export function gatewayCall(request: any) {
77
const controllers = getGatewayControllers(

integration-test/client/native-call.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as grpc from '@grpc/grpc-js';
2-
import {Metadata} from '@grpc/grpc-js/build/src/metadata';
2+
import {Metadata} from '@grpc/grpc-js/build/src/metadata.js';
33

4-
import {v1Package} from '../package-definitions';
4+
import {v1Package} from '../package-definitions.js';
55

66
function serverStreamCall(
77
//@ts-ignore

0 commit comments

Comments
 (0)