Skip to content

Commit

Permalink
edit config and packager
Browse files Browse the repository at this point in the history
  • Loading branch information
polymorphicengine committed Feb 10, 2025
1 parent 0797c49 commit fcaccc8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
20 changes: 12 additions & 8 deletions app/Editor/Config.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Editor.Config where
Expand Down Expand Up @@ -28,13 +29,19 @@ import Conferer.Source.CLIArgs as Cli
import Conferer.Source.Env as Env
import Conferer.Source.Yaml as Yaml
import Control.Monad (unless)
import qualified Data.ByteString as B
import Data.FileEmbed
import GHC.Generics (Generic)
import qualified Sound.Tidal.Clock as Clock (ClockConfig (..), defaultConfig)
import System.Directory.OsPath
import System.File.OsPath as F
import System.OsPath
import Zwirn.Language.Compiler
import Zwirn.Stream

defaultConfigFile :: B.ByteString
defaultConfigFile = $(embedFile "config.yaml")

data EditorConfig = EditorConfig
{ editorConfigPort :: Int,
editorConfigHighlight :: Bool,
Expand Down Expand Up @@ -89,21 +96,18 @@ instance FromConfig FullConfig

getConfig :: IO Conf.Config
getConfig = do
curr <- getCurrentDirectory
home <- getHomeDirectory
configDirPath <- (home <>) <$> encodeUtf "/.config/zwirn-editor/"
path <- (home <>) <$> encodeUtf "/.config/zwirn-editor/config.yaml"
defaultConfigPath <- (curr <>) <$> encodeUtf "/static/config.yaml"
configDirPath <- (home <>) <$> encodeUtf "/.config/zwirn-loom/"
path <- (home <>) <$> encodeUtf "/.config/zwirn-loom/config.yaml"
createDirectoryIfMissing True configDirPath
exists <- doesFileExist path
unless exists (copyFile defaultConfigPath path)
unless exists (F.writeFile path (B.fromStrict defaultConfigFile))
decoded <- decodeUtf path
mkConfig'
[]
[ Cli.fromConfig,
Env.fromConfig "zwirn",
Yaml.fromFilePath decoded,
Yaml.fromFilePath "./static/config.yaml"
Env.fromConfig "loom",
Yaml.fromFilePath decoded
]

tpPort :: FullConfig -> Int
Expand Down
File renamed without changes.
26 changes: 16 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "zwirn-loom",
"version": "0.0.1",
"version": "0.1.0.0",
"description": "An editor for the zwirn live coding language",
"main": "main.js",
"scripts": {
"start": "electron-forge start",
"pack-app": "electron-packager . zwirn --overwrite --prune=true --ignore=\\.github --ignore=\\.stack-work --ignore=\\.gitignore --ignore=\\dist-newstyle",
"pack-app": "electron-packager . zwirn-loom --overwrite --prune=true --ignore=/dist-newstyle --ignore=/node_modules",
"postpack-app:darwin": "node ./postpack-app-darwin.js",
"postpack-app:win32": "node ./postpack-app-win.js",
"package": "electron-forge package",
Expand All @@ -23,28 +23,34 @@
"author": "Martin Gius",
"license": "GPL-3",
"devDependencies": {
"@electron-forge/cli": "^6.2.1",
"@electron-forge/maker-deb": "^6.0.0-beta.64",
"@electron-forge/maker-rpm": "^6.0.0-beta.64",
"@electron-forge/maker-squirrel": "^6.0.0-beta.64",
"@electron-forge/maker-zip": "^6.0.0-beta.64",
"@electron-forge/cli": "^6.4.2",
"@electron-forge/maker-deb": "^6.4.2",
"@electron-forge/maker-rpm": "^6.4.2",
"@electron-forge/maker-squirrel": "^6.4.2",
"@electron-forge/maker-zip": "^6.4.2",
"@electron-forge/plugin-auto-unpack-natives": "^6.4.2",
"@electron/packager": "^18.3.6",
"electron": "^21.1.1",
"ncp": "^2.0.0",
"rpmbuild": "^0.0.23",
"run-script-os": "^1.1.6",
"shelljs": "^0.8.3"
},
"dependencies": {
"@electron/remote": "^2.0.8",
"electron": "^21.1.1",
"electron-squirrel-startup": "^1.0.0",
"electron-squirrel-startup": "^1.0.1",
"electron-store": "^8.1.0",
"freeport": "^1.0.5",
"rpmbuild": "^0.0.23",
"wait-on": "^3.3.0"
},
"config": {
"forge": {
"packagerConfig": {},
"packagerConfig": {
"ignore": [
"/dist-newstyle"
]
},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
Expand Down
3 changes: 3 additions & 0 deletions zwirn-loom.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ executable zwirn-loom
directory,
conferer,
conferer-yaml,
bytestring,
file-embed,
file-io,
zwirn-core >= 0.1 && < 0.2,
tidal-link >= 1.1 && < 1.2
hs-source-dirs: app
Expand Down

0 comments on commit fcaccc8

Please sign in to comment.