Skip to content

Commit 3fea92b

Browse files
authored
Convert to monorepo with Yarn 4 (#118)
* Initial conversion to monorepo * Update Yarn to version 4.5.3 * Add basic CI * Fix build scripts for React Native and Expo templates * Add `mockTemplates.mts` script file * Make `mockTemplates.mts` executable * Fix `NPM` peer dependency issue * Disable Lint during CI * Fix `build` command to comply with `vite`'s new template * Switch to `@react-native-community/cli` * Resolve peer dependency issues * Update Yarn to version 4.6.0 * Remove `echo` calls in CI * Update dependencies across templates to latest versions * Fix React-Native template * Update JDK version for React Native build in CI workflow * Rename `babel.config.cts` to `babel.config.js` * Fix `babel.config.js` * Fix Expo template * Add `@react-native-community/cli` * Update tests workflow to use `-y` flag with `npx tsx` * Add missing fields to all `package.json` files * Update CI workflow to allow manual dispatch and add failure check * Remove unnecessary `yarn rimraf` command * Update `.gitignore` for Expo template * Update metro config for Expo template * Add `eslint-plugin-jest` to resolve ESLint-related issues * Format files in Expo template * Rename `metro.config.ts` to `metro.base.config.ts` * Bump `@types/node` * Format all files * Rename `.eslintrc.json` to `eslint.config.js` * Migrate ESLint config of Vite template to flat config * Fix Vite template * Fix dependencies * Fix prettier configs and format all files * Fix Expo template * Rename `TypedColors.ts` to `Colors.ts` * Fix CI * Update dependencies * Update all templates * Fix `mockTemplates.mts` script * Fix `cra-template-redux` * Fix `cra-template-redux-typescript` * Fix `react-native-template-redux-typescript` * Fix `rtk-app-structure-example` * Fix `vite-template-redux` * Fix Expo template * Update dependencies * Update Yarn to version 4.7.0 * Migrate Expo template to flat config * Migrate React-Native template to flat config * Fix minor issues in ESLint configs * Migrate root level ESLint config to flat config * Update `.gitignore` files * Update ESLint config * Update dependencies * Enable verbose logging in Jest configuration for better test output * Utilize the `useAnimatedValue` hook * Update dependencies * Upgrade Yarn to version 4.8.1
1 parent 03d9a62 commit 3fea92b

File tree

177 files changed

+24870
-48820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+24870
-48820
lines changed

.eslintrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
# Use LF line endings for template files
2-
**/template/** text=auto eol=lf
1+
* text=auto eol=lf

.github/workflows/tests.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
defaults:
6+
run:
7+
shell: bash
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
name: Test and lint ${{ matrix.packages }} on Node.js ${{ matrix.node }} and ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
node: [22.x]
17+
os: [ubuntu-latest, windows-latest]
18+
packages:
19+
[
20+
"cra-template-redux",
21+
"cra-template-redux-typescript",
22+
"expo-template-redux-typescript",
23+
"react-native-template-redux-typescript",
24+
"vite-template-redux",
25+
]
26+
27+
steps:
28+
- name: Checkout repository for ${{ matrix.packages }} on ${{ matrix.node }} and ${{ matrix.os }}
29+
if: ${{ github.event_name == 'pull_request' }}
30+
uses: actions/checkout@v4
31+
with:
32+
ref: ${{ github.event.pull_request.head.ref }}
33+
repository: ${{ github.event.pull_request.head.repo.full_name }}
34+
35+
- name: Checkout repository for ${{ matrix.packages }} on ${{ matrix.node }} and ${{ matrix.os }}
36+
if: ${{ github.event_name != 'pull_request' }}
37+
uses: actions/checkout@v4
38+
39+
- name: Setup Node.js ${{ matrix.node }} for ${{ matrix.packages }} on ${{ matrix.os }}
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: ${{ matrix.node }}
43+
check-latest: true
44+
45+
- name: Set up environment variables for ${{ matrix.packages }} on ${{ matrix.node }} and ${{ matrix.os }}
46+
if: ${{ matrix.os == 'windows-latest' }}
47+
run: echo "TEMP=$USERPROFILE\AppData\Local\Temp" >> $GITHUB_ENV
48+
49+
- name: Set up JDK for React Native build for ${{ matrix.packages }} on ${{ matrix.node }} and ${{ matrix.os }}
50+
if: matrix.packages == 'react-native-template-redux-typescript' || matrix.packages == 'expo-template-redux-typescript'
51+
uses: actions/setup-java@v4
52+
with:
53+
java-version: "21.x"
54+
distribution: "temurin"
55+
cache: "gradle"
56+
57+
- name: Mock the templates for ${{ matrix.packages }} on ${{ matrix.node }} and ${{ matrix.os }}
58+
run: npx -y tsx@latest scripts/mockTemplates.mts ${{ matrix.packages }}
59+
60+
- name: Did we fail?
61+
if: failure()
62+
working-directory: packages/${{ matrix.packages }}
63+
run: ls -R

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,37 @@
1+
.DS_Store
2+
*.log
13
node_modules
4+
dist*/
5+
lib
6+
es
7+
8+
.yalc/
9+
yalc.lock
10+
11+
.idea/
12+
.vscode/
13+
temp/
14+
.tmp-projections
15+
build/
16+
.rts2*
17+
coverage/
18+
19+
typesversions
20+
.cache
21+
.yarnrc
22+
.yarn/*
23+
!.yarn/patches
24+
!.yarn/releases
25+
!.yarn/plugins
26+
!.yarn/sdks
27+
!.yarn/versions
28+
.pnp.*
29+
*.tgz
30+
31+
tsconfig.vitest-temp.json
32+
33+
# Ignore template lock files
34+
/packages/**/package-lock.json
35+
/packages/**/yarn.lock
36+
37+
.eslintcache

.prettierrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.yarn/releases/yarn-4.8.1.cjs

Lines changed: 935 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
compressionLevel: mixed
2+
3+
enableGlobalCache: false
4+
5+
enableTransparentWorkspaces: false
6+
7+
nodeLinker: node-modules
8+
9+
yarnPath: .yarn/releases/yarn-4.8.1.cjs

babel.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

eslint.config.mts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import js from "@eslint/js"
2+
import prettierConfig from "eslint-config-prettier/flat"
3+
import type { ConfigArray } from "typescript-eslint"
4+
import { config, configs } from "typescript-eslint"
5+
6+
const eslintConfig: ConfigArray = config(
7+
{
8+
name: "global-ignores",
9+
ignores: [
10+
"**/*.snap",
11+
"**/dist/",
12+
"**/.yalc/",
13+
"**/build/",
14+
"**/temp/",
15+
"**/.temp/",
16+
"**/.tmp/",
17+
"**/.yarn/",
18+
"**/coverage/",
19+
"packages/rtk-app-structure-example",
20+
"packages/vite-template-redux",
21+
"packages/react-native-template-redux-typescript/template",
22+
"packages/expo-template-redux-typescript",
23+
"packages/cra-template-redux/template",
24+
"packages/cra-template-redux-typescript/template",
25+
],
26+
},
27+
{
28+
name: `${js.meta.name}/recommended`,
29+
...js.configs.recommended,
30+
},
31+
configs.strictTypeChecked,
32+
configs.stylisticTypeChecked,
33+
{
34+
name: "main",
35+
linterOptions: {
36+
reportUnusedDisableDirectives: 2,
37+
},
38+
languageOptions: {
39+
parserOptions: {
40+
projectService: true,
41+
tsconfigRootDir: import.meta.dirname,
42+
},
43+
},
44+
rules: {
45+
"no-undef": [0],
46+
"@typescript-eslint/consistent-type-definitions": [2, "type"],
47+
"@typescript-eslint/consistent-type-imports": [
48+
2,
49+
{
50+
prefer: "type-imports",
51+
fixStyle: "separate-type-imports",
52+
disallowTypeAnnotations: true,
53+
},
54+
],
55+
},
56+
},
57+
58+
prettierConfig,
59+
)
60+
61+
export default eslintConfig

jest.config.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)