Skip to content

Commit

Permalink
refactor: cordis migrate - stage 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ilharp committed May 12, 2024
1 parent c125ed5 commit 9a31213
Show file tree
Hide file tree
Showing 33 changed files with 150 additions and 173 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,86 +106,86 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.zip
path: build/dist/koishi.zip
path: build/dist/cordis.zip

- name: Upload msi for Windows to Build Artifact
if: matrix.target.goos == 'windows'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.msi
path: build/dist/koishi.msi
path: build/dist/cordis.msi

- name: Upload zip for macOS to Build Artifact
if: matrix.target.goos == 'darwin'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.zip
path: build/dist/koishi.zip
path: build/dist/cordis.zip

- name: Upload dmg for macOS to Build Artifact
if: matrix.target.goos == 'darwin'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.dmg
path: build/dist/koishi.dmg
path: build/dist/cordis.dmg

- name: Upload pkg for macOS to Build Artifact
if: matrix.target.goos == 'darwin'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.pkg
path: build/dist/koishi.pkg
path: build/dist/cordis.pkg

- name: Upload zip for Linux to Build Artifact
if: matrix.target.goos == 'linux'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.zip
path: build/dist/koishi.zip
path: build/dist/cordis.zip

- name: Upload AppImage for Linux to Build Artifact
if: matrix.target.goos == 'linux'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.AppImage
path: build/dist/Koishi.AppImage
path: build/dist/Cordis.AppImage

- name: Upload Release Files for Windows to GitHub Release
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'windows'
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/koishi.msi build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi
mv build/dist/cordis.zip build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/cordis.msi build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi
gh release upload ${{ steps.tag.outputs.version }} \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi
build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi
shell: bash

- name: Upload Release Files for macOS to GitHub Release
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'darwin'
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/koishi.dmg build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.dmg
mv build/dist/koishi.pkg build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg
mv build/dist/cordis.zip build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/cordis.dmg build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.dmg
mv build/dist/cordis.pkg build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg
gh release upload ${{ steps.tag.outputs.version }} \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.dmg \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg
build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.dmg \
build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg
shell: bash

- name: Upload Release Files for Linux to GitHub Release
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'linux'
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/Koishi.AppImage build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.AppImage
mv build/dist/cordis.zip build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/Cordis.AppImage build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.AppImage
gh release upload ${{ steps.tag.outputs.version }} \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.AppImage
build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.AppImage
shell: bash

# - name: Upload Release Files for Windows to App Center
Expand All @@ -196,7 +196,7 @@ jobs:
# -a koishi/Koishi-Desktop-for-Windows \
# -g stable \
# -b ${{ steps.tag.outputs.build_version }} \
# -f build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi
# -f build/dist/cordis-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi
# shell: bash

# - name: Upload Release Files for macOS to App Center
Expand All @@ -207,5 +207,5 @@ jobs:
# -a koishi/Koishi-Desktop-for-macOS \
# -g stable \
# -b ${{ steps.tag.outputs.build_version }} -n ${{ steps.tag.outputs.build_number }} \
# -f build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg
# -f build/dist/codris-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg
# shell: bash
4 changes: 2 additions & 2 deletions config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// KOISHI DESKTOP BUILD CONFIG
// CORDIS DESKTOP BUILD CONFIG
// ---------------------------------------------------
// Here are all config used during building. You can
// freely change configs like mirrors and build paths,
Expand Down Expand Up @@ -35,7 +35,7 @@ export const versionToolsWix = '311'
//#endregion

//#region Defaults
// These are defaults for koishi-desktop.
// These are defaults for Cordis Desktop.

export const repoBoilerplate = 'koishijs/boilerplate'
export const versionBoilerplate = 'v1.13.6'
Expand Down
4 changes: 2 additions & 2 deletions packages/app/koicli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func NewCli(i *do.Injector) (*cli.App, error) {
do.ProvideNamed(i, serviceCommandYarn, newYarnCommand)

return &cli.App{
Name: p.Sprintf("Koishi Desktop"),
Usage: p.Sprintf("Launch Koishi from your desktop."),
Name: p.Sprintf("Cordis Desktop"),
Usage: p.Sprintf("Launch Cordis from your desktop."),
Version: fmt.Sprintf("v%s", util.AppVersion),
Authors: []*cli.Author{
{
Expand Down
2 changes: 1 addition & 1 deletion packages/app/koicli/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func newImportCommand(i *do.Injector) (*cli.Command, error) {

return &cli.Command{
Name: "import",
Usage: p.Sprintf("Import a Koishi Bundle"),
Usage: p.Sprintf("Import a Cordis Bundle"),
ArgsUsage: "path",
Action: do.MustInvokeNamed[cli.ActionFunc](i, serviceActionImport),

Expand Down
2 changes: 1 addition & 1 deletion packages/app/koicli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func newRunCommand(i *do.Injector) (*cli.Command, error) {

return &cli.Command{
Name: "run",
Usage: p.Sprintf("Run Koishi Desktop"),
Usage: p.Sprintf("Run Cordis Desktop"),
Action: do.MustInvokeNamed[cli.ActionFunc](i, serviceActionRun),
Subcommands: []*cli.Command{
{
Expand Down
2 changes: 1 addition & 1 deletion packages/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func main() {

do.Provide(i, koicli.NewCli)

l.Info(p.Sprintf("Koishi Desktop v%s", util.AppVersion))
l.Info(p.Sprintf("Cordis Desktop v%s", util.AppVersion))

noConsole := false

Expand Down
10 changes: 5 additions & 5 deletions packages/app/ui/tray/tray.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ func (tray *TrayDaemon) onReady() {

l.Debug(p.Sprintf("Tray ready."))

// systray.SetTitle("Koishi")
// systray.SetTitle("Cordis")
if runtime.GOOS != "windows" {
systray.SetTooltip("Koishi")
systray.SetTooltip("Cordis")
}
systray.SetTemplateIcon(icon.Koishi, icon.Koishi)

Expand Down Expand Up @@ -516,7 +516,7 @@ func (tray *TrayDaemon) rebuild() {
func (tray *TrayDaemon) addItemsBefore() {
p := do.MustInvoke[*message.Printer](tray.i)

mTitle := systray.AddMenuItem(p.Sprintf("Koishi Desktop"), "")
mTitle := systray.AddMenuItem(p.Sprintf("Cordis Desktop"), "")
mTitle.Disable()
mTitle.SetTemplateIcon(icon.Koishi, icon.Koishi)
version := "v" + util.AppVersion
Expand Down Expand Up @@ -654,12 +654,12 @@ func (tray *TrayDaemon) addItemsAfter() {
os.Getenv("COMSPEC"),
"/C",
"START",
"Koishi Desktop Terminal",
"Cordis Desktop Terminal",
"/D",
dirExe,
"cmd", // Use "cmd" here
"/K",
"echo Koishi Desktop Terminal - You can start running koi command here.",
"echo Cordis Desktop Terminal - You can start running koi command here.",
)
} else {
cmd = exec.Command(
Expand Down
6 changes: 3 additions & 3 deletions packages/build/tasks/pack/appimage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { linuxAppImageDesktop } from '../../templates/linux'
import { dir } from '../../utils/path'
import { exec } from '../../utils/spawn'

const appDirPath = dir('buildLinux', 'Koishi.AppDir/')
const appDirPath = dir('buildLinux', 'Cordis.AppDir/')
const appBinaryPath = path.join(appDirPath, 'usr/bin/')
const appMetaInfoPath = path.join(appDirPath, 'usr/share/metainfo/')

Expand Down Expand Up @@ -76,8 +76,8 @@ export const packAppImageGenerate = () =>

export const packAppImageCopyDist = () =>
fs.copyFile(
dir('buildLinux', 'Koishi-x86_64.AppImage'),
dir('dist', 'Koishi.AppImage')
dir('buildLinux', 'Cordis-x86_64.AppImage'),
dir('dist', 'Cordis.AppImage')
)

export const packAppImage = series(
Expand Down
26 changes: 13 additions & 13 deletions packages/build/tasks/pack/mac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,38 @@ import { koiVersion } from '../../utils/config'
import { dir } from '../../utils/path'
import { exec, tryExec } from '../../utils/spawn'

const appPath = dir('buildMac', 'Koishi.app/')
const appPath = dir('buildMac', 'Cordis.app/')

export const packMacApp = async () => {
const appInfoPlistPath = dir('buildMac', 'Koishi.app/Contents/Info.plist')
const appMacosPath = dir('buildMac', 'Koishi.app/Contents/MacOS/')
const appResourcesPath = dir('buildMac', 'Koishi.app/Contents/Resources/')
const appInfoPlistPath = dir('buildMac', 'Cordis.app/Contents/Info.plist')
const appMacosPath = dir('buildMac', 'Cordis.app/Contents/MacOS/')
const appResourcesPath = dir('buildMac', 'Cordis.app/Contents/Resources/')
const appIconPath = dir(
'buildMac',
'Koishi.app/Contents/Resources/koishi-app.icns'
'Cordis.app/Contents/Resources/koishi-app.icns'
)

await mkdirp(appMacosPath)
await mkdirp(appResourcesPath)

await fs.cp(dir('buildUnfoldBinary'), appMacosPath, { recursive: true })
await fs.rename(
dir('buildMac', 'Koishi.app/Contents/MacOS/KoiShell_KoiShell.bundle/'),
dir('buildMac', 'Koishi.app/KoiShell_KoiShell.bundle/')
dir('buildMac', 'Cordis.app/Contents/MacOS/KoiShell_KoiShell.bundle/'),
dir('buildMac', 'Cordis.app/KoiShell_KoiShell.bundle/')
)
await fs.copyFile(dir('buildAssets', 'koishi-app.icns'), appIconPath)
await fs.writeFile(appInfoPlistPath, macAppPlist)
}

export const packMacDmg = async () => {
await fs.writeFile(
dir('buildMac', 'Koishi.app/Contents/MacOS/koi.yml'),
dir('buildMac', 'Cordis.app/Contents/MacOS/koi.yml'),
'redirect: USERDATA'
)
await tryExec('yarn', ['create-dmg', appPath, dir('buildMac'), '--overwrite'])
await fs.rename(
dir('buildMac', `Koishi ${koiVersion}.dmg`),
dir('dist', 'koishi.dmg')
dir('buildMac', `Cordis ${koiVersion}.dmg`),
dir('dist', 'cordis.dmg')
)
}

Expand All @@ -57,12 +57,12 @@ export const packMacPkg = async () => {
'--identifier',
'chat.koishi.desktop',
'--component',
'Koishi.app',
'Cordis.app',
'--scripts',
'scripts',
'--install-location',
'/Applications',
'koishi-app.pkg',
'cordis-app.pkg',
],
dir('buildMac')
)
Expand All @@ -74,7 +74,7 @@ export const packMacPkg = async () => {
'distribution.xml',
'--package-path',
'.',
dir('dist', 'koishi.pkg'),
dir('dist', 'cordis.pkg'),
],
dir('buildMac')
)
Expand Down
4 changes: 2 additions & 2 deletions packages/build/tasks/pack/msi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const buildPackMsi = (lang: Lang) => async () => {
)
}

const pathNeutralMsi = dir('buildMsi', 'koishi.msi')
const pathNeutralMsi = dir('buildMsi', 'cordis.msi')

export const packMsiCopyNeutral = () =>
fs.copyFile(dir('buildMsi', '1033.msi'), pathNeutralMsi)
Expand Down Expand Up @@ -209,7 +209,7 @@ export const packMsiListStorage = () =>
exec('cscript', [getPathWiSubStg(), pathNeutralMsi], dir('buildMsi'))

export const packMsiCopyDist = () =>
fs.copyFile(pathNeutralMsi, dir('dist', 'koishi.msi'))
fs.copyFile(pathNeutralMsi, dir('dist', 'cordis.msi'))

export const packMsi = series(
packMsiMkdir,
Expand Down
2 changes: 1 addition & 1 deletion packages/build/tasks/pack/portable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { zip } from '../../utils/compress'
import { dir } from '../../utils/path'

export const packPortable = () =>
zip(dir('buildPortable'), dir('dist', 'koishi.zip'))
zip(dir('buildPortable'), dir('dist', 'cordis.zip'))
10 changes: 5 additions & 5 deletions packages/build/templates/linux/chat.koishi.desktop.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<metadata_license>AGPL-1.0</metadata_license>
<project_license>AGPL-1.0</project_license>

<name>Koishi</name>
<summary>Cross-platform chatbot framework made with love</summary>
<name>Cordis</name>
<summary>Meta-Framework for Modern Applications</summary>
<description>
<p>Cross-platform chatbot framework made with love</p>
<p>Meta-Framework for Modern Applications</p>
</description>
<developer_name>Koishi.js</developer_name>
<developer_name>Cordis</developer_name>

<categories>
<category>Development</category>
Expand All @@ -26,7 +26,7 @@
<keyword>Chatbot</keyword>
<keyword xml:lang="zh">聊天机器人</keyword>

<keyword translate="no">Koishi</keyword>
<keyword translate="no">Cordis</keyword>

<keyword translate="no">Discord</keyword>
<keyword translate="no">Telegram</keyword>
Expand Down
10 changes: 5 additions & 5 deletions packages/build/templates/linux/chat.koishi.desktop.desktop.hbs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[Desktop Entry]
Type=Application
Name=Koishi
Comment=Start Koishi
Name=Cordis
Comment=Start Cordis
TryExec=koi
Exec=koi
Icon=chat.koishi.desktop
Categories=Development;
Keywords=Bot;Chatbot;Koishi;Discord;Telegram;OneBot;Framework;
Keywords[zh]=Bot;机器人;聊天机器人;Koishi;Discord;Telegram;OneBot;框架;
Keywords=Bot;Chatbot;Koishi;Cordis;Discord;Telegram;OneBot;Framework;
Keywords[zh]=Bot;机器人;聊天机器人;Koishi;Cordis;Discord;Telegram;OneBot;框架;
Actions=UI;Daemon;
X-AppImage-Name=Koishi
X-AppImage-Name=Cordis
X-AppImage-Version={{koiVersion}}
X-AppImage-Arch=x86_64

Expand Down
Loading

0 comments on commit 9a31213

Please sign in to comment.