clang-format-node 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * The ABSOLUTE path to the `clang-format` executable binary based on the OS platform and architecture.
3
- *
4
3
  * @alias `clangFormatNodePath`. See {@link clangFormatNodePath}.
5
4
  * @version `v1.2.0` Initial release.
6
5
  * @see https://clang-format-node.lumir.page/docs/apis/clang-format-node
@@ -8,7 +7,6 @@
8
7
  export const clangFormatPath: string;
9
8
  /**
10
9
  * Alias for `clangFormatPath`.
11
- *
12
10
  * @alias `clangFormatPath`. See {@link clangFormatPath}.
13
11
  * @version `v1.2.0` Initial release.
14
12
  * @see https://clang-format-node.lumir.page/docs/apis/clang-format-node
@@ -4,7 +4,6 @@
4
4
  * The possible combinations are `darwin-arm64`, `darwin-x64`, `linux-arm`, `linux-arm64`, `linux-ppc64`, `linux-s390x`, `linux-x64`, `win32-x64`.
5
5
  *
6
6
  * Throws an error if the executable is not found.
7
- *
8
7
  * @param {string} osPlatform The current operating system platform. (e.g., `darwin`, `linux`, `win32`)
9
8
  * @param {string} architecture The current system architecture. (e.g., `arm`, `arm64`, `ppc64`, `s390x`, `x64`)
10
9
  * @returns {string} The ABSOLUTE path to the `clang-format` executable binary.
@@ -20,7 +19,6 @@ export function getClangFormatPath(osPlatform: string, architecture: string): st
20
19
  * The possible combinations are `darwin-arm64`, `darwin-x64`, `linux-arm`, `linux-arm64`, `linux-ppc64`, `linux-s390x`, `linux-x64`, `win32-x64`.
21
20
  *
22
21
  * Throws an error if the executable is not found.
23
- *
24
22
  * @param {string} osPlatform The current operating system platform. (e.g., `darwin`, `linux`, `win32`)
25
23
  * @param {string} architecture The current system architecture. (e.g., `arm`, `arm64`, `ppc64`, `s390x`, `x64`)
26
24
  * @returns {string} The ABSOLUTE path to the `clang-format` executable binary.
@@ -1 +1 @@
1
- "use strict";var _require=require("fs"),existsSync=_require.existsSync;var _require2=require("path"),resolve=_require2.resolve;function getClangFormatPath(osPlatform,architecture){var clangFormatPath=resolve(__dirname,"..","bin","cfn-".concat(osPlatform,"-").concat(architecture),"clang-format".concat(osPlatform==="win32"?".exe":""));if(!existsSync(clangFormatPath))throw new Error("No executable found for '".concat(osPlatform,"(OS platform)-").concat(architecture,"(architecture)'\nThe possible combinations are 'darwin-arm64', 'darwin-x64', 'linux-arm', 'linux-arm64', 'linux-ppc64', 'linux-s390x', 'linux-x64', 'win32-x64'"));return clangFormatPath}var getClangFormatNodePath=getClangFormatPath;module.exports={getClangFormatPath:getClangFormatPath,getClangFormatNodePath:getClangFormatNodePath};
1
+ "use strict";var _require=require("fs"),existsSync=_require.existsSync;var _require2=require("path"),resolve=_require2.resolve;function getClangFormatPath(osPlatform,architecture){var clangFormatPath=resolve(__dirname,"..","..","bin","cfn-".concat(osPlatform,"-").concat(architecture),"clang-format".concat(osPlatform==="win32"?".exe":""));if(!existsSync(clangFormatPath))throw new Error("No executable found for '".concat(osPlatform,"(OS platform)-").concat(architecture,"(architecture)'\nThe possible combinations are 'darwin-arm64', 'darwin-x64', 'linux-arm', 'linux-arm64', 'linux-ppc64', 'linux-s390x', 'linux-x64', 'win32-x64'"));return clangFormatPath}var getClangFormatNodePath=getClangFormatPath;module.exports={getClangFormatPath:getClangFormatPath,getClangFormatNodePath:getClangFormatNodePath};
package/chmod.js ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @fileoverview Script to change permissions of binaries.
3
+ */
4
+
5
+ /* eslint-disable n/prefer-node-protocol -- DO NOT USE `node:` namespace for backward compatibility */
6
+
7
+ // --------------------------------------------------------------------------------
8
+ // Require
9
+ // --------------------------------------------------------------------------------
10
+
11
+ const { resolve } = require('path');
12
+ const { chmodSync, readdirSync } = require('fs');
13
+
14
+ // --------------------------------------------------------------------------------
15
+ // Execution
16
+ // --------------------------------------------------------------------------------
17
+
18
+ const binPath = resolve(__dirname, 'bin');
19
+ const clangFormatNodePaths = readdirSync(binPath, {
20
+ recursive: true,
21
+ })
22
+ .filter(path => path.includes('clang-format'))
23
+ .map(path => resolve(binPath, path));
24
+
25
+ clangFormatNodePaths.forEach(clangFormatNodePath => {
26
+ try {
27
+ chmodSync(clangFormatNodePath, 0o755);
28
+ } catch (error) {
29
+ // eslint-disable-next-line no-console
30
+ console.error(
31
+ `Error changing permissions for ${clangFormatNodePath}:`,
32
+ error.message,
33
+ );
34
+ throw error;
35
+ }
36
+ });
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "clang-format-node",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Node wrapper for clang-format native binary inspired by angular/clang-format.🐉",
5
5
  "main": "build/index.js",
6
6
  "files": [
7
+ "bin",
7
8
  "build",
9
+ "chmod.js",
8
10
  "LICENSE.md",
9
11
  "README.md"
10
12
  ],
@@ -46,17 +48,12 @@
46
48
  "provenance": true
47
49
  },
48
50
  "scripts": {
49
- "postinstall": "shx test -d src && npm run build || npm run chmod",
51
+ "postinstall": "node chmod.js || exit 0",
50
52
  "prepublishOnly": "npm run build",
51
- "build": "npx babel src -d build && npx tsc && shx cp -r src/bin build && shx cp ../../LICENSE.md ../../README.md .",
52
- "postbuild": "npm run chmod",
53
+ "build": "npx babel src -d build && npx tsc && node ../../scripts/cp.mjs ../../LICENSE.md LICENSE.md ../../README.md README.md",
53
54
  "test": "node --test",
54
- "chmod": "shx chmod 755 ./src/bin/**/* ./build/bin/**/* || exit 0",
55
55
  "dev": "node src/cli.js",
56
56
  "start": "node build/cli.js"
57
57
  },
58
- "dependencies": {
59
- "shx": "^0.4.0"
60
- },
61
- "gitHead": "9535f44511b1cd90e47d4d51923bbf689dbc2c90"
58
+ "gitHead": "6469d991ff716a5296b7f8d42147e930b9755812"
62
59
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes