Skip to content

Commit

Permalink
Merge pull request #35 from badsyntax/bugfix/commonjs
Browse files Browse the repository at this point in the history
Ship hybrid package. Refs #32
  • Loading branch information
badsyntax authored Feb 8, 2022
2 parents 2ddc7e9 + 44f468d commit df1e7f9
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,28 @@
"version": "0.0.0",
"private": false,
"description": "Generate an accurate S3 ETAG for multipart uploads in Node.js",
"exports": "./index.js",
"main": "./cjs/index.js",
"module": "./esm/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"require": "./cjs/index.js",
"default": "./esm/index.js"
}
},
"types": "./esm/index.d.ts",
"type": "module",
"sideEffects": false,
"publishConfig": {
"registry": "https://pkgs.dev.azure.com/chevin-devops/_packaging/chevin-npm/npm/registry/"
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"build": "npm run build:esm && npm run build:cjs",
"build:cjs": "tsc -p tsconfig.build.cjs.json",
"build:esm": "tsc -p tsconfig.build.esm.json",
"prebuild": "rimraf lib",
"postbuild": "cp package.json README.md LICENSE.md lib/",
"postbuild:cjs": "echo '{\"type\":\"commonjs\"}' > lib/cjs/package.json && echo '{\"type\":\"module\"}' > lib/esm/package.json",
"format": "prettier --write '**/*.{ts,json,svg,md,yml}'",
"format-check": "prettier --check '**/*.{ts,json,svg,md,yml}'",
"lint": "eslint src/**/*.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/s3Etag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* An implementation of this algorithm: https://stackoverflow.com/a/19896823/492325
* Author: Richard Willis <willis.rh@gmail.com>
*/
import fs from 'node:fs';
import crypto, { BinaryLike } from 'node:crypto';
import fs from 'fs';
import crypto, { BinaryLike } from 'crypto';

export const defaultPartSizeInBytes = 5 * 1024 * 1024; // 5MB

Expand Down
9 changes: 9 additions & 0 deletions tsconfig.build.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"target": "ES2015",
"module": "CommonJS",
"outDir": "./lib/cjs"
},
"exclude": ["node_modules", "**/*.test.ts"]
}
9 changes: 9 additions & 0 deletions tsconfig.build.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"outDir": "./lib/esm"
},
"exclude": ["node_modules", "**/*.test.ts"]
}
4 changes: 0 additions & 4 deletions tsconfig.build.json

This file was deleted.

2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"noImplicitAny": true,
Expand Down

0 comments on commit df1e7f9

Please sign in to comment.