From 56194f6f58794489b5ca01331c92221ed9c68d80 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 7 Apr 2026 19:06:01 +0200 Subject: [PATCH] Use biome instead of eslint/prettier --- babel.config.js | 4 +- biome.json | 34 +++ bun.lock | 21 ++ example/.eslintrc.js | 4 - example/.prettierrc.js | 5 - example/App.tsx | 37 ++-- example/app.json | 4 +- example/babel.config.js | 38 ++-- example/index.js | 6 +- .../AppIcon.appiconset/Contents.json | 102 ++++----- .../OmniExample/Images.xcassets/Contents.json | 8 +- example/jest.config.js | 2 +- example/metro.config.js | 10 +- example/package.json | 72 +++---- example/react-native.config.js | 26 +-- example/tsconfig.json | 22 +- nitro.json | 44 ++-- .../generated/shared/json/OmniConfig.json | 16 +- package.json | 204 +++++++----------- post-script.js | 98 ++++----- release.config.cjs | 60 ------ src/index.ts | 18 +- src/specs/omni.nitro.ts | 12 +- tsconfig.json | 70 +++--- 24 files changed, 425 insertions(+), 492 deletions(-) create mode 100644 biome.json delete mode 100644 example/.eslintrc.js delete mode 100644 example/.prettierrc.js delete mode 100644 release.config.cjs diff --git a/babel.config.js b/babel.config.js index 3e0218e..30526a8 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: ['module:@react-native/babel-preset'], -} + presets: ["module:@react-native/babel-preset"], +}; diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..1e83385 --- /dev/null +++ b/biome.json @@ -0,0 +1,34 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.4.9/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, + "files": { + "ignoreUnknown": false + }, + "formatter": { + "enabled": true, + "indentStyle": "tab" + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + }, + "assist": { + "enabled": true, + "actions": { + "source": { + "organizeImports": "on" + } + } + } +} diff --git a/bun.lock b/bun.lock index d7606f6..c2acffd 100644 --- a/bun.lock +++ b/bun.lock @@ -5,6 +5,7 @@ "": { "name": "react-native-omni", "devDependencies": { + "@biomejs/biome": "2.4.10", "@jamesacarr/eslint-formatter-github-actions": "^0.2.0", "@semantic-release/changelog": "^6.0.3", "@semantic-release/git": "^10.0.1", @@ -310,6 +311,24 @@ "@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], + "@biomejs/biome": ["@biomejs/biome@2.4.10", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.4.10", "@biomejs/cli-darwin-x64": "2.4.10", "@biomejs/cli-linux-arm64": "2.4.10", "@biomejs/cli-linux-arm64-musl": "2.4.10", "@biomejs/cli-linux-x64": "2.4.10", "@biomejs/cli-linux-x64-musl": "2.4.10", "@biomejs/cli-win32-arm64": "2.4.10", "@biomejs/cli-win32-x64": "2.4.10" }, "bin": { "biome": "bin/biome" } }, "sha512-xxA3AphFQ1geij4JTHXv4EeSTda1IFn22ye9LdyVPoJU19fNVl0uzfEuhsfQ4Yue/0FaLs2/ccVi4UDiE7R30w=="], + + "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.4.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-vuzzI1cWqDVzOMIkYyHbKqp+AkQq4K7k+UCXWpkYcY/HDn1UxdsbsfgtVpa40shem8Kax4TLDLlx8kMAecgqiw=="], + + "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.4.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-14fzASRo+BPotwp7nWULy2W5xeUyFnTaq1V13Etrrxkrih+ez/2QfgFm5Ehtf5vSjtgx/IJycMMpn5kPd5ZNaA=="], + + "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.4.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-7MH1CMW5uuxQ/s7FLST63qF8B3Hgu2HRdZ7tA1X1+mk+St4JOuIrqdhIBnnyqeyWJNI+Bww7Es5QZ0wIc1Cmkw=="], + + "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.4.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-WrJY6UuiSD/Dh+nwK2qOTu8kdMDlLV3dLMmychIghHPAysWFq1/DGC1pVZx8POE3ZkzKR3PUUnVrtZfMfaJjyQ=="], + + "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.4.10", "", { "os": "linux", "cpu": "x64" }, "sha512-tZLvEEi2u9Xu1zAqRjTcpIDGVtldigVvzug2fTuPG0ME/g8/mXpRPcNgLB22bGn6FvLJpHHnqLnwliOu8xjYrg=="], + + "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.4.10", "", { "os": "linux", "cpu": "x64" }, "sha512-kDTi3pI6PBN6CiczsWYOyP2zk0IJI08EWEQyDMQWW221rPaaEz6FvjLhnU07KMzLv8q3qSuoB93ua6inSQ55Tw=="], + + "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.4.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-umwQU6qPzH+ISTf/eHyJ/QoQnJs3V9Vpjz2OjZXe9MVBZ7prgGafMy7yYeRGnlmDAn87AKTF3Q6weLoMGpeqdQ=="], + + "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.4.10", "", { "os": "win32", "cpu": "x64" }, "sha512-aW/JU5GuyH4uxMrNYpoC2kjaHlyJGLgIa3XkhPEZI0uKhZhJZU8BuEyJmvgzSPQNGozBwWjC972RaNdcJ9KyJg=="], + "@colors/colors": ["@colors/colors@1.5.0", "", {}, "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="], "@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="], @@ -1992,6 +2011,8 @@ "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], + "fdir/picomatch": ["picomatch@4.0.4", "", {}, "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A=="], + "finalhandler/debug": ["debug@2.6.9", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="], "finalhandler/encodeurl": ["encodeurl@1.0.2", "", {}, "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w=="], diff --git a/example/.eslintrc.js b/example/.eslintrc.js deleted file mode 100644 index 187894b..0000000 --- a/example/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: '@react-native', -}; diff --git a/example/.prettierrc.js b/example/.prettierrc.js deleted file mode 100644 index 06860c8..0000000 --- a/example/.prettierrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - arrowParens: 'avoid', - singleQuote: true, - trailingComma: 'all', -}; diff --git a/example/App.tsx b/example/App.tsx index 2ecfcec..dcf881b 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -1,24 +1,25 @@ -import React from 'react'; -import { View, StyleSheet } from 'react-native'; -import { Omni } from 'react-native-omni'; +import type React from "react"; +import { StyleSheet, View } from "react-native"; +import { Omni } from "react-native-omni"; function App(): React.JSX.Element { - return ( - - - - ); + return ( + + + + ); } const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - }, - view: { - width: 200, - height: 200 - }}); + container: { + flex: 1, + justifyContent: "center", + alignItems: "center", + }, + view: { + width: 200, + height: 200, + }, +}); -export default App; \ No newline at end of file +export default App; diff --git a/example/app.json b/example/app.json index ea046ea..54372fb 100644 --- a/example/app.json +++ b/example/app.json @@ -1,4 +1,4 @@ { - "name": "OmniExample", - "displayName": "OmniExample" + "name": "OmniExample", + "displayName": "OmniExample" } diff --git a/example/babel.config.js b/example/babel.config.js index eaddc88..e764a94 100644 --- a/example/babel.config.js +++ b/example/babel.config.js @@ -1,20 +1,20 @@ -const path = require('path'); -const pak = require('../package.json'); +const path = require("node:path"); +const pak = require("../package.json"); -module.exports = api => { - api.cache(true); - return { - presets: ['module:@react-native/babel-preset'], - plugins: [ - [ - 'module-resolver', - { - extensions: ['.js', '.ts', '.json', '.jsx', '.tsx'], - alias: { - [pak.name]: path.join(__dirname, '../', pak.source), - }, - }, - ], - ], - }; -}; \ No newline at end of file +module.exports = (api) => { + api.cache(true); + return { + presets: ["module:@react-native/babel-preset"], + plugins: [ + [ + "module-resolver", + { + extensions: [".js", ".ts", ".json", ".jsx", ".tsx"], + alias: { + [pak.name]: path.join(__dirname, "../", pak.source), + }, + }, + ], + ], + }; +}; diff --git a/example/index.js b/example/index.js index 9b73932..881337a 100644 --- a/example/index.js +++ b/example/index.js @@ -2,8 +2,8 @@ * @format */ -import { AppRegistry } from 'react-native'; -import App from './App'; -import { name as appName } from './app.json'; +import { AppRegistry } from "react-native"; +import App from "./App"; +import { name as appName } from "./app.json"; AppRegistry.registerComponent(appName, () => App); diff --git a/example/ios/OmniExample/Images.xcassets/AppIcon.appiconset/Contents.json b/example/ios/OmniExample/Images.xcassets/AppIcon.appiconset/Contents.json index 8121323..bb8673b 100644 --- a/example/ios/OmniExample/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/example/ios/OmniExample/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,53 +1,53 @@ { - "images" : [ - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "20x20" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "20x20" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "29x29" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "29x29" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "40x40" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "40x40" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "60x60" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "60x60" - }, - { - "idiom" : "ios-marketing", - "scale" : "1x", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } + "images": [ + { + "idiom": "iphone", + "scale": "2x", + "size": "20x20" + }, + { + "idiom": "iphone", + "scale": "3x", + "size": "20x20" + }, + { + "idiom": "iphone", + "scale": "2x", + "size": "29x29" + }, + { + "idiom": "iphone", + "scale": "3x", + "size": "29x29" + }, + { + "idiom": "iphone", + "scale": "2x", + "size": "40x40" + }, + { + "idiom": "iphone", + "scale": "3x", + "size": "40x40" + }, + { + "idiom": "iphone", + "scale": "2x", + "size": "60x60" + }, + { + "idiom": "iphone", + "scale": "3x", + "size": "60x60" + }, + { + "idiom": "ios-marketing", + "scale": "1x", + "size": "1024x1024" + } + ], + "info": { + "author": "xcode", + "version": 1 + } } diff --git a/example/ios/OmniExample/Images.xcassets/Contents.json b/example/ios/OmniExample/Images.xcassets/Contents.json index 2d92bd5..9a38aea 100644 --- a/example/ios/OmniExample/Images.xcassets/Contents.json +++ b/example/ios/OmniExample/Images.xcassets/Contents.json @@ -1,6 +1,6 @@ { - "info" : { - "version" : 1, - "author" : "xcode" - } + "info": { + "version": 1, + "author": "xcode" + } } diff --git a/example/jest.config.js b/example/jest.config.js index 8eb675e..899ab4f 100644 --- a/example/jest.config.js +++ b/example/jest.config.js @@ -1,3 +1,3 @@ module.exports = { - preset: 'react-native', + preset: "react-native", }; diff --git a/example/metro.config.js b/example/metro.config.js index d268384..b44338f 100644 --- a/example/metro.config.js +++ b/example/metro.config.js @@ -1,6 +1,6 @@ -const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); -const path = require('path'); -const root = path.resolve(__dirname, '..'); +const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config"); +const path = require("node:path"); +const root = path.resolve(__dirname, ".."); /** * Metro configuration @@ -9,7 +9,7 @@ const root = path.resolve(__dirname, '..'); * @type {import('metro-config').MetroConfig} */ const config = { - watchFolders: [root], + watchFolders: [root], }; -module.exports = mergeConfig(getDefaultConfig(__dirname), config); \ No newline at end of file +module.exports = mergeConfig(getDefaultConfig(__dirname), config); diff --git a/example/package.json b/example/package.json index 0f4ffba..bdd64a2 100644 --- a/example/package.json +++ b/example/package.json @@ -1,37 +1,37 @@ { - "name": "react-native-omni-example", - "version": "0.0.1", - "private": true, - "scripts": { - "android": "react-native run-android", - "ios": "react-native run-ios --simulator='iPhone 16'", - "lint": "eslint .", - "start": "react-native start --reset-cache", - "test": "jest", - "pod": "bundle install && bundle exec pod install --project-directory=ios" - }, - "dependencies": { - "react": "19.2.3", - "react-native": "0.84.1", - "@react-native/new-app-screen": "0.84.1", - "react-native-safe-area-context": "^5.5.2", - "react-native-nitro-modules": "0.35.3" - }, - "devDependencies": { - "@babel/core": "^7.25.2", - "@babel/preset-env": "^7.25.3", - "@babel/runtime": "^7.25.0", - "@react-native-community/cli": "20.1.0", - "@react-native-community/cli-platform-android": "20.1.0", - "@react-native-community/cli-platform-ios": "20.1.0", - "@react-native/babel-preset": "0.84.1", - "@react-native/eslint-config": "0.84.1", - "@react-native/metro-config": "0.84.1", - "@react-native/typescript-config": "0.84.1", - "@types/jest": "^29.5.13", - "babel-plugin-module-resolver": "^5.0.2" - }, - "engines": { - "node": ">= 22.11.0" - } -} \ No newline at end of file + "name": "react-native-omni-example", + "version": "0.0.1", + "private": true, + "scripts": { + "android": "react-native run-android", + "ios": "react-native run-ios --simulator='iPhone 16'", + "lint": "eslint .", + "start": "react-native start --reset-cache", + "test": "jest", + "pod": "bundle install && bundle exec pod install --project-directory=ios" + }, + "dependencies": { + "react": "19.2.3", + "react-native": "0.84.1", + "@react-native/new-app-screen": "0.84.1", + "react-native-safe-area-context": "^5.5.2", + "react-native-nitro-modules": "0.35.3" + }, + "devDependencies": { + "@babel/core": "^7.25.2", + "@babel/preset-env": "^7.25.3", + "@babel/runtime": "^7.25.0", + "@react-native-community/cli": "20.1.0", + "@react-native-community/cli-platform-android": "20.1.0", + "@react-native-community/cli-platform-ios": "20.1.0", + "@react-native/babel-preset": "0.84.1", + "@react-native/eslint-config": "0.84.1", + "@react-native/metro-config": "0.84.1", + "@react-native/typescript-config": "0.84.1", + "@types/jest": "^29.5.13", + "babel-plugin-module-resolver": "^5.0.2" + }, + "engines": { + "node": ">= 22.11.0" + } +} diff --git a/example/react-native.config.js b/example/react-native.config.js index a289f92..4cdbcbb 100644 --- a/example/react-native.config.js +++ b/example/react-native.config.js @@ -1,18 +1,18 @@ -const path = require('path') -const pkg = require('../package.json') +const path = require("node:path"); +const pkg = require("../package.json"); /** * @type {import('@react-native-community/cli-types').Config} */ module.exports = { - project: { - ios: { - automaticPodsInstallation: true, - }, - }, - dependencies: { - [pkg.name]: { - root: path.join(__dirname, '..'), - }, - }, -} + project: { + ios: { + automaticPodsInstallation: true, + }, + }, + dependencies: { + [pkg.name]: { + root: path.join(__dirname, ".."), + }, + }, +}; diff --git a/example/tsconfig.json b/example/tsconfig.json index 1607947..367593b 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -1,12 +1,12 @@ { - "extends": "@react-native/typescript-config", - "include": ["**/*.ts", "**/*.tsx"], - "exclude": ["**/node_modules", "**/Pods"], - "compilerOptions": { - "strict": true, - "baseUrl": ".", - "paths": { - "react-native-omni": ["../src"] - } - } -} \ No newline at end of file + "extends": "@react-native/typescript-config", + "include": ["**/*.ts", "**/*.tsx"], + "exclude": ["**/node_modules", "**/Pods"], + "compilerOptions": { + "strict": true, + "baseUrl": ".", + "paths": { + "react-native-omni": ["../src"] + } + } +} diff --git a/nitro.json b/nitro.json index a89ba78..b443ef7 100644 --- a/nitro.json +++ b/nitro.json @@ -1,26 +1,20 @@ { - "$schema": "https://nitro.margelo.com/nitro.schema.json", - "cxxNamespace": [ - "omni" - ], - "ios": { - "iosModuleName": "Omni" - }, - "android": { - "androidNamespace": [ - "omni" - ], - "androidCxxLibName": "Omni" - }, - "autolinking": { - "Omni": { - "android": { - "language": "kotlin", - "implementationClassName": "HybridOmni" - } - } - }, - "ignorePaths": [ - "**/node_modules" - ] -} \ No newline at end of file + "$schema": "https://nitro.margelo.com/nitro.schema.json", + "cxxNamespace": ["omni"], + "ios": { + "iosModuleName": "Omni" + }, + "android": { + "androidNamespace": ["omni"], + "androidCxxLibName": "Omni" + }, + "autolinking": { + "Omni": { + "android": { + "language": "kotlin", + "implementationClassName": "HybridOmni" + } + } + }, + "ignorePaths": ["**/node_modules"] +} diff --git a/nitrogen/generated/shared/json/OmniConfig.json b/nitrogen/generated/shared/json/OmniConfig.json index e0baf1d..b11a48c 100644 --- a/nitrogen/generated/shared/json/OmniConfig.json +++ b/nitrogen/generated/shared/json/OmniConfig.json @@ -1,10 +1,10 @@ { - "uiViewClassName": "Omni", - "supportsRawText": false, - "bubblingEventTypes": {}, - "directEventTypes": {}, - "validAttributes": { - "isRed": true, - "hybridRef": true - } + "uiViewClassName": "Omni", + "supportsRawText": false, + "bubblingEventTypes": {}, + "directEventTypes": {}, + "validAttributes": { + "isRed": true, + "hybridRef": true + } } diff --git a/package.json b/package.json index 820bdd9..3a80923 100644 --- a/package.json +++ b/package.json @@ -1,122 +1,84 @@ { - "name": "react-native-omni", - "version": "0.1.0", - "description": "video player using vlc and videojs", - "main": "./lib/commonjs/index.js", - "module": "./lib/module/index.js", - "types": "./lib/typescript/src/index.d.ts", - "react-native": "src/index", - "source": "src/index", - "scripts": { - "typecheck": "tsc --noEmit", - "clean": "git clean -dfX", - "release": "semantic-release", - "build": "bun run typecheck && bob build", - "codegen": "nitrogen --logLevel=\"debug\" && bun run build && node post-script.js" - }, - "keywords": [ - "react-native", - "react-native-omni" - ], - "files": [ - "src", - "react-native.config.js", - "lib", - "nitrogen", - "cpp", - "nitro.json", - "android/build.gradle", - "android/fix-prefab.gradle", - "android/gradle.properties", - "android/CMakeLists.txt", - "android/src", - "ios/**/*.h", - "ios/**/*.m", - "ios/**/*.mm", - "ios/**/*.cpp", - "ios/**/*.swift", - "app.plugin.js", - "*.podspec", - "README.md" - ], - "workspaces": [ - "example" - ], - "repository": "https://github.com/zoeroux/react-native-omni.git", - "author": "Zoe Roux", - "license": "MIT", - "bugs": "https://github.com/zoeroux/react-native-omni/issues", - "homepage": "https://github.com/zoeroux/react-native-omni#readme", - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - }, - "devDependencies": { - "@jamesacarr/eslint-formatter-github-actions": "^0.2.0", - "@semantic-release/changelog": "^6.0.3", - "@semantic-release/git": "^10.0.1", - "@types/jest": "^29.5.12", - "@types/react": "19.2.0", - "nitrogen": "0.35.3", - "react": "19.2.3", - "react-native": "0.84.1", - "react-native-builder-bob": "^0.40.18", - "react-native-nitro-modules": "0.35.3", - "conventional-changelog-conventionalcommits": "^9.1.0", - "semantic-release": "^25.0.3", - "typescript": "^5.8.3" - }, - "peerDependencies": { - "react": "*", - "react-native": "*", - "react-native-nitro-modules": "*" - }, - "eslintConfig": { - "root": true, - "extends": [ - "@react-native", - "prettier" - ], - "plugins": [ - "prettier" - ], - "rules": { - "prettier/prettier": [ - "warn", - { - "quoteProps": "consistent", - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "es5", - "useTabs": false - } - ] - } - }, - "eslintIgnore": [ - "node_modules/", - "lib/" - ], - "prettier": { - "quoteProps": "consistent", - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "es5", - "useTabs": false, - "semi": false - }, - "react-native-builder-bob": { - "source": "src", - "output": "lib", - "targets": [ - "commonjs", - "module", - [ - "typescript", - { - "project": "tsconfig.json" - } - ] - ] - } -} \ No newline at end of file + "name": "react-native-omni", + "version": "0.1.0", + "description": "video player using vlc and videojs", + "main": "./lib/commonjs/index.js", + "module": "./lib/module/index.js", + "types": "./lib/typescript/src/index.d.ts", + "react-native": "src/index", + "source": "src/index", + "scripts": { + "typecheck": "tsc --noEmit", + "build": "bun run typecheck && bob build", + "codegen": "nitrogen --logLevel=\"debug\" && bun run build && node post-script.js" + }, + "keywords": [ + "react-native", + "react-native-omni", + "vlc", + "videojs" + ], + "files": [ + "src", + "react-native.config.js", + "lib", + "nitrogen", + "cpp", + "nitro.json", + "android/build.gradle", + "android/fix-prefab.gradle", + "android/gradle.properties", + "android/CMakeLists.txt", + "android/src", + "ios/**/*.h", + "ios/**/*.m", + "ios/**/*.mm", + "ios/**/*.cpp", + "ios/**/*.swift", + "app.plugin.js", + "*.podspec", + "README.md" + ], + "workspaces": [ + "example" + ], + "repository": "https://github.com/zoeroux/react-native-omni.git", + "author": "Zoe Roux", + "license": "MIT", + "bugs": "https://github.com/zoeroux/react-native-omni/issues", + "homepage": "https://github.com/zoeroux/react-native-omni#readme", + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + }, + "devDependencies": { + "@biomejs/biome": "2.4.10", + "@types/jest": "^29.5.12", + "@types/react": "19.2.0", + "nitrogen": "0.35.3", + "react": "19.2.3", + "react-native": "0.84.1", + "react-native-builder-bob": "^0.40.18", + "react-native-nitro-modules": "0.35.3", + "typescript": "^5.8.3" + }, + "peerDependencies": { + "react": "*", + "react-native": "*", + "react-native-nitro-modules": "*" + }, + "react-native-builder-bob": { + "source": "src", + "output": "lib", + "targets": [ + "commonjs", + "module", + [ + "typescript", + { + "project": "tsconfig.json" + } + ] + ] + } +} diff --git a/post-script.js b/post-script.js index 4fae87a..4d8a9ac 100644 --- a/post-script.js +++ b/post-script.js @@ -1,60 +1,54 @@ /** -* @file This script is auto-generated by create-nitro-module and should not be edited. -* -* @description This script applies a workaround for Android by modifying the 'OnLoad.cpp' file. -* It reads the file content and removes the 'margelo/nitro/' string from it. This enables support for custom package names. -* -* @module create-nitro-module -*/ -const path = require('node:path') -const { writeFile, readFile } = require('node:fs/promises') -const { readdir } = require('node:fs/promises') - + * @file This script is auto-generated by create-nitro-module and should not be edited. + * + * @description This script applies a workaround for Android by modifying the 'OnLoad.cpp' file. + * It reads the file content and removes the 'margelo/nitro/' string from it. This enables support for custom package names. + * + * @module create-nitro-module + */ +const path = require("node:path"); +const { writeFile, readFile } = require("node:fs/promises"); +const { readdir } = require("node:fs/promises"); const updateViewManagerFiles = async (file) => { - const viewManagerFile = path.join( - process.cwd(), - 'nitrogen/generated/android/kotlin/com/margelo/nitro/omni/views', - file - ) - - const viewManagerStr = await readFile(viewManagerFile, { encoding: 'utf8' }) - await writeFile( - viewManagerFile, - viewManagerStr.replace( - /com\.margelo\.nitro\.omni\.\*/g, - 'com.omni.*' - ) - ) -} + const viewManagerFile = path.join( + process.cwd(), + "nitrogen/generated/android/kotlin/com/margelo/nitro/omni/views", + file, + ); + const viewManagerStr = await readFile(viewManagerFile, { encoding: "utf8" }); + await writeFile( + viewManagerFile, + viewManagerStr.replace(/com\.margelo\.nitro\.omni\.\*/g, "com.omni.*"), + ); +}; const androidWorkaround = async () => { - const androidOnLoadFile = path.join( - process.cwd(), - 'nitrogen/generated/android', - 'OmniOnLoad.cpp' - ) - - const viewManagerDir = await readdir( - path.join( - process.cwd(), - 'nitrogen/generated/android/kotlin/com/margelo/nitro/omni/views' - ) - ) - const viewManagerFiles = viewManagerDir.filter((file) => - file.endsWith('Manager.kt') - ) - const res = await Promise.allSettled( - viewManagerFiles.map(updateViewManagerFiles) - ) + const androidOnLoadFile = path.join( + process.cwd(), + "nitrogen/generated/android", + "OmniOnLoad.cpp", + ); - if (res.some((r) => r.status === 'rejected')) { - throw new Error(`Error updating view manager files: ${res}`) - } + const viewManagerDir = await readdir( + path.join( + process.cwd(), + "nitrogen/generated/android/kotlin/com/margelo/nitro/omni/views", + ), + ); + const viewManagerFiles = viewManagerDir.filter((file) => + file.endsWith("Manager.kt"), + ); + const res = await Promise.allSettled( + viewManagerFiles.map(updateViewManagerFiles), + ); - - const str = await readFile(androidOnLoadFile, { encoding: 'utf8' }) - await writeFile(androidOnLoadFile, str.replace(/margelo\/nitro\//g, '')) -} -androidWorkaround() \ No newline at end of file + if (res.some((r) => r.status === "rejected")) { + throw new Error(`Error updating view manager files: ${res}`); + } + + const str = await readFile(androidOnLoadFile, { encoding: "utf8" }); + await writeFile(androidOnLoadFile, str.replace(/margelo\/nitro\//g, "")); +}; +androidWorkaround(); diff --git a/release.config.cjs b/release.config.cjs deleted file mode 100644 index 92d84b8..0000000 --- a/release.config.cjs +++ /dev/null @@ -1,60 +0,0 @@ -const rules = [ - { type: 'feat', release: 'minor', title: '✨ Features' }, - { type: 'fix', release: 'patch', title: '🐛 Bug Fixes' }, - { type: 'perf', release: 'patch', title: '💨 Performance Improvements' }, - { type: 'refactor', release: 'patch', title: '🔄 Code Refactors' }, - { type: 'docs', release: 'patch', title: '📚 Documentation' }, - { type: 'chore', release: 'patch', title: '🛠️ Other changes' }, -] - -const sortMap = Object.fromEntries( - rules.map((rule, index) => [rule.title, index]) -) - -/** - * @type {import('semantic-release').GlobalConfig} - */ -module.exports = { - branches: ['main', { name: 'next', prerelease: 'next' }], - plugins: [ - [ - '@semantic-release/commit-analyzer', - { - preset: 'conventionalcommits', - releaseRules: [ - { breaking: true, release: 'major' }, - { revert: true, release: 'patch' }, - ].concat(rules.map(({ type, release }) => ({ type, release }))), - }, - ], - [ - '@semantic-release/release-notes-generator', - { - preset: 'conventionalcommits', - presetConfig: { - types: rules.map(({ type, title }) => ({ - type, - section: title, - })), - }, - writerOpts: { - commitGroupsSort: (a, z) => sortMap[a.title] - sortMap[z.title], - }, - }, - ], - [ - '@semantic-release/changelog', - { - changelogFile: 'CHANGELOG.md', - }, - ], - '@semantic-release/npm', - '@semantic-release/github', - [ - '@semantic-release/git', - { - assets: ['package.json', 'CHANGELOG.md', 'example/package.json'], - }, - ], - ], -} diff --git a/src/index.ts b/src/index.ts index d993027..9cc9f44 100755 --- a/src/index.ts +++ b/src/index.ts @@ -1,14 +1,10 @@ -import { getHostComponent, type HybridRef } from 'react-native-nitro-modules' -import OmniConfig from '../nitrogen/generated/shared/json/OmniConfig.json' -import type { - OmniProps, - OmniMethods, -} from './specs/omni.nitro' - +import { getHostComponent, type HybridRef } from "react-native-nitro-modules"; +import OmniConfig from "../nitrogen/generated/shared/json/OmniConfig.json"; +import type { OmniMethods, OmniProps } from "./specs/omni.nitro"; export const Omni = getHostComponent( - 'Omni', - () => OmniConfig -) + "Omni", + () => OmniConfig, +); -export type OmniRef = HybridRef +export type OmniRef = HybridRef; diff --git a/src/specs/omni.nitro.ts b/src/specs/omni.nitro.ts index 981d5ca..d302eb2 100755 --- a/src/specs/omni.nitro.ts +++ b/src/specs/omni.nitro.ts @@ -1,13 +1,13 @@ import type { - HybridView, - HybridViewProps, - HybridViewMethods, -} from 'react-native-nitro-modules' + HybridView, + HybridViewMethods, + HybridViewProps, +} from "react-native-nitro-modules"; export interface OmniProps extends HybridViewProps { - isRed: boolean + isRed: boolean; } export interface OmniMethods extends HybridViewMethods {} -export type Omni = HybridView \ No newline at end of file +export type Omni = HybridView; diff --git a/tsconfig.json b/tsconfig.json index eab4aee..07f80db 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,37 +1,37 @@ { - "compilerOptions": { - "composite": true, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react", - "lib": ["esnext"], - "module": "esnext", - "moduleResolution": "node", - "noEmit": false, - "noFallthroughCasesInSwitch": true, - "noImplicitReturns": true, - "noImplicitUseStrict": false, - "noStrictGenericChecks": false, - "noUncheckedIndexedAccess": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "strict": true, - "target": "esnext", - "verbatimModuleSyntax": true - }, - "exclude": [ - "**/node_modules", - "**/lib", - "**/.eslintrc.js", - "**/.prettierrc.js", - "**/jest.config.js", - "**/babel.config.js", - "**/metro.config.js", - "**/tsconfig.json" - ], - "include": ["src/**/*", "nitrogen/**/*.json"] + "compilerOptions": { + "composite": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "lib": ["esnext"], + "module": "esnext", + "moduleResolution": "node", + "noEmit": false, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noImplicitUseStrict": false, + "noStrictGenericChecks": false, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "target": "esnext", + "verbatimModuleSyntax": true + }, + "exclude": [ + "**/node_modules", + "**/lib", + "**/.eslintrc.js", + "**/.prettierrc.js", + "**/jest.config.js", + "**/babel.config.js", + "**/metro.config.js", + "**/tsconfig.json" + ], + "include": ["src/**/*", "nitrogen/**/*.json"] }