Skip to content

Commit

Permalink
嵌入执行node程序
Browse files Browse the repository at this point in the history
  • Loading branch information
2284730142 committed May 8, 2021
1 parent 32fbaa6 commit 2a8f715
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 286 deletions.
9 changes: 0 additions & 9 deletions .erb/configs/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ export default {
}
]
},
{
test: /\.node$/,
loader: 'native-ext-loader',
options: {
// rewritePath: process.env.NODE_ENV === 'production' ? path.resolve(__dirname, '../../resources/app/dist') : undefined
basePath: process.env.NODE_ENV === 'production' ? ['../assets/slsdk'] : []
// name: "[path][name].[ext]",
}
}
]
},

Expand Down
Binary file added assets/NeteaseCloudMusicApi.exe
Binary file not shown.
3 changes: 3 additions & 0 deletions assets/run.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Set ws = CreateObject("Wscript.Shell")
ws.currentdirectory = "assets"
ws.run "cmd /c NeteaseCloudMusicApi.exe",vbhide
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"@babel/preset-env": "^7.13.12",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@babel/register": "^7.13.14",
"@babel/register": "^7.13.16",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
"@teamsupercell/typings-for-css-modules-loader": "^2.5.1",
"@testing-library/jest-dom": "^5.11.10",
Expand Down
16 changes: 10 additions & 6 deletions src/main.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ import path from 'path';
import {app, BrowserWindow, ipcMain, IpcMainEvent} from 'electron';
import {autoUpdater} from 'electron-updater';
import log from 'electron-log';
import expressServer from './server/app';
import {serverPort} from "./server/config";
import {ReceiveMessageFromRender, RenderMessageArgsType} from "./window/event.window";
import {ReceiveMessageFromRender, RenderMessageArgsType} from './window/event.window';
import {exec} from 'child_process';

const RESOURCES_PATH = app.isPackaged ? path.join(process.resourcesPath, 'assets') : path.join(__dirname, '../assets');

Expand Down Expand Up @@ -94,9 +93,14 @@ const createWindow = async () => {
});
// 移除菜单栏
mainWindow.setMenu(null);
// 创建本地node服务(整合express) todo 更改为子线程服务后续接着改成cluster模式的service
expressServer.listen(serverPort, () => {
console.log(`Example app listening at http://localhost:${serverPort}`);
// 创建本地node服务(整合express)pkg打包 todo 改成cluster模式的service pm2
console.log(getAssetPath('run.vbs'));
exec(`cscript ${getAssetPath('run.vbs')}`, (err, stdout) => {
if (err) {
console.log(`err: ${err}`);
return;
}
console.log(`stdout: ${stdout}`);
});
};

Expand Down
265 changes: 0 additions & 265 deletions src/main.prod.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,266 +1 @@
/*!
* accepts
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* body-parser
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* body-parser
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* bytes
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015 Jed Watson
* MIT Licensed
*/

/*!
* content-disposition
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* content-type
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* cookie
* Copyright(c) 2012-2014 Roman Shtylman
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* depd
* Copyright(c) 2014 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* depd
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* depd
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* depd
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* destroy
* Copyright(c) 2014 Jonathan Ong
* MIT Licensed
*/

/*!
* ee-first
* Copyright(c) 2014 Jonathan Ong
* MIT Licensed
*/

/*!
* encodeurl
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* escape-html
* Copyright(c) 2012-2013 TJ Holowaychuk
* Copyright(c) 2015 Andreas Lubbe
* Copyright(c) 2015 Tiancheng "Timothy" Gu
* MIT Licensed
*/

/*!
* etag
* Copyright(c) 2014-2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2013 Roman Shtylman
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* finalhandler
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* forwarded
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* fresh
* Copyright(c) 2012 TJ Holowaychuk
* Copyright(c) 2016-2017 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* http-errors
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* media-typer
* Copyright(c) 2014 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* merge-descriptors
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* methods
* Copyright(c) 2013-2014 TJ Holowaychuk
* Copyright(c) 2015-2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* MIT Licensed
*/

/*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* negotiator
* Copyright(c) 2012 Federico Romero
* Copyright(c) 2012-2014 Isaac Z. Schlueter
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* on-finished
* Copyright(c) 2013 Jonathan Ong
* Copyright(c) 2014 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* parseurl
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* proxy-addr
* Copyright(c) 2014-2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* range-parser
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015-2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* raw-body
* Copyright(c) 2013-2014 Jonathan Ong
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* send
* Copyright(c) 2012 TJ Holowaychuk
* Copyright(c) 2014-2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* serve-static
* Copyright(c) 2010 Sencha Inc.
* Copyright(c) 2011 TJ Holowaychuk
* Copyright(c) 2014-2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* statuses
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* toidentifier
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* type-is
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* unpipe
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/

/*!
* vary
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/

/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1079,13 +1079,13 @@
"@babel/helper-validator-option" "^7.12.17"
"@babel/plugin-transform-typescript" "^7.13.0"

"@babel/register@^7.13.14":
version "7.13.14"
resolved "https://registry.npm.taobao.org/@babel/register/download/@babel/register-7.13.14.tgz?cache=0&sync_timestamp=1617027525533&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fregister%2Fdownload%2F%40babel%2Fregister-7.13.14.tgz#bbfa8f4f027c2ebc432e8e69e078b632605f2d9b"
integrity sha1-u/qPTwJ8LrxDLo5p4Hi2MmBfLZs=
"@babel/register@^7.13.16":
version "7.13.16"
resolved "https://registry.nlark.com/@babel/register/download/@babel/register-7.13.16.tgz?cache=0&sync_timestamp=1618918365114&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fregister%2Fdownload%2F%40babel%2Fregister-7.13.16.tgz#ae3ab0b55c8ec28763877383c454f01521d9a53d"
integrity sha1-rjqwtVyOwodjh3ODxFTwFSHZpT0=
dependencies:
clone-deep "^4.0.1"
find-cache-dir "^2.0.0"
lodash "^4.17.19"
make-dir "^2.1.0"
pirates "^4.0.0"
source-map-support "^0.5.16"
Expand Down

0 comments on commit 2a8f715

Please sign in to comment.