[go: nahoru, domu]

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

Move build from TSDX to Vite #534

Merged
merged 8 commits into from
Aug 10, 2022
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
36 changes: 36 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint",
"no-only-tests"
],
"rules": {
"no-only-tests/no-only-tests": "error",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-inferrable-types": "warn",
"@typescript-eslint/ban-types": "warn",
"no-prototype-builtins": "warn",
"prefer-const": "warn",
"react/no-unescaped-entities": "warn",
"@typescript-eslint/no-empty-function": "warn"
}
}
18 changes: 9 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ set up.
1. [Clone](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository)
this repository (or a
[fork](https://help.github.com/en/github/getting-started-with-github/fork-a-repo#propose-changes-to-someone-elses-project))
1. At the project root, install all modules by running `yarn install`.
1. Start a dev build of reactfire by running `yarn start`. ReactFire will recompile on every file change.
1. At the project root, install all modules by running `npm install`.
1. Start a dev build of reactfire by running `npm run start`. ReactFire will recompile on every file change.

### Testing

1. run `yarn test` from the repository root. Make sure you've rebuilt your changes (usually by keeping `yarn start` running in a separate tab).
1. run `npm run test` from the repository root. Make sure you've rebuilt your changes (usually by keeping `npm run start` running in a separate tab).

### Before submitting a PR

1. run `yarn build` to confirm that the source builds
2. run `yarn test` to confirm that tests pass
3. run `yarn lint` to confirm that code meets our style guide
> If the lint check fails, run `yarn lint --fix` to automatically fix any issues.
5. run `yarn docs` to rebuild the reference docs
> If you've forked the repo, run `yarn docs:fork` instead. This will ensure the reference docs link to the firebaseextended/reactfire repository.
1. run `npm run build` to confirm that the source builds
2. run `npm run test` to confirm that tests pass
3. run `npm run lint` to confirm that code meets our style guide
> If the lint check fails, run `npm run lint --fix` to automatically fix any issues.
5. run `npm run docs` to rebuild the reference docs
> If you've forked the repo, run `npm run docs:fork` instead. This will ensure the reference docs link to the firebaseextended/reactfire repository.
26 changes: 4 additions & 22 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v3
with:
node-version: '14'
- name: node_modules cache
id: node_modules_cache
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ runner.os }}-14-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-14-node_modules-
- name: Yarn offline cache
if: steps.node_modules_cache.outputs.cache-hit != 'true'
uses: actions/cache@v2
with:
path: ~/.npm-packages-offline-cache
key: yarn-offline-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-offline
cache: 'npm'
- name: Install deps
if: steps.node_modules_cache.outputs.cache-hit != 'true'
run: |
yarn config set yarn-offline-mirror ~/.npm-packages-offline-cache
yarn config set yarn-offline-mirror-pruning true
yarn install --frozen-lockfile --prefer-offline
run: npm ci
- name: Generate reference docs
run: yarn docs
run: npm run docs
- name: Check for diff
run: git diff --exit-code -- 'docs/reference***.md'

55 changes: 10 additions & 45 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v3
with:
node-version: '14'
- name: node_modules cache
id: node_modules_cache
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ runner.os }}-14-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-14-node_modules-
- name: Yarn offline cache
if: steps.node_modules_cache.outputs.cache-hit != 'true'
uses: actions/cache@v2
with:
path: ~/.npm-packages-offline-cache
key: yarn-offline-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-offline
cache: 'npm'
- name: Install deps
if: steps.node_modules_cache.outputs.cache-hit != 'true'
run: |
yarn config set yarn-offline-mirror ~/.npm-packages-offline-cache
yarn config set yarn-offline-mirror-pruning true
yarn install --frozen-lockfile --prefer-offline
run: npm ci
- name: Build
id: yarn-pack-dir
id: pack-dir
run: ./build.sh
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
Expand All @@ -62,37 +44,20 @@ jobs:
needs: build
strategy:
matrix:
node: ["12", "14"]
node: ["14", "16"]
fail-fast: false
name: Test Node.js ${{ matrix.node }} (Ubuntu)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
check-latest: true
- name: node_modules cache
id: node_modules_cache
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ runner.os }}-${{ matrix.node }}-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node }}-node_modules-
- name: Yarn offline cache
if: steps.node_modules_cache.outputs.cache-hit != 'true'
uses: actions/cache@v2
with:
path: ~/.npm-packages-offline-cache
key: yarn-offline-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-offline
cache: 'npm'
- name: Install deps
if: steps.node_modules_cache.outputs.cache-hit != 'true'
run: |
yarn config set yarn-offline-mirror ~/.npm-packages-offline-cache
yarn install --frozen-lockfile --prefer-offline
run: npm ci
- name: Install deps for functions
run: npm install
working-directory: ./functions
Expand All @@ -108,15 +73,15 @@ jobs:
chmod +x reactfire-${{ github.run_id }}/unpack.sh
./reactfire-${{ github.run_id }}/unpack.sh
- name: Run tests
run: yarn test
run: npm run test
publish:
runs-on: ubuntu-latest
name: Publish (NPM)
needs: test
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
steps:
- name: Setup node
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v3
with:
node-version: '14'
registry-url: 'https://registry.npmjs.org'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ unpack.sh

example/.parcel-cache/
.firebaserc
stats.html
20 changes: 0 additions & 20 deletions babel.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ else
fi;

npm --no-git-tag-version --allow-same-version -f version $OVERRIDE_VERSION
yarn build
npm run build
TARBALL=$(npm pack . | tail -n 1)
mv $TARBALL reactfire.tgz

Expand Down
4 changes: 2 additions & 2 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ npm install --save firebase reactfire
1. Run your app.

```bash
yarn start
npm run start

# or

npm run start
yarn start
```

1. Edit the value of `yummy` in the _Database_ tab in the [Firebase console](https://console.firebase.google.com) and watch it update in real time in your app! 🔥🔥🔥
Expand Down
Loading