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

module-first setup #5

Merged
merged 5 commits into from
Apr 21, 2024
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
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

39 changes: 39 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* eslint-env node */
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'prettier',
],
ignorePatterns: ['dist/'],
settings: {
'import/resolver': {
typescript: true,
},
react: { version: 'detect' },
},
rules: {
'import/no-unresolved': ['error', { ignore: ['zustand-slices'] }],
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
};
91 changes: 0 additions & 91 deletions .eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/pnpm-lock.yaml
/dist
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

## [Unreleased]

### Changed

- ESM-first build #5

## [0.0.2] - 2024-04-19

### Changed

- Detect name collisions #1

## [0.0.1] - 2024-04-18

### Added

- Initial release
13 changes: 4 additions & 9 deletions examples/01_counter/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "zustand-slices-example",
"version": "0.1.0",
"name": "example",
"version": "0.0.0",
"private": true,
"type": "commonjs",
"dependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
Expand All @@ -17,11 +18,5 @@
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
}
8 changes: 8 additions & 0 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler"
},
"exclude": []
}
70 changes: 35 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,86 @@
"name": "zustand-slices",
"description": "A slice utility for Zustand",
"version": "0.0.2",
"type": "module",
"author": "Daishi Kato",
"repository": {
"type": "git",
"url": "https://github.com/zustandjs/zustand-slices.git"
},
"source": "./src/index.ts",
"main": "./dist/index.umd.js",
"module": "./dist/index.modern.js",
"types": "./dist/src/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/index.modern.mjs",
"default": "./dist/index.umd.js"
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
},
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"sideEffects": false,
"files": [
"src",
"dist"
],
"packageManager": "[email protected]",
"scripts": {
"compile": "microbundle build -f modern,umd --globals react=React --no-compress",
"postcompile": "cp dist/index.modern.mjs dist/index.modern.js && cp dist/index.modern.mjs.map dist/index.modern.js.map",
"test": "run-s eslint tsc-test jest",
"eslint": "eslint --ext .js,.ts,.tsx .",
"jest": "jest",
"tsc-test": "tsc --project . --noEmit",
"examples:01_counter": "DIR=01_counter EXT=tsx webpack serve"
},
"jest": {
"testEnvironment": "jsdom",
"preset": "ts-jest/presets/js-with-ts",
"setupFilesAfterEnv": [
"./test-setup.ts"
]
"compile": "rm -rf dist && pnpm run '/^compile:.*/'",
"compile:esm": "tsc -p tsconfig.esm.json",
"compile:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
"test": "pnpm run '/^test:.*/'",
"test:format": "prettier -c .",
"test:lint": "eslint .",
"test:types": "tsc -p . --noEmit",
"test:types:examples": "tsc -p examples --noEmit",
"test:spec": "vitest run",
"examples:01_counter": "DIR=01_counter vite"
},
"keywords": [
"react",
"zustand",
"slices"
],
"license": "MIT",
"prettier": {
"singleQuote": true
},
"dependencies": {
"signal-polyfill": "^0.1.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^15.0.2",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.7",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"eslint": "8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"html-webpack-plugin": "^5.6.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"microbundle": "^0.15.1",
"npm-run-all": "^4.1.5",
"eslint-plugin-react-hooks": "^4.6.0",
"jsdom": "^24.0.0",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ts-expect": "^1.3.0",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"typescript": "^5.4.5",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"vite": "^5.2.10",
"vitest": "^1.5.0",
"zustand": "^4.5.2"
},
"peerDependencies": {
"react": "*",
"react": ">=18.0.0",
"zustand": ">=4.0.0"
}
}
Loading
Loading