Skip to content

Commit

Permalink
Module-first setup (#11)
Browse files Browse the repository at this point in the history
* Module-first setup

* update CHANGELOG
  • Loading branch information
dai-shi authored May 12, 2024
1 parent b56d9d4 commit f12c315
Show file tree
Hide file tree
Showing 22 changed files with 2,364 additions and 7,719 deletions.
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: ['jotai-cache'] }],
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
};
61 changes: 0 additions & 61 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.

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

## [Unreleased]

### Changed

- Module-first setup #11

## [0.4.1] - 2024-01-30

### Changed

- fix: always async #10

## [0.4.0] - 2024-01-11

### Added

- fix behavior with strict mode #7

## [0.3.0] - 2023-03-03

### Added

- feat: mark internal atoms as private

## [0.2.0] - 2023-01-31

### Added

- Migrate to Jotai v2 API #1
7 changes: 0 additions & 7 deletions __tests__/01_basic_spec.tsx

This file was deleted.

13 changes: 4 additions & 9 deletions examples/01_typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "jotai-cache-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"
]
}
}
2 changes: 1 addition & 1 deletion examples/01_typescript/public/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<title>jotai-cache example</title>
<title>example</title>
</head>
<body>
<div id="app"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Suspense } from 'react';
import { Suspense } from 'react';
import { useAtom } from 'jotai/react';
import { atom } from 'jotai/vanilla';
import { atomWithCache } from 'jotai-cache';
Expand Down
4 changes: 2 additions & 2 deletions examples/01_typescript/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { StrictMode } from 'react';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';

import App from './App';
import App from './app';

const ele = document.getElementById('app');
if (ele) {
Expand Down
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": []
}
90 changes: 46 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,80 @@
"name": "jotai-cache",
"description": "👻🗃 ",
"version": "0.4.1",
"type": "module",
"author": "Daishi Kato",
"repository": {
"type": "git",
"url": "https://github.com/jotaijs/jotai-cache.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",
"module": "./dist/index.modern.js",
"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",
"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_typescript": "DIR=01_typescript EXT=tsx webpack serve"
},
"jest": {
"testEnvironment": "jsdom",
"preset": "ts-jest/presets/js-with-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_typescript": "DIR=01_typescript vite"
},
"keywords": [
"jotai",
"react",
"cache"
],
"license": "MIT",
"prettier": {
"singleQuote": true
},
"devDependencies": {
"@types/jest": "^29.5.11",
"@types/node": "^20.11.10",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
"@testing-library/user-event": "^14.5.2",
"@types/node": "^20.12.11",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"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.33.2",
"html-webpack-plugin": "^5.6.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jotai": "^2.6.3",
"microbundle": "^0.15.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"typescript": "^5.3.3",
"webpack": "^5.90.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"happy-dom": "^14.10.1",
"jotai": "^2.8.0",
"prettier": "^3.2.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"ts-expect": "^1.3.0",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vitest": "^1.6.0"
},
"peerDependencies": {
"jotai": ">=2.0.0"
Expand Down
Loading

0 comments on commit f12c315

Please sign in to comment.