Skip to content

Commit

Permalink
Build NPM packages
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Nov 21, 2023
1 parent 8c492c6 commit 52ccf3f
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 3,517 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: npm

on:
push:
branches:
- master

workflow_dispatch:

concurrency:
group: npm-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
nodejs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8"]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- uses: actions/setup-node@v3
with:
node-version: 13
registry-url: 'https://registry.npmjs.org'

- name: Display node version
shell: bash
run: |
node --version
npm --version
cd nodejs-examples
npm install [email protected] -g
npm install [email protected]
npm --version
- name: Build nodejs package
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd scripts/nodejs
./run.sh
npm install
rm run.sh
npm ci
npm publish --provenance --access public
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ two-pass-*.sh
build-*
vits-vctk
vits-zh-aishell3
jslint.mjs
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(sherpa-onnx)

set(SHERPA_ONNX_VERSION "1.8.10")
set(SHERPA_ONNX_VERSION "1.8.11")

# Disable warning about
#
Expand Down
7 changes: 7 additions & 0 deletions scripts/nodejs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Introduction

Text-to-speech and speech-to-text with [Next-gen Kaldi](https://github.com/k2-fsa/)

Please refer to
https://github.com/k2-fsa/sherpa-onnx/tree/master/nodejs-examples
for examples.
7 changes: 2 additions & 5 deletions scripts/nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,13 @@ if (os.platform() == "win32") {
if (process.arch == "x64") {
soname =
path.join(__dirname, "lib", "linux-x64", "libsherpa-onnx-c-api.so");
} else if (process.arch == "ia32") {
soname =
path.join(__dirname, "lib", "linux-x86", "libsherpa-onnx-c-api.so");
} else {
throw new Error(
`Support only Linux x86 and x64 for now. Given ${process.arch}`);
throw new Error(`Support only Linux x64 for now. Given ${process.arch}`);
}
} else {
throw new Error(`Unsupported platform ${os.platform()}`);
}

if (!fs.existsSync(soname)) {
throw new Error(`Cannot find file ${soname}. Please make sure you have run
./build.sh`);
Expand Down
Loading

0 comments on commit 52ccf3f

Please sign in to comment.