Skip to content

purescript-purgatory/primordials

Repository files navigation

Primordials 🐍

My Purescript Prelude

Installation

$ pnpm i ssh://[email protected]:rajatsharma/primordials.git
$ pnpx primordial-link

Usage

Handlebars

  • Compile handlebars:
import Primordials.Handlebars (mkCompilerWithVariables)

comileHandlebarsTemplate :: Effect String
comileHandlebarsTemplate = do
  pure mkCompilerWithVariables { name: "World" } "Hello, {{name}}!" -- "Hello, World"

File Operations

  • Create File path:
import Primordials.Node.FileOps (mkPath)

mainDirPath :: Path.FilePath
mainDirPath = mkPath [ "src", "main", "scala" ]
  • Copy directory with contents:
import Primordials.Node.FileOps (copyDir)

copyDirectoryWithContents :: Effect Unit
copyDirectoryWithContents = copyDir (mkPath [ "src" ]) (mkPath [ "test" ])
  • Replace text in file:
import Primordials.Node.FileOps (copyDir)

replaceInFile :: Effect Unit
replaceInFile = replace { files: "src/index.js", from: ";", to: "" }

License

GPL-3.0