diff --git a/package.json b/package.json index 41eb365..40c661a 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,18 @@ { "name": "@lucrise/azul-ts", "version": "0.0.1", - "main": "index.js", - "types": "dist/index.d.ts", + "type": "module", + "files": [ + "dist" + ], + "main": "./dist/index.umd.cjs", + "module": "./dist/index.js", + "exports": { + ".": { + "import": "./dist/index.js", + "require": "./dist/index.umd.cjs" + } + }, "scripts": { "prepare": "husky install", "test": "npx jest --verbose", diff --git a/src/azul-api/request.ts b/src/azul-api/request.ts index d5ace27..bd618c5 100644 --- a/src/azul-api/request.ts +++ b/src/azul-api/request.ts @@ -3,6 +3,10 @@ import fs from 'fs/promises'; import { request, Agent } from 'undici'; import { capitalizeKeys } from '../utils'; import { Process } from './processes'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); enum AzulURL { DEV = 'https://pruebas.azul.com.do/webservices/JSON/Default.aspx', diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..85fc159 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,4 @@ +import AzulPage from './azul-page'; +import AzulAPI from './azul-api/api'; + +export { AzulPage, AzulAPI }; diff --git a/tsconfig.json b/tsconfig.json index c61be11..33c3c5d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,15 +1,27 @@ { "compilerOptions": { - "target": "es2015", - "module": "commonjs", - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "outDir": "./dist", - "strict": true, + "target": "ES2020", + "module": "ESNext", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, "esModuleInterop": true, - "forceConsistentCasingInFileNames": true + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true, + + /* Output */ + "outDir": "dist", }, - "include": ["src", "test"], + "include": ["src/**/*", "test"], "exclude": ["node_modules", "**/__tests__/*"] }