Search

NPM 배포 (package.json)

1.
pakcage.json의 아래 내용을 추가한다.
 "main": "dist/index.js", "typings": "dist/index.d.ts"
Plain Text
복사
2.
npm run build를 자동으로 진행하기 위해 workflow를 추가
name: Publish on: workflow_dispatch jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: "20.x" registry-url: "https://registry.npmjs.org" # 배포를 위한 명령어들 - run: npm install - run: npm test - run: npm run build - run: npm publish --access public # NPM Access 토큰 env: NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
Plain Text
복사
3.
git 계정의 git repository secret에 NPM_ACCESS_TOKEN 을 추가
4.
불필요한 파일이 업로드 되지 않도록 .npmignore를 생성하고 아래와 같이 작성
src docs images tsconfig.json jest.config.js .*
Plain Text
복사