diff --git a/README.md b/README.md index d9a65dc1..6a120284 100644 --- a/README.md +++ b/README.md @@ -46,51 +46,31 @@ The icon is provided under [Creative Commons BY-NC-SA](https://creativecommons.o The default sounds of notifications is provided [Creative Commons BY](https://creativecommons.org/licenses/by/4.0/) -## Privacy Policy +### Privacy Policy * [プライバシーポリシー(Privacy Policy(ja))](https://thedesk.top/priv.html) -## Language - -* 日本語(Japanese) -* 日本語, 関西(Japanese, Kansai) -* English -* български(Bulgarian) with [translate project](https://translate.thedesk.top/project/thedesk/bg) -* Česky(Czech) with [translate project](https://translate.thedesk.top/project/thedesk/cs) -* Deutsch(German) with [translate project](https://translate.thedesk.top/project/thedesk/de) -* Español, argentina(Spanish, Argentina) with [translate project](https://translate.thedesk.top/project/thedesk/es-AR) -* italiano(Italian) with [translate project](https://translate.thedesk.top/project/thedesk/it-IT) - -and more... - -### Translation +## Translation Crowdin project is available! Visit: https://translate.thedesk.top -### Run on developer mode +## Development -**you cannot use npm or any other package manager without Yarn.**(it will throw error) + to launch developer version with console(if close dev mode, you may press Ctrl+C twice.) -* `yarn` -* `yarn dev` +**Strongly recommend to use yarn, not npm** -## Contributors +```sh +git clone https://github.com/cutls/TheDesk +cd TheDesk/app +yarn install -Build for macOS(Now: Travis CI) - -* [toneji](https://minohdon.jp/@toneji) - -Build for Linux(Now: Travis CI) - -* [popn_ja](https://popon.pptdn.jp/@popn_ja) - -Fellow coder - -* [kPherox](https://pl.kpherox.dev/kPherox) +yarn dev +``` ## Build -**you cannot use npm or any other package manager without Yarn.**(it will throw error) +**Strongly recommend to use yarn, not npm** ```sh git clone https://github.com/cutls/TheDesk @@ -100,7 +80,9 @@ yarn install yarn build ``` -run `yarn dev` to launch developer version with console(if close dev mode, you may press Ctrl+C twice.) +### Options + +Look at `yarn build --help` ### Restriction with macOS build @@ -108,7 +90,17 @@ Requires XCode(XCode Command Line Tools) to use iTunes NowPlaying Built assets should be notarized after building by expensive Apple Developer user. To disable it, see `app/build/notarize.js` (beta) -### PWA support +### Programatic build + +TheDesk builder has type declaration for TypeScript. + +```ts +import build from './app/builder' +build() +``` + + +### PWA build TheDesk is a web-based app, so you can run it on a browser. Of course, the main stream is as Electron. Some features won't work as well as Electron. @@ -125,6 +117,16 @@ Did you find a bug with Pleroma accounts? Pleroma **does not** follow Mastodon API rules completely although Pleroma developers say so. Please write issues to improve TheDesk affinity with Pleroma. -## Vulnerabilities when `yarn install`??? +## Contributors -No, if your npm says materialize-css has vulnerabilities(CVE-2019-11002/3/4), look at [here](https://github.com/Dogfalo/materialize/issues/6286) under discussion, but I do not think this report is really fatal. \ No newline at end of file +Build for macOS(Now: Travis CI) + +* [toneji](https://minohdon.jp/@toneji) + +Build for Linux(Now: Travis CI) + +* [popn_ja](https://popon.pptdn.jp/@popn_ja) + +Fellow coder + +* [kPherox](https://pl.kpherox.dev/kPherox) diff --git a/README_ja.md b/README_ja.md index 69e9a564..2c9536eb 100644 --- a/README_ja.md +++ b/README_ja.md @@ -33,45 +33,33 @@ Download:[TheDesk](https://thedesk.top) 標準の通知音は [Creative Commons BY](https://creativecommons.org/licenses/by/4.0/) で提供されています。 -## プライバシーポリシー +### プライバシーポリシー * [プライバシーポリシー](https://thedesk.top/priv.html) -## 言語 - -* 日本語 -* 日本語(関西) -* English(英語) -* ドイツ語, チェコ語, ブルガリア語, イタリア語, スペイン語アルゼンチン方言他 (from [Crowdin](https://translate.thedesk.top)) - -### 翻訳 +## 翻訳 Crowdinから翻訳に参加してみませんか?: https://translate.thedesk.top -**yarnを使ってください。その他(npmなど)を使用するとエラーが出ます** +## ビルドと開発 -### デベロッパーモード +**npmではなくyarnを使ってください。** -`yarn dev`を`app`フォルダ内で実行。 +### 開発 -## 主なコントリビューター +コンソールが出る開発モードで起動します。並行して監視が走る関係上、Ctrl+Cを2回押さないと終了しない場合があります。 -macOSビルダー(現在はTravis CI) +```sh +git clone https://github.com/cutls/TheDesk +cd TheDesk/app +yarn install -* [とねぢ](https://minohdon.jp/@toneji) +yarn dev +``` -Linuxビルダー(現在はTravis CI) - -* [ぽぷんじゃ](https://popon.pptdn.jp/@popn_ja) - -コーダー - -* [kPherox](https://pl.kpherox.dev/kPherox) - -## ビルド - -**yarnを使ってください。その他(npmなど)を使用するとエラーが出ます** +**npmではなくyarnを使ってください。** +### ビルド ```sh git clone https://github.com/cutls/TheDesk @@ -81,7 +69,9 @@ yarn install yarn build ``` -`yarn dev`でコンソールが出る開発モードで起動します。並行して監視が走る関係上、Ctrl+Cを2回押さないと終了しない場合があります。 +### オプション + +`yarn build --help`参照。 ### macOSでビルドするときの制限 @@ -93,7 +83,16 @@ Notarizeが入ります。つまり、認証された(課金したとも言う) フォークを世に出す場合や、Cutlsが信用できない場合、自分でMac AppStoreに出す場合など、[自分でNotarizeする必要があるとき](https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/)、[それをCI等で自動化するとき](https://qiita.com/ktmouk/items/7fc27c9ad0e3caf7899d)。 -### PWAとして実行 +### プログラムでビルド + +TypeScript用の型定義を持っています。 + +```ts +import build from './app/builder' +build() +``` + +### PWAとしてビルド TheDeskはウェブ技術を使用して作られているので、ブラウザで動かすこともできます。もちろん、Electron向けに設計されているので一部機能は動きません。 @@ -113,7 +112,17 @@ Issuesに書いてある問題についてはなるべく対処しますので [TheDesk - マストドン日本語ウィキ](https://ja.mstdn.wiki/TheDesk) -## `yarn install`したら脆弱性あるって言われた +## 主なコントリビューター + +macOSビルダー(現在はTravis CI) + +* [とねぢ](https://minohdon.jp/@toneji) + +Linuxビルダー(現在はTravis CI) + +* [ぽぷんじゃ](https://popon.pptdn.jp/@popn_ja) + +コーダー + +* [kPherox](https://pl.kpherox.dev/kPherox) -materialize-cssの脆弱性(CVE-2019-11002/3/4)については[こちら](https://github.com/Dogfalo/materialize/issues/6286)で本当に脆弱性かどうか議論しています。 -実際には害が無いものと思われます。 diff --git a/app/build.d.ts b/app/build.d.ts new file mode 100644 index 00000000..53dd513c --- /dev/null +++ b/app/build.d.ts @@ -0,0 +1,7 @@ +declare function _exports(options?: { + onlyStore?: boolean; + withStore?: boolean; + withIa32?: boolean; + withArm64?: boolean; +}): void; +export = _exports; diff --git a/app/build.js b/app/build.js index c32e93e6..d49ae9ef 100644 --- a/app/build.js +++ b/app/build.js @@ -8,6 +8,7 @@ const version = data.version const codename = data.codename const ver = `${version} (${codename})` const construct = require('./view/make/make.js') +const { ModuleResolutionKind } = require('typescript') const { platform, arch } = process const Platform = builder.Platform const Arch = builder.Arch @@ -62,12 +63,15 @@ async function build(os, arch, config) { publish: 'never' }) } -async function cmd() { - if (isTrue('onlyStore') || isTrue('withStore')) { +async function cmd(options) { + if (isTrue(options, 'help', 'h')) { + return console.log(help()) + } + if (isTrue(options, 'onlyStore') || isTrue(options, 'withStore')) { console.log('start building for application stores') construct(ver, basefile, false, true) if (platform == 'win32') { - if ((isTrue('withIa32') && arch == 'x64') || arch == 'ia32') { + if ((isTrue(options, 'withIa32') && arch == 'x64') || arch == 'ia32') { await build(Platform.WINDOWS, Arch.ia32, config) fs.renameSync( `../build/TheDesk ${version}.exe`, @@ -93,12 +97,12 @@ async function cmd() { if (arch == 'ia32') { await build(Platform.LINUX, Arch.ia32, config) } - if ((isTrue('withIa32') && arch == 'x64')) { + if ((isTrue(options, 'withIa32') && arch == 'x64')) { console.log('snapcraft does not curretly support builing i386 on amd64') } if (arch == 'x64') { await build(Platform.LINUX, Arch.x64, config) - if (!isTrue('onlyStore')) { + if (!isTrue(options, 'onlyStore')) { fs.renameSync( `../build/thedesk_${version}_amd64.snap`, `../build/thedesk_${version}_amd64-store.snap` @@ -111,11 +115,11 @@ async function cmd() { return false } } - if (!isTrue('onlyStore')) { + if (!isTrue(options, 'onlyStore')) { console.log('start building for normal usage') construct(ver, basefile, false, false) if (platform == 'win32') { - if ((isTrue('withIa32') && arch == 'x64') || arch == 'ia32') { + if ((isTrue(options, 'withIa32') && arch == 'x64') || arch == 'ia32') { await build(Platform.WINDOWS, Arch.ia32, config) fs.renameSync( `../build/TheDesk ${version}.exe`, @@ -133,7 +137,7 @@ async function cmd() { '../build/TheDesk.exe' ) } - if (isTrue('withArm64')) { + if ((isTrue(options, 'withArm64') && arch == 'x64') || arch == 'arm64') { await build(Platform.WINDOWS, Arch.arm64, config) fs.renameSync( `../build/TheDesk ${version}.exe`, @@ -148,7 +152,7 @@ async function cmd() { if (arch == 'ia32') { await build(Platform.LINUX, Arch.ia32, config) } - if ((isTrue('withIa32') && arch == 'x64')) { + if (isTrue(options, 'withIa32') && arch == 'x64') { console.log('snapcraft does not curretly support builing i386 on amd64') } if (arch == 'x64') { @@ -157,7 +161,7 @@ async function cmd() { `../build/thedesk_${version}_amd64.snap`, `../build/thedesk_${version}_amd64-normal.snap` ) - if (isTrue('onlyStore') || isTrue('withStore')) { + if (isTrue(options, 'onlyStore') || isTrue(options, 'withStore')) { fs.renameSync( `../build/thedesk_${version}_amd64-store.snap`, `../build/thedesk_${version}_amd64.snap` @@ -171,10 +175,42 @@ async function cmd() { } } } -function isTrue(long, short) { +function isTrue(options, long, short) { const { argv } = process + if (options ? options[long] : 0) return true if (argv.includes(`--${long}`)) return true if (short && argv.includes(`-${short}`)) return true return false } -cmd() +function help() { + return ` +TheDesk Builder command tool + yarn build [options] (or node build.js [options]) + yarn build:[preset] (check package.json) + + --help or -h: show help + + --onlyStore: App Store of platforms assets(without update check) + --withStore: App Store assets and normal version + + [only Windows] + if you pass these args on Linux or macOS, it just will be ignored... + + --withIa32: ia32 build on x64 system(if your machine is ia32, it will be built if this arg is not passed) + --withArm64(beta) arm64 build on x64 system(if your machine is arm64, it will be built if this arg is not passed, and not build store build for arm64) + + Programatic usage + ` +} + +/** + * Builder + * @module builder + * @param {Object} [options] - Options + * @param {boolean} [options.onlyStore] - App Store of platforms assets(without update check) + * @param {boolean} [options.withStore] - App Store of platforms assets(without update check) assets and normal version + * @param {boolean} [options.withIa32] - [Windows only] ia32 build on x64 system(if your machine is ia32, it will be built if this arg is not passed) + * @param {boolean} [options.withArm64] - [Windows only(beta)] arm64 build on x64 system(if your machine is arm64, it will be built if this arg is not passed, and not build store build for arm64) + * @return {void} + */ + module.exports = cmd \ No newline at end of file diff --git a/app/buildCli.js b/app/buildCli.js new file mode 100644 index 00000000..f1007be0 --- /dev/null +++ b/app/buildCli.js @@ -0,0 +1,2 @@ +const cmd = require('./build') +cmd() \ No newline at end of file diff --git a/app/package.json b/app/package.json index 279bf2a5..6dc7f40b 100644 --- a/app/package.json +++ b/app/package.json @@ -15,10 +15,10 @@ "dev": "run-p dev:*", "dev:run": "electron ./ --dev", "dev:watchview": "node view/make/makeCli.js --watch", - "build": "node build.js", + "build": "node buildCli.js", "build:pwa": "node view/make/makeCli.js --pwa", - "build:all:x64": "node build.js --withStore", - "build:all": "node build.js --withStore --withIa32", + "build:all:x64": "node buildCli.js --withStore", + "build:all": "node buildCli.js --withStore --withIa32 --withArm64", "lint:fix": "eslint js --fix", "lint": "eslint js" }, @@ -84,8 +84,7 @@ "eslint": "^7.23.0", "npm-run-all": "^4.1.5", "readline-sync": "1.4.10", - "ts-node": "^9.1.1", - "typescript": "^4.2.4" + "ts-node": "^9.1.1" }, "resolutions": { "@types/fs-extra": "9.0.11" diff --git a/app/view/make/make.d.ts b/app/view/make/make.d.ts new file mode 100644 index 00000000..b96410e7 --- /dev/null +++ b/app/view/make/make.d.ts @@ -0,0 +1,2 @@ +export = construct; +declare function construct(ver: any, basefile: any, pwa: any, store: any): void; diff --git a/app/view/pl-PL/index.html b/app/view/pl-PL/index.html index fed6dd4f..c05f9ad0 100644 --- a/app/view/pl-PL/index.html +++ b/app/view/pl-PL/index.html @@ -26,7 +26,7 @@