🎨 Change npm to pnpm
This commit is contained in:
6
.github/workflows/pake-cli.yaml
vendored
6
.github/workflows/pake-cli.yaml
vendored
@@ -68,7 +68,7 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: "npm"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install Rust for ubuntu-24.04
|
||||
if: inputs.platform == 'ubuntu-24.04'
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
path: |
|
||||
node_modules
|
||||
~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
@@ -117,7 +117,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Installing latest pake-cli..."
|
||||
npm install pake-cli@latest --no-package-lock
|
||||
pnpm install pake-cli@latest
|
||||
|
||||
# Verify installation
|
||||
if [ ! -d "node_modules/pake-cli" ]; then
|
||||
|
||||
18
.github/workflows/quality-and-test.yml
vendored
18
.github/workflows/quality-and-test.yml
vendored
@@ -26,10 +26,10 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: "npm"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Check EditorConfig compliance
|
||||
uses: editorconfig-checker/action-editorconfig-checker@main
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: "npm"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install Rust (Ubuntu)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
@@ -124,13 +124,13 @@ jobs:
|
||||
version: 1.1
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build CLI
|
||||
run: npm run cli:build
|
||||
run: pnpm run cli:build
|
||||
|
||||
- name: Run CLI Test Suite
|
||||
run: npm test
|
||||
run: pnpm test
|
||||
env:
|
||||
CI: true
|
||||
NODE_ENV: test
|
||||
@@ -161,7 +161,7 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: "npm"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install Rust (Ubuntu)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
@@ -198,10 +198,10 @@ jobs:
|
||||
version: 1.1
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build CLI
|
||||
run: npm run cli:build
|
||||
run: pnpm run cli:build
|
||||
|
||||
- name: Run Release Build Test
|
||||
run: ./tests/release.js
|
||||
|
||||
12
.github/workflows/single-app.yaml
vendored
12
.github/workflows/single-app.yaml
vendored
@@ -76,7 +76,7 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: "npm"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies (ubuntu only)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
@@ -104,8 +104,8 @@ jobs:
|
||||
NAME_ZH: ${{ inputs.name_zh }}
|
||||
URL: ${{ inputs.url }}
|
||||
run: |
|
||||
npm ci
|
||||
npm run build:config
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build:config
|
||||
|
||||
- name: Add Rust targets for macOS universal build
|
||||
if: matrix.os == 'macos-latest'
|
||||
@@ -117,7 +117,7 @@ jobs:
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
timeout-minutes: 15
|
||||
run: |
|
||||
npm run tauri build
|
||||
pnpm run tauri build
|
||||
mkdir -p output/linux
|
||||
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
|
||||
@@ -126,7 +126,7 @@ jobs:
|
||||
if: matrix.os == 'macos-latest'
|
||||
timeout-minutes: 20
|
||||
run: |
|
||||
npm run tauri build -- --target universal-apple-darwin
|
||||
pnpm run tauri build -- --target universal-apple-darwin
|
||||
mkdir -p output/macos
|
||||
mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/"${{inputs.title}}".dmg
|
||||
|
||||
@@ -134,7 +134,7 @@ jobs:
|
||||
if: matrix.os == 'windows-latest'
|
||||
timeout-minutes: 15
|
||||
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
|
||||
Move-Item -Path "src-tauri\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi" -Destination "output\windows\${{inputs.title}}_x64.msi"
|
||||
git checkout -- src-tauri/Cargo.lock
|
||||
|
||||
11
Dockerfile
11
Dockerfile
@@ -40,10 +40,11 @@ RUN --mount=type=cache,target=/var/cache/apt \
|
||||
# Verify Rust version in builder stage
|
||||
RUN rustc --version && echo "Builder stage Rust version verified"
|
||||
|
||||
# Install Node.js 22.x
|
||||
# Install Node.js 22.x and pnpm
|
||||
RUN --mount=type=cache,target=/var/cache/apt \
|
||||
curl -fsSL https://deb.nodesource.com/setup_22.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 . /pake
|
||||
@@ -55,9 +56,9 @@ COPY --from=cargo-builder /cargo-cache/git /usr/local/cargo/git
|
||||
COPY --from=cargo-builder /cargo-cache/registry /usr/local/cargo/registry
|
||||
|
||||
# Install dependencies and build pake-cli
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm ci && \
|
||||
npm run cli:build
|
||||
RUN --mount=type=cache,target=/root/.local/share/pnpm \
|
||||
pnpm install --frozen-lockfile && \
|
||||
pnpm run cli:build
|
||||
|
||||
# Set up the entrypoint
|
||||
WORKDIR /output
|
||||
|
||||
3661
package-lock.json
generated
3661
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@@ -3,8 +3,12 @@
|
||||
"version": "3.2.16",
|
||||
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
"node": ">=18.0.0",
|
||||
"pnpm": ">=10.0.0",
|
||||
"npm": "please-use-pnpm",
|
||||
"yarn": "please-use-pnpm"
|
||||
},
|
||||
"packageManager": "pnpm@10.15.0",
|
||||
"bin": {
|
||||
"pake": "./dist/cli.js"
|
||||
},
|
||||
@@ -29,19 +33,19 @@
|
||||
"src-tauri"
|
||||
],
|
||||
"scripts": {
|
||||
"start": "npm run dev",
|
||||
"dev": "npm run tauri dev",
|
||||
"build": "npm run tauri build --",
|
||||
"build:debug": "npm run tauri build -- --debug",
|
||||
"build:mac": "npm run tauri build -- --target universal-apple-darwin",
|
||||
"start": "pnpm run dev",
|
||||
"dev": "pnpm run tauri dev",
|
||||
"build": "pnpm run tauri build --",
|
||||
"build:debug": "pnpm run tauri build -- --debug",
|
||||
"build:mac": "pnpm run tauri build -- --target universal-apple-darwin",
|
||||
"build:config": "chmod +x scripts/configure-tauri.mjs && node scripts/configure-tauri.mjs",
|
||||
"analyze": "cd src-tauri && cargo bloat --release --crates",
|
||||
"tauri": "tauri",
|
||||
"cli": "cross-env NODE_ENV=development rollup -c -w",
|
||||
"cli:build": "cross-env NODE_ENV=production rollup -c",
|
||||
"test": "npm run cli:build && cross-env PAKE_CREATE_APP=1 node tests/index.js",
|
||||
"test": "pnpm run cli:build && cross-env PAKE_CREATE_APP=1 node tests/index.js",
|
||||
"format": "prettier --write . --ignore-unknown && find tests -name '*.js' -exec sed -i '' 's/[[:space:]]*$//' {} \\; && cd src-tauri && cargo fmt --verbose",
|
||||
"prepublishOnly": "npm run cli:build"
|
||||
"prepublishOnly": "pnpm run cli:build"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./dist/cli.js",
|
||||
@@ -80,7 +84,7 @@
|
||||
"cross-env": "^7.0.3",
|
||||
"prettier": "^3.6.2",
|
||||
"rollup": "^4.46.3",
|
||||
"rollup-plugin-typescript2": "^0.36.0",
|
||||
"@rollup/plugin-typescript": "^12.1.2",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.9.2"
|
||||
}
|
||||
|
||||
2266
pnpm-lock.yaml
generated
Normal file
2266
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
2
pnpm-workspace.yaml
Normal file
2
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
onlyBuiltDependencies:
|
||||
- sharp
|
||||
3
rollup.config.js
vendored
3
rollup.config.js
vendored
@@ -1,7 +1,7 @@
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import appRootPath from "app-root-path";
|
||||
import typescript from "rollup-plugin-typescript2";
|
||||
import typescript from "@rollup/plugin-typescript";
|
||||
import alias from "@rollup/plugin-alias";
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import json from "@rollup/plugin-json";
|
||||
@@ -48,7 +48,6 @@ export default {
|
||||
json(),
|
||||
typescript({
|
||||
tsconfig: "tsconfig.json",
|
||||
clean: true, // Clear cache
|
||||
}),
|
||||
commonjs(),
|
||||
replace({
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
```bash
|
||||
# 完整测试套件(推荐)
|
||||
npm test # 运行完整测试套件,包含真实构建测试(8-12分钟)
|
||||
pnpm test # 运行完整测试套件,包含真实构建测试(8-12分钟)
|
||||
|
||||
# 开发时快速测试
|
||||
npm test -- --no-build # 跳过构建测试,仅验证核心功能(30秒)
|
||||
pnpm test -- --no-build # 跳过构建测试,仅验证核心功能(30秒)
|
||||
```
|
||||
|
||||
### 🚀 完整测试套件包含
|
||||
@@ -76,7 +76,7 @@ npm test -- --no-build # 跳过构建测试,仅验证核心功能(30秒
|
||||
|
||||
## 故障排除
|
||||
|
||||
**CLI 文件不存在**:运行 `npm run cli:build`
|
||||
**CLI 文件不存在**:运行 `pnpm run cli:build`
|
||||
|
||||
**测试超时**:构建测试需要较长时间完成
|
||||
|
||||
@@ -95,4 +95,4 @@ node ./tests/release.js
|
||||
|
||||
## 开发建议
|
||||
|
||||
提交代码前建议运行 `npm test` 确保所有平台构建正常。
|
||||
提交代码前建议运行 `pnpm test` 确保所有平台构建正常。
|
||||
|
||||
@@ -31,7 +31,7 @@ export const TEST_URLS = {
|
||||
|
||||
// Test assets for different scenarios
|
||||
export const TEST_ASSETS = {
|
||||
WEEKLY_ICNS: "https://gw.alipayobjects.com/os/k/fw/weekly.icns",
|
||||
WEEKLY_ICNS: "https://cdn.tw93.fun/pake/weekly.icns",
|
||||
INVALID_ICON: "https://example.com/nonexistent.icns",
|
||||
};
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ runner.addTest(
|
||||
async () => {
|
||||
try {
|
||||
// Test installing pake-cli@latest (simulates GitHub Actions)
|
||||
execSync("npm install pake-cli@latest --no-package-lock", {
|
||||
execSync("pnpm install pake-cli@latest", {
|
||||
encoding: "utf8",
|
||||
timeout: 60000, // 1 minute timeout
|
||||
cwd: "/tmp",
|
||||
@@ -351,7 +351,7 @@ runner.addTest(
|
||||
// Test icon URL validation (without actually downloading)
|
||||
const testScript = `
|
||||
const validIconUrls = [
|
||||
'https://gw.alipayobjects.com/os/k/fw/weekly.icns',
|
||||
'https://cdn.tw93.fun/pake/weekly.icns',
|
||||
'https://example.com/icon.png',
|
||||
'https://cdn.example.com/assets/app.ico'
|
||||
];
|
||||
@@ -460,15 +460,15 @@ runner.addTest(
|
||||
// Simulate MacBuilder multi-arch command generation
|
||||
const generateMacBuildCommand = (multiArch, debug, features = ['cli-build']) => {
|
||||
if (!multiArch) {
|
||||
const baseCommand = debug ? 'npm run tauri build -- --debug' : 'npm run tauri build --';
|
||||
const baseCommand = debug ? 'pnpm run tauri build -- --debug' : 'pnpm run tauri build --';
|
||||
return features.length > 0 ?
|
||||
\`\${baseCommand} --features \${features.join(',')}\` :
|
||||
baseCommand;
|
||||
}
|
||||
|
||||
const baseCommand = debug
|
||||
? 'npm run tauri build -- --debug'
|
||||
: 'npm run tauri build --';
|
||||
? 'pnpm run tauri build -- --debug'
|
||||
: 'pnpm run tauri build --';
|
||||
|
||||
const configPath = 'src-tauri/.pake/tauri.conf.json';
|
||||
let fullCommand = \`\${baseCommand} --target universal-apple-darwin -c "\${configPath}"\`;
|
||||
@@ -482,7 +482,7 @@ const generateMacBuildCommand = (multiArch, debug, features = ['cli-build']) =>
|
||||
|
||||
// Test different scenarios
|
||||
const tests = [
|
||||
{ multiArch: false, debug: false, expected: 'npm run tauri build -- --features cli-build' },
|
||||
{ multiArch: false, debug: false, expected: 'pnpm run tauri build -- --features cli-build' },
|
||||
{ multiArch: true, debug: false, expected: 'universal-apple-darwin' },
|
||||
{ multiArch: false, debug: true, expected: '--debug' },
|
||||
];
|
||||
@@ -537,7 +537,7 @@ runner.addTest(
|
||||
|
||||
// Check for essential workflow components
|
||||
const requiredElements = [
|
||||
"npm install pake-cli@latest --no-package-lock", // Latest version installation
|
||||
"pnpm install pake-cli@latest", // Latest version installation
|
||||
"timeout-minutes: 15", // Sufficient timeout
|
||||
"node ./script/github-action-build.js", // Build script execution
|
||||
"ubuntu-24.04", // Linux support
|
||||
|
||||
@@ -96,7 +96,7 @@ class PakeTestRunner {
|
||||
|
||||
// Check if CLI file exists
|
||||
if (!fs.existsSync(config.CLI_PATH)) {
|
||||
console.log("❌ CLI file not found. Run: npm run cli:build");
|
||||
console.log("❌ CLI file not found. Run: pnpm run cli:build");
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("✅ CLI file exists");
|
||||
@@ -328,7 +328,7 @@ class PakeTestRunner {
|
||||
"pake-cli Package Installation",
|
||||
async () => {
|
||||
try {
|
||||
execSync("npm install pake-cli@latest --no-package-lock", {
|
||||
execSync("pnpm install pake-cli@latest", {
|
||||
encoding: "utf8",
|
||||
timeout: 60000,
|
||||
cwd: "/tmp",
|
||||
@@ -1209,7 +1209,7 @@ if (args.includes("--help") || args.includes("-h")) {
|
||||
Usage: npm test [-- options]
|
||||
|
||||
Complete Test Suite (Default):
|
||||
npm test # Run complete test suite with real build (8-12 minutes)
|
||||
pnpm test # Run complete test suite with real build (8-12 minutes)
|
||||
|
||||
Test Components:
|
||||
✅ Unit Tests # CLI commands, validation, response time
|
||||
@@ -1230,7 +1230,7 @@ Skip Components (if needed):
|
||||
Examples:
|
||||
npm test # Complete test suite (recommended)
|
||||
npm test -- --e2e # Complete suite + end-to-end tests
|
||||
npm test -- --no-build # Skip real build (faster for development)
|
||||
pnpm test -- --no-build # Skip real build (faster for development)
|
||||
|
||||
Environment:
|
||||
CI=1 # Enable CI mode
|
||||
|
||||
@@ -63,12 +63,12 @@ class ReleaseBuildTest {
|
||||
try {
|
||||
// Build config
|
||||
this.log("DEBUG", "Configuring app...");
|
||||
execSync("npm run build:config", { stdio: "pipe" });
|
||||
execSync("pnpm run build:config", { stdio: "pipe" });
|
||||
|
||||
// Build app
|
||||
this.log("DEBUG", "Building app package...");
|
||||
try {
|
||||
execSync("npm run build:debug", {
|
||||
execSync("pnpm run build:debug", {
|
||||
stdio: "pipe",
|
||||
timeout: 120000, // 2 minutes
|
||||
env: { ...process.env, PAKE_CREATE_APP: "1" },
|
||||
|
||||
Reference in New Issue
Block a user