Compare commits
3 Commits
e569719f97
...
49b31301cf
Author | SHA1 | Date | |
---|---|---|---|
49b31301cf | |||
892fea509f | |||
38cc5e2189 |
31
.drone.yml
Normal file
31
.drone.yml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: node:16.18-bullseye
|
||||||
|
commands:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y cmake jq zip
|
||||||
|
- ./scripts/build-wasm.sh
|
||||||
|
- npm ci
|
||||||
|
- npm run test
|
||||||
|
- ./scripts/build-and-package.sh modern
|
||||||
|
- ./scripts/build-and-package.sh legacy
|
||||||
|
- ./scripts/build-and-package.sh extension
|
||||||
|
- sha256sum *.zip > sha256sum.txt
|
||||||
|
|
||||||
|
- name: upload
|
||||||
|
image: plugins/s3
|
||||||
|
settings:
|
||||||
|
bucket: um-web
|
||||||
|
access_key:
|
||||||
|
from_secret: S3_ACCESS_KEY
|
||||||
|
secret_key:
|
||||||
|
from_secret: S3_SECRET_KEY
|
||||||
|
source: |
|
||||||
|
*.zip
|
||||||
|
sha256sum.txt
|
||||||
|
target: /${DRONE_COMMIT_BRANCH}-latest
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
/dist
|
||||||
|
/build
|
||||||
/coverage
|
/coverage
|
||||||
|
|
||||||
# local env files
|
# local env files
|
||||||
@ -27,3 +28,6 @@ yarn-error.log*
|
|||||||
/src/QmcWasm/build
|
/src/QmcWasm/build
|
||||||
/src/QmcWasm/*.js
|
/src/QmcWasm/*.js
|
||||||
/src/QmcWasm/*.wasm
|
/src/QmcWasm/*.wasm
|
||||||
|
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
28
README.md
28
README.md
@ -44,8 +44,8 @@
|
|||||||
|
|
||||||
### 自行构建
|
### 自行构建
|
||||||
|
|
||||||
#### JS部分
|
#### JS部分
|
||||||
|
|
||||||
- 环境要求
|
- 环境要求
|
||||||
- nodejs (v16.x)
|
- nodejs (v16.x)
|
||||||
- npm
|
- npm
|
||||||
@ -70,15 +70,15 @@
|
|||||||
```sh
|
```sh
|
||||||
npm run make-extension
|
npm run make-extension
|
||||||
```
|
```
|
||||||
|
|
||||||
#### WASM部分
|
#### WASM部分
|
||||||
|
|
||||||
- 环境要求
|
- 环境要求
|
||||||
- Linux
|
- Linux
|
||||||
- python3
|
- python3
|
||||||
|
|
||||||
- 运行此目录下的build-wasm
|
- 运行此目录下的build-wasm
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
bash build-wasm
|
./scripts/build-wasm.sh
|
||||||
```
|
```
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
setupFilesAfterEnv: [
|
testPathIgnorePatterns: ['/build/', '/dist/', '/node_modules/'],
|
||||||
'./src/__test__/setup_jest.js'
|
setupFilesAfterEnv: ['./src/__test__/setup_jest.js'],
|
||||||
],
|
moduleNameMapper: {
|
||||||
moduleNameMapper: {
|
'@/(.*)': '<rootDir>/src/$1',
|
||||||
'@/(.*)': '<rootDir>/src/$1'
|
},
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const src = "./src/extension/"
|
const src = __dirname + "/src/extension/"
|
||||||
const dst = "./dist"
|
const dst = __dirname + "/dist"
|
||||||
fs.readdirSync(src).forEach(file => {
|
fs.readdirSync(src).forEach(file => {
|
||||||
let srcPath = path.join(src, file)
|
let srcPath = path.join(src, file)
|
||||||
let dstPath = path.join(dst, file)
|
let dstPath = path.join(dst, file)
|
||||||
fs.copyFileSync(srcPath, dstPath)
|
fs.copyFileSync(srcPath, dstPath)
|
||||||
console.log(`Copy: ${srcPath} => ${dstPath}`)
|
console.log(`Copy: ${srcPath} => ${dstPath}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
const manifestRaw = fs.readFileSync("./extension-manifest.json", "utf-8")
|
const manifestRaw = fs.readFileSync(__dirname + "/extension-manifest.json", "utf-8")
|
||||||
const manifest = JSON.parse(manifestRaw)
|
const manifest = JSON.parse(manifestRaw)
|
||||||
|
|
||||||
const pkgRaw = fs.readFileSync("./package.json", "utf-8")
|
const pkgRaw = fs.readFileSync(__dirname + "/package.json", "utf-8")
|
||||||
const pkg = JSON.parse(pkgRaw)
|
const pkg = JSON.parse(pkgRaw)
|
||||||
|
|
||||||
verExt = pkg["version"]
|
verExt = pkg["version"]
|
||||||
if (verExt.startsWith("v")) verExt = verExt.slice(1)
|
if (verExt.startsWith("v")) verExt = verExt.slice(1)
|
||||||
if (verExt.includes("-")) verExt = verExt.split("-")[0]
|
if (verExt.includes("-")) verExt = verExt.split("-")[0]
|
||||||
manifest["version"] = `${verExt}.${pkg["ext_build"]}`
|
manifest["version"] = `${verExt}.${pkg["ext_build"]}`
|
||||||
manifest["version_name"] = pkg["version"]
|
manifest["version_name"] = pkg["version"]
|
||||||
|
|
||||||
fs.writeFileSync("./dist/manifest.json", JSON.stringify(manifest), "utf-8")
|
fs.writeFileSync(__dirname + "/dist/manifest.json", JSON.stringify(manifest), "utf-8")
|
||||||
console.log("Write: manifest.json")
|
console.log("Write: manifest.json")
|
||||||
|
23
scripts/build-and-package.sh
Executable file
23
scripts/build-and-package.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
cd "$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
|
VERSION="$(jq -r ".version" <package.json)"
|
||||||
|
DIST_NAME="um-web.$1.${VERSION}"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
"modern") npm run build -- --modern ;;
|
||||||
|
"legacy") npm run build ;;
|
||||||
|
"extension") npm run make-extension ;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unknown command: $1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
mv dist "${DIST_NAME}"
|
||||||
|
zip -rJ9 "${DIST_NAME}.zip" "${DIST_NAME}"
|
||||||
|
rm -rf "${DIST_NAME}"
|
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
set -ex
|
||||||
|
|
||||||
|
cd "$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
pushd ./src/QmcWasm
|
pushd ./src/QmcWasm
|
||||||
bash build-wasm
|
bash build-wasm
|
@ -12,16 +12,16 @@ if [ -z "$BUILD_TYPE" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p build/wasm
|
mkdir -p build/wasm
|
||||||
if [ ! -d build/emsdk ]; then
|
if [ ! -d ../../build/emsdk ]; then
|
||||||
git clone https://github.com/emscripten-core/emsdk.git build/emsdk
|
git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd build/emsdk
|
pushd ../../build/emsdk
|
||||||
#git pull
|
#git pull
|
||||||
./emsdk install 3.0.0
|
./emsdk install 3.0.0
|
||||||
./emsdk activate 3.0.0
|
./emsdk activate 3.0.0
|
||||||
source ./emsdk_env.sh
|
source ./emsdk_env.sh
|
||||||
popd # build/emsdk
|
popd # ../../build/emsdk
|
||||||
|
|
||||||
pushd build/wasm
|
pushd build/wasm
|
||||||
emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../..
|
emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../..
|
||||||
@ -33,8 +33,6 @@ TARGET_FILES="
|
|||||||
KgmWasmBundle.js
|
KgmWasmBundle.js
|
||||||
"
|
"
|
||||||
|
|
||||||
#mkdir -p "${CURR_DIR}/npm"
|
|
||||||
#cp $TARGET_FILES "${CURR_DIR}/npm/"
|
|
||||||
cp $TARGET_FILES "${CURR_DIR}/"
|
cp $TARGET_FILES "${CURR_DIR}/"
|
||||||
popd # build/wasm
|
popd # build/wasm
|
||||||
|
|
||||||
|
@ -12,16 +12,15 @@ if [ -z "$BUILD_TYPE" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p build/wasm
|
mkdir -p build/wasm
|
||||||
if [ ! -d build/emsdk ]; then
|
if [ ! -d ../../build/emsdk ]; then
|
||||||
git clone https://github.com/emscripten-core/emsdk.git build/emsdk
|
git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd build/emsdk
|
pushd ../../build/emsdk
|
||||||
#git pull
|
|
||||||
./emsdk install 3.0.0
|
./emsdk install 3.0.0
|
||||||
./emsdk activate 3.0.0
|
./emsdk activate 3.0.0
|
||||||
source ./emsdk_env.sh
|
source ./emsdk_env.sh
|
||||||
popd # build/emsdk
|
popd # ../../build/emsdk
|
||||||
|
|
||||||
pushd build/wasm
|
pushd build/wasm
|
||||||
emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../..
|
emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../..
|
||||||
@ -33,8 +32,6 @@ TARGET_FILES="
|
|||||||
QmcWasmBundle.js
|
QmcWasmBundle.js
|
||||||
"
|
"
|
||||||
|
|
||||||
#mkdir -p "${CURR_DIR}/npm"
|
|
||||||
#cp $TARGET_FILES "${CURR_DIR}/npm/"
|
|
||||||
cp $TARGET_FILES "${CURR_DIR}/"
|
cp $TARGET_FILES "${CURR_DIR}/"
|
||||||
popd # build/wasm
|
popd # build/wasm
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// import { DecryptBuffer as DecryptQmcCacheBuffer } from '../qmccache';
|
|
||||||
// import fs from 'fs';
|
|
||||||
//
|
|
||||||
// const expectedBuffer = fs.readFileSync(__dirname + '/fixture/qmc_cache_expected.bin');
|
|
||||||
//
|
|
||||||
// const createInputBuffer = () => {
|
|
||||||
// const buffer = Buffer.alloc(256);
|
|
||||||
// for (let i = buffer.byteLength; i >= 0; i--) {
|
|
||||||
// buffer[i] = i;
|
|
||||||
// }
|
|
||||||
// return buffer;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// describe('decrypt/qmccache', () => {
|
|
||||||
// it('should decrypt specified buffer correctly', () => {
|
|
||||||
// const input = createInputBuffer();
|
|
||||||
// DecryptQmcCacheBuffer(input);
|
|
||||||
// expect(input).toEqual(expectedBuffer);
|
|
||||||
// });
|
|
||||||
// });
|
|
Loading…
Reference in New Issue
Block a user