Skip to content

Commit

Permalink
fix: drop esm
Browse files Browse the repository at this point in the history
  • Loading branch information
htdangkhoa committed Jun 19, 2024
1 parent 7dba7f7 commit 0f2f8cb
Show file tree
Hide file tree
Showing 8 changed files with 307 additions and 602 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: build 22
path: dist
path: build

- name: Setup Node
uses: actions/setup-node@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: build ${{ inputs.node-version }}
path: dist
path: build
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverage: true,
Expand Down
40 changes: 16 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,16 @@
"[email protected]"
],
"license": "MIT",
"main": "./dist/cjs/lib/index.js",
"module": "./dist/esm/lib/index.js",
"types": "./dist/types/lib/index.d.ts",
"main": "build/lib/index.js",
"files": [
"dist"
"build/lib",
"build/generated"
],
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/types/lib/index.d.ts",
"import": "./dist/esm/lib/index.js",
"require": "./dist/cjs/lib/index.js"
}
},
"type": "module",
"scripts": {
"test": "jest --runInBand --no-cache",
"test:cov": "npm run test && coveralls < coverage/lcov.info",
"prebuild": "rimraf dist",
"prebuild": "rimraf build",
"build": "tsc",
"postbuild": "esm2cjs --in dist/esm --out dist/cjs -l error",
"generate": "./scripts/generate.sh"
},
"dependencies": {
Expand All @@ -45,23 +34,26 @@
"protobufjs": "^7.3.2"
},
"devDependencies": {
"@alcalzone/esm2cjs": "^1.1.2",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.5",
"coveralls-next": "^4.2.1",
"glob": "^10.4.2",
"googleapis": "^140.0.0",
"@types/node": "^20.11.30",
"coveralls-next": "^4.2.0",
"glob": "^10.3.10",
"googleapis": "^134.0.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"rimraf": "^5.0.7",
"ts-jest": "^29.1.5",
"rimraf": "^5.0.5",
"string-width": "^4.2.0",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"ts-proto": "^1.180.0",
"typescript": "5.4.5"
"ts-proto": "^1.170.0",
"typescript": "5.4.3"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"resolutions": {
"string-width": "^4.2.0"
}
}
4 changes: 2 additions & 2 deletions scripts/export-client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { globSync as glob } from 'glob';
import fs from 'fs';
const glob = require('glob').globSync;
const fs = require('fs');

const [path] = process.argv.slice(2);

Expand Down
4 changes: 2 additions & 2 deletions scripts/indexing.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { globSync as glob } from 'glob';
import fs from 'fs';
const glob = require('glob').globSync;
const fs = require('fs');

const [path, version] = process.argv.slice(2);

Expand Down
17 changes: 8 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */

/* Language and Environment */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"lib": ["ESNext"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
Expand All @@ -25,9 +25,9 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */

/* Modules */
"module": "ESNext", /* Specify what module code is generated. */
"module": "commonjs", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
Expand All @@ -49,7 +49,7 @@
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "dist/esm", /* Specify an output folder for all emitted files. */
"outDir": "build", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand All @@ -65,12 +65,12 @@
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
"declarationDir": "dist/types", /* Specify the output directory for generated declaration files. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */

/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
Expand Down Expand Up @@ -103,5 +103,4 @@
"include": [
"src"
],
"exclude": ["src/tests"]
}
}
Loading

0 comments on commit 0f2f8cb

Please sign in to comment.