Skip to content

Commit 6e66ce5

Browse files
committed
initial branch code commit
1 parent 5abf72b commit 6e66ce5

28 files changed

+4197
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Common Setup for CI
2+
3+
description: Reusable common setup for project's CI jobs
4+
5+
inputs:
6+
node-version:
7+
description: Specific Node.js version to override the common one that's gonna be selected by default
8+
required: false
9+
default: v22.5.0
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: ${{ inputs.node-version }}
17+
18+
- name: Get Node.js version
19+
id: node_version
20+
run: |
21+
echo "::set-output name=version::$(node -v)"
22+
shell: bash
23+
24+
- name: Install pnpm
25+
run: npm install -g pnpm@^9
26+
shell: bash
27+
28+
- name: Restore possibly cached dependencies
29+
id: cache-node-modules
30+
uses: actions/cache@v3
31+
with:
32+
path: ./node_modules
33+
key: node-modules-${{ runner.os }}-${{ steps.node_version.outputs.version }}-${{ hashFiles('./pnpm-lock.yaml') }}
34+
35+
- name: Install dependencies if weren't cached
36+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
37+
run: pnpm install --frozen-lockfile
38+
shell: bash

.github/workflows/ci-build-check.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI - build check
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
ts_build_test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- uses: ./.github/actions/ci-common-setup
16+
17+
- name: TypeScript test build
18+
run: pnpm run build-check
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI - ESLint check
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
lint_check:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- uses: ./.github/actions/ci-common-setup
16+
17+
- name: Lint check
18+
run: pnpm exec eslint --cache
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI - Prettier check
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
prettier_check:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- uses: ./.github/actions/ci-common-setup
16+
17+
- name: Prettier check
18+
run: pnpm exec prettier --check "./{src,spec}/**/*.{ts,tsx,js,mjs,jsx}"

.github/workflows/ci-tests.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI - tests
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
run_tests:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- uses: ./.github/actions/ci-common-setup
16+
17+
- name: Run tests
18+
run: pnpm run test
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release new version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry_run:
7+
type: boolean
8+
default: false
9+
description: Perform as a dry run
10+
11+
jobs:
12+
release_new_version:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.SEMANTIC_RELEASE_ACTION_PAT }} # Without providing any token here as well as if passing the built-in `secrets.GITHUB_TOKEN` - the semantic release action would end up unauthorized to push changes to master since it is set with branch protection, more reference for this issue on: https://github.com/semantic-release/semantic-release/issues/2636#issuecomment-1574476011
20+
21+
- uses: ./.github/actions/ci-common-setup
22+
with:
23+
node-version: v18
24+
25+
# The following action version, value of `semantic_version` and the versions of all the plugins specifically set here are a work around found for now to deal with the constant crush described here: https://github.com/cycjimmy/semantic-release-action/issues/159 (was hard to just go with the Node v14 suggestion said there since we use pnpm which outright doesn't support Node v14)
26+
- name: Semantic Release
27+
id: semantic_release
28+
uses: cycjimmy/semantic-release-action@v3.4.2
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
with:
33+
semantic_version: 19.0.5
34+
dry_run: ${{ inputs.dry_run }}
35+
extra_plugins: |
36+
@semantic-release/commit-analyzer@9.0.2
37+
@semantic-release/release-notes-generator@10.0.3
38+
@semantic-release/changelog@6.0.2
39+
@semantic-release/github@8.0.7
40+
@semantic-release/npm@9.0.2
41+
@semantic-release/git@10.0.1
42+
conventional-changelog-conventionalcommits@^7.0.2

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
.env
27+
_node_compile_cache

.prettierrc.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
trailingComma: es5
2+
singleQuote: true
3+
printWidth: 100
4+
semi: true
5+
arrowParens: avoid

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Dor Shtaif
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

eslint.config.mjs

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// @ts-check
2+
3+
import globals from 'globals';
4+
import eslintJs from '@eslint/js';
5+
import eslintTs from 'typescript-eslint';
6+
import eslintConfigPrettier from 'eslint-config-prettier';
7+
8+
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.Config} */
9+
const eslintConfigPrettierTypeForced = (() => {
10+
/** @type {any} */
11+
const eslintConfigPrettierAsAny = eslintConfigPrettier;
12+
return eslintConfigPrettierAsAny;
13+
})();
14+
15+
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
16+
export default [
17+
eslintJs.configs.recommended,
18+
...eslintTs.configs.recommended,
19+
eslintConfigPrettierTypeForced,
20+
{
21+
files: ['**/*.{ts,ts,tsx,js,mjs,jsx}'],
22+
plugins: {},
23+
languageOptions: {
24+
globals: { ...globals.browser },
25+
parser: eslintTs.parser,
26+
ecmaVersion: 5,
27+
sourceType: 'script',
28+
},
29+
/** @type {Partial<import("eslint/rules").ESLintRules>} */
30+
rules: {
31+
['no-shadow']: 'off',
32+
['comma-dangle']: 'off',
33+
['radix']: 'off',
34+
['no-use-before-define']: 'off',
35+
['no-constant-condition']: 'off',
36+
['no-unused-vars']: 'off',
37+
['no-unused-expressions']: 'off',
38+
['no-await-in-loop']: 'off',
39+
['no-empty']: 'off',
40+
['no-continue']: 'off',
41+
['require-yield']: 'off',
42+
['@typescript-eslint/require-yield']: 'off',
43+
['@typescript-eslint/no-explicit-any']: 'off',
44+
['@typescript-eslint/no-non-null-assertion']: 'off',
45+
['@typescript-eslint/no-empty-function']: 'off',
46+
['@typescript-eslint/no-unused-expressions']: 'warn',
47+
['@typescript-eslint/no-unused-vars']: [
48+
'warn',
49+
{
50+
varsIgnorePattern: '^_',
51+
argsIgnorePattern: '^_',
52+
caughtErrorsIgnorePattern: '^_',
53+
destructuredArrayIgnorePattern: '^_',
54+
},
55+
],
56+
},
57+
},
58+
];

package.json

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "react-async-iterators",
3+
"version": "0.0.1",
4+
"author": "Dor Shtaif <dorshtaif@gmail.com>",
5+
"description": "The magic of JavaScript async iterators in React ⛓️ 🧬 🔃",
6+
"type": "module",
7+
"homepage": "https://github.com/shtaif/react-async-iterators",
8+
"bugs": "https://github.com/shtaif/react-async-iterators/issues",
9+
"repository": "github:shtaif/react-async-iterators",
10+
"sideEffects": false,
11+
"keywords": [],
12+
"main": "./dist/cjs/index.js",
13+
"module": "./dist/esm/index.js",
14+
"types": "./dist/esm/index.d.ts",
15+
"exports": {
16+
".": {
17+
"import": "./dist/esm/index.js",
18+
"require": "./dist/cjs/index.js",
19+
"default": "./dist/esm/index.js"
20+
}
21+
},
22+
"files": [
23+
"dist"
24+
],
25+
"scripts": {
26+
"test": "vitest --run --config ./spec/vitest.config.ts",
27+
"test:dev": "vitest --watch --config ./spec/vitest.config.ts",
28+
"build": "rm -rf ./dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node ./scripts/set-module-type-in-dist-builds.mjs",
29+
"build-check": "tsc --noEmit -p ./tsconfig.json",
30+
"prepublishOnly": "npm run build"
31+
},
32+
"peerDependencies": {
33+
"react": ">=17"
34+
},
35+
"devDependencies": {
36+
"@eslint/js": "^9.17.0",
37+
"@testing-library/jest-dom": "^6.6.3",
38+
"@testing-library/react": "^16.1.0",
39+
"@types/node": "^22.10.2",
40+
"@types/react": "^18.2.47",
41+
"@types/react-dom": "^18.0.11",
42+
"@vitejs/plugin-react-swc": "^3.6.0",
43+
"@vitest/ui": "^2.1.8",
44+
"eslint": "^9.16.0",
45+
"eslint-config-prettier": "^9.1.0",
46+
"globals": "^15.13.0",
47+
"jsdom": "^25.0.1",
48+
"prettier": "^3.4.2",
49+
"typescript": "^5.7.2",
50+
"typescript-eslint": "^8.18.0",
51+
"vitest": "~2.1.8"
52+
}
53+
}

0 commit comments

Comments
 (0)