Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: provide portable file. #657

Closed
ivysrono opened this issue Mar 16, 2020 · 7 comments
Closed

feature request: provide portable file. #657

ivysrono opened this issue Mar 16, 2020 · 7 comments

Comments

@ivysrono
Copy link
Contributor

As I know, electron-builder has this feature.
this may work with #656

@yishn
Copy link
Member

yishn commented Mar 16, 2020

Maybe you can help us set up this feature?

@ivysrono
Copy link
Contributor Author

I'm not good at electron and webpack, just try:

"build":

    "win": {
      "target": "portable"
    },

"scripts":

    "p": "npm run bundle && electron-builder --win",

Get Sabaki 0.50.1.exe and launch error:

[Window Title]
Error

[Main Instruction]
A JavaScript error occurred in the main process

[Content]
Uncaught Exception:
Error: Cannot find module '@sabaki/i18n'
Require stack:
- C:\Users\xx\AppData\Local\Temp\1ZDG19Esb5o7IvwBezRH2Ex47V4\resources\app.asar\src\i18n.js
- C:\Users\xx\AppData\Local\Temp\1ZDG19Esb5o7IvwBezRH2Ex47V4\resources\app.asar\src\main.js
- 
    at Module._resolveFilename (internal/modules/cjs/loader.js:798:15)
    at Function../lib/common/reset-search-paths.ts.Module._resolveFilename (electron/js2c/browser_init.js:7595:16)
    at Module._load (internal/modules/cjs/loader.js:691:27)
    at Module._load (electron/js2c/asar.js:717:26)
    at Function.Module._load (electron/js2c/asar.js:717:26)
    at Module.require (internal/modules/cjs/loader.js:853:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\Users\xx\AppData\Local\Temp\1ZDG19Esb5o7IvwBezRH2Ex47V4\resources\app.asar\src\i18n.js:7:19)
    at Module._compile (internal/modules/cjs/loader.js:968:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:986:10)

yishn added a commit that referenced this issue Mar 16, 2020
@yishn
Copy link
Member

yishn commented Mar 16, 2020

We didn't include @sabaki/i18n in the build bundle; it should work fine now.

@ivysrono
Copy link
Contributor Author

#659

@ivysrono
Copy link
Contributor Author

ivysrono commented Mar 17, 2020

discussion:
I have writen a vbs file to package sabaki fast:

command_chinesenpm = "npm --registry https://registry.npm.taobao.org install"
command_disturl = "npm config set disturl https://npm.taobao.org/mirrors/atom-shell"
command_electron = "npm config set ELECTRON_MIRROR https://cdn.npm.taobao.org/dist/electron/"

LangId = CreateObject("wscript.Shell").RegRead("HKEY_CURRENT_USER\Control Panel\International\Locale")

If LangId = "00000804" Then ' Accelerate and simplify for Chinese Mainland users.
    CreateObject("WScript.Shell").Run command_electron, 1, true
    CreateObject("WScript.Shell").Run command_disturl, 1, true
    CreateObject("WScript.Shell").Run command_chinesenpm, 1, true
Else
    CreateObject("WScript.Shell").Run "npm install", 1, true
End If

'CreateObject("WScript.Shell").Run "npm run watch", 0
'CreateObject("WScript.Shell").Run "npm start", 0
'CreateObject("WScript.Shell").Run "npm run build", 1, true

CreateObject("WScript.Shell").Run "npm run dist:port", 1, true
CreateObject("WScript.Shell").Run "npm run dist:win", 1, true
'CreateObject("WScript.Shell").Run "npm run dist:linux", 1, true
'CreateObject("WScript.Shell").Run "npm run dist:macos", 1, true

'00000804 Chinese (PRC)
'00000404 Chinese (Taiwan)
'00000c04 Chinese (Hong Kong SAR, PRC)
'00001004 Chinese (Singapore)

NPM and github are so slow in China, that's why we need to set mirror.
Would you merge it if I create one PR?
If yes, should I delete the LangId check?
If no, would you like to add *.vbs in .gitignore?

@yishn
Copy link
Member

yishn commented Mar 17, 2020

If we'd like to provide such a script, we need to make it cross-platform, and not Windows only. Maybe we should link to the instructions? If you just want to add .vbs to .gitignore, feel free to add it in your existing PR.

@ivysrono ivysrono changed the title featire request: provide portable file. feature request: provide portable file. Mar 17, 2020
yishn pushed a commit that referenced this issue Mar 17, 2020
* add portable file package support

#657

* fix

* clean

* Update package.json

* Update .gitignore

* Update building-tests.md
@ivysrono
Copy link
Contributor Author

Thanks, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants