Node.js 20.12+, PNPM 9+
- PNPM
- Turborepo
- Vite
- Vue
- Storybook
pnpm i --frozen-lockfile— Install node dependenciespnpm dev— Running playground (http://localhost:5173) and storybook (http://localhost:6006)pnpm build— Building apps and packagespnpm build:packages— Building all packagespnpm lint— Check the lintingpnpm lint:fix— Linting and fixing
- Q: How do i publish packages to NPM?
- A: Add the code below to .github/workflows/ci.yml and add
NPM_TOKENto the GitHub repository secrets.
- name: Publish packages to NPM
shell: bash
run: |
echo "//registry.npmjs.org/:_authToken="${{ secrets.NPM_TOKEN }}"" > ~/.npmrc
pnpm -r --filter='./packages/*' publish --access public --provenanceand create a configuration for vite.config.ts
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
export default defineConfig({
plugins: [dts()],
build: {
target: 'esnext',
sourcemap: true,
minify: false,
emptyOutDir: false,
lib: {
entry: './src/index.ts',
name: 'utils',
fileName: 'index'
},
rollupOptions: {
output: {
exports: 'named'
}
}
}
})and you will need to specify the export in the package.json file
{
"files": ["dist"],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.umd.cjs"
}
}
}