Skip to content

Commit

Permalink
Improve project's setup
Browse files Browse the repository at this point in the history
* Use tsup to build project;
* Update entry poing for cjs and esm;
* Remove umd support;
* Update npm scripts and husky hooks;
* Disable husky installation, remove pinst and move husky installation to prepare script;
* Set minimal required Node.js version to 18;
* Update ci workflow to use Node 18, 20 and 21;
* Use Node 20 for coverage reports and eslint workflow;
* Remove typescript workflow, because tsup will manage type validation;
  • Loading branch information
octet-stream committed Nov 10, 2023
1 parent 9b46fd2 commit 6e0181c
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 86 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
57 changes: 0 additions & 57 deletions .github/workflows/typescript.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
npm run lint:types
npm run lint-staged
pnpm exec lint-staged
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run coverage
pnpm run coverage
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules

/.changeset
/.github
/.husky
/coverage
Expand All @@ -15,3 +16,4 @@ node_modules
/tsconfig.eslint.json
/tsconfig.build.json
/tsconfig.ava.json
/tsup.config.ts
36 changes: 16 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,28 @@
"sideEffects": false,
"packageManager": "[email protected]",
"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": {
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"
},
Expand Down
12 changes: 8 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6e0181c

Please sign in to comment.