-
-
Notifications
You must be signed in to change notification settings - Fork 18
chore: set up initial actions & docs #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
60dd36d
chore: set up initial actions & docs
JakobJingleheimer bcbed74
fixup!: remove erroneous main field
JakobJingleheimer 6cb3a8a
ci(test): create job matrix & rename `test:lint` → `lint`
JakobJingleheimer 10d0692
doc: add license file
JakobJingleheimer c53f572
fixup!: rename jobs to be more indicative
JakobJingleheimer a3f83df
fixup!: correct `-test` → `--test`
JakobJingleheimer c29d623
fixup!: remove nonexistent "markdown" in biome config
JakobJingleheimer 558162d
add git things
AugustinMauroy 0d9698c
update biome things
AugustinMauroy a219502
Create .nvmrc
AugustinMauroy 79b0149
add recipes dir
AugustinMauroy 8590905
Fix typo
AugustinMauroy cb84d16
workflows: use `--run`
AugustinMauroy 45bb65a
add more rules
AugustinMauroy bd21091
chore: alphabetise npm scripts
JakobJingleheimer 6534d6d
test(ci): add `pre-commit` superset
JakobJingleheimer 36af6af
chore: fix tsconfig
JakobJingleheimer 7a72cbb
chore(ci): switch angry `node --run` → `npm run`
JakobJingleheimer 3c81c16
chore: adjust glob pattern for angry CI
JakobJingleheimer d081e4b
test(ci): move coverage to only node 23.x
JakobJingleheimer db231d9
Revert "test(ci): move coverage to only node 23.x"
JakobJingleheimer 741e67f
test(ci): remove 20.x
JakobJingleheimer bdd3b74
test(ci): switch actions from tag to SHA to avoid supply-chain vulner…
JakobJingleheimer 30367c9
chore(dep): upgrade `typescript` to `5.7.2`
JakobJingleheimer 3c408df
doc: update codemod registry link
JakobJingleheimer 38df653
fixup!: remove biome bumperstickers
JakobJingleheimer d57d2dd
doc(license): set copyright holder & remove file extension
JakobJingleheimer eef8d21
[actions] use ljharb/actions/node/matrix (#3)
ljharb 0faeabb
Revert "[actions] use ljharb/actions/node/matrix" (#4)
JakobJingleheimer 5fc724f
ci: add dependabot
JakobJingleheimer 80676be
fixup!: correct md block type
JakobJingleheimer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
Lint: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [23.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run test:lint | ||
- run: npm run test:types | ||
|
||
Test: | ||
runs-on: | ||
macos-latest | ||
ubuntu-latest | ||
windows-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [23.x, 22.x, 20.x] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run test:unit | ||
- run: npm run test:e2e | ||
AugustinMauroy marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Contributing | ||
JakobJingleheimer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
A recipe generally has a few things: | ||
|
||
* A `README.md` explaining its purpose and use (including any options, and required and optional | ||
files). | ||
* Tests via node's test runner (min coverage: 80%) | ||
* unit tests (file extension: `.spec.mjs` or `.spec.mts`) | ||
* end-to-end test(s) for accepted use-cases (file extension: `.e2e.mjs` or `.e2e.mts`) | ||
* Code comments (js docs, etc) | ||
* Types (either via typescript or jsdoc) | ||
|
||
CI will run lint & type checking and all included test files against all PRs. | ||
|
||
> [!INFO] | ||
> snapshots will be generated with the file extension `.snap.cjs`. | ||
|
||
New recipes are added under `./recipes` in their own folder, succinctly named for what it does. General-purpose recipes have simple names like `correct-ts-specifiers`. A suite of migrations has a name like `migrate from 18 to 20`, and more specific migrations are named like `migrate fs.readFile from 18 to 20`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
# Node.js userland migrations | ||
|
||
This repository contains codemodes (automated migrations) for "userland" code. These are intended to facilitate adopting new features and upgrading source-code affected by breaking changes. | ||
|
||
## Usage | ||
|
||
> [!CAUTION] | ||
> These scripts change source code. Commit any unsaved changes before running them. Failing to do so may ruin your day. | ||
|
||
To run the transform scripts use [`codemod`](https://go.codemod.com/github) command below: | ||
|
||
```console | ||
$ npx codemod <transform> --target <path> [...options] | ||
``` | ||
|
||
* `transform` - name of transform. see available transforms below. | ||
* `path` - directory to transform. defaults to the current directory. | ||
|
||
See the [codemod CLI doc](https://go.codemod.com/cli-docs) for a full list of available commands. | ||
|
||
## Available codemods | ||
|
||
All Node.js codemods are also available in the [Codemod Registry](https://codemod.com/registry?framework=node.js). | ||
AugustinMauroy marked this conversation as resolved.
Show resolved
Hide resolved
|
AugustinMauroy marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"formatter": { | ||
"indentStyle": "tab", | ||
"lineWidth": 100 | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"semicolons": "always", | ||
"quoteStyle": "single", | ||
"trailingCommas": "all" | ||
}, | ||
"linter": { | ||
"style": { | ||
"useImportType": true | ||
} | ||
} | ||
}, | ||
"json": { | ||
"formatter": { | ||
"enabled": false | ||
} | ||
}, | ||
"markdown": { | ||
"formatter": { | ||
"enabled": false | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { basename, dirname, extname, join } from 'node:path'; | ||
import { snapshot } from 'node:test'; | ||
|
||
|
||
snapshot.setResolveSnapshotPath(generateSnapshotPath); | ||
/** | ||
* @param testFilePath '/tmp/foo.test.js' | ||
* @returns '/tmp/foo.test.snap.cjs' | ||
*/ | ||
function generateSnapshotPath(testFilePath?: string) { | ||
if (!testFilePath) return ''; | ||
|
||
const ext = extname(testFilePath); | ||
const filename = basename(testFilePath, ext); | ||
const base = dirname(testFilePath); | ||
|
||
return join(base, `${filename}.snap.cjs`); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "userland-migrations", | ||
"version": "1.0.0", | ||
"description": "A collection of migration recipes for userland code.", | ||
"main": "index.js", | ||
JakobJingleheimer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"scripts": { | ||
"test:e2e": "node --no-warnings --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=./coverage.lcov --test-reporter=spec --test-reporter-destination=stdout --import './build/snapshots.ts' -test --test-coverage-include='recipes/**/*' --test-coverage-exclude='**/*.e2e.m(j|t)s' './packages/*/*.e2e.m(j|t)s'", | ||
"test:lint": "biome lint ./recipes", | ||
"test:types": "tsc", | ||
JakobJingleheimer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"test:unit": "node --no-warnings --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=./coverage.lcov --test-reporter=spec --test-reporter-destination=stdout --experimental-test-module-mocks --import './build/snapshots.ts' -test --test-coverage-include='recipes/**/*' --test-coverage-exclude='**/*.spec.m(j|t)s' --test-coverage-lines=0.8 './packages/*/*.spec.m(j|t)s'" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/nodejs/userland-migrations" | ||
}, | ||
"keywords": [ | ||
"automation", | ||
"codemod", | ||
"migrations", | ||
"node.js" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/nodejs/userland-migrations/issues" | ||
}, | ||
"homepage": "https://nodejs.org/learn/userland-migrations", | ||
bmuenzenmeyer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"devDependencies": { | ||
"@biomejs/biome": "^1.9.4", | ||
"@types/node": "^22.9.1", | ||
"typescript": "^5.6.3" | ||
AugustinMauroy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
"workspaces": [ | ||
"./recipes/*" | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.