diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d89f2cf..58459bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - node: [16.x, 18.x, 20.x] + node: [18.x, 20.x, 21.x] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -65,7 +65,7 @@ jobs: - name: Upload codecov report uses: codecov/codecov-action@v3 - if: matrix.node == '18.x' && matrix.os == 'ubuntu-latest' + if: matrix.node == '20.x' && matrix.os == 'ubuntu-latest' with: file: ./coverage/coverage-final.json flags: unittests diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml deleted file mode 100644 index ed3ce1e..0000000 --- a/.github/workflows/typescript.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: TypeScript Types - -on: - push: - branches: [main] - paths: - - "**.ts" - - "**.tsx" - - "package.json" - - "pnpm-lock.yaml" - - "tsconfig.json" - - ".github/workflows/typescript.yml" - pull_request: - branches: [main] - paths: - - "**.ts" - - "**.tsx" - - "package.json" - - "pnpm-lock.yaml" - - "tsconfig.json" - - ".github/workflows/typescript.yml" - -jobs: - typescript: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - - - name: Setup pnpm - uses: pnpm/action-setup@v2 - with: - run_install: false - - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: pnpm i --frozen-lockfile - - - name: Run TypeScript - run: pnpm run lint:types diff --git a/.husky/pre-commit b/.husky/pre-commit index bc6c13f..5ee7abd 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1 @@ -npm run lint:types -npm run lint-staged +pnpm exec lint-staged diff --git a/.husky/pre-push b/.husky/pre-push index cd15012..e4275fc 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1 +1 @@ -npm run coverage +pnpm run coverage diff --git a/.npmignore b/.npmignore index f501f6b..20c53b7 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,6 @@ node_modules +/.changeset /.github /.husky /coverage @@ -15,3 +16,4 @@ node_modules /tsconfig.eslint.json /tsconfig.build.json /tsconfig.ava.json +/tsup.config.ts diff --git a/package.json b/package.json index d2be1af..aaf21d7 100644 --- a/package.json +++ b/package.json @@ -19,32 +19,28 @@ "sideEffects": false, "packageManager": "pnpm@8.10.2", "engines": { - "node": ">= 16.5" + "node": ">= 18" }, - "source": "src/slate-to-react.ts", - "main": "lib/slate-to-react.cjs", - "umd:main": "lib/slate-to-react.umd.js", - "module": "lib/slate-to-react.legacy.mjs", "types": "@type/slate-to-react.d.ts", + "main": "lib/slate-to-react.js", "exports": { - "types": "./@type/slate-to-react.d.ts", - "import": "./lib/slate-to-react.mjs", - "require": "./lib/slate-to-react.cjs", - "default": "./lib/slate-to-react.mjs" + "import": { + "types": "./lib/slate-to-react.ts", + "default": "./lib/slate-to-react.js" + }, + "require": { + "types": "./lib/slate-to-react.cts", + "default": "./lib/slate-to-react.cjs" + } }, "scripts": { "eslint": "eslint src/**/*.ts src/**/*.tsx", - "lint:types": "tsc --noEmit", - "lint-staged": "lint-staged", "test": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" ava", "coverage": "c8 pnpm test", "report": "c8 -r=html pnpm test", "ci": "c8 pnpm test && c8 report --reporter=json", - "build": "pnpm lint:types && microbundle --tsconfig tsconfig.build.json --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react --globals react/jsx-runtime=jsx", - "cleanup": "del-cli @type lib", - "postinstall": "husky install", - "prepublishOnly": "pinst --disable && pnpm run eslint && pnpm run lint:types && pnpm run cleanup && pnpm run build", - "postpublish": "pinst --enable", + "build": "del-cli lib && tsup", + "prepare": "node -e 'process.exit(+(process.env.CI !== undefined || process.env.NO_HUSKY_HOOKS !== undefined));' && husky install || true", "release": "pnpm build && pnpm changeset publish" }, "pnpm": { @@ -55,8 +51,8 @@ } }, "devDependencies": { - "@changesets/changelog-github": "^0.4.8", - "@changesets/cli": "^2.26.2", + "@changesets/changelog-github": "0.4.8", + "@changesets/cli": "2.26.2", "@octetstream/eslint-config": "7.2.1", "@testing-library/react": "14.0.0", "@types/node": "20.4.1", @@ -68,7 +64,7 @@ "@typescript-eslint/parser": "5.61.0", "ava": "5.3.1", "c8": "8.0.0", - "cross-env": "^7.0.3", + "cross-env": "7.0.3", "del-cli": "5.0.0", "eslint": "8.44.0", "eslint-config-airbnb": "19.0.4", @@ -92,7 +88,7 @@ "slate-react": "0.97.1", "ts-expect": "1.3.0", "ts-node": "10.9.1", - "tsup": "^7.2.0", + "tsup": "7.2.0", "typescript": "5.1.6", "uuid": "9.0.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01a935b..f5a9fee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,5 +1,9 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + dependencies: nanoid: specifier: 3.3.4 @@ -7,10 +11,10 @@ dependencies: devDependencies: '@changesets/changelog-github': - specifier: ^0.4.8 + specifier: 0.4.8 version: 0.4.8 '@changesets/cli': - specifier: ^2.26.2 + specifier: 2.26.2 version: 2.26.2 '@octetstream/eslint-config': specifier: 7.2.1 @@ -46,7 +50,7 @@ devDependencies: specifier: 8.0.0 version: 8.0.0 cross-env: - specifier: ^7.0.3 + specifier: 7.0.3 version: 7.0.3 del-cli: specifier: 5.0.0 @@ -118,7 +122,7 @@ devDependencies: specifier: 10.9.1 version: 10.9.1(@types/node@20.4.1)(typescript@5.1.6) tsup: - specifier: ^7.2.0 + specifier: 7.2.0 version: 7.2.0(postcss@8.4.21)(ts-node@10.9.1)(typescript@5.1.6) typescript: specifier: 5.1.6