Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate package to TS #68

Merged
merged 2 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
dist
jest.*config.js
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ module.exports = {
'plugin:react/jsx-runtime',
'google',
],
'root': true,
'parser': '@typescript-eslint/parser',
'extends': [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
'parserOptions': {
'ecmaFeatures': {
'jsx': true,
Expand All @@ -26,6 +33,7 @@ module.exports = {
'react-hooks',
'testing-library',
'jest',
'@typescript-eslint',
],
'rules': {
'require-jsdoc': 0,
Expand Down
40 changes: 18 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
name: CI
on: [pull_request]
name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
name: Test

runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: preactjs/compressed-size-action@v2
- uses: actions/checkout@v3
- name: Use Node.js 17
uses: actions/setup-node@v3
with:
compression: 'brotli'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
node-version: '17'
- name: Install dependencies
run: |
npm install -g yarn
- name: yarn install, build, and test
run: |
yarn install
yarn build
yarn run bundlewatch
yarn lint
yarn test
run: npm install
- run: npm run build
- run: npm run bundlewatch
- run: npm test
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
},
],
['@babel/preset-react', {runtime: 'automatic'}],
'@babel/preset-typescript',
],
plugins: [],
};
68 changes: 40 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "teaful",
"version": "0.10.0",
"version": "0.11.0-canary.2",
"description": "Tiny, easy and powerful React state management (less than 1kb)",
"license": "MIT",
"keywords": [
"react",
"typescript",
"preact",
"state",
"state management",
Expand All @@ -23,7 +24,7 @@
"type": "git",
"url": "https://github.com/teafuljs/teaful.git"
},
"source": "package/index.js",
"source": "package/index.ts",
"main": "dist/index.js",
"umd:main": "dist/index.umd.js",
"module": "dist/index.m.js",
Expand All @@ -39,7 +40,7 @@
},
{
"path": "./dist/index.modern.js",
"maxSize": "1 kB"
"maxSize": "1.1 kB"
},
{
"path": "./dist/index.m.js",
Expand All @@ -51,18 +52,19 @@
}
]
},
"types": "package/index.d.ts",
"types": "dist/index.d.ts",
"scripts": {
"lint": "eslint ./package ./tests",
"format": "eslint --fix ./package ./tests ./examples",
"test": "jest ./package ./tests",
"format": "eslint --fix ./package ./tests",
"format:examples": "eslint --fix ./examples",
"test": "jest",
"test:example:todo-list": "jest ./examples/todo-list",
"test:examples": "jest ./examples",
"test:watch": "jest ./package ./tests --watch",
"copy-types": "node ./config/copy-type-definition.js",
"build": "microbundle --jsx React.createElement --no-generateTypes && yarn copy-types",
"test:watch": "jest ./tests --watch",
"build": "microbundle --jsx React.createElement",
"dev": "microbundle watch",
"prepublish": "yarn build"
"prepublish": "yarn build",
"bundlewatch": "bundlewatch"
},
"peerDependencies": {
"react": ">= 16.8.0",
Expand All @@ -74,33 +76,43 @@
}
},
"jest": {
"testEnvironment": "jsdom",
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "identity-obj-proxy"
}
"projects": [
"./tests/config/jest.config.js",
"./tests/config/jest.lint.config.js",
"./tests/config/jest.tsc.config.js"
]
},
"jest-runner-tsc": {
"tsconfigPath": "./tsconfig.json"
},
"devDependencies": {
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.16.4",
"@babel/preset-react": "7.16.0",
"@testing-library/dom": "8.11.1",
"@testing-library/react": "12.1.2",
"@babel/preset-env": "7.16.11",
"@babel/preset-react": "7.16.7",
"@babel/preset-typescript": "7.16.7",
"@testing-library/dom": "8.11.3",
"@testing-library/react": "12.1.4",
"@testing-library/user-event": "13.5.0",
"babel-jest": "27.4.2",
"bundlewatch": "0.3.2",
"eslint": "8.4.0",
"@types/jest": "27.4.1",
"@types/react": "17.0.40",
"@types/react-dom": "17.0.13",
"@typescript-eslint/eslint-plugin": "5.15.0",
"@typescript-eslint/parser": "5.15.0",
"babel-jest": "27.5.1",
"bundlewatch": "0.3.3",
"eslint": "8.11.0",
"eslint-config-google": "0.14.0",
"eslint-plugin-jest": "25.3.0",
"eslint-plugin-react": "7.27.1",
"eslint-plugin-jest": "26.1.1",
"eslint-plugin-react": "7.29.4",
"eslint-plugin-react-hooks": "4.3.0",
"eslint-plugin-testing-library": "5.0.1",
"jest": "27.4.3",
"eslint-plugin-testing-library": "5.1.0",
"jest": "27.5.1",
"jest-runner-eslint": "1.0.0",
"jest-runner-tsc": "1.6.0",
"microbundle": "0.14.2",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-test-renderer": "17.0.2",
"shelljs": "0.8.4"
"react-test-renderer": "17.0.2"
},
"bugs": "https://github.com/teafuljs/teaful/issues"
}
61 changes: 0 additions & 61 deletions package/index.d.ts

This file was deleted.

Loading