clang-format-node 1.3.4 → 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 +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.4",
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": "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": "d8fec7bde3bea04baea693e431b9b3d52c016023"
58
+ "gitHead": "6469d991ff716a5296b7f8d42147e930b9755812"
62
59
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes