Skip to content

Commit

Permalink
chore: .mts migration
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Oct 5, 2024
1 parent 2c4d3e2 commit 402bed6
Show file tree
Hide file tree
Showing 122 changed files with 457 additions and 468 deletions.
13 changes: 7 additions & 6 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ component_management:
- component_id: internal
name: internal
paths:
- src/internal/*.ts
- src/internal/*.mts
- component_id: lib
name: lib
paths:
- src/lib/*.ts
- src/lib/*.mts

coverage:
precision: 2
Expand Down Expand Up @@ -89,14 +89,15 @@ github_checks:
annotations: true

ignore:
- '**/*.d.mts'
- '**/__mocks__/**'
- '**/__tests__/**'
- '**/index.ts'
- '**/index.mts'
- '**/interfaces/**'
- '**/types/**'
- '!src/index.ts'
- src/internal/*.browser.ts
- '!src/index.mts'
- src/internal/*.browser.mts

profiling:
critical_files_paths:
- src/lib/*.ts
- src/lib/*.mts
2 changes: 2 additions & 0 deletions .dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ hmarr
iife
jchen
kaisugi
ksort
lcov
lintstagedrc
mkbuild
mlly
nocheck
nvmrc
pathe
pjson
Expand Down
41 changes: 16 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ jobs:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-key.outputs.result }}
version: ${{ steps.version.outputs.result }}
test-files: ${{ steps.test-files.outputs.files_exists }}
typecheck-files: ${{ steps.typecheck-files.outputs.files_exists }}
version-typescript: ${{ steps.version-typescript.outputs.result }}
version: ${{ steps.version.outputs.result }}
steps:
- id: debug
name: Print environment variables and event payload
Expand Down Expand Up @@ -97,6 +99,16 @@ jobs:
- id: version-typescript
name: Get TypeScript version
run: echo "result=$(jq .devDependencies.typescript package.json -r)" >>$GITHUB_OUTPUT
- id: test-files
name: Check for test files
uses: andstor/[email protected]
with:
files: '**/__tests__/*.spec.+(mts|tsx)'
- id: typecheck-files
name: Check for typecheck files
uses: andstor/[email protected]
with:
files: '**/__tests__/*.spec-d.mts'
commitlint:
needs: preflight
runs-on: ubuntu-latest
Expand Down Expand Up @@ -248,43 +260,34 @@ jobs:
- 5.5.4
- 5.4.5
- 5.0.4
if: ${{ fromJson(needs.preflight.outputs.typecheck-files) }}
steps:
- id: checkout
name: Checkout ${{ env.REF_NAME }}
uses: actions/[email protected]
with:
persist-credentials: false
ref: ${{ env.REF }}
- id: test-files-check
name: Check for typecheck files
uses: andstor/[email protected]
with:
files: '**/__tests__/*.spec-d.ts'
- id: node
if: steps.test-files-check.outputs.files_exists == 'true'
name: Setup Node.js
uses: actions/[email protected]
with:
cache: yarn
cache-dependency-path: yarn.lock
node-version-file: .nvmrc
- id: cache
if: steps.test-files-check.outputs.files_exists == 'true'
name: Restore dependencies cache
uses: actions/[email protected]
with:
key: ${{ needs.preflight.outputs.cache-key }}
path: ${{ env.CACHE_PATH }}
- id: typescript
if: steps.test-files-check.outputs.files_exists == 'true'
name: Install typescript@${{ matrix.typescript-version }}
run: yarn add -D typescript@${{ matrix.typescript-version }}
- id: print-typescript-version
if: steps.test-files-check.outputs.files_exists == 'true'
name: Print TypeScript version
run: jq .devDependencies.typescript package.json -r
- id: typecheck
if: steps.test-files-check.outputs.files_exists == 'true'
name: Run typecheck
run: yarn typecheck
test:
Expand All @@ -302,20 +305,15 @@ jobs:
COVERAGE_SUMMARY: ./coverage/coverage-summary.json
PCT: .total.branches.pct + .total.functions.pct + .total.lines.pct + .total.statements.pct
VITEST_REPORT: ./.vitest-reports/test.blob.json
if: ${{ fromJson(needs.preflight.outputs.test-files) }}
steps:
- id: checkout
name: Checkout ${{ env.REF_NAME }}
uses: actions/[email protected]
with:
persist-credentials: false
ref: ${{ env.REF }}
- id: test-files-check
name: Check for test files
uses: andstor/[email protected]
with:
files: '**/__tests__/*.spec.+(ts|tsx)'
- id: node
if: steps.test-files-check.outputs.files_exists == 'true'
name: Setup Node.js v${{ matrix.node-version }}
uses: actions/[email protected]
with:
Expand All @@ -324,35 +322,30 @@ jobs:
check-latest: true
node-version: ${{ matrix.node-version }}
- id: cache
if: steps.test-files-check.outputs.files_exists == 'true'
name: Restore dependencies cache
uses: actions/[email protected]
with:
key: ${{ needs.preflight.outputs.cache-key }}
path: ${{ env.CACHE_PATH }}
- id: test
if: steps.test-files-check.outputs.files_exists == 'true'
name: Run tests
run: |
yarn test:cov --coverage.thresholds.100=false \
&& echo "coverage=$(jq '${{ env.PCT }}' ${{ env.COVERAGE_SUMMARY }} -r)" >>$GITHUB_OUTPUT
- id: report
if: steps.test-files-check.outputs.files_exists == 'true'
name: Upload report
uses: actions/[email protected]
with:
name: ${{ format('vitest-report-{0}-{1}.json', github.event.repository.name, env.SHA) }}
path: ${{ env.VITEST_REPORT }}
- id: coverage-summary
if: steps.test-files-check.outputs.files_exists == 'true'
name: Upload coverage summary
uses: actions/[email protected]
with:
name: |
${{ format('coverage-summary-{0}-{1}.json', github.event.repository.name, env.SHA) }}
path: ${{ env.COVERAGE_SUMMARY }}
- id: codecov
if: steps.test-files-check.outputs.files_exists == 'true'
name: Upload coverage report to Codecov
uses: codecov/[email protected]
env:
Expand All @@ -373,9 +366,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- id: coverage-failure
if: |
steps.test-files-check.outputs.files_exists == 'true'
&& ${{ toJson(steps.test.outputs.coverage) }} != 400
if: ${{ toJson(steps.test.outputs.coverage) }} != 400
name: Coverage threshold failure (${{ steps.test.outputs.coverage }})
run: yarn test:cov:reports
build:
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"**/*.{cts,mts,ts}": "yarn test --changed --typecheck --mode=typecheck",
"**/yarn.lock": "yarn dedupe --check",
"src/**/*.ts": [
"src/**/*.mts": [
"yarn test --changed --coverage",
"yarn build",
"bash -c tsc -p tsconfig.build.json"
Expand Down
17 changes: 1 addition & 16 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,6 @@
"resolutions"
],
"vsicons.associations.files": [
{
"extensions": [".eslintrc.base.cjs"],
"format": "svg",
"icon": "eslint"
},
{
"extensions": ["build.json", "typecheck.json"],
"format": "svg",
Expand All @@ -247,14 +242,9 @@
"icon": "vitest"
},
{
"extensions": ["spec-d.ts"],
"extensions": ["spec-d.mts"],
"format": "svg",
"icon": "testts"
},
{
"extensions": ["yarnrc.yml"],
"format": "svg",
"icon": "yarn"
}
],
"vsicons.associations.folders": [
Expand All @@ -273,11 +263,6 @@
"format": "svg",
"icon": "private"
},
{
"extensions": ["namespaces"],
"format": "svg",
"icon": "module"
},
{
"extensions": ["patches"],
"format": "svg",
Expand Down
4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ changesetBaseRefs:
changesetIgnorePatterns:
- '!{docs,src/**,{CHANGELOG,LICENSE,README}.md,package.json}'
- '**/*.snap'
- '**/*.spec.ts'
- '**/*.spec-d.ts'
- '**/*.spec.mts'
- '**/*.spec-d.mts'

compressionLevel: mixed

Expand Down
78 changes: 39 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,27 @@ import {

This package exports the following identifiers:

- [`canParseUrl`](./src/lib/can-parse-url.ts)
- [`cwd`](./src/lib/cwd.ts)
- [`defaultConditions`](./src/lib/default-conditions.ts)
- [`defaultExtensions`](./src/lib/default-extensions.ts)
- [`defaultMainFields`](./src/lib/default-main-fields.ts)
- [`extensionFormatMap`](./src/lib/extension-format-map.ts)
- [`formats`](./src/lib/formats.ts)
- [`isAbsoluteSpecifier`](./src/lib/is-absolute-specifier.ts)
- [`isArrayIndex`](./src/lib/is-array-index.ts)
- [`isBareSpecifier`](./src/lib/is-bare-specifier.ts)
- [`isDirectory`](./src/lib/is-directory.ts)
- [`isFile`](./src/lib/is-file.ts)
- [`isImportsSubpath`](./src/lib/is-imports-subpath.ts)
- [`isRelativeSpecifier`](./src/lib/is-relative-specifier.ts)
- [`lookupPackageScope`](./src/lib/lookup-package-scope.ts)
- [`patternKeyCompare`](./src/lib/pattern-key-compare.ts)
- [`patternMatch`](./src/lib/pattern-match.ts)
- [`readPackageJson`](./src/lib/read-package-json.ts)
- [`resolveAlias`](./src/lib/resolve-alias.ts)
- [`resolveModule`](./src/lib/resolve-module.ts)
- [`resolver`](./src/lib/resolver.ts)
- [`canParseUrl`](./src/lib/can-parse-url.mts)
- [`cwd`](./src/lib/cwd.mts)
- [`defaultConditions`](./src/lib/default-conditions.mts)
- [`defaultExtensions`](./src/lib/default-extensions.mts)
- [`defaultMainFields`](./src/lib/default-main-fields.mts)
- [`extensionFormatMap`](./src/lib/extension-format-map.mts)
- [`formats`](./src/lib/formats.mts)
- [`isAbsoluteSpecifier`](./src/lib/is-absolute-specifier.mts)
- [`isArrayIndex`](./src/lib/is-array-index.mts)
- [`isBareSpecifier`](./src/lib/is-bare-specifier.mts)
- [`isDirectory`](./src/lib/is-directory.mts)
- [`isFile`](./src/lib/is-file.mts)
- [`isImportsSubpath`](./src/lib/is-imports-subpath.mts)
- [`isRelativeSpecifier`](./src/lib/is-relative-specifier.mts)
- [`lookupPackageScope`](./src/lib/lookup-package-scope.mts)
- [`patternKeyCompare`](./src/lib/pattern-key-compare.mts)
- [`patternMatch`](./src/lib/pattern-match.mts)
- [`readPackageJson`](./src/lib/read-package-json.mts)
- [`resolveAlias`](./src/lib/resolve-alias.mts)
- [`resolveModule`](./src/lib/resolve-module.mts)
- [`resolver`](./src/lib/resolver.mts)
- `legacyMainResolve`
- `moduleResolve`
- `packageExportsResolve`
Expand All @@ -128,8 +128,8 @@ This package exports the following identifiers:
- `packageResolve`
- `packageSelfResolve`
- `packageTargetResolve`
- [`root`](./src/lib/root.ts)
- [`toRelativeSpecifier`](./src/lib/to-relative-specifier.ts)
- [`root`](./src/lib/root.mts)
- [`toRelativeSpecifier`](./src/lib/to-relative-specifier.mts)

There is no default export.

Expand All @@ -139,25 +139,25 @@ This package is fully typed with [TypeScript][].

### Interfaces

- [`Aliases`](src/interfaces/aliases.ts)
- [`FileSystem`](src/interfaces/file-system.ts)
- [`MainFieldMap`](src/interfaces/main-field-map.ts)
- [`ModuleFormatMap`](src/interfaces/module-format-map.ts)
- [`ResolveAliasOptions`](src/interfaces/options-resolve-alias.ts)
- [`ResolveModuleOptions`](src/interfaces/options-resolve-module.ts)
- [`ProtocolMap`](src/interfaces/protocol-map.ts)
- [`Stats`](src/interfaces/stats.ts)
- [`Aliases`](src/interfaces/aliases.mts)
- [`FileSystem`](src/interfaces/file-system.mts)
- [`MainFieldMap`](src/interfaces/main-field-map.mts)
- [`ModuleFormatMap`](src/interfaces/module-format-map.mts)
- [`ResolveAliasOptions`](src/interfaces/options-resolve-alias.mts)
- [`ResolveModuleOptions`](src/interfaces/options-resolve-module.mts)
- [`ProtocolMap`](src/interfaces/protocol-map.mts)
- [`Stats`](src/interfaces/stats.mts)

### Type Aliases

- [`ChangeExtFn`](src/types/change-ext-fn.ts)
- [`MainField`](src/types/main-field.ts)
- [`ModuleFormat`](src/types/module-format.ts)
- [`ModuleId`](src/types/module-id.ts)
- [`Numeric`](src/types/numeric.ts)
- [`PatternKeyCompareResult`](src/types/pattern-key-compare-result.ts)
- [`PatternMatch`](src/types/pattern-match.ts)
- [`Protocol`](src/types/protocol.ts)
- [`ChangeExtFn`](src/types/change-ext-fn.mts)
- [`MainField`](src/types/main-field.mts)
- [`ModuleFormat`](src/types/module-format.mts)
- [`ModuleId`](src/types/module-id.mts)
- [`Numeric`](src/types/numeric.mts)
- [`PatternKeyCompareResult`](src/types/pattern-key-compare-result.mts)
- [`PatternMatch`](src/types/pattern-match.mts)
- [`Protocol`](src/types/protocol.mts)

## Contribute

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion __fixtures__/parent.ts → __fixtures__/parent.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import pathe from '@flex-development/pathe'
*
* @const {URL} parent
*/
const parent: URL = pathe.pathToFileURL('__fixtures__/parent.ts')
const parent: URL = pathe.pathToFileURL('__fixtures__/parent.mts')

export default parent
Empty file removed __mocks__/.gitkeep
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions build/build.ts → build/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ await make({
{
dts: 'only',
entryPoints: [
'src/*.ts',
'src/interfaces/*.ts',
'src/lib/*.ts',
'src/types/*.ts'
'src/*.mts',
'src/interfaces/*.mts',
'src/lib/*.mts',
'src/types/*.mts'
]
},
{
dts: false,
entryPoints: ['src/internal/*.ts', 'src/lib/*.ts', 'src/*.ts']
entryPoints: ['src/internal/*.mts', 'src/lib/*.mts', 'src/*.mts']
}
],
target: ['node18', tsconfig.compilerOptions.target],
Expand Down
Loading

0 comments on commit 402bed6

Please sign in to comment.