feat: impl ToYAML for YValue, migrate to spago@next, bun, asdf

This commit is contained in:
orion 2023-11-28 14:08:40 -06:00
parent cd4833a324
commit 30b219d237
Signed by: orion
GPG Key ID: 6D4165AE4C928719
12 changed files with 83 additions and 4058 deletions

8
.prettierrc.cjs Normal file
View File

@ -0,0 +1,8 @@
module.exports = {
tabWidth: 2,
trailingComma: 'all',
singleQuote: true,
semi: false,
arrowParens: 'avoid',
plugins: [],
}

1
.psc-ide-port Normal file
View File

@ -0,0 +1 @@
15163

3
.tool-versions Normal file
View File

@ -0,0 +1,3 @@
bun 1.0.11
purescript 0.15.12
nodejs 20.9.0

27
bun/fmt.js Normal file
View File

@ -0,0 +1,27 @@
/** @type {(parser: string, ps: string[]) => import("bun").Subprocess} */
const prettier = (parser, ps) =>
Bun.spawn(['bun', 'x', 'prettier', '--write', '--parser', parser, ...ps], {
stdout: 'inherit',
stderr: 'inherit',
})
const procs = [
prettier('babel', ['./src/**/*.js', './bun/**/*.js', './.prettierrc.cjs']),
prettier('json', ['./package.json', './jsconfig.json']),
Bun.spawn(
[
'bun',
'x',
'purs-tidy',
'format-in-place',
'src/**/*.purs',
'test/**/*.purs',
],
{
stdout: 'inherit',
stderr: 'inherit',
},
),
]
await Promise.all(procs.map(p => p.exited))

16
jsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"types": ["bun-types"],
"lib": ["esnext"],
"target": "esnext",
"module": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"jsx": "react",
"allowJs": true,
"checkJs": true,
"noEmit": true,
"strict": true
},
"include": ["src/**/*.js", "bun/**/*.js"]
}

4014
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,14 +4,16 @@
"repository": "https://github.com/archaeron/purescript-yaml-next",
"private": true,
"scripts": {
"test": "spago -x test.dhall test",
"fmt": "bun bun/fmt.js",
"test": "spago test",
"postinstall": "spago build"
},
"dependencies": {
"js-yaml": "^4.1.0"
},
"devDependencies": {
"purescript": "^0.15.0",
"spago": "^0.20.9"
"bun-types": "1.0.11",
"purs-tidy": "^0.10.0",
"spago": "next"
}
}

View File

@ -1,9 +0,0 @@
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.15.0-20220513/packages.dhall
sha256:1ed784f37ae6131d99acd542d058d5ce39954ccaacc3adba5cc7cf1549d2bffa
let overrides = {=}
let additions = {=}
in upstream // overrides // additions

View File

@ -1,15 +0,0 @@
{ name = "yaml-next"
, license = "MIT"
, repository = "https://github.com/archaeron/purescript-yaml-next"
, dependencies =
[ "argonaut-codecs"
, "argonaut-core"
, "effect"
, "foreign"
, "functions"
, "ordered-collections"
, "unsafe-coerce"
]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs" ]
}

19
spago.yaml Normal file
View File

@ -0,0 +1,19 @@
package:
dependencies:
- argonaut-codecs
- argonaut-core
- effect
- foreign
- functions
- ordered-collections
- unsafe-coerce
name: yaml-next
test:
dependencies:
- spec
main: Test.Main
workspace:
extra_packages: {}
package_set:
url: https://raw.githubusercontent.com/purescript/package-sets/psc-0.15.10-20230930/packages.json
hash: sha256-nTsd44o7/hrTdk0c6dh0wyBqhFFDJJIeKdQU6L1zv/A=

View File

@ -14,7 +14,7 @@ import Data.Function.Uncurried (Fn4, runFn4)
import Data.List (List)
import Data.Maybe (Maybe, maybe)
import Data.Tuple (Tuple(..), fst, snd)
import Prelude (class Eq, class Show, map, show, ($), (<>), (==), (<<<))
import Prelude (class Eq, class Show, identity, map, show, ($), (<>), (==), (<<<))
import Unsafe.Coerce (unsafeCoerce)
type YObject = M.Map String YValue
@ -73,6 +73,9 @@ instance arrayToYAML :: (ToYAML a) => ToYAML (Array a) where
instance maybeToYAML :: (ToYAML a) => ToYAML (Maybe a) where
toYAML = maybe YNull toYAML
instance yvalueToYAML :: ToYAML YValue where
toYAML = identity
type Pair = Tuple String YValue
-- | Helper function to create a key-value tuple for a YAML object.

View File

@ -1,16 +0,0 @@
let conf = ./spago.dhall
in conf // {
sources = conf.sources # [ "test/**/*.purs" ],
dependencies = conf.dependencies # [
, "spec"
, "aff"
, "arrays"
, "either"
, "lists"
, "maybe"
, "prelude"
, "transformers"
, "tuples"
]
}