fix: added support for publishing both cjs and esm

This commit is contained in:
StevanFreeborn
2023-02-04 00:25:08 -06:00
parent 3af7368e44
commit 081fb73eaa
3 changed files with 19 additions and 7 deletions
+7 -2
View File
@@ -2,15 +2,20 @@
"name": "onspring-api-sdk", "name": "onspring-api-sdk",
"version": "1.0.0", "version": "1.0.0",
"description": "A javascript SDK for interacting with version 2 of the Onspring API.", "description": "A javascript SDK for interacting with version 2 of the Onspring API.",
"main": "dist/index.js", "main": "dist/cjs/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"exports": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"default": "./dist/cjs/index.js"
},
"scripts": { "scripts": {
"clean": "rimraf dist", "clean": "rimraf dist",
"lint": "eslint --ignore-path .eslintignore --ext .js,.ts .", "lint": "eslint --ignore-path .eslintignore --ext .js,.ts .",
"lint-fix": "eslint --fix --ignore-path .eslintignore --ext .js,.ts . --max-warnings=0", "lint-fix": "eslint --fix --ignore-path .eslintignore --ext .js,.ts . --max-warnings=0",
"format-staged": "pretty-quick --staged", "format-staged": "pretty-quick --staged",
"format": "pretty-quick", "format": "pretty-quick",
"build": "npm run lint-fix && npm run tests && npm run format && npm run clean && tsc", "build": "npm run lint-fix && npm run tests && npm run format && npm run clean && tsc --project tsconfig.cjs.json & tsc --project tsconfig.esm.json",
"tests": "mocha -R progress -r ts-node/register ./tests/**/*.spec.ts", "tests": "mocha -R progress -r ts-node/register ./tests/**/*.spec.ts",
"test": "mocha -r ts-node/register", "test": "mocha -r ts-node/register",
"test-coverage": "nyc npm run tests", "test-coverage": "nyc npm run tests",
+1 -1
View File
@@ -1,5 +1,5 @@
import { type Readable } from 'stream'; import { type Readable } from 'stream';
import FormData = require('form-data'); import FormData from 'form-data';
/** /**
* @class SaveFileRequest - Represents a request to save a file. * @class SaveFileRequest - Represents a request to save a file.
+11 -4
View File
@@ -1,12 +1,19 @@
{ {
"compilerOptions": { "compilerOptions": {
"strictNullChecks": true, "strictNullChecks": true,
"module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"target": "es2015",
"declaration": true, "declaration": true,
"outDir": "./dist", "declarationDir": "./dist/types",
"esModuleInterop": true "esModuleInterop": true
}, },
"include": ["src/**/*"] "include": ["src/**/*"],
"ts-node": {
"compilerOptions": {
"module": "commonjs",
"target": "es2015"
},
"moduleTypes": {
"*.ts": "cjs"
}
}
} }