Skip to content
Merged
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
17 changes: 13 additions & 4 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ on:
jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@v5
# Setup .npmrc file to publish to npm

- name: Setup
uses: ./.github/actions/setup
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: yarn install --immutable
shell: bash

- name: Publish package
run: npm publish
Expand Down
2 changes: 1 addition & 1 deletion app.plugin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Root Expo config plugin entry so users can declare simply:
// plugins: [ ["react-native-vosk", { models: [...], iOSMicrophonePermission: "..." }] ]
module.exports = require('./plugin/withVosk.js');
module.exports = require('./plugin/build/withVosk');
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-vosk",
"version": "2.1.0",
"version": "2.1.1",
"description": "Speech recognition module for react native using Vosk library",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand Down Expand Up @@ -42,7 +42,7 @@
"typecheck": "tsc",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
"prepare": "bob build",
"prepare": "bob build && tsc --project plugin/tsconfig.json",
"release": "release-it"
},
"keywords": [
Expand Down Expand Up @@ -85,7 +85,9 @@
"del-cli": "^6.0.0",
"eslint": "^9.35.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-jest": "latest",
Comment thread
riderodd marked this conversation as resolved.
"eslint-plugin-prettier": "^5.5.4",
"expo-module-scripts": "^5.0.7",
"jest": "^29.7.0",
"prettier": "^3.6.2",
"react": "19.1.0",
Expand Down
9 changes: 4 additions & 5 deletions plugin/withVosk.ts → plugin/src/withVosk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ import {
withInfoPlist,
withXcodeProject,
withGradleProperties,
createRunOncePlugin,
} from '@expo/config-plugins';
import fs from 'fs';
import path from 'path';
import pkg from '../../package.json';

export type VoskPluginProps = {
models?: string[]; // Relative paths as provided in app.json (e.g., assets/model-fr-fr)
iOSMicrophonePermission?: string; // NSMicrophoneUsageDescription text
};

const withVosk: ConfigPlugin<VoskPluginProps> = (
config,
props: VoskPluginProps = {}
) => {
const withVosk: ConfigPlugin<VoskPluginProps | void> = (config, props) => {
const { models = [], iOSMicrophonePermission } = props as VoskPluginProps;
Comment thread
riderodd marked this conversation as resolved.

// iOS: add microphone permission string
Expand Down Expand Up @@ -84,4 +83,4 @@ const withVosk: ConfigPlugin<VoskPluginProps> = (
return config;
};

export default withVosk;
export default createRunOncePlugin(withVosk, pkg.name, pkg.version);
10 changes: 10 additions & 0 deletions plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "expo-module-scripts/tsconfig.plugin",
"compilerOptions": {
"outDir": "build",
"rootDir": "src",
"resolveJsonModule": true
},
"include": ["./src"],
Comment thread
riderodd marked this conversation as resolved.
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
}
90 changes: 0 additions & 90 deletions plugin/withVosk.js

This file was deleted.

Loading
Loading