Skip to content

Commit

Permalink
修复symlink文件丢失问题
Browse files Browse the repository at this point in the history
  • Loading branch information
shixiongfei committed May 15, 2024
1 parent 015c016 commit 2f0cddf
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "napi-ctp",
"version": "0.2.0",
"version": "0.2.1",
"description": "Node API for CTP",
"main": "index.js",
"types": "index.d.ts",
Expand All @@ -20,7 +20,7 @@
"build": "node-gyp clean && node-gyp-build && tsc",
"build:debug": "node-gyp clean && node-gyp configure && node-gyp build --debug && tsc",
"install": "node-gyp-build",
"prebuild": "prebuildify --napi",
"prebuild": "node prebuild.js && prebuildify --napi",
"test": "node test.js"
},
"repository": {
Expand Down
39 changes: 39 additions & 0 deletions prebuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* prebuild.js
*
* Copyright (c) 2022-2024 Xiongfei Shi
*
* Author: Xiongfei Shi <xiongfei.shi(a)icloud.com>
* License: Apache-2.0
*
* https://github.com/shixiongfei/napi-ctp
*/

if (process.platform === "darwin") {
const fs = require("node:fs");

const symlinks = [
[
"./tradeapi/macos/thostmduserapi_se.framework/thostmduserapi_se",
"./Versions/Current",
],
[
"./tradeapi/macos/thostmduserapi_se.framework/Versions/Current",
"./A/thostmduserapi_se",
],
[
"./tradeapi/macos/thosttraderapi_se.framework/thosttraderapi_se",
"./Versions/Current",
],
[
"./tradeapi/macos/thosttraderapi_se.framework/Versions/Current",
"./A/thosttraderapi_se",
],
];

symlinks.forEach(([symlink, target]) => {
if (!fs.existsSync(symlink)) {
fs.symlinkSync(target, symlink);
}
});
}

0 comments on commit 2f0cddf

Please sign in to comment.