Skip to content

Commit

Permalink
Eject wes-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
WesSouza committed Dec 16, 2023
1 parent 0a401e9 commit c7cfc90
Show file tree
Hide file tree
Showing 17 changed files with 4,072 additions and 78 deletions.
26 changes: 26 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_\\d*$"
}
]
},
"ignorePatterns": [
"**/dist/**"
]
}
28 changes: 14 additions & 14 deletions .github/workflows/lint-typecheck-test-build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# ⚠️ WARNING
# This file is auto-generated by https://github.com/WesSouza/wes-cli

name: Lint, Type Check, Test, Build

on:
pull_request:
push:
branches:
- "main"

jobs:
check:
Expand All @@ -13,29 +13,29 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['16.x', '18.x']
node: ['18.x', '20.x']
os: [ubuntu-latest, macOS-latest]


steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Install wes-cli
run: |
npm i -g [email protected]
wes install
uses: actions/checkout@v4

- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Lint
run: yarn lint
- name: Install
run: yarn install --frozen-lockfile

- name: Check Types
- name: Check types
run: yarn check:types

- name: Lint
run: yarn lint

- name: Test
run: yarn test:ci

Expand Down
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Node & Yarn
node_modules
*.log*

/dist
/coverage

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Example
/example/yarn.lock
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
2 changes: 0 additions & 2 deletions .wes-defaults/local/gitignore

This file was deleted.

22 changes: 0 additions & 22 deletions .wes-defaults/local/package.json

This file was deleted.

5 changes: 0 additions & 5 deletions .wes-defaults/local/tsconfig.json

This file was deleted.

8 changes: 0 additions & 8 deletions .wes-defaults/local/yarn.lock

This file was deleted.

10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ yarn add immer-state
```

```js
import { StateManager, useSelector } from 'https://cdn.pika.dev/immer-state@^0.3.0';
import { StateManager, useSelector } from 'https://cdn.skypack.dev/immer-state@%5E0.8.0';
```

## Example
Expand All @@ -29,14 +29,6 @@ yarn run start

Then open [localhost:1234](http://localhost:1234/).

## Development

This library uses `wes-cli`, which simplifies configuration setup. Instead of
using `yarn install`, you should use `npx wes-cli install`, which will create
all configuration files and run `yarn install`.

[Read more about `wes-cli`.](https://github.com/WesSouza/wes-cli/#wes-install)

## LICENSE

MIT, https://wes.dev/LICENSE.txt
79 changes: 79 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "immer-state",
"version": "0.8.0",
"author": "Wes Souza",
"license": "MIT",
"files": [
"dist"
],
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"engines": {
"node": ">=14"
},
"dependencies": {},
"scripts": {
"lint": "eslint .",
"build": "rollup -c",
"prepare": "yarn run build",
"check:types": "tsc --noEmit",
"coverage": "vitest run --coverage",
"test": "vitest run",
"test:ui": "vitest --ui",
"test:watch": "vitest"
},
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.5",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.1.2",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.5.1",
"@types/node": "^18.19.3",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vitejs/plugin-react": "^3.1.0",
"@vitest/coverage-c8": "^0.28.5",
"@vitest/ui": "^0.28.5",
"esbuild": "^0.17.19",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"immer": "^9.0.21",
"import-sort-style-wes": "^3.0.2",
"jsdom": "^21.1.2",
"prettier": "2.8.4",
"prettier-plugin-import-sort": "^0.0.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^3.29.4",
"rollup-plugin-esbuild": "^5.0.0",
"rollup-plugin-replace": "^2.2.0",
"ts-node-dev": "^2.0.0",
"typescript": "^4.9.5",
"vite": "^4.5.1",
"vitest": "^0.28.5"
},
"peerDependencies": {
"fast-deep-equal": ">=3",
"immer": ">=6",
"react": ">=16"
},
"importSort": {
".js, .jsx": {
"parser": "babylon",
"style": "wes"
},
".ts, .tsx": {
"parser": "typescript",
"style": "wes"
}
}
}
34 changes: 34 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import typescript from '@rollup/plugin-typescript';
import esbuild from 'rollup-plugin-esbuild';

export default [
{
input: './src/index.ts',
output: [
{
dir: './dist',
format: 'cjs',
entryFileNames: '[name].cjs',
exports: 'auto',
preserveModules: true,
sourcemap: true,
},
{
dir: './dist',
exports: 'auto',
format: 'es',
preserveModules: true,
sourcemap: true,
},
],
external: (id) => !/^[./]/.test(id),
plugins: [
esbuild(),
typescript({
tsconfig: './tsconfig.build.json',
declaration: true,
declarationDir: 'dist',
}),
],
},
];
10 changes: 10 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./src"
},
"include": [
"src/**/*.ts"
]
}
33 changes: 33 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"compilerOptions": {
"allowJs": true,
"alwaysStrict": true,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"jsx": "react-jsx",
"lib": ["ESNext", "dom"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "dist",
"resolveJsonModule": true,
"rootDir": ".",
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "ES2017"
},
"exclude": ["dist", "node_modules", "example"],
"include": ["**/*.ts", "**/*.tsx"]
}
20 changes: 20 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/// <reference types="vitest" />
/// <reference types="vite/client" />

import { default as react } from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore Somehow TypeScript is saying react is not callable
react(),
],
test: {
css: true,
environment: 'jsdom',
globals: true,
setupFiles: './vitest.setup.ts',
},
});
8 changes: 8 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import '@testing-library/jest-dom';

import { cleanup } from '@testing-library/react';
import { afterEach } from 'vitest';

afterEach(() => {
cleanup();
});
18 changes: 0 additions & 18 deletions wes-config.json

This file was deleted.

Loading

0 comments on commit c7cfc90

Please sign in to comment.