-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
adcbc2f
commit 9f269e7
Showing
9 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-24.04 | ||
env: | ||
EMSCRIPTEN_VERSION: '3.1.74' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22.x | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt install -y \ | ||
ninja-build \ | ||
gettext | ||
npm i -g pnpm | ||
pnpm i | ||
./scripts/install-deps.sh | ||
- name: Install emsdk | ||
run: | | ||
git clone https://github.com/emscripten-core/emsdk | ||
cd emsdk | ||
./emsdk install ${{ env.EMSCRIPTEN_VERSION }} | ||
./emsdk activate ${{ env.EMSCRIPTEN_VERSION }} | ||
- name: Build | ||
run: | | ||
. emsdk/emsdk_env.sh | ||
pnpm run configure | ||
pnpm run build | ||
npm pack | ||
- name: Setup tmate session | ||
if: ${{ failure() }} | ||
uses: mxschmitt/action-tmate@v3 | ||
|
||
- name: Release | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
uses: 'marvinpinto/action-automatic-releases@latest' | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
automatic_release_tag: latest | ||
prerelease: true | ||
title: "Nightly Build" | ||
files: | | ||
fcitx5-rime.js-*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
cmake_minimum_required(VERSION 3.27) | ||
|
||
project(fcitx5-rime-js VERSION 0.1.0) | ||
|
||
option(RIME_ONLY "" ON) | ||
add_subdirectory(fcitx5-js) | ||
target_link_libraries(Fcitx5 | ||
"--embed-file ${PROJECT_BINARY_DIR}/sysroot/usr/lib/fcitx5/librime.so@/usr/lib/fcitx5/librime.so" | ||
"--embed-file ${PROJECT_BINARY_DIR}/sysroot/usr/share/fcitx5/addon/rime.conf@/usr/share/fcitx5/addon/rime.conf" | ||
"--embed-file ${PROJECT_BINARY_DIR}/sysroot/usr/share/fcitx5/inputmethod/rime.conf@/usr/share/fcitx5/inputmethod/rime.conf" | ||
"--embed-file ${PROJECT_BINARY_DIR}/sysroot/usr/share/rime-data/opencc@/usr/share/rime-data/opencc" | ||
"--embed-file ${PROJECT_SOURCE_DIR}/cache/placeholder.yaml@/usr/share/rime-data/default.yaml" # fcitx5-rime requires this file. | ||
"--extern-post-js ${PROJECT_SOURCE_DIR}/src/rime.js" | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head></head> | ||
<body> | ||
<script type="module"> | ||
import { loadZip } from "./dist/Fcitx5.js" | ||
await loadZip('./rime-ice.zip') | ||
</script> | ||
<textarea></textarea> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "fcitx5-rime.js", | ||
"version": "0.1.0", | ||
"description": "Fcitx5 Rime as a JavaScript library", | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"author": { | ||
"name": "Qijia Liu", | ||
"email": "[email protected]", | ||
"url": "https://github.com/eagleoflqj" | ||
}, | ||
"scripts": { | ||
"configure": "emcmake cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug", | ||
"build": "EMCC_FORCE_STDLIBS=libc++ FCITX_DISTRIBUTION=fcitx5-js cmake --build build", | ||
"preview": "serve -S", | ||
"prepack": "bash scripts/prepack.sh" | ||
}, | ||
"license": "AGPL-3.0-or-later", | ||
"devDependencies": { | ||
"serve": "^14.2.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set -e | ||
|
||
pnpm i --prefix=fcitx5-js | ||
pnpm i --prefix=fcitx5-js/fcitx5-webview | ||
|
||
./fcitx5-js/scripts/install-deps.sh | ||
file=rime.zip | ||
[[ -f cache/$file ]] || wget -P cache https://github.com/fcitx-contrib/fcitx5-plugins/releases/download/js/$file | ||
unzip -d build/sysroot/usr cache/$file | ||
|
||
mkdir -p build/fcitx5-js | ||
ln -sf ../sysroot build/fcitx5-js | ||
ln -sf ../build/fcitx5-js fcitx5-js/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
set -e | ||
|
||
rm -rf dist/* | ||
mkdir -p dist | ||
|
||
cp build/sysroot/usr/lib/libFcitx5* dist | ||
cp build/fcitx5-js/src/Fcitx5.* dist | ||
cp fcitx5-js/page/Fcitx5.d.ts dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export async function loadZip(url) { | ||
const [_, schema] = await Promise.all([ | ||
fcitxReady, | ||
fetch(url).then(res => res.arrayBuffer()) | ||
]) | ||
window.fcitx.unzip(schema, '/usr/share/rime-data') | ||
window.fcitx.enable() | ||
window.fcitx.setInputMethods(['rime']) | ||
} |