From 966443ea66989ac29322595e1035af93af08e964 Mon Sep 17 00:00:00 2001 From: Ali Sait Teke Date: Sat, 23 Nov 2024 04:26:13 +0000 Subject: [PATCH] chore(ci): update GitHub Actions workflow to use npm install instead of npm ci for better compatibility chore(ci): remove clean dependencies step to streamline the installation process feat(package.json): enhance build script to include source files and generate type definitions fix(package.json): update prepublishOnly script to run tests before publishing feat(package.json): add postinstall script to build the package after installation chore(package.json): include additional files in the package for better distribution --- .../workflows/npm-publish-github-packages.yml | 27 +++++++++---------- package.json | 15 ++++++++--- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/npm-publish-github-packages.yml b/.github/workflows/npm-publish-github-packages.yml index ee89aee..1a384d3 100644 --- a/.github/workflows/npm-publish-github-packages.yml +++ b/.github/workflows/npm-publish-github-packages.yml @@ -9,16 +9,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 20 cache: 'npm' - # Clean install to fix rollup issue - - name: Clean dependencies - run: | - rm -rf node_modules package-lock.json + + # Önce normal install yapılır - name: Install dependencies - run: npm ci + run: npm install + + - name: Generate package-lock.json + run: npm install --package-lock-only + - run: npm run typecheck - run: npm run lint - run: npm run build @@ -32,18 +35,15 @@ jobs: id-token: write steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 20 registry-url: https://npm.pkg.github.com cache: 'npm' - - name: Clean dependencies - run: | - rm -rf node_modules package-lock.json - - name: Install dependencies - run: npm ci + run: npm install - name: Build package run: npm run build @@ -73,18 +73,15 @@ jobs: id-token: write steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 20 registry-url: https://registry.npmjs.org cache: 'npm' - - name: Clean dependencies - run: | - rm -rf node_modules package-lock.json - - name: Install dependencies - run: npm ci + run: npm install - name: Build package run: npm run build diff --git a/package.json b/package.json index 04ea10f..bfa088f 100644 --- a/package.json +++ b/package.json @@ -15,15 +15,17 @@ }, "scripts": { "clean": "rimraf dist", - "build": "tsup", - "dev": "tsup --watch", + "prebuild": "npm run clean", + "build": "tsup src/index.ts --format cjs,esm --dts", + "dev": "tsup src/index.ts --format cjs,esm --dts --watch", "test": "vitest", "coverage": "vitest run --coverage", "lint": "eslint src/**/*.ts", "format": "prettier --write src/", "typecheck": "tsc --noEmit", "prepare": "npm run build", - "prepublishOnly": "npm run lint" + "prepublishOnly": "npm test && npm run lint", + "postinstall": "npm run build" }, "repository": { "type": "git", @@ -63,7 +65,12 @@ "node": ">=18" }, "files": [ - "dist/**/*" + "dist/**/*", + "src/**/*", + "package.json", + "package-lock.json", + "README.md", + "LICENSE" ], "publishConfig": { "access": "public"