You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -48,48 +53,63 @@ A script for checking compatible licenses is included.
48
53
**Create** the husky hook file `.husky/pre-commit`
49
54
50
55
```sh
51
-
#!/bin/sh
52
-
."$(dirname "$0")/_/husky.sh"
53
-
54
-
yarn lint-staged
56
+
lint-staged
55
57
```
56
58
57
59
**Adjust** build script references to make sure they use `tsconfig.build.json`, e.g. `tsc -p tsconfig.build.json`.
58
60
59
61
**Ensure** the following development dependencies are present:
60
62
61
63
-`@types\node` and `@types\jest` (if using)
62
-
- Typescript 4 or above, e.g. `~4.0` with an up-to-date `tslib`
64
+
- Typescript 5.7 or above, e.g. `~5.7` with an up-to-date `tslib`
63
65
-`jest` and `ts-jest`, if using
64
66
65
-
**Remove** any other linting configurations or linters. Also, `node-license-validator` is no longer required. Remove libraries that are re-exported by this project `husky`, `lint-staged`, `eslint` and `prettier`
@@ -136,17 +156,41 @@ _Note: replace the {{PACKAGE-NAME}} with the correct package name, i.e. `hyperde
136
156
137
157
```javascript
138
158
module.exports= {
139
-
globals: {
140
-
'ts-jest': {
141
-
tsconfig:'tsconfig.json'
142
-
}
143
-
}, // ...
159
+
transform: {
160
+
'^.+\\.(ts|tsx)$': [
161
+
'ts-jest',
162
+
{
163
+
tsconfig:'tsconfig.json',
164
+
},
165
+
],
166
+
},
167
+
// ...
144
168
```
145
169
146
170
**Remove** any other old linting or tsconfig files and refernces to them, for example a `config` folder containing `tsconfig...` files. These are no longer required.
147
171
148
172
## Upgrade
149
173
174
+
### v2 to v3.0
175
+
176
+
If not already, the project should be updated to yarn v4 instead of yarn v1. yarn v1 was EOL a few years ago, and v4 is working for us quite nicely.
177
+
178
+
1. Make sure that you are ready to do a semver major bump, with a new minimum nodejs version of v20.
179
+
1. Update your package.json engines to require node 20
180
+
1. Install the updated `@sofie-automation/code-standard-preset` package
181
+
1. Install tools that used to be included by the preset package: `yarn add eslint husky lint-staged prettier`, any you do not need can be omitted.
182
+
1. Check the package.json scripts;
183
+
- Change `husky install` to `husky`
184
+
- Change the `lint:raw` to simply `eslint`
185
+
- Check if any `yarn X` can be made simply `X` or `run X`
186
+
1. In `.husky/pre-commit`, replace the contents to be simply `lint-staged`
187
+
1. Ensure the project has an updated typescript
188
+
- This may require updating other tools, be sure to check jest/compiling later
189
+
1. Remove the existing `.eslintrc.json` and replace with the new `eslint.config.mjs` example above. If you have modified your file from the default, you will need to translate that across.
190
+
1. In your code, any references to eslint rules `node/*` have been renamed to `n/*`
191
+
1. Due to the rules requiring conforming to ESM import syntax, you may need to update many file imports. You can use `npx fix-esm-import-path src` as an easy way of updating all the imports in the project
192
+
1. Make sure that everything is working. You will likely have a bunch of linter failures due to updated formatting and linting rules, which will need resolving.
193
+
150
194
### v2.0 to v2.1
151
195
152
196
This release introduces a simple replacement for `standard-version`
@@ -163,6 +207,7 @@ Steps:
163
207
- Below any `yarn publish ....` lines, add `echo "**Published:** $NEW_VERSION" >> $GITHUB_STEP_SUMMARY` to log the publish in the github action workflow
164
208
165
209
While you are here, try to update any `uses:` lines in the actions workflows, common ones that need updating:
210
+
166
211
- `actions/checkout@v3`
167
212
- `actions/setup-node@v3`
168
213
@@ -176,7 +221,6 @@ Steps:
176
221
- Remove the old husky config from `package.json`
177
222
- Update the scripts and lint-staged config in `package.json`
178
223
179
-
180
224
---
181
225
182
226
_The NRK logo is a registered trademark of Norsk rikskringkasting AS. The license does not grant any right to use, in any way, any trademarks, service marks or logos of Norsk rikskringkasting AS._
0 commit comments