From 0f5dd9a8cfba1299495bc551555c4ff684d684bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A3=A8=EB=B0=80LuMir?= Date: Sun, 13 Jul 2025 02:10:40 +0900 Subject: [PATCH 1/5] build(*): add `cp.mjs` script for file copying and update build scripts (#400) This pull request introduces updates to streamline file copying processes across multiple packages, refactor scripts for consistency, and improve documentation. The most significant changes involve the addition of a reusable file copy script (`cp.mjs`), updates to package build commands to use this script, and the replacement of `apt` commands with `apt-get` for better compatibility. ### File Copying Enhancements: * Added a new script `scripts/cp.mjs` to facilitate file copying with support for recursive and forced operations. This script is now reusable across packages. * Updated `build` scripts in `packages/clang-format-git-python/package.json`, `packages/clang-format-git/package.json`, and `packages/clang-format-node/package.json` to replace `shx cp` commands with `node ../../scripts/cp.mjs`, enhancing consistency and maintainability. [[1]](diffhunk://#diff-fb0eb5dba5b2656b3fdea4322c2ed2a691973f2e9ea536ce20b36c347ab1267eL53-R53) [[2]](diffhunk://#diff-d85dcfb0934f579cff896723ab5eeb9a52668d2bb322338dddd93bc1241aa4f1L52-R52) [[3]](diffhunk://#diff-6e04d643c57b851ab02ad78e41531387d2cc01caf6c4cfbaa536aadd37346a30L51-R51) ### Configuration Updates: * Added `cp.mjs` to `.github/sync-client.yml` for syncing scripts across repositories. ### Compatibility Improvements: * Replaced `apt` commands with `apt-get` in `.github/workflows/test-cross-platform.yml` and `website/docs/further-reading/build-process.md` for improved compatibility and standardization. [[1]](diffhunk://#diff-290907d9a4bcf13181105b134bd1645da5a3ef27c54f148ad5823e6b77e88426L172-R173) [[2]](diffhunk://#diff-edab0f47c80e77f546d2197d14eaba72fd8253dfe4cae3ff34f13f80c229a394L12-R13) --- .github/sync-client.yml | 2 ++ .github/workflows/test-cross-platform.yml | 4 ++-- packages/clang-format-git-python/package.json | 2 +- packages/clang-format-git/package.json | 2 +- packages/clang-format-node/package.json | 2 +- scripts/cp.mjs | 24 +++++++++++++++++++ website/docs/further-reading/build-process.md | 4 ++-- 7 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 scripts/cp.mjs diff --git a/.github/sync-client.yml b/.github/sync-client.yml index c44cb9e..de81e26 100644 --- a/.github/sync-client.yml +++ b/.github/sync-client.yml @@ -41,6 +41,8 @@ lumirlumir/lumirlumir-configs: - source: ./.vscode/settings.json dest: ./configs/.vscode/settings.json # ./scripts + - source: ./scripts/cp.mjs + dest: ./configs/scripts/cp.mjs - source: ./scripts/vercel-ignore-command.sh dest: ./configs/scripts/vercel-ignore-command.sh # ./ diff --git a/.github/workflows/test-cross-platform.yml b/.github/workflows/test-cross-platform.yml index 209d53b..aac5a02 100644 --- a/.github/workflows/test-cross-platform.yml +++ b/.github/workflows/test-cross-platform.yml @@ -169,8 +169,8 @@ jobs: run: | docker exec ${{ matrix.docker.node-name }} /bin/bash -c " echo ---Set up dependencies--- && - apt update -y && - apt install -y git && + apt-get update -y && + apt-get install -y git && echo ---Debug uname -m--- && uname -m && diff --git a/packages/clang-format-git-python/package.json b/packages/clang-format-git-python/package.json index 8f50de5..aa9e420 100644 --- a/packages/clang-format-git-python/package.json +++ b/packages/clang-format-git-python/package.json @@ -50,7 +50,7 @@ "scripts": { "postinstall": "npm run chmod", "prepublishOnly": "npm run build", - "build": "npx babel src -d build && npx tsc && shx cp -r src/script build && shx cp ../../LICENSE.md ../../README.md .", + "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs src/script build/script ../../LICENSE.md LICENSE.md ../../README.md README.md", "postbuild": "npm run chmod", "test": "node --test", "chmod": "shx chmod 755 ./src/script/**/* ./build/script/**/* || exit 0", diff --git a/packages/clang-format-git/package.json b/packages/clang-format-git/package.json index 67787dd..61482f7 100644 --- a/packages/clang-format-git/package.json +++ b/packages/clang-format-git/package.json @@ -49,7 +49,7 @@ "scripts": { "postinstall": "npm run chmod", "prepublishOnly": "npm run build", - "build": "npx babel src -d build && npx tsc && shx cp -r src/bin build && shx cp ../../LICENSE.md ../../README.md .", + "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs src/bin build/bin ../../LICENSE.md LICENSE.md ../../README.md README.md", "postbuild": "npm run chmod", "test": "node --test", "chmod": "shx chmod 755 ./src/bin/**/* ./build/bin/**/* || exit 0", diff --git a/packages/clang-format-node/package.json b/packages/clang-format-node/package.json index 325bed9..81ce7a8 100644 --- a/packages/clang-format-node/package.json +++ b/packages/clang-format-node/package.json @@ -48,7 +48,7 @@ "scripts": { "postinstall": "npm run chmod", "prepublishOnly": "npm run build", - "build": "npx babel src -d build && npx tsc && shx cp -r src/bin build && shx cp ../../LICENSE.md ../../README.md .", + "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs src/bin build/bin ../../LICENSE.md LICENSE.md ../../README.md README.md", "postbuild": "npm run chmod", "test": "node --test", "chmod": "shx chmod 755 ./src/bin/**/* ./build/bin/**/* || exit 0", diff --git a/scripts/cp.mjs b/scripts/cp.mjs new file mode 100644 index 0000000..4af4678 --- /dev/null +++ b/scripts/cp.mjs @@ -0,0 +1,24 @@ +/** + * @fileoverview Script to copy files from src to dest. + * Usage: `node path/to/cp.mjs src1 dest1 src2 dest2 src3 dest3 ...` + */ + +// -------------------------------------------------------------------------------- +// Import +// -------------------------------------------------------------------------------- + +import { cpSync } from 'node:fs'; +import { resolve } from 'node:path'; + +// -------------------------------------------------------------------------------- +// Copy Files +// -------------------------------------------------------------------------------- + +const args = process.argv.slice(2); + +for (let i = 0; i < args.length; i += 2) { + cpSync(resolve(process.cwd(), args[i]), resolve(process.cwd(), args[i + 1]), { + force: true, + recursive: true, + }); +} diff --git a/website/docs/further-reading/build-process.md b/website/docs/further-reading/build-process.md index 18c15d1..b1fee34 100644 --- a/website/docs/further-reading/build-process.md +++ b/website/docs/further-reading/build-process.md @@ -9,8 +9,8 @@ description: "Guide for building the `clang-format` native binary on Linux and c You can build `clang-format` native binary on Linux using the script below. ```sh -sudo apt update -y -sudo apt install -y git python3 g++ cmake ninja-build +sudo apt-get update -y +sudo apt-get install -y git python3 g++ cmake ninja-build # Replace llvmorg-18.1.8 with your desired version. Check the tags at https://github.com/llvm/llvm-project/tags git clone --depth 1 --branch llvmorg-18.1.8 https://github.com/llvm/llvm-project.git From ee3b6757dbe3a19b3ed5b7a91af8d2c0725ca073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A3=A8=EB=B0=80LuMir?= Date: Sun, 13 Jul 2025 20:16:23 +0900 Subject: [PATCH 2/5] refactor(*): simplify paths to the binary files (#401) This pull request reorganizes the directory structure of several packages (`clang-format-git`, `clang-format-git-python`, and `clang-format-node`) to simplify paths and improve consistency. It also updates related scripts, tests, and documentation to reflect these changes. ### Directory Structure Updates: * `.github/workflows/llvm-build-bump-pr.yml` and `.github/workflows/test-cross-platform.yml`: Updated artifact paths for `clang-format-git`, `clang-format-git-python`, and `clang-format-node` to remove `src` directories and directly reference `bin` or `script` directories. [[1]](diffhunk://#diff-d608eb75b383338d789a8908995e47499214a7cc55a847771ad73800464b18b0L466-R478) [[2]](diffhunk://#diff-290907d9a4bcf13181105b134bd1645da5a3ef27c54f148ad5823e6b77e88426L163-R166) ### Package Configuration Changes: * `packages/clang-format-git/package.json`, `packages/clang-format-git-python/package.json`, and `packages/clang-format-node/package.json`: Updated `files` arrays to include new directories (`bin` or `script`) and modified `build` and `chmod` scripts to reflect the updated directory structure. [[1]](diffhunk://#diff-d85dcfb0934f579cff896723ab5eeb9a52668d2bb322338dddd93bc1241aa4f1R7) [[2]](diffhunk://#diff-d85dcfb0934f579cff896723ab5eeb9a52668d2bb322338dddd93bc1241aa4f1L52-R56) [[3]](diffhunk://#diff-fb0eb5dba5b2656b3fdea4322c2ed2a691973f2e9ea536ce20b36c347ab1267eR8) [[4]](diffhunk://#diff-fb0eb5dba5b2656b3fdea4322c2ed2a691973f2e9ea536ce20b36c347ab1267eL53-R57) [[5]](diffhunk://#diff-6e04d643c57b851ab02ad78e41531387d2cc01caf6c4cfbaa536aadd37346a30R7) [[6]](diffhunk://#diff-6e04d643c57b851ab02ad78e41531387d2cc01caf6c4cfbaa536aadd37346a30L51-R55) ### Code Updates: * `packages/clang-format-git/src/utils/getGitClangFormatPath.js` and `packages/clang-format-node/src/utils/getClangFormatPath.js`: Adjusted path resolution logic to account for the removal of `src` directories. [[1]](diffhunk://#diff-1bb2e643c38d95e89f5956f9701352544d048ce9b211521186d0aecda6a2b09bR36) [[2]](diffhunk://#diff-69431841c8379c19bac868db91bce476be6122cca550dd2bb841a8fd7d050ebbR36) * `packages/clang-format-git-python/src/utils/gitClangFormatPath.js` and `packages/clang-format-git-python/src/utils/gitClangFormatPath.test.js`: Updated path references for `git-clang-format` script and corresponding tests. [[1]](diffhunk://#diff-0b92886b850ec05cf8174fb293fc1d7f26dfd6064e907bfc81e09da43c8e1e49L18-R24) [[2]](diffhunk://#diff-41c3fa28ed17f0f9ce4b26fa451766e45f1ff88989d94a76cef0cdd408c6f72fL23-R26) ### Documentation and Script Updates: * [`website/docs/apis/clang-format-git-python.md`](diffhunk://#diff-5060a3c67544aaba0c41aeee2e68442e779de26fa17d0129b8de744b4ed1fb34L94-R94): Updated documentation to reflect the new path for the `git-clang-format` script. * [`scripts/cp.mjs`](diffhunk://#diff-44bb9af56ea76a8568ef9f74fd698177219262b768f1591966533363fdbf0655L22): Removed the `recursive` option from the `cpSync` function since it is no longer needed for the updated directory structure. --- .github/workflows/llvm-build-bump-pr.yml | 6 +++--- .github/workflows/test-cross-platform.yml | 4 ++-- packages/clang-format-git-python/package.json | 5 +++-- .../{src => }/script/git-clang-format | 0 .../src/utils/gitClangFormatPath.js | 4 ++-- .../src/utils/gitClangFormatPath.test.js | 4 ++-- .../{src => }/bin/cfg-darwin-arm64/git-clang-format | Bin .../{src => }/bin/cfg-darwin-x64/git-clang-format | Bin .../{src => }/bin/cfg-linux-arm/git-clang-format | Bin .../{src => }/bin/cfg-linux-arm64/git-clang-format | Bin .../{src => }/bin/cfg-linux-ppc64/git-clang-format | Bin .../{src => }/bin/cfg-linux-s390x/git-clang-format | Bin .../{src => }/bin/cfg-linux-x64/git-clang-format | Bin .../bin/cfg-win32-x64/git-clang-format.exe | Bin packages/clang-format-git/package.json | 5 +++-- .../src/utils/getGitClangFormatPath.js | 1 + .../{src => }/bin/cfn-darwin-arm64/clang-format | Bin .../{src => }/bin/cfn-darwin-x64/clang-format | Bin .../{src => }/bin/cfn-linux-arm/clang-format | Bin .../{src => }/bin/cfn-linux-arm64/clang-format | Bin .../{src => }/bin/cfn-linux-ppc64/clang-format | Bin .../{src => }/bin/cfn-linux-s390x/clang-format | Bin .../{src => }/bin/cfn-linux-x64/clang-format | Bin .../{src => }/bin/cfn-win32-x64/clang-format.exe | Bin packages/clang-format-node/package.json | 5 +++-- .../src/utils/getClangFormatPath.js | 1 + scripts/cp.mjs | 1 - website/docs/apis/clang-format-git-python.md | 2 +- 28 files changed, 21 insertions(+), 17 deletions(-) rename packages/clang-format-git-python/{src => }/script/git-clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-git/{src => }/bin/cfg-darwin-arm64/git-clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-git/{src => }/bin/cfg-darwin-x64/git-clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-git/{src => }/bin/cfg-linux-arm/git-clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-git/{src => }/bin/cfg-linux-arm64/git-clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-git/{src => }/bin/cfg-linux-ppc64/git-clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-git/{src => }/bin/cfg-linux-s390x/git-clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-git/{src => }/bin/cfg-linux-x64/git-clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-git/{src => }/bin/cfg-win32-x64/git-clang-format.exe (100%) mode change 100755 => 100644 rename packages/clang-format-node/{src => }/bin/cfn-darwin-arm64/clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-node/{src => }/bin/cfn-darwin-x64/clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-node/{src => }/bin/cfn-linux-arm/clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-node/{src => }/bin/cfn-linux-arm64/clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-node/{src => }/bin/cfn-linux-ppc64/clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-node/{src => }/bin/cfn-linux-s390x/clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-node/{src => }/bin/cfn-linux-x64/clang-format (100%) mode change 100755 => 100644 rename packages/clang-format-node/{src => }/bin/cfn-win32-x64/clang-format.exe (100%) mode change 100755 => 100644 diff --git a/.github/workflows/llvm-build-bump-pr.yml b/.github/workflows/llvm-build-bump-pr.yml index 9284ade..83fa344 100644 --- a/.github/workflows/llvm-build-bump-pr.yml +++ b/.github/workflows/llvm-build-bump-pr.yml @@ -463,19 +463,19 @@ jobs: - name: Download artifacts for clang-format-git uses: actions/download-artifact@v4 with: - path: packages/clang-format-git/src/bin + path: packages/clang-format-git/bin pattern: cfg-* - name: Download artifacts for clang-format-git-python uses: actions/download-artifact@v4 with: - path: packages/clang-format-git-python/src/script + path: packages/clang-format-git-python/script name: git-clang-format - name: Download artifacts for clang-format-node uses: actions/download-artifact@v4 with: - path: packages/clang-format-node/src/bin + path: packages/clang-format-node/bin pattern: cfn-* - name: Update file permissions to 755 diff --git a/.github/workflows/test-cross-platform.yml b/.github/workflows/test-cross-platform.yml index aac5a02..c3a9e76 100644 --- a/.github/workflows/test-cross-platform.yml +++ b/.github/workflows/test-cross-platform.yml @@ -160,10 +160,10 @@ jobs: run: docker run -d --name ${{ matrix.docker.node-name }} --platform linux/${{ matrix.docker.platform }} ubuntu:22.04 tail -f /dev/null - name: Copy git-clang-format file to Docker container - run: docker cp ./packages/clang-format-git/src/bin/cfg-linux-${{ matrix.docker.node-name }}/git-clang-format ${{ matrix.docker.node-name }}:/ + run: docker cp ./packages/clang-format-git/bin/cfg-linux-${{ matrix.docker.node-name }}/git-clang-format ${{ matrix.docker.node-name }}:/ - name: Copy clang-format file to Docker container - run: docker cp ./packages/clang-format-node/src/bin/cfn-linux-${{ matrix.docker.node-name }}/clang-format ${{ matrix.docker.node-name }}:/ + run: docker cp ./packages/clang-format-node/bin/cfn-linux-${{ matrix.docker.node-name }}/clang-format ${{ matrix.docker.node-name }}:/ - name: Docker exec run: | diff --git a/packages/clang-format-git-python/package.json b/packages/clang-format-git-python/package.json index aa9e420..fd949ea 100644 --- a/packages/clang-format-git-python/package.json +++ b/packages/clang-format-git-python/package.json @@ -5,6 +5,7 @@ "main": "build/index.js", "files": [ "build", + "script", "LICENSE.md", "README.md" ], @@ -50,10 +51,10 @@ "scripts": { "postinstall": "npm run chmod", "prepublishOnly": "npm run build", - "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs src/script build/script ../../LICENSE.md LICENSE.md ../../README.md README.md", + "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs ../../LICENSE.md LICENSE.md ../../README.md README.md", "postbuild": "npm run chmod", "test": "node --test", - "chmod": "shx chmod 755 ./src/script/**/* ./build/script/**/* || exit 0", + "chmod": "shx chmod 755 ./script/**/* || exit 0", "dev": "node src/cli.js", "start": "node build/cli.js" }, diff --git a/packages/clang-format-git-python/src/script/git-clang-format b/packages/clang-format-git-python/script/git-clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-git-python/src/script/git-clang-format rename to packages/clang-format-git-python/script/git-clang-format diff --git a/packages/clang-format-git-python/src/utils/gitClangFormatPath.js b/packages/clang-format-git-python/src/utils/gitClangFormatPath.js index 022e0a4..92e8114 100644 --- a/packages/clang-format-git-python/src/utils/gitClangFormatPath.js +++ b/packages/clang-format-git-python/src/utils/gitClangFormatPath.js @@ -15,13 +15,13 @@ const { resolve } = require('path'); // -------------------------------------------------------------------------------- /** - * The ABSOLUTE path to the [`git-clang-format`](https://github.com/lumirlumir/npm-clang-format-node/blob/main/packages/clang-format-git-python/src/script/git-clang-format) Python script. + * The ABSOLUTE path to the [`git-clang-format`](https://github.com/lumirlumir/npm-clang-format-node/blob/main/packages/clang-format-git-python/script/git-clang-format) Python script. * @type {string} * @alias `clangFormatGitPythonPath`. See {@link clangFormatGitPythonPath}. * @version `v1.2.0` Initial release. * @see https://clang-format-node.lumir.page/docs/apis/clang-format-git-python */ -const gitClangFormatPath = resolve(__dirname, `..`, `script`, `git-clang-format`); +const gitClangFormatPath = resolve(__dirname, `..`, `..`, `script`, `git-clang-format`); /** * Alias for `gitClangFormatPath`. diff --git a/packages/clang-format-git-python/src/utils/gitClangFormatPath.test.js b/packages/clang-format-git-python/src/utils/gitClangFormatPath.test.js index 291cdc2..b014ac4 100644 --- a/packages/clang-format-git-python/src/utils/gitClangFormatPath.test.js +++ b/packages/clang-format-git-python/src/utils/gitClangFormatPath.test.js @@ -20,10 +20,10 @@ describe('gitClangFormatPath', () => { it('gitClangFormatPath === clangFormatGitPythonPath', () => { strictEqual(gitClangFormatPath, clangFormatGitPythonPath); }); - it('clangFormatGitPythonPath === resolve(__dirname, `..`, `script`, `git-clang-format`)', () => { + it('clangFormatGitPythonPath === resolve(__dirname, `..`, `..`, `script`, `git-clang-format`)', () => { strictEqual( clangFormatGitPythonPath, - resolve(__dirname, `..`, `script`, `git-clang-format`), + resolve(__dirname, `..`, `..`, `script`, `git-clang-format`), ); }); }); diff --git a/packages/clang-format-git/src/bin/cfg-darwin-arm64/git-clang-format b/packages/clang-format-git/bin/cfg-darwin-arm64/git-clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-git/src/bin/cfg-darwin-arm64/git-clang-format rename to packages/clang-format-git/bin/cfg-darwin-arm64/git-clang-format diff --git a/packages/clang-format-git/src/bin/cfg-darwin-x64/git-clang-format b/packages/clang-format-git/bin/cfg-darwin-x64/git-clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-git/src/bin/cfg-darwin-x64/git-clang-format rename to packages/clang-format-git/bin/cfg-darwin-x64/git-clang-format diff --git a/packages/clang-format-git/src/bin/cfg-linux-arm/git-clang-format b/packages/clang-format-git/bin/cfg-linux-arm/git-clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-git/src/bin/cfg-linux-arm/git-clang-format rename to packages/clang-format-git/bin/cfg-linux-arm/git-clang-format diff --git a/packages/clang-format-git/src/bin/cfg-linux-arm64/git-clang-format b/packages/clang-format-git/bin/cfg-linux-arm64/git-clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-git/src/bin/cfg-linux-arm64/git-clang-format rename to packages/clang-format-git/bin/cfg-linux-arm64/git-clang-format diff --git a/packages/clang-format-git/src/bin/cfg-linux-ppc64/git-clang-format b/packages/clang-format-git/bin/cfg-linux-ppc64/git-clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-git/src/bin/cfg-linux-ppc64/git-clang-format rename to packages/clang-format-git/bin/cfg-linux-ppc64/git-clang-format diff --git a/packages/clang-format-git/src/bin/cfg-linux-s390x/git-clang-format b/packages/clang-format-git/bin/cfg-linux-s390x/git-clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-git/src/bin/cfg-linux-s390x/git-clang-format rename to packages/clang-format-git/bin/cfg-linux-s390x/git-clang-format diff --git a/packages/clang-format-git/src/bin/cfg-linux-x64/git-clang-format b/packages/clang-format-git/bin/cfg-linux-x64/git-clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-git/src/bin/cfg-linux-x64/git-clang-format rename to packages/clang-format-git/bin/cfg-linux-x64/git-clang-format diff --git a/packages/clang-format-git/src/bin/cfg-win32-x64/git-clang-format.exe b/packages/clang-format-git/bin/cfg-win32-x64/git-clang-format.exe old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-git/src/bin/cfg-win32-x64/git-clang-format.exe rename to packages/clang-format-git/bin/cfg-win32-x64/git-clang-format.exe diff --git a/packages/clang-format-git/package.json b/packages/clang-format-git/package.json index 61482f7..34336cc 100644 --- a/packages/clang-format-git/package.json +++ b/packages/clang-format-git/package.json @@ -4,6 +4,7 @@ "description": "Node wrapper for git-clang-format Python script as a standalone native binary to allow execution without a Python dependency.🐉", "main": "build/index.js", "files": [ + "bin", "build", "LICENSE.md", "README.md" @@ -49,10 +50,10 @@ "scripts": { "postinstall": "npm run chmod", "prepublishOnly": "npm run build", - "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs src/bin build/bin ../../LICENSE.md LICENSE.md ../../README.md README.md", + "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs ../../LICENSE.md LICENSE.md ../../README.md README.md", "postbuild": "npm run chmod", "test": "node --test", - "chmod": "shx chmod 755 ./src/bin/**/* ./build/bin/**/* || exit 0", + "chmod": "shx chmod 755 ./bin/**/* || exit 0", "dev": "node src/cli.js", "start": "node build/cli.js" }, diff --git a/packages/clang-format-git/src/utils/getGitClangFormatPath.js b/packages/clang-format-git/src/utils/getGitClangFormatPath.js index cd614fb..8e91b53 100644 --- a/packages/clang-format-git/src/utils/getGitClangFormatPath.js +++ b/packages/clang-format-git/src/utils/getGitClangFormatPath.js @@ -33,6 +33,7 @@ function getGitClangFormatPath(osPlatform, architecture) { const gitClangFormatPath = resolve( __dirname, `..`, + `..`, `bin`, `cfg-${osPlatform}-${architecture}`, `git-clang-format${osPlatform === 'win32' ? '.exe' : ''}`, diff --git a/packages/clang-format-node/src/bin/cfn-darwin-arm64/clang-format b/packages/clang-format-node/bin/cfn-darwin-arm64/clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-node/src/bin/cfn-darwin-arm64/clang-format rename to packages/clang-format-node/bin/cfn-darwin-arm64/clang-format diff --git a/packages/clang-format-node/src/bin/cfn-darwin-x64/clang-format b/packages/clang-format-node/bin/cfn-darwin-x64/clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-node/src/bin/cfn-darwin-x64/clang-format rename to packages/clang-format-node/bin/cfn-darwin-x64/clang-format diff --git a/packages/clang-format-node/src/bin/cfn-linux-arm/clang-format b/packages/clang-format-node/bin/cfn-linux-arm/clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-node/src/bin/cfn-linux-arm/clang-format rename to packages/clang-format-node/bin/cfn-linux-arm/clang-format diff --git a/packages/clang-format-node/src/bin/cfn-linux-arm64/clang-format b/packages/clang-format-node/bin/cfn-linux-arm64/clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-node/src/bin/cfn-linux-arm64/clang-format rename to packages/clang-format-node/bin/cfn-linux-arm64/clang-format diff --git a/packages/clang-format-node/src/bin/cfn-linux-ppc64/clang-format b/packages/clang-format-node/bin/cfn-linux-ppc64/clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-node/src/bin/cfn-linux-ppc64/clang-format rename to packages/clang-format-node/bin/cfn-linux-ppc64/clang-format diff --git a/packages/clang-format-node/src/bin/cfn-linux-s390x/clang-format b/packages/clang-format-node/bin/cfn-linux-s390x/clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-node/src/bin/cfn-linux-s390x/clang-format rename to packages/clang-format-node/bin/cfn-linux-s390x/clang-format diff --git a/packages/clang-format-node/src/bin/cfn-linux-x64/clang-format b/packages/clang-format-node/bin/cfn-linux-x64/clang-format old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-node/src/bin/cfn-linux-x64/clang-format rename to packages/clang-format-node/bin/cfn-linux-x64/clang-format diff --git a/packages/clang-format-node/src/bin/cfn-win32-x64/clang-format.exe b/packages/clang-format-node/bin/cfn-win32-x64/clang-format.exe old mode 100755 new mode 100644 similarity index 100% rename from packages/clang-format-node/src/bin/cfn-win32-x64/clang-format.exe rename to packages/clang-format-node/bin/cfn-win32-x64/clang-format.exe diff --git a/packages/clang-format-node/package.json b/packages/clang-format-node/package.json index 81ce7a8..da3a110 100644 --- a/packages/clang-format-node/package.json +++ b/packages/clang-format-node/package.json @@ -4,6 +4,7 @@ "description": "Node wrapper for clang-format native binary inspired by angular/clang-format.🐉", "main": "build/index.js", "files": [ + "bin", "build", "LICENSE.md", "README.md" @@ -48,10 +49,10 @@ "scripts": { "postinstall": "npm run chmod", "prepublishOnly": "npm run build", - "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs src/bin build/bin ../../LICENSE.md LICENSE.md ../../README.md README.md", + "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs ../../LICENSE.md LICENSE.md ../../README.md README.md", "postbuild": "npm run chmod", "test": "node --test", - "chmod": "shx chmod 755 ./src/bin/**/* ./build/bin/**/* || exit 0", + "chmod": "shx chmod 755 ./bin/**/* || exit 0", "dev": "node src/cli.js", "start": "node build/cli.js" }, diff --git a/packages/clang-format-node/src/utils/getClangFormatPath.js b/packages/clang-format-node/src/utils/getClangFormatPath.js index eacb146..09ed684 100644 --- a/packages/clang-format-node/src/utils/getClangFormatPath.js +++ b/packages/clang-format-node/src/utils/getClangFormatPath.js @@ -33,6 +33,7 @@ function getClangFormatPath(osPlatform, architecture) { const clangFormatPath = resolve( __dirname, `..`, + `..`, `bin`, `cfn-${osPlatform}-${architecture}`, `clang-format${osPlatform === 'win32' ? '.exe' : ''}`, diff --git a/scripts/cp.mjs b/scripts/cp.mjs index 4af4678..ad4e3c1 100644 --- a/scripts/cp.mjs +++ b/scripts/cp.mjs @@ -19,6 +19,5 @@ const args = process.argv.slice(2); for (let i = 0; i < args.length; i += 2) { cpSync(resolve(process.cwd(), args[i]), resolve(process.cwd(), args[i + 1]), { force: true, - recursive: true, }); } diff --git a/website/docs/apis/clang-format-git-python.md b/website/docs/apis/clang-format-git-python.md index f86ce73..8e6cc7d 100644 --- a/website/docs/apis/clang-format-git-python.md +++ b/website/docs/apis/clang-format-git-python.md @@ -91,7 +91,7 @@ These APIs depends on the Node.js `fs` and `path` module and the file system, so > Type: `string` -The ABSOLUTE path to the [`git-clang-format`](https://github.com/lumirlumir/npm-clang-format-node/blob/main/packages/clang-format-git-python/src/script/git-clang-format) Python script. +The ABSOLUTE path to the [`git-clang-format`](https://github.com/lumirlumir/npm-clang-format-node/blob/main/packages/clang-format-git-python/script/git-clang-format) Python script. - Type: `string` - Alias: `clangFormatGitPythonPath`. See [`clangFormatGitPythonPath`](#clangformatgitpythonpath). From 168f2179955b43101f6b53b9e593ccd9caa9ac52 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 16:14:52 +0900 Subject: [PATCH 3/5] chore(deps-dev): bump eslint from 9.30.1 to 9.31.0 (#403) [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint&package-manager=npm_and_yarn&previous-version=9.30.1&new-version=9.31.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 37 ++++++++++++------------------------- package.json | 2 +- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1c1e34d..77c8fcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "c8": "^10.1.3", "concurrently": "^9.2.0", "editorconfig-checker": "^6.0.0", - "eslint": "^9.30.1", + "eslint": "^9.31.0", "eslint-config-bananass": "^0.2.0", "eslint-plugin-mark": "^0.1.0-canary.1", "husky": "^9.1.5", @@ -2673,9 +2673,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.30.1", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.30.1.tgz", - "integrity": "sha512-zXhuECFlyep42KZUhWjfvsmXGX39W8K8LFb8AWXM9gSV9dQB+MrJGLKvW6Zw0Ggnbpw0VHTtrhFXYe3Gym18jg==", + "version": "9.31.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.31.0.tgz", + "integrity": "sha512-LOm5OVt7D4qiKCqoiPbA7LWmI+tbw1VbTUowBcUMgQSuM6poJufkFkYDcQpo5KfgD39TnNySV26QjOh7VFpSyw==", "dev": true, "license": "MIT", "engines": { @@ -9158,9 +9158,9 @@ } }, "node_modules/eslint": { - "version": "9.30.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.30.1.tgz", - "integrity": "sha512-zmxXPNMOXmwm9E0yQLi5uqXHs7uq2UIiqEKo3Gq+3fwo1XrJ+hijAZImyF7hclW3E6oHz43Yk3RP8at6OTKflQ==", + "version": "9.31.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.31.0.tgz", + "integrity": "sha512-QldCVh/ztyKJJZLr4jXNUByx3gR+TDYZCRXEktiZoUR3PGy4qCmSbkxcIle8GEwGpb5JBZazlaJ/CxLidXdEbQ==", "dev": true, "license": "MIT", "dependencies": { @@ -9168,9 +9168,9 @@ "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.0", "@eslint/config-helpers": "^0.3.0", - "@eslint/core": "^0.14.0", + "@eslint/core": "^0.15.0", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.30.1", + "@eslint/js": "9.31.0", "@eslint/plugin-kit": "^0.3.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", @@ -9630,9 +9630,9 @@ } }, "node_modules/eslint/node_modules/@eslint/core": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz", - "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==", + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.1.tgz", + "integrity": "sha512-bkOp+iumZCCbt1K1CmWf0R9pM5yKpDv+ZXtvSyQpudrI9kuFLp+bM2WOPXImuD/ceQuaa8f5pj93Y7zyECIGNA==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -9656,19 +9656,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/eslint/node_modules/@eslint/plugin-kit/node_modules/@eslint/core": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.1.tgz", - "integrity": "sha512-bkOp+iumZCCbt1K1CmWf0R9pM5yKpDv+ZXtvSyQpudrI9kuFLp+bM2WOPXImuD/ceQuaa8f5pj93Y7zyECIGNA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", diff --git a/package.json b/package.json index 2b21ff1..817abbb 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "c8": "^10.1.3", "concurrently": "^9.2.0", "editorconfig-checker": "^6.0.0", - "eslint": "^9.30.1", + "eslint": "^9.31.0", "eslint-config-bananass": "^0.2.0", "eslint-plugin-mark": "^0.1.0-canary.1", "husky": "^9.1.5", From df49101bd4774ac8913c249a2d219087563de5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A3=A8=EB=B0=80LuMir?= Date: Mon, 14 Jul 2025 19:41:00 +0900 Subject: [PATCH 4/5] fix(*): drop `shx` and replace it with Node.js native script (#402) This pull request refactors the handling of file permissions across three packages (`clang-format-git-python`, `clang-format-git`, and `clang-format-node`) by replacing the use of the `shx` dependency with custom `chmod.js` scripts. These scripts ensure that the necessary files and binaries have the correct execution permissions. Additionally, the `postinstall` and `postbuild` scripts are updated to use these new `chmod.js` files, and the `shx` dependency is removed. ### File Permission Handling Updates: * [`packages/clang-format-git-python/chmod.js`](diffhunk://#diff-27b69f71118a60e9a2ad54a11e79e10b8485e6080af45ec037ee193fd598c77cR1-R26): Added a script to set execution permissions for the `git-clang-format` script using `chmodSync`. * [`packages/clang-format-git/chmod.js`](diffhunk://#diff-337db8b3485bbb276d0c1b16655b094b11cf7605b7adc8e52a4b3f06d0e9edabR1-R33): Added a script to set execution permissions for binaries in the `bin` directory, filtering for files containing `git-clang-format`. * [`packages/clang-format-node/chmod.js`](diffhunk://#diff-36fbb1ea12298f23d64d479606f6b239ed8a2ca3373684dbd49b5037f16bbfe6R1-R36): Added a script to set execution permissions for binaries in the `bin` directory, filtering for files containing `clang-format`. ### Package Configuration Updates: * [`packages/clang-format-git-python/package.json`](diffhunk://#diff-fb0eb5dba5b2656b3fdea4322c2ed2a691973f2e9ea536ce20b36c347ab1267eR9): Added `chmod.js` to the `files` array, replaced `npm run chmod` with `node chmod.js` in the `postinstall` script, and removed the `shx` dependency. [[1]](diffhunk://#diff-fb0eb5dba5b2656b3fdea4322c2ed2a691973f2e9ea536ce20b36c347ab1267eR9) [[2]](diffhunk://#diff-fb0eb5dba5b2656b3fdea4322c2ed2a691973f2e9ea536ce20b36c347ab1267eL52-R61) * [`packages/clang-format-git/package.json`](diffhunk://#diff-d85dcfb0934f579cff896723ab5eeb9a52668d2bb322338dddd93bc1241aa4f1R9): Added `chmod.js` to the `files` array, replaced `npm run chmod` with `node chmod.js` in the `postinstall` script, and removed the `shx` dependency. [[1]](diffhunk://#diff-d85dcfb0934f579cff896723ab5eeb9a52668d2bb322338dddd93bc1241aa4f1R9) [[2]](diffhunk://#diff-d85dcfb0934f579cff896723ab5eeb9a52668d2bb322338dddd93bc1241aa4f1L51-R60) * [`packages/clang-format-node/package.json`](diffhunk://#diff-6e04d643c57b851ab02ad78e41531387d2cc01caf6c4cfbaa536aadd37346a30R9): Added `chmod.js` to the `files` array, replaced `npm run chmod` with `node chmod.js` in the `postinstall` script, and removed the `shx` dependency. [[1]](diffhunk://#diff-6e04d643c57b851ab02ad78e41531387d2cc01caf6c4cfbaa536aadd37346a30R9) [[2]](diffhunk://#diff-6e04d643c57b851ab02ad78e41531387d2cc01caf6c4cfbaa536aadd37346a30L50-L60) --- package-lock.json | 242 +++--------------- packages/clang-format-git-python/chmod.js | 26 ++ packages/clang-format-git-python/package.json | 8 +- packages/clang-format-git/chmod.js | 33 +++ packages/clang-format-git/package.json | 8 +- packages/clang-format-node/chmod.js | 36 +++ packages/clang-format-node/package.json | 8 +- website/index.md | 4 +- 8 files changed, 137 insertions(+), 228 deletions(-) create mode 100644 packages/clang-format-git-python/chmod.js create mode 100644 packages/clang-format-git/chmod.js create mode 100644 packages/clang-format-node/chmod.js diff --git a/package-lock.json b/package-lock.json index 77c8fcd..65a3eb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3809,6 +3809,7 @@ "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", @@ -3822,6 +3823,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, "license": "MIT", "engines": { "node": ">= 8" @@ -3831,6 +3833,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", @@ -7011,6 +7014,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, "license": "MIT", "dependencies": { "fill-range": "^7.1.1" @@ -8824,6 +8828,7 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, "license": "MIT", "dependencies": { "once": "^1.4.0" @@ -9915,6 +9920,7 @@ "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -9962,6 +9968,7 @@ "version": "1.19.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz", "integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==", + "dev": true, "license": "ISC", "dependencies": { "reusify": "^1.0.4" @@ -10047,6 +10054,7 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" @@ -10293,6 +10301,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -10737,6 +10746,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.1" @@ -10926,6 +10936,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -11536,15 +11547,6 @@ "node": ">= 0.4" } }, - "node_modules/interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/ip-address": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", @@ -11721,6 +11723,7 @@ "version": "2.16.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, "license": "MIT", "dependencies": { "hasown": "^2.0.2" @@ -11798,6 +11801,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -11855,6 +11859,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" @@ -11921,6 +11926,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.12.0" @@ -12211,6 +12217,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, "license": "ISC" }, "node_modules/isobject": { @@ -14385,6 +14392,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, "license": "MIT", "engines": { "node": ">= 8" @@ -15107,6 +15115,7 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, "license": "MIT", "dependencies": { "braces": "^3.0.3", @@ -15189,6 +15198,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -15552,12 +15562,6 @@ "node": ">= 10" } }, - "node_modules/nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "license": "MIT" - }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -16300,6 +16304,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -16475,6 +16480,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "dev": true, "license": "MIT", "engines": { "node": ">=4" @@ -16843,6 +16849,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, "license": "MIT" }, "node_modules/path-scurry": { @@ -16924,6 +16931,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, "license": "MIT", "engines": { "node": ">=8.6" @@ -17319,16 +17327,6 @@ "dev": true, "license": "MIT" }, - "node_modules/pump": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", - "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -17353,6 +17351,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, "funding": [ { "type": "github", @@ -17657,17 +17656,6 @@ "node": ">=8.10.0" } }, - "node_modules/rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "dependencies": { - "resolve": "^1.1.6" - }, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", @@ -17905,6 +17893,7 @@ "version": "1.22.10", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, "license": "MIT", "dependencies": { "is-core-module": "^2.16.0", @@ -18005,6 +17994,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, "license": "MIT", "engines": { "iojs": ">=1.0.0", @@ -18161,6 +18151,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, "funding": [ { "type": "github", @@ -18371,148 +18362,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/shelljs": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.9.2.tgz", - "integrity": "sha512-S3I64fEiKgTZzKCC46zT/Ib9meqofLrQVbpSswtjFfAVDW+AZ54WTnAM/3/yENoxz/V1Cy6u3kiiEbQ4DNphvw==", - "license": "BSD-3-Clause", - "dependencies": { - "execa": "^1.0.0", - "fast-glob": "^3.3.2", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/shelljs/node_modules/cross-spawn": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", - "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/shelljs/node_modules/execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "license": "MIT", - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/shelljs/node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/shelljs/node_modules/is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/shelljs/node_modules/npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/shelljs/node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/shelljs/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/shelljs/node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/shelljs/node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/shelljs/node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "license": "ISC" - }, - "node_modules/shelljs/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, "node_modules/shiki": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/shiki/-/shiki-2.1.0.tgz", @@ -18530,22 +18379,6 @@ "@types/hast": "^3.0.4" } }, - "node_modules/shx": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/shx/-/shx-0.4.0.tgz", - "integrity": "sha512-Z0KixSIlGPpijKgcH6oCMCbltPImvaKy0sGH8AkLRXw1KyzpKtaCTizP2xen+hNDqVF4xxgvA0KXSb9o4Q6hnA==", - "license": "MIT", - "dependencies": { - "minimist": "^1.2.8", - "shelljs": "^0.9.2" - }, - "bin": { - "shx": "lib/cli.js" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -19176,15 +19009,6 @@ "node": ">=8" } }, - "node_modules/strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", @@ -19261,6 +19085,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -19938,6 +19763,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "license": "MIT", "dependencies": { "is-number": "^7.0.0" @@ -21234,6 +21060,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, "license": "ISC" }, "node_modules/write-file-atomic": { @@ -21465,8 +21292,7 @@ "hasInstallScript": true, "license": "MIT", "dependencies": { - "clang-format-node": "^1.3.4", - "shx": "^0.4.0" + "clang-format-node": "^1.3.4" }, "bin": { "clang-format-git": "build/cli.js", @@ -21481,8 +21307,7 @@ "hasInstallScript": true, "license": "MIT", "dependencies": { - "clang-format-node": "^1.3.4", - "shx": "^0.4.0" + "clang-format-node": "^1.3.4" }, "bin": { "clang-format-git-python": "build/cli.js", @@ -21496,9 +21321,6 @@ "version": "1.3.4", "hasInstallScript": true, "license": "MIT", - "dependencies": { - "shx": "^0.4.0" - }, "bin": { "clang-format": "build/cli.js", "clang-format-node": "build/cli.js" diff --git a/packages/clang-format-git-python/chmod.js b/packages/clang-format-git-python/chmod.js new file mode 100644 index 0000000..b16f71a --- /dev/null +++ b/packages/clang-format-git-python/chmod.js @@ -0,0 +1,26 @@ +/** + * @fileoverview Script to change permissions of a script. + */ + +/* eslint-disable n/prefer-node-protocol -- DO NOT USE `node:` namespace for backward compatibility */ + +// -------------------------------------------------------------------------------- +// Require +// -------------------------------------------------------------------------------- + +const { resolve } = require('path'); +const { chmodSync } = require('fs'); + +// -------------------------------------------------------------------------------- +// Execution +// -------------------------------------------------------------------------------- + +const scriptPath = resolve(__dirname, 'script', 'git-clang-format'); + +try { + chmodSync(scriptPath, 0o755); +} catch (error) { + // eslint-disable-next-line no-console + console.error(`Error changing permissions for ${scriptPath}:`, error.message); + throw error; +} diff --git a/packages/clang-format-git-python/package.json b/packages/clang-format-git-python/package.json index fd949ea..e50f13d 100644 --- a/packages/clang-format-git-python/package.json +++ b/packages/clang-format-git-python/package.json @@ -6,6 +6,7 @@ "files": [ "build", "script", + "chmod.js", "LICENSE.md", "README.md" ], @@ -49,17 +50,14 @@ "provenance": true }, "scripts": { - "postinstall": "npm run chmod", + "postinstall": "node chmod.js || exit 0", "prepublishOnly": "npm run build", "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs ../../LICENSE.md LICENSE.md ../../README.md README.md", - "postbuild": "npm run chmod", "test": "node --test", - "chmod": "shx chmod 755 ./script/**/* || exit 0", "dev": "node src/cli.js", "start": "node build/cli.js" }, "dependencies": { - "clang-format-node": "^1.3.4", - "shx": "^0.4.0" + "clang-format-node": "^1.3.4" } } diff --git a/packages/clang-format-git/chmod.js b/packages/clang-format-git/chmod.js new file mode 100644 index 0000000..50f7dbd --- /dev/null +++ b/packages/clang-format-git/chmod.js @@ -0,0 +1,33 @@ +/** + * @fileoverview Script to change permissions of binaries. + */ + +/* eslint-disable n/prefer-node-protocol -- DO NOT USE `node:` namespace for backward compatibility */ + +// -------------------------------------------------------------------------------- +// Require +// -------------------------------------------------------------------------------- + +const { resolve } = require('path'); +const { chmodSync, readdirSync } = require('fs'); + +// -------------------------------------------------------------------------------- +// Execution +// -------------------------------------------------------------------------------- + +const binPath = resolve(__dirname, 'bin'); +const clangFormatGitPaths = readdirSync(binPath, { + recursive: true, +}) + .filter(path => path.includes('git-clang-format')) + .map(path => resolve(binPath, path)); + +clangFormatGitPaths.forEach(clangFormatGitPath => { + try { + chmodSync(clangFormatGitPath, 0o755); + } catch (error) { + // eslint-disable-next-line no-console + console.error(`Error changing permissions for ${clangFormatGitPath}:`, error.message); + throw error; + } +}); diff --git a/packages/clang-format-git/package.json b/packages/clang-format-git/package.json index 34336cc..3e5eb17 100644 --- a/packages/clang-format-git/package.json +++ b/packages/clang-format-git/package.json @@ -6,6 +6,7 @@ "files": [ "bin", "build", + "chmod.js", "LICENSE.md", "README.md" ], @@ -48,17 +49,14 @@ "provenance": true }, "scripts": { - "postinstall": "npm run chmod", + "postinstall": "node chmod.js || exit 0", "prepublishOnly": "npm run build", "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs ../../LICENSE.md LICENSE.md ../../README.md README.md", - "postbuild": "npm run chmod", "test": "node --test", - "chmod": "shx chmod 755 ./bin/**/* || exit 0", "dev": "node src/cli.js", "start": "node build/cli.js" }, "dependencies": { - "clang-format-node": "^1.3.4", - "shx": "^0.4.0" + "clang-format-node": "^1.3.4" } } diff --git a/packages/clang-format-node/chmod.js b/packages/clang-format-node/chmod.js new file mode 100644 index 0000000..7d0207a --- /dev/null +++ b/packages/clang-format-node/chmod.js @@ -0,0 +1,36 @@ +/** + * @fileoverview Script to change permissions of binaries. + */ + +/* eslint-disable n/prefer-node-protocol -- DO NOT USE `node:` namespace for backward compatibility */ + +// -------------------------------------------------------------------------------- +// Require +// -------------------------------------------------------------------------------- + +const { resolve } = require('path'); +const { chmodSync, readdirSync } = require('fs'); + +// -------------------------------------------------------------------------------- +// Execution +// -------------------------------------------------------------------------------- + +const binPath = resolve(__dirname, 'bin'); +const clangFormatNodePaths = readdirSync(binPath, { + recursive: true, +}) + .filter(path => path.includes('clang-format')) + .map(path => resolve(binPath, path)); + +clangFormatNodePaths.forEach(clangFormatNodePath => { + try { + chmodSync(clangFormatNodePath, 0o755); + } catch (error) { + // eslint-disable-next-line no-console + console.error( + `Error changing permissions for ${clangFormatNodePath}:`, + error.message, + ); + throw error; + } +}); diff --git a/packages/clang-format-node/package.json b/packages/clang-format-node/package.json index da3a110..5da0754 100644 --- a/packages/clang-format-node/package.json +++ b/packages/clang-format-node/package.json @@ -6,6 +6,7 @@ "files": [ "bin", "build", + "chmod.js", "LICENSE.md", "README.md" ], @@ -47,16 +48,11 @@ "provenance": true }, "scripts": { - "postinstall": "npm run chmod", + "postinstall": "node chmod.js || exit 0", "prepublishOnly": "npm run build", "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs ../../LICENSE.md LICENSE.md ../../README.md README.md", - "postbuild": "npm run chmod", "test": "node --test", - "chmod": "shx chmod 755 ./bin/**/* || exit 0", "dev": "node src/cli.js", "start": "node build/cli.js" - }, - "dependencies": { - "shx": "^0.4.0" } } diff --git a/website/index.md b/website/index.md index a53c2d5..1a07ef2 100644 --- a/website/index.md +++ b/website/index.md @@ -32,8 +32,8 @@ features: linkText: Migration Guide - icon: '' - title: Use only Node.js, no other dependencies needed - details: No need for Python or C++. Just use Node.js with no additional dependencies required. + title: Zero dependencies + details: No need for Python, C++, or any npm sub-dependencies. Just use Node.js alone, with no extra dependencies. link: /docs/get-started/installation linkText: Installation From 6469d991ff716a5296b7f8d42147e930b9755812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A3=A8=EB=B0=80LuMir?= Date: Mon, 14 Jul 2025 19:58:02 +0900 Subject: [PATCH 5/5] chore(release): bump package versions from `v1.3.4` to `v1.3.5` (`patch`) (#404) ## Release Information: `v1.3.5` New release of `lumirlumir/npm-clang-format-node` has arrived! :tada: This PR bumps the package versions from `v1.3.4` to `v1.3.5` (`patch`). See [Actions](https://github.com/lumirlumir/npm-clang-format-node/actions/runs/16264909140) for more details. | Info | Value | | ----------- | -------------------------- | | Repository | `lumirlumir/npm-clang-format-node` | | SEMVER | `patch` | | Pre ID | `canary` | | Short SHA | df49101 | | Old Version | `v1.3.4` | | New Version | `v1.3.5` | ## What's Changed ### :bug: Bug Fixes * fix(*): drop `shx` and replace it with Node.js native script by @lumirlumir in https://github.com/lumirlumir/npm-clang-format-node/pull/402 ### :hammer_and_wrench: Builds * build(*): add `cp.mjs` script for file copying and update build scripts by @lumirlumir in https://github.com/lumirlumir/npm-clang-format-node/pull/400 ### :recycle: Code Refactoring * refactor(*): simplify paths to the binary files by @lumirlumir in https://github.com/lumirlumir/npm-clang-format-node/pull/401 ### :arrow_up: Dependency Updates * chore(deps-dev): bump eslint from 9.30.1 to 9.31.0 by @dependabot[bot] in https://github.com/lumirlumir/npm-clang-format-node/pull/403 **Full Changelog**: https://github.com/lumirlumir/npm-clang-format-node/compare/v1.3.4...v1.3.5 --- examples/clang-format/package.json | 4 +- examples/git-clang-format/package.json | 4 +- lerna.json | 2 +- package-lock.json | 44 +++++++++--------- packages/clang-format-git-python/package.json | 4 +- .../script/git-clang-format | 0 .../bin/cfg-darwin-arm64/git-clang-format | Bin .../bin/cfg-darwin-x64/git-clang-format | Bin .../bin/cfg-linux-arm/git-clang-format | Bin .../bin/cfg-linux-arm64/git-clang-format | Bin .../bin/cfg-linux-ppc64/git-clang-format | Bin .../bin/cfg-linux-s390x/git-clang-format | Bin .../bin/cfg-linux-x64/git-clang-format | Bin .../bin/cfg-win32-x64/git-clang-format.exe | Bin packages/clang-format-git/package.json | 4 +- .../bin/cfn-darwin-arm64/clang-format | Bin .../bin/cfn-darwin-x64/clang-format | Bin .../bin/cfn-linux-arm/clang-format | Bin .../bin/cfn-linux-arm64/clang-format | Bin .../bin/cfn-linux-ppc64/clang-format | Bin .../bin/cfn-linux-s390x/clang-format | Bin .../bin/cfn-linux-x64/clang-format | Bin .../bin/cfn-win32-x64/clang-format.exe | Bin packages/clang-format-node/package.json | 2 +- tests/integration-api-cjs/package.json | 8 ++-- tests/integration-api-esm/package.json | 8 ++-- .../package.json | 8 ++-- website/package.json | 2 +- 28 files changed, 45 insertions(+), 45 deletions(-) mode change 100644 => 100755 packages/clang-format-git-python/script/git-clang-format mode change 100644 => 100755 packages/clang-format-git/bin/cfg-darwin-arm64/git-clang-format mode change 100644 => 100755 packages/clang-format-git/bin/cfg-darwin-x64/git-clang-format mode change 100644 => 100755 packages/clang-format-git/bin/cfg-linux-arm/git-clang-format mode change 100644 => 100755 packages/clang-format-git/bin/cfg-linux-arm64/git-clang-format mode change 100644 => 100755 packages/clang-format-git/bin/cfg-linux-ppc64/git-clang-format mode change 100644 => 100755 packages/clang-format-git/bin/cfg-linux-s390x/git-clang-format mode change 100644 => 100755 packages/clang-format-git/bin/cfg-linux-x64/git-clang-format mode change 100644 => 100755 packages/clang-format-git/bin/cfg-win32-x64/git-clang-format.exe mode change 100644 => 100755 packages/clang-format-node/bin/cfn-darwin-arm64/clang-format mode change 100644 => 100755 packages/clang-format-node/bin/cfn-darwin-x64/clang-format mode change 100644 => 100755 packages/clang-format-node/bin/cfn-linux-arm/clang-format mode change 100644 => 100755 packages/clang-format-node/bin/cfn-linux-arm64/clang-format mode change 100644 => 100755 packages/clang-format-node/bin/cfn-linux-ppc64/clang-format mode change 100644 => 100755 packages/clang-format-node/bin/cfn-linux-s390x/clang-format mode change 100644 => 100755 packages/clang-format-node/bin/cfn-linux-x64/clang-format mode change 100644 => 100755 packages/clang-format-node/bin/cfn-win32-x64/clang-format.exe diff --git a/examples/clang-format/package.json b/examples/clang-format/package.json index 0307103..ef41c0b 100644 --- a/examples/clang-format/package.json +++ b/examples/clang-format/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "examples-clang-format", - "version": "1.3.4", + "version": "1.3.5", "scripts": { "formatted:c": "npx clang-format src/formatted.c", "formatted:c:dry-run": "npx clang-format -Werror -n src/formatted.c", @@ -13,6 +13,6 @@ "unformatted:cpp:dry-run": "npx clang-format -Werror -n src/unformatted.cpp" }, "dependencies": { - "clang-format-node": "^1.3.4" + "clang-format-node": "^1.3.5" } } diff --git a/examples/git-clang-format/package.json b/examples/git-clang-format/package.json index c210ba5..2f563b5 100644 --- a/examples/git-clang-format/package.json +++ b/examples/git-clang-format/package.json @@ -1,13 +1,13 @@ { "private": true, "name": "examples-git-clang-format", - "version": "1.3.4", + "version": "1.3.5", "scripts": { "add-a-space-to-line-9-of-main-c-file": "node -e \"require('fs').copyFileSync('src/main_overwrite.txt','src/main.c')\"", "git-add": "git add src/main.c && git status", "git-clang-format": "npx git-clang-format" }, "dependencies": { - "clang-format-git": "^1.3.4" + "clang-format-git": "^1.3.5" } } diff --git a/lerna.json b/lerna.json index fc521aa..08ddb76 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "1.3.4" + "version": "1.3.5" } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 65a3eb2..98558a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,16 +37,16 @@ }, "examples/clang-format": { "name": "examples-clang-format", - "version": "1.3.4", + "version": "1.3.5", "dependencies": { - "clang-format-node": "^1.3.4" + "clang-format-node": "^1.3.5" } }, "examples/git-clang-format": { "name": "examples-git-clang-format", - "version": "1.3.4", + "version": "1.3.5", "dependencies": { - "clang-format-git": "^1.3.4" + "clang-format-git": "^1.3.5" } }, "node_modules/@actions/core": { @@ -21288,11 +21288,11 @@ } }, "packages/clang-format-git": { - "version": "1.3.4", + "version": "1.3.5", "hasInstallScript": true, "license": "MIT", "dependencies": { - "clang-format-node": "^1.3.4" + "clang-format-node": "^1.3.5" }, "bin": { "clang-format-git": "build/cli.js", @@ -21303,11 +21303,11 @@ } }, "packages/clang-format-git-python": { - "version": "1.3.4", + "version": "1.3.5", "hasInstallScript": true, "license": "MIT", "dependencies": { - "clang-format-node": "^1.3.4" + "clang-format-node": "^1.3.5" }, "bin": { "clang-format-git-python": "build/cli.js", @@ -21318,7 +21318,7 @@ } }, "packages/clang-format-node": { - "version": "1.3.4", + "version": "1.3.5", "hasInstallScript": true, "license": "MIT", "bin": { @@ -21331,20 +21331,20 @@ }, "tests/integration-api-cjs": { "name": "tests-integration-api-cjs", - "version": "1.3.4", + "version": "1.3.5", "dependencies": { - "clang-format-git": "^1.3.4", - "clang-format-git-python": "^1.3.4", - "clang-format-node": "^1.3.4" + "clang-format-git": "^1.3.5", + "clang-format-git-python": "^1.3.5", + "clang-format-node": "^1.3.5" } }, "tests/integration-api-esm": { "name": "tests-integration-api-esm", - "version": "1.3.4", + "version": "1.3.5", "dependencies": { - "clang-format-git": "^1.3.4", - "clang-format-git-python": "^1.3.4", - "clang-format-node": "^1.3.4" + "clang-format-git": "^1.3.5", + "clang-format-git-python": "^1.3.5", + "clang-format-node": "^1.3.5" } }, "tests/integration-binaries-perimission": { @@ -21357,11 +21357,11 @@ }, "tests/integration-binaries-permission": { "name": "tests-integration-binaries-permission", - "version": "1.3.4", + "version": "1.3.5", "dependencies": { - "clang-format-git": "^1.3.4", - "clang-format-git-python": "^1.3.4", - "clang-format-node": "^1.3.4" + "clang-format-git": "^1.3.5", + "clang-format-git-python": "^1.3.5", + "clang-format-node": "^1.3.5" } }, "tests/integration-cjs": { @@ -21397,7 +21397,7 @@ } }, "website": { - "version": "1.3.4", + "version": "1.3.5", "devDependencies": { "@codecov/vite-plugin": "^1.9.1", "markdown-it-footnote": "^4.0.0", diff --git a/packages/clang-format-git-python/package.json b/packages/clang-format-git-python/package.json index e50f13d..59fc74e 100644 --- a/packages/clang-format-git-python/package.json +++ b/packages/clang-format-git-python/package.json @@ -1,6 +1,6 @@ { "name": "clang-format-git-python", - "version": "1.3.4", + "version": "1.3.5", "description": "Node wrapper for git-clang-format Python script. This package requires Python3 as a dependency.🐉", "main": "build/index.js", "files": [ @@ -58,6 +58,6 @@ "start": "node build/cli.js" }, "dependencies": { - "clang-format-node": "^1.3.4" + "clang-format-node": "^1.3.5" } } diff --git a/packages/clang-format-git-python/script/git-clang-format b/packages/clang-format-git-python/script/git-clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-git/bin/cfg-darwin-arm64/git-clang-format b/packages/clang-format-git/bin/cfg-darwin-arm64/git-clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-git/bin/cfg-darwin-x64/git-clang-format b/packages/clang-format-git/bin/cfg-darwin-x64/git-clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-git/bin/cfg-linux-arm/git-clang-format b/packages/clang-format-git/bin/cfg-linux-arm/git-clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-git/bin/cfg-linux-arm64/git-clang-format b/packages/clang-format-git/bin/cfg-linux-arm64/git-clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-git/bin/cfg-linux-ppc64/git-clang-format b/packages/clang-format-git/bin/cfg-linux-ppc64/git-clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-git/bin/cfg-linux-s390x/git-clang-format b/packages/clang-format-git/bin/cfg-linux-s390x/git-clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-git/bin/cfg-linux-x64/git-clang-format b/packages/clang-format-git/bin/cfg-linux-x64/git-clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-git/bin/cfg-win32-x64/git-clang-format.exe b/packages/clang-format-git/bin/cfg-win32-x64/git-clang-format.exe old mode 100644 new mode 100755 diff --git a/packages/clang-format-git/package.json b/packages/clang-format-git/package.json index 3e5eb17..25bc703 100644 --- a/packages/clang-format-git/package.json +++ b/packages/clang-format-git/package.json @@ -1,6 +1,6 @@ { "name": "clang-format-git", - "version": "1.3.4", + "version": "1.3.5", "description": "Node wrapper for git-clang-format Python script as a standalone native binary to allow execution without a Python dependency.🐉", "main": "build/index.js", "files": [ @@ -57,6 +57,6 @@ "start": "node build/cli.js" }, "dependencies": { - "clang-format-node": "^1.3.4" + "clang-format-node": "^1.3.5" } } diff --git a/packages/clang-format-node/bin/cfn-darwin-arm64/clang-format b/packages/clang-format-node/bin/cfn-darwin-arm64/clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-node/bin/cfn-darwin-x64/clang-format b/packages/clang-format-node/bin/cfn-darwin-x64/clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-node/bin/cfn-linux-arm/clang-format b/packages/clang-format-node/bin/cfn-linux-arm/clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-node/bin/cfn-linux-arm64/clang-format b/packages/clang-format-node/bin/cfn-linux-arm64/clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-node/bin/cfn-linux-ppc64/clang-format b/packages/clang-format-node/bin/cfn-linux-ppc64/clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-node/bin/cfn-linux-s390x/clang-format b/packages/clang-format-node/bin/cfn-linux-s390x/clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-node/bin/cfn-linux-x64/clang-format b/packages/clang-format-node/bin/cfn-linux-x64/clang-format old mode 100644 new mode 100755 diff --git a/packages/clang-format-node/bin/cfn-win32-x64/clang-format.exe b/packages/clang-format-node/bin/cfn-win32-x64/clang-format.exe old mode 100644 new mode 100755 diff --git a/packages/clang-format-node/package.json b/packages/clang-format-node/package.json index 5da0754..684456c 100644 --- a/packages/clang-format-node/package.json +++ b/packages/clang-format-node/package.json @@ -1,6 +1,6 @@ { "name": "clang-format-node", - "version": "1.3.4", + "version": "1.3.5", "description": "Node wrapper for clang-format native binary inspired by angular/clang-format.🐉", "main": "build/index.js", "files": [ diff --git a/tests/integration-api-cjs/package.json b/tests/integration-api-cjs/package.json index 75dac37..5dc670e 100644 --- a/tests/integration-api-cjs/package.json +++ b/tests/integration-api-cjs/package.json @@ -1,14 +1,14 @@ { "private": true, "name": "tests-integration-api-cjs", - "version": "1.3.4", + "version": "1.3.5", "type": "commonjs", "scripts": { "test": "node --test" }, "dependencies": { - "clang-format-git": "^1.3.4", - "clang-format-git-python": "^1.3.4", - "clang-format-node": "^1.3.4" + "clang-format-git": "^1.3.5", + "clang-format-git-python": "^1.3.5", + "clang-format-node": "^1.3.5" } } diff --git a/tests/integration-api-esm/package.json b/tests/integration-api-esm/package.json index aeb6be4..5d61058 100644 --- a/tests/integration-api-esm/package.json +++ b/tests/integration-api-esm/package.json @@ -1,14 +1,14 @@ { "private": true, "name": "tests-integration-api-esm", - "version": "1.3.4", + "version": "1.3.5", "type": "module", "scripts": { "test": "node --test" }, "dependencies": { - "clang-format-git": "^1.3.4", - "clang-format-git-python": "^1.3.4", - "clang-format-node": "^1.3.4" + "clang-format-git": "^1.3.5", + "clang-format-git-python": "^1.3.5", + "clang-format-node": "^1.3.5" } } diff --git a/tests/integration-binaries-permission/package.json b/tests/integration-binaries-permission/package.json index dd587a0..dfe6fef 100644 --- a/tests/integration-binaries-permission/package.json +++ b/tests/integration-binaries-permission/package.json @@ -1,13 +1,13 @@ { "private": true, "name": "tests-integration-binaries-permission", - "version": "1.3.4", + "version": "1.3.5", "scripts": { "test": "node --test" }, "dependencies": { - "clang-format-git": "^1.3.4", - "clang-format-git-python": "^1.3.4", - "clang-format-node": "^1.3.4" + "clang-format-git": "^1.3.5", + "clang-format-git-python": "^1.3.5", + "clang-format-node": "^1.3.5" } } diff --git a/website/package.json b/website/package.json index a4d073f..1562440 100644 --- a/website/package.json +++ b/website/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "website", - "version": "1.3.4", + "version": "1.3.5", "type": "module", "scripts": { "dev": "npx vitepress --open --host", pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy