Skip to content

Commit

Permalink
workflow(GitHub Actions): fix the error—cnpm: command not found
Browse files Browse the repository at this point in the history
  • Loading branch information
cloydlau committed Oct 11, 2024
1 parent 0ebda26 commit 4e40538
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: cnpm sync
if: success()

- run: curl -L https://npmmirror.com/sync/json-editor-vue
if: success()

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: pnpm sync-to-cnpm
if: success()
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ stats.html
*.local
*.log
*.zip
*.tgz
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
"test:coverage": "vitest run --coverage",
"test:ui": "vitest --ui",
"doc": "vitepress dev --open /README",
"build": "vite build && pnpm typegen",
"typegen": "npx tsup --entry.json-editor-vue src/index.ts --format esm,cjs --cjsInterop --clean --dts-only",
"check-exports": "pnpm build && npx attw $(npm pack)",
"build": "vite build && pnpm typegen",
"release": "esno ./scripts/release.mts",
"sync-to-cnpm": "npx cnpm sync && curl -L https://npmmirror.com/sync/json-editor-vue",
"license-scan": "license-checker --summary --out ./dependency-licenses.txt",
"lint": "eslint \"**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue,json,md,html,css,scss,sass}\" --ignore-pattern stats.html",
"lint:fix": "eslint \"**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue,json,md,html,css,scss,sass}\" --ignore-pattern stats.html --fix",
Expand Down Expand Up @@ -105,6 +105,7 @@
"@vue/test-utils": "latest",
"axios": "^1.7.7",
"case-police": "^0.7.0",
"cnpm": "^9.4.0",
"cross-spawn": "^7.0.3",
"del": "^8.0.0",
"destr": "^2.0.3",
Expand Down
22 changes: 22 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions scripts/release.mts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// pnpm i esno prompts semver cross-spawn kolorist del open -D -w

import fs from 'node:fs'
import spawn from 'cross-spawn'
// import { deleteAsync } from 'del'
import { deleteAsync } from 'del'
import { cyan } from 'kolorist'
// import open from 'open'
import prompts from 'prompts'
Expand Down Expand Up @@ -36,11 +34,12 @@ async function release() {
return
}

console.log(cyan('\nChecking exports...'))
if (spawn.sync('pnpm', ['check-exports'], { stdio: 'inherit' }).status === 1) {
console.log(cyan('\nAnalyzing types...'))
const attw = spawn.sync('npx', ['attw', '$(npm pack)'], { stdio: 'inherit' })
await deleteAsync(['./*.tgz'])
if (attw.status === 1) {
return
}
// await deleteAsync(['./*.tgz'])

const jsrConfig = JSON.parse(fs.readFileSync('./jsr.json', 'utf-8'))
const npmConfig = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
Expand Down

0 comments on commit 4e40538

Please sign in to comment.