Skip to content
Draft
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ assets/
.github/
/.eslintrc.js
/metro.config.js
**/node_modules
56 changes: 54 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: '@react-native',
plugins: ['import'],
plugins: ['import', 'tsdoc', '@typescript-eslint'],
reportUnusedDisableDirectives: true,
rules: {
// disabled rules
'prettier/prettier': 'off',
Expand All @@ -24,7 +26,8 @@ module.exports = {
'no-debugger': 'error',
'prefer-const': 'error',
'no-multiple-empty-lines': 'error',
'no-unused-vars': 'error',
'no-unused-vars': 'off',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • TODO: check impact of this change

'@typescript-eslint/no-unused-vars': ['error', { 'vars': 'all', 'args': 'after-used', 'ignoreRestSiblings': true }],
'no-trailing-spaces': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'react/jsx-boolean-value': 'error',
Expand All @@ -34,6 +37,7 @@ module.exports = {
'error',
{
code: 120,
ignoreComments: true, // allow longer TSDoc/comment lines
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • maybe not?

ignoreTemplateLiterals: true,
// FIXME: doesn't work :/
ignorePattern: '^log\\(', // ignore "log('...')"
Expand All @@ -45,6 +49,10 @@ module.exports = {
'import/namespace': 'error',
'import/default': 'error',
'import/export': 'error',
// typescript-eslint v8 removed extension rules. Map to base rules to preserve behavior
'@typescript-eslint/func-call-spacing': 'off',
'func-call-spacing': ['error', 'never'],
// TSDoc is enforced via an override on TS/TSX files only (see overrides)
},
settings: {
'import/ignore': ['node_modules/react-native/index\\.js$'], // https://github.com/facebook/react-native/issues/28549
Expand All @@ -58,4 +66,48 @@ module.exports = {
WebSocket: true,
URLSearchParams: true,
},
// Targeted relief for specs: avoid import plugin traversing RN internals
overrides: [
// Enforce TSDoc only for TypeScript sources in src/
{
files: ['src/**/*.{ts,tsx}'],
rules: {
'tsdoc/syntax': 'error',
},
},
{
files: ['src/specs/**/*.ts'],
rules: {
// Turn off import rules that resolve into RN internals and crash parsers
'import/named': 'off',
'import/no-unresolved': 'off',
},
settings: {
// Treat RN internals as core so import plugin won't try to resolve/parse them
'import/core-modules': [
'react-native/Libraries/Types/CodegenTypes',
'react-native/Libraries/Utilities/codegenNativeComponent',
],
},
},
// Node scripts: allow console and relax max-len for long regex/HTML strings
{
files: ['scripts/**/*.mjs'],
rules: {
'no-console': 'off',
'no-useless-escape': 'off',
quotes: 'off',
'@typescript-eslint/no-unused-vars': 'off',
'max-len': [
'error',
{
code: 200,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreUrls: true,
},
],
},
},
],
};
41 changes: 29 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ run-name: ⚙️ Build examples on ${{ github.event_name == 'pull_request' && 'P
on:
push:
branches:
- main
- master
pull_request:
types: [opened, synchronize, reopened]

Expand All @@ -13,35 +13,52 @@ jobs:
name: build-example-ios
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.4'
- name: Checkout
uses: actions/checkout@v3
- name: Install modules
run: yarn
ruby-version: '3.3.5'
bundler-cache: true
env:
# Point bundler to the example app's Gemfile so cache keys match correctly
BUNDLE_GEMFILE: example/Gemfile
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '20'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install example
run: yarn bootstrap
- name: Build
run: cd example/ios && xcodebuild -workspace CameraKitExample.xcworkspace -configuration Debug -scheme CameraKitExample -sdk iphoneos build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
run: cd example/ios && xcodebuild -workspace CameraKitExample.xcworkspace -configuration Debug -scheme CameraKitExample -sdk iphoneos build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
build-example-android:
name: build-example-android
runs-on: ubuntu-latest # using linux runner for speed
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: 'gradle'
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Install modules
run: yarn
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '20'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install example
run: yarn bootstrap-linux
- name: Setup Gradle (validation + caching)
uses: gradle/actions/setup-gradle@v4
with:
validate-wrappers: true
cache-read-only: false
- name: Build
run: cd example/android && ./gradlew assembleDebug
119 changes: 119 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Docs (TypeDoc → GitHub Pages)

# References (official docs):
# - Pages deployment action: https://github.com/actions/deploy-pages
# - Upload Pages artifact: https://github.com/actions/upload-pages-artifact
# - Configure Pages: https://github.com/actions/configure-pages
# - Setup Node: https://github.com/actions/setup-node
# - Checkout: https://github.com/actions/checkout
# - TypeDoc options: https://typedoc.org/options/

on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:

# Required for Pages
permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
name: Build TypeDoc site
runs-on: ubuntu-latest
steps:
- name: Checkout
# https://github.com/actions/checkout
uses: actions/checkout@v5

- name: Setup Node.js (LTS 22)
# https://github.com/actions/setup-node
uses: actions/setup-node@v5
with:
node-version: '22'
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Configure GitHub Pages
# Provides the GitHub Pages URL and sets up permissions
# https://github.com/actions/configure-pages
uses: actions/configure-pages@v5

- name: Build documentation (TypeDoc)
# typedoc.json sets: out=docs/site, githubPages=true (.nojekyll), customCss
run: |
yarn docs:clean
yarn docs:build

- name: Upload artifact
# Upload the static site for Pages to deploy
# https://github.com/actions/upload-pages-artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/site

deploy-production:
name: Deploy (Production)
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
# Runs on push to master and manual dispatch. Manual runs should target the
# master branch via the UI (Run workflow → Branch: master).
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- name: Require master branch for manual runs
run: |
if [ "${GITHUB_REF_NAME}" != "master" ]; then
echo "Manual runs must target 'master'. Selected: ${GITHUB_REF_NAME}";
exit 1;
fi
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

deploy-preview:
name: Deploy (PR Preview)
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
# Skip preview deploys for forked PRs and Dependabot to avoid failures
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]'
steps:
- name: Deploy preview to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
preview: true

# Usage:
# 1. In GitHub → Settings → Pages, set "Source" to "GitHub Actions".
# 2. Push to master → builds and deploys to the production Pages site.
# 3. Open a PR targeting master → builds and deploys an ephemeral PR Preview URL.
# The preview URL is exposed as the environment URL of the "Deploy (PR Preview)" job
# and in the PR checks. It is automatically cleaned up when the PR closes.
# 4. Manual run: Actions → this workflow → Run workflow. Choose Branch: master.
# This performs a production deploy using the content of master.
# 5. The docs are NOT committed to the repo. They are built in CI and published
# from the uploaded Pages artifact. GitHub Pages hosts the result; no gh-pages branch
# is required when using the official Pages actions.
# 6. Customize TypeDoc via typedoc.json (`out`, `customCss`, validation filters, etc.).
# 7. Local preview: `yarn docs:build && yarn docs:serve` → http://localhost:8080
#
# Notes:
# - The Pages environment requires the `pages:write` and `id-token:write` permissions.
# - `githubPages: true` in typedoc.json ensures `.nojekyll` is emitted for correct asset serving.
# - For monorepos or matrix builds, you can upload multiple artifacts and deploy from a single job.
21 changes: 10 additions & 11 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ run-name: 🩺 Code checks on ${{ github.event_name == 'pull_request' && 'PR' ||
on:
push:
branches:
- main
- master
pull_request:
types: [opened, synchronize, reopened]

Expand All @@ -14,15 +14,14 @@ jobs:
runs-on: ubuntu-latest # using linux runner for speed
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install modules
run: yarn
- name: Install Bundler
run: sudo gem install bundler
- name: Install gems
run: cd example && sudo bundle install
- name: Install example
run: yarn bootstrap-linux
Comment on lines -17 to -25
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • TODO: check or revert this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint

Expand All @@ -32,7 +31,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install dependencies
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ yarn-error.log
# Ruby / CocoaPods
**/Pods/
/vendor/bundle/
# Bundle (example app)
example/.bundle/
example/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*
Expand Down Expand Up @@ -85,6 +88,9 @@ example/.yarn/*
ios/build/
ios/DerivedData/
dist/

# Generated documentation artifacts (do not commit)
docs/site/
### Xcode ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<h1 align="center">
🎈 React Native Camera Kit
</h1>
[![react-native-camera-kit](./images/header.png)](https://github.com/teslamotors/react-native-camera-kit)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find a way to add an alt "React Native Camera Kit"



<p align="center">
A <strong>high performance, easy to use, rock solid</strong><br>
Expand Down
Loading