✨ Update pnpm package management usage
This commit is contained in:
21
.github/workflows/pake_build_single_app.yaml
vendored
21
.github/workflows/pake_build_single_app.yaml
vendored
@@ -71,6 +71,17 @@ jobs:
|
|||||||
toolchain: ${{ matrix.rust }}
|
toolchain: ${{ matrix.rust }}
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
cache: "pnpm"
|
||||||
|
|
||||||
- name: Install dependencies (ubuntu only)
|
- name: Install dependencies (ubuntu only)
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
|
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
|
||||||
@@ -97,13 +108,13 @@ jobs:
|
|||||||
NAME_ZH: ${{ inputs.name_zh }}
|
NAME_ZH: ${{ inputs.name_zh }}
|
||||||
URL: ${{ inputs.url }}
|
URL: ${{ inputs.url }}
|
||||||
run: |
|
run: |
|
||||||
npm install
|
pnpm install --frozen-lockfile
|
||||||
npm run build:config
|
pnpm run build:config
|
||||||
|
|
||||||
- name: Build for Ubuntu
|
- name: Build for Ubuntu
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
run: |
|
run: |
|
||||||
npm run tauri build
|
pnpm run tauri build
|
||||||
mkdir -p output/linux
|
mkdir -p output/linux
|
||||||
mv src-tauri/target/release/bundle/deb/*.deb output/linux/${{inputs.title}}_`arch`.deb
|
mv src-tauri/target/release/bundle/deb/*.deb output/linux/${{inputs.title}}_`arch`.deb
|
||||||
mv src-tauri/target/release/bundle/appimage/*.AppImage output/linux/"${{inputs.title}}"_`arch`.AppImage
|
mv src-tauri/target/release/bundle/appimage/*.AppImage output/linux/"${{inputs.title}}"_`arch`.AppImage
|
||||||
@@ -113,14 +124,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
rustup target add aarch64-apple-darwin
|
rustup target add aarch64-apple-darwin
|
||||||
rustup target add x86_64-apple-darwin
|
rustup target add x86_64-apple-darwin
|
||||||
npm run tauri build -- --target universal-apple-darwin
|
pnpm run tauri build -- --target universal-apple-darwin
|
||||||
mkdir -p output/macos
|
mkdir -p output/macos
|
||||||
mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/"${{inputs.title}}".dmg
|
mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/"${{inputs.title}}".dmg
|
||||||
|
|
||||||
- name: Build for Windows
|
- name: Build for Windows
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
run: |
|
run: |
|
||||||
npm run tauri build -- --target x86_64-pc-windows-msvc
|
pnpm run tauri build -- --target x86_64-pc-windows-msvc
|
||||||
New-Item -Path "output\windows" -ItemType Directory
|
New-Item -Path "output\windows" -ItemType Directory
|
||||||
Move-Item -Path "src-tauri\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi" -Destination "output\windows\${{inputs.title}}_x64.msi"
|
Move-Item -Path "src-tauri\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi" -Destination "output\windows\${{inputs.title}}_x64.msi"
|
||||||
|
|
||||||
|
|||||||
13
.github/workflows/quality-and-test.yml
vendored
13
.github/workflows/quality-and-test.yml
vendored
@@ -94,11 +94,16 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: "npm"
|
cache: "pnpm"
|
||||||
|
|
||||||
- name: Install Rust (Ubuntu)
|
- name: Install Rust (Ubuntu)
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
@@ -129,13 +134,13 @@ jobs:
|
|||||||
version: 1.1
|
version: 1.1
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build CLI
|
- name: Build CLI
|
||||||
run: npm run cli:build
|
run: pnpm run cli:build
|
||||||
|
|
||||||
- name: Run CLI Test Suite
|
- name: Run CLI Test Suite
|
||||||
run: npm test
|
run: pnpm test
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
NODE_ENV: test
|
NODE_ENV: test
|
||||||
|
|||||||
11
Dockerfile
11
Dockerfile
@@ -33,10 +33,11 @@ RUN --mount=type=cache,target=/var/cache/apt \
|
|||||||
libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev \
|
libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev \
|
||||||
gnome-video-effects
|
gnome-video-effects
|
||||||
|
|
||||||
# Install Node.js 20.x
|
# Install Node.js 20.x and pnpm
|
||||||
RUN --mount=type=cache,target=/var/cache/apt \
|
RUN --mount=type=cache,target=/var/cache/apt \
|
||||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
||||||
apt-get update && apt-get install -y nodejs
|
apt-get update && apt-get install -y nodejs && \
|
||||||
|
npm install -g pnpm
|
||||||
|
|
||||||
# Copy project files
|
# Copy project files
|
||||||
COPY . /pake
|
COPY . /pake
|
||||||
@@ -48,9 +49,9 @@ COPY --from=cargo-builder /cargo-cache/git /usr/local/cargo/git
|
|||||||
COPY --from=cargo-builder /cargo-cache/registry /usr/local/cargo/registry
|
COPY --from=cargo-builder /cargo-cache/registry /usr/local/cargo/registry
|
||||||
|
|
||||||
# Install dependencies and build pake-cli
|
# Install dependencies and build pake-cli
|
||||||
RUN --mount=type=cache,target=/root/.npm \
|
RUN --mount=type=cache,target=/root/.pnpm \
|
||||||
npm install && \
|
pnpm install --frozen-lockfile && \
|
||||||
npm run cli:build
|
pnpm run cli:build
|
||||||
|
|
||||||
# Set up the entrypoint
|
# Set up the entrypoint
|
||||||
WORKDIR /output
|
WORKDIR /output
|
||||||
|
|||||||
16
rollup.config.js
vendored
16
rollup.config.js
vendored
@@ -46,6 +46,14 @@ function pakeCliDevPlugin() {
|
|||||||
|
|
||||||
let devHasStarted = false;
|
let devHasStarted = false;
|
||||||
|
|
||||||
|
// 智能检测包管理器
|
||||||
|
const detectPackageManager = () => {
|
||||||
|
const fs = require("fs");
|
||||||
|
if (fs.existsSync("pnpm-lock.yaml")) return "pnpm";
|
||||||
|
if (fs.existsSync("yarn.lock")) return "yarn";
|
||||||
|
return "npm";
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: "pake-cli-dev-plugin",
|
name: "pake-cli-dev-plugin",
|
||||||
buildEnd() {
|
buildEnd() {
|
||||||
@@ -66,9 +74,11 @@ function pakeCliDevPlugin() {
|
|||||||
console.log(chalk.yellow(`cli running end with code: ${code}`));
|
console.log(chalk.yellow(`cli running end with code: ${code}`));
|
||||||
if (devHasStarted) return;
|
if (devHasStarted) return;
|
||||||
devHasStarted = true;
|
devHasStarted = true;
|
||||||
devChildProcess = await exec(
|
|
||||||
"npm run tauri dev -- --config ./src-tauri/.pake/tauri.conf.json --features cli-build",
|
const packageManager = detectPackageManager();
|
||||||
);
|
const command = `${packageManager} run tauri dev -- --config ./src-tauri/.pake/tauri.conf.json --features cli-build`;
|
||||||
|
|
||||||
|
devChildProcess = await exec(command);
|
||||||
|
|
||||||
devChildProcess.stdout.on("data", (data) => {
|
devChildProcess.stdout.on("data", (data) => {
|
||||||
console.log(chalk.green(data.toString()));
|
console.log(chalk.green(data.toString()));
|
||||||
|
|||||||
Reference in New Issue
Block a user