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

Version 0.6.0 #6

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"buildCommand": "compile",
"sandboxes": ["new", "react-typescript-react-ts"],
"node": "14"
"node": "18"
}
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-relay'] }],
'@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.

41 changes: 12 additions & 29 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,19 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache dependencies
uses: actions/cache@v1
version: 8.2.0
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn install

- name: Test
run: yarn test

- name: Compile
run: yarn run compile

- name: Publish
run: npm publish
node-version: 18
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- run: npm test
- run: npm run compile
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
31 changes: 9 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,14 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
node-version: '14.x'

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache dependencies
uses: actions/cache@v1
version: 8.2.0
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn install

- name: Test
run: yarn test
node-version: 18
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- run: npm test
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
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Change Log

## [Unreleased]

## [0.6.0] - 2023-06-06

### Added

- feat: update dependencies to latest versions
- feat: add ChatGPT-generated JSDoc documentation

## [0.5.0] - 2023-03-04

### Added
- feat: mark internal atoms as private

- feat: mark internal atoms as private

## [0.4.0] - 2023-01-31

### Added

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

This file was deleted.

20 changes: 12 additions & 8 deletions examples/01_minimal/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
{
"name": "jotai-relay-example",
"version": "0.1.0",
"type": "commonjs",
"private": true,
"dependencies": {
"babel-plugin-relay": "latest",
"jotai": "latest",
"jotai-relay": "latest",
"relay-runtime": "latest",
"react": "latest",
"react-dom": "latest",
"react-scripts": "latest"
"react-dom": "latest"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"devDependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
"@types/relay-runtime": "latest",
"typescript": "latest",
"vite": "latest"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
],
"scripts": {
"dev": "vite"
}
}
3 changes: 3 additions & 0 deletions examples/01_minimal/relay.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// eslint-disable-next-line no-undef
module.exports = {
language: 'typescript',
// eslint-disable-next-line no-undef
src: `${__dirname}/src`,
// eslint-disable-next-line no-undef
schema: `${__dirname}/data/schema.graphql`,
exclude: ['**/node_modules/**', '**/__mocks__/**', '**/__generated__/**'],
};
24 changes: 12 additions & 12 deletions examples/01_minimal/src/__generated__/AppCountriesQuery.graphql.ts

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

22 changes: 15 additions & 7 deletions examples/01_minimal/src/App.js → examples/01_minimal/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import React, { Suspense } from 'react';
import { Suspense } from 'react';
import { Provider, useAtom } from 'jotai/react';
import { createStore } from 'jotai/vanilla';
import { environmentAtom, atomWithQuery } from 'jotai-relay';
import { Environment, Network, RecordSource, Store } from 'relay-runtime';
import graphql from 'babel-plugin-relay/macro';
import {
Environment,
Network,
RecordSource,
Store,
graphql,
} from 'relay-runtime';

import type { appCountriesQuery } from './__generated__/AppCountriesQuery.graphql';

const myEnvironment = new Environment({
network: Network.create(async (params, variables) => {
Expand All @@ -22,9 +29,9 @@ const myEnvironment = new Environment({
store: new Store(new RecordSource()),
});

const countriesAtom = atomWithQuery(
const countriesAtom = atomWithQuery<appCountriesQuery>(
graphql`
query AppCountriesQuery {
query appCountriesQuery {
countries {
name
}
Expand All @@ -35,10 +42,11 @@ const countriesAtom = atomWithQuery(

const Main = () => {
const [data] = useAtom(countriesAtom);

return (
<ul>
{data.countries.map(({ name }) => (
<li key={name}>{name}</li>
{data.countries.map((country: { name: string }) => (
<li key={country.name}>{country.name}</li>
))}
</ul>
);
Expand Down
Loading
Loading