https://github.com/tomdoestech/publish-npm-module
https://github.com/tomdoestech/publish-npm-module
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/tomdoestech/publish-npm-module
- Owner: TomDoesTech
- Created: 2024-11-02T23:56:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-03T00:29:50.000Z (over 1 year ago)
- Last Synced: 2025-03-25T09:24:48.595Z (about 1 year ago)
- Language: TypeScript
- Size: 23.4 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Create and Publish NPM Module
## What we're usuing
- [tsup](https://tsup.egoist.dev/)
- [TypeScrip](https://www.typescriptlang.org)
- [Vitest](https://vitest.dev/)
### Step 1: Create a new project
pnpm init
pnpm add -D typescript tsup vitest
npx tsc --init
### Step 2: Setup tsup
tsup.config.ts
```
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
format: ["cjs", "esm"], // Build for commonJS and ESmodules
dts: true, // Generate declaration file (.d.ts)
splitting: false,
sourcemap: true,
clean: true,
});
```
### Step 3: Update package.json
```
{
"scripts": {
"build": "tsup",
"test": "vitest"
}
}
```
### Step 3: Create some code
### Step 4: Automate updates with github actions