mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-22 00:00:04 +08:00
Compare commits
78 Commits
v1.06.2209
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
5b68973fc4 | ||
|
080ee2b6df | ||
|
465af9b79a | ||
|
322de01a35 | ||
|
8c9eeed51f | ||
|
a3e75a647f | ||
|
54ce4f4565 | ||
|
4b9612b7a6 | ||
|
940cd4a12d | ||
|
bf2fbd90ed | ||
|
7972c036f2 | ||
|
75ea918b71 | ||
|
df2d94f3f2 | ||
|
2778d18e9e | ||
|
e2d698f573 | ||
|
ab106f123a | ||
|
f32e4d59c8 | ||
|
5cad0a1fac | ||
|
cab9cb805d | ||
|
99b2a42170 | ||
|
cb363c5326 | ||
|
70a2622fae | ||
|
11cee791d5 | ||
|
5fe2af43d8 | ||
|
e47ef79745 | ||
|
471984aa7b | ||
|
1a5519f125 | ||
|
23b2b57500 | ||
|
fbe81e32ba | ||
|
3ea46144c8 | ||
|
1d38da3d78 | ||
|
817c74ea86 | ||
|
a33d79f0c3 | ||
|
d9dec28b02 | ||
|
1e637f3969 | ||
|
98cbf7202e | ||
|
34c27f5d34 | ||
|
3d941dbe23 | ||
|
4c591f266a | ||
|
f41bffd96a | ||
|
285d29c48f | ||
|
d581d5aa8b | ||
|
d4b8412f98 | ||
|
c5a0c09738 | ||
|
d5b5e5a977 | ||
|
60e77b0df0 | ||
|
afb354792d | ||
|
ac06e4ad9c | ||
|
f7191c2280 | ||
|
4354a28fe5 | ||
|
7fa50693a7 | ||
|
57ccd51771 | ||
|
041d451488 | ||
|
8404792579 | ||
|
4a25d2704b | ||
|
b9874782f9 | ||
|
386900ccf5 | ||
|
b53b420a0c | ||
|
3902faa429 | ||
|
bec0771df6 | ||
|
af247207d4 | ||
|
96360cb0d4 | ||
|
199b994991 | ||
|
f4c6d6cc5f | ||
|
006b61bb0f | ||
|
7a302f6c12 | ||
|
baf4206157 | ||
|
a556ded5f7 | ||
|
3ddeba5923 | ||
|
70c44ccb8c | ||
|
035ffe756f | ||
|
ff3f815e9e | ||
|
277c1bde14 | ||
|
1d169d995a | ||
|
78170a663e | ||
|
0447f18b42 | ||
|
43cea86b7a | ||
|
cc93ba32a5 |
1
.github/ISSUE_TEMPLATE/bug_report.md
vendored
1
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -10,6 +10,7 @@ assignees: ''
|
||||
**预先准备**
|
||||
1. 删除 `~/.config/wechat-devtools` 目录,重新打开项目(若发布 `issue` 即默认阁下执行了此操作且问题没有解决);
|
||||
2. HelloWorld是否正常(登录状态新建默认项目,执行复现步骤):正常/不正常
|
||||
3. ***注意:如果你的问题是编译器错误,那么请提供可复现的demo,否则会被直接关闭。***
|
||||
|
||||
**问题描述**
|
||||
<!-- 请对问题做一个简单描述。 -->
|
||||
|
66
.github/workflows/build-deb.yml
vendored
Normal file
66
.github/workflows/build-deb.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Build DEB Package
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build-deb:
|
||||
name: Build DEB Package
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
# https://stackoverflow.com/questions/61096521/how-to-use-gpg-key-in-github-actions
|
||||
# gpg --generate-key
|
||||
# gpg --export-secret-keys YOUR_ID_HERE | base64 > private.key
|
||||
- name: Configure GPG Key
|
||||
run: |
|
||||
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
|
||||
gpg --list-secret-keys jiyecafe@gmail.com
|
||||
env:
|
||||
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt-get install -y build-essential fakeroot devscripts debhelper # debmake lintian pbuilder
|
||||
|
||||
- name: Build Deb Package
|
||||
run: |
|
||||
export BUILD_VERSION=${{ steps.tag.outputs.tag }}
|
||||
ls -l
|
||||
mkdir -p tmp/build
|
||||
export WINE=false
|
||||
tools/build-prepare.sh
|
||||
env WINE=false tools/build-deepin.sh ${{ steps.tag.outputs.tag }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-deb-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
88
.github/workflows/build-src.yml
vendored
Normal file
88
.github/workflows/build-src.yml
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Build Base Packages
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build-src:
|
||||
name: Build Base Packages
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
echo "$UID, $GID"
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export ACTION_MODE=true
|
||||
ls -l
|
||||
export WINE=false
|
||||
tools/build-with-docker.sh
|
||||
|
||||
- name: Compress Resources
|
||||
run: |
|
||||
ls -l
|
||||
mkdir -p tmp/src
|
||||
rm -rf nwjs/node nwjs/node.exe
|
||||
cp node/bin/node nwjs/node
|
||||
cd nwjs && ln -s node node.exe
|
||||
cd ..
|
||||
tar -zcf tmp/src/src-linux.tar.gz bin nwjs package.nw tools
|
||||
|
||||
- name: Compress nodegit
|
||||
run: |
|
||||
ls -l
|
||||
mkdir -p tmp/build
|
||||
cp -r package.nw/node_modules/nodegit .
|
||||
tar -zcf nodegit.tar.gz nodegit
|
||||
mv nodegit.tar.gz tmp/build
|
||||
cd tmp/build
|
||||
ls -l
|
||||
|
||||
- name: View Directory
|
||||
run: |
|
||||
ls -l
|
||||
|
||||
- name: Upload src artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.src
|
||||
path: tmp/src
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
66
.github/workflows/build-tar.yml
vendored
Normal file
66
.github/workflows/build-tar.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Build tar.gz AppImage
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build-tar:
|
||||
name: Build tar.gz AppImage
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
- name: Inspect directory after downloading artifacts
|
||||
run: |
|
||||
ls -alFR wechat-devtools-*.build
|
||||
ls -alFR wechat-devtools-*.src
|
||||
- name: Prepare
|
||||
run: |
|
||||
sudo apt install -y fuse
|
||||
echo "$UID, $GID"
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export WINE=false
|
||||
export ACTION_MODE=true
|
||||
# tar.gz AppImage
|
||||
ls -l
|
||||
mkdir -p tmp/build
|
||||
tools/build-prepare.sh
|
||||
tools/build-release.sh ${{ matrix.ARCH }} ${{ steps.tag.outputs.tag }}
|
||||
|
||||
- name: View Directory
|
||||
run: |
|
||||
ls -l
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-simple-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
52
.github/workflows/flatpak-verify.yml
vendored
52
.github/workflows/flatpak-verify.yml
vendored
@ -1,52 +0,0 @@
|
||||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Flatpak Verify
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches: [ master, dev]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
# # Allows you to run this workflow manually from the Actions tab
|
||||
# workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
flatpak:
|
||||
name: "Flatpak"
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: bilelmoussaoui/flatpak-github-actions:freedesktop-21.08
|
||||
options: --privileged
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86_64]
|
||||
# Don't fail the whole workflow if one architecture fails
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
- name: Prepare
|
||||
run: |
|
||||
yum install -y p7zip p7zip-plugins nodejs
|
||||
cd compiler && npm install
|
||||
cat /etc/issue
|
||||
7z
|
||||
# Docker is required by the docker/setup-qemu-action which enables emulation
|
||||
- name: Install deps
|
||||
run: |
|
||||
dnf -y install docker
|
||||
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
|
||||
env:
|
||||
ACTION_MODE: true
|
||||
with:
|
||||
bundle: wechat-devtools.flatpak
|
||||
manifest-path: io.github.msojocs.wechat-devtools.yml
|
||||
cache-key: flatpak-builder-${{ github.sha }}
|
||||
cache: false
|
||||
arch: ${{ matrix.arch }}
|
371
.github/workflows/release-wine.yml
vendored
371
.github/workflows/release-wine.yml
vendored
@ -1,371 +0,0 @@
|
||||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Build Packages Wine
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches: [ master, dev, 45-snap-version]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
# # Allows you to run this workflow manually from the Actions tab
|
||||
# workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-src:
|
||||
name: Build Base Packages
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
cd compiler && npm install
|
||||
echo "$UID, $GID"
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export ACTION_MODE=true
|
||||
export DOCKER_UID=$UID
|
||||
export DOCKER_GID=$GID
|
||||
ls -l
|
||||
export WINE=true
|
||||
docker-compose up
|
||||
|
||||
- name: Compress Resources
|
||||
run: |
|
||||
ls -l
|
||||
export WINE=true
|
||||
mkdir -p tmp/src
|
||||
mkdir -p tmp/build
|
||||
rm -rf nwjs/node nwjs/node.exe
|
||||
cp node/bin/node nwjs/node
|
||||
cd nwjs && ln -s node node.exe
|
||||
cd ..
|
||||
tar -zcf tmp/src/src-wine.tar.gz bin nwjs package.nw tools
|
||||
|
||||
- name: View Directory
|
||||
run: |
|
||||
ls -l
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.src
|
||||
path: tmp/src
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
||||
|
||||
build-tar:
|
||||
name: Build tar.gz AppImage
|
||||
needs:
|
||||
- build-src
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
cd compiler && npm install
|
||||
echo "$UID, $GID"
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export WINE=true
|
||||
export ACTION_MODE=true
|
||||
# tar.gz AppImage
|
||||
ls -l
|
||||
mkdir -p tmp/build
|
||||
tools/build-prepare.sh
|
||||
tools/build-release.sh ${{ matrix.ARCH }} ${{ steps.tag.outputs.tag }}
|
||||
|
||||
- name: View Directory
|
||||
run: |
|
||||
ls -l
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
||||
|
||||
build-deb:
|
||||
name: Build DEB Package
|
||||
needs:
|
||||
- build-src
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
# https://stackoverflow.com/questions/61096521/how-to-use-gpg-key-in-github-actions
|
||||
- name: Configure GPG Key
|
||||
run: |
|
||||
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
|
||||
env:
|
||||
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
sudo apt-get install -y build-essential fakeroot devscripts debhelper # debmake lintian pbuilder
|
||||
|
||||
- name: Build Deb Package
|
||||
run: |
|
||||
export BUILD_VERSION=${{ steps.tag.outputs.tag }}
|
||||
ls -l
|
||||
mkdir -p tmp/build
|
||||
export WINE=true
|
||||
tools/build-prepare.sh
|
||||
tools/build-deepin.sh ${{ steps.tag.outputs.tag }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
||||
|
||||
# build-arch:
|
||||
# name: Build ArchLinux Package
|
||||
# runs-on: ubuntu-latest
|
||||
# timeout-minutes: 30
|
||||
# strategy:
|
||||
# matrix:
|
||||
# node-version: [16.x]
|
||||
# ARCH: ['x86_64']
|
||||
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# with:
|
||||
# submodules: 'recursive'
|
||||
# - name: Use Node.js ${{ matrix.node-version }}
|
||||
# uses: actions/setup-node@v2
|
||||
# with:
|
||||
# node-version: ${{ matrix.node-version }}
|
||||
# cache: 'npm'
|
||||
|
||||
# - name: Prepare
|
||||
# run: |
|
||||
# cd compiler && npm install
|
||||
# npm install node-gyp nw-gyp npm -g
|
||||
# node-gyp install
|
||||
# cat /etc/passwd
|
||||
|
||||
# - name: Generate TAG
|
||||
# id: Tag
|
||||
# run: |
|
||||
# tag='continuous'
|
||||
# name='Continuous Build'
|
||||
# if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
# tag='${{ github.ref_name }}'
|
||||
# name='${{ github.ref_name }}'
|
||||
# fi
|
||||
# echo "tag result: $tag - $name"
|
||||
# echo "::set-output name=tag::$tag"
|
||||
# echo "::set-output name=name::$name"
|
||||
|
||||
# - name: Build ArchLinux Package
|
||||
# uses: countstarlight/arch-makepkg-action@master
|
||||
# env:
|
||||
# BUILD_VERSION: ${{ steps.tag.outputs.tag }}
|
||||
# WINE: true
|
||||
# with:
|
||||
# repos: >
|
||||
# archlinuxcn=https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
|
||||
# before: "tools/build-aur.sh && sudo pacman -S --noconfirm archlinuxcn-keyring"
|
||||
# packages: >
|
||||
# gconf
|
||||
# p7zip
|
||||
# libxkbfile
|
||||
# python2
|
||||
# openssl
|
||||
# gcc
|
||||
# make
|
||||
# libssh2
|
||||
# krb5
|
||||
# wget
|
||||
# scripts: "cd tmp/AUR && makepkg && ls -l && cd ../../"
|
||||
|
||||
# - name: Fix Permissions
|
||||
# run: |
|
||||
# sudo chmod -R 0777 tmp
|
||||
# mkdir -p tmp/build
|
||||
# mv tmp/AUR/*.pkg.* tmp/build
|
||||
# cd tmp/build
|
||||
# for file in `ls *.pkg.*`;do mv $file `echo $file|sed 's/:/-/g'`;done;
|
||||
# ls -l
|
||||
|
||||
# - name: Upload artifact
|
||||
# uses: actions/upload-artifact@v2.3.1
|
||||
# with:
|
||||
# # Artifact name
|
||||
# name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
# path: tmp/build
|
||||
|
||||
# build-snap:
|
||||
# name: Build Snap Package
|
||||
# runs-on: ubuntu-18.04
|
||||
# timeout-minutes: 30
|
||||
# strategy:
|
||||
# matrix:
|
||||
# node-version: [16.x]
|
||||
# ARCH: ['x86_64']
|
||||
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# with:
|
||||
# submodules: 'recursive'
|
||||
# - name: Install Snapcraft
|
||||
# uses: samuelmeuli/action-snapcraft@v1
|
||||
# with:
|
||||
# use_lxd: true
|
||||
|
||||
# - name: Prepare
|
||||
# run: |
|
||||
# cd compiler && npm install
|
||||
# git --version
|
||||
# git --help
|
||||
|
||||
# # You can now run Snapcraft shell commands
|
||||
# - name: Build snap
|
||||
# run: sg lxd -c 'snapcraft --use-lxd'
|
||||
|
||||
# - name: move file
|
||||
# run: |
|
||||
# mkdir -p tmp/build
|
||||
# mv *.snap tmp/build
|
||||
# - name: Upload artifact
|
||||
# uses: actions/upload-artifact@v2.3.1
|
||||
# with:
|
||||
# # Artifact name
|
||||
# name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
# path: tmp/build
|
||||
|
||||
upload:
|
||||
name: Create release and upload artifacts
|
||||
needs:
|
||||
- build-tar
|
||||
- build-deb
|
||||
# - build-snap
|
||||
# - build-arch
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
- name: Inspect directory after downloading artifacts
|
||||
run: ls -alFR
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
|
||||
- name: Create release and upload artifacts
|
||||
if: startsWith(github.ref, 'refs/heads/')
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
|
||||
chmod +x pyuploadtool-x86_64.AppImage
|
||||
./pyuploadtool-x86_64.AppImage **build/WeChat*.AppImage **build/*.tar.gz **build/*.deb # **build/*.pkg.* **build/*.snap
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
# note you'll typically need to create a personal access token
|
||||
# with permissions to create releases in the other repo
|
||||
name: ${{ steps.tag.outputs.name }}
|
||||
tag_name: ${{ steps.tag.outputs.tag }}
|
||||
files: |
|
||||
**build/WeChat*.AppImage
|
||||
**build/*.tar.gz
|
||||
**build/*.deb
|
||||
# **build/*.pkg.*
|
||||
# **build/*.snap
|
329
.github/workflows/release.yml
vendored
329
.github/workflows/release.yml
vendored
@ -9,7 +9,11 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches: [ master, dev, 45-snap-version]
|
||||
branches: [ master, dev, ci, skyline]
|
||||
paths-ignore:
|
||||
- 'README.MD'
|
||||
- 'CHANGELOG.MD'
|
||||
- 'docs/**'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
# # Allows you to run this workflow manually from the Actions tab
|
||||
@ -17,329 +21,29 @@ on:
|
||||
|
||||
jobs:
|
||||
build-src:
|
||||
name: Build Base Packages
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
cd compiler && npm install
|
||||
echo "$UID, $GID"
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export ACTION_MODE=true
|
||||
export DOCKER_UID=$UID
|
||||
export DOCKER_GID=$GID
|
||||
ls -l
|
||||
export WINE=false
|
||||
docker-compose up
|
||||
|
||||
- name: Compress Resources
|
||||
run: |
|
||||
ls -l
|
||||
mkdir -p tmp/src
|
||||
rm -rf nwjs/node nwjs/node.exe
|
||||
cp node/bin/node nwjs/node
|
||||
cd nwjs && ln -s node node.exe
|
||||
cd ..
|
||||
tar -zcf tmp/src/src-linux.tar.gz bin nwjs package.nw tools
|
||||
|
||||
- name: Compress nodegit compiler
|
||||
run: |
|
||||
ls -l
|
||||
mkdir -p tmp/build
|
||||
cp -r package.nw/node_modules/nodegit .
|
||||
sudo rm -rf compiler/test
|
||||
tar -zcf compiler.tar.gz compiler
|
||||
tar -zcf nodegit.tar.gz nodegit
|
||||
mv nodegit.tar.gz tmp/build
|
||||
mv compiler.tar.gz tmp/build
|
||||
cd tmp/build
|
||||
ls -l
|
||||
|
||||
- name: View Directory
|
||||
run: |
|
||||
ls -l
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.src
|
||||
path: tmp/src
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
||||
|
||||
uses: ./.github/workflows/build-src.yml
|
||||
secrets: inherit
|
||||
build-tar:
|
||||
name: Build tar.gz AppImage
|
||||
needs:
|
||||
- build-src
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
cd compiler && npm install
|
||||
echo "$UID, $GID"
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export WINE=false
|
||||
export ACTION_MODE=true
|
||||
# tar.gz AppImage
|
||||
ls -l
|
||||
mkdir -p tmp/build
|
||||
tools/build-prepare.sh
|
||||
tools/build-release.sh ${{ matrix.ARCH }} ${{ steps.tag.outputs.tag }}
|
||||
|
||||
- name: View Directory
|
||||
run: |
|
||||
ls -l
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
||||
|
||||
uses: ./.github/workflows/build-tar.yml
|
||||
secrets: inherit
|
||||
build-deb:
|
||||
name: Build DEB Package
|
||||
needs:
|
||||
- build-src
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
# https://stackoverflow.com/questions/61096521/how-to-use-gpg-key-in-github-actions
|
||||
- name: Configure GPG Key
|
||||
run: |
|
||||
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
|
||||
env:
|
||||
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
sudo apt-get install -y build-essential fakeroot devscripts debhelper # debmake lintian pbuilder
|
||||
|
||||
- name: Build Deb Package
|
||||
run: |
|
||||
export BUILD_VERSION=${{ steps.tag.outputs.tag }}
|
||||
ls -l
|
||||
mkdir -p tmp/build
|
||||
export WINE=false
|
||||
tools/build-prepare.sh
|
||||
env WINE=false tools/build-deepin.sh ${{ steps.tag.outputs.tag }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
||||
|
||||
build-arch:
|
||||
name: Build ArchLinux Package
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
cd compiler && npm install
|
||||
npm install node-gyp nw-gyp npm -g
|
||||
node-gyp install
|
||||
cat /etc/passwd
|
||||
|
||||
- name: Generate TAG
|
||||
id: Tag
|
||||
run: |
|
||||
tag='continuous'
|
||||
name='Continuous Build'
|
||||
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
||||
tag='${{ github.ref_name }}'
|
||||
name='${{ github.ref_name }}'
|
||||
fi
|
||||
echo "tag result: $tag - $name"
|
||||
echo "::set-output name=tag::$tag"
|
||||
echo "::set-output name=name::$name"
|
||||
|
||||
- name: Build ArchLinux Package
|
||||
uses: countstarlight/arch-makepkg-action@master
|
||||
env:
|
||||
BUILD_VERSION: ${{ steps.tag.outputs.tag }}
|
||||
with:
|
||||
repos: >
|
||||
archlinuxcn=https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
|
||||
before: "tools/build-aur.sh && sudo pacman -S --noconfirm archlinuxcn-keyring"
|
||||
packages: >
|
||||
gconf
|
||||
p7zip
|
||||
libxkbfile
|
||||
python2
|
||||
openssl
|
||||
gcc
|
||||
make
|
||||
libssh2
|
||||
krb5
|
||||
wget
|
||||
scripts: "cd tmp/AUR && makepkg && ls -l && cd ../../"
|
||||
|
||||
- name: Fix Permissions
|
||||
run: |
|
||||
sudo chmod -R 0777 tmp
|
||||
mkdir -p tmp/build
|
||||
mv tmp/AUR/*.pkg.* tmp/build
|
||||
cd tmp/build
|
||||
for file in `ls *.pkg.*`;do mv $file `echo $file|sed 's/:/-/g'`;done;
|
||||
ls -l
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
||||
|
||||
build-snap:
|
||||
name: Build Snap Package
|
||||
runs-on: ubuntu-18.04
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
ARCH: ['x86_64']
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
- name: Install Snapcraft
|
||||
uses: samuelmeuli/action-snapcraft@v1
|
||||
with:
|
||||
use_lxd: true
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
cd compiler && npm install
|
||||
git --version
|
||||
git --help
|
||||
|
||||
# You can now run Snapcraft shell commands
|
||||
- name: Build snap
|
||||
run: sg lxd -c 'snapcraft --use-lxd'
|
||||
|
||||
- name: move file
|
||||
run: |
|
||||
mkdir -p tmp/build
|
||||
mv *.snap tmp/build
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2.3.1
|
||||
with:
|
||||
# Artifact name
|
||||
name: wechat-devtools-${{ matrix.ARCH }}.build
|
||||
path: tmp/build
|
||||
|
||||
uses: ./.github/workflows/build-deb.yml
|
||||
secrets: inherit
|
||||
upload:
|
||||
name: Create release and upload artifacts
|
||||
needs:
|
||||
- build-tar
|
||||
- build-deb
|
||||
- build-snap
|
||||
- build-arch
|
||||
# - build-snap
|
||||
# - build-arch
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
- name: Inspect directory after downloading artifacts
|
||||
run: ls -alFR
|
||||
|
||||
@ -361,9 +65,10 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
sudo apt install -y fuse
|
||||
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
|
||||
chmod +x pyuploadtool-x86_64.AppImage
|
||||
./pyuploadtool-x86_64.AppImage **build/WeChat*.AppImage **build/*.tar.gz **build/*.deb **build/*.pkg.* **build/*.snap
|
||||
./pyuploadtool-x86_64.AppImage **build/WeChat*.AppImage **build/*.tar.gz **build/*.deb
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
@ -377,5 +82,3 @@ jobs:
|
||||
**build/WeChat*.AppImage
|
||||
**build/*.tar.gz
|
||||
**build/*.deb
|
||||
**build/*.pkg.*
|
||||
**build/*.snap
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "compiler"]
|
||||
path = compiler
|
||||
url = https://github.com/msojocs/wx-compiler
|
@ -1,50 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
# 检验版本号是否匹配
|
||||
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
|
||||
# 获取开发工具版本号与MD5
|
||||
VERSION_DATA=$( cat "$root_dir/conf/devtools_v" )
|
||||
VERSION_DATA=(${VERSION_DATA//,/ })
|
||||
TARGET_VERSION=${VERSION_DATA[0]}
|
||||
TARGET_VERSION_MD5=${VERSION_DATA[1]}
|
||||
|
||||
# 检查snapcraft主版本号是否正确
|
||||
SNAP_VERSION=$(grep -P "'\d+\.\d+\.\d{5,}" -o $root_dir/snap/snapcraft.yaml)
|
||||
if [ "${SNAP_VERSION//\'/}" != "$TARGET_VERSION" ];then
|
||||
echo "SNAP版本不正确!!!"
|
||||
echo "SNAP版本: ${SNAP_VERSION//\'/} != 目标版本: $TARGET_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查readme中的版本
|
||||
README_VERSION=$(grep -P '[\-`]\d+\.\d+\.\d{5,}[\-`]' -o "$root_dir/readme.md")
|
||||
for ver in $README_VERSION; do
|
||||
ver="${ver//[-\`]/}"
|
||||
if [ "${ver}" != "${TARGET_VERSION}" ];then
|
||||
echo "README中版本不正确!!!"
|
||||
echo "README中版本: ${ver} != 目标版本: ${TARGET_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# 检查snapcraft构建时下载的工具版本号是否正确
|
||||
SNAP_DEVTOOL_VERSION=$(cat $root_dir/snap/snapcraft.yaml | grep -P "=\d+\d+\d{5,}" -o)
|
||||
if [ "${SNAP_DEVTOOL_VERSION//=/}" != "${TARGET_VERSION//./}" ];then
|
||||
echo "SNAP工具版本不正确!!!"
|
||||
echo "snap下载版本: ${SNAP_DEVTOOL_VERSION//=/} != 目标版本: ${TARGET_VERSION//./}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 有当前版本的TAG,检查snap版本是否符合要求
|
||||
LATEST_TAG=$(git describe --abbrev=0)
|
||||
if [[ $LATEST_TAG == "v${TARGET_VERSION}"* ]];then
|
||||
SNAP_VERSION=$(grep -P "'\d+\.\d+\.\d+-\d+" -o $root_dir/snap/snapcraft.yaml)
|
||||
if [ "v${SNAP_VERSION//\'/}" != "$LATEST_TAG" ];then
|
||||
echo "SNAP版本与TAG不符!!!"
|
||||
echo "SNAP版本: v${SNAP_VERSION//\'/} != 最新TAG: $LATEST_TAG"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
6
.vscode/launch.json
vendored
6
.vscode/launch.json
vendored
@ -8,8 +8,8 @@
|
||||
"type": "nwjs",
|
||||
"request": "launch",
|
||||
"name": "Launch NWjs",
|
||||
"nwjsVersion": "0.49.3",
|
||||
"webRoot": "${workspaceFolder}/compiler/test/package.nw",
|
||||
"nwjsVersion": "0.55.0",
|
||||
"webRoot": "${workspaceFolder}/package.nw",
|
||||
"reloadAfterAttached": true,
|
||||
"runtimeArgs": [
|
||||
// "--load-extension=${workspaceFolder}/tmp/data/WeappPlugin",
|
||||
@ -21,7 +21,7 @@
|
||||
"LANG": "zh_CN.UTF-8"
|
||||
},
|
||||
"userDataDir": false,
|
||||
"runtimeExecutable": "${workspaceFolder}/cache/wechat_devtools_1.05.2203070_x64/wechatdevtools.exe"
|
||||
"runtimeExecutable": "${workspaceFolder}/nwjs/nw"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,4 +1,118 @@
|
||||
# 1.06.2209070-1 / 2022-09-
|
||||
# 1.06.2504010-3 / 2025-07-
|
||||
- refactor: 重构主题监听处理方案
|
||||
|
||||
# 1.06.2504010-2 / 2025-07-15
|
||||
- fix: cli使用异常。#147
|
||||
|
||||
# 1.06.2504010-1 / 2025-07-05
|
||||
- fix: 更新弹窗无法关闭。
|
||||
- update: devtools to v1.06.2504010
|
||||
|
||||
# 1.06.2503290-3 / 2025-05-23
|
||||
- update: compiler(Linux) v0.1.5
|
||||
- fix: worker无法使用 #145
|
||||
|
||||
# 1.06.2503290-2 / 2025-05-02
|
||||
- update: compiler(Linux) v0.1.4
|
||||
|
||||
# 1.06.2503290-1 / 2025-04-30
|
||||
|
||||
- update: node v16.11.0 (解决codebuddy无法使用。)
|
||||
- perf: 替换float-pigment。
|
||||
- update: devtools to v1.06.2503290
|
||||
|
||||
# 1.06.2412050-2 / 2025-02-17
|
||||
|
||||
- update: compiler(Linux) v0.1.3
|
||||
|
||||
# 1.06.2412050-1 / 2025-02-16
|
||||
|
||||
- update: devtools to v1.06.2412050
|
||||
- update: compiler(Linux) v0.1.2
|
||||
|
||||
# 1.06.2412040-1 / 2025-01-16
|
||||
|
||||
- update: devtools to v1.06.2412040
|
||||
|
||||
# 1.06.2409140-3 / 2024-11-16
|
||||
|
||||
- fix: 多开实例会出现卡死的情况
|
||||
|
||||
# 1.06.2409140-2 / 2024-11-15
|
||||
|
||||
- perf: 不对Skyline插件进行初始化(不会弹窗)
|
||||
|
||||
# 1.06.2409140-1 / 2024-10-26
|
||||
|
||||
- update: devtools to v1.06.2409140
|
||||
|
||||
# 1.06.2407120-1 / 2024-09-28
|
||||
|
||||
- update: devtools to v1.06.2407120
|
||||
|
||||
# 1.06.2405020-4 / 2024-09-28
|
||||
|
||||
- fix: 视频无法播放的问题(#118)
|
||||
|
||||
# 1.06.2405020-3 / 2024-08-10
|
||||
|
||||
- update: compiler(Linux) v0.1.1
|
||||
|
||||
# 1.06.2405020-2 / 2024-07-13
|
||||
|
||||
- fix: mock 面板按钮点击无反应
|
||||
- update: compiler(Linux) v0.1.0
|
||||
|
||||
# 1.06.2405020-1 / 2024-07-07
|
||||
|
||||
- update: devtools to v1.06.2405020
|
||||
- update: compiler(Linux) v0.0.9
|
||||
|
||||
# 1.06.2402040-1 / 2024-05-03
|
||||
|
||||
- update: devtools to v1.06.2402040
|
||||
|
||||
# 1.06.2310080-2 / 2024-01-02
|
||||
|
||||
- fix: AppImage的cli使用会闪退
|
||||
|
||||
# 1.06.2310080-1 / 2023-12-30
|
||||
|
||||
- fix: AppImage的cli使用会闪退
|
||||
- update: devtools to v1.06.2310080
|
||||
|
||||
# 1.06.2308310-3 / 2023-12-24
|
||||
|
||||
- update: compiler(Linux) v0.0.7
|
||||
|
||||
# 1.06.2308310-2 / 2023-11-10
|
||||
|
||||
- update: compiler(Linux) v0.0.6
|
||||
|
||||
# 1.06.2308310-1 / 2023-09-30
|
||||
|
||||
- update: devtools to v1.06.2308310
|
||||
|
||||
# 1.06.2307260-2 / 2023-09-23
|
||||
|
||||
- update: compiler(Linux) v0.0.5
|
||||
|
||||
# 1.06.2307260-1 / 2023-09-09
|
||||
|
||||
- update: node-pty to v1.0.0
|
||||
- update: devtools to v1.06.2307260
|
||||
- update: compiler(Linux) v0.0.4
|
||||
- dprecated: wine version
|
||||
|
||||
# 1.06.2306020-1 / 2023-06-04
|
||||
|
||||
- update: devtools to v1.06.2306020
|
||||
|
||||
# 1.06.2301040-1 / 2023-01-21
|
||||
|
||||
- update: devtools to v1.06.2301040
|
||||
|
||||
# 1.06.2209070-1 / 2022-09-09
|
||||
|
||||
- update: devtools to v1.06.2209070
|
||||
|
@ -10,11 +10,10 @@
|
||||
----
|
||||
|
||||
[](https://github.com/msojocs/wechat-devtools-linux/actions/workflows/release.yml)
|
||||
[](https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html)
|
||||
[](https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html)
|
||||
[](https://nwjs.io/downloads/)
|
||||
[](https://nodejs.org/en/)
|
||||
[](https://aur.archlinux.org/packages/wechat-devtools)
|
||||
[](https://snapcraft.io/wechat-devtools)
|
||||
[](https://nodejs.org/en/)
|
||||
|
||||
|
||||
这是微信开发者工具 Linux版
|
||||
|
||||
@ -35,7 +34,7 @@
|
||||
|
||||
# 进度
|
||||
|
||||
当前工具可以在Linux上构筑最新版 `1.06.2209070`,支持CLI模式。
|
||||
当前工具可以在Linux上构筑最新版 `1.06.2503290`,支持CLI模式。
|
||||
另现在已经可以直接在设置界面里面修改字体,手工输入字体名称就可以。
|
||||
|
||||
# 功能测试记录
|
||||
@ -51,8 +50,8 @@
|
||||
# 系统要求
|
||||
|
||||
* 基于Linux的桌面系统,首选GNOME(其他的桌面环境可能会有问题,未测试)
|
||||
* CI自动构建的包对 glibc 和 libstdc++ 有一定的版本要求,glibc 的版本要求2.23,libstdc++ 的版本要求3.4.21
|
||||
* 如果你下载的是 `wine` 版本,那么你需要安装有 `wine` `wine-binfmt` 支持,建议版本在5.0以上,低版本可能会存在有问题
|
||||
* CI自动构建的包对 glibc 和 libstdc++ 有一定的版本要求,glibc 的版本要求>=2.23,libstdc++ 的版本要求>=3.4.21
|
||||
* ~~如果你下载的是 `wine` 版本,那么你需要安装有 `wine` `wine-binfmt` 支持,建议版本在5.0以上,低版本可能会存在有问题~~
|
||||
|
||||
# CLI支持
|
||||
|
||||
@ -69,14 +68,12 @@
|
||||
|
||||
目前支持以下平台:
|
||||
|
||||
1. [AUR](https://aur.archlinux.org/packages/wechat-devtools)
|
||||
2. [Snap Store](https://snapcraft.io/wechat-devtools)
|
||||
3. 统信商店(家庭版)、深度商店(社区版)
|
||||
1. 统信应用商店(deepin)
|
||||
|
||||
# 自行构建
|
||||
|
||||
> 注:
|
||||
> 如果想构建 wine 版本,请添加环境变量:`export WINE=true`
|
||||
> 如果想构建 wine 版本,请添加环境变量:`export WINE=true` 。注意:不受支持。
|
||||
|
||||
## 方法0(推荐)
|
||||
|
||||
@ -88,9 +85,9 @@
|
||||
```
|
||||
git clone --recurse-submodules https://github.com/msojocs/wechat-web-devtools-linux.git
|
||||
```
|
||||
4. 在本地项目目录中执行如下的语句,构筑开发者工具:
|
||||
4. 在本地项目目录中执行如下的语句,构建开发者工具:
|
||||
```
|
||||
docker-compose up
|
||||
tools/build-with-docker.sh
|
||||
```
|
||||
5. 在本地项目目录中执行如下的语句,可以安装应用图标(非必须):
|
||||
```
|
||||
@ -106,18 +103,18 @@
|
||||
1. 如果构建 `wine` 版本,请先在Linux环境中自行安装 `wine` `wine-binfmt`;
|
||||
2. 安装编译 `nodegit` 所需的依赖:`python2.7 python3.6及以上 libkrb5-dev gcc openssl libssh2-1-dev g++ make pkg-config` ;
|
||||
|
||||
另外 `7z` 旧版解压可能存在问题(未测试最低版本号,比如:ubuntu16.04 自带的不行),请参考 `Dockerfile`
|
||||
另外 `7z` 旧版解压可能存在问题(未测试最低版本号,比如:ubuntu16.04 自带的不行),请参考[`Dockerfile`](docker/Dockerfile)
|
||||
3. 克隆本项目:
|
||||
```
|
||||
git clone --recurse-submodules https://github.com/msojocs/wechat-web-devtools-linux.git
|
||||
```
|
||||
4. 在本地项目目录中执行如下的语句,构筑开发者工具:
|
||||
4. 在本地项目目录中执行以下命令,构建开发者工具:
|
||||
```
|
||||
./tools/setup-wechat-devtools-bash
|
||||
```
|
||||
5. 在本地项目目录中执行如下的语句,可以安装应用图标(非必须):
|
||||
```
|
||||
./tools/install-desktop-icon-node
|
||||
./tools/install-desktop-icon-bash
|
||||
```
|
||||
|
||||
之后即可通过点击应用图标启动微信开发者工具,也可以运行 `bin/wechat-devtools` 通过命令行启动
|
||||
@ -129,7 +126,7 @@
|
||||
3. 修复了nwjs上关于Menu的段错误,确保最新版本可以正常启动 (by dragonation);
|
||||
4. 在构筑过程中会重新编译node_modules,确保原生模块可以在Linux上正确运行;
|
||||
5. 下载更新可以支持断点再续,并使用了taobao国内的npm源,加速下载(稳定性待测试)。
|
||||
6. 纯 Linux 支持,使用 nodejs 实现模拟官方编译器
|
||||
6. 纯 Linux 支持,使用 cpp 实现模拟官方编译器。[wx-compiler](https://github.com/msojocs/wx-compiler)
|
||||
|
||||
# 后续计划
|
||||
|
||||
@ -156,30 +153,61 @@
|
||||
|
||||
# 赞赏
|
||||
|
||||
如果这个仓库让你感到舒适,可以点个Star或者请这个菜鸡大学生喝杯咖啡(请尽量带上github昵称):
|
||||
如果这个仓库让你感到舒适,可以点个Star或者请这个 ~~菜鸡大学生~~ 打工人喝杯咖啡(请尽量带上github昵称):
|
||||
|
||||

|
||||
|
||||
# 感谢赞赏支持
|
||||
|
||||
| 赞赏人 | 赞赏金额 |
|
||||
|-------|---------|
|
||||
| Milder | 50.00¥ |
|
||||
| [Starrah](https://github.com/Starrah) | 50.00¥ |
|
||||
| 仙人柱 | 50.00¥ |
|
||||
| . | 20.00¥ |
|
||||
| [icepie](https://github.com/icepie) | 20.00¥ |
|
||||
| 南极の短尾猫 | 20.00¥ |
|
||||
| [younland](https://github.com/younland) | 20.00¥ |
|
||||
| [guanzhengyinqin](https://github.com/guanzhengyinqin) | 20.00¥ |
|
||||
| 李喆 | 10.00¥ |
|
||||
| 陈陈菌 | 10.00¥ |
|
||||
| [chiiihc](https://github.com/chiiihc) | 10.00¥ |
|
||||
| [nsfoxer](https://github.com/nsfoxer) | 10.00¥ |
|
||||
| shaoxp | 5.00¥ |
|
||||
| david | 5.00¥ |
|
||||
| [zyk-miao](https://github.com/zyk-miao) | 5.00¥ |
|
||||
| [CoryByte](https://github.com/Corybyte) | 5.00¥ |
|
||||
时间倒序
|
||||
|
||||
| 赞赏人 | 赞赏 | 时间 |
|
||||
|-------|---------|-----|
|
||||
| returning | 10.00¥ | 2025-07-12 |
|
||||
| 👍 | 10.00¥ | 2025-07-10 |
|
||||
| hanwor | 20.00¥ | 2025-06-17 |
|
||||
| 。。。 | 10.00¥ | 2025-03-29 |
|
||||
| SakuraPuare | 20.00¥ | 2025-03-24 |
|
||||
| [senseab](https://github.com/senseab) | 50.00¥ | 2024-12-21 |
|
||||
| l | 10.00¥ | 2024-12-08 |
|
||||
| lcurk0 | 50.00¥ | 2024-11-29 |
|
||||
| [stvsl](https://github.com/stvsl) | 10.00¥ | 2024-11-26 |
|
||||
| 仙人柱 | 50.00¥ | 2024-11-20 |
|
||||
| [cabbage7th](https://github.com/cabbage7th) | 20.00¥ | 2024-10-06 |
|
||||
| [shao4598](https://github.com/shao4598) | 50.00¥ | 2024-09-24 |
|
||||
| [OWALabuy](https://github.com/OWALabuy) | 16.66¥ | 2024-08-28 |
|
||||
| [wangvation](https://github.com/wangvation) | 50.00¥ | 2024-07-16 |
|
||||
| 孤泉冷月 | 100.00¥ | 2024-07-12 |
|
||||
| [liushuai05](https://github.com/liushuai05) | 88.00¥ | 2023-12-26 |
|
||||
| LGTU | 10.00¥ | 2023-11-25 |
|
||||
| [WRXinYue](https://github.com/WRXinYue) | 10 | 2023-11-09 |
|
||||
| silentdoer | 50.00¥ | 2023-09-26 |
|
||||
| ??? | 20 |2023-08-11 |
|
||||
| Geequlim | 100 | 2023-07-12 |
|
||||
| 对方正在输入 | 10 | 2023-04-28 |
|
||||
| @DaqiongYang | 50 | 2023-03-29 |
|
||||
| AInoob | 5 | 2023-01-30 |
|
||||
| ??? | 5 | 2023-01-18 |
|
||||
| 仙人柱 | 50.00¥ | 2022-08-09 |
|
||||
| [guanzhengyinqin](https://github.com/guanzhengyinqin) | 20.00¥ | 2022-07-14 |
|
||||
| [nsfoxer](https://github.com/nsfoxer) | 10.00¥ | 2022-06-30 |
|
||||
| [chiiihc](https://github.com/chiiihc) | 5.00¥ | 2022-06-17 |
|
||||
| [younland](https://github.com/younland) | 20.00¥ | 2022-06-15 |
|
||||
| [chiiihc](https://github.com/chiiihc) | 5.00¥ | 2022-06-14 |
|
||||
| 陈陈菌 | 10.00¥ | 2022-05-29 |
|
||||
| WWW | 5.00¥ | 2022-05-26 |
|
||||
| 南极の短尾猫 | 20.00¥ | 2022-05-22 |
|
||||
| 猪宝的猪 | 20.00¥ | 2022-05-15 |
|
||||
| finalwhy | 66.60¥ | 2022-05-09 |
|
||||
| [CoryByte](https://github.com/Corybyte) | 5.00¥ | 2022-04-23 |
|
||||
| [Starrah](https://github.com/Starrah) | 50.00¥ | 2022-04-12 |
|
||||
| [zyk-miao](https://github.com/zyk-miao) | 5.00¥ | 2022-04-12 |
|
||||
| [icepie](https://github.com/icepie) | 20.00¥ | 2022-04-08 |
|
||||
| Milder | 50.00¥ | 2022-03-23 |
|
||||
| . | 20.00¥ | 2022-03-21 |
|
||||
| shaoxp | 5.00¥ | 2022-03-16 |
|
||||
| 李喆 | 10.00¥ | 2022-03-05 |
|
||||
| david | 5.00¥ | ??? |
|
||||
|
||||
# 免责声明
|
||||
|
@ -53,11 +53,11 @@ else
|
||||
fi;
|
||||
|
||||
EXTENSION1="--load-extension=$root_dir/nwjs/package.nw/js/ideplugin"
|
||||
EXTENSION2=--load-extension=$APPDATA/WeappPlugin
|
||||
EXTENSION2="--load-extension=$APPDATA/WeappPlugin/inspector"
|
||||
INSPECTOR1="--custom-devtools-frontend=file://$root_dir/package.nw/js/ideplugin/inspector" # 要加file://指明为本地文件路径
|
||||
INSPECTOR2="--custom-devtools-frontend=file://$APPDATA/WeappPlugin/inspector/"
|
||||
USERDATADIR="$APPDATA"
|
||||
|
||||
# "$@"参数
|
||||
LANG=zh_CN.UTF-8
|
||||
exec "$root_dir/nwjs/nw" $root_dir/package.nw $EXTENSION2 $INSPECTOR1 "$@"
|
||||
exec "$root_dir/nwjs/nw" $root_dir/package.nw $EXTENSION1 $INSPECTOR1 "$@"
|
@ -8,10 +8,14 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
|
||||
done
|
||||
root_dir="$( cd -P "$( dirname "$SOURCE" )"/.. >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd $root_dir
|
||||
cd $root_dir/bin
|
||||
|
||||
export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs"
|
||||
export APPDATA="$root_dir/nwjs"
|
||||
export PATH="$root_dir/node/bin:$root_dir/nwjs:$PATH"
|
||||
|
||||
node $root_dir/package.nw/js/common/cli/index.js "$@"
|
||||
if [ ! -z "$APPIMAGE" ];then
|
||||
# AppImage在程序退出后会删除相关程序文件,导致无法启动
|
||||
tail -f /etc/issue
|
||||
fi
|
1
compiler
1
compiler
@ -1 +0,0 @@
|
||||
Subproject commit a780f231d31025a37667a70f82d8cde0cec8836d
|
1
conf/compiler_version
Normal file
1
conf/compiler_version
Normal file
@ -0,0 +1 @@
|
||||
WX_COMPILER_VERSION=v0.1.5
|
@ -1 +1 @@
|
||||
1.06.2209070,8c6be639c117f8c8e6493d335bb17eee
|
||||
1.06.2504010,6a579ac93961fbfe04774b26f0c85b78
|
@ -1,6 +1,6 @@
|
||||
# 此处版本应与nwjs使用的node版本一致
|
||||
if [ -z $NODE_VERSION ];then
|
||||
NODE_VERSION=16.4.2
|
||||
NODE_VERSION=16.11.0
|
||||
fi
|
||||
NODE_URL_CN=https://npmmirror.com/mirrors/node/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz
|
||||
NODE_URL_GLOBAL=https://nodejs.org/download/release/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz
|
||||
|
@ -1,19 +0,0 @@
|
||||
version: "3"
|
||||
services:
|
||||
wechat_devtools:
|
||||
image: jiyecafe/wechat-devtools-build:v3
|
||||
# build:
|
||||
# context: ./docker
|
||||
# dockerfile: Dockerfile
|
||||
volumes:
|
||||
- .:/workspace
|
||||
- ./cache/.npm:/root/.npm
|
||||
environment:
|
||||
- ACTION_MODE=${ACTION_MODE:-false}
|
||||
# - https_proxy=${https_proxy:-}
|
||||
- WINE=${WINE:-false}
|
||||
- LOCAL_USER_ID=${DOCKER_UID:-1000}
|
||||
- LOCAL_GROUP_ID=${DOCKER_GID:-1000}
|
||||
- BUILD_VERSION=${BUILD_VERSION:-v0}
|
||||
entrypoint: /workspace/docker/docker-entrypoint
|
||||
userns_mode: "host"
|
@ -4,6 +4,7 @@ WORKDIR /workspace
|
||||
|
||||
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
|
||||
sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
|
||||
sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
|
||||
sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
|
||||
mkdir -p /build_temp/python36 /build_temp/nodejs && \
|
||||
apt update && \
|
||||
@ -27,7 +28,7 @@ RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
|
||||
./setup_16.x &&\
|
||||
apt-get install -y nodejs &&\
|
||||
rm -rf /build_temp && \
|
||||
apt install -y gosu && \
|
||||
apt install -y gosu unzip python && \
|
||||
gosu nobody true && \
|
||||
useradd -s /bin/bash -m user
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC
|
||||
strings /lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC_2.2
|
||||
|
||||
notice() {
|
||||
echo -e "\033[36m $1 \033[0m "
|
||||
}
|
||||
|
||||
rm -rf /tmp/vscode-ripgrep-cache-1.13.2/ripgrep-v13.0.0-4-x86_64-unknown-linux-musl.tar.gz
|
||||
|
||||
if [ "$(id -u)" -eq '0' ];then
|
||||
USER_ID=${LOCAL_USER_ID:-1000}
|
||||
GROUP_ID=${LOCAL_GROUP_ID:-1000}
|
||||
notice "$USER_ID, $GROUP_ID"
|
||||
usermod -u ${USER_ID} -g ${GROUP_ID} user > /dev/null 2>&1
|
||||
chown -R ${USER_ID}:${GROUP_ID} /workspace > /dev/null 2>&1
|
||||
|
||||
# ls -l
|
||||
# cat /etc/passwd
|
||||
exec gosu user docker/entrypoint
|
||||
|
||||
fi
|
||||
|
||||
echo "nothing"
|
||||
# exec /usr/local/bin/gosu user entrypoint
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # 命令出错就退出
|
||||
trap 'catchError $LINENO $BASH_COMMAND' SIGHUP SIGINT SIGQUIT EXIT # 捕获错误情况
|
||||
trap 'catchError $LINENO $BASH_COMMAND' ERR # 捕获错误情况
|
||||
|
||||
catchError() {
|
||||
exit_code=$?
|
||||
@ -24,10 +24,11 @@ python --version
|
||||
echo "docker node version: $( node --version )"
|
||||
|
||||
cd /workspace
|
||||
rm -rf node nwjs package.nw
|
||||
export HOME="/tmp/home"
|
||||
mkdir -p /tmp/home
|
||||
#
|
||||
# exec ./tools/rebuild-node-modules 0.53.1
|
||||
./tools/setup-wechat-devtools-bash
|
||||
./tools/setup-wechat-devtools.sh
|
||||
|
||||
# chmod -R 777 tmp node nwjs package.nw
|
||||
# ls -l package.nw
|
||||
|
@ -1,183 +0,0 @@
|
||||
app-id: io.github.msojocs.wechat-devtools
|
||||
runtime: org.freedesktop.Platform
|
||||
runtime-version: '21.08'
|
||||
sdk: org.freedesktop.Sdk
|
||||
sdk-extensions:
|
||||
- org.freedesktop.Sdk.Extension.node12
|
||||
command: startup
|
||||
finish-args:
|
||||
# X11 + XShm access
|
||||
- --share=ipc
|
||||
- --socket=x11
|
||||
# Wayland access
|
||||
- --socket=wayland
|
||||
# Needs to talk to the network:
|
||||
- --share=network
|
||||
# Needs to save files locally
|
||||
- --filesystem=host
|
||||
- --metadata=X-DConf=migrate-path=/io/github/msojocs/wechat-devtools
|
||||
modules:
|
||||
- name: nwjs
|
||||
buildsystem: simple
|
||||
sources:
|
||||
- type: archive
|
||||
url: http://npmmirror.com/mirrors/nwjs/v0.55.0/nwjs-sdk-v0.55.0-linux-x64.tar.gz
|
||||
md5: ac7680788544c457daee11aaf69798fe
|
||||
build-commands:
|
||||
- ls -l
|
||||
- mkdir -p /app/opt/nwjs
|
||||
- mv * /app/opt/nwjs
|
||||
|
||||
- name: package.nw
|
||||
buildsystem: simple
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1062207210&version_type=1
|
||||
md5: 7599cfeeebb57bda7ae5594daf2e0659
|
||||
archive-type: 7z
|
||||
path: code
|
||||
strip-components: 0
|
||||
dest-filename: wechat_devtools.7z
|
||||
build-commands:
|
||||
- ls -l
|
||||
- mv code/package.nw /app/opt/package.nw
|
||||
|
||||
- name: nodejs
|
||||
buildsystem: simple
|
||||
build-options:
|
||||
prepend-path: /app/opt/nodejs/bin
|
||||
build-args:
|
||||
- --share=network
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://npmmirror.com/mirrors/node/v16.1.0/node-v16.1.0-linux-x64.tar.gz
|
||||
md5: 2280bfbbf29981fd5adce334f40146ff
|
||||
build-commands:
|
||||
- ls -l
|
||||
- mkdir -p /app/opt/nodejs
|
||||
- mv * /app/opt/nodejs
|
||||
- npm config set registry https://registry.npmmirror.com # 注册模块镜像
|
||||
- npm config set disturl https://npmmirror.com/dist # node-gyp 编译依赖的 node 源码镜像
|
||||
- npm install -g npm@8.6.0
|
||||
- npm --version
|
||||
- npm -g install nw-gyp node-gyp
|
||||
|
||||
- name: library
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- for file in *.deb; do ar p $file data.tar.xz | tar -xJ; done;
|
||||
post-install:
|
||||
- rm -rf usr/share/{doc,man}
|
||||
- cp -dr usr/* $FLATPAK_DEST/
|
||||
# - cp -dr lib/* $FLATPAK_DEST/lib
|
||||
# - cp -dr opt/* $FLATPAK_DEST/
|
||||
sources:
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libkrb5-dev_1.18.3-6+deb11u1_amd64.deb
|
||||
sha256: d3a4a4705329c51d7a9843a72f87421938eeeef8548b3f2d46ce83f0862f9311
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/krb5-multidev_1.18.3-6+deb11u1_amd64.deb
|
||||
sha256: b8bbee0879e6041ebbf58f62e1a526cc25225d67c140d5593b1341cc31388351
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libkrb5-3_1.18.3-6+deb11u1_amd64.deb
|
||||
sha256: afb9dced3fcbdbc439a166eaa217dbfd485585842f12ce4587123009618e8bfe
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libk5crypto3_1.18.3-6+deb11u1_amd64.deb
|
||||
sha256: 4a010fc69322b6be9e141a76593f46e6588c968ee3b7cf79a3b8b7efda9aeeba
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libgssapi-krb5-2_1.18.3-6+deb11u1_amd64.deb
|
||||
sha256: 2ab853cbd0494c06fa694906c6eeea4df79720f461c76d080eb21a3e98f44115
|
||||
|
||||
- name: build
|
||||
buildsystem: simple
|
||||
build-options:
|
||||
ldflags: -L/app/lib/x86_64-linux-gnu
|
||||
prepend-path: /app/opt/nodejs/bin:/usr/lib/sdk/node12/bin
|
||||
build-args:
|
||||
- --share=network
|
||||
prepend-ld-library-path: /app/lib/x86_64-linux-gnu
|
||||
env:
|
||||
- WINE=false
|
||||
sources:
|
||||
# - type: git
|
||||
# branch: dev
|
||||
# url: https://github.com/msojocs/wechat-web-devtools-linux.git
|
||||
- type: dir
|
||||
path: tools
|
||||
dest: tools
|
||||
- type: dir
|
||||
path: compiler
|
||||
dest: compiler
|
||||
build-commands:
|
||||
# - ln -s /app/opt/package.nw package.nw
|
||||
- cp -r /app/opt/package.nw .
|
||||
- cd package.nw && ls -l
|
||||
- python --version
|
||||
- python3 --version
|
||||
- python2 --version
|
||||
- node --version
|
||||
- tools/fix-package-name.js
|
||||
- tools/fix-selection-copy-node
|
||||
- tools/fix-cli.sh
|
||||
- tools/fix-core.sh
|
||||
- tools/fix-menu.sh
|
||||
- tools/fix-other.sh
|
||||
- tools/rebuild-node-modules.sh 0.55.0
|
||||
# - ls -l
|
||||
post-install:
|
||||
- rm -rf /app/opt/package.nw
|
||||
- cp -r package.nw /app/opt
|
||||
|
||||
- name: library
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- for file in *.deb; do ar p $file data.tar.xz | tar -xJ; done;
|
||||
post-install:
|
||||
- rm -rf usr/share/{doc,man}
|
||||
- cp -dr usr/* $FLATPAK_DEST/
|
||||
- cp -dr lib/* $FLATPAK_DEST/lib
|
||||
# - cp -dr opt/* $FLATPAK_DEST/
|
||||
sources:
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libgssapi-krb5-2_1.18.3-6+deb11u1_amd64.deb
|
||||
sha256: 2ab853cbd0494c06fa694906c6eeea4df79720f461c76d080eb21a3e98f44115
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libkrb5-3_1.18.3-6+deb11u1_amd64.deb
|
||||
sha256: afb9dced3fcbdbc439a166eaa217dbfd485585842f12ce4587123009618e8bfe
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libk5crypto3_1.18.3-6+deb11u1_amd64.deb
|
||||
sha256: 4a010fc69322b6be9e141a76593f46e6588c968ee3b7cf79a3b8b7efda9aeeba
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libkrb5support0_1.18.3-6+deb11u1_amd64.deb
|
||||
sha256: 1f19908dbd37bd2ba9b3b3c9eb6ab8bee9a72f72745e6887f5366bb5fece654b
|
||||
- type: file
|
||||
url: http://ftp.cn.debian.org/debian/pool/main/k/keyutils/libkeyutils1_1.6.1-2_amd64.deb
|
||||
sha256: f01060b434d8cad3c58d5811d2082389f11b3db8152657d6c22c1d298953f2a5
|
||||
|
||||
- name: clean
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- cp /app/opt/nodejs/bin/node /app/opt/nwjs
|
||||
- cd /app/opt/nwjs && ln -s node node.exe
|
||||
- rm -rf /app/opt/nodejs
|
||||
|
||||
- name: startup
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- sed -i 's/Icon=dir\/res\/icons\/wechat-devtools.svg/Icon=io.github.msojocs.wechat_devtools/' template.desktop
|
||||
- sed -i 's/Exec=dir\/bin\/wechat-devtools/Exec=startup/' template.desktop
|
||||
post-install:
|
||||
- install -Dm755 wechat-devtools /app/opt/bin/wechat-devtools
|
||||
- install -Dm755 startup.sh /app/bin/startup
|
||||
- install -Dm644 template.desktop /app/share/applications/io.github.msojocs.wechat-devtools.desktop
|
||||
- install -Dm644 wechat-devtools.svg /app/share/icons/hicolor/scalable/apps/io.github.msojocs.wechat-devtools.svg
|
||||
sources:
|
||||
- type: file
|
||||
path: bin/wechat-devtools
|
||||
- type: file
|
||||
path: res/flatpak/startup.sh
|
||||
- type: file
|
||||
path: res/template.desktop
|
||||
- type: file
|
||||
path: res/icons/wechat-devtools.svg
|
||||
|
32
package-lock.json
generated
32
package-lock.json
generated
@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "wechat-web-devtools-linux",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"devDependencies": {
|
||||
"husky": "^7.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/husky": {
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/husky/-/husky-7.0.4.tgz",
|
||||
"integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"husky": "lib/bin.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"husky": {
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/husky/-/husky-7.0.4.tgz",
|
||||
"integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"husky": "^7.0.4"
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ _wechat_devtools_md5="2785d569b88d72a8e238d438d92faf44"
|
||||
_wechat_devtools_exe="wechat_devtools_${_wechat_devtools_ver}_x64.exe"
|
||||
_nwjs_ver="0.55.0"
|
||||
_install_dir="/opt/wechat-devtools"
|
||||
_node_version="16.4.2"
|
||||
_node_version="16.11.0"
|
||||
|
||||
pkgname=wechat-devtools
|
||||
pkgver="${_wechat_devtools_ver}" # 主版本号
|
||||
@ -89,7 +89,7 @@ build() {
|
||||
_log "prepare nw-gyp"
|
||||
node --version
|
||||
npm uninstall node-gyp -g
|
||||
npm install nw-gyp node-gyp -g
|
||||
npm install nw-gyp@3.6.6 node-gyp -g
|
||||
|
||||
# node bin
|
||||
_log "copy node exectuable"
|
||||
@ -120,7 +120,7 @@ package() {
|
||||
find ./package.nw -type d | xargs -I {} chmod -R a+rx {}
|
||||
|
||||
cp ${srcdir}/node.${_node_version} nwjs/node
|
||||
cd nwjs && ln -s node node.exe
|
||||
cd nwjs && ln -s node node.exe && ln -s ../package.nw package.nw
|
||||
|
||||
install -Dm755 "${srcdir}/wechat-devtools" "${pkgdir}${_install_dir}/bin/wechat-devtools"
|
||||
install -Dm755 "${srcdir}/wechat-devtools-cli" "${pkgdir}${_install_dir}/bin/wechat-devtools-cli"
|
||||
|
@ -12,10 +12,17 @@ DH_VERBOSE = 1
|
||||
# package maintainers to append LDFLAGS
|
||||
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||
|
||||
# 1.20.9ubuntu1 -> 1.20.9ubuntu2修改了默认打包工具为zstd,导致统信平台不能识别,强制设定为xz
|
||||
# changelog: https://launchpad.net/ubuntu/+source/dpkg/1.20.9ubuntu2
|
||||
override_dh_builddeb:
|
||||
dh_builddeb -- -Zxz
|
||||
|
||||
override_dh_strip_nondeterminism:
|
||||
|
||||
override_dh_shlibdeps:
|
||||
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
|
||||
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -Xswc.linux-x64-musl.node
|
||||
override_dh_strip:
|
||||
dh_strip --no-automatic-dbgsym
|
||||
|
||||
%:
|
||||
dh "$@"
|
||||
|
29
res/scripts/cli.js
Normal file
29
res/scripts/cli.js
Normal file
@ -0,0 +1,29 @@
|
||||
(() => {
|
||||
process.argv[0] = 'wechat-devtools-cli'
|
||||
process.env.USERPROFILE = require('os').homedir()
|
||||
Object.defineProperty(global, 'userDirPath', {
|
||||
set: function(value) {
|
||||
if (value.includes('AppData/Local')) {
|
||||
value = value.replace('AppData/Local', '.config')
|
||||
value = value.replace(/User Data\/.*?\//, '')
|
||||
// value = value.replace('~', require('os').homedir())
|
||||
}
|
||||
this._userDirPath = value
|
||||
},
|
||||
get: function() {
|
||||
return this._userDirPath
|
||||
}
|
||||
})
|
||||
// appPath
|
||||
Object.defineProperty(global, 'appPath', {
|
||||
set: function(value) {
|
||||
if (value.includes('.exe')) {
|
||||
value = value.replace('.exe', '')
|
||||
}
|
||||
this._appPath = value
|
||||
},
|
||||
get: function() {
|
||||
return this._appPath
|
||||
}
|
||||
})
|
||||
})();
|
11
res/scripts/entrance.js
Normal file
11
res/scripts/entrance.js
Normal file
@ -0,0 +1,11 @@
|
||||
(() => {
|
||||
const http = require('http')
|
||||
const originaleListen = http.Server.prototype.listen
|
||||
http.Server.prototype.listen = function(...args) {
|
||||
if (args[0] == 33233) {
|
||||
console.warn('block port of http server:', args[0])
|
||||
return
|
||||
}
|
||||
return originaleListen.apply(this, args)
|
||||
}
|
||||
})();
|
347
res/scripts/hackrequire.js
Normal file
347
res/scripts/hackrequire.js
Normal file
@ -0,0 +1,347 @@
|
||||
/* patch wechat devtools begin */
|
||||
(() => {
|
||||
try {
|
||||
{
|
||||
// 修正编译器路径
|
||||
const originalSpawn = require("child_process").spawn;
|
||||
require("child_process").spawn = function (command, args, options) {
|
||||
if (command.includes("wcc.exe")) {
|
||||
command = command.replace("code/package.nw", "package.nw");
|
||||
command = command.replace("wcc.exe", "wcc");
|
||||
} else if (command.includes("wcsc.exe")) {
|
||||
command = command.replace("code/package.nw", "package.nw");
|
||||
command = command.replace("wcsc.exe", "wcsc");
|
||||
}
|
||||
return originalSpawn.apply(this, [command, args, options]);
|
||||
};
|
||||
}
|
||||
{
|
||||
// 修正路径错误
|
||||
const originalResolve = require("path").resolve;
|
||||
require("path").resolve = function (...paths) {
|
||||
if (paths.length === 2 && paths[1].includes("code/package.nw")) {
|
||||
paths[1] = paths[1].replace("code/package.nw", "package.nw");
|
||||
}
|
||||
return originalResolve.apply(this, paths);
|
||||
};
|
||||
}
|
||||
if (typeof nw === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
let log = function (content) {
|
||||
process.stderr.write(content + "\n");
|
||||
};
|
||||
|
||||
let originMenuItem = nw.MenuItem;
|
||||
nw.MenuItem = function MenuItem(options) {
|
||||
|
||||
options = Object.assign({}, options);
|
||||
|
||||
delete options.shortcutName;
|
||||
delete options.shouldEnabled;
|
||||
|
||||
if (options.label && (typeof options.label === "string")) {
|
||||
|
||||
if (options.label.indexOf("[") !== -1) {
|
||||
let rest = options.label.split("[").slice(1).join("[").trim();
|
||||
if (rest[rest.length - 1] === "]") {
|
||||
rest = rest.slice(0, -1).split("+").map((x) => {
|
||||
if (!x) { return "+" }
|
||||
switch (x) {
|
||||
case "↓": { return "Down"; }
|
||||
case "↑": { return "Up"; }
|
||||
case "PAGE↓": { return "PageDown"; }
|
||||
case "PAGE↑": { return "PageUp"; }
|
||||
case "←": { return "Left"; }
|
||||
case "→": { return "Right"; }
|
||||
default: { return x; }
|
||||
}
|
||||
});
|
||||
if (rest.length > 1) {
|
||||
options.key = rest[rest.length - 1];
|
||||
options.modifiers = rest.slice(0, -1).join("+");
|
||||
} else {
|
||||
options.key = rest[0];
|
||||
}
|
||||
}
|
||||
options.label = options.label.split("[")[0];
|
||||
}
|
||||
|
||||
if (options.label.indexOf("(&") !== -1) {
|
||||
options.label = options.label.split("(&")[0];
|
||||
}
|
||||
options.label = options.label.replace("&", "").trim();
|
||||
|
||||
switch (options.label) {
|
||||
case "Go to Declaration": { options.label = "转到声明"; break; }
|
||||
case "Go to References": { options.label = "转到引用"; break; }
|
||||
case "Find All References": { options.label = "查找所有引用"; break; }
|
||||
case "Find All Implementations": { options.label = "查找所有实现"; break; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new originMenuItem(options);
|
||||
|
||||
};
|
||||
|
||||
let originAppend = nw.Menu.prototype.append;
|
||||
nw.Menu.prototype.append = function (item) {
|
||||
|
||||
if (item.parentMenu) {
|
||||
item.parentMenu.remove(item);
|
||||
}
|
||||
item.parentMenu = this;
|
||||
|
||||
if ((this.items.length > 0) &&
|
||||
(this.items[this.items.length - 1].type === "separator") &&
|
||||
(item.type === "separator")) {
|
||||
originInsert.call(this, item, this.items.length);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((this.items.length === 0) && (item.type === "separator")) {
|
||||
originInsert.call(this, item, this.items.length);
|
||||
return;
|
||||
}
|
||||
|
||||
return originAppend.call(this, item);
|
||||
};
|
||||
|
||||
let originInsert = nw.Menu.prototype.insert;
|
||||
nw.Menu.prototype.insert = function (item, index) {
|
||||
if (item.parentMenu) {
|
||||
item.parentMenu.remove(item);
|
||||
}
|
||||
item.parentMenu = this;
|
||||
return originInsert.call(this, item, index);
|
||||
};
|
||||
{
|
||||
// 修正新窗口数据丢失的问题
|
||||
const originalOpen = nw.Window.open
|
||||
nw.Window.open = function (url, options, callback) {
|
||||
console.warn('[wechat-devtools] nw.Window.open is called, url:', url, 'options:', options);
|
||||
let cb = callback
|
||||
if (options.title === '版本更新提示') {
|
||||
options.inject_js_start = 'js/unpack/hackrequire/index.js';
|
||||
cb = (...args) => {
|
||||
const keys = [
|
||||
"shareData",
|
||||
"windowMap",
|
||||
"isSimple",
|
||||
"masterProxyPort",
|
||||
"proxyPort",
|
||||
"masterH2ProxyPort",
|
||||
"h2ProxyPort"
|
||||
];
|
||||
for(let k of keys)
|
||||
args[0].window.global[k] = global[k];
|
||||
callback(...args)
|
||||
}
|
||||
}
|
||||
else if (options.title === '云开发控制台') {
|
||||
cb = (...args) => {
|
||||
const keys = [
|
||||
"shareData",
|
||||
"windowMap",
|
||||
"isSimple",
|
||||
"masterProxyPort",
|
||||
"proxyPort",
|
||||
"masterH2ProxyPort",
|
||||
"h2ProxyPort",
|
||||
'tokenData',
|
||||
];
|
||||
for(let k of keys)
|
||||
args[0].window.global[k] = global[k];
|
||||
callback(...args)
|
||||
}
|
||||
}
|
||||
else if (options.title.includes('微信开发者工具')) {
|
||||
cb = (...args) => {
|
||||
const keys = [
|
||||
"shareData",
|
||||
"windowMap",
|
||||
"isSimple",
|
||||
"masterProxyPort",
|
||||
"proxyPort",
|
||||
"masterH2ProxyPort",
|
||||
"h2ProxyPort",
|
||||
'tokenData',
|
||||
];
|
||||
for(let k of keys)
|
||||
args[0].window.global[k] = global[k];
|
||||
callback(...args)
|
||||
}
|
||||
}
|
||||
return originalOpen.apply(this, [url, options, cb])
|
||||
}
|
||||
}
|
||||
{
|
||||
// 修正打开外部Terminal的功能
|
||||
const originalExec = require('child_process').exec;
|
||||
require('child_process').exec = function (command, options, callback) {
|
||||
if (command.includes('open -a Terminal')) {
|
||||
command = 'gnome-terminal'
|
||||
}
|
||||
return originalExec.apply(this, [command, options, callback])
|
||||
}
|
||||
}
|
||||
{
|
||||
// 修正 暗色/亮色 自动跟随系统
|
||||
const {spawn, execSync} = require('child_process')
|
||||
let isDark = (function () {
|
||||
try {
|
||||
const { DESKTOP_SESSION } = process.env;
|
||||
console.log(DESKTOP_SESSION);
|
||||
let theme = "";
|
||||
switch (DESKTOP_SESSION) {
|
||||
case "deepin":
|
||||
theme = execSync(
|
||||
`gsettings get com.deepin.dde.appearance gtk-theme`
|
||||
);
|
||||
break;
|
||||
case "gnome":
|
||||
case "gnome-classic":
|
||||
theme = execSync(
|
||||
`gsettings get org.gnome.desktop.interface ${this.gnomeScheme}`
|
||||
);
|
||||
break;
|
||||
|
||||
case "plasma":
|
||||
theme = execSync(
|
||||
`gsettings get org.gnome.desktop.interface color-scheme`,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
console.warn(
|
||||
`NOT SUPPORTED !!! DESKTOP_SESSION: ${DESKTOP_SESSION}`
|
||||
);
|
||||
break;
|
||||
}
|
||||
console.log(theme.toString());
|
||||
return theme.toString().toLowerCase().includes("dark");
|
||||
} catch (error) {
|
||||
console.error("尝试获取主题信息失败,使用默认暗色");
|
||||
return true;
|
||||
}
|
||||
})()
|
||||
const originalMatchMedia = window.matchMedia
|
||||
window.matchMedia = function (...args) {
|
||||
console.warn('----------------> matchMedia:', ...args)
|
||||
const mm = originalMatchMedia.apply(this, args)
|
||||
Object.defineProperty(mm, 'matches', {
|
||||
get(){
|
||||
return isDark
|
||||
}
|
||||
})
|
||||
return mm
|
||||
}
|
||||
class CheckDark {
|
||||
// 监听gsettings monitor org.gnome.desktop.interface gtk-theme
|
||||
monitorTheme(callback) {
|
||||
try {
|
||||
if (this.callback) {
|
||||
this.callback = callback
|
||||
return;
|
||||
}
|
||||
this.callback = callback
|
||||
let monitor = null;
|
||||
const { DESKTOP_SESSION } = process.env;
|
||||
switch (DESKTOP_SESSION) {
|
||||
case "deepin":
|
||||
monitor = spawn("gsettings", [
|
||||
"monitor",
|
||||
"com.deepin.dde.appearance",
|
||||
"gtk-theme",
|
||||
]);
|
||||
break;
|
||||
case "gnome":
|
||||
case "gnome-classic":
|
||||
monitor = spawn("gsettings", [
|
||||
"monitor",
|
||||
"org.gnome.desktop.interface",
|
||||
this.gnomeScheme,
|
||||
]);
|
||||
break;
|
||||
case "plasma":
|
||||
monitor = spawn("gsettings", [
|
||||
"monitor",
|
||||
"org.gnome.desktop.interface",
|
||||
'color-scheme',
|
||||
]);
|
||||
break;
|
||||
default:
|
||||
console.warn(
|
||||
`NOT SUPPORTED !!! DESKTOP_SESSION: ${DESKTOP_SESSION}`
|
||||
);
|
||||
break;
|
||||
}
|
||||
monitor &&
|
||||
monitor.on("error", (err) => {
|
||||
console.error("monitorTheme", err);
|
||||
});
|
||||
monitor &&
|
||||
monitor.stdout.on("data", (chunk) => {
|
||||
const data = chunk.toString();
|
||||
console.warn('Theme changed:', data)
|
||||
isDark = data.toLowerCase().includes("dark");
|
||||
this.callback(isDark)
|
||||
});
|
||||
process.on("SIGTERM", (signal) => {
|
||||
monitor.kill(signal);
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("尝试监听主题失败!", err);
|
||||
}
|
||||
}
|
||||
get gnomeScheme() {
|
||||
try {
|
||||
// 判断 Gnome-Shell 版本 from @icepie
|
||||
const gnomeVersion = execSync(`gnome-shell --version`)
|
||||
.toString()
|
||||
.replace(/[\r\n]/g, "")
|
||||
.split(" ");
|
||||
const gnomeVersionNum =
|
||||
gnomeVersion.length == 3 ? Number(gnomeVersion[2]) : 0;
|
||||
return gnomeVersionNum >= 42 ? "color-scheme" : "gtk-theme";
|
||||
} catch (err) {
|
||||
console.error("检查gnome版本失败, 使用gtk-theme", err);
|
||||
return "gtk-theme";
|
||||
}
|
||||
}
|
||||
}
|
||||
const checkDark = new CheckDark()
|
||||
const original = MediaQueryList.prototype.addEventListener
|
||||
MediaQueryList.prototype.addEventListener = function (...args) {
|
||||
console.warn('----------> MediaQueryList.addEventListener:', ...args)
|
||||
checkDark.monitorTheme((isDark) => {
|
||||
args[1]({
|
||||
matches: isDark
|
||||
})
|
||||
})
|
||||
return original.apply(this, args)
|
||||
}
|
||||
}
|
||||
{
|
||||
// 修复云开发控制台
|
||||
const originalBind = Function.prototype.bind
|
||||
Function.prototype.bind = function(...args) {
|
||||
if (args[0]?._tokenMap) {
|
||||
console.warn('---------set tokenData')
|
||||
if (window.tokenData) {
|
||||
args[0]._sessionToken = window.tokenData._sessionToken
|
||||
args[0]._tokenMap = window.tokenData._tokenMap
|
||||
}
|
||||
else
|
||||
window.tokenData = args[0]
|
||||
}
|
||||
return originalBind.apply(this, args)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
process.stderr.write(error.message);
|
||||
process.stderr.write(error.stack);
|
||||
}
|
||||
})();
|
||||
/* patch wechat devtools end */
|
@ -1,11 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=WeChat Dev Tools
|
||||
Name[zh_CN]=微信开发者工具
|
||||
Comment=The development tools for wechat projects
|
||||
Comment[zh_CN]=提供微信开发相关项目的开发IDE支持
|
||||
Categories=Development;WebDevelopment;IDE;
|
||||
Exec=wechat-devtools %U
|
||||
Icon=${SNAP}/meta/gui/wechat-devtools.png
|
||||
Type=Application
|
||||
Terminal=false
|
||||
MimeType=x-scheme-handler/wechatide
|
Binary file not shown.
Before Width: | Height: | Size: 342 KiB |
@ -1,202 +0,0 @@
|
||||
name: wechat-devtools # you probably want to 'snapcraft register <name>'
|
||||
base: core18 # the base snap is the execution environment for this snap
|
||||
version: '1.06.2209070-1' # just for humans, typically '1.2+git' or '1.3.2'
|
||||
summary: WeChat Devtools for Linux # 79 char long summary
|
||||
description: |
|
||||
WeChat Devtools for Linux.
|
||||
|
||||
grade: stable # must be 'stable' to release into candidate/stable channels
|
||||
confinement: strict # use 'strict' once you have the right plugs and slots
|
||||
|
||||
architectures:
|
||||
- build-on: [amd64]
|
||||
run-on: [amd64]
|
||||
|
||||
# pull
|
||||
# build
|
||||
# stage
|
||||
# prime
|
||||
# snap
|
||||
# /root/parts/my-part/src/nw
|
||||
parts:
|
||||
node-js:
|
||||
plugin: dump
|
||||
source: https://npmmirror.com/mirrors/node/v16.4.2/node-v16.4.2-linux-x64.tar.gz
|
||||
# source: cache/node-v16.4.2-linux-x64.tar.gz
|
||||
organize:
|
||||
"*": node/
|
||||
override-build: |
|
||||
mkdir -p $SNAPCRAFT_STAGE/node
|
||||
cp -r * $SNAPCRAFT_STAGE/node
|
||||
ls -l
|
||||
ls -l $SNAPCRAFT_PART_INSTALL
|
||||
package-nw:
|
||||
plugin: dump
|
||||
source: https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1062209070&version_type=1
|
||||
# source: cache/wechat_devtools_1.05.2204180_x64.exe
|
||||
source-type: 7z
|
||||
source-subdir: code
|
||||
override-build: |
|
||||
chmod -R 755 code/package.nw
|
||||
cp -r code/package.nw $SNAPCRAFT_STAGE
|
||||
# after 会执行到stage
|
||||
|
||||
build-node:
|
||||
plugin: nil
|
||||
build-environment:
|
||||
- PATH: "$SNAPCRAFT_STAGE/node/bin:$PATH"
|
||||
- NW_VERSION: 0.55.0
|
||||
- WINE: 'false'
|
||||
# - NW_PACKAGE_DIR: "$SNAPCRAFT_PART_BUILD/code/package.nw"
|
||||
# - srcdir: "$SNAPCRAFT_PROJECT_DIR"
|
||||
build-packages:
|
||||
- python2.7
|
||||
- libxkbfile-dev
|
||||
- pkg-config
|
||||
- libkrb5-dev
|
||||
- gcc
|
||||
- g++
|
||||
- make
|
||||
- openssl
|
||||
- libssh2-1-dev
|
||||
- wget
|
||||
override-pull: |
|
||||
ls -l
|
||||
override-build: |
|
||||
env
|
||||
echo "=============3============"
|
||||
ls -l $SNAPCRAFT_PART_SRC
|
||||
ls -l $SNAPCRAFT_PART_BUILD
|
||||
ls -l $SNAPCRAFT_PART_INSTALL
|
||||
ls -l $SNAPCRAFT_PRIME
|
||||
ls -l $SNAPCRAFT_PROJECT_DIR
|
||||
ls -l $SNAPCRAFT_STAGE
|
||||
ls -l
|
||||
|
||||
cd $SNAPCRAFT_PROJECT_DIR/compiler && npm install
|
||||
cd $SNAPCRAFT_PART_BUILD
|
||||
# 准备文件
|
||||
cp -r $SNAPCRAFT_STAGE/package.nw package.nw
|
||||
chmod -R 755 package.nw
|
||||
cp -r "${SNAPCRAFT_PROJECT_DIR}/tools" tools
|
||||
cp -r "${SNAPCRAFT_PROJECT_DIR}/compiler" compiler
|
||||
|
||||
# 执行构建脚本
|
||||
npm install node-gyp nw-gyp -g --registry=https://registry.npm.taobao.org
|
||||
node-gyp install --registry=https://registry.npm.taobao.org
|
||||
|
||||
for script in fix-package-name.js fix-cli.sh fix-core.sh fix-other.sh; do
|
||||
echo -e "\e[1;34mrun ${script}\e[0m"
|
||||
tools/${script}
|
||||
done
|
||||
# 构建模块
|
||||
tools/rebuild-node-modules.sh $NW_VERSION
|
||||
rm -rf tools
|
||||
cp -r package.nw $SNAPCRAFT_PART_INSTALL
|
||||
chmod -R 755 $SNAPCRAFT_PART_INSTALL/package.nw
|
||||
|
||||
stage-packages:
|
||||
- libxkbfile1
|
||||
- git-core
|
||||
- libssh2-1-dev
|
||||
|
||||
after:
|
||||
- node-js
|
||||
- package-nw
|
||||
# - desktop-gnome-platform
|
||||
|
||||
nw-js:
|
||||
plugin: dump
|
||||
source: https://npmmirror.com/mirrors/nwjs/v0.55.0/nwjs-sdk-v0.55.0-linux-x64.tar.gz
|
||||
# source: ./cache/nwjs-sdk-v0.55.0-linux-x64.tar.gz
|
||||
organize:
|
||||
"*": nwjs/
|
||||
stage-packages:
|
||||
- libnss3
|
||||
- libnspr4
|
||||
override-pull: |
|
||||
ls -l
|
||||
ls -l $SNAPCRAFT_PART_SRC
|
||||
ls -l $SNAPCRAFT_PART_BUILD
|
||||
snapcraftctl pull
|
||||
ls -l
|
||||
ls -l $SNAPCRAFT_PART_SRC
|
||||
ls -l $SNAPCRAFT_PART_BUILD
|
||||
rm -rf nacl_irt_x86_64.nexe
|
||||
# chmod 644 nacl_irt_x86_64.nexe
|
||||
# tar -zcf nacl_irt_x86_64.nexe.tar.gz nacl_irt_x86_64.nexe
|
||||
# ln -s $SNAP/nacl_irt_x86_64.nexe nacl_irt_x86_64.nexe
|
||||
ls -l
|
||||
ls -l $SNAPCRAFT_PART_SRC
|
||||
ls -l $SNAPCRAFT_PART_BUILD
|
||||
ls -l $SNAPCRAFT_PART_INSTALL
|
||||
ls -l $SNAPCRAFT_STAGE
|
||||
|
||||
override-build: |
|
||||
ls -l
|
||||
rm -rf $SNAPCRAFT_PART_INSTALL/nwjs/node $SNAPCRAFT_PART_INSTALL/nwjs/node.exe
|
||||
install -Dm755 $SNAPCRAFT_STAGE/node/bin/node $SNAPCRAFT_PART_INSTALL/nwjs/node
|
||||
cd $SNAPCRAFT_PART_INSTALL/nwjs && ln -s node node.exe
|
||||
ls -l $SNAPCRAFT_PART_INSTALL/nwjs
|
||||
snapcraftctl build
|
||||
ls -l $SNAPCRAFT_PART_INSTALL/nwjs
|
||||
after:
|
||||
- build-node
|
||||
|
||||
run-script:
|
||||
plugin: nil
|
||||
override-build: |
|
||||
snapcraftctl build
|
||||
ls
|
||||
install -Dm755 "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools" "$SNAPCRAFT_PART_INSTALL/bin/wechat-devtools"
|
||||
install -Dm755 "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools-cli" "$SNAPCRAFT_PART_INSTALL/bin/wechat-devtools-cli"
|
||||
|
||||
stage:
|
||||
- bin/wechat-devtools
|
||||
- bin/wechat-devtools-cli
|
||||
- usr/*
|
||||
|
||||
apps:
|
||||
wechat-devtools:
|
||||
# autostart: wechat-devtools.desktop
|
||||
command: bin/wechat-devtools
|
||||
environment:
|
||||
WECHAT_DEVTOOLS_DIR: $SNAP/nwjs
|
||||
APPDATA: "$SNAP_USER_DATA/wechat_devtools"
|
||||
PATH: "$SNAP/node/bin:$SNAP/nwjs:$PATH"
|
||||
USERPROFILE: $SNAP_USER_DATA
|
||||
GIT_EXEC_PATH: $SNAP/usr/lib/git-core
|
||||
|
||||
extensions:
|
||||
- gnome-3-34
|
||||
plugs:
|
||||
- desktop
|
||||
- desktop-legacy
|
||||
- opengl
|
||||
- mount-observe
|
||||
- adb-support
|
||||
- x11
|
||||
- wayland
|
||||
- network
|
||||
- network-bind
|
||||
- gsettings
|
||||
- browser-support
|
||||
- home
|
||||
- system-observe
|
||||
- removable-media
|
||||
- udisks2
|
||||
- unity7
|
||||
|
||||
plugs:
|
||||
gtk-3-themes:
|
||||
interface: content
|
||||
target: $SNAP/data-dir/themes
|
||||
default-provider: gtk-common-themes
|
||||
icon-themes:
|
||||
interface: content
|
||||
target: $SNAP/data-dir/icons
|
||||
default-provider: gtk-common-themes
|
||||
sound-themes:
|
||||
interface: content
|
||||
target: $SNAP/data-dir/sounds
|
||||
default-provider: gtk-common-themes
|
9
test/nw-simple/index.html
Normal file
9
test/nw-simple/index.html
Normal file
@ -0,0 +1,9 @@
|
||||
<!-- <video src="https://vjs.zencdn.net/v/oceans.mp4"></video> -->
|
||||
<hr />
|
||||
<video autoplay width="320" height="240" controls>
|
||||
<source src="https://media.w3.org/2010/05/sintel/trailer.mp4" type="video/mp4">
|
||||
您的浏览器不支持 HTML5 video 标签。
|
||||
</video>
|
||||
<script>
|
||||
// window.open('chrome://media-internals/')
|
||||
</script>
|
4
test/nw-simple/package.json
Normal file
4
test/nw-simple/package.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "test",
|
||||
"main": "index.html"
|
||||
}
|
@ -3,7 +3,7 @@ const { execSync, spawn } = require("child_process");
|
||||
|
||||
class CheckDark {
|
||||
// 监听gsettings monitor org.gnome.desktop.interface gtk-theme
|
||||
monitorTheme() {
|
||||
monitorTheme(callback) {
|
||||
try {
|
||||
let monitor = null;
|
||||
const { DESKTOP_SESSION } = process.env;
|
||||
@ -37,11 +37,8 @@ class CheckDark {
|
||||
monitor.stdout.on("data", (chunk) => {
|
||||
// TODO: 防抖动包装
|
||||
const data = chunk.toString();
|
||||
const t = data.toLowerCase().includes("dark");
|
||||
console.log(data);
|
||||
console.log("dark", t);
|
||||
// (this._theme = t ? i.Dark : i.Light),
|
||||
// this._onDidThemeChange.fire(this._theme);
|
||||
const isDark = data.toLowerCase().includes("dark");
|
||||
callback(isDark)
|
||||
});
|
||||
process.on("SIGTERM", (signal) => {
|
||||
monitor.kill(signal);
|
||||
@ -83,7 +80,7 @@ class CheckDark {
|
||||
}
|
||||
get gnomeScheme() {
|
||||
try {
|
||||
// 判断 Gnome-Shell 版本
|
||||
// 判断 Gnome-Shell 版本 from @icepie
|
||||
const gnomeVersion = execSync(`gnome-shell --version`)
|
||||
.toString()
|
||||
.replace(/[\r\n]/g, "")
|
||||
@ -98,7 +95,9 @@ class CheckDark {
|
||||
}
|
||||
}
|
||||
const cd = new CheckDark();
|
||||
cd.monitorTheme();
|
||||
cd.monitorTheme((isDark) => {
|
||||
console.info('is dark:', isDark)
|
||||
});
|
||||
console.log(cd.isDark);
|
||||
|
||||
function original() {
|
||||
|
10
test/wxvpkg-test
Normal file → Executable file
10
test/wxvpkg-test
Normal file → Executable file
@ -4,12 +4,4 @@ root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
tmp_dir="$root_dir/tmp"
|
||||
|
||||
# unpack 文件 到 路径
|
||||
node "$root_dir/tools/wxvpkg/unpack" "$tmp_dir/core.wxvpkg" "$tmp_dir/core.wxvpkg.ext"
|
||||
|
||||
# pack 路径 到 文件
|
||||
node "$root_dir/tools/wxvpkg/pack" "$tmp_dir/core.wxvpkg.ext" "$tmp_dir/core.wxvpkg.test"
|
||||
|
||||
# unpack 文件 到 路径
|
||||
rm -rf "$tmp_dir/core.wxvpkg.ext1"
|
||||
node "$root_dir/tools/wxvpkg/unpack" "$tmp_dir/core.wxvpkg.test" "$tmp_dir/core.wxvpkg.ext1"
|
||||
|
||||
node "$root_dir/tools/wxvpkg_unpack.js" "/home/msojocs/.config/wechat-devtools/WeappVendor/3.8.5.wxvpkg" "/home/msojocs/.config/wechat-devtools/WeappVendor/3.8.5.wxvpkg.ext"
|
||||
|
@ -100,7 +100,7 @@ cd "$build_dir"
|
||||
ls -l "$build_dir"
|
||||
mkdir -p "$root_dir/tmp/build"
|
||||
|
||||
if [[ "$WINE" != 'false' ]];then
|
||||
if [[ "$WINE" == 'true' ]];then
|
||||
echo "添加wine依赖 - $WINE"
|
||||
echo "Depends: wine, wine-binfmt" >> "$build_dir/debian/control"
|
||||
fi
|
||||
|
6
tools/build-with-docker.sh
Executable file
6
tools/build-with-docker.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
echo "$(id -u):$(id -g)"
|
||||
docker run -u "$(id -u):$(id -g)" --rm -i -e "ACTION_MODE=${ACTION_MODE:-false}" -w /workspace -v "$root_dir:/workspace" jiyecafe/wechat-devtools-build:v1.0.4 \
|
||||
bash ./docker/entrypoint
|
@ -11,7 +11,8 @@ fi
|
||||
|
||||
cd "$NW_PACKAGE_DIR"
|
||||
|
||||
sed -i 's#AppData/Local/\${global.userDirName}/User Data/\${global.productHash}/Default#.config/\${global.userDirName}/Default#g' js/common/cli/index.js
|
||||
sed -i 's#USERPROFILE#HOME#g' js/common/cli/index.js
|
||||
sed -i 's#`./\${global.appname}.exe`#`./bin/\${global.appname}`#g' js/common/cli/index.js
|
||||
sed -i 's#,""));const T#,""));_.$0="wechat-devtools-cli";const T#' js/common/cli/index.js
|
||||
cd $root_dir/package.nw/js/common/cli
|
||||
cat $root_dir/res/scripts/cli.js > temp.js
|
||||
cat index.js >> temp.js
|
||||
rm index.js
|
||||
mv temp.js index.js
|
@ -1,18 +1,21 @@
|
||||
#!/bin/bash
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
set -e
|
||||
trap 'catchError $LINENO "$BASH_COMMAND"' ERR # 捕获错误情况
|
||||
catchError() {
|
||||
exit_code=$?
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
fail "\033[31mcommand: $2\n at $0:$1\n at $STEP\033[0m"
|
||||
fi
|
||||
exit $exit_code
|
||||
}
|
||||
# set -e
|
||||
# trap 'catchError $LINENO "$BASH_COMMAND"' ERR # 捕获错误情况
|
||||
# catchError() {
|
||||
# exit_code=$?
|
||||
# if [ $exit_code -ne 0 ]; then
|
||||
# fail "\033[31mcommand: $2\n at $0:$1\n at $STEP\033[0m"
|
||||
# fi
|
||||
# exit $exit_code
|
||||
# }
|
||||
|
||||
notice() {
|
||||
echo -e "\033[36m $1 \033[0m "
|
||||
}
|
||||
warn() {
|
||||
echo -e "\033[43;37m 警告 \033[0m $1"
|
||||
}
|
||||
fail() {
|
||||
echo -e "\033[41;37m 失败 \033[0m $1"
|
||||
}
|
||||
@ -34,53 +37,17 @@ node "$unpack_script" "$package_dir/core.wxvpkg" "$tmp_dir/core.wxvpkg"
|
||||
# |_| \_\_____|_| |_____/_/ \_\____|_____| \____\___/|_| \_\_____|
|
||||
#
|
||||
|
||||
# find
|
||||
open_find_result=$( grep -lr "this.props.onWindowOpenFail());if" "$tmp_dir/core.wxvpkg" )
|
||||
echo "云开发控制台启动点: $open_find_result"
|
||||
if [[ ! -z $open_find_result ]];then
|
||||
# replace
|
||||
new_cb_handle="this.props.onWindowOpenFail());Object.keys(window).forEach(key=>{if(!e.window[key]){try{e.window[key]=window[key];}catch(e){console.error(e);}}});"
|
||||
sed -i "s/this.props.onWindowOpenFail());/$new_cb_handle/g" $open_find_result
|
||||
fi
|
||||
|
||||
token_find_result=$( grep -lr "constructor(){this._sessionToken=\"\",this._tokenMap={}}" "$tmp_dir/core.wxvpkg" )
|
||||
echo "WebSocket token存储对象位置: $token_find_result"
|
||||
if [[ ! -z $token_find_result ]];then
|
||||
new_constructor="constructor(){if(window.tokenData){/*有就直接用*/this._sessionToken=window.tokenData._sessionToken;this._tokenMap=window.tokenData._tokenMap;}else{/*没有就新建*/this._sessionToken=\"\",this._tokenMap={};window.tokenData=this;/*新建完要给中间人*/}}"
|
||||
sed -i "s#constructor(){this._sessionToken=\"\",this._tokenMap={}}#$new_constructor#g" "$token_find_result"
|
||||
fi
|
||||
|
||||
# open -a Terminal "`pwd`" --> gnome-terminal
|
||||
notice "fix terminal"
|
||||
find_result=$( grep -lr 'open -a Terminal "`pwd`"' "$tmp_dir/core.wxvpkg" )
|
||||
echo "Terminal启动位置: $find_result"
|
||||
if [[ ! -z $find_result ]];then
|
||||
new_str="gnome-terminal"
|
||||
sed -i "s#open -a Terminal \"\`pwd\`\"#$new_str#g" "$find_result"
|
||||
fi
|
||||
# token_find_result=$( grep -lr "constructor(){this._sessionToken=\"\",this._tokenMap={}}" "$tmp_dir/core.wxvpkg" )
|
||||
# echo "WebSocket token存储对象位置: $token_find_result"
|
||||
# if [[ ! -z $token_find_result ]];then
|
||||
# new_constructor="constructor(){if(window.tokenData){/*有就直接用*/this._sessionToken=window.tokenData._sessionToken;this._tokenMap=window.tokenData._tokenMap;}else{/*没有就新建*/this._sessionToken=\"\",this._tokenMap={};window.tokenData=this;/*新建完要给中间人*/}}"
|
||||
# sed -i "s#constructor(){this._sessionToken=\"\",this._tokenMap={}}#$new_constructor#g" "$token_find_result"
|
||||
# else
|
||||
# warn "WebSocket token存储对象位置未找到"
|
||||
# fi
|
||||
|
||||
# wcc、wcsc处理,设置WINE=fasle环境变量生效
|
||||
if [[ "$WINE" != 'true' ]];then
|
||||
# "wcc.exe":!0,"wcsc.exe":!0
|
||||
find_result=$( grep -lr 'wcc-exec' "$tmp_dir/core.wxvpkg" )
|
||||
echo "wcc: $find_result"
|
||||
if [[ ! -z $find_result ]];then
|
||||
# new_str='{"wcc.bin":!0,"wcsc.bin":!0,wcc:!0,wcsc:!0}'
|
||||
# sed -i "s#{wcc:!0,wcsc:!0}#$new_str#g" "$find_result"
|
||||
# new_str='"linux"===process.platform'
|
||||
# sed -i "s#\"darwin\"===process.platform#$new_str#g" "$find_result"
|
||||
|
||||
# return_exp_wcc=$(cat $find_result | grep -P 'return [a-z]+\("wcc"\)' -o) # return ?("wcc")
|
||||
# return_exp_wcc_replace="${return_exp_wcc//wcc/wcc.bin}" # return ?("wcc.bin")
|
||||
# return_exp_wcc_replace="${return_exp_wcc//return /${return_exp_wcc_replace},}" # return ?("wcc.bin")
|
||||
|
||||
# return_exp_wcsc=$(cat $find_result | grep -P 'return [a-z]+\("wcsc"\)' -o) # return ?("wcsc")
|
||||
# return_exp_wcsc_replace="${return_exp_wcc_replace//wcc/wcsc}"
|
||||
|
||||
sed -i "s#wcc\\.exe#wcc#g" "$find_result"
|
||||
sed -i "s#wcsc\\.exe#wcsc#g" "$find_result"
|
||||
sed -i "s#code/package.nw#package.nw#g" "$find_result"
|
||||
fi
|
||||
# 处理报错时控制台显示的环境
|
||||
find_result=$( grep -lr '(env:' "$tmp_dir/core.wxvpkg" )
|
||||
echo "env: $find_result"
|
||||
@ -88,6 +55,8 @@ if [[ "$WINE" != 'true' ]];then
|
||||
for file in $find_result; do
|
||||
sed -i 's#"Windows"#"Linux"#g' "$file"
|
||||
done
|
||||
else
|
||||
warn "Windows字符串位置未找到"
|
||||
fi
|
||||
|
||||
current=`date "+%Y-%m-%d %H:%M:%S"`
|
||||
@ -95,29 +64,7 @@ if [[ "$WINE" != 'true' ]];then
|
||||
echo $timeStamp > "${package_dir}/.build_time"
|
||||
fi
|
||||
|
||||
# fix theme
|
||||
notice "fix theme"
|
||||
find_result=$( grep -lr "OSThemeController=" "$tmp_dir/core.wxvpkg" )
|
||||
echo "theme: $find_result"
|
||||
if [[ -n $find_result ]];then
|
||||
# require of child_process
|
||||
sed -i 's/"use strict";O/"use strict";const {execSync,spawn}=require("child_process");O/' $find_result
|
||||
# replace listener to monitor
|
||||
sed -i 's/this.registerListeners()/this.monitorTheme()/' $find_result
|
||||
# replace check func
|
||||
sed -i 's/mediaQuery.matches/isDark/' $find_result
|
||||
# add functions
|
||||
sed -i 's#}getDefaultTheme#}get isDark(){try{const{DESKTOP_SESSION}=process.env;console.log(DESKTOP_SESSION);let theme="";switch(DESKTOP_SESSION){case"deepin":theme=execSync(`gsettings get com.deepin.dde.appearance gtk-theme`);break;case"gnome":case"gnome-classic":theme=execSync(`gsettings get org.gnome.desktop.interface ${this.gnomeScheme}`);break;default:break}return theme.includes("dark");}catch(err){console.error("尝试获取主题信息失败,使用默认暗色",err);return true;}}get gnomeScheme(){try{const gnomeVersion=execSync(`gnome-shell --version`).toString().replace(/[\\r\\n]/g,"").split(" ");const gnomeVersionNum=gnomeVersion.length==3?Number(gnomeVersion[2]):0;return gnomeVersionNum>=42?"color-scheme":"gtk-theme";}catch(err){console.error("检查gnome版本失败, 使用gtk-theme", err);return "gtk-theme";}}monitorTheme(){try{let monitor=null;const{DESKTOP_SESSION}=process.env;switch(DESKTOP_SESSION){case"deepin":monitor=spawn("gsettings",["monitor","com.deepin.dde.appearance","gtk-theme",]);break;case"gnome":case"gnome-classic":monitor=spawn("gsettings",["monitor","org.gnome.desktop.interface",this.gnomeScheme,]);break;default:console.warn(`NOT SUPPORTED!!!DESKTOP_SESSION:${DESKTOP_SESSION}`);break}monitor\&\&monitor.on("error",(err)=>{console.error("monitorTheme",err)});monitor\&\&monitor.stdout.on("data",e.debounce((chunk)=>{const data=chunk.toString();const t=data.toLowerCase().includes("dark");(this._theme=t?i.Dark:i.Light),this._onDidThemeChange.fire(this._theme)},400));process.on("SIGTERM",(signal)=>{monitor.kill(signal);});}catch(err){console.error("尝试监听主题失败!", err);}}getDefaultTheme#' $find_result
|
||||
fi
|
||||
|
||||
# fix update check
|
||||
notice "fix update check"
|
||||
sed -i 's#</body><script src=../js/core#</body><script src="../js/unpack/hackrequire/index.js"></script><script src=../js/core#' "$package_dir/html/whatsnew.html"
|
||||
find_result=$( grep -lr "whatsnew.html" "$tmp_dir/core.wxvpkg" )
|
||||
grep -lr "t=>{R(\"new_version_hint" "$find_result"
|
||||
sed -i 's#t=>{R("new_version_hint#t=>{const keys = ["shareData", "windowMap", "isSimple","masterProxyPort", "proxyPort", "masterH2ProxyPort", "h2ProxyPort"];for(let k of keys)t.window.global[k] = global[k];R("new_version_hint#' $find_result
|
||||
|
||||
# pack 路径 到 文件
|
||||
echo "pack"
|
||||
notice "pack"
|
||||
node "$pack_script" "$tmp_dir/core.wxvpkg" "$package_dir/core.wxvpkg"
|
||||
rm -rf "$tmp_dir/core.wxvpkg"
|
||||
|
@ -3,6 +3,9 @@
|
||||
|
||||
set -e
|
||||
|
||||
warn() {
|
||||
echo -e "\033[43;37m 警告 \033[0m $1"
|
||||
}
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
NW_PACKAGE_DIR="$root_dir/package.nw"
|
||||
|
||||
@ -15,115 +18,12 @@ if [ ! -f "$target_file" ]; then
|
||||
fi
|
||||
# 判断匹配函数,匹配函数不为0,则包含给定字符
|
||||
if [ `grep -c "patch wechat devtools begin" $target_file` -ne '0' ];then
|
||||
echo -e "\e[1;31m$target_file seems to have been modified\e[0m" >&2
|
||||
exit 1
|
||||
warn "$target_file seems to have been modified"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
tmp_file=$(mktemp)
|
||||
cat > "$tmp_file" <<EOF
|
||||
/* patch wechat devtools begin */
|
||||
/* nw-menu.js */
|
||||
(() => {
|
||||
try {
|
||||
if (typeof nw === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
let log = function (content) {
|
||||
process.stderr.write(content + "\n");
|
||||
};
|
||||
|
||||
let originMenuItem = nw.MenuItem;
|
||||
nw.MenuItem = function MenuItem(options) {
|
||||
|
||||
options = Object.assign({}, options);
|
||||
|
||||
delete options.shortcutName;
|
||||
delete options.shouldEnabled;
|
||||
|
||||
if (options.label && (typeof options.label === "string")) {
|
||||
|
||||
if (options.label.indexOf("[") !== -1) {
|
||||
let rest = options.label.split("[").slice(1).join("[").trim();
|
||||
if (rest[rest.length - 1] === "]") {
|
||||
rest = rest.slice(0, -1).split("+").map((x) => {
|
||||
if (!x) { return "+" }
|
||||
switch (x) {
|
||||
case "↓": { return "Down"; }
|
||||
case "↑": { return "Up"; }
|
||||
case "PAGE↓": { return "PageDown"; }
|
||||
case "PAGE↑": { return "PageUp"; }
|
||||
case "←": { return "Left"; }
|
||||
case "→": { return "Right"; }
|
||||
default: { return x; }
|
||||
}
|
||||
});
|
||||
if (rest.length > 1) {
|
||||
options.key = rest[rest.length - 1];
|
||||
options.modifiers = rest.slice(0, -1).join("+");
|
||||
} else {
|
||||
options.key = rest[0];
|
||||
}
|
||||
}
|
||||
options.label = options.label.split("[")[0];
|
||||
}
|
||||
|
||||
if (options.label.indexOf("(&") !== -1) {
|
||||
options.label = options.label.split("(&")[0];
|
||||
}
|
||||
options.label = options.label.replace("&", "").trim();
|
||||
|
||||
switch (options.label) {
|
||||
case "Go to Declaration": { options.label = "转到声明"; break; }
|
||||
case "Go to References": { options.label = "转到引用"; break; }
|
||||
case "Find All References": { options.label = "查找所有引用"; break; }
|
||||
case "Find All Implementations": { options.label = "查找所有实现"; break; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new originMenuItem(options);
|
||||
|
||||
};
|
||||
|
||||
let originAppend = nw.Menu.prototype.append;
|
||||
nw.Menu.prototype.append = function (item) {
|
||||
|
||||
if (item.parentMenu) {
|
||||
item.parentMenu.remove(item);
|
||||
}
|
||||
item.parentMenu = this;
|
||||
|
||||
if ((this.items.length > 0) &&
|
||||
(this.items[this.items.length - 1].type === "separator") &&
|
||||
(item.type === "separator")) {
|
||||
originInsert.call(this, item, this.items.length);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((this.items.length === 0) && (item.type === "separator")) {
|
||||
originInsert.call(this, item, this.items.length);
|
||||
return;
|
||||
}
|
||||
|
||||
return originAppend.call(this, item);
|
||||
};
|
||||
|
||||
let originInsert = nw.Menu.prototype.insert;
|
||||
nw.Menu.prototype.insert = function (item, index) {
|
||||
if (item.parentMenu) {
|
||||
item.parentMenu.remove(item);
|
||||
}
|
||||
item.parentMenu = this;
|
||||
return originInsert.call(this, item, index);
|
||||
};
|
||||
} catch (error) {
|
||||
process.stderr.write(error.message);
|
||||
process.stderr.write(error.stack);
|
||||
}
|
||||
})();
|
||||
/* patch wechat devtools end */
|
||||
EOF
|
||||
cat "$root_dir/res/scripts/hackrequire.js" > "$tmp_file"
|
||||
cat "$target_file" >> "$tmp_file"
|
||||
|
||||
cat "$tmp_file" > "$target_file"
|
||||
|
@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -ex
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
srcdir=$root_dir
|
||||
tmp_dir="$root_dir/tmp"
|
||||
nwjs_dir="$root_dir/nwjs"
|
||||
package_dir="$root_dir/package.nw"
|
||||
|
||||
# 修复: webview manager
|
||||
@ -12,28 +13,76 @@ package_dir="$root_dir/package.nw"
|
||||
echo "fix: webview manager"
|
||||
sed -i 's#module.exports = createWebviewManager;#module.exports = createWebviewManager,( /** @type {any} */ (window)).createWebviewManager = createWebviewManager;#g' "$package_dir/js/libs/vseditor/webview-resource/main.js"
|
||||
|
||||
# 修复:可视化用的wcc,wcsc
|
||||
echo "fix: wcc,wcsc"
|
||||
# wcc wcsc
|
||||
ls -l "${srcdir}/compiler"
|
||||
# 可视化编译
|
||||
(cd "${package_dir}/node_modules/" \
|
||||
&& rm -rf wcc \
|
||||
&& cp -rL "${srcdir}/compiler/wcc_node" "wcc" \
|
||||
&& chmod +x wcc/bin/linux/*
|
||||
)
|
||||
echo "replace: wcc,wcsc linux version"
|
||||
source "${srcdir}/conf/compiler_version"
|
||||
|
||||
# 预览编译,设置 WINE!=true 环境变量生效
|
||||
# 如果是mac执行wcc,否则wcc.exe
|
||||
if [[ "$WINE" != 'true' ]];then
|
||||
# \cp -rf "${srcdir}/compiler/generatemd5.js" "${package_dir}/js/vendor/generatemd5.js"
|
||||
\cp "${srcdir}/compiler/nodejs"/* "${package_dir}/node_modules/wcc-exec"
|
||||
cd "${package_dir}/node_modules/wcc-exec" && chmod 0755 wcc wcsc wcc.bin wcsc.bin
|
||||
# node "${package_dir}/js/vendor/generatemd5.js"
|
||||
|
||||
current=`date "+%Y-%m-%d %H:%M:%S"`
|
||||
timeStamp=`date -d "$current" +%s`
|
||||
echo $timeStamp > "${package_dir}/.build_time"
|
||||
mkdir -p "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}"
|
||||
if [ ! -f "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc" ];then
|
||||
wget -c "https://github.com/msojocs/wx-compiler/releases/download/${WX_COMPILER_VERSION}/wcc" -O "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc.tmp"
|
||||
mv "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc.tmp" "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc"
|
||||
chmod 0755 "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc"
|
||||
fi
|
||||
|
||||
if [ ! -f "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc" ];then
|
||||
wget -c "https://github.com/msojocs/wx-compiler/releases/download/${WX_COMPILER_VERSION}/wcsc" -O "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc.tmp"
|
||||
mv "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc.tmp" "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc"
|
||||
chmod 0755 "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc"
|
||||
fi
|
||||
|
||||
if [ ! -f "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc_module.node" ];then
|
||||
wget -c "https://github.com/msojocs/wx-compiler/releases/download/${WX_COMPILER_VERSION}/wcc_module.node" -O "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc_module.node.tmp"
|
||||
mv "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc_module.node.tmp" "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc_module.node"
|
||||
chmod 0755 "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcc_module.node"
|
||||
fi
|
||||
|
||||
if [ ! -f "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc_module.node" ];then
|
||||
wget -c "https://github.com/msojocs/wx-compiler/releases/download/${WX_COMPILER_VERSION}/wcsc_module.node" -O "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc_module.node.tmp"
|
||||
mv "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc_module.node.tmp" "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc_module.node"
|
||||
chmod 0755 "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}/wcsc_module.node"
|
||||
fi
|
||||
|
||||
# \cp -rf "${srcdir}/compiler/generatemd5.js" "${package_dir}/js/vendor/generatemd5.js"
|
||||
\cp "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}"/{wcc,wcsc} "${package_dir}/node_modules/wcc-exec"
|
||||
cd "${package_dir}/node_modules/wcc-exec" && chmod 0755 wcc wcsc && rm -rf wcc.exe wcsc.exe
|
||||
# node "${package_dir}/js/vendor/generatemd5.js"
|
||||
|
||||
# 修复:可视化用的wcc,wcsc
|
||||
echo "fix: wcc,wcsc"
|
||||
\cp "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}"/wcc_module.node "${package_dir}/node_modules/wcc/build/Release"
|
||||
cd "${package_dir}/node_modules/wcc/build/Release" && rm -rf wcc.node && mv wcc_module.node wcc.node
|
||||
\cp "${srcdir}/cache/compiler/${WX_COMPILER_VERSION}"/wcsc_module.node "${package_dir}/node_modules/wcc/build/Release"
|
||||
cd "${package_dir}/node_modules/wcc/build/Release" && rm -rf wcsc.node && mv wcsc_module.node wcsc.node
|
||||
|
||||
# 修复mock按钮无反应
|
||||
sed -i '1s/^/window.prompt = parent.prompt;\n/' "${package_dir}/js/ideplugin/devtools/index.js"
|
||||
|
||||
# 修复视频无法播放
|
||||
if [ ! -f "${srcdir}/cache/libffmpeg-0.55.00-linux-x64.zip" ];then
|
||||
wget -c https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt/releases/download/0.55.0/0.55.0-linux-x64.zip -O "${srcdir}/cache/libffmpeg-0.55.00-linux-x64.zip.tmp"
|
||||
mv "${srcdir}/cache/libffmpeg-0.55.00-linux-x64.zip.tmp" "${srcdir}/cache/libffmpeg-0.55.00-linux-x64.zip"
|
||||
fi
|
||||
rm -rf "${nwjs_dir}/lib/libffmpeg.so"
|
||||
unzip "${srcdir}/cache/libffmpeg-0.55.00-linux-x64.zip" -d "${nwjs_dir}/lib"
|
||||
|
||||
# Skyline解析插件修复
|
||||
float_pigment_version="continuous"
|
||||
if [ ! -f "${srcdir}/cache/float-pigment-${float_pigment_version}.node" ];then
|
||||
wget -c "https://github.com/msojocs/float-pigment-rust/releases/download/${float_pigment_version}/float-pigment.linux-x64-gnu.node" -O "${srcdir}/cache/float-pigment-${float_pigment_version}.node.tmp"
|
||||
mv "${srcdir}/cache/float-pigment-${float_pigment_version}.node.tmp" "${srcdir}/cache/float-pigment-${float_pigment_version}.node"
|
||||
fi
|
||||
rm "${package_dir}/node_modules/node-float-pigment-css/float-pigment-css-for-nodejs.node" "${package_dir}/node_modules/node-float-pigment-css/float-pigment-css-for-nwjs.node"
|
||||
cp "${srcdir}/cache/float-pigment-${float_pigment_version}.node" "${package_dir}/node_modules/node-float-pigment-css/float-pigment-css-for-nodejs.node"
|
||||
cp "${srcdir}/cache/float-pigment-${float_pigment_version}.node" "${package_dir}/node_modules/node-float-pigment-css/float-pigment-css-for-nwjs.node"
|
||||
|
||||
# 阻止无限启动服务器
|
||||
mv "${package_dir}/js/core/entrance.js" "${package_dir}/js/core/entrance.js.bak"
|
||||
cat "${srcdir}/res/scripts/entrance.js" > "${package_dir}/js/core/entrance.js"
|
||||
cat "${package_dir}/js/core/entrance.js.bak" >> "${package_dir}/js/core/entrance.js"
|
||||
rm "${package_dir}/js/core/entrance.js.bak"
|
||||
|
||||
current=`date "+%Y-%m-%d %H:%M:%S"`
|
||||
timeStamp=`date -d "$current" +%s`
|
||||
echo $timeStamp > "${package_dir}/.build_time"
|
||||
|
||||
|
||||
rm -rf "$tmp_dir/node_modules"
|
@ -13,6 +13,8 @@ const parseFile = function (path) {
|
||||
content.name = "wechat-devtools";
|
||||
// 开启调试,更新参数
|
||||
content['chromium-args'] = content['chromium-args'].replace('--disable-devtools', '--mixed-context').replace('--ignore-gpu-blacklist', '--ignore-gpu-blocklist')
|
||||
// fix worker #145
|
||||
.replace('--js-flags=--harmony-weak-refs', '--enable-features=SharedArrayBuffer')
|
||||
content.window.height = content.window.width = 1000
|
||||
fs.writeFileSync(path, JSON.stringify(content));
|
||||
|
||||
|
@ -7,12 +7,10 @@ const { execSync } = require("child_process");
|
||||
console.info("Patching editor selection copy configs");
|
||||
|
||||
let configPath = os.homedir() + "/.config/wechat_devtools/Default/Editor/User/settings.json";
|
||||
let config = undefined;
|
||||
let config = {};
|
||||
if (fs.existsSync(configPath)) {
|
||||
// console.info(configPath)
|
||||
config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
||||
} else {
|
||||
config = {};
|
||||
}
|
||||
|
||||
config["editor.selectionClipboard"] = false;
|
||||
|
17
tools/install-desktop-icon-bash
Executable file
17
tools/install-desktop-icon-bash
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
|
||||
for size in "64" "128" "256" "512"; do
|
||||
echo "size: $size"
|
||||
install -Dm644 "$root_dir/res/icons/${size}x${size}.png" "${HOME}/.local/share/icons/hicolor/${size}x${size}/wechat-devtools.png"
|
||||
done
|
||||
|
||||
# svg
|
||||
svg_path="${HOME}/.local/share/icons/hicolor/scalable/wechat-devtools.svg"
|
||||
install -Dm644 "$root_dir/res/icons/wechat-devtools.svg" "$svg_path"
|
||||
|
||||
# desktop
|
||||
template_path="$root_dir/res/template.desktop"
|
||||
install -Dm644 "$template_path" "$HOME/.local/share/applications/wechat-devtools.desktop"
|
||||
sed -i 's#dir#'$root_dir'#g' "$HOME/.local/share/applications/wechat-devtools.desktop"
|
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
const { spawn } = require("child_process");
|
||||
const { info } = require("console");
|
||||
|
||||
for (let size of ["64", "128", "256", "512"]) {
|
||||
let iconPath =
|
||||
os.homedir() +
|
||||
`/.local/share/icons/hicolor/${size}x${size}/wechat-devtools.png`;
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(iconPath));
|
||||
} catch (error) {}
|
||||
info(`Writing icon file ${iconPath}`);
|
||||
fs.copyFileSync(
|
||||
path.resolve(__dirname, "../res/icons", `${size}x${size}.png`),
|
||||
iconPath
|
||||
);
|
||||
}
|
||||
|
||||
let svgPath =
|
||||
os.homedir() + "/.local/share/icons/hicolor/scalable/wechat-devtools.svg";
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(svgPath));
|
||||
} catch (error) {}
|
||||
info(`Writing icon file ${svgPath}`);
|
||||
fs.copyFileSync(
|
||||
path.resolve(__dirname, "../res/icons/wechat-devtools.svg"),
|
||||
svgPath
|
||||
);
|
||||
|
||||
let desktopCode = fs
|
||||
.readFileSync(path.resolve(__dirname, "../res/template.desktop"), "utf8")
|
||||
.replace(new RegExp("dir", "g"), path.resolve(__dirname, ".."));
|
||||
|
||||
desktopPath =
|
||||
os.homedir() + "/.local/share/applications/wechat-devtools.desktop";
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(desktopPath));
|
||||
} catch (error) {}
|
||||
info(`Writing desktop file ${desktopPath}`);
|
||||
fs.writeFileSync(desktopPath, desktopCode);
|
7
tools/push-docker.sh
Normal file → Executable file
7
tools/push-docker.sh
Normal file → Executable file
@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
set -ex
|
||||
|
||||
cd $root_dir/docker
|
||||
docker build . --name jiyecafe/wechat-devtools-build:latest
|
||||
# docker tag wechat-web-devtools-linux_wechat_devtools jiyecafe/wechat-devtools-build:latest
|
||||
docker build . -t jiyecafe/wechat-devtools-build:v1.0.4
|
||||
docker tag jiyecafe/wechat-devtools-build:v1.0.4 jiyecafe/wechat-devtools-build:latest
|
||||
docker push jiyecafe/wechat-devtools-build:v1.0.4
|
||||
docker push jiyecafe/wechat-devtools-build:latest
|
@ -2,12 +2,16 @@
|
||||
# 参数:
|
||||
# 1 ---- NW版本
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
|
||||
notice() {
|
||||
echo -e "\033[36m $1 \033[0m "
|
||||
}
|
||||
|
||||
fail() {
|
||||
echo -e "\033[41;37m 失败 \033[0m $1"
|
||||
}
|
||||
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
package_dir="$root_dir/package.nw"
|
||||
export PATH="$root_dir/node/bin:$PATH"
|
||||
@ -22,7 +26,7 @@ fi
|
||||
|
||||
PY_VERSION=`python -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'`
|
||||
if [ $PY_VERSION != 2 ]; then
|
||||
hash python2 2>/dev/null || { echo >&2 "I require python2 but it's not installed. Aborting."; exit 1; }
|
||||
hash python2 2>/dev/null || { fail "I require python2 but it's not installed. Aborting."; exit 1; }
|
||||
ln -s "$( which python2 )" "$root_dir/node/bin/python"
|
||||
fi
|
||||
|
||||
@ -41,7 +45,9 @@ python3 --version
|
||||
|
||||
# these modules are only available in windows
|
||||
cd "${package_dir}/node_modules" && \
|
||||
rm -fr "vscode-windows-ca-certs" "vscode-windows-registry" "vscode-windows-registry-node" "windows-process-tree"
|
||||
rm -fr "vscode-windows-ca-certs" \
|
||||
"vscode-windows-registry" "vscode-windows-registry-node" "windows-process-tree" \
|
||||
"node-pty" "node-pty-node"
|
||||
|
||||
rm -fr "${package_dir}/node_modules/vscode-ripgrep/bin/"* # redownload bin on linux
|
||||
# https://github.com/microsoft/ripgrep-prebuilt
|
||||
@ -52,8 +58,19 @@ mkdir -p tmp && cd tmp
|
||||
# notice "非ACTION模式, 设置镜像源"
|
||||
# export https_proxy="http://127.0.0.1:7890"
|
||||
# fi
|
||||
wget https://github.com/microsoft/ripgrep-prebuilt/releases/download/v12.1.1-1/ripgrep-v12.1.1-1-x86_64-unknown-linux-musl.tar.gz -O ripgrep-v12.1.1-1-x86_64-unknown-linux-musl.tar.gz
|
||||
tar xvf ripgrep-v12.1.1-1-x86_64-unknown-linux-musl.tar.gz -C ../bin && \
|
||||
|
||||
# ripgrep版本
|
||||
ripgrep_version="12.1.1-1"
|
||||
# ripgrep路径
|
||||
ripgrep_path="$root_dir/cache/ripgrep-v${ripgrep_version}-x86_64-unknown-linux-musl.tar.gz"
|
||||
mkdir -p "$root_dir/cache"
|
||||
# 文件不存在,下载
|
||||
if [ ! -f "$ripgrep_path" ];then
|
||||
wget https://github.com/microsoft/ripgrep-prebuilt/releases/download/v12.1.1-1/ripgrep-v12.1.1-1-x86_64-unknown-linux-musl.tar.gz \
|
||||
-O "${ripgrep_path}.tmp"
|
||||
mv "${ripgrep_path}.tmp" "${ripgrep_path}"
|
||||
fi
|
||||
tar xvf "$ripgrep_path" -C ../bin && \
|
||||
cd .. && rm -rf tmp
|
||||
|
||||
(cd "${package_dir}/node_modules" && \
|
||||
@ -71,7 +88,7 @@ export JOBS=$max_thread
|
||||
(cd "${package_dir}/node_modules_tmp" && npm install \
|
||||
extract-file-icon \
|
||||
native-keymap \
|
||||
node-pty \
|
||||
node-pty@1.0.0 \
|
||||
native-watchdog \
|
||||
oniguruma \
|
||||
spdlog@0.11.1 \
|
||||
@ -86,6 +103,10 @@ notice "rebuild node-pty"
|
||||
cd "$package_dir/node_modules_tmp/node_modules" && \
|
||||
cp -fr "node-pty" "node-pty-node" && \
|
||||
cd "node-pty" && nw-gyp rebuild --arch=x64 "--target=$NW_VERSION" --dist-url=https://registry.npmmirror.com/-/binary/nwjs
|
||||
mkdir -p "$package_dir/node_modules/node-pty/build/Release" && \
|
||||
cp -rf "$package_dir/node_modules_tmp/node_modules/node-pty/lib" "$package_dir/node_modules/node-pty/lib" && \
|
||||
cp -rf "$package_dir/node_modules_tmp/node_modules/node-pty/package.json" "$package_dir/node_modules/node-pty/package.json" && \
|
||||
cp -rf "$package_dir/node_modules/node-pty" "$package_dir/node_modules/node-pty-node"
|
||||
|
||||
notice "rebuild native-watchdog"
|
||||
cd "$package_dir/node_modules_tmp/node_modules/native-watchdog" && \
|
||||
@ -112,6 +133,7 @@ find -name "*.a" -delete && \
|
||||
find -name "*.lib" -delete && \
|
||||
find -name "*.mk" -delete)
|
||||
|
||||
# TODO: 检查路径包含空格时,是否正常
|
||||
notice "copy node files"
|
||||
(cd "${package_dir}/node_modules_tmp/node_modules" && \
|
||||
find -name "*.node" | xargs -I{} \cp -rf {} ${package_dir}/node_modules/{})
|
||||
|
@ -1,109 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# 指定版本:
|
||||
# 格式:version=xxxx
|
||||
# version: latest - 最新
|
||||
# x.xx.xxxxx - 指定版本号
|
||||
#
|
||||
|
||||
set -e
|
||||
trap 'catchError $LINENO "$BASH_COMMAND"' ERR # 捕获错误情况
|
||||
catchError() {
|
||||
exit_code=$?
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
fail "\033[31mcommand: $2\n at $0:$1\n at $STEP\033[0m"
|
||||
fi
|
||||
exit $exit_code
|
||||
}
|
||||
success() {
|
||||
echo -e "\033[42;37m 成功 \033[0m $1"
|
||||
}
|
||||
fail() {
|
||||
echo -e "\033[41;37m 失败 \033[0m $1"
|
||||
}
|
||||
notice() {
|
||||
echo -e "\033[36m $1 \033[0m "
|
||||
}
|
||||
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
|
||||
echo "==========Initializing node=========="
|
||||
|
||||
if [ -f "$root_dir/node/bin/node" ]; then
|
||||
success "node安装完毕"
|
||||
else
|
||||
"$root_dir/tools/update-node.sh"
|
||||
success "node ok"
|
||||
fi
|
||||
|
||||
if [ ! -f "$root_dir/node/bin/node" ]; then
|
||||
fail "Node安装失败"
|
||||
exit
|
||||
fi
|
||||
# 将node加入环境
|
||||
export PATH="$root_dir/node/bin":$PATH
|
||||
if [ "$ACTION_MODE" != "true" ]; then
|
||||
notice "非ACTION模式, 设置镜像源"
|
||||
npm config set registry http://registry.npmmirror.com/ # 注册模块镜像
|
||||
npm config set disturl http://npmmirror.com/dist # node-gyp 编译依赖的 node 源码镜像
|
||||
## 以下选择添加
|
||||
npm config set sass_binary_site http://npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像
|
||||
npm config set electron_mirror http://npmmirror.com/mirrors/electron/ # electron 二进制包镜像
|
||||
npm config set puppeteer_download_host http://npmmirror.com/mirrors # puppeteer 二进制包镜像
|
||||
npm config set chromedriver_cdnurl http://npmmirror.com/mirrors/chromedriver # chromedriver 二进制包镜像
|
||||
npm config set operadriver_cdnurl http://npmmirror.com/mirrors/operadriver # operadriver 二进制包镜像
|
||||
npm config set phantomjs_cdnurl http://npmmirror.com/mirrors/phantomjs # phantomjs 二进制包镜像
|
||||
npm config set selenium_cdnurl http://npmmirror.com/mirrors/selenium # selenium 二进制包镜像
|
||||
npm config set node_inspector_cdnurl http://npmmirror.com/mirrors/node-inspector # node-inspector 二进制包镜像
|
||||
# npm cache clean --force # 清空缓存
|
||||
fi
|
||||
echo "=====安装node-gyp nw-gyp===="
|
||||
npm uninstall node-gyp -g
|
||||
npm install node-gyp nw-gyp npm -g
|
||||
node-gyp install
|
||||
node-gyp list
|
||||
|
||||
echo "==========Initializing nwjs=========="
|
||||
if [ -f "$root_dir/nwjs/nw" ]; then
|
||||
success "nwjs安装完毕"
|
||||
else
|
||||
node "$root_dir/tools/update-nwjs-node"
|
||||
fi
|
||||
|
||||
# 7z旧版本解压不正常
|
||||
# rm -rf "$root_dir/tmp/7z"
|
||||
# mkdir -p "$root_dir/tmp/7z"
|
||||
# cd "$root_dir/tmp/7z"
|
||||
# wget https://www.7-zip.org/a/7z2107-linux-x64.tar.xz
|
||||
# tar -xJf 7z2107-linux-x64.tar.xz
|
||||
# ln -s 7zz 7z
|
||||
# export PATH="$root_dir/tmp/7z:$PATH"
|
||||
|
||||
echo "==========Initializing wechat-devtools package=========="
|
||||
|
||||
if [[ $@ == *version* ]];then
|
||||
# 参数有版本号,优先级高,清空TARGET_VERSION
|
||||
echo "参数有版本号"
|
||||
TARGET_VERSION=""
|
||||
else
|
||||
# 参数没有版本号,获取
|
||||
echo "参数没有版本号"
|
||||
VERSION_DATA=$( cat "$root_dir/conf/devtools_v" )
|
||||
VERSION_DATA=(${VERSION_DATA//,/ })
|
||||
TARGET_VERSION="version=${VERSION_DATA[0]}"
|
||||
fi
|
||||
echo "TARGET_VERSION: $TARGET_VERSION"
|
||||
if [ ! -f "$root_dir/package.nw/package.json" ];then
|
||||
# 没装,直接装
|
||||
node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@
|
||||
exit 0
|
||||
fi
|
||||
# 装了,获取已安装版本
|
||||
DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" )
|
||||
DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}"
|
||||
# 已安装, 比较目标版本
|
||||
if [ "$TARGET_VERSION" == "$DEVTOOLS_VERSION" ];then
|
||||
success "微信开发者工具安装完毕"
|
||||
exit 0
|
||||
fi
|
||||
node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@
|
169
tools/setup-wechat-devtools.sh
Executable file
169
tools/setup-wechat-devtools.sh
Executable file
@ -0,0 +1,169 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# 指定版本:
|
||||
# 格式:version=xxxx
|
||||
# version: latest - 最新
|
||||
# x.xx.xxxxx - 指定版本号
|
||||
#
|
||||
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
|
||||
export PATH="$root_dir/tools:$PATH"
|
||||
# 步骤
|
||||
source "step.sh"
|
||||
|
||||
set -e
|
||||
trap 'catchError $LINENO "$BASH_COMMAND"' ERR # 捕获错误情况
|
||||
catchError() {
|
||||
exit_code=$?
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
fail "\033[31mcommand: $2\n at $0:$1\n at $STEP\033[0m"
|
||||
fi
|
||||
exit $exit_code
|
||||
}
|
||||
success() {
|
||||
echo -e "\033[42;37m 成功 \033[0m $1"
|
||||
}
|
||||
fail() {
|
||||
echo -e "\033[41;37m 失败 \033[0m $1"
|
||||
}
|
||||
notice() {
|
||||
echo -e "\033[36m $1 \033[0m "
|
||||
}
|
||||
|
||||
|
||||
if [ $CURRENT_STEP == $INSTALL_START ];then
|
||||
rm -rf "$root_dir"/{node,nwjs,package.nw}
|
||||
echo "==========Initializing node=========="
|
||||
if [ -f "$root_dir/node/bin/node" ]; then
|
||||
step_switch $INSTALL_NODE_SUCCESS
|
||||
success "node安装完毕"
|
||||
else
|
||||
"$root_dir/tools/update-node.sh"
|
||||
step_switch $INSTALL_NODE_SUCCESS
|
||||
success "node ok"
|
||||
fi
|
||||
|
||||
if [ ! -f "$root_dir/node/bin/node" ]; then
|
||||
step_switch $INSTALL_START
|
||||
fail "Node安装失败"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# 将node加入环境
|
||||
export PATH="$root_dir/cache/npm/node_global/bin:$root_dir/node/bin:$PATH"
|
||||
node --version
|
||||
npm --version
|
||||
|
||||
if [ $CURRENT_STEP == $INSTALL_NODE_SUCCESS ];then
|
||||
npm config set prefix "$root_dir/cache/npm/node_global"
|
||||
npm config set cache "$root_dir/cache/npm/node_cache"
|
||||
if [ "$ACTION_MODE" != "true" ]; then
|
||||
notice "非ACTION模式, 设置镜像源"
|
||||
npm config set registry http://registry.npmmirror.com/ # 注册模块镜像
|
||||
npm config set disturl http://npmmirror.com/dist # node-gyp 编译依赖的 node 源码镜像
|
||||
## 以下选择添加
|
||||
npm config set sass_binary_site http://npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像
|
||||
npm config set electron_mirror http://npmmirror.com/mirrors/electron/ # electron 二进制包镜像
|
||||
npm config set puppeteer_download_host http://npmmirror.com/mirrors # puppeteer 二进制包镜像
|
||||
npm config set chromedriver_cdnurl http://npmmirror.com/mirrors/chromedriver # chromedriver 二进制包镜像
|
||||
npm config set operadriver_cdnurl http://npmmirror.com/mirrors/operadriver # operadriver 二进制包镜像
|
||||
npm config set phantomjs_cdnurl http://npmmirror.com/mirrors/phantomjs # phantomjs 二进制包镜像
|
||||
npm config set selenium_cdnurl http://npmmirror.com/mirrors/selenium # selenium 二进制包镜像
|
||||
npm config set node_inspector_cdnurl http://npmmirror.com/mirrors/node-inspector # node-inspector 二进制包镜像
|
||||
fi
|
||||
step_switch $INSTALL_NPM_CONFIG_SUCCESS
|
||||
fi
|
||||
|
||||
if [ $CURRENT_STEP == $INSTALL_NPM_CONFIG_SUCCESS ];then
|
||||
notice "=====安装node-gyp nw-gyp===="
|
||||
npm uninstall node-gyp -g
|
||||
npm install node-gyp nw-gyp@3.6.6 -g
|
||||
echo $PATH
|
||||
node-gyp install
|
||||
node-gyp list
|
||||
step_switch $INSTALL_GYP_SUCCESS
|
||||
fi
|
||||
|
||||
if [ $CURRENT_STEP == $INSTALL_GYP_SUCCESS ];then
|
||||
echo "==========Initializing nwjs=========="
|
||||
if [ -f "$root_dir/nwjs/nw" ]; then
|
||||
success "nwjs安装完毕"
|
||||
else
|
||||
node "$root_dir/tools/update-nwjs-node"
|
||||
fi
|
||||
step_switch $INSTALL_NW_SUCCESS
|
||||
fi
|
||||
|
||||
# 7z旧版本解压不正常
|
||||
# rm -rf "$root_dir/tmp/7z"
|
||||
# mkdir -p "$root_dir/tmp/7z"
|
||||
# cd "$root_dir/tmp/7z"
|
||||
# wget https://www.7-zip.org/a/7z2107-linux-x64.tar.xz
|
||||
# tar -xJf 7z2107-linux-x64.tar.xz
|
||||
# ln -s 7zz 7z
|
||||
# export PATH="$root_dir/tmp/7z:$PATH"
|
||||
|
||||
if [ $CURRENT_STEP == $INSTALL_NW_SUCCESS ];then
|
||||
notice "==========Initializing wechat-devtools package=========="
|
||||
if [[ $@ == *version* ]];then
|
||||
# 参数有版本号,优先级高,清空TARGET_VERSION
|
||||
echo "参数有版本号"
|
||||
TARGET_VERSION=""
|
||||
else
|
||||
# 参数没有版本号,获取
|
||||
echo "参数没有版本号"
|
||||
VERSION_DATA=$( cat "$root_dir/conf/devtools_v" )
|
||||
VERSION_DATA=(${VERSION_DATA//,/ })
|
||||
TARGET_VERSION="version=${VERSION_DATA[0]}"
|
||||
fi
|
||||
echo "TARGET_VERSION: $TARGET_VERSION"
|
||||
if [ ! -f "$root_dir/package.nw/package.json" ];then
|
||||
# 没装,直接装
|
||||
node "$root_dir/tools/update-wechat-devtools.js" $TARGET_VERSION $@
|
||||
|
||||
step_switch $INSTALL_WECHAT_SUCCESS
|
||||
else
|
||||
# 装了,获取已安装版本
|
||||
DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" )
|
||||
DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}"
|
||||
# 已安装, 比较目标版本
|
||||
if [ "$TARGET_VERSION" != "$DEVTOOLS_VERSION" ];then
|
||||
node "$root_dir/tools/update-wechat-devtools.js" $TARGET_VERSION $@
|
||||
fi
|
||||
step_switch $INSTALL_WECHAT_SUCCESS
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $CURRENT_STEP == $INSTALL_WECHAT_SUCCESS ];then
|
||||
notice "Patching wechat-devtools package name"
|
||||
"$root_dir/tools/fix-package-name.js"
|
||||
|
||||
notice "Patching wechat-devtools editor selection autocopy"
|
||||
"$root_dir/tools/fix-selection-copy-node"
|
||||
|
||||
notice "Patching wechat-devtools CLI supports"
|
||||
"$root_dir/tools/fix-cli.sh"
|
||||
|
||||
notice "Patching wechat-devtools core.wxvpkg"
|
||||
"$root_dir/tools/fix-core.sh"
|
||||
|
||||
notice "Rebuilding wechat-devtools node modules"
|
||||
nwjsConfig=`cat "$root_dir/conf/nwjs.json" | grep -m 1 -Eo "version\": \"[0-9]{1}\.[0-9]{2}\.[0-9]+"`
|
||||
nwjs_version="${nwjsConfig/version\": \"/}"
|
||||
"$root_dir/tools/rebuild-node-modules.sh" "$nwjs_version"
|
||||
step_switch $INSTALL_REBUILD_SUCCESS
|
||||
fi
|
||||
|
||||
if [ $CURRENT_STEP == $INSTALL_REBUILD_SUCCESS ];then
|
||||
notice "Patching wechat-devtools"
|
||||
"$root_dir/tools/fix-menu.sh"
|
||||
|
||||
notice "Patching Other"
|
||||
"$root_dir/tools/fix-other.sh"
|
||||
fi
|
||||
|
||||
success "微信开发者工具安装完毕"
|
||||
|
||||
step_over
|
43
tools/step.sh
Executable file
43
tools/step.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
if [ -f "$_dir/tmp/.step" ];then
|
||||
CURRENT_STEP=`cat "$_dir/tmp/.step"`
|
||||
unset _dir
|
||||
if [ "$CURRENT_STEP" == "" ];then
|
||||
echo "default"
|
||||
CURRENT_STEP="INSTALL_START"
|
||||
fi
|
||||
else
|
||||
CURRENT_STEP="INSTALL_START"
|
||||
fi
|
||||
|
||||
INSTALL_START="INSTALL_START"
|
||||
INSTALL_NODE_SUCCESS="INSTALL_NODE_SUCCESS"
|
||||
INSTALL_NPM_CONFIG_SUCCESS="INSTALL_NPM_CONFIG_SUCCESS"
|
||||
INSTALL_GYP_SUCCESS="INSTALL_GYP_SUCCESS"
|
||||
INSTALL_NW_SUCCESS="INSTALL_NW_SUCCESS"
|
||||
INSTALL_WECHAT_SUCCESS="INSTALL_WECHAT_SUCCESS"
|
||||
INSTALL_REBUILD_SUCCESS="INSTALL_REBUILD_SUCCESS"
|
||||
|
||||
|
||||
step_switch() {
|
||||
echo -e "\033[42;36m 切换步骤-> \033[0m $1"
|
||||
CURRENT_STEP=$1
|
||||
_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
echo -n "$1" > "$_dir/tmp/.step"
|
||||
unset _dir
|
||||
}
|
||||
|
||||
step_error() {
|
||||
echo -e "\033[41;37m 步骤异常-> \033[0m $1 $2"
|
||||
step_switch $2
|
||||
CURRENT_STEP=$1
|
||||
exit
|
||||
}
|
||||
|
||||
step_over() {
|
||||
_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
echo -n "" > "$_dir/tmp/.step"
|
||||
unset _dir
|
||||
}
|
@ -91,7 +91,7 @@ const download = function (url) {
|
||||
util.format("../cache/wechat_devtools_%s_x64.exe", version)
|
||||
);
|
||||
let headers = execSync(`curl -IL "${url}"`).toString()
|
||||
console.log(headers)
|
||||
console.log('response header data:', headers)
|
||||
md5 = headers.match(/X-COS-META-MD5: (.*?)\r/i)[1]
|
||||
|
||||
if (fs.existsSync(localPath)) {
|
||||
@ -196,102 +196,112 @@ const upgrade = function (extractPath) {
|
||||
);
|
||||
}
|
||||
}
|
||||
if(fs.existsSync(path.resolve(__dirname, '../package.nw/js/common/miniprogram-builder/modules/fullcompiler/app/contactandlaunch/updateContactAndLaunch.js'))) {
|
||||
try {
|
||||
fs.renameSync(
|
||||
path.resolve(__dirname, '../package.nw/js/common/miniprogram-builder/modules/fullcompiler/app/contactandlaunch/updateContactAndLaunch.js'),
|
||||
path.resolve(__dirname, '../package.nw/js/common/miniprogram-builder/modules/fullcompiler/app/contactandlaunch/updatecontactandlaunch.js')
|
||||
)
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
const patch_wechat_devtools_package_name = function () {
|
||||
info("Patching wechat-devtools package name");
|
||||
// const patch_wechat_devtools_package_name = function () {
|
||||
// info("Patching wechat-devtools package name");
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
spawn(path.resolve(__dirname, "fix-package-name.js"), [], {
|
||||
stdio: "inherit",
|
||||
}).on("close", (code) => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
const patch_wechat_devtools_editor_selection_autocopy = function () {
|
||||
info("Patching wechat-devtools editor selection autocopy");
|
||||
// return new Promise((resolve, reject) => {
|
||||
// spawn(path.resolve(__dirname, "fix-package-name.js"), [], {
|
||||
// stdio: "inherit",
|
||||
// }).on("close", (code) => {
|
||||
// resolve();
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
// const patch_wechat_devtools_editor_selection_autocopy = function () {
|
||||
// info("Patching wechat-devtools editor selection autocopy");
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
spawn(path.resolve(__dirname, "fix-selection-copy-node"), [], {
|
||||
stdio: "inherit",
|
||||
}).on("close", (code) => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
const patch_wechat_devtools_CLI = function () {
|
||||
info("Patching wechat-devtools CLI supports");
|
||||
// return new Promise((resolve, reject) => {
|
||||
// spawn(path.resolve(__dirname, "fix-selection-copy-node"), [], {
|
||||
// stdio: "inherit",
|
||||
// }).on("close", (code) => {
|
||||
// resolve();
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
// const patch_wechat_devtools_CLI = function () {
|
||||
// info("Patching wechat-devtools CLI supports");
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
spawn(path.resolve(__dirname, "fix-cli.sh"), [], {
|
||||
stdio: "inherit",
|
||||
}).on("close", (code) => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
const patch_wechat_devtools_core = function () {
|
||||
info("Patching wechat-devtools core.wxvpkg");
|
||||
// return new Promise((resolve, reject) => {
|
||||
// spawn(path.resolve(__dirname, "fix-cli.sh"), [], {
|
||||
// stdio: "inherit",
|
||||
// }).on("close", (code) => {
|
||||
// resolve();
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
// const patch_wechat_devtools_core = function () {
|
||||
// info("Patching wechat-devtools core.wxvpkg");
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
spawn(path.resolve(__dirname, "fix-core.sh"), [], {
|
||||
stdio: "inherit",
|
||||
}).on("close", (code) => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
const rebuild_wechat_devtools_node_modules = function () {
|
||||
info("Rebuilding wechat-devtools node modules");
|
||||
// return new Promise((resolve, reject) => {
|
||||
// spawn(path.resolve(__dirname, "fix-core.sh"), [], {
|
||||
// stdio: "inherit",
|
||||
// }).on("close", (code) => {
|
||||
// resolve();
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
// const rebuild_wechat_devtools_node_modules = function () {
|
||||
// info("Rebuilding wechat-devtools node modules");
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const nwConfig = require(path.resolve(__dirname, "../conf/nwjs.json"));
|
||||
const e = spawn(
|
||||
path.resolve(__dirname, "rebuild-node-modules.sh"),
|
||||
[nwConfig.version],
|
||||
{
|
||||
stdio: "inherit",
|
||||
}
|
||||
);
|
||||
e.on("error", (code) => {
|
||||
reject(code);
|
||||
});
|
||||
e.on("close", (code) => {
|
||||
console.info(
|
||||
`Rebuilding wechat-devtools node modules Result Code: ${code}`
|
||||
);
|
||||
if (0 === code) resolve();
|
||||
else {
|
||||
reject(code);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
const patch_wechat_devtools = function () {
|
||||
info("Patching wechat-devtools");
|
||||
// return new Promise((resolve, reject) => {
|
||||
// const nwConfig = require(path.resolve(__dirname, "../conf/nwjs.json"));
|
||||
// const e = spawn(
|
||||
// path.resolve(__dirname, "rebuild-node-modules.sh"),
|
||||
// [nwConfig.version],
|
||||
// {
|
||||
// stdio: "inherit",
|
||||
// }
|
||||
// );
|
||||
// e.on("error", (code) => {
|
||||
// reject(code);
|
||||
// });
|
||||
// e.on("close", (code) => {
|
||||
// console.info(
|
||||
// `Rebuilding wechat-devtools node modules Result Code: ${code}`
|
||||
// );
|
||||
// if (0 === code) resolve();
|
||||
// else {
|
||||
// reject(code);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
// const patch_wechat_devtools = function () {
|
||||
// info("Patching wechat-devtools");
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const exec = spawn(path.resolve(__dirname, "fix-menu.sh"), [], {
|
||||
stdio: "inherit",
|
||||
});
|
||||
exec.on("close", (code) => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
const patch_other = function () {
|
||||
info("Patching Other");
|
||||
// return new Promise((resolve, reject) => {
|
||||
// const exec = spawn(path.resolve(__dirname, "fix-menu.sh"), [], {
|
||||
// stdio: "inherit",
|
||||
// });
|
||||
// exec.on("close", (code) => {
|
||||
// resolve();
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
// const patch_other = function () {
|
||||
// info("Patching Other");
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
execSync(path.resolve(__dirname, "fix-other.sh"));
|
||||
// return new Promise((resolve, reject) => {
|
||||
// execSync(path.resolve(__dirname, "fix-other.sh"));
|
||||
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
// resolve();
|
||||
// });
|
||||
// };
|
||||
|
||||
const start = async () => {
|
||||
try {
|
||||
@ -299,13 +309,13 @@ const start = async () => {
|
||||
const localPath = await download(url);
|
||||
const extractPath = await extract(localPath);
|
||||
await upgrade(extractPath);
|
||||
await patch_wechat_devtools_package_name();
|
||||
await patch_wechat_devtools_editor_selection_autocopy();
|
||||
await patch_wechat_devtools_CLI();
|
||||
await patch_wechat_devtools_core();
|
||||
await rebuild_wechat_devtools_node_modules();
|
||||
await patch_wechat_devtools();
|
||||
await patch_other();
|
||||
// await patch_wechat_devtools_package_name();
|
||||
// await patch_wechat_devtools_editor_selection_autocopy();
|
||||
// await patch_wechat_devtools_CLI();
|
||||
// await patch_wechat_devtools_core();
|
||||
// await rebuild_wechat_devtools_node_modules();
|
||||
// await patch_wechat_devtools();
|
||||
// await patch_other();
|
||||
// 写入构建时间戳
|
||||
fs.writeFileSync(
|
||||
path.resolve(__dirname, "../package.nw/.build_time"),
|
@ -3,7 +3,6 @@
|
||||
// https://gist.github.com/chemzqm/9f2334ca201dc2fbc363fdd757aa2ed4
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
const { execSync } = require('child_process')
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const from = args[0]
|
||||
@ -12,7 +11,10 @@ const to = args[1]
|
||||
let file = to
|
||||
console.log(file)
|
||||
if (fs.existsSync(file)) {
|
||||
execSync(`rm -rf ${file}`)
|
||||
try{
|
||||
fs.rmSync(file)
|
||||
}
|
||||
catch{}
|
||||
}
|
||||
|
||||
let fd = fs.openSync(file, 'w')
|
||||
@ -28,7 +30,10 @@ function writeInt32(number, start) {
|
||||
writeSync(buf, start)
|
||||
}
|
||||
|
||||
let files = fs.readdirSync(dest)
|
||||
// 加入子文件夹的文件
|
||||
const files = fs.readdirSync(dest, { recursive: true }).filter(e => fs.statSync(path.join(dest, e)).isFile())
|
||||
// console.log(JSON.stringify(files, null, 4))
|
||||
|
||||
// 文件数
|
||||
let totalCount = files.length
|
||||
|
||||
@ -57,6 +62,7 @@ for (let file of files) {
|
||||
writeInt32(dataOffset, start)
|
||||
start += 4
|
||||
// write length
|
||||
// console.info('dest:', dest, 'file:', file)
|
||||
let contentBuf = fs.readFileSync(path.join(dest, file))
|
||||
writeInt32(contentBuf.length, start)
|
||||
start += 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user