From 8976aec0f3c6d4ec326f8b8ffa90aa9f1860beb5 Mon Sep 17 00:00:00 2001 From: Natalie McCallum Date: Tue, 29 Nov 2022 10:24:05 +1000 Subject: [PATCH] Set up build --- .gitignore | 1 + .prettierignore | 1 + package.json | 16 +++++++++++++--- tsconfig.json | 8 ++++++-- vite.config.ts | 10 ++++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 vite.config.ts diff --git a/.gitignore b/.gitignore index e8de6f8..b6674dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ coverage/ .DS_Store node_modules/ +dist/ diff --git a/.prettierignore b/.prettierignore index 404abb2..d64c4ca 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,2 @@ coverage/ +dist/ diff --git a/package.json b/package.json index 3b08541..8df8869 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,20 @@ "name": "@tlecommunity/client", "version": "0.1.0", "description": "API Client for the community edition of The Lacuna Expanse", - "main": "", + "files": [ + "dist" + ], + "main": "./dist/client.umd.js", + "module": "./dist/client.mjs", + "types": "./dist/", + "exports": { + ".": { + "import": "./dist/client.mjs", + "require": "./dist/client.umd.js" + } + }, "scripts": { - "dev": "vite", - "build": "vite build", + "build": "vite build && tsc --emitDeclarationOnly --outDir dist", "test": "jest --coverage", "lint": "prettier --check **/*.{ts,tsx,md,js,jsx,css,scss,yml}", "lint:fix": "prettier --write **/*.{ts,tsx,md,js,jsx,css,scss,yml}" diff --git a/tsconfig.json b/tsconfig.json index de3bffd..e27b646 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,10 @@ "target": "es6", "module": "es6", "esModuleInterop": true, - "moduleResolution": "node" - } + "moduleResolution": "node", + "isolatedModules": true, + "declaration": true + }, + "include": ["lib/"], + "exclude": ["**/__tests__/"] } diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..fd68626 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vite'; + +export default defineConfig({ + build: { + lib: { + entry: './lib/index', + name: 'client', + }, + }, +}); -- 2.51.2