From 79c0ea30f249af4f65fc7efa75734982c9f9ba97 Mon Sep 17 00:00:00 2001 From: Christoph Hegemann Date: Thu, 28 Sep 2023 11:41:59 +0200 Subject: [PATCH] pulp -> spago The ecosystem has clearly moved on from pulp by now --- README.md | 13 ++++--------- src/Pscid/Console.purs | 4 ++-- src/Pscid/Options.purs | 30 +++++------------------------- 3 files changed, 11 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index bd0f359..2d18e92 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ pscid === -An editor agnostic minimal IDE for your shell. Think `pulp -w build` on steroids. +An editor agnostic minimal IDE for your shell. Think `spago -w build` on steroids. ### Installation @@ -16,9 +16,9 @@ Start `pscid` in a terminal in the root folder of your project. pscid will show you errors and warnings (one at a time) whenever you save a PureScript source file. This makes for a nice iterative workflow. -Type `b` inside `pscid`'s terminal window to build your project. This looks up the `pscid:build` script inside your package.json, then falls back to the `build` script, and then finally tries `spago/pulp build`. +Type `b` inside `pscid`'s terminal window to build your project. This looks up the `pscid:build` script inside your package.json, then falls back to the `build` script, and then finally tries `spago build`. -Type `t` inside `pscid`'s terminal window to test your project. As with building this looks up the `pscid:test` script first, then `test`, then falls back to `spago/pulp test` as a last resort. +Type `t` inside `pscid`'s terminal window to test your project. As with building this looks up the `pscid:test` script first, then `test`, then falls back to `spago test` as a last resort. Type `q` to quit pscid. @@ -28,11 +28,6 @@ Some warnings carry a suggestion from the compiler (for example redundant imports). `pscid` will prompt you to press `s` inside the terminal window when it encounters such a warning, and automatically apply the suggestion for you. -#### CAREFUL: This modifies the file in place. - -If something goes horribly wrong you might lose your uncommited changes. Commit -often and trust in the types I guess... - ### Demo ![Demo GIF](http://i.imgur.com/ssBtu6w.gif) @@ -52,7 +47,7 @@ It's inspired by https://github.com/ndmitchell/ghcid and https://github.com/antt ### LICENSE -Copyright 2018 Christoph Hegemann and Contributors +Copyright 2023 Christoph Hegemann and Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. diff --git a/src/Pscid/Console.purs b/src/Pscid/Console.purs index 5a0afcc..0106cda 100644 --- a/src/Pscid/Console.purs +++ b/src/Pscid/Console.purs @@ -23,8 +23,8 @@ owl = helpText ∷ String helpText = """ -Press b to run a full build (tries "npm run pscid:build" then "npm run build" then "spago/pulp build") -Press t to test (tries "npm run pscid:test" then "npm run test" then "spago/pulp test") +Press b to run a full build (tries "npm run pscid:build" then "npm run build" then "spago build") +Press t to test (tries "npm run pscid:test" then "npm run test" then "spago test") Press r to reset Press q to quit """ diff --git a/src/Pscid/Options.purs b/src/Pscid/Options.purs index 36cf7bb..38c6304 100644 --- a/src/Pscid/Options.purs +++ b/src/Pscid/Options.purs @@ -9,9 +9,6 @@ import Data.Maybe (Maybe(..), fromMaybe, optional) import Data.String as String import Effect (Effect) import Effect.Console as Console -import Effect.Exception (catchException) -import Node.FS.Sync as FSSync -import Node.Path as Path import Node.Platform (Platform(..)) import Node.Process (platform) import Node.Process as Process @@ -33,9 +30,9 @@ type PscidOptions = PscidSettings (Maybe Int) defaultOptions ∷ PscidOptions defaultOptions = { port: Nothing - , buildCommand: BuildCommand (pulpCmd <> " build") [] + , buildCommand: BuildCommand (spagoCmd <> " build") [] , outputDirectory: "output" - , testCommand: BuildCommand (pulpCmd <> " test") [] + , testCommand: BuildCommand (spagoCmd <> " test") [] , testAfterRebuild: false , sourceDirectories: [] , censorCodes: [] @@ -54,9 +51,6 @@ scanDefaultDirectories = spagoCmd ∷ String spagoCmd = if platform == Just Win32 then "spago.cmd" else "spago" -pulpCmd ∷ String -pulpCmd = if platform == Just Win32 then "pulp.cmd" else "pulp" - npmCmd ∷ String npmCmd = if platform == Just Win32 then "npm.cmd" else "npm" @@ -82,10 +76,10 @@ printCLICommand = case _ of BuildCommand str includes → str <> " -I " <> String.joinWith ":" includes --- | If the command is a BuildCommand (eg. "spago/pulp build"), then the array +-- | If the command is a BuildCommand (eg. "spago build"), then the array -- | of include paths is set. If the command is an NPM script, the command is -- | left unchanged. This is because it's impossible to guarantee that the NPM --- | script directly executes "spago/pulp build" (it may execute another +-- | script directly executes "spago build" (it may execute another -- | script), and therefore we cannot simply append the includes onto the end of -- | the command. setCommandIncludes ∷ Array IncludePath → CLICommand → CLICommand @@ -95,7 +89,6 @@ setCommandIncludes includesArr cmd = case cmd of mkCommand ∷ String → Effect CLICommand mkCommand cmd = do - spagoProject ← isSpagoProject pscidSpecific ← hasNamedScript ("pscid:" <> cmd) namedScript ← hasNamedScript cmd @@ -105,23 +98,10 @@ mkCommand cmd = do npmBuildCommand = guard namedScript $> ScriptCommand (npmCmd <> " run -s " <> cmd) - buildCommand = - if spagoProject - then BuildCommand (spagoCmd <> " " <> cmd) [] - else BuildCommand (pulpCmd <> " " <> cmd) [] + buildCommand = BuildCommand (spagoCmd <> " " <> cmd) [] pure $ fromMaybe buildCommand (npmSpecificCommand <|> npmBuildCommand) -isSpagoProject ∷ Effect Boolean -isSpagoProject = ado - dhallConfig <- exists "spago.dhall" - spagoConfig <- exists "spago.yaml" - in dhallConfig || spagoConfig - where - exists config = do - cwd ← Process.cwd - catchException (\_ → pure false) (FSSync.exists (Path.concat [cwd, config])) - -- | Accepts defaults options and buildOptions ∷ PscidOptions