Skip to content

Commit dc549dd

Browse files
Merge changes from v1.9.2-next.1 into main (#175)
2 parents 5b2dc36 + 3cdb79c commit dc549dd

10 files changed

Lines changed: 450 additions & 899 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 📝 Annual License Update Workflow
2+
3+
on:
4+
# This workflow runs on Jan 1st every year.
5+
schedule:
6+
- cron: "0 0 1 1 *"
7+
8+
jobs:
9+
update-license:
10+
name: 📝 Update License File
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
13+
permissions:
14+
contents: write # to checkout the code and update the LICENSE file
15+
steps:
16+
- uses: actions/checkout@v5
17+
with:
18+
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
19+
20+
- name: Configure Git User
21+
run: |
22+
git config user.name 'github-actions[bot]'
23+
git config user.email 'github-actions[bot]@users.noreply.github.com'
24+
25+
- name: Update Copyright Date Range in LICENSE
26+
run: |
27+
function log_error_and_exit() {
28+
local problem_description="$1"
29+
printf '%s\n' '🚨LICENSE UPDATE FAILED🚨' "ERROR: $problem_description."
30+
exit 1
31+
}
32+
33+
year=$( date +%Y )
34+
35+
sed -i -E "s/(Copyright © [0-9]{4})-[0-9]{4}(.*)/\1-$year\2/" ./LICENSE ||
36+
log_error_and_exit 'sed command exited with non-zero exit code'
37+
38+
git add ./LICENSE
39+
40+
git commit -m "chore(license): update copyright date range to include $year" ||
41+
log_error_and_exit 'git commit command exited with non-zero exit code'
42+
43+
echo '✅ License Copyright date range successfully updated.'

.github/workflows/cicd.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ jobs:
3333
id-token: write # to enable use of OIDC for npm provenance
3434
issues: write # to be able to comment on released issues
3535
steps:
36-
- uses: actions/checkout@v4
36+
- uses: actions/checkout@v5
3737
with:
3838
persist-credentials: false
3939

4040
- uses: actions/setup-node@v4
4141
with:
42-
node-version-file: ".nvmrc"
42+
node-version-file: .nvmrc
4343

4444
- name: Install Dependencies
4545
run: npm ci --include=dev

.github/workflows/test.yaml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121
permissions:
2222
contents: read # to checkout the code
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525

2626
- uses: actions/setup-node@v4
2727
with:
28-
node-version-file: ".nvmrc"
28+
node-version-file: .nvmrc
2929

3030
- name: Install Dependencies
3131
run: npm ci --include=dev
@@ -51,7 +51,7 @@ jobs:
5151
needs: run-tests # run job if tests passed
5252
if: needs.run-tests.outputs.success == 'true'
5353
steps:
54-
- uses: actions/download-artifact@v4
54+
- uses: actions/download-artifact@v5
5555
with: { name: test-coverage-reports }
5656
- uses: codecov/codecov-action@v4
5757
with:
@@ -66,9 +66,9 @@ jobs:
6666
contents: write # to auto-merge dependabot PRs
6767
pull-requests: write # to update the PR
6868
steps:
69-
- uses: actions/checkout@v4
69+
- uses: actions/checkout@v5
7070
- name: Download Test Coverage Reports
71-
uses: actions/download-artifact@v4
71+
uses: actions/download-artifact@v5
7272
with: { name: test-coverage-reports, path: ./coverage }
7373
- name: Add Vitest Test Coverage Report to PR
7474
uses: davelosert/vitest-coverage-report-action@v2
@@ -84,28 +84,20 @@ jobs:
8484
update-github-commit-status:
8585
name: 📡 Update GitHub Commit Status
8686
runs-on: ubuntu-latest
87-
needs: run-tests # run job if the workflow has not been cancelled
87+
needs: run-tests # always run job unless the workflow was cancelled
8888
if: ${{ !cancelled() }}
8989
permissions:
9090
statuses: write # to update commit status
9191
steps:
9292
- run: |
93-
if [ ${{ needs.run-tests.outputs.success }} == 'true' ]; then
94-
commit_status_state='success'
95-
description='Tests passed'
96-
else
97-
commit_status_state='failure'
98-
description='Tests failed'
99-
fi
100-
10193
curl --request POST \
10294
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
10395
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
10496
--header 'Accept: application/vnd.github+json' \
10597
--header 'X-GitHub-Api-Version: 2022-11-28' \
10698
--data "{
10799
\"context\": \"tests\",
108-
\"state\": \"$commit_status_state\",
109-
\"description\": \"$description\",
100+
\"state\": \"${{ needs.run-tests.result }}\",
101+
\"description\": \"Tests ${{ needs.run-tests.result == 'success' && 'passed' || 'failed' }}\",
110102
\"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"
111103
}"

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22
1+
v22.19

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
44

55
---
66

7+
## [1.9.2-next.1](https://github.com/Nerdware-LLC/ts-string-helpers/compare/v1.9.1...v1.9.2-next.1) (2025-12-15)
8+
79
## [1.9.1](https://github.com/Nerdware-LLC/ts-string-helpers/compare/v1.9.0...v1.9.1) (2025-03-06)
810

911
## [1.9.1-next.1](https://github.com/Nerdware-LLC/ts-string-helpers/compare/v1.9.0...v1.9.1-next.1) (2025-03-06)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024-2025 Trevor Anderson
3+
Copyright © 2024-2025 Trevor Anderson
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

