Skip to content

Commit

Permalink
chore: upgrade dependencies
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
- The minimal version of Node.js is 16.
- CommonJS => ESM.
  • Loading branch information
BlackGlory committed Apr 5, 2023
1 parent cfb5c93 commit 2a33859
Show file tree
Hide file tree
Showing 16 changed files with 1,121 additions and 1,635 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion __tests__/can-transition.spec.ts
@@ -1,4 +1,4 @@
import { canTransition } from '@src/can-transition'
import { canTransition } from '@src/can-transition.js'

describe('canTransition', () => {
describe('legal', () => {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/finite-state-machine.spec.ts
@@ -1,5 +1,5 @@
import { FiniteStateMachine } from '@src/finite-state-machine'
import { BadEventError } from '@src/errors'
import { FiniteStateMachine } from '@src/finite-state-machine.js'
import { BadEventError } from '@src/errors.js'
import { getError } from 'return-style'

describe('FiniteStateMachine', () => {
Expand Down
5 changes: 3 additions & 2 deletions __tests__/observable-finite-state-machine.spec.ts
@@ -1,6 +1,7 @@
import { ObservableFiniteStateMachine } from '@src/observable-finite-state-machine'
import { BadEventError } from '@src/errors'
import { ObservableFiniteStateMachine } from '@src/observable-finite-state-machine.js'
import { BadEventError } from '@src/errors.js'
import { getError } from 'return-style'
import { jest } from '@jest/globals'

describe('ObservableFiniteStateMachine', () => {
describe('observerStateChanges', () => {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/transition.spec.ts
@@ -1,6 +1,6 @@
import { transition } from '@src/transition'
import { transition } from '@src/transition.js'
import { getError } from 'return-style'
import { BadEventError } from '@src/errors'
import { BadEventError } from '@src/errors.js'

describe('transition', () => {
describe('legal', () => {
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion jest.config.js → jest.config.cjs
Expand Up @@ -2,7 +2,8 @@ const { pathsToModuleNameMapper } = require('ts-jest')
const { compilerOptions } = require('./tsconfig.base.json')

module.exports = {
preset: 'ts-jest'
preset: 'ts-jest/presets/default-esm'
, resolver: '@blackglory/jest-resolver'
, testMatch: ['**/__tests__/**/?(*.)+(spec|test).[jt]s?(x)']
, moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/'
Expand Down
58 changes: 32 additions & 26 deletions package.json
Expand Up @@ -2,56 +2,62 @@
"name": "extra-fsm",
"version": "0.1.1",
"description": "",
"files": ["lib"],
"files": [
"lib"
],
"type": "module",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"sideEffects": false,
"repository": "git@github.com:BlackGlory/extra-fsm.git",
"author": "BlackGlory <woshenmedoubuzhidao@blackglory.me>",
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=16"
},
"scripts": {
"prepare": "ts-patch install -s",
"lint": "eslint --ext .js,.jsx,.ts,.tsx --quiet src __tests__",
"test": "jest --runInBand --config jest.config.js",
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --config jest.config.js",
"test:coverage": "jest --coverage --config jest.config.js",
"prepublishOnly": "run-s clean build",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand --config jest.config.cjs",
"test:debug": "cross-env NODE_OPTIONS=--experimental-vm-modules node --inspect-brk node_modules/.bin/jest --runInBand --config jest.config.cjs",
"test:coverage": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --config jest.config.cjs",
"prepublishOnly": "run-s prepare clean build",
"clean": "rimraf lib",
"build": "run-s build:*",
"build:compile": "tsc --project tsconfig.build.json --module commonjs --target es2018 --outDir lib",
"build:patch": "tscpaths -p tsconfig.build.json -s ./src -o ./lib",
"build": "tsc --project tsconfig.build.json",
"release": "standard-version"
},
"husky": {
"hooks": {
"pre-commit": "run-s lint build test",
"pre-commit": "run-s prepare lint build test",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@types/jest": "^28.1.1",
"@types/node": "14",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"eslint": "^8.26.0",
"@blackglory/jest-resolver": "^0.3.0",
"@commitlint/cli": "^17.5.1",
"@commitlint/config-conventional": "^17.4.4",
"@types/jest": "^29.5.0",
"@types/node": "16",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"cross-env": "^7.0.3",
"eslint": "^8.37.0",
"husky": "^4.3.8",
"jest": "^28.1.1",
"jest": "^29.5.0",
"jest-resolve": "^29.5.0",
"npm-run-all": "^4.1.5",
"return-style": "^1.0.0",
"return-style": "^3.0.0",
"rimraf": "^3.0.2",
"standard-version": "^9.5.0",
"ts-jest": "^28.0.4",
"tscpaths": "^0.0.9",
"tslib": "^2.4.0",
"typescript": "^4.7.3"
"ts-jest": "^29.1.0",
"ts-patch": "^2.1.0",
"tslib": "^2.5.0",
"typescript": "4.8",
"typescript-transform-paths": "^3.4.6"
},
"dependencies": {
"@blackglory/errors": "^2.2.3",
"@blackglory/types": "^1.3.0",
"rxjs": "^7.5.5"
"@blackglory/errors": "^3.0.2",
"extra-utils": "^5.1.1",
"rxjs": "^7.8.0"
}
}
2 changes: 1 addition & 1 deletion src/can-transition.ts
@@ -1,4 +1,4 @@
import { IFiniteStateMachineSchema } from './types'
import { IFiniteStateMachineSchema } from './types.js'

export function canTransition<
State extends string | number | symbol
Expand Down
4 changes: 2 additions & 2 deletions src/finite-state-machine.ts
@@ -1,5 +1,5 @@
import { IFiniteStateMachineSchema } from './types'
import { BadEventError } from './errors'
import { IFiniteStateMachineSchema } from './types.js'
import { BadEventError } from './errors.js'

export class FiniteStateMachine<
State extends string | number | symbol
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
@@ -1,6 +1,6 @@
export * from './finite-state-machine'
export * from './observable-finite-state-machine'
export * from './transition'
export * from './can-transition'
export * from './errors'
export * from './types'
export * from './finite-state-machine.js'
export * from './observable-finite-state-machine.js'
export * from './transition.js'
export * from './can-transition.js'
export * from './errors.js'
export * from './types.js'
4 changes: 2 additions & 2 deletions src/observable-finite-state-machine.ts
@@ -1,6 +1,6 @@
import { FiniteStateMachine } from './finite-state-machine'
import { FiniteStateMachine } from './finite-state-machine.js'
import { Subject, Observable } from 'rxjs'
import { isEmptyObject } from '@blackglory/types'
import { isEmptyObject } from 'extra-utils'

export interface IFiniteStateMachineStateChange<
State extends string | number | symbol
Expand Down
6 changes: 3 additions & 3 deletions src/transition.ts
@@ -1,6 +1,6 @@
import { IFiniteStateMachineSchema } from './types'
import { canTransition } from './can-transition'
import { BadEventError } from './errors'
import { IFiniteStateMachineSchema } from './types.js'
import { canTransition } from './can-transition.js'
import { BadEventError } from './errors.js'

export function transition<
State extends string | number | symbol
Expand Down
10 changes: 8 additions & 2 deletions tsconfig.base.json
@@ -1,7 +1,9 @@
{
"compilerOptions": {
"target": "ES2019"
, "module": "CommonJS"
"target": "ES2018"
, "module": "NodeNext"
, "moduleResolution": "NodeNext"
, "esModuleInterop": true
, "strict": true
, "noUnusedLocals": true
, "noUnusedParameters": true
Expand All @@ -11,5 +13,9 @@
, "@utils/*": ["src/utils/*"]
, "@test/*": ["__tests__/*"]
}
, "plugins": [
{ "transform": "typescript-transform-paths" }
, { "transform": "typescript-transform-paths", "afterDeclarations": true }
]
}
}

0 comments on commit 2a33859

Please sign in to comment.