Skip to content

Commit

Permalink
pulp -> spago
Browse files Browse the repository at this point in the history
The ecosystem has clearly moved on from pulp by now
  • Loading branch information
kritzcreek committed Sep 28, 2023
1 parent 2e2f676 commit 6d4d6b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 33 deletions.
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.

Expand All @@ -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)
Expand All @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions src/Pscid/Console.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
27 changes: 5 additions & 22 deletions src/Pscid/Options.purs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,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: []
Expand All @@ -54,9 +54,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"

Expand All @@ -82,10 +79,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
Expand All @@ -95,7 +92,6 @@ setCommandIncludes includesArr cmd = case cmd of

mkCommand String Effect CLICommand
mkCommand cmd = do
spagoProject ← isSpagoProject
pscidSpecific ← hasNamedScript ("pscid:" <> cmd)
namedScript ← hasNamedScript cmd

Expand All @@ -105,23 +101,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
Expand Down

0 comments on commit 6d4d6b9

Please sign in to comment.