eslint.config.js

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,86 @@
11
import eslintJS from "@eslint/js";
22
import stylisticPlugin from "@stylistic/eslint-plugin";
33
import vitestPlugin from "@vitest/eslint-plugin";
4+
import { defineConfig } from "eslint/config";
45
import eslintConfigPrettier from "eslint-config-prettier";
5-
import importPlugin from "eslint-plugin-import-x";
6+
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
7+
import {
8+
importX as importXPlugin,
9+
createNodeResolver,
10+
} from "eslint-plugin-import-x";
611
import nodePlugin from "eslint-plugin-n";
712
import globals from "globals";
813
import tsEslint from "typescript-eslint";
914

10-
export default tsEslint.config(
11-
///////////////////////////////////////////////////////////////////
12-
// ALL FILES
15+
// Shared constants:
16+
const PARSED_EXTENSIONS = [".ts", ".js"];
17+
18+
export default defineConfig(
19+
/////////////////////////////////////////////////////////////////////////////
20+
// GLOBAL CONFIGS
1321
{
14-
files: ["src/**/*.ts", "./*.[tj]s"],
15-
linterOptions: { reportUnusedDisableDirectives: true },
22+
name: "global/ignores",
23+
ignores: ["**/node_modules/", "**/coverage/", "**/dist/"],
24+
},
25+
{
26+
name: "global/languageOptions",
1627
languageOptions: {
1728
ecmaVersion: "latest",
1829
sourceType: "module",
19-
globals: globals.node,
2030
parser: tsEslint.parser,
2131
parserOptions: {
2232
projectService: true,
2333
tsconfigRootDir: import.meta.dirname,
2434
},
2535
},
36+
},
37+
{
38+
name: "global/linterOptions",
39+
linterOptions: {
40+
reportUnusedDisableDirectives: true,
41+
},
42+
},
43+
{
44+
name: "global/plugins",
2645
plugins: {
2746
"@stylistic": stylisticPlugin,
2847
"@typescript-eslint": tsEslint.plugin,
29-
"import-x": importPlugin,
48+
"import-x": importXPlugin,
3049
"n": nodePlugin,
50+
"vitest": vitestPlugin,
3151
},
3252
settings: {
33-
"import-x/extensions": [".ts", ".js"],
53+
...importXPlugin.configs.typescript.settings,
54+
"import-x/extensions": PARSED_EXTENSIONS,
3455
"import-x/parsers": {
35-
"@typescript-eslint/parser": [".ts", ".js"],
56+
"@typescript-eslint/parser": PARSED_EXTENSIONS,
3657
},
37-
"import-x/resolver": {
38-
node: { extensions: [".ts", ".js"] },
39-
typescript: { project: ["tsconfig.json"] },
58+
"import-x/resolver-next": [
59+
createTypeScriptImportResolver({ alwaysTryTypes: true }),
60+
createNodeResolver({ extensions: PARSED_EXTENSIONS }),
61+
],
62+
"n": {
63+
// Runtime nodejs version !== dev nodejs version
64+
version: ">=22.19.0",
4065
},
4166
},
67+
},
68+
/////////////////////////////////////////////////////////////////////////////
69+
// ALL FILES
70+
{
71+
name: "files:all/base",
72+
files: ["src/**/*.ts", "./*.[tj]s"],
73+
languageOptions: {
74+
globals: globals.node,
75+
},
4276
rules: {
4377
// MERGE PRESETS:
4478
...stylisticPlugin.configs.customize(
4579
{ semi: true, quotes: "double", arrowParens: true, braceStyle: "1tbs" } // prettier-ignore
4680
).rules,
4781
...eslintJS.configs.recommended.rules,
48-
...importPlugin.configs.recommended.rules,
82+
...importXPlugin.configs.recommended.rules,
83+
...importXPlugin.configs.typescript.rules,
4984
...nodePlugin.configs["flat/recommended-module"].rules,
5085
...[
5186
...tsEslint.configs.strictTypeChecked,
@@ -75,7 +110,7 @@ export default tsEslint.config(
75110
"import-x/order": [
76111
"warn",
77112
{
78-
"groups": ["builtin", "external", "internal", "parent", "sibling", "type"], // prettier-ignore
113+
"groups": ["builtin", "external", "internal", "parent", ["index", "sibling"], "type"], // prettier-ignore
79114
"alphabetize": { order: "asc", orderImportKind: "desc" },
80115
"newlines-between": "never",
81116
},
@@ -93,22 +128,19 @@ export default tsEslint.config(
93128
...eslintConfigPrettier.rules,
94129
},
95130
},
96-
///////////////////////////////////////////////////////////////////
131+
/////////////////////////////////////////////////////////////////////////////
97132
// TEST FILES
98133
{
99134
files: ["src/**/*.test.ts"],
100135
languageOptions: {
101136
globals: vitestPlugin.environments.env.globals,
102137
},
103-
plugins: {
104-
vitest: vitestPlugin,
105-
},
106138
rules: {
107139
...vitestPlugin.configs.recommended.rules,
108140
"vitest/no-disabled-tests": "warn",
109141
"vitest/no-focused-tests": "warn",
110142
"vitest/valid-expect": "warn",
111143
},
112144
}
113-
///////////////////////////////////////////////////////////////////
145+
/////////////////////////////////////////////////////////////////////////////
114146
);

0 commit comments

Comments
 (0)