Skip to content

Commit 9791f41

Browse files
authored
chore: sync repo-template-ts (#2217)
* chore: sync repo-template-ts Signed-off-by: Ian Lewis <ian@ianlewis.org> * chore: restore copyright header Signed-off-by: Ian Lewis <ian@ianlewis.org> * chore: update dist Signed-off-by: Ian Lewis <ian@ianlewis.org> --------- Signed-off-by: Ian Lewis <ian@ianlewis.org>
1 parent eb9696e commit 9791f41

File tree

13 files changed

+1102
-649
lines changed

13 files changed

+1102
-649
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ indent_style = tab
2626
[{*.json,*.yaml}]
2727
indent_style = space
2828
indent_size = 2
29+
30+
# JavaScript and TypeScript files
31+
[{*.js,*.cjs,*.mjs,*.jsx,*.mjsx,*.ts,*.cts,*.mts,*.tsx,*.mtsx}]
32+
indent_style = space
33+
indent_size = 2

.github/workflows/pre-submit.units.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,17 @@ jobs:
147147
- name: actionlint
148148
run: make actionlint
149149

150+
eslint:
151+
runs-on: ubuntu-latest
152+
steps:
153+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
154+
with:
155+
persist-credentials: false
156+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
157+
with:
158+
node-version-file: "package.json"
159+
- run: make eslint
160+
150161
zizmor:
151162
runs-on: ubuntu-latest
152163
permissions:
@@ -217,26 +228,12 @@ jobs:
217228
persist-credentials: false
218229
- run: make yamllint
219230

220-
eslint:
221-
runs-on: ubuntu-latest
222-
steps:
223-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
224-
with:
225-
persist-credentials: false
226-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
227-
with:
228-
node-version-file: "package.json"
229-
- run: make eslint
230-
231231
todos:
232232
runs-on: ubuntu-latest
233233
steps:
234234
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
235235
with:
236236
persist-credentials: false
237-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
238-
with:
239-
node-version-file: "package.json"
240237
- run: make todos
241238

242239
# e2e tests.

.textlintrc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ rules:
3131
- "CLI"
3232
- "CVSS"
3333
- "DCO"
34+
- "ESM" # ECMAScript Modules
3435
- "PR"
3536
- "UI"
3637
- "YAML"

Makefile

Lines changed: 100 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ OUTPUT_FORMAT ?= $(shell if [ "${GITHUB_ACTIONS}" == "true" ]; then echo "github
2525
REPO_ROOT = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2626
REPO_NAME = $(shell basename "$(REPO_ROOT)")
2727

28-
AQUA_VERSION ?= 2.51.2
28+
# renovate: datasource=github-releases depName=aquaproj/aqua versioning=loose
29+
AQUA_VERSION ?= v2.51.2
2930
AQUA_REPO ?= github.com/aquaproj/aqua
3031
AQUA_CHECKSUM.Linux.x86_64 = 17db2da427bde293b1942e3220675ef796a67f1207daf89e6e80fea8d2bb8c22
3132
AQUA_CHECKSUM.Linux.aarch64 = b3f0d573e762ce9d104c671b8224506c4c4a32eedd1e6d7ae1e1e39983cdb6a8
3233
AQUA_CHECKSUM ?= $(AQUA_CHECKSUM.$(uname_s).$(uname_m))
33-
AQUA_URL = https://$(AQUA_REPO)/releases/download/v$(AQUA_VERSION)/aqua_$(kernel)_$(arch).tar.gz
34+
AQUA_URL = https://$(AQUA_REPO)/releases/download/$(AQUA_VERSION)/aqua_$(kernel)_$(arch).tar.gz
3435
AQUA_ROOT_DIR = $(REPO_ROOT)/.aqua
3536

3637
# The help command prints targets in groups. Help documentation in the Makefile
@@ -90,7 +91,7 @@ node_modules/.installed: package-lock.json
9091
.bin/aqua-$(AQUA_VERSION)/aqua:
9192
@set -euo pipefail; \
9293
mkdir -p .bin/aqua-$(AQUA_VERSION); \
93-
tempfile=$$(mktemp --suffix=".aqua-v$(AQUA_VERSION).tar.gz"); \
94+
tempfile=$$(mktemp --suffix=".aqua-$(AQUA_VERSION).tar.gz"); \
9495
curl -sSLo "$${tempfile}" "$(AQUA_URL)"; \
9596
echo "$(AQUA_CHECKSUM) $${tempfile}" | sha256sum -c; \
9697
tar -x -C .bin/aqua-$(AQUA_VERSION) -f "$${tempfile}"
@@ -112,6 +113,15 @@ package: compile ## Builds the distribution package.
112113
@rm -rf dist
113114
@npx rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript
114115

116+
## Testing
117+
#####################################################################
118+
119+
.PHONY: unit-test
120+
unit-test: compile ## Runs all unit tests.
121+
# NOTE: Make sure the package builds.
122+
@NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 \
123+
./node_modules/.bin/jest
124+
115125
## Tools
116126
#####################################################################
117127

@@ -120,11 +130,23 @@ license-headers: ## Update license headers.
120130
@set -euo pipefail; \
121131
files=$$( \
122132
git ls-files --deduplicate \
123-
':(glob)*.ts' 'src/*.ts' '__tests__/*.ts' '__fixtures__/*.ts' \
124-
':(glob)*.mts' 'src/*.mts' '__tests__/*.mts' '__fixtures__/*.mts' \
125-
':(glob)*.js' 'src/*.js' '__tests__/*.js' '__fixtures__/*.js' \
126-
':(glob)*.mjs' 'src/*.mjs' '__tests__/*.mjs' '__fixtures__/*.mjs' \
133+
'*.c' \
134+
'*.cpp' \
135+
'*.go' \
136+
'*.h' \
137+
'*.hpp' \
138+
'*.ts' \
139+
'*.js' \
140+
'*.lua' \
141+
'*.py' \
142+
'*.rb' \
143+
'*.rs' \
144+
'*.toml' \
145+
'*.yaml' \
146+
'*.yml' \
127147
'Makefile' \
148+
':!:dist/' \
149+
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
128150
); \
129151
name=$$(git config user.name); \
130152
if [ "$${name}" == "" ]; then \
@@ -159,9 +181,11 @@ json-format: node_modules/.installed ## Format JSON files.
159181
'*.json5' \
160182
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
161183
); \
184+
if [ "$${files}" == "" ]; then \
185+
exit 0; \
186+
fi; \
162187
./node_modules/.bin/prettier \
163188
--write \
164-
--no-error-on-unmatched-pattern \
165189
$${files}
166190

167191
.PHONY: md-format
@@ -173,10 +197,12 @@ md-format: node_modules/.installed ## Format Markdown files.
173197
'*.md' \
174198
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
175199
); \
200+
if [ "$${files}" == "" ]; then \
201+
exit 0; \
202+
fi; \
176203
# NOTE: prettier uses .editorconfig for tab-width. \
177204
./node_modules/.bin/prettier \
178205
--write \
179-
--no-error-on-unmatched-pattern \
180206
$${files}
181207

182208
.PHONY: yaml-format
@@ -187,45 +213,51 @@ yaml-format: node_modules/.installed ## Format YAML files.
187213
'*.yml' \
188214
'*.yaml' \
189215
); \
216+
if [ "$${files}" == "" ]; then \
217+
exit 0; \
218+
fi; \
190219
./node_modules/.bin/prettier \
191220
--write \
192-
--no-error-on-unmatched-pattern \
193221
$${files}
194222

195223
.PHONY: js-format
196224
js-format: node_modules/.installed ## Format YAML files.
197225
@set -euo pipefail; \
198226
files=$$( \
199227
git ls-files --deduplicate \
200-
':(glob)*.js' 'src/*.js' '__tests__/*.js' '__fixtures__/*.js' \
201-
':(glob)*.mjs' 'src/*.mjs' '__tests__/*.mjs' '__fixtures__/*.mjs' \
228+
'*.js' \
229+
'*.cjs' \
230+
'*.mjs' \
231+
'*.jsx' \
232+
'*.mjsx' \
233+
':!:dist/' \
202234
); \
235+
if [ "$${files}" == "" ]; then \
236+
exit 0; \
237+
fi; \
203238
./node_modules/.bin/prettier \
204239
--write \
205-
--no-error-on-unmatched-pattern \
206240
$${files}
207241

208242
.PHONY: ts-format
209243
ts-format: node_modules/.installed ## Format YAML files.
210244
@set -euo pipefail; \
211245
files=$$( \
212246
git ls-files --deduplicate \
213-
':(glob)*.ts' 'src/*.ts' '__tests__/*.ts' '__fixtures__/*.ts' \
214-
':(glob)*.mts' 'src/*.mts' '__tests__/*.mts' '__fixtures__/*.mts' \
215-
); \
247+
'*.ts' \
248+
'*.cts' \
249+
'*.mts' \
250+
'*.tsx' \
251+
'*.mtsx' \
252+
':!:dist/' \
253+
); \
254+
if [ "$${files}" == "" ]; then \
255+
exit 0; \
256+
fi; \
216257
./node_modules/.bin/prettier \
217258
--write \
218-
--no-error-on-unmatched-pattern \
219259
$${files}
220260

221-
## Testing
222-
#####################################################################
223-
224-
.PHONY: unit-test
225-
unit-test: compile ## Runs all unit tests.
226-
# NOTE: Make sure the package builds.
227-
@NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 npx jest
228-
229261
## Linting
230262
#####################################################################
231263

@@ -242,6 +274,9 @@ actionlint: $(AQUA_ROOT_DIR)/.installed ## Runs the actionlint linter.
242274
'.github/workflows/*.yaml' \
243275
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
244276
); \
277+
if [ "$${files}" == "" ]; then \
278+
exit 0; \
279+
fi; \
245280
PATH="$(REPO_ROOT)/.bin/aqua-$(AQUA_VERSION):$(AQUA_ROOT_DIR)/bin:$${PATH}"; \
246281
AQUA_ROOT_DIR="$(AQUA_ROOT_DIR)"; \
247282
if [ "$(OUTPUT_FORMAT)" == "github" ]; then \
@@ -264,6 +299,9 @@ zizmor: .venv/.installed ## Runs the zizmor linter.
264299
'.github/workflows/*.yaml' \
265300
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
266301
); \
302+
if [ "$${files}" == "" ]; then \
303+
exit 0; \
304+
fi; \
267305
if [ "$(OUTPUT_FORMAT)" == "github" ]; then \
268306
.venv/bin/zizmor \
269307
--quiet \
@@ -290,6 +328,9 @@ markdownlint: node_modules/.installed $(AQUA_ROOT_DIR)/.installed ## Runs the ma
290328
':!:.github/ISSUE_TEMPLATE/*.md' \
291329
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
292330
); \
331+
if [ "$${files}" == "" ]; then \
332+
exit 0; \
333+
fi; \
293334
PATH="$(REPO_ROOT)/.bin/aqua-$(AQUA_VERSION):$(AQUA_ROOT_DIR)/bin:$${PATH}"; \
294335
AQUA_ROOT_DIR="$(AQUA_ROOT_DIR)"; \
295336
if [ "$(OUTPUT_FORMAT)" == "github" ]; then \
@@ -317,6 +358,9 @@ markdownlint: node_modules/.installed $(AQUA_ROOT_DIR)/.installed ## Runs the ma
317358
'.github/ISSUE_TEMPLATE/*.md' \
318359
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
319360
); \
361+
if [ "$${files}" == "" ]; then \
362+
exit 0; \
363+
fi; \
320364
if [ "$(OUTPUT_FORMAT)" == "github" ]; then \
321365
exit_code=0; \
322366
while IFS="" read -r p && [ -n "$$p" ]; do \
@@ -351,6 +395,9 @@ textlint: node_modules/.installed $(AQUA_ROOT_DIR)/.installed ## Runs the textli
351395
':!:requirements.txt' \
352396
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
353397
); \
398+
if [ "$${files}" == "" ]; then \
399+
exit 0; \
400+
fi; \
354401
if [ "$(OUTPUT_FORMAT)" == "github" ]; then \
355402
exit_code=0; \
356403
while IFS="" read -r p && [ -n "$$p" ]; do \
@@ -378,6 +425,9 @@ todos: $(AQUA_ROOT_DIR)/.installed ## Check for outstanding TODOs.
378425
git ls-files --deduplicate \
379426
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
380427
); \
428+
if [ "$${files}" == "" ]; then \
429+
exit 0; \
430+
fi; \
381431
PATH="$(REPO_ROOT)/.bin/aqua-$(AQUA_VERSION):$(AQUA_ROOT_DIR)/bin:$${PATH}"; \
382432
AQUA_ROOT_DIR="$(AQUA_ROOT_DIR)"; \
383433
output="default"; \
@@ -405,6 +455,9 @@ yamllint: .venv/.installed ## Runs the yamllint linter.
405455
'*.yaml' \
406456
| while IFS='' read -r f; do [ -f "$${f}" ] && echo "$${f}" || true; done \
407457
); \
458+
if [ "$${files}" == "" ]; then \
459+
exit 0; \
460+
fi; \
408461
format="standard"; \
409462
if [ "$(OUTPUT_FORMAT)" == "github" ]; then \
410463
format="github"; \
@@ -420,19 +473,21 @@ eslint: node_modules/.installed ## Runs eslint.
420473
@set -euo pipefail; \
421474
files=$$( \
422475
git ls-files --deduplicate \
423-
'src/*.ts' \
424-
'src/*.mts' \
425-
'src/*.js' \
426-
'src/*.mjs' \
427-
'__tests__/*.ts' \
428-
'__tests__/*.mts' \
429-
'__tests__/*.js' \
430-
'__tests__/*.mjs' \
431-
'__fixtures__/*.ts' \
432-
'__fixtures__/*.mts' \
433-
'__fixtures__/*.js' \
434-
'__fixtures__/*.mjs' \
476+
'*.js' \
477+
'*.cjs' \
478+
'*.mjs' \
479+
'*.jsx' \
480+
'*.mjsx' \
481+
'*.ts' \
482+
'*.cts' \
483+
'*.mts' \
484+
'*.tsx' \
485+
'*.mtsx' \
486+
':!:dist/' \
435487
); \
488+
if [ "$${files}" == "" ]; then \
489+
exit 0; \
490+
fi; \
436491
if [ "$(OUTPUT_FORMAT)" == "github" ]; then \
437492
set -euo pipefail; \
438493
exit_code=0; \
@@ -455,10 +510,15 @@ eslint: node_modules/.installed ## Runs eslint.
455510
;; \
456511
esac; \
457512
done <<<$$(echo "$${p}" | jq -c '.messages[]'); \
458-
done <<<$$(npx eslint --max-warnings 0 -f json $${files} | jq -c '.[]'); \
513+
done <<<$$(./node_modules/.bin/eslint \
514+
--max-warnings 0 \
515+
--format json \
516+
$${files} | jq -c '.[]'); \
459517
exit "$${exit_code}"; \
460518
else \
461-
npx eslint --max-warnings 0 $${files}; \
519+
./node_modules/.bin/eslint \
520+
--max-warnings 0 \
521+
$${files}; \
462522
fi
463523

464524
## Maintenance
@@ -471,6 +531,6 @@ clean: ## Delete temporary files.
471531
$(AQUA_ROOT_DIR) \
472532
.venv \
473533
node_modules \
474-
*.sarif.json\
534+
*.sarif.json \
475535
lib \
476536
coverage

dist/index.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default [
2121
github.getFlatConfigs().recommended,
2222
...github.getFlatConfigs().typescript,
2323
{
24-
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
24+
files: ["**/*.{js,cjs,mjs,jsx,mjsx,ts,cts,mts,tsx,mtsx}"],
2525
ignores: ["**/coverage", "**/dist", "**/linter", "**/node_modules"],
2626
plugins: {
2727
"@stylistic/ts": stylisticTs,

0 commit comments

Comments
 (0)