-
Notifications
You must be signed in to change notification settings - Fork 253
Unify cloud and mobile linter configs, add dependency check script on install #1987
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1 @@ | ||
| export NVM_DIR="$HOME/.nvm" | ||
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
|
|
||
| npx lint-staged | ||
| npx lint-staged --no-stash | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,7 @@ | ||
| module.exports = { | ||
| // Cloud files: use cloud's own eslint and prettier configs | ||
| "cloud/**/*.{js,jsx,ts,tsx}": (filenames) => { | ||
| return [`eslint --fix --config cloud/eslint.config.mjs ${filenames.join(" ")}`] | ||
| }, | ||
| "cloud/**/*.{js,jsx,ts,tsx,json,md}": (filenames) => { | ||
| return [`prettier --write --config cloud/packages/cloud/.prettierrc.js ${filenames.join(" ")}`] | ||
| }, | ||
|
|
||
| // Non-cloud, non-root files: use root eslint and prettier configs | ||
| "!(cloud)/**/*.{js,jsx,ts,tsx}": "eslint --fix --quiet", | ||
| "!(cloud)/**/*.{js,jsx,ts,tsx,json,css,md,html,yml,yaml}": "prettier --write", | ||
|
|
||
| // Root-level config files: prettier only (root eslint needs expo which may not be installed) | ||
| "*.{js,jsx,ts,tsx}": "eslint --fix --quiet", | ||
| "*.{js,jsx,ts,tsx,json,css,md,html,yml,yaml}": "prettier --write", | ||
| "*.json": "prettier --write", | ||
| "*.{md,html,yml,yaml}": "prettier --write", | ||
|
|
||
| // Swift files | ||
| "*.swift": "swiftformat", | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| #!/usr/bin/env zx | ||
|
|
||
| import { setBuildEnv } from './set-build-env.mjs'; | ||
| await setBuildEnv(); | ||
| import setBuildEnv from "./set-build-env.mjs" | ||
| await setBuildEnv() | ||
|
|
||
| console.log('Flashing last built Android release...'); | ||
| console.log("Flashing last built Android release...") | ||
|
|
||
| // Install APK on device | ||
| await $({ stdio: 'inherit' })`adb install -r android/app/build/outputs/apk/release/app-release.apk`; | ||
| await $({ stdio: "inherit" })`adb install -r android/app/build/outputs/apk/release/app-release.apk` | ||
|
|
||
| console.log('✅ Android release installed successfully!'); | ||
| console.log("✅ Android release installed successfully!") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,20 @@ | ||
| #!/usr/bin/env zx | ||
|
|
||
| import { setBuildEnv } from './set-build-env.mjs'; | ||
| await setBuildEnv(); | ||
| import setBuildEnv from "./set-build-env.mjs" | ||
| await setBuildEnv() | ||
|
|
||
| console.log('Building Android release...'); | ||
| console.log("Building Android release...") | ||
|
|
||
| // Prebuild Android | ||
| await $({ stdio: 'inherit' })`bun expo prebuild --platform android`; | ||
| await $({ stdio: "inherit" })`bun expo prebuild --platform android` | ||
|
|
||
| // bundle js code: | ||
| await $({stdio: "inherit"})`bun expo export --platform android` | ||
|
|
||
| // Build release APK | ||
| await $({ stdio: 'inherit', cwd: 'android' })`./gradlew assembleRelease`; | ||
| await $({ stdio: "inherit", cwd: "android" })`./gradlew assembleRelease` | ||
|
|
||
| // Install APK on device | ||
| await $({ stdio: 'inherit' })`adb install -r android/app/build/outputs/apk/release/app-release.apk`; | ||
| await $({ stdio: "inherit" })`adb install -r android/app/build/outputs/apk/release/app-release.apk` | ||
|
|
||
| console.log('✅ Android release built and installed successfully!'); | ||
| console.log("✅ Android release built and installed successfully!") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| #!/usr/bin/env zx | ||
|
|
||
| import { setBuildEnv } from './set-build-env.mjs'; | ||
| await setBuildEnv(); | ||
| import setBuildEnv from "./set-build-env.mjs" | ||
| await setBuildEnv() | ||
|
|
||
| console.log('Building AAB for Google Play...'); | ||
| console.log("Building AAB for Google Play...") | ||
|
|
||
| // Prebuild Android | ||
| await $({ stdio: 'inherit' })`bun expo prebuild --platform android`; | ||
| await $({ stdio: "inherit" })`bun expo prebuild --platform android` | ||
|
|
||
| // Bundle JS code | ||
| await $({ stdio: 'inherit' })`bun expo export --platform android`; | ||
| await $({ stdio: "inherit" })`bun expo export --platform android` | ||
|
|
||
| // Build release AAB | ||
| await $({ stdio: 'inherit', cwd: 'android' })`./gradlew bundleRelease`; | ||
| await $({ stdio: "inherit", cwd: "android" })`./gradlew bundleRelease` | ||
|
|
||
| console.log('✅ AAB built successfully!'); | ||
| console.log('📦 Output: android/app/build/outputs/bundle/release/app-release.aab'); | ||
| console.log("✅ AAB built successfully!") | ||
| console.log("📦 Output: android/app/build/outputs/bundle/release/app-release.aab") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| async function checkDeps() { | ||
| console.log("Checking dependencies...") | ||
|
|
||
| // check if nvm's script exists: | ||
| const nvmDir = process.env.NVM_DIR || `${process.env.HOME}/.nvm` | ||
| if (!fs.existsSync(`${nvmDir}/nvm.sh`)) { | ||
| console.warn("⚠️ nvm not found...") | ||
|
Comment on lines
+5
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| // Check if swiftformat is installed | ||
| try { | ||
| await $`command -v swiftformat` | ||
| } catch { | ||
| console.warn(` | ||
| ⚠️ swiftformat not found. | ||
|
|
||
| Install it with Homebrew: | ||
|
|
||
| brew install swiftformat | ||
| `) | ||
| } | ||
| } | ||
|
|
||
| export default checkDeps | ||
|
|
||
| if (import.meta.url === `file://${process.argv[1]}`) { | ||
| await checkDeps() | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the
nvminit meansnpx lint-stagedwill fail on machines where Node is only available vianvm(common per repo guidance). In that environment, the hook can no longer findnpx, so commits are blocked unless users manually export PATH or install a system Node.Useful? React with 👍 / 👎.