diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 954564e..8b6b09f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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() diff --git a/.gitignore b/.gitignore index 2610867..e48b679 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,3 @@ stats.html *.local *.log *.zip -*.tgz diff --git a/package.json b/package.json index 33e1df5..7dff8f5 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index caf295f..d1605d7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -63,6 +63,9 @@ importers: case-police: specifier: ^0.7.0 version: 0.7.0 + cnpm: + specifier: ^9.4.0 + version: 9.4.0 cross-spawn: specifier: ^7.0.3 version: 7.0.3 @@ -1729,6 +1732,23 @@ packages: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} + cnpm@9.4.0: + resolution: {integrity: sha512-oxvozguyEuXp/3Ie0JEtmHKt8+OayZfNH40/B1gmtok2+0dHTS0Kt4uUn5rZ8qIYNk5UzzFVmu1pZxEn0no/iQ==} + engines: {node: '>= 14.18.0'} + hasBin: true + bundledDependencies: + - auto-correct + - bagpipe + - commander + - cross-spawn + - giturl + - ini + - npm + - npm-request + - npminstall + - open + - urllib + code-red@1.0.4: resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==} @@ -6207,6 +6227,8 @@ snapshots: strip-ansi: 6.0.1 wrap-ansi: 7.0.0 + cnpm@9.4.0: {} + code-red@1.0.4: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 diff --git a/scripts/release.mts b/scripts/release.mts index 8212ce1..eaea4a1 100644 --- a/scripts/release.mts +++ b/scripts/release.mts @@ -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' @@ -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'))