clang-format-node 1.2.0-canary.0 → 1.2.0
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.
- package/{LICENSE → LICENSE.md} +1 -1
- package/README.md +41 -390
- package/package.json +4 -4
package/{LICENSE → LICENSE.md}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024 루밀LuMir(lumirlumir)
|
|
3
|
+
Copyright (c) 2024-present 루밀LuMir(lumirlumir)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,425 +1,76 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- markdownlint-disable-next-line -->
|
|
2
|
+
# <div align="center"> clang-format-node </div>
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://github.com/lumirlumir/npm-clang-format-node/actions/workflows/test-cross-platform.yml)
|
|
6
|
-
[](https://codecov.io/gh/lumirlumir/npm-clang-format-node)
|
|
7
|
-

|
|
8
|
-
[](https://www.npmjs.com/package/clang-format-node)
|
|
9
|
-
&color=violet&display_name=release)
|
|
10
|
-
|
|
11
|
-
Node repackaging(wrapping) of the `clang-format` native binary inspired by ['angular/clang-format'](https://github.com/angular/clang-format).🐉
|
|
12
|
-
|
|
13
|
-
This package intends to release a new npm package for every **latest** release of the `clang-format`. It **checks** for the latest LLVM release every week, builds `clang-format` using its own pipeline, and makes a **pull request**. All processes are run automatically. If you are interested in build process, take a look at [`.github/workflows/llvm-build-bump-pr.yml`](/.github/workflows/llvm-build-bump-pr.yml)
|
|
14
|
-
|
|
15
|
-
> [!IMPORTANT]
|
|
16
|
-
>
|
|
17
|
-
> Please participate in the issue regarding the introduction of a **glob pattern**. Click [here](https://github.com/lumirlumir/npm-clang-format-node/issues/14).
|
|
18
|
-
|
|
19
|
-
## Why I started this project
|
|
20
|
-
|
|
21
|
-
['angular/clang-format'](https://github.com/angular/clang-format) is no longer maintained. (See [#79](https://github.com/angular/clang-format/issues/79) [#82](https://github.com/angular/clang-format/issues/82) [#83](https://github.com/angular/clang-format/pull/83)) Nevertheless, new versions of `clang-format` continue to be released. Bugs are fixed, and new features are added. However, using `clang-format` directly in a Node.js environment without any support can be somewhat cumbersome. So I decided to make a **new**, **maintained** one.
|
|
22
|
-
|
|
23
|
-
Note that some feautures from 'angular/clang-format' are not included in this package. Specifically `check-clang-format` and `git-clang-format` are not used. There are a few reasons for this. Both commands **rely on Python**, so if you haven't installed Python, they cannot be executed. Many people would prefer if this package worked without dependencies beyond Node.js. **So, this package relies only on Node.js.** See the [Migration](#migration-from-angularclang-format) for alternative methods to `check-clang-format` and `git-clang-format`.
|
|
24
|
-
|
|
25
|
-
## Supported
|
|
26
|
-
|
|
27
|
-
### OS Platforms and Architectures
|
|
28
|
-
|
|
29
|
-
It supports **ALL** [**Tier1**](https://github.com/nodejs/node/blob/main/BUILDING.md#strategy) and some [**Tier2**](https://github.com/nodejs/node/blob/main/BUILDING.md#strategy) platforms of Node.js. *Note that the functionality cannot be guaranteed on platforms which is not mentioned below*.
|
|
4
|
+
<!-- markdownlint-disable-next-line -->
|
|
5
|
+
<div align="center">
|
|
30
6
|
|
|
31
|
-
|
|
7
|
+
⭐If you like this package, please give it a star on [GitHub](https://github.com/lumirlumir/npm-clang-format-node)!⭐<br>
|
|
8
|
+
Your support helps us improve and maintain the project.
|
|
32
9
|
|
|
33
|
-
<
|
|
34
|
-
---- | ---------------- | ---------------- | ------------ |
|
|
35
|
-
1 | macOS | arm64 | Tier 1 |
|
|
36
|
-
2 | macOS | x64 | Tier 1 |
|
|
37
|
-
3 | GNU/Linux | armv7 | Tier 1 |
|
|
38
|
-
4 | GNU/Linux | arm64 | Tier 1 |
|
|
39
|
-
5 | GNU/Linux | ppc64le >=power8 | Tier 2 |
|
|
40
|
-
6 | GNU/Linux | s390x | Tier 2 |
|
|
41
|
-
7 | GNU/Linux | x64 | Tier 1 |
|
|
42
|
-
8 | Windows | x64 | Tier 1 |
|
|
43
|
-
|
|
44
|
-
> [!TIP]
|
|
45
|
-
>
|
|
46
|
-
> 1. If your platform isn't yet supported, you can build the `clang-format` native binary from the latest upstream clang sources. Refer to [`docs/llvm-build-linux.sh`](/docs/llvm-build-linux.sh) and [`.github/workflows/llvm-build-bump-pr.yml`](/.github/workflows/llvm-build-bump-pr.yml) for the build scripts for **Linux Shell** and **GitHub Actions**, respectively.
|
|
47
|
-
>
|
|
48
|
-
> 1. Or you can download `clang-format` native binary from [LLVM release assets](https://github.com/llvm/llvm-project/releases) that match your operating system platform and architecture like the lists below.
|
|
49
|
-
>
|
|
50
|
-
> - `clang+llvm-18.1.7-aarch64-linux-gnu.tar.xz`
|
|
51
|
-
> - `clang+llvm-18.1.7-armv7a-linux-gnueabihf.tar.gz`
|
|
52
|
-
> - `clang+llvm-18.1.7-powerpc64-ibm-aix-7.2.tar.xz`
|
|
53
|
-
> - `clang+llvm-18.1.7-x86_64-pc-windows-msvc.tar.xz`
|
|
54
|
-
> - `and more...`
|
|
55
|
-
|
|
56
|
-
### Node.js
|
|
10
|
+
<image src="https://llvm.org/img/LLVMWyvernSmall.png" width="350px" height="220px"/><br /><br />
|
|
57
11
|
|
|
12
|
+
&color=violet&display_name=release)
|
|
13
|
+
[](https://www.npmjs.com/package/clang-format-node)
|
|
14
|
+

|
|
58
15
|

|
|
59
16
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
> However, this package does not utilize the latest features of Node.js and is transpiled using Babel. Therefore, it is expected to work on versions significantly lower than the officially supported ones. (ex. `"node": ">= 0.7.10"`) Consequently, **if the current package operates on a version of Node.js that is lower than the officially supported version, it should be perfectly fine to use.**
|
|
65
|
-
|
|
66
|
-
### [GitHub Actions Runner Images](https://github.com/actions/runner-images?tab=readme-ov-file#available-images)
|
|
67
|
-
|
|
68
|
-
If you want to use `clang-format-node` in continuous integration (CI), You can use **GitHub Actions**. The following basic runner images are compatible(available) with `clang-format-node`.
|
|
69
|
-
|
|
70
|
-
Image | YAML Label | Included Software |
|
|
71
|
-
---------------------------- | ---------------------------------------------------------------------- | ----------------- |
|
|
72
|
-
macOS 15 | `macos-15-large` | macOS-15 |
|
|
73
|
-
macOS 15 Arm64 | `macos-15` or `macos-15-xlarge` | macOS-15-arm64 |
|
|
74
|
-
macOS 14 | `macos-latest-large` or `macos-14-large` | macOS-14 |
|
|
75
|
-
macOS 14 Arm64 | `macos-latest`, `macos-14`, `macos-latest-xlarge` or `macos-14-xlarge` | macOS-14-arm64 |
|
|
76
|
-
macOS 13 | `macos-13` or `macos-13-large` | macOS-13 |
|
|
77
|
-
macOS 13 Arm64 | `macos-13-xlarge` | macOS-13-arm64 |
|
|
78
|
-
macOS 12 | `macos-12` or `macos-12-large` | macOS-12 |
|
|
79
|
-
Ubuntu 24.04 | `ubuntu-latest` or `ubuntu-24.04` | ubuntu-24.04 |
|
|
80
|
-
Ubuntu 22.04 | `ubuntu-22.04` | ubuntu-22.04 |
|
|
81
|
-
Windows Server 2022 | `windows-latest` or `windows-2022` | windows-2022 |
|
|
82
|
-
|
|
83
|
-
However, the following basic runner images are **NOT** compatible(available) with `clang-format-node`. It's because the ***dependencies*** for LLVM's latest release version are not compatible with the following images.
|
|
84
|
-
|
|
85
|
-
Image | YAML Label | Included Software |
|
|
86
|
-
----------------------- | -------------- | ----------------- |
|
|
87
|
-
~~Ubuntu 20.04~~ | `ubuntu-20.04` | [ubuntu-20.04] |
|
|
88
|
-
~~Windows Server 2019~~ | `windows-2019` | [windows-2019] |
|
|
89
|
-
|
|
90
|
-
### Docker(Build) Images
|
|
91
|
-
|
|
92
|
-
I used the following Images to build `clang-format` excuatable binaries.
|
|
93
|
-
|
|
94
|
-
> [!TIP]
|
|
95
|
-
>
|
|
96
|
-
> If you want to see which software is included in **GitHub Actions runner**, click [here](https://github.com/actions/runner-images?tab=readme-ov-file#available-images) and refer to the 'Included Software' column.
|
|
97
|
-
|
|
98
|
-
Binary Folder Name | Docker(Build) Image |
|
|
99
|
-
------------------ | ------------------------------------------------------------------ |
|
|
100
|
-
`darwin-arm64` | GitHub Actions runner `macos-14` |
|
|
101
|
-
`darwin-x64` | GitHub Actions runner `macos-12` |
|
|
102
|
-
`linux-arm` | [`arm32v7/ubuntu:22.04`](https://hub.docker.com/r/arm32v7/ubuntu/) |
|
|
103
|
-
`linux-arm64` | [`arm64v8/ubuntu:22.04`](https://hub.docker.com/r/arm64v8/ubuntu/) |
|
|
104
|
-
`linux-ppc64` | [`ppc64le/ubuntu:22.04`](https://hub.docker.com/r/ppc64le/ubuntu/) |
|
|
105
|
-
`linux-s390x` | [`s390x/ubuntu:22.04`](https://hub.docker.com/r/s390x/ubuntu/) |
|
|
106
|
-
`linux-x64` | GitHub Actions runner `ubuntu-22.04` |
|
|
107
|
-
`win32-x64` | GitHub Actions runner `windows-2022` |
|
|
108
|
-
|
|
109
|
-
## Installation
|
|
110
|
-
|
|
111
|
-
### global
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
npm install -g clang-format-node
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
yarn global add clang-format-node
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### local(devDependencies)
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
npm install --save-dev clang-format-node
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
yarn add --dev clang-format-node
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Usages
|
|
132
|
-
|
|
133
|
-
If you want to learn more about `clang-format` itself, see the [`clang-format style options`](https://clang.llvm.org/docs/ClangFormatStyleOptions.html).
|
|
134
|
-
|
|
135
|
-
> [!TIP]
|
|
136
|
-
>
|
|
137
|
-
> `clang-format` can take multiple files as arguments.
|
|
138
|
-
>
|
|
139
|
-
> ```bash
|
|
140
|
-
> npx clang-format -n -Werror file1.cpp file2.cpp src/file3.cpp
|
|
141
|
-
> ```
|
|
142
|
-
|
|
143
|
-
### Basic
|
|
144
|
-
|
|
145
|
-
#### Global
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
clang-format [options] [@<file>] [<file> ...]
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
#### Local
|
|
152
|
-
|
|
153
|
-
Use `npx` to run a locally installed package.
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
npx clang-format [options] [@<file>] [<file> ...]
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
#### Frequently used commands
|
|
160
|
-
|
|
161
|
-
1. `--version`: Check the version of `clang-format`.
|
|
162
|
-
|
|
163
|
-
``` bash
|
|
164
|
-
npx clang-format --version
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Output example
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
clang-format version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
- `https://github.com/llvm/llvm-project`: Git repository URL for the LLVM project, which includes Clang.
|
|
174
|
-
- `3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff`: The commit hash of the Git repository where the source code for that version is stored. This hash allows you to precisely trace which source code version was used to generate `clang-format`.
|
|
175
|
-
|
|
176
|
-
1. `--help`: Help view additional options.
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
npx clang-format --help
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
1. `--dry-run` or `-n`: Makes an **WARNING** when `example.cpp` is not correctly formatted.
|
|
183
|
-
|
|
184
|
-
`--dry-run` and `-n` options are equivalent.
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
npx clang-format --dry-run example.cpp
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
npx clang-format -n example.cpp
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
1. `-Werror --dry-run` or `-Werror -n`: Makes an **ERROR** when `example.cpp` is not correctly formatted.
|
|
195
|
-
|
|
196
|
-
> Similar to `eslint` or `prettier --check` commands.
|
|
197
|
-
|
|
198
|
-
`--dry-run` and `-n` options are equivalent.
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
npx clang-format -Werror --dry-run example.cpp
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
npx clang-format -Werror -n example.cpp
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
1. `-i`: Automatically fix unformatted files.
|
|
209
|
-
|
|
210
|
-
> Similar to `eslint --fix` or `prettier --write` commands.
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
npx clang-format -i example.cpp
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Glob patterns
|
|
217
|
-
|
|
218
|
-
Unfortunately, there is no way to apply `clang-format` recursively. `*.cpp` will only match files in the current directory, not subdirectories. Even `**/*` doesn't work.
|
|
219
|
-
|
|
220
|
-
**So, you need to use the `find` command in Linux.** If you are a Windows user, use ***git bash***. then you can use the `find` command. The `find` command recursively searches through directories.
|
|
221
|
-
|
|
222
|
-
It is simple but can produce an error if the [**Argument list is too long**](https://stackoverflow.com/questions/11289551/argument-list-too-long-error-for-rm-cp-mv-commands). In that case, use `xargs`
|
|
223
|
-
|
|
224
|
-
#### Basic
|
|
225
|
-
|
|
226
|
-
To recursively search for all `.cpp` files in the current directory, use:
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
npx clang-format $(find . -name "*.cpp")
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
If the argument list is too long, use `xargs`. And if file names contain spaces or special characters, use `-print0` and `-0` options. `-print0` makes `find` output file names separated by null characters (`\0`), and `-0` tells `xargs` to correctly handle these null-separated file names.
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
find . -name "*.cpp" -print0 | xargs -0 npx clang-format
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
#### With regular expressions
|
|
239
|
-
|
|
240
|
-
To recursively search for all `.cpp` and `.h` files in the current directory using a regular expression, use:
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
npx clang-format $(find . -regex ".*\.\(cpp\|h\)")
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
#### With negation patterns
|
|
247
|
-
|
|
248
|
-
To exclude `excluded_file.cpp` from the `.cpp` files, use:
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
npx clang-format $(find . -name "*.cpp" ! -name "excluded_file.cpp")
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### [`.clang-format-ignore`](https://clang.llvm.org/docs/ClangFormat.html#clang-format-ignore)
|
|
255
|
-
|
|
256
|
-
You can create `.clang-format-ignore` files to make `clang-format` ignore certain files. A `.clang-format-ignore` file consists of patterns of file path names. It has the following format:
|
|
257
|
-
|
|
258
|
-
- A blank line is skipped.
|
|
259
|
-
- Leading and trailing spaces of a line are trimmed.
|
|
260
|
-
- A line starting with a hash (`#`) is a comment.
|
|
261
|
-
- A non-comment line is a single pattern.
|
|
262
|
-
- The slash (`/`) is used as the directory separator.
|
|
263
|
-
- A pattern is relative to the directory of the `.clang-format-ignore` file (or the root directory if the pattern starts with a slash). Patterns containing drive names (e.g. `C:`) are not supported.
|
|
264
|
-
- Patterns follow the rules specified in [**POSIX 2.13.1, 2.13.2, and Rule 1 of 2.13.3.**](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13)
|
|
265
|
-
- A pattern is negated if it starts with a bang (`!`).
|
|
266
|
-
|
|
267
|
-
To match all files in a directory, use e.g. `foo/bar/*`. To match all files in the directory of the `.clang-format-ignore` file, use `*`. Multiple `.clang-format-ignore` files are supported similar to the `.clang-format` files, with a lower directory level file voiding the higher level ones.
|
|
268
|
-
|
|
269
|
-
### Use with `husky` and `lint-staged`
|
|
270
|
-
|
|
271
|
-
Ensuring that changes to your code are properly formatted is an important part of your development workflow. Use `husky` and `lint-staged` for your continuous integration process.
|
|
272
|
-
|
|
273
|
-
#### `husky` (v8.x)
|
|
274
|
-
|
|
275
|
-
```bash
|
|
276
|
-
# .husky/pre-commit
|
|
277
|
-
|
|
278
|
-
npx lint-staged
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
#### `lint-staged` (v15.x)
|
|
282
|
-
|
|
283
|
-
1. Check
|
|
284
|
-
|
|
285
|
-
```jsonc
|
|
286
|
-
/* package.json */
|
|
287
|
-
|
|
288
|
-
{
|
|
289
|
-
// ...
|
|
290
|
-
"lint-staged": {
|
|
291
|
-
"*.{c,cpp,h}": "npx clang-format -Werror -n",
|
|
292
|
-
}
|
|
293
|
-
// ...
|
|
294
|
-
}
|
|
295
|
-
```
|
|
17
|
+
[](https://github.com/lumirlumir/npm-clang-format-node/actions/workflows/lint.yml)
|
|
18
|
+
[](https://github.com/lumirlumir/npm-clang-format-node/actions/workflows/test.yml)
|
|
19
|
+
[](https://github.com/lumirlumir/npm-clang-format-node/actions/workflows/test-cross-platform.yml)
|
|
20
|
+
[](https://codecov.io/gh/lumirlumir/npm-clang-format-node)
|
|
296
21
|
|
|
297
|
-
|
|
22
|
+
[](https://clang-format-node.lumir.page)
|
|
298
23
|
|
|
299
|
-
|
|
300
|
-
/* package.json */
|
|
24
|
+
Node repackaging(wrapping) of the **LLVM Clang's** `clang-format` and `git-clang-format` native binary inspired by ['angular/clang-format'](https://github.com/angular/clang-format).🐉
|
|
301
25
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
"lint-staged": {
|
|
305
|
-
"*.{c,cpp,h}": "npx clang-format -i",
|
|
306
|
-
}
|
|
307
|
-
// ...
|
|
308
|
-
}
|
|
309
|
-
```
|
|
26
|
+
<!-- markdownlint-disable-next-line -->
|
|
27
|
+
</div>
|
|
310
28
|
|
|
311
|
-
> [!
|
|
29
|
+
> [!IMPORTANT]
|
|
312
30
|
>
|
|
313
|
-
>
|
|
314
|
-
|
|
315
|
-
## Migration from 'angular/clang-format'
|
|
316
|
-
|
|
317
|
-
### `check-clang-format`
|
|
318
|
-
|
|
319
|
-
This package only uses native `clang-format` features to check formatting. The following commands will produce an error if the target files are not correctly formatted. So use them with `husky` and `lint-staged`. (`--dry-run` and `-n` options are equivalent.)
|
|
320
|
-
|
|
321
|
-
```bash
|
|
322
|
-
npx clang-format -Werror --dry-run example.cpp
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
npx clang-format -Werror -n example.cpp
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### `git-clang-format`
|
|
330
|
-
|
|
331
|
-
Use [`husky`](https://typicode.github.io/husky/) and [`lint-staged`](https://github.com/lint-staged/lint-staged) for the `pre-commit` hook instead. See [Use with `husky` and `lint-staged`](#use-with-husky-and-lint-staged) for details.
|
|
332
|
-
|
|
333
|
-
## Contributing
|
|
334
|
-
|
|
335
|
-
Thanks for having attention to this package.🙇♂️ Issues and PRs are always welcome.🎉
|
|
336
|
-
|
|
337
|
-
I recommend you to read the guides on [LLVM and clang-format mentioned in issues tab](https://github.com/lumirlumir/npm-clang-format-node/issues/new/choose) before contributing.
|
|
338
|
-
|
|
339
|
-
### Installation
|
|
340
|
-
|
|
341
|
-
1. Fork it.
|
|
342
|
-
|
|
343
|
-
1. Clone it to your local directory. ([Git](https://git-scm.com/downloads) is required.)
|
|
344
|
-
|
|
345
|
-
```bash
|
|
346
|
-
git clone https://github.com/lumirlumir/npm-clang-format-node.git
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
1. Move to the `npm-clang-format-node` directory.
|
|
350
|
-
|
|
351
|
-
```bash
|
|
352
|
-
cd npm-clang-format-node
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
1. Install npm packages. ([Node.js](https://nodejs.org/en) is required.)
|
|
356
|
-
|
|
357
|
-
```bash
|
|
358
|
-
npm install
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
1. Edit codes.
|
|
362
|
-
|
|
363
|
-
1. Create `my-branch` branch.
|
|
364
|
-
|
|
365
|
-
```bash
|
|
366
|
-
git switch -c my-branch
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
1. Commit your changes. (`husky` and `lint-staged` will lint and test your changed files!)
|
|
31
|
+
> Please participate in the issue regarding the introduction of a **glob pattern**. Click [here](https://github.com/lumirlumir/npm-clang-format-node/issues/14).
|
|
370
32
|
|
|
371
|
-
|
|
372
|
-
git commit -am "commit type: title"
|
|
373
|
-
```
|
|
33
|
+
## Included Packages
|
|
374
34
|
|
|
375
|
-
|
|
35
|
+
This repository is maintained as a **monorepo** and includes the following packages.
|
|
376
36
|
|
|
377
|
-
1.
|
|
37
|
+
1. `clang-format-node` [](https://www.npmjs.com/package/clang-format-node):
|
|
38
|
+
Node repackaging of the `clang-format` native binary. (The **CORE** package.) [『Docs』](/docs/02-packages/01-clang-format-node.md), [『Repository』](https://github.com/lumirlumir/npm-clang-format-node/tree/main/packages/clang-format-node), [『npm』](https://www.npmjs.com/package/clang-format-node)
|
|
378
39
|
|
|
379
|
-
|
|
40
|
+
1. `clang-format-git` [](https://www.npmjs.com/package/clang-format-git): Node repackaging of the `git-clang-format` Python script as a standalone native binary to **allow execution without a Python dependency**. [『Docs』](/docs/02-packages/02-clang-format-git.md), [『Repository』](https://github.com/lumirlumir/npm-clang-format-node/tree/main/packages/clang-format-git), [『npm』](https://www.npmjs.com/package/clang-format-git)
|
|
380
41
|
|
|
381
|
-
|
|
42
|
+
1. `clang-format-git-python` [](https://www.npmjs.com/package/clang-format-git-python): Node repackaging of the `git-clang-format` Python script. **This package requires Python3 as a dependency**. [『Docs』](/docs/02-packages/03-clang-format-git-python.md), [『Repository』](https://github.com/lumirlumir/npm-clang-format-node/tree/main/packages/clang-format-git-python), [『npm』](https://www.npmjs.com/package/clang-format-git-python)
|
|
382
43
|
|
|
383
|
-
|
|
44
|
+
## Supported
|
|
384
45
|
|
|
385
|
-
OS
|
|
386
|
-
------- | ---------------------------------- |
|
|
387
|
-
macOS | `darwin` |
|
|
388
|
-
Linux | `linux` |
|
|
389
|
-
Windows | `win32` |
|
|
46
|
+
See the [supported](/docs/01-introduction/05-supported.md) documentation, which lists the supported 'OS Platforms and Architectures', 'Node.js Versions', 'GitHub Actions Runner Images', and 'Docker(Build) Images'.
|
|
390
47
|
|
|
391
|
-
|
|
48
|
+
## Releases
|
|
392
49
|
|
|
393
|
-
|
|
50
|
+
Each package intends to release a new npm package for every **latest** release of the `clang-format` and `git-clang-format`. It **checks** for the latest LLVM release every week, builds all packages using its own pipeline, and makes a pull request. **All processes are run automatically**. If you are interested in the build process, take a look at [`.github/workflows/llvm-build-bump-pr.yml`](/.github/workflows/llvm-build-bump-pr.yml).
|
|
394
51
|
|
|
395
|
-
|
|
396
|
-
------------------ | ------------------------------ | --------- | --------------- | ------------------- |
|
|
397
|
-
arm(armv7, armv7l) | `arm` | `ARM` | `arm/v7` | `arm32v7` |
|
|
398
|
-
arm64 | `arm64` | `AArch64` | `arm64/v8` | `arm64v8` |
|
|
399
|
-
ppc64le[^1] | `ppc64` | `PowerPC` | `ppc64le` | `ppc64le` |
|
|
400
|
-
s390x | `s390x` | `SystemZ` | `s390x` | `s390x` |
|
|
401
|
-
x64 | `x64` | `X86` | `amd64` | `amd64` |
|
|
52
|
+
## Contributing (Issues & Pull Requests)
|
|
402
53
|
|
|
403
|
-
|
|
54
|
+
Thanks for having attention to this package🙇♂️. We appreciate you spending the time to work on these things. Every issue and pull request about bugs, suggestions and the other topics is always welcome!
|
|
404
55
|
|
|
405
|
-
|
|
56
|
+
Please read our [Code of Conduct](./CODE_OF_CONDUCT.md) and [Contributing Guides](/docs/04-community/01-contributing.md) before you work on these things. We also recommend you to read the [Guides on LLVM and `clang-format`](docs/03-others/04-guides-on-llvm-and-clang-format.md) mentioned in the documentation before contributing.
|
|
406
57
|
|
|
407
|
-
|
|
58
|
+
## Documentation
|
|
408
59
|
|
|
409
|
-
|
|
60
|
+
For full documentation, see the [official documentation of the `clang-format-node`](https://clang-format-node.lumir.page) or [`docs` directory of `clang-format-node` repository](https://github.com/lumirlumir/npm-clang-format-node/tree/main/docs).
|
|
410
61
|
|
|
411
62
|
## Versioning
|
|
412
63
|
|
|
413
|
-
|
|
64
|
+
See [Versioning](/docs/04-community/02-versioning.md).
|
|
414
65
|
|
|
415
|
-
|
|
66
|
+
## Change Log
|
|
416
67
|
|
|
417
|
-
|
|
68
|
+
See [Change Log](/CHANGELOG.md).
|
|
418
69
|
|
|
419
|
-
##
|
|
70
|
+
## Code of Conduct
|
|
420
71
|
|
|
421
|
-
See [
|
|
72
|
+
See [Code of Conduct](/CODE_OF_CONDUCT.md).
|
|
422
73
|
|
|
423
74
|
## License
|
|
424
75
|
|
|
425
|
-
[MIT](/LICENSE) under [LLVM Apache License 2.0](https://github.com/llvm/llvm-project/blob/main/LICENSE.TXT)
|
|
76
|
+
[MIT](/LICENSE.md) under [LLVM Apache License 2.0](https://github.com/llvm/llvm-project/blob/main/LICENSE.TXT).
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clang-format-node",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Node repackaging of the clang-format native binary inspired by angular/clang-format.🐉",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"build",
|
|
8
|
-
"LICENSE",
|
|
8
|
+
"LICENSE.md",
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
11
|
"bin": {
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"scripts": {
|
|
45
45
|
"postinstall": "test -d src && npm run build || npm run chmod",
|
|
46
46
|
"prepublishOnly": "npm run build",
|
|
47
|
-
"build": "npx babel src -d build && npx tsc && cp -r src/bin build && cp ../../LICENSE ../../README.md .",
|
|
47
|
+
"build": "npx babel src -d build && npx tsc && cp -r src/bin build && cp ../../LICENSE.md ../../README.md .",
|
|
48
48
|
"postbuild": "npm run chmod",
|
|
49
49
|
"test": "node --test",
|
|
50
50
|
"chmod": "find ./src/bin ./build/bin -type f -exec chmod 755 {} + || true"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "44eb57089c2fe3eacddca8f4c86320aed28493eb"
|
|
53
53
|
}
|