Skip to content

Commit

Permalink
feat: drop node 14
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove node 14 support
  • Loading branch information
tdreyno committed Mar 20, 2023
1 parent 823b223 commit f7541ec
Show file tree
Hide file tree
Showing 31 changed files with 191 additions and 7,147 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
// Update 'VARIANT' to pick a Node version: 18, 16.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"args": {
Expand All @@ -27,7 +27,7 @@
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
// "postCreateCommand": "npm install",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ["18", "16", "14"]
node: ["18", "16"]
name: Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: yarn install
- run: yarn test
- run: yarn build
- run: npm ci
- run: npm run test
- run: npm run build
- name: Code Climate Coverage Action
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: 3c9c36dc44d794c8a3f398889936100a4df2b6913e5388ab824effed6cefcc31
with:
coverageCommand: yarn coverage
- run: yarn test:npm
coverageCommand: npm run coverage
- run: npm run test:npm
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
with:
node-version: 16
- name: Install dependencies
run: yarn install
run: npm ci
- name: Build
run: yarn build
run: npm run build
- name: Test
run: yarn test
run: npm run test
- name: Test NPM
run: yarn test:npm
run: npm run test:npm
- name: Release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release
run: npm run semantic-release
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ build
/*.log
.DS_Store
.cache
yarn-error.log
/coverage
package-lock.json
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit
npm exec commitlint -- --edit
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
. "$(dirname "$0")/_/husky.sh"

npm test
yarn run lint-staged
npm exec lint-staged
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package-lock.json
yarn.lock
build
dist
coverage
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Fizz is a small library for building state machines that can effectively manage
## Install

```bash
yarn add @tdreyno/fizz
npm install --save @tdreyno/fizz
```

## Let's play pong
Expand Down
2 changes: 1 addition & 1 deletion bin/test-npm-version
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /bin/bash

yarn link && cd test-npm-version && yarn && yarn link "@tdreyno/fizz" && yarn build
npm link && cd test-npm-version && npm install && npm link "@tdreyno/fizz" && npm run build
16 changes: 9 additions & 7 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,8 @@ module.exports = {
// globalTeardown: null,

// A set of global variables that need to be available in all test environments
globals: {
"ts-jest": {
useESM: true,
diagnostics: false,
},
},
// globals: {
// },

// extensionsToTreatAsEsm: [".ts", ".tsx"],

Expand Down Expand Up @@ -166,7 +162,13 @@ module.exports = {

// A map from regular expressions to paths to transformers
transform: {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.tsx?$": [
"ts-jest",
{
useESM: true,
diagnostics: false,
},
],
"^.+\\.svelte$": [
"svelte-jester",
{
Expand Down
47 changes: 24 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"access": "public"
},
"engines": {
"node": ">= 14"
"node": ">= 16"
},
"sideEffects": false,
"type": "module",
Expand All @@ -22,44 +22,45 @@
"build:incremental": "tsc --incremental --project tsconfig.json",
"test": "jest --runInBand",
"test:npm": "bash bin/test-npm-version",
"version": "yarn run build",
"version": "npm run build",
"coverage": "jest --runInBand --coverage --coverageDirectory '../coverage'",
"commit": "git-cz",
"semantic-release": "semantic-release",
"prepare": "husky install"
"prepare": "husky install",
"format": "prettier . --write"
},
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.2",
"@commitlint/prompt": "^17.4.2",
"@commitlint/config-conventional": "^17.4.4",
"@commitlint/prompt": "^17.4.4",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.7",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/svelte": "^3.2.1",
"@types/jest": "^27.4.0",
"@types/node": "^18.7.23",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.4",
"@types/serialize-javascript": "^5.0.1",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.54.0",
"commitizen": "^4.2.6",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.4.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"jest": "^27.5.1",
"lint-staged": "^13.1.2",
"prettier": "^2.8.0",
"semantic-release": "^19.0.5",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"lint-staged": "^13.2.0",
"prettier": "^2.8.5",
"semantic-release": "^20.1.3",
"serialize-javascript": "^6.0.1",
"svelte": "^3.55",
"svelte": "^3.57.0",
"svelte-jester": "^2.3.2",
"svelte-preprocess": "^5.0.1",
"ts-jest": "^27.0.7",
"typescript": "^4.9.3"
"svelte-preprocess": "^5.0.3",
"ts-jest": "^29.0.5",
"typescript": "^5.0.2"
},
"dependencies": {},
"peerDependencies": {
"svelte": "^3.55"
},
Expand All @@ -73,8 +74,8 @@
]
},
"volta": {
"node": "16.13.1",
"yarn": "1.22.17"
"node": "18.15.0",
"npm": "8.17.0"
},
"config": {
"commitizen": {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/boundActions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ActionCreatorType, Enter, createAction } from "../action"
import { StateReturn, stateWrapper } from "../state"

import { type ActionCreatorType, type Enter, createAction } from "../action"
import { type StateReturn, stateWrapper } from "../state"
import { createInitialContext } from "../context"
import { createRuntime } from "../runtime"
import { noop } from "../effect"
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/default.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { enter, Enter } from "../action"
import { enter, type Enter } from "../action"
import { createInitialContext } from "../context"
import { isState, state } from "../state"
import { createRuntime } from "../runtime"
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/is.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { enter, Enter } from "../action"
import { enter, type Enter } from "../action"
import { createInitialContext } from "../context"
import { isState, state } from "../state"
import { createRuntime } from "../runtime"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionCreatorType, createAction } from "../../../../action"
import { type ActionCreatorType, createAction } from "../../../../action"

export const finishedLoading = createAction<"FinishedLoading", string>(
"FinishedLoading",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/loadingMachine/core/actions/ReEnter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionCreatorType, createAction } from "../../../../action"
import { type ActionCreatorType, createAction } from "../../../../action"

export const reEnter = createAction<"ReEnter", string>("ReEnter")
export type ReEnter = ActionCreatorType<typeof reEnter>
2 changes: 1 addition & 1 deletion src/__tests__/loadingMachine/core/actions/Reset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionCreatorType, createAction } from "../../../../action"
import { type ActionCreatorType, createAction } from "../../../../action"

export const reset = createAction("Reset")
export type Reset = ActionCreatorType<typeof reset>
2 changes: 1 addition & 1 deletion src/__tests__/loadingMachine/core/actions/StartLoading.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionCreatorType, createAction } from "../../../../action"
import { type ActionCreatorType, createAction } from "../../../../action"

export const startLoading = createAction("StartLoading")
export type StartLoading = ActionCreatorType<typeof startLoading>
2 changes: 1 addition & 1 deletion src/__tests__/loadingMachine/core/actions/Update.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionCreatorType, createAction } from "../../../../action"
import { type ActionCreatorType, createAction } from "../../../../action"

export const update = createAction("Update")
export type Update = ActionCreatorType<typeof update>
3 changes: 1 addition & 2 deletions src/__tests__/loadingMachine/core/states/Initializing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { StartLoading, startLoading } from "../actions"

import { type StartLoading, startLoading } from "../actions"
import type { Enter } from "../../../../action"
import Loading from "./Loading"
import type { Shared } from "../types"
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/nestedMachine/actions/CompletedForm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionCreatorType, createAction } from "../../../action"
import { type ActionCreatorType, createAction } from "../../../action"

export const completedForm = createAction<"CompletedForm", string>(
"CompletedForm",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionCreatorType, createAction } from "../../../../../action"
import { type ActionCreatorType, createAction } from "../../../../../action"

export const setName = createAction<"SetName", string>("SetName")
export type SetName = ActionCreatorType<typeof setName>
8 changes: 6 additions & 2 deletions src/__tests__/onContextChange.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { ActionCreatorType, Enter, createAction, enter } from "../action"
import {
type ActionCreatorType,
type Enter,
createAction,
enter,
} from "../action"
import { Context, createInitialContext } from "../context"

import { createRuntime } from "../runtime"
import { noop } from "../effect"
import { state } from "../state"
Expand Down
8 changes: 6 additions & 2 deletions src/__tests__/promises.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ActionCreatorType, Enter, createAction, enter } from "../action"
import {
type ActionCreatorType,
type Enter,
createAction,
enter,
} from "../action"
import { effect, noop } from "../effect"

import { createInitialContext } from "../context"
import { createRuntime } from "../runtime"
import { isState, state } from "../state"
Expand Down
9 changes: 7 additions & 2 deletions src/__tests__/runtime.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { ActionCreatorType, Enter, Exit, createAction, enter } from "../action"
import {
type ActionCreatorType,
type Enter,
type Exit,
createAction,
enter,
} from "../action"
import { goBack, log, noop } from "../effect"

import type { Context } from "../context"
import { UnknownStateReturnType } from "../errors"
import { createInitialContext } from "../context"
Expand Down
6 changes: 5 additions & 1 deletion src/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { type Action, enter, exit, isAction, beforeEnter } from "./action.js"
import { type Effect, effect, isEffect, log } from "./effect.js"
import { MissingCurrentState, UnknownStateReturnType } from "./errors.js"
import { StateReturn, StateTransition, isStateTransition } from "./state.js"
import {
type StateReturn,
type StateTransition,
isStateTransition,
} from "./state.js"
import { arraySingleton, externalPromise } from "./util.js"

import type { Context } from "./context.js"
Expand Down
10 changes: 5 additions & 5 deletions src/state.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
Action,
ActionCreator,
ActionName,
ActionPayload,
BeforeEnter,
type Action,
type ActionCreator,
type ActionName,
type ActionPayload,
type BeforeEnter,
enter,
} from "./action.js"
import { createInitialContext } from "./context.js"
Expand Down
2 changes: 1 addition & 1 deletion src/svelte/createStore.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Action, enter, beforeEnter } from "../action.js"
import type { BoundStateFn, StateTransition } from "../state.js"
import { Context, createInitialContext } from "../context.js"
import { Readable, readable } from "svelte/store"
import { type Readable, readable } from "svelte/store"
import { Runtime, createRuntime } from "../runtime.js"

export interface ContextValue<
Expand Down
Loading

0 comments on commit f7541ec

Please sign in to comment.