Skip to content

Commit

Permalink
No nx (#433)
Browse files Browse the repository at this point in the history
* Migrate tests

* Migrate typetests

* Migrate tests of tools

* Migrate prettier

* Migrate changeset check

* Get rid of useless linter

* MIgrate atomic-router and core build

* MIgrate dev-tools build

* MIgrate io-ts build

* Simplify tsconfigs

* MIgrate solid and runtypes build

* Fix typo

* Migrate all builds

* Remove extra deps

* Migrate website

* Migrate sizelimit

* Clean up global scripts

* Fix website build action

* Finalize website building process

* Fix website build

* pnpm

* No extra deps

* No useless files

* Fix pkg linters

* Fix all types/exports issues

* Embed publint to CI

* Embed attw to CI

* Fix changelogs

* Fix canary errors

* Fix typo

* Fix typos

* Fix apps structure as private

* Delete extra CHANGELOG

* Use native pnpm publish for publish canary

* Fix typo

* Change names

* Remove extra log

* Fix version setting for canary

* apply patch to changeset to acuire more control

* Hash

* Fixes

* Fix deps problems

* Make canary releases real

* optimize minor

* Use real publish for release

* Delete unused files

* Migrate showcases

* Update internal docs

* Finalize

* Update build tool-chain

* Exclude showcases from versioning
  • Loading branch information
igorkamyshev committed Jan 27, 2024
1 parent 7f28946 commit 896e27d
Show file tree
Hide file tree
Showing 202 changed files with 4,099 additions and 10,260 deletions.
6 changes: 5 additions & 1 deletion .changeset/config.json
Expand Up @@ -4,7 +4,11 @@
"commit": "../tools/utils/commit_message.js",
"fixed": [["@farfetched/*"]],
"linked": [],
"ignore": ["website", "showcase-*"],
"access": "public",
"baseBranch": "origin/master",
"updateInternalDependencies": "patch"
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
@@ -1,11 +1,12 @@
---
'@farfetched/typed-contracts': patch
'@farfetched/atomic-router': patch
'@farfetched/core': patch
'@farfetched/io-ts': patch
'@farfetched/superstruct': patch
'@farfetched/dev-tools': patch
'@farfetched/runtypes': patch
'@farfetched/io-ts': patch
'@farfetched/solid': patch
'@farfetched/superstruct': patch
'@farfetched/typed-contracts': patch
'@farfetched/core': patch
'@farfetched/zod': patch
---

Expand Down
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

43 changes: 0 additions & 43 deletions .eslintrc.json

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/canary.yml
Expand Up @@ -38,9 +38,12 @@ jobs:
- name: Check if new canary release is required
id: canary_required
run: node ./tools/scripts/canary/canary_required.mjs """${{ steps.find_comment.outputs.comment-body }}""" >> $GITHUB_OUTPUT && cat $GITHUB_OUTPUT
- name: Prepare package names
if: steps.canary_required.outputs.skipCanary == ''
run: node ./tools/scripts/canary/canary_name_change.mjs
- name: Publish canary release
if: steps.canary_required.outputs.skipCanary == ''
run: pnpm nx run-many --output-style=static --target=publish --all --configuration=canary
run: pnpm -r publish --no-git-checks
- name: Retrieve information about latest canary release
id: canary_info
run: node ./tools/scripts/canary/canary_info.mjs >> $GITHUB_OUTPUT && cat $GITHUB_OUTPUT
Expand Down
86 changes: 8 additions & 78 deletions .github/workflows/ci.yml
Expand Up @@ -14,95 +14,25 @@ jobs:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm lint:format
- run: pnpm test
- run: pnpm test:types
- run: pnpm lint
- run: pnpm run format:check
- run: pnpm run -r test:run
- run: pnpm run -r typetest:run
pkg:
runs-on: ubuntu-latest

steps:
- name: Find comment about previous analysis (ATTW)
uses: peter-evans/find-comment@v1
id: find_attw_comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: ATTW
- name: Find comment about previous analysis (Publint)
uses: peter-evans/find-comment@v1
id: find_publint_comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: publint
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm size
- name: Validate typings of all packages
id: typelint
run: echo "result<<EOF"$'\n'"$(pnpm node ./tools/scripts/typelint.mjs)"$'\n'EOF >> $GITHUB_OUTPUT
- name: Validate exports of all packages
id: publint
run: echo "result<<EOF"$'\n'"$(pnpm node ./tools/scripts/publint.mjs)"$'\n'EOF >> $GITHUB_OUTPUT
# In case of absence of the comment we will create it with information about latest analysis
- name: Create comment (ATTW)
if: steps.find_attw_comment.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
# ATTW
<details>
<summary>Analysis</summary>
${{ steps.typelint.outputs.result }}
</details>
- name: Create comment (publint)
if: steps.find_publint_comment.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
# publint
<details>
<summary>Analysis</summary>
${{ steps.publint.outputs.result }}
</details>
# Otherwise we will update it with information about latest analysis
- name: Update comment (ATTW)
if: steps.find_attw_comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
with:
edit-mode: replace
comment-id: ${{ steps.find_attw_comment.outputs.comment-id }}
body: |
# ATTW
<details>
<summary>Analysis</summary>
${{ steps.typelint.outputs.result }}
</details>
- name: Update comment (publint)
if: steps.find_publint_comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
with:
edit-mode: replace
comment-id: ${{ steps.find_publint_comment.outputs.comment-id }}
body: |
# publint
- run: pnpm run -r build
- run: pnpm run -r size
- run: pnpm run -r publint
- run: pnpm run -r typelint

<details>
<summary>Analysis</summary>
${{ steps.publint.outputs.result }}
</details>
changes:
runs-on: ubuntu-latest

Expand All @@ -116,4 +46,4 @@ jobs:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm lint:changes
- run: pnpm changeset status
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Expand Up @@ -19,4 +19,4 @@ jobs:
- run: |
echo "//registry.npmjs.org/:_authToken="${{secrets.NPM_TOKEN}}"" > ~/.npmrc
shell: sh
- run: pnpm nx run-many --output-style=static --target=publish --all
- run: pnpm -r publish --no-git-checks
4 changes: 2 additions & 2 deletions .github/workflows/website.yml
Expand Up @@ -20,13 +20,13 @@ jobs:
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- run: pnpm nx build website
- run: pnpm run -r build

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 1d6db711ad880b2455da08a6aeb2a119
projectName: farfetched
directory: dist/apps/website
directory: apps/website/docs/.vitepress/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -37,4 +37,6 @@ testem.log
# System Files
.DS_Store
Thumbs.db
.nx

**/dist
**/.vitepress/cache/*
1 change: 0 additions & 1 deletion .prettierignore
Expand Up @@ -3,5 +3,4 @@
/dist
/coverage
pnpm-lock.yaml
/.nx/cache
apps/website/docs/.vitepress/cache/
1 change: 0 additions & 1 deletion .vscode/extensions.json
@@ -1,6 +1,5 @@
{
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
Expand Down
27 changes: 11 additions & 16 deletions README.md
Expand Up @@ -17,6 +17,10 @@ The advanced data fetching tool for web applications

Continue reading about Farfetched in the [documentation](https://farfetched.pages.dev). It covers integration with the most popular UI-frameworks (such React and Solid), error handling, dependent queries, advanced contracts and other great tools.

### Showcases

Repository contains [several showcases](./apps/) of Farfetched usage. To start playing with them, clone repository and run `pnpm install && pnpm run --filter NAME dev` in the root directory, where `NAME` is the name of the showcase.

## Maintains

### Getting started
Expand All @@ -25,12 +29,11 @@ Continue reading about Farfetched in the [documentation](https://farfetched.page
- install deps via `pnpm install`
- make changes
- make sure that your changes is passing checks:
- run tests via `pnpm test`
- run type tests via `pnpm test:types`
- run linter via `pnpm lint`
- try to build it via `pnpm build`
- format code via `pnpm format`
- fill in changes via `pnpm changes`
- run tests via `pnpm run -r test:run`
- run type tests via `pnpm run -r typetest:run`
- try to build it via `pnpm run -r build`
- format code via `pnpm run format:check`
- fill in changes via `pnpm changeset`
- open a PR
- enjoy 🎉

Expand All @@ -44,17 +47,9 @@ After merging PR to master-branch, [Version-action](./.github/workflows/version.

#### New package creation

```sh
pnpm nx generate @nx/js:library --name=NAME --importPath @farfetched/NAME
```

#### Graph

Run this command to see a diagram of the dependencies of projects.
Copy-paste `packages/atomic-router` directory, rename it to the package name. Then, update `package.json`, `README.md` and `vite.config.ts` files. Then, delete `CHANGELOG.md` file and any other files that are not needed in the new package.

```sh
pnpm nx graph
```
Fancy generator will be added in the future.

## Credits

Expand Down
Expand Up @@ -5,4 +5,4 @@
- clone the repo
- ensure that `pnpm` is installed
- install dependencies via `pnpm install`
- start showcase via `pnpm nx serve showcase-forest-real-world-breaking-bad`
- start showcase via `pnpm run --filter showcase-forest-real-world-breaking-bad dev`
9 changes: 9 additions & 0 deletions apps/showcase-forest-real-world-breaking-bad/package.json
@@ -0,0 +1,9 @@
{
"name": "showcase-forest-real-world-breaking-bad",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite dev",
"build": "vite build"
}
}
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
Expand Down
6 changes: 6 additions & 0 deletions apps/showcase-forest-real-world-breaking-bad/vite.config.ts
@@ -0,0 +1,6 @@
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
plugins: [tsconfigPaths()],
});
Expand Up @@ -5,4 +5,4 @@
- clone the repo
- ensure that `pnpm` is installed
- install dependencies via `pnpm install`
- start showcase via `pnpm nx serve showcase-react-real-world-pokemons`
- start showcase via `pnpm run --filter showcase-react-real-world-pokemons dev`
9 changes: 9 additions & 0 deletions apps/showcase-react-real-world-pokemons/package.json
@@ -0,0 +1,9 @@
{
"name": "showcase-react-real-world-pokemons",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite dev",
"build": "vite build"
}
}
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
Expand Down
7 changes: 7 additions & 0 deletions apps/showcase-react-real-world-pokemons/vite.config.ts
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import reactPlugin from '@vitejs/plugin-react';

export default defineConfig({
plugins: [tsconfigPaths(), reactPlugin()],
});
Expand Up @@ -5,4 +5,4 @@
- clone the repo
- ensure that `pnpm` is installed
- install dependencies via `pnpm install`
- start showcase via `pnpm nx serve showcase-solid-real-world-rick-morty`
- start showcase via `pnpm run --filter showcase-solid-real-world-rick-morty dev`
9 changes: 9 additions & 0 deletions apps/showcase-solid-real-world-rick-morty/package.json
@@ -0,0 +1,9 @@
{
"name": "showcase-solid-real-world-rick-morty",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite dev",
"build": "vite build"
}
}
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "solid-js",
Expand Down
@@ -1,12 +1,11 @@
import { defineConfig } from 'vite';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import tsconfigPaths from 'vite-tsconfig-paths';
import solid from 'vite-plugin-solid';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
cacheDir: '../../../node_modules/.vite/showcase-solid-real-world-rick-morty',
plugins: [
nxViteTsPaths(),
tsconfigPaths(),
solid({
/*
* solid plugin supports only .tsx and .jsx files by default
Expand Down Expand Up @@ -40,5 +39,4 @@ export default defineConfig({
resolve: {
conditions: ['browser'],
},
build: { outDir: '../../../dist/apps/showcase/solid-real-world-rick-morty' },
});

0 comments on commit 896e27d

Please sign in to comment.