From 4fb06ebaac40629acd47b79d7ad931d8936e78b3 Mon Sep 17 00:00:00 2001 From: ANGkeith Date: Sat, 7 Sep 2024 23:49:27 +0800 Subject: [PATCH] pkg+esbuild --- .github/workflows/build.yml | 4 ++-- .gitignore | 1 + package.json | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7a1d5d83..2a94385e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,9 +33,9 @@ jobs: path: ${{ env.PKG_CACHE_PATH }} key: pkg-cache-${{ matrix.node-version }} - run: npm ci - - run: npm run build + - run: npm run build:pkg - run: npm run pkg-linux - - run: node src/index.js --version + - run: node pkg/out.cjs --version - run: bin/linux/gitlab-ci-local --version - run: bin/linux/gitlab-ci-local --help diff --git a/.gitignore b/.gitignore index 4edeec9c4..82fbc3f89 100644 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,6 @@ tsconfig.tsbuildinfo .DS_Store .vscode +pkg /.gitlab-ci.yml diff --git a/package.json b/package.json index 317921f48..92f12c44b 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,10 @@ "bin": "src/index.js", "version": "4.53.0", "scripts": { - "pkg-linux": "pkg src/index.js --public -t node18-linux-x64 -o bin/linux/gitlab-ci-local && chmod +x bin/linux/gitlab-ci-local && gzip -c bin/linux/gitlab-ci-local > bin/linux.gz", - "pkg-macos": "pkg src/index.js --public -t node18-macos-x64 -o bin/macos/gitlab-ci-local && gzip -c bin/macos/gitlab-ci-local > bin/macos.gz", - "pkg-win": "pkg src/index.js --public -t node18-win-x64 -o bin/win/gitlab-ci-local && gzip -c bin/win/gitlab-ci-local.exe > bin/win.gz", + "build:pkg": "mkdir -p pkg && esbuild src/index.ts --outfile=pkg/out.cjs --bundle --platform=node --format=cjs --minify", + "pkg-linux": "pkg pkg/index.cjs --public -t node18-linux-x64 -o bin/linux/gitlab-ci-local && chmod +x bin/linux/gitlab-ci-local && gzip -c bin/linux/gitlab-ci-local > bin/linux.gz", + "pkg-macos": "pkg pkg/index.cjs --public -t node18-macos-x64 -o bin/macos/gitlab-ci-local && gzip -c bin/macos/gitlab-ci-local > bin/macos.gz", + "pkg-win": "pkg pkg/index.cjs --public -t node18-win-x64 -o bin/win/gitlab-ci-local && gzip -c bin/win/gitlab-ci-local.exe > bin/win.gz", "pkg-all": "npm run pkg-linux && npm run pkg-macos && npm run pkg-win", "pkg": "pkg", "cleanup": "git clean -fX tests/ && git clean -fX src/",