diff --git a/babel.config.js b/babel.config.js index 1f3f880..82b44a3 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1 +1 @@ -module.exports = { presets: ['@babel/preset-env'] }; +export default { presets: ['@babel/preset-env'] }; diff --git a/package.json b/package.json index 90f26d3..d7fd8c7 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@kittycad/lib", "version": "0.0.17", "description": "Javascript library for KittyCAD API", + "type": "module", "keywords": [ "hardward", "library", @@ -21,19 +22,19 @@ "exports": { ".": { "types": "./dist/types/src", - "import": "./dist/index.es.js", - "require": "./dist/index.js" + "import": "./dist/mjs/index.js", + "require": "./dist/cjs/index.js" } }, - "main": "./dist/index.js", - "module": "./dist/index.es.js", - "browser": "./dist/index.umd.js", + "main": "./dist/cjs/index.js", + "module": "./dist/mjs/index.js", + "browser": "./dist/umd/index.js", "types": "./dist/types/src", "files": [ "dist" ], "engines": { - "node": ">= 16.13 <17" + "node": ">= 16.13 <19" }, "devDependencies": { "@babel/preset-env": "^7.18.9", @@ -65,7 +66,7 @@ "build:js": "rollup -c", "build:types": "tsc --emitDeclarationOnly", "build": "rimraf dist && npm run build:types && npm run build:js", - "gen": "ts-node --project ./tsconfig.gen.json ./src/modelsGen.ts && prettier --config .prettierrc --write ./src && prettier --config .prettierrc --write ./__tests__ && prettier --config .prettierrc --write ./kittycad.ts.patch.json", + "gen": "ts-node ./src/modelsGen.ts && prettier --config .prettierrc --write ./src && prettier --config .prettierrc --write ./__tests__ && prettier --config .prettierrc --write ./kittycad.ts.patch.json", "test": "jest", "tsc": "tsc" }, diff --git a/src/apiGen.ts b/src/apiGen.ts index b30931e..e73e1cc 100644 --- a/src/apiGen.ts +++ b/src/apiGen.ts @@ -1,7 +1,8 @@ import fsp from 'node:fs/promises'; import { OpenAPIV3 } from 'openapi-types'; -import { observe, generate } from 'fast-json-patch'; import { format } from 'prettier'; +import pkg from 'fast-json-patch'; +const { observe, generate } = pkg; export default async function apiGen(lookup: any) { const spec: OpenAPIV3.Document = JSON.parse( diff --git a/tsconfig.gen.json b/tsconfig.gen.json deleted file mode 100644 index 7048c29..0000000 --- a/tsconfig.gen.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "CommonJS" - } -} diff --git a/tsconfig.json b/tsconfig.json index d471605..a49191e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,4 +25,8 @@ }, "exclude": ["node_modules", "dist"], "include": ["src/**/*", "__tests__/**/*"], + "ts-node": { + "esm": true, + "experimentalSpecifierResolution": "node", + } }