diff --git a/.changeset/config.json b/.changeset/config.json index d4ce818..4aa67b3 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,11 +1,11 @@ { "$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json", "changelog": "@changesets/cli/changelog", - "commit": false, + "commit": true, "fixed": [], "linked": [], "access": "public", "baseBranch": "master", "updateInternalDependencies": "patch", "ignore": [] -} \ No newline at end of file +} diff --git a/.changeset/seven-colts-prove.md b/.changeset/seven-colts-prove.md new file mode 100644 index 0000000..7d11ef4 --- /dev/null +++ b/.changeset/seven-colts-prove.md @@ -0,0 +1,20 @@ +--- +"rts.js": patch +--- + +CI/CD +Replace manual Changesets version/publish with changesets/action@v1 +Trigger release when a PR is merged into master; keep workflow_dispatch +Update permissions: contents: write, pull-requests: write, id-token: write +Step order: Checkout → pnpm (v10) → Node 20 → Install → Test → Build → Changesets Action +Tests +Use system temporary directory via os.tmpdir() for all temp files (cross-platform) +Unify cleanup with fs.rmSync(..., { recursive: true, force: true }) +Remove test/temp directory and related references +Update ava.config.js (remove exclude for test/temp/**/*.ts) +Docs +Update test/README.md to document the new temp file strategy +Config/Misc +Set .changeset/config.json baseBranch to master and enable commit: true +Allow committing Changeset entries by adjusting .gitignore +Keep Node 20 and pnpm cache configuration for faster installs and builds diff --git a/.changeset/ten-chefs-slide.md b/.changeset/ten-chefs-slide.md deleted file mode 100644 index 4b42889..0000000 --- a/.changeset/ten-chefs-slide.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -"rts.js": patch ---- - -Ci (release): Triggering release when PR is merged into master; Test temporary files to use system temporary directory instead --Ci: Modify. ithub/workflows/release. yml --The triggering condition is changed to pull_dequest.clost to master, and only executed when merged==true --Retain manual triggering of workflow_ispatch --Change the workflow name to release --Upgrade pnpm/action setup to v10 and adjust the installation order to match pnpm cache --Test: Migration of temporary files to system temporary directory --All use cases use the rts tests/* subdirectories under os. tpdir() uniformly, compatible with Windows/Linux --Adjust file creation and cleanup to fs.rmSync (..., {recursive: true, force: true}) --Delete the test/temp directory and related dependency paths in the repository --Chore (ava): Remove the exclusion of test/temp/* */*. ts in ava.cnfig.js --Docs (test): Update temporary file policy instructions in test/README.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61d9737..3b5fb5e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,8 @@ jobs: if: github.event.pull_request.merged == true runs-on: ubuntu-latest permissions: - contents: read + contents: write + pull-requests: write id-token: write # for npm provenance steps: - name: Checkout @@ -31,17 +32,17 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Build - run: | - pnpm run --if-present release:build || pnpm run --if-present build - - name: Test run: pnpm run --if-present test - - name: Publish with Changesets (pnpm) - run: pnpm run changeset:publish + - name: Build + run: pnpm run --if-present release:build || pnpm run --if-present build + + - name: Changesets - Version or Publish + uses: changesets/action@v1 env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_CONFIG_PROVENANCE: true diff --git a/CHANGELOG.md b/CHANGELOG.md index db3ded1..fbc84e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # rts.js +## 0.0.4 + +### Patch Changes + +- 1ad20ab: Ci (release): Triggering release when PR is merged into master; Test temporary files to use system temporary directory instead + -Ci: Modify. ithub/workflows/release. yml + -The triggering condition is changed to pull_dequest.clost to master, and only executed when merged==true + -Retain manual triggering of workflow_ispatch + -Change the workflow name to release + -Upgrade pnpm/action setup to v10 and adjust the installation order to match pnpm cache + -Test: Migration of temporary files to system temporary directory + -All use cases use the rts tests/_ subdirectories under os. tpdir() uniformly, compatible with Windows/Linux + -Adjust file creation and cleanup to fs.rmSync (..., {recursive: true, force: true}) + -Delete the test/temp directory and related dependency paths in the repository + -Chore (ava): Remove the exclusion of test/temp/_ _/_. ts in ava.cnfig.js + -Docs (test): Update temporary file policy instructions in test/README.md + ## 0.0.3 ### Patch Changes diff --git a/package.json b/package.json index a1fe8dd..51a38fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rts.js", - "version": "0.0.3", + "version": "0.0.4", "description": "nodejs runtime transformer,cans transform ts、js、jsx、tsx、css code to nodejs code", "main": "src/index.ts", "types": "src/index.ts", diff --git a/scripts/release.ts b/scripts/release.ts index abe9f5c..664767f 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -237,45 +237,6 @@ function createGitTag(config: ReleaseConfig): void { } } -/** - * Push changes to git - */ -function pushToGit(): void { - console.log("📤 Pushing changes to git..."); - try { - execSync("git add .", { stdio: "inherit" }); - execSync('git commit -m "chore: release"', { stdio: "inherit" }); - execSync("git push", { stdio: "inherit" }); - console.log("✅ Changes pushed to git"); - } catch (error) { - console.error("❌ Failed to push to git"); - process.exit(1); - } -} - -/** - * Clean up changeset files - */ -function cleanupChangesetFiles(): void { - console.log("🧹 Cleaning up changeset files..."); - try { - const changesetDir = ".changeset"; - if (fs.existsSync(changesetDir)) { - const files = fs - .readdirSync(changesetDir) - .filter((file) => file.endsWith(".md") && file !== "README.md"); - - files.forEach((file) => { - fs.unlinkSync(path.join(changesetDir, file)); - }); - } - console.log("✅ Changeset files cleaned up"); - } catch (error) { - console.error("❌ Failed to clean up changeset files"); - process.exit(1); - } -} - /** * Main release function */ @@ -307,12 +268,6 @@ function release(config: ReleaseConfig): void { // Publish to npm publishToNpm(config); - // Push changes to git - pushToGit(); - cleanupChangesetFiles(); - - // Create git tag for the release - createGitTag(config); } console.log("🎉 Release completed successfully!"); @@ -374,7 +329,6 @@ Examples: pnpm run release --dry-run # Dry run pnpm run release init # Initialize changeset pnpm run release --skip-build # Skip build step - pnpm run release tag # Create git tag `); process.exit(1); }