diff --git a/core/spago.yaml b/core/spago.yaml index 69300a949..b1e85e2e2 100644 --- a/core/spago.yaml +++ b/core/spago.yaml @@ -24,7 +24,6 @@ package: - newtype - node-buffer - node-fs - - node-fs-aff - node-path - node-process - ordered-collections diff --git a/core/src/Log.purs b/core/src/Log.purs index 38c7a99f0..2d075614d 100644 --- a/core/src/Log.purs +++ b/core/src/Log.purs @@ -152,13 +152,13 @@ logError l = log { level: LogError, content: Ansi.foreground Ansi.Red (toDoc l) die :: forall a b m u. MonadEffect m => MonadAsk (LogEnv b) m => Loggable a => a -> m u die msg = do logFailure msg - Effect.liftEffect $ Process.exit 1 + Effect.liftEffect $ Process.exit' 1 -- | Same as `die`, but with multiple failures die' :: forall a b m u. MonadEffect m => MonadAsk (LogEnv b) m => Loggable a => Array a -> m u die' msgs = do _ <- traverse logFailure msgs - Effect.liftEffect $ Process.exit 1 + Effect.liftEffect $ Process.exit' 1 justOrDieWith :: forall a b m x. MonadEffect m => MonadAsk (LogEnv b) m => Loggable a => Maybe x -> a -> m x justOrDieWith value msg = case value of diff --git a/docs-search/index/spago.yaml b/docs-search/index/spago.yaml index bdc173628..23be5c1d2 100644 --- a/docs-search/index/spago.yaml +++ b/docs-search/index/spago.yaml @@ -21,7 +21,6 @@ package: - newtype - node-buffer - node-fs - - node-fs-aff - node-process - ordered-collections - prelude diff --git a/docs-search/index/src/Docs/Search/IndexBuilder.purs b/docs-search/index/src/Docs/Search/IndexBuilder.purs index 088ed425e..e5e3f0834 100644 --- a/docs-search/index/src/Docs/Search/IndexBuilder.purs +++ b/docs-search/index/src/Docs/Search/IndexBuilder.purs @@ -447,7 +447,7 @@ withExisting file f = do logAndExit :: forall a. String -> Effect a logAndExit message = do log message - Process.exit 1 + Process.exit' 1 showGlobs :: Array String -> String showGlobs = Array.intercalate ", " diff --git a/docs-search/index/test/Docs/Search/Main.purs b/docs-search/index/test/Docs/Search/Main.purs index ccbbc2e63..82c45143c 100644 --- a/docs-search/index/test/Docs/Search/Main.purs +++ b/docs-search/index/test/Docs/Search/Main.purs @@ -2,19 +2,28 @@ module Test.Docs.Search.Main where import Prelude +import Data.Identity (Identity(..)) +import Data.Maybe (Maybe(..)) +import Data.Newtype (un) import Effect (Effect) -import Effect.Aff (launchAff_) +import Effect.Aff (Milliseconds(..), launchAff_) import Test.Declarations as Declarations import Test.IndexBuilder as IndexBuilder import Test.ModuleIndex as ModuleIndex import Test.ModuleParser as ModuleParser -import Test.TypeQuery as TypeQuery import Test.Spec (Spec) import Test.Spec.Reporter.Console (consoleReporter) -import Test.Spec.Runner (runSpec) +import Test.Spec.Runner (Config, defaultConfig, runSpecT) +import Test.TypeQuery as TypeQuery + +testConfig :: Config +testConfig = defaultConfig + { slow = Milliseconds 2_000.0 + , timeout = Just (Milliseconds 5_000.0) + } main :: Effect Unit -main = launchAff_ $ runSpec [ consoleReporter ] mainTest +main = launchAff_ $ void $ un Identity $ runSpecT testConfig [ consoleReporter ] mainTest mainTest :: Spec Unit mainTest = do diff --git a/spago.lock b/spago.lock index 1cd972691..befc4589f 100644 --- a/spago.lock +++ b/spago.lock @@ -257,7 +257,6 @@ workspace: - newtype - node-buffer - node-fs - - node-fs-aff - node-process - ordered-collections - prelude @@ -286,6 +285,7 @@ workspace: - contravariant - control - datetime + - debug - distributive - docs-search-common - effect @@ -316,8 +316,8 @@ workspace: - mmorph - newtype - node-buffer + - node-event-emitter - node-fs - - node-fs-aff - node-path - node-process - node-streams @@ -424,6 +424,7 @@ workspace: - control - convertable-options - datetime + - debug - distributive - docs-search-common - docs-search-index @@ -435,7 +436,6 @@ workspace: - exceptions - exists - fetch - - fetch-core - filterable - fixed-points - foldable-traversable @@ -454,6 +454,9 @@ workspace: - integers - invariant - js-date + - js-fetch + - js-promise + - js-promise-aff - js-timers - js-uri - json-codecs @@ -464,7 +467,6 @@ workspace: - lists - maybe - media-types - - minibench - mmorph - newtype - node-buffer @@ -472,8 +474,8 @@ workspace: - node-event-emitter - node-execa - node-fs - - node-fs-aff - node-human-signals + - node-os - node-path - node-process - node-streams @@ -523,7 +525,6 @@ workspace: - web-events - web-file - web-html - - web-promise - web-storage - web-streams - web-xhr @@ -570,6 +571,7 @@ workspace: - control - convertable-options - datetime + - debug - distributive - docs-search-common - docs-search-index @@ -582,7 +584,6 @@ workspace: - exists - exitcodes - fetch - - fetch-core - filterable - fixed-points - foldable-traversable @@ -601,6 +602,9 @@ workspace: - integers - invariant - js-date + - js-fetch + - js-promise + - js-promise-aff - js-timers - js-uri - json-codecs @@ -611,7 +615,6 @@ workspace: - lists - maybe - media-types - - minibench - mmorph - newtype - node-buffer @@ -619,8 +622,8 @@ workspace: - node-event-emitter - node-execa - node-fs - - node-fs-aff - node-human-signals + - node-os - node-path - node-process - node-streams @@ -674,7 +677,6 @@ workspace: - web-events - web-file - web-html - - web-promise - web-storage - web-streams - web-xhr @@ -702,7 +704,6 @@ workspace: - newtype - node-buffer - node-fs - - node-fs-aff - node-path - node-process - ordered-collections @@ -760,12 +761,10 @@ workspace: - lcg - lists - maybe - - minibench - newtype - node-buffer - - node-child-process + - node-event-emitter - node-fs - - node-fs-aff - node-path - node-process - node-streams @@ -802,10 +801,10 @@ workspace: - variant package_set: address: - registry: 20.0.1 - compiler: ">=0.15.7 <0.16.0" + registry: 47.9.1 + compiler: ">=0.15.13 <0.16.0" content: - abc-parser: 2.0.0 + abc-parser: 2.0.1 ace: 9.1.0 aff: 7.1.0 aff-bus: 6.0.0 @@ -816,6 +815,7 @@ workspace: affjax-node: 1.0.0 affjax-web: 1.0.0 ansi: 7.0.0 + applicative-phases: 1.0.0 argonaut: 9.0.0 argonaut-aeson-generic: 0.4.1 argonaut-codecs: 9.1.0 @@ -828,7 +828,8 @@ workspace: arraybuffer: 13.2.0 arraybuffer-builder: 3.1.0 arraybuffer-types: 3.0.2 - arrays: 7.2.0 + arrays: 7.3.0 + arrays-extra: 0.4.4 arrays-zipper: 2.0.1 ask: 1.0.0 assert: 6.0.0 @@ -837,29 +838,21 @@ workspace: b64: 0.0.8 barbies: 1.0.1 barlow-lens: 0.9.0 - basic-auth: 3.0.1 bifunctors: 6.0.0 bigints: 7.0.1 - bolson: 0.3.2 + bolson: 0.3.9 + bookhound: 0.1.7 bower-json: 3.0.0 - bucketchain: 1.0.1 - bucketchain-basic-auth: 1.0.1 - bucketchain-conditional: 1.0.1 - bucketchain-cors: 1.0.1 - bucketchain-csrf: 1.0.1 - bucketchain-header-utils: 1.0.1 - bucketchain-health: 1.0.1 - bucketchain-history-api-fallback: 1.0.1 - bucketchain-logger: 1.0.1 - bucketchain-secure: 1.0.1 - bucketchain-simple-api: 5.0.1 - bucketchain-sslify: 1.0.1 - bucketchain-static: 1.0.1 call-by-name: 4.0.1 canvas: 6.0.0 canvas-action: 9.0.0 cartesian: 1.0.6 catenable-lists: 7.0.0 + chameleon: 1.0.0 + chameleon-halogen: 1.0.3 + chameleon-react-basic: 1.1.0 + chameleon-styled: 2.5.0 + chameleon-transformers: 1.0.0 channel: 1.0.0 checked-exceptions: 3.1.1 classless: 0.1.1 @@ -867,42 +860,44 @@ workspace: classless-decode-json: 0.1.1 classless-encode-json: 0.1.3 classnames: 2.0.0 - codec: 6.0.0 + codec: 6.1.0 codec-argonaut: 10.0.0 + codec-json: 1.1.0 colors: 7.0.1 concur-core: 0.5.0 concur-react: 0.5.0 concurrent-queues: 3.0.0 - console: 6.0.0 + console: 6.1.0 const: 6.0.0 contravariant: 6.0.0 control: 6.0.0 convertable-options: 1.0.0 coroutines: 7.0.0 - crypto: 5.0.1 css: 6.0.0 + css-frameworks: 1.0.1 + data-mvc: 0.0.2 datetime: 6.1.0 datetime-parsing: 0.2.0 debug: 6.0.2 decimals: 7.1.0 default-values: 1.0.1 - deku: 0.9.18 + deku: 0.9.23 deno: 0.0.5 dissect: 1.0.0 distributive: 6.0.0 - dodo-printer: 2.2.1 dom-filereader: 7.0.0 - dom-indexed: 11.0.0 - dotenv: 4.0.0 + dom-indexed: 12.0.0 + dotenv: 4.0.3 droplet: 0.6.0 - dts: 0.1.3 + dts: 1.0.0 + dual-numbers: 1.0.2 dynamic-buffer: 3.0.1 echarts-simple: 0.0.1 effect: 4.0.0 either: 6.1.0 - elmish: 0.9.3 + elmish: 0.10.0 elmish-enzyme: 0.1.1 - elmish-hooks: 0.9.1 + elmish-hooks: 0.10.0 elmish-html: 0.8.1 elmish-testing-library: 0.3.1 email-validate: 7.0.0 @@ -910,31 +905,35 @@ workspace: enums: 6.0.1 env-names: 0.3.4 error: 2.0.0 + eta-conversion: 0.3.2 exceptions: 6.0.0 exists: 6.0.0 exitcodes: 4.0.0 expect-inferred: 3.0.0 fahrtwind: 2.0.0 fallback: 0.1.0 - fast-vect: 1.1.0 - fetch: 1.1.4 - fetch-argonaut: 1.0.0 - fetch-core: 4.0.4 + fast-vect: 1.2.0 + fetch: 4.1.0 + fetch-argonaut: 1.0.1 + fetch-core: 5.1.0 fetch-yoga-json: 1.1.0 filterable: 5.0.0 + fix-functor: 0.1.0 fixed-points: 7.0.0 fixed-precision: 5.0.0 flame: 1.3.0 float32: 2.0.0 + fmt: 0.2.1 foldable-traversable: 6.0.0 foreign: 7.0.0 foreign-object: 4.1.0 foreign-readwrite: 3.4.0 + forgetmenot: 0.1.0 fork: 6.0.0 form-urlencoded: 7.0.0 formatters: 7.0.0 framer-motion: 1.0.1 - free: 7.0.0 + free: 7.1.0 freeap: 7.0.0 freer-free: 0.0.1 freet: 7.0.0 @@ -945,39 +944,35 @@ workspace: gen: 4.0.0 generate-values: 1.0.1 generic-router: 0.0.1 - geojson: 0.0.2 + geojson: 0.0.5 geometry-plane: 1.0.3 - github-actions-toolkit: 0.5.0 grain: 3.0.0 grain-router: 3.0.0 grain-virtualized: 3.0.0 - graphql-client: 9.3.2 graphs: 8.1.0 group: 4.1.1 halogen: 7.0.0 - halogen-bootstrap5: 2.1.0 + halogen-bootstrap5: 2.3.1 halogen-css: 10.0.0 halogen-echarts-simple: 0.0.4 - halogen-formless: 4.0.2 + halogen-formless: 4.0.3 halogen-helix: 1.0.0 halogen-hooks: 0.6.3 halogen-hooks-extra: 0.9.0 halogen-store: 0.5.4 halogen-storybook: 2.0.0 halogen-subscriptions: 2.0.0 - halogen-svg-elems: 7.0.0 + halogen-svg-elems: 8.0.0 + halogen-typewriter: 1.0.4 halogen-vdom: 8.0.0 halogen-vdom-string-renderer: 0.5.0 heckin: 2.0.1 heterogeneous: 0.6.0 homogeneous: 0.4.0 http-methods: 6.0.0 - httpure: 0.16.0 - httpurple: 3.0.1 - httpurple-argonaut: 1.0.1 - httpurple-yoga-json: 1.0.0 + httpurple: 4.0.0 humdrum: 0.0.1 - hyrule: 2.3.7 + hyrule: 2.3.8 identity: 6.0.0 identy: 4.0.1 indexed-db: 1.0.0 @@ -992,37 +987,43 @@ workspace: jelly-signal: 0.4.0 jest: 1.0.0 js-abort-controller: 1.0.0 - js-bigints: 2.0.0 + js-bigints: 2.2.1 js-date: 8.0.0 + js-fetch: 0.2.1 js-fileio: 3.0.0 + js-intl: 1.0.4 + js-iterators: 0.1.1 + js-maps: 0.1.2 js-promise: 1.0.0 js-promise-aff: 1.0.0 js-timers: 6.1.0 js-uri: 3.1.0 - json-codecs: 3.0.0 + json: 1.0.0 + json-codecs: 5.0.0 justifill: 0.5.0 jwt: 0.0.9 - language-cst-parser: 0.12.3 + labeled-data: 0.2.0 lazy: 6.0.0 lazy-joe: 1.0.0 lcg: 4.0.0 leibniz: 5.0.0 liminal: 1.0.1 - linalg: 5.1.0 + linalg: 6.0.0 lists: 7.0.0 literals: 1.0.2 logging: 3.0.0 logging-journald: 0.4.0 + lumi-components: 18.0.0 machines: 7.0.0 maps-eager: 0.4.1 marionette: 1.0.0 - marionette-commander: 0.1.1 marionette-react-basic-hooks: 0.1.1 + marked: 0.1.0 matrices: 5.0.1 matryoshka: 1.0.0 maybe: 6.0.0 - mdast-util-from-markdown: 0.2.1 media-types: 6.0.0 + meowclient: 1.0.0 midi: 4.0.0 milkis: 9.0.0 minibench: 4.0.1 @@ -1036,58 +1037,66 @@ workspace: morello: 0.4.0 mote: 3.0.0 motsunabe: 2.0.0 + mvc: 0.0.1 mysql: 6.0.1 n3: 0.1.0 nano-id: 1.1.0 + nanoid: 0.1.0 naturals: 3.0.0 nested-functor: 0.2.1 newtype: 5.0.0 nextjs: 0.1.1 nextui: 0.2.0 - node-buffer: 8.0.0 - node-buffer-blob: 1.0.0 - node-child-process: 9.0.0 - node-event-emitter: 1.0.1 - node-execa: 1.3.2 - node-fs: 8.2.0 - node-fs-aff: 9.2.0 - node-http: 8.0.0 + node-buffer: 9.0.0 + node-child-process: 11.1.0 + node-event-emitter: 3.0.0 + node-execa: 5.0.0 + node-fs: 9.1.0 + node-glob-basic: 1.3.0 + node-http: 9.1.0 + node-http2: 1.1.1 node-human-signals: 1.0.0 - node-net: 4.0.0 + node-net: 5.1.0 + node-os: 5.1.0 node-path: 5.0.0 - node-process: 10.0.0 - node-readline: 7.0.0 + node-process: 11.2.0 + node-readline: 8.1.0 node-sqlite3: 8.0.0 - node-streams: 7.0.0 - node-streams-aff: 5.0.0 - node-url: 6.0.0 - nodemailer: 4.0.1 + node-streams: 9.0.0 + node-tls: 0.3.1 + node-url: 7.0.1 + node-zlib: 0.4.0 nonempty: 7.0.0 now: 6.0.0 npm-package-json: 2.0.0 nullable: 6.0.0 numberfield: 0.1.0 numbers: 9.0.1 - object-maps: 0.1.1 - ocarina: 1.5.2 + oak: 3.1.1 + oak-debug: 1.2.2 + object-maps: 0.3.0 + ocarina: 1.5.4 open-folds: 6.3.0 open-memoize: 6.1.0 open-pairing: 6.1.0 options: 7.0.0 - optparse: 5.0.0 - ordered-collections: 3.0.0 + optparse: 5.0.1 + ordered-collections: 3.1.1 ordered-set: 0.4.0 orders: 6.0.0 - pairs: 9.0.0 - parallel: 6.0.0 + owoify: 1.2.0 + pairs: 9.0.1 + parallel: 7.0.0 parsing: 10.2.0 parsing-dataview: 3.2.4 partial: 4.0.0 pathy: 9.0.0 - pha: 0.9.1 + pha: 0.13.0 phaser: 0.7.0 + phylio: 1.1.2 pipes: 8.0.0 pirates-charm: 0.0.1 + pmock: 0.9.0 point-free: 1.0.0 pointed-list: 0.5.1 polymorphic-vectors: 4.0.0 @@ -1099,18 +1108,16 @@ workspace: profunctor: 6.0.0 profunctor-lenses: 8.0.0 protobuf: 4.3.0 - ps-cst: 1.2.0 psa-utils: 8.0.0 - psc-ide: 19.0.0 psci-support: 6.0.0 qualified-do: 2.2.0 - quantities: 12.1.0 + quantities: 12.2.0 quickcheck: 8.0.1 quickcheck-combinators: 0.1.3 quickcheck-laws: 7.0.0 quickcheck-utf8: 0.0.0 random: 6.0.0 - rationals: 5.0.1 + rationals: 6.0.0 rdf: 0.1.0 react: 11.0.0 react-aria: 0.2.0 @@ -1119,11 +1126,11 @@ workspace: react-basic-dnd: 10.1.0 react-basic-dom: 6.1.0 react-basic-emotion: 7.1.0 - react-basic-hooks: 8.1.2 + react-basic-hooks: 8.2.0 react-basic-storybook: 2.0.0 react-dom: 8.0.0 react-halo: 3.0.0 - react-icons: 1.1.1 + react-icons: 1.1.2 react-markdown: 0.1.0 react-testing-library: 4.0.1 react-virtuoso: 1.0.0 @@ -1131,6 +1138,7 @@ workspace: recharts: 1.1.0 record: 4.0.0 record-extra: 5.0.1 + record-ptional-fields: 0.1.2 record-studio: 1.0.4 refs: 6.0.0 remotedata: 5.0.0 @@ -1139,7 +1147,7 @@ workspace: result: 1.0.3 return: 0.2.0 ring-modules: 5.0.1 - rito: 0.3.2 + rito: 0.3.4 routing: 11.0.0 routing-duplex: 0.7.0 run: 5.0.0 @@ -1147,12 +1155,12 @@ workspace: safely: 4.0.1 school-of-music: 1.3.0 selection-foldable: 0.2.0 + selective-functors: 1.0.1 semirings: 7.0.0 signal: 13.0.0 simple-emitter: 3.0.1 simple-i18n: 2.0.1 simple-json: 9.0.0 - simple-jwt: 4.0.1 simple-ulid: 3.0.0 sized-matrices: 1.0.0 sized-vectors: 5.0.2 @@ -1160,9 +1168,9 @@ workspace: small-ffi: 4.0.1 soundfonts: 4.1.0 sparse-matrices: 1.3.0 - sparse-polynomials: 2.0.3 - spec: 7.3.0 - spec-discovery: 8.0.1 + sparse-polynomials: 2.0.5 + spec: 7.5.5 + spec-mocha: 5.0.0 spec-quickcheck: 5.0.0 splitmix: 2.1.0 ssrs: 1.0.0 @@ -1174,23 +1182,21 @@ workspace: strings-extra: 4.0.0 stringutils: 0.0.12 substitute: 0.2.3 - sunde: 3.0.0 supply: 0.2.0 svg-parser: 3.0.0 systemd-journald: 0.3.0 tagged: 4.0.2 tailrec: 6.1.0 - tecton: 0.1.6 - tecton-halogen: 0.1.3 + tecton: 0.2.1 + tecton-halogen: 0.2.0 test-unit: 17.0.0 thermite: 6.3.1 thermite-dom: 0.3.1 these: 6.0.0 - toppokki: 4.0.0 transformation-matrix: 1.0.1 transformers: 6.0.0 tree-rose: 4.0.2 - ts-bridge: 2.0.3 + ts-bridge: 4.0.0 tuples: 7.0.0 two-or-more: 1.0.0 type-equality: 4.0.1 @@ -1199,6 +1205,7 @@ workspace: typelevel-lists: 2.1.0 typelevel-peano: 1.0.1 typelevel-prelude: 7.0.0 + typelevel-regex: 0.0.3 typelevel-rows: 0.1.0 uint: 7.0.0 ulid: 3.0.1 @@ -1219,6 +1226,7 @@ workspace: uuidv4: 1.0.0 validation: 6.0.0 variant: 8.0.0 + variant-encodings: 2.0.0 vectorfield: 1.0.1 vectors: 2.1.0 versions: 7.0.0 @@ -1231,31 +1239,57 @@ workspace: web-dom-xpath: 3.0.0 web-encoding: 3.0.0 web-events: 4.0.0 - web-fetch: 3.0.0 + web-fetch: 4.0.1 web-file: 4.0.0 web-geometry: 0.1.0 web-html: 4.1.0 - web-pointerevents: 1.0.0 + web-pointerevents: 2.0.0 web-proletarian: 1.0.0 - web-promise: 3.1.0 - web-resize-observer: 2.0.0 + web-promise: 3.2.0 + web-resize-observer: 2.1.0 web-router: 1.0.0 web-socket: 4.0.0 web-storage: 5.0.0 - web-streams: 3.0.0 + web-streams: 4.0.0 web-touchevents: 4.0.0 - web-uievents: 4.0.0 + web-uievents: 5.0.0 web-url: 2.0.0 web-workers: 1.1.0 web-xhr: 5.0.1 webextension-polyfill: 0.1.0 + webgpu: 0.0.1 which: 2.0.0 yoga-fetch: 1.0.1 yoga-json: 5.1.0 yoga-om: 0.1.0 yoga-postgres: 6.0.0 yoga-tree: 1.0.0 + z3: 0.0.2 extra_packages: + dodo-printer: + git: https://github.com/natefaubion/purescript-dodo-printer.git + ref: v2.2.1 + dependencies: + - aff + - ansi + - arrays + - avar + - console + - control + - effect + - either + - exceptions + - foldable-traversable + - integers + - lists + - maybe + - newtype + - parallel + - partial + - prelude + - safe-coerce + - strings + - tuples html-parser-halogen: git: https://github.com/rnons/purescript-html-parser-halogen.git ref: 035a51d02ba9f8b70c3ffd9fe31a3f5bed19941c @@ -1372,7 +1406,6 @@ workspace: - lists - maybe - node-fs - - node-fs-aff - node-path - node-process - ordered-collections @@ -1381,14 +1414,13 @@ workspace: - refs - strings - tuples - ordered-collections: 3.1.1 registry-foreign: git: https://github.com/purescript/registry-dev.git - ref: 6a803c37577af368caa221a2a06d6be2079d32da + ref: d7d35c94cc286528e506a6a7ca78d22c84b251c9 subdir: foreign registry-lib: git: https://github.com/purescript/registry-dev.git - ref: 6a803c37577af368caa221a2a06d6be2079d32da + ref: d7d35c94cc286528e506a6a7ca78d22c84b251c9 subdir: lib search-trie: git: https://github.com/klntsky/purescript-search-trie.git @@ -1446,7 +1478,7 @@ workspace: - newtype - node-buffer - node-child-process - - node-fs-aff + - node-fs - node-path - node-process - node-streams @@ -1552,12 +1584,13 @@ packages: dependencies: [] arrays: type: registry - version: 7.2.0 - integrity: sha256-vjd5tY1VFIg3HGBUFqG9+tWXqkV3EHRqZCzE+JC2yR0= + version: 7.3.0 + integrity: sha256-tmcklBlc/muUtUfr9RapdCPwnlQeB3aSrC4dK85gQlc= dependencies: - bifunctors - control - foldable-traversable + - functions - maybe - nonempty - partial @@ -1625,8 +1658,8 @@ packages: - unfoldable codec: type: registry - version: 6.0.0 - integrity: sha256-VLG7Ii38xmeT5UGH98xBFiWp1YnFZim/iMg+aQz2RB8= + version: 6.1.0 + integrity: sha256-6vMLNlsJxQarVQ9cn1FYfl5x6opfzxAza15SzRdxFxQ= dependencies: - bifunctors - profunctor @@ -1654,8 +1687,8 @@ packages: - strings console: type: registry - version: 6.0.0 - integrity: sha256-gJpJ53fCDAL8BiCiJXH0HNAJ9K3gJtLo8GDaCK6hA5U= + version: 6.1.0 + integrity: sha256-CxmAzjgyuGDmt9FZW51VhV6rBPwR6o0YeKUzA9rSzcM= dependencies: - effect - prelude @@ -1727,6 +1760,13 @@ packages: - partial - prelude - tuples + debug: + type: registry + version: 6.0.2 + integrity: sha256-vmkYFuXYuELBzeauvgHG6E6Kf/Hp1dAnxwE9ByHfwSg= + dependencies: + - functions + - prelude distributive: type: registry version: 6.0.0 @@ -1738,9 +1778,9 @@ packages: - tuples - type-equality dodo-printer: - type: registry - version: 2.2.1 - integrity: sha256-9HgCr5c0TMZCSi/ibCB5LlAL8HTQf/KTRljIXkZeEKM= + type: git + url: https://github.com/natefaubion/purescript-dodo-printer.git + rev: 831c5c963a57ca4bfd62f96335267d7d0785851d dependencies: - aff - ansi @@ -1755,25 +1795,17 @@ packages: - integers - lists - maybe - - minibench - newtype - - node-buffer - - node-child-process - - node-fs-aff - - node-path - - node-process - - node-streams - parallel - partial - - posix-types - prelude - safe-coerce - strings - tuples dom-indexed: type: registry - version: 11.0.0 - integrity: sha256-asNUditTILJdNGS7xxFFkm6TrxC0hykoZUII3aTi5Q4= + version: 12.0.0 + integrity: sha256-bltgxNRfJrJc73YirgM+8u4AqdJAsuaKr7epwzIayF0= dependencies: - media-types - prelude @@ -1843,49 +1875,27 @@ packages: - enums fetch: type: registry - version: 1.1.4 - integrity: sha256-Tmt60rjS4PNtKMVGpo8O6W1Fdhcu3a3CvyN/x+SwXEs= + version: 4.1.0 + integrity: sha256-zCwBUkRL9n6nUhK1+7UqqsuxswPFATsZfGSBOA3NYYY= dependencies: - aff - - aff-promise - arraybuffer-types + - bifunctors - effect - - fetch-core - - foreign - - http-methods - - newtype - - prelude - - record - - typelevel-prelude - - unsafe-coerce - - web-file - - web-promise - - web-streams - fetch-core: - type: registry - version: 4.0.4 - integrity: sha256-lS4yhvznII/vg37LewU/Ubeoj6OpxED2kb5/yn58YQQ= - dependencies: - - arraybuffer-types - - arrays - - console - - effect - - foldable-traversable + - either - foreign - - foreign-object - - functions - http-methods + - js-fetch + - js-promise + - js-promise-aff - maybe - newtype - - nullable + - ordered-collections - prelude - record - - tuples + - strings - typelevel-prelude - - unfoldable - - unsafe-coerce - web-file - - web-promise - web-streams filterable: type: registry @@ -1986,8 +1996,8 @@ packages: - transformers free: type: registry - version: 7.0.0 - integrity: sha256-72auTIZAG6fhz4F94rxyDwgfnHwp+/89rujZpZWrV0w= + version: 7.1.0 + integrity: sha256-JAumgEsGSzJCNLD8AaFvuX7CpqS5yruCngi6yI7+V5k= dependencies: - catenable-lists - control @@ -2169,6 +2179,29 @@ packages: - foreign - integers - now + js-fetch: + type: registry + version: 0.2.1 + integrity: sha256-zQaVi9wFWku1SsWmdR11kRpOb+wxkNWR49cn928ucjw= + dependencies: + - arraybuffer-types + - arrays + - effect + - foldable-traversable + - foreign + - foreign-object + - functions + - http-methods + - js-promise + - maybe + - newtype + - prelude + - record + - tuples + - typelevel-prelude + - unfoldable + - web-file + - web-streams js-promise: type: registry version: 1.0.0 @@ -2180,6 +2213,14 @@ packages: - functions - maybe - prelude + js-promise-aff: + type: registry + version: 1.0.0 + integrity: sha256-s9kml9Ei74hKlMMg41yyZp4GkbmYUwaH+gBWWrdhwec= + dependencies: + - aff + - foreign + - js-promise js-timers: type: registry version: 6.1.0 @@ -2354,18 +2395,6 @@ packages: dependencies: - newtype - prelude - minibench: - type: registry - version: 4.0.1 - integrity: sha256-7jyxcklZI49q/otYvMV4f9YnJwEqQ3Me5buhDwAOydw= - dependencies: - - console - - effect - - integers - - numbers - - partial - - prelude - - refs mmorph: type: registry version: 7.0.0 @@ -2383,42 +2412,47 @@ packages: - safe-coerce node-buffer: type: registry - version: 8.0.0 - integrity: sha256-RwOTB8yTS4Jjqc55JqxRcVaMXP+cYJ5aww0XH1Z/I8A= + version: 9.0.0 + integrity: sha256-PWE2DJ5ruBLCmeA/fUiuySEFmUJ/VuRfyrnCuVZBlu4= dependencies: - arraybuffer-types - effect - maybe + - nullable - st - unsafe-coerce node-child-process: type: registry - version: 9.0.0 - integrity: sha256-bi7hXHcrgqw6UQzD4p0kr2flPxdqyRHv3bLcffZYpm0= + version: 11.1.0 + integrity: sha256-vioMNgk8p+CGwlb6T3I3TIir27el85Yg4satLE/I89w= dependencies: - exceptions - foreign - foreign-object - functions + - node-event-emitter - node-fs + - node-os - node-streams - nullable - posix-types - unsafe-coerce node-event-emitter: type: registry - version: 1.0.1 - integrity: sha256-OwJNgvg20g4g5Alp5Zka3C5KMLH8hwTz9KW4DYr82ls= + version: 3.0.0 + integrity: sha256-Qw0MjsT4xRH2j2i4K8JmRjcMKnH5z1Cw39t00q4LE4w= dependencies: - effect + - either - functions + - maybe + - nullable - prelude - - safe-coerce - unsafe-coerce node-execa: type: registry - version: 1.3.2 - integrity: sha256-kKVeJC+s5Pfye9aJ2V55NUfSyETZ2DZxPP02+zpNS/M= + version: 5.0.0 + integrity: sha256-yNcgbCs4guwoTApyV6LRoYCYnU5loWgQiqMtsbloZqk= dependencies: - aff - arrays @@ -2434,9 +2468,11 @@ packages: - js-timers - maybe - node-buffer + - node-child-process - node-event-emitter - node-fs - node-human-signals + - node-os - node-path - node-process - node-streams @@ -2448,20 +2484,18 @@ packages: - partial - posix-types - prelude - - profunctor-lenses - record - refs - safe-coerce - strings - tailrec - - transformers - tuples - unsafe-coerce - unsafe-reference node-fs: type: registry - version: 8.2.0 - integrity: sha256-6X/8KFH5qAF15UDrMadoyAMZxd08bs9IF2XrVgvpH2I= + version: 9.1.0 + integrity: sha256-TzhvGdrwcM0bazDvrWSqh+M/H8GKYf1Na6aGm2Qg4+c= dependencies: - datetime - effect @@ -2480,15 +2514,6 @@ packages: - prelude - strings - unsafe-coerce - node-fs-aff: - type: registry - version: 9.2.0 - integrity: sha256-usKEFrLY9zh8o3IP3bwc+jX7Zd4OOmhHvwLFZlxdN8U= - dependencies: - - aff - - either - - node-fs - - node-path node-human-signals: type: registry version: 1.0.0 @@ -2500,6 +2525,30 @@ packages: - maybe - ordered-collections - prelude + node-os: + type: registry + version: 5.1.0 + integrity: sha256-K3gcu9AXanN1+qtk1900+Fi+CuO0s3/H/RMNRNgIzso= + dependencies: + - arrays + - bifunctors + - console + - control + - datetime + - effect + - either + - exceptions + - foldable-traversable + - foreign + - foreign-object + - functions + - maybe + - node-buffer + - nullable + - partial + - posix-types + - prelude + - unsafe-coerce node-path: type: registry version: 5.0.0 @@ -2508,25 +2557,29 @@ packages: - effect node-process: type: registry - version: 10.0.0 - integrity: sha256-YzUqf7HWkGEQVRmkxUpL1x2GzKqKLyEyR7mkP68xcZs= + version: 11.2.0 + integrity: sha256-+2MQDYChjGbVbapCyJtuWYwD41jk+BntF/kcOTKBMVs= dependencies: - effect + - foreign - foreign-object - maybe + - node-event-emitter - node-streams - posix-types - prelude - unsafe-coerce node-streams: type: registry - version: 7.0.0 - integrity: sha256-EGCA+hp6chlxDlQ8UG3RIaIIL1R0OckKnqP+KPAX1y4= + version: 9.0.0 + integrity: sha256-2n6dq7YWleTDmD1Kur/ul7Cn08IvWrScgPf+0PgX2TQ= dependencies: + - aff - effect - either - exceptions - node-buffer + - node-event-emitter - nullable - prelude nonempty: @@ -2591,8 +2644,8 @@ packages: - tuples optparse: type: registry - version: 5.0.0 - integrity: sha256-Y1xqUrnOB5934wKssPyWVdF4kqA6ITXwSasdEOkxZT8= + version: 5.0.1 + integrity: sha256-cEzEkNW4q0gZlXl4z0zn+H2vs6l2UAp7NPHCsois73k= dependencies: - aff - arrays @@ -2620,7 +2673,6 @@ packages: - open-memoize - partial - prelude - - quickcheck - strings - tailrec - transformers @@ -2650,8 +2702,8 @@ packages: - prelude parallel: type: registry - version: 6.0.0 - integrity: sha256-VJbkGD0rAKX+NUEeBJbYJ78bEKaZbgow+QwQEfPB6ko= + version: 7.0.0 + integrity: sha256-gUC9i4Txnx9K9RcMLsjujbwZz6BB1bnE2MLvw4GIw5o= dependencies: - control - effect @@ -2833,7 +2885,7 @@ packages: registry-foreign: type: git url: https://github.com/purescript/registry-dev.git - rev: 6a803c37577af368caa221a2a06d6be2079d32da + rev: d7d35c94cc286528e506a6a7ca78d22c84b251c9 subdir: foreign dependencies: - aff @@ -2871,7 +2923,7 @@ packages: registry-lib: type: git url: https://github.com/purescript/registry-dev.git - rev: 6a803c37577af368caa221a2a06d6be2079d32da + rev: d7d35c94cc286528e506a6a7ca78d22c84b251c9 subdir: lib dependencies: - aff @@ -2897,7 +2949,6 @@ packages: - newtype - node-buffer - node-fs - - node-fs-aff - node-path - nullable - ordered-collections @@ -2952,17 +3003,17 @@ packages: - prelude spec: type: registry - version: 7.3.0 - integrity: sha256-YmmRmlHmSHyAM8j5/QVHLgkMhtAkt2FXytVb5j/Zu0s= + version: 7.5.5 + integrity: sha256-HdyBH7Ys1/m2SdTq3u2u9LdQ4cGeaohWeEMYay2mHdU= dependencies: - aff - ansi - arrays - avar - bifunctors - - console - control - datetime + - debug - effect - either - exceptions @@ -2978,6 +3029,7 @@ packages: - parallel - pipes - prelude + - refs - strings - tailrec - transformers @@ -3200,25 +3252,14 @@ packages: - web-storage web-pointerevents: type: registry - version: 1.0.0 - integrity: sha256-I3OGc4gVslh2QsH8QUTeihKCIpFwv4t3RoycZB9ITOs= + version: 2.0.0 + integrity: sha256-uy1cI/Tck8Cf/MP0psvm2MLNxdijqfLZGLRq5FmuRh0= dependencies: - effect - maybe - prelude - web-dom - web-uievents - web-promise: - type: registry - version: 3.1.0 - integrity: sha256-YfqJyEC3bHH6D8QgTi0ME5oJmGYOuZ2TlcyOdpG8dIE= - dependencies: - - effect - - exceptions - - foldable-traversable - - functions - - maybe - - prelude web-storage: type: registry version: 5.0.0 @@ -3228,16 +3269,16 @@ packages: - web-events web-streams: type: registry - version: 3.0.0 - integrity: sha256-+QELAR7lb08Ebr4lCntxeGk5Z1i+NInDJwzEzz3Pigc= + version: 4.0.0 + integrity: sha256-02HgXIk6R+pU9fWOX42krukAI1QkCbLKcCv3b4Jq6WI= dependencies: - arraybuffer-types - effect - exceptions + - js-promise - nullable - prelude - tuples - - web-promise web-touchevents: type: registry version: 4.0.0 @@ -3246,8 +3287,8 @@ packages: - web-uievents web-uievents: type: registry - version: 4.0.0 - integrity: sha256-Vtp5m/8IWP3flDXpnVn3Mxq8lCFDlBFp5eBnB+uO/CM= + version: 5.0.0 + integrity: sha256-5I+ut9JYno3wowti3vJGs1afKCm1ucppKuy+zhuSyss= dependencies: - web-html web-xhr: diff --git a/spago.yaml b/spago.yaml index a25a416f9..41ddc480f 100644 --- a/spago.yaml +++ b/spago.yaml @@ -61,15 +61,15 @@ package: - spec workspace: package_set: - registry: 20.0.1 + registry: 47.9.1 extra_packages: registry-lib: git: https://github.com/purescript/registry-dev.git - ref: 6a803c37577af368caa221a2a06d6be2079d32da + ref: d7d35c94cc286528e506a6a7ca78d22c84b251c9 subdir: lib registry-foreign: git: https://github.com/purescript/registry-dev.git - ref: 6a803c37577af368caa221a2a06d6be2079d32da + ref: d7d35c94cc286528e506a6a7ca78d22c84b251c9 subdir: foreign html-parser-halogen: dependencies: @@ -212,7 +212,7 @@ workspace: - newtype - node-buffer - node-child-process - - node-fs-aff + - node-fs - node-path - node-process - node-streams @@ -261,7 +261,7 @@ workspace: - lists - maybe - node-fs - - node-fs-aff + - node-fs - node-path - node-process - ordered-collections @@ -270,4 +270,27 @@ workspace: - refs - strings - tuples - ordered-collections: "3.1.1" + dodo-printer: + git: "https://github.com/natefaubion/purescript-dodo-printer.git" + ref: "v2.2.1" + dependencies: + - aff + - ansi + - arrays + - avar + - console + - control + - effect + - either + - exceptions + - foldable-traversable + - integers + - lists + - maybe + - newtype + - parallel + - partial + - prelude + - safe-coerce + - strings + - tuples diff --git a/src/Spago/Cmd.purs b/src/Spago/Cmd.purs index 17c0487e1..0479ad9c5 100644 --- a/src/Spago/Cmd.purs +++ b/src/Spago/Cmd.purs @@ -3,9 +3,12 @@ module Spago.Cmd where import Spago.Prelude import Data.Array as Array +import Data.Foldable (traverse_) +import Data.Posix (Pid) import Data.String (Pattern(..)) import Data.String as String import Data.Time.Duration (Milliseconds(..)) +import Node.ChildProcess.Types (Exit(..), KillSignal, inherit, pipe) import Node.Library.Execa as Execa import Node.Platform as Platform import Node.Process as Process @@ -16,6 +19,51 @@ data StdinConfig | StdinNewPipe | StdinWrite String +type ExecResult = + { canceled :: Boolean + , escapedCommand :: String + , exit :: Exit + , exitCode :: Maybe Int + , killed :: Boolean + , message :: String + , originalMessage :: Maybe String + , pid :: Maybe Pid + , shortMessage :: String + , signal :: Maybe KillSignal + , signalDescription :: Maybe String + , stderr :: String + , stderrError :: Maybe Error + , stdinError :: Maybe Error + , stdout :: String + , stdoutError :: Maybe Error + , timedOut :: Boolean + } + +printExecResult :: ExecResult -> String +printExecResult r = Array.intercalate "\n" + [ "escapedCommand: " <> show r.escapedCommand + , "canceled: " <> show r.canceled + , "exit: " <> show r.exit + , "exitCode: " <> show r.exitCode + , "signal: " <> show r.signal + , "signalDescription: " <> show r.signalDescription + , "pid: " <> show r.pid + , "killed: " <> show r.killed + , "timedOut: " <> show r.timedOut + , "shortMessage: " <> show r.shortMessage + , "message: " <> show r.message + , "originalMessage: " <> show r.originalMessage + , "stdinError: " <> show r.stdinError + , "stdoutError: " <> show r.stdoutError + , "stderrError: " <> show r.stderrError + , "stderr:" + , r.stderr + , "" + , "stdout:" + , r.stdout + , "" + ] + type ExecOptions = { pipeStdin :: StdinConfig , pipeStdout :: Boolean @@ -23,10 +71,6 @@ type ExecOptions = , cwd :: Maybe FilePath } -type ExecResult = Execa.ExecaSuccess - -type ExecError = Execa.ExecaError - defaultExecOptions :: ExecOptions defaultExecOptions = { pipeStdin: StdinNewPipe @@ -37,33 +81,50 @@ defaultExecOptions = spawn :: forall m. MonadAff m => String -> Array String -> ExecOptions -> m Execa.ExecaProcess spawn cmd args opts = liftAff do - subprocess <- Execa.execa cmd args (_ { cwd = opts.cwd }) + let + stdinOpt = case opts.pipeStdin of + StdinPipeParent -> Just inherit + StdinWrite _ -> Just pipe + StdinNewPipe -> Just pipe + subprocess <- Execa.execa cmd args (_ { cwd = opts.cwd, stdin = stdinOpt, stdout = Just pipe, stderr = Just pipe }) case opts.pipeStdin of - StdinPipeParent -> subprocess.stdin.shareParentProcessStdin - StdinWrite s -> subprocess.stdin.writeUtf8End s + StdinWrite s | Just { writeUtf8End } <- subprocess.stdin -> writeUtf8End s _ -> pure unit + when (opts.pipeStderr) do - subprocess.stderr.pipeToParentStderr + traverse_ _.pipeToParentStderr subprocess.stderr when (opts.pipeStdout) do - subprocess.stdout.pipeToParentStdout + traverse_ _.pipeToParentStdout subprocess.stdout pure subprocess -joinProcess :: forall m. MonadAff m => Execa.ExecaProcess -> m (Either ExecError ExecResult) -joinProcess cp = liftAff $ cp.result +joinProcess :: forall m. MonadAff m => Execa.ExecaProcess -> m (Either ExecResult ExecResult) +joinProcess cp = do + result <- liftAff $ cp.getResult + case result.exit of + Normally 0 -> pure $ Right result + _ -> pure $ Left result -exec :: forall m. MonadAff m => String -> Array String -> ExecOptions -> m (Either ExecError ExecResult) +exec :: forall m. MonadAff m => String -> Array String -> ExecOptions -> m (Either ExecResult ExecResult) exec cmd args opts = liftAff do - subprocess <- spawn cmd args opts - subprocess.result + result <- _.getResult =<< spawn cmd args opts + case result.exit of + Normally 0 -> pure $ Right result + _ -> pure $ Left result -kill :: Execa.ExecaProcess -> Aff ExecError +kill :: Execa.ExecaProcess -> Aff ExecResult kill cp = liftAff do void $ cp.killForced $ Milliseconds 2_000.0 - cp.result >>= case _ of - Left e -> pure e - Right res -> unsafeCrashWith ("Tried to kill the process, failed. Result: " <> show res) + cp.getResult >>= \r -> case r.exit of + Normally 0 -> unsafeCrashWith ("Tried to kill the process, failed. Result:\n" <> printExecResult r) + _ -> pure r + +getStdout :: Either ExecResult ExecResult -> String +getStdout = either _.stdout _.stdout + +getStderr :: Either ExecResult ExecResult -> String +getStderr = either _.stderr _.stderr -- | Try to find one of the flags in a list of Purs args -- | For example, trying to find the `output` arg @@ -116,23 +177,23 @@ getExecutable command = let cmd1 = mkCmd command (Just "cmd") askVersion cmd1 >>= case _ of Right r -> pure { cmd: cmd1, output: r.stdout } - Left err' -> do + Left r -> do let cmd2 = mkCmd command Nothing - logDebug [ "Failed to find purs.cmd. Trying with just purs...", show err' ] + logDebug [ "Failed to find purs.cmd. Trying with just purs...", show r.message ] askVersion cmd2 >>= case _ of - Right r -> pure { cmd: cmd2, output: r.stdout } - Left err -> complain err + Right r' -> pure { cmd: cmd2, output: r'.stdout } + Left r' -> complain r' _ -> do -- On other platforms, we just call `purs` let cmd1 = mkCmd command Nothing askVersion cmd1 >>= case _ of Right r -> pure { cmd: cmd1, output: r.stdout } - Left err -> complain err + Left r -> complain r where askVersion cmd = exec cmd [ "--version" ] defaultExecOptions { pipeStdout = false, pipeStderr = false } mkCmd cmd maybeExtension = cmd <> maybe "" (append ".") maybeExtension complain err = do - logDebug $ show err + logDebug $ printExecResult err die [ "Failed to find " <> command <> ". Have you installed it, and is it in your PATH?" ] diff --git a/src/Spago/Command/Build.purs b/src/Spago/Command/Build.purs index 527870e4d..8c16ef7fe 100644 --- a/src/Spago/Command/Build.purs +++ b/src/Spago/Command/Build.purs @@ -133,10 +133,10 @@ run opts = do Just as | Array.length as > 0 -> as _ -> [] Cmd.exec backend.cmd (addOutputArgs moreBackendArgs) Cmd.defaultExecOptions >>= case _ of - Left err -> do - logDebug $ show err + Left r -> do + logDebug $ Cmd.printExecResult r die [ "Failed to build with backend " <> backend.cmd ] - Right _r -> + Right _ -> logSuccess "Backend build succeeded." let diff --git a/src/Spago/Command/Bundle.purs b/src/Spago/Command/Bundle.purs index de9179c09..1b6418cd1 100644 --- a/src/Spago/Command/Bundle.purs +++ b/src/Spago/Command/Bundle.purs @@ -4,8 +4,8 @@ import Spago.Prelude import Node.Path as Path import Spago.Cmd as Cmd -import Spago.Esbuild (Esbuild) import Spago.Config (BundlePlatform(..), BundleType(..), Workspace, WorkspacePackage) +import Spago.Esbuild (Esbuild) type BundleEnv a = { esbuild :: Esbuild @@ -78,7 +78,7 @@ run = do logInfo "Bundling..." logDebug $ "Running esbuild: " <> show args Cmd.exec esbuild.cmd args execOptions >>= case _ of - Right _r -> logSuccess "Bundle succeeded." - Left err -> do - logDebug $ show err + Right _ -> logSuccess "Bundle succeeded." + Left r -> do + logDebug $ Cmd.printExecResult r die [ "Failed to bundle." ] diff --git a/src/Spago/Command/Docs.purs b/src/Spago/Command/Docs.purs index 541ac2434..0ea06a5b3 100644 --- a/src/Spago/Command/Docs.purs +++ b/src/Spago/Command/Docs.purs @@ -7,8 +7,8 @@ import Spago.Prelude import Control.Promise (Promise) import Control.Promise as Promise -import Docs.Search.IndexBuilder as IndexBuilder import Docs.Search.Config as DocConfig +import Docs.Search.IndexBuilder as IndexBuilder import Effect.Uncurried (EffectFn1, runEffectFn1) import Node.Process as Process import Spago.Command.Build as Build @@ -44,8 +44,8 @@ run = do result <- Purs.docs globs docsFormat case result of - Left err -> die err.message - Right _ -> pure unit + Left r -> die r.message + _ -> pure unit when (docsFormat == Html) $ do liftAff $ IndexBuilder.run' diff --git a/src/Spago/Command/Run.purs b/src/Spago/Command/Run.purs index 6193fe05f..382efb3ab 100644 --- a/src/Spago/Command/Run.purs +++ b/src/Spago/Command/Run.purs @@ -48,8 +48,8 @@ type Node = { cmd :: String, version :: Version } nodeVersion :: forall a. Spago (LogEnv a) Version nodeVersion = Cmd.exec "node" [ "--version" ] Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false } >>= case _ of - Left err -> do - logDebug $ show err + Left r -> do + logDebug $ Cmd.printExecResult r die [ "Failed to find node. Have you installed it, and is it in your PATH?" ] Right r -> case parseLenientVersion r.stdout of Left _err -> die $ "Failed to parse NodeJS version. Was: " <> r.stdout @@ -117,19 +117,19 @@ run = do logDebug $ "Executing from: " <> show opts.executeDir logDebug $ "Running node command with args: `" <> show nodeArgs <> "`" Cmd.exec node.cmd nodeArgs (execOptions { cwd = Just opts.executeDir }) >>= case _ of - Right _r -> case opts.successMessage of + Right _ -> case opts.successMessage of Just m -> logSuccess m Nothing -> pure unit - Left err -> do - logDebug $ show err + Left r -> do + logDebug $ Cmd.printExecResult r die opts.failureMessage Just backend -> do let args = [ "--run", opts.moduleName <> ".main" ] <> opts.execArgs logDebug $ "Running command `" <> backend.cmd <> " " <> show args <> "`" Cmd.exec backend.cmd args execOptions >>= case _ of - Right _r -> case opts.successMessage of + Right _ -> case opts.successMessage of Just m -> logSuccess m Nothing -> pure unit - Left err -> do - logDebug $ show err - die [ opts.failureMessage, "Backend " <> show backend <> " exited with error:" <> err.shortMessage ] + Left r -> do + logDebug $ Cmd.printExecResult r + die [ opts.failureMessage, "Backend " <> show backend <> " exited with error:" <> r.shortMessage ] diff --git a/src/Spago/Command/Uninstall.purs b/src/Spago/Command/Uninstall.purs index 4e06e3da1..643de4b94 100644 --- a/src/Spago/Command/Uninstall.purs +++ b/src/Spago/Command/Uninstall.purs @@ -94,7 +94,7 @@ run args = do true -> case pkgConfig.test of Nothing -> do logWarn $ "Could not uninstall test dependencies for " <> PackageName.print pkgConfig.name <> " because it does not have a test configuration." - liftEffect $ Process.exit 0 + liftEffect $ Process.exit' 0 Just { dependencies } -> pure { name: pkgConfig.name , deps: dependencies diff --git a/src/Spago/Git.purs b/src/Spago/Git.purs index bc4cc14ea..d3d98eef3 100644 --- a/src/Spago/Git.purs +++ b/src/Spago/Git.purs @@ -18,6 +18,7 @@ import Control.Monad.Except as Except import Data.Array as Array import Data.String (Pattern(..)) import Data.String as String +import Node.ChildProcess.Types (Exit(..)) import Node.Path as Path import Node.Process as Process import Registry.Version as Version @@ -35,7 +36,9 @@ runGit :: forall a. Array String -> Maybe FilePath -> ExceptT String (Spago (Git runGit args cwd = ExceptT do { git } <- ask result <- Cmd.exec git.cmd args (Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false, cwd = cwd }) - pure $ bimap _.stderr _.stdout result + pure case result of + Right r -> Right r.stdout + Left r -> Left r.stderr fetchRepo :: forall a b. { git :: String, ref :: String | a } -> FilePath -> Spago (GitEnv b) (Either (Array String) Unit) fetchRepo { git, ref } path = do @@ -85,29 +88,29 @@ listTags cwd = do let opts = Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false, cwd = cwd } { git } <- ask Cmd.exec git.cmd [ "tag" ] opts >>= case _ of - Left err -> do - pure $ Left $ toDoc [ "Could not run `git tag`. Error:", err.message ] - Right res -> pure $ Right $ String.split (Pattern "\n") res.stdout + Left r -> do + pure $ Left $ toDoc [ "Could not run `git tag`. Error:", r.message ] + Right r -> pure $ Right $ String.split (Pattern "\n") r.stdout getStatus :: forall a. Maybe FilePath -> Spago (GitEnv a) (Either Docc String) getStatus cwd = do let opts = Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false, cwd = cwd } { git } <- ask Cmd.exec git.cmd [ "status", "--porcelain" ] opts >>= case _ of - Left err -> do - pure $ Left $ toDoc [ "Could not run `git status`. Error:", err.message ] - Right res -> pure $ Right res.stdout + Left r -> do + pure $ Left $ toDoc [ "Could not run `git status`. Error:", r.message ] + Right r -> pure $ Right r.stdout getRef :: forall a. Maybe FilePath -> Spago (GitEnv a) (Either Docc String) getRef cwd = do let opts = Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false, cwd = cwd } { git } <- ask Cmd.exec git.cmd [ "rev-parse", "HEAD" ] opts >>= case _ of - Left err -> pure $ Left $ toDoc + Left r -> pure $ Left $ toDoc [ "Could not run `git rev-parse HEAD` to determine the current ref. Error:" - , err.shortMessage + , r.shortMessage ] - Right res' -> pure $ Right res'.stdout + Right r -> pure $ Right r.stdout tagCheckedOut :: forall a. Maybe FilePath -> Spago (GitEnv a) (Either Docc String) tagCheckedOut cwd = do @@ -115,7 +118,7 @@ tagCheckedOut cwd = do { git } <- ask Cmd.exec git.cmd [ "describe", "--tags", "--exact-match" ] opts >>= case _ of Left _ -> pure $ Left $ toDoc "The git ref currently checked out is not a tag." - Right res' -> pure $ Right res'.stdout + Right r -> pure $ Right r.stdout pushTag :: forall a. Maybe FilePath -> Version -> Spago (GitEnv a) (Either Docc Unit) pushTag cwd version = do @@ -128,10 +131,10 @@ pushTag cwd version = do Online -> do logInfo $ "Pushing tag 'v" <> Version.print version <> "' to the remote" Cmd.exec git.cmd [ "push", "origin", "v" <> Version.print version ] opts >>= case _ of - Left err -> pure $ Left $ toDoc + Left r -> pure $ Left $ toDoc [ "Could not push the tag 'v" <> Version.print version <> "' to the remote." , "Error:" - , err.shortMessage + , r.shortMessage ] Right _ -> pure $ Right unit @@ -145,30 +148,32 @@ isIgnored path = do result <- Cmd.exec git.cmd [ "check-ignore", "--quiet", path ] (Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false }) case result of -- Git is successful if it's an ignored file - Right { exitCode: 0 } -> pure true + Right _ -> pure true -- Git will fail with exitCode 128 if this is not a git repo or if it's dealing with a link. -- We ignore links - I mean, do we really want to deal with recursive links?!? - Left { exitCode: Just 128 } -> do - -- Sigh. Even if something is behind a link Node will not tell us that, - -- so we need to check all the paths between the cwd and the provided path - -- Just beautiful - paths <- liftEffect do - cwd <- Process.cwd - absolutePath <- Path.resolve [] path - FS.getInBetweenPaths cwd absolutePath - Array.any identity <$> traverse FS.isLink paths - -- Git will fail with 1 when a file is just, like, normally ignored - Left { exitCode: Just 1 } -> pure false - _ -> do - logDebug "IsIgnored encountered an interesting exitCode" - logDebug $ show result - -- We still do not ignore it, just in case - pure false + Left r + | Normally 128 <- r.exit -> do + -- Sigh. Even if something is behind a link Node will not tell us that, + -- so we need to check all the paths between the cwd and the provided path + -- Just beautiful + paths <- liftEffect do + cwd <- Process.cwd + absolutePath <- Path.resolve [] path + FS.getInBetweenPaths cwd absolutePath + Array.any identity <$> traverse FS.isLink paths + -- Git will fail with 1 when a file is just, like, normally ignored + | Normally 1 <- r.exit -> + pure false + | otherwise -> do + logDebug "IsIgnored encountered an interesting exitCode" + logDebug $ Cmd.printExecResult r + -- We still do not ignore it, just in case + pure false getGit :: forall a. Spago (LogEnv a) Git getGit = do Cmd.exec "git" [ "--version" ] Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false } >>= case _ of Right r -> pure { cmd: "git", version: r.stdout } - Left err -> do - logDebug $ show err + Left r -> do + logDebug $ Cmd.printExecResult r die [ "Failed to find git. Have you installed it, and is it in your PATH?" ] diff --git a/src/Spago/Paths.purs b/src/Spago/Paths.purs index 348e7efd6..11e09489f 100644 --- a/src/Spago/Paths.purs +++ b/src/Spago/Paths.purs @@ -27,10 +27,16 @@ globalCachePath :: FilePath globalCachePath = paths.cache localCachePath :: FilePath -localCachePath = Path.concat [ cwd, ".spago" ] +localCachePath = toLocalCachePath cwd localCachePackagesPath :: FilePath -localCachePackagesPath = Path.concat [ localCachePath, "packages" ] +localCachePackagesPath = toLocalCachePackagesPath cwd + +toLocalCachePath :: FilePath -> FilePath +toLocalCachePath rootDir = Path.concat [ rootDir, ".spago" ] + +toLocalCachePackagesPath :: FilePath -> FilePath +toLocalCachePackagesPath rootDir = Path.concat [ toLocalCachePath rootDir, "p" ] registryPath ∷ FilePath registryPath = Path.concat [ globalCachePath, "registry" ] diff --git a/src/Spago/Psa.purs b/src/Spago/Psa.purs index 9d5b91961..d173ed9b6 100644 --- a/src/Spago/Psa.purs +++ b/src/Spago/Psa.purs @@ -23,6 +23,7 @@ import Foreign.Object as FO import Node.Encoding as Encoding import Node.FS.Aff as FSA import Node.Path as Path +import Spago.Cmd as Cmd import Spago.Config (Package(..), PackageMap, WorkspacePackage) import Spago.Config as Config import Spago.Core.Config (CensorBuildWarnings(..), WarningCensorTest(..)) @@ -38,11 +39,8 @@ defaultStatVerbosity = Core.CompactStats psaCompile :: forall a. Set.Set FilePath -> Array String -> PsaArgs -> Spago (Purs.PursEnv a) Unit psaCompile globs pursArgs psaArgs = do result <- Purs.compile globs (Array.snoc pursArgs "--json-errors") - let - result' = case result of - Left err -> { output: err.stdout, exitCode: err.exitCode, err: Just err } - Right success -> { output: success.stdout, exitCode: Just success.exitCode, err: Nothing } - arrErrorsIsEmpty <- forWithIndex (Str.split (Str.Pattern "\n") result'.output) \idx err -> + let resultStdout = Cmd.getStdout result + arrErrorsIsEmpty <- forWithIndex (Str.split (Str.Pattern "\n") resultStdout) \idx err -> case jsonParser err >>= CA.decode psaResultCodec >>> lmap CA.printJsonDecodeError of Left decodeErrMsg -> do logWarn $ Array.intercalate "\n" @@ -63,7 +61,9 @@ psaCompile globs pursArgs psaArgs = do if Array.all identity arrErrorsIsEmpty then do logSuccess "Build succeeded." else do - for_ result'.err $ logDebug <<< show + case result of + Left r -> logDebug $ Cmd.printExecResult r + _ -> pure unit die [ "Failed to build." ] where diff --git a/src/Spago/Purs.purs b/src/Spago/Purs.purs index d21c62185..c6efb4ae0 100644 --- a/src/Spago/Purs.purs +++ b/src/Spago/Purs.purs @@ -8,6 +8,7 @@ import Data.Codec.Argonaut.Record as CAR import Data.Profunctor as Profunctor import Data.Set as Set import Data.String as String +import Node.Library.Execa (ExecaResult) import Registry.Internal.Codec as Internal.Codec import Registry.Version as Version import Spago.Cmd as Cmd @@ -40,7 +41,7 @@ parseVersionOutput { cmd, output: stdout } = case parseLenientVersion (dropStuff where dropStuff pattern = fromMaybe "" <<< Array.head <<< String.split (String.Pattern pattern) -compile :: forall a. Set FilePath -> Array String -> Spago (PursEnv a) (Either Cmd.ExecError Cmd.ExecResult) +compile :: forall a. Set FilePath -> Array String -> Spago (PursEnv a) (Either ExecaResult ExecaResult) compile globs pursArgs = do { purs } <- ask let args = [ "compile" ] <> pursArgs <> Set.toUnfoldable globs @@ -53,7 +54,7 @@ compile globs pursArgs = do Cmd.exec purs.cmd args $ Cmd.defaultExecOptions { pipeStdout = false } -repl :: forall a. Set FilePath -> Array String -> Spago (PursEnv a) (Either Cmd.ExecError Cmd.ExecResult) +repl :: forall a. Set FilePath -> Array String -> Spago (PursEnv a) (Either ExecaResult ExecaResult) repl globs pursArgs = do { purs } <- ask let args = [ "repl" ] <> pursArgs <> Set.toUnfoldable globs @@ -86,7 +87,7 @@ printDocsFormat = case _ of Ctags -> "ctags" Etags -> "etags" -docs :: forall a. Set FilePath -> DocsFormat -> Spago (PursEnv a) (Either Cmd.ExecError Cmd.ExecResult) +docs :: forall a. Set FilePath -> DocsFormat -> Spago (PursEnv a) (Either ExecaResult ExecaResult) docs globs format = do { purs } <- ask let args = [ "docs", "--format", printDocsFormat format ] <> Set.toUnfoldable globs @@ -126,9 +127,9 @@ graph globs pursArgs = do logDebug [ "Running command:", "purs " <> String.joinWith " " args ] let execOpts = Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false } Cmd.exec purs.cmd args execOpts >>= case _ of - Right { stdout } -> do + Right r -> do logDebug "Called `purs graph`, decoding.." - pure $ parseJson moduleGraphCodec stdout - Left err -> do - logDebug $ show err - die [ "Failed to call `purs graph`, error: " <> err.shortMessage ] + pure $ parseJson moduleGraphCodec r.stdout + Left r -> do + logDebug $ Cmd.printExecResult r + die [ "Failed to call `purs graph`, error: " <> r.shortMessage ] diff --git a/test-fixtures/graph-modules.json b/test-fixtures/graph-modules.json index 771326b17..a7e487dfa 100644 --- a/test-fixtures/graph-modules.json +++ b/test-fixtures/graph-modules.json @@ -7,7 +7,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Control/Applicative.purs" + "path": ".spago/p/prelude-6.0.1/src/Control/Applicative.purs" }, "Control.Apply": { "depends": [ @@ -17,7 +17,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Control/Apply.purs" + "path": ".spago/p/prelude-6.0.1/src/Control/Apply.purs" }, "Control.Bind": { "depends": [ @@ -30,14 +30,14 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Control/Bind.purs" + "path": ".spago/p/prelude-6.0.1/src/Control/Bind.purs" }, "Control.Category": { "depends": [ "Control.Semigroupoid" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Control/Category.purs" + "path": ".spago/p/prelude-6.0.1/src/Control/Category.purs" }, "Control.Monad": { "depends": [ @@ -49,17 +49,17 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Control/Monad.purs" + "path": ".spago/p/prelude-6.0.1/src/Control/Monad.purs" }, "Control.Semigroupoid": { "depends": [], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Control/Semigroupoid.purs" + "path": ".spago/p/prelude-6.0.1/src/Control/Semigroupoid.purs" }, "Data.Boolean": { "depends": [], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Boolean.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Boolean.purs" }, "Data.BooleanAlgebra": { "depends": [ @@ -69,7 +69,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/BooleanAlgebra.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/BooleanAlgebra.purs" }, "Data.Bounded": { "depends": [ @@ -80,7 +80,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Bounded.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Bounded.purs" }, "Data.Bounded.Generic": { "depends": [ @@ -88,7 +88,7 @@ "Data.Bounded" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Bounded/Generic.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Bounded/Generic.purs" }, "Data.CommutativeRing": { "depends": [ @@ -99,7 +99,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/CommutativeRing.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/CommutativeRing.purs" }, "Data.DivisionRing": { "depends": [ @@ -108,7 +108,7 @@ "Data.Semiring" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/DivisionRing.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/DivisionRing.purs" }, "Data.Eq": { "depends": [ @@ -120,7 +120,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Eq.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Eq.purs" }, "Data.Eq.Generic": { "depends": [ @@ -128,7 +128,7 @@ "Data.Generic.Rep" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Eq/Generic.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Eq/Generic.purs" }, "Data.EuclideanRing": { "depends": [ @@ -139,7 +139,7 @@ "Data.Semiring" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/EuclideanRing.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/EuclideanRing.purs" }, "Data.Field": { "depends": [ @@ -150,7 +150,7 @@ "Data.Semiring" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Field.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Field.purs" }, "Data.Function": { "depends": [ @@ -160,7 +160,7 @@ "Data.Ring" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Function.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Function.purs" }, "Data.Functor": { "depends": [ @@ -169,7 +169,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Functor.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Functor.purs" }, "Data.Generic.Rep": { "depends": [ @@ -180,7 +180,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Generic/Rep.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Generic/Rep.purs" }, "Data.HeytingAlgebra": { "depends": [ @@ -190,7 +190,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/HeytingAlgebra.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/HeytingAlgebra.purs" }, "Data.HeytingAlgebra.Generic": { "depends": [ @@ -199,7 +199,7 @@ "Data.HeytingAlgebra" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/HeytingAlgebra/Generic.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/HeytingAlgebra/Generic.purs" }, "Data.Monoid": { "depends": [ @@ -215,7 +215,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Monoid.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Monoid.purs" }, "Data.Monoid.Additive": { "depends": [ @@ -224,7 +224,7 @@ "Data.Ord" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Monoid/Additive.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Monoid/Additive.purs" }, "Data.Monoid.Conj": { "depends": [ @@ -234,7 +234,7 @@ "Data.Ord" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Monoid/Conj.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Monoid/Conj.purs" }, "Data.Monoid.Disj": { "depends": [ @@ -244,7 +244,7 @@ "Data.Ord" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Monoid/Disj.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Monoid/Disj.purs" }, "Data.Monoid.Dual": { "depends": [ @@ -253,14 +253,14 @@ "Data.Ord" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Monoid/Dual.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Monoid/Dual.purs" }, "Data.Monoid.Endo": { "depends": [ "Prelude" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Monoid/Endo.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Monoid/Endo.purs" }, "Data.Monoid.Generic": { "depends": [ @@ -268,7 +268,7 @@ "Data.Generic.Rep" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Monoid/Generic.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Monoid/Generic.purs" }, "Data.Monoid.Multiplicative": { "depends": [ @@ -277,12 +277,12 @@ "Data.Ord" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Monoid/Multiplicative.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Monoid/Multiplicative.purs" }, "Data.NaturalTransformation": { "depends": [], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/NaturalTransformation.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/NaturalTransformation.purs" }, "Data.Ord": { "depends": [ @@ -296,7 +296,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Ord.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Ord.purs" }, "Data.Ord.Generic": { "depends": [ @@ -304,7 +304,7 @@ "Data.Generic.Rep" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Ord/Generic.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Ord/Generic.purs" }, "Data.Ordering": { "depends": [ @@ -313,7 +313,7 @@ "Data.Show" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Ordering.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Ordering.purs" }, "Data.Reflectable": { "depends": [ @@ -321,7 +321,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Reflectable.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Reflectable.purs" }, "Data.Ring": { "depends": [ @@ -332,7 +332,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Ring.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Ring.purs" }, "Data.Ring.Generic": { "depends": [ @@ -340,7 +340,7 @@ "Data.Generic.Rep" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Ring/Generic.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Ring/Generic.purs" }, "Data.Semigroup": { "depends": [ @@ -351,7 +351,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Semigroup.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Semigroup.purs" }, "Data.Semigroup.First": { "depends": [ @@ -360,7 +360,7 @@ "Data.Ord" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Semigroup/First.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Semigroup/First.purs" }, "Data.Semigroup.Generic": { "depends": [ @@ -368,7 +368,7 @@ "Data.Generic.Rep" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Semigroup/Generic.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Semigroup/Generic.purs" }, "Data.Semigroup.Last": { "depends": [ @@ -377,7 +377,7 @@ "Data.Ord" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Semigroup/Last.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Semigroup/Last.purs" }, "Data.Semiring": { "depends": [ @@ -387,7 +387,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Semiring.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Semiring.purs" }, "Data.Semiring.Generic": { "depends": [ @@ -395,7 +395,7 @@ "Data.Generic.Rep" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Semiring/Generic.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Semiring/Generic.purs" }, "Data.Show": { "depends": [ @@ -407,7 +407,7 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Show.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Show.purs" }, "Data.Show.Generic": { "depends": [ @@ -417,24 +417,24 @@ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Show/Generic.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Show/Generic.purs" }, "Data.Symbol": { "depends": [ "Type.Proxy" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Symbol.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Symbol.purs" }, "Data.Unit": { "depends": [], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Unit.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Unit.purs" }, "Data.Void": { "depends": [], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Data/Void.purs" + "path": ".spago/p/prelude-6.0.1/src/Data/Void.purs" }, "Effect": { "depends": [ @@ -442,7 +442,7 @@ "Control.Apply" ], "package": "effect", - "path": ".spago/packages/effect-4.0.0/src/Effect.purs" + "path": ".spago/p/effect-4.0.0/src/Effect.purs" }, "Effect.Class": { "depends": [ @@ -451,7 +451,7 @@ "Effect" ], "package": "effect", - "path": ".spago/packages/effect-4.0.0/src/Effect/Class.purs" + "path": ".spago/p/effect-4.0.0/src/Effect/Class.purs" }, "Effect.Class.Console": { "depends": [ @@ -462,7 +462,7 @@ "Effect.Console" ], "package": "console", - "path": ".spago/packages/console-6.0.0/src/Effect/Class/Console.purs" + "path": ".spago/p/console-6.0.0/src/Effect/Class/Console.purs" }, "Effect.Console": { "depends": [ @@ -471,7 +471,7 @@ "Data.Unit" ], "package": "console", - "path": ".spago/packages/console-6.0.0/src/Effect/Console.purs" + "path": ".spago/p/console-6.0.0/src/Effect/Console.purs" }, "Effect.Uncurried": { "depends": [ @@ -479,14 +479,14 @@ "Effect" ], "package": "effect", - "path": ".spago/packages/effect-4.0.0/src/Effect/Uncurried.purs" + "path": ".spago/p/effect-4.0.0/src/Effect/Uncurried.purs" }, "Effect.Unsafe": { "depends": [ "Effect" ], "package": "effect", - "path": ".spago/packages/effect-4.0.0/src/Effect/Unsafe.purs" + "path": ".spago/p/effect-4.0.0/src/Effect/Unsafe.purs" }, "Main": { "depends": [ @@ -528,16 +528,16 @@ "Data.Void" ], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Prelude.purs" + "path": ".spago/p/prelude-6.0.1/src/Prelude.purs" }, "Record.Unsafe": { "depends": [], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Record/Unsafe.purs" + "path": ".spago/p/prelude-6.0.1/src/Record/Unsafe.purs" }, "Type.Proxy": { "depends": [], "package": "prelude", - "path": ".spago/packages/prelude-6.0.1/src/Type/Proxy.purs" + "path": ".spago/p/prelude-6.0.1/src/Type/Proxy.purs" } } diff --git a/test-fixtures/sources-output.txt b/test-fixtures/sources-output.txt index 89d1e6873..200dc4fe8 100644 --- a/test-fixtures/sources-output.txt +++ b/test-fixtures/sources-output.txt @@ -1,5 +1,5 @@ src/**/*.purs test/**/*.purs -.spago/packages/console-6.1.0/src/**/*.purs -.spago/packages/effect-4.0.0/src/**/*.purs -.spago/packages/prelude-6.0.1/src/**/*.purs +.spago/p/console-6.1.0/src/**/*.purs +.spago/p/effect-4.0.0/src/**/*.purs +.spago/p/prelude-6.0.1/src/**/*.purs diff --git a/test-fixtures/sources-output.win.txt b/test-fixtures/sources-output.win.txt index f6b63d150..1858391f8 100644 --- a/test-fixtures/sources-output.win.txt +++ b/test-fixtures/sources-output.win.txt @@ -1,5 +1,5 @@ src\**\*.purs test\**\*.purs -.spago\packages\console-6.1.0\src\**\*.purs -.spago\packages\effect-4.0.0\src\**\*.purs -.spago\packages\prelude-6.0.1\src\**\*.purs +.spago\p\console-6.1.0\src\**\*.purs +.spago\p\effect-4.0.0\src\**\*.purs +.spago\p\prelude-6.0.1\src\**\*.purs diff --git a/test-fixtures/sources-subproject-output.txt b/test-fixtures/sources-subproject-output.txt index c5e382f04..2d0d8859d 100644 --- a/test-fixtures/sources-subproject-output.txt +++ b/test-fixtures/sources-subproject-output.txt @@ -1,5 +1,5 @@ -.spago/packages/console-6.1.0/src/**/*.purs -.spago/packages/effect-4.0.0/src/**/*.purs -.spago/packages/prelude-6.0.1/src/**/*.purs +.spago/p/console-6.1.0/src/**/*.purs +.spago/p/effect-4.0.0/src/**/*.purs +.spago/p/prelude-6.0.1/src/**/*.purs subpackage/src/**/*.purs subpackage/test/**/*.purs diff --git a/test-fixtures/sources-subproject-output.win.txt b/test-fixtures/sources-subproject-output.win.txt index 50fe243fe..60fa168cb 100644 --- a/test-fixtures/sources-subproject-output.win.txt +++ b/test-fixtures/sources-subproject-output.win.txt @@ -1,5 +1,5 @@ -.spago\packages\console-6.1.0\src\**\*.purs -.spago\packages\effect-4.0.0\src\**\*.purs -.spago\packages\prelude-6.0.1\src\**\*.purs +.spago\p\console-6.1.0\src\**\*.purs +.spago\p\effect-4.0.0\src\**\*.purs +.spago\p\prelude-6.0.1\src\**\*.purs subpackage\src\**\*.purs subpackage\test\**\*.purs diff --git a/test/Prelude.purs b/test/Prelude.purs index 65c5b5efc..ff7e8eda7 100644 --- a/test/Prelude.purs +++ b/test/Prelude.purs @@ -12,13 +12,14 @@ import Data.String as String import Effect.Aff as Aff import Effect.Class.Console (log) import Effect.Class.Console as Console +import Node.Library.Execa (ExecaResult) import Node.Path (dirname) import Node.Path as Path import Node.Process as Process import Registry.PackageName as PackageName import Registry.Version as Version -import Spago.Cmd (ExecError, ExecResult) as X -import Spago.Cmd (ExecError, ExecResult, StdinConfig(..)) +import Spago.Cmd (ExecResult, StdinConfig(..)) +import Spago.Cmd (ExecResult, StdinConfig(..)) as X import Spago.Cmd as Cmd import Spago.Command.Init as Init import Spago.Core.Config (Dependencies(..), Config) @@ -29,8 +30,8 @@ import Test.Spec.Assertions (fail) import Test.Spec.Assertions as Assert type TestDirs = - { spago :: Array String -> Aff (Either ExecError ExecResult) - , spago' :: StdinConfig -> Array String -> Aff (Either ExecError ExecResult) + { spago :: Array String -> Aff (Either ExecResult ExecResult) + , spago' :: StdinConfig -> Array String -> Aff (Either ExecResult ExecResult) , fixture :: FilePath -> FilePath , oldCwd :: FilePath , testCwd :: FilePath @@ -52,7 +53,7 @@ withTempDir = Aff.bracket createTempDir cleanupTempDir fixture path = Path.concat [ fixturesPath, path ] - spago' :: StdinConfig -> Array String -> Aff (Either ExecError ExecResult) + spago' :: StdinConfig -> Array String -> Aff (Either ExecResult ExecResult) spago' stdin args = Cmd.exec "node" @@ -120,18 +121,14 @@ plusDependencies deps config = config check :: { stdout :: String -> Aff Unit , stderr :: String -> Aff Unit - , result :: Either ExecError ExecResult -> Boolean + , result :: Either ExecResult ExecResult -> Boolean } - -> Either ExecError ExecResult + -> Either ExecResult ExecResult -> Aff Unit check checkers execResult = do let - stdout = String.trim $ case execResult of - Left err -> err.stdout - Right res -> res.stdout - stderr = String.trim $ case execResult of - Left err -> err.stderr - Right res -> res.stderr + stdout = String.trim $ Cmd.getStdout execResult + stderr = String.trim $ Cmd.getStderr execResult printStdoutStderr <- liftEffect $ map isJust $ Process.lookupEnv "SPAGO_TEST_DEBUG" @@ -149,9 +146,9 @@ check checkers execResult = do checkOutputsStr :: { stdoutStr :: Maybe String , stderrStr :: Maybe String - , result :: Either ExecError ExecResult -> Boolean + , result :: Either ExecResult ExecResult -> Boolean } - -> Either ExecError ExecResult + -> Either ExecResult ExecResult -> Aff Unit checkOutputsStr checkers = check @@ -163,9 +160,9 @@ checkOutputsStr checkers = checkOutputs :: { stdoutFile :: Maybe FilePath , stderrFile :: Maybe FilePath - , result :: Either ExecError ExecResult -> Boolean + , result :: (Either ExecResult ExecResult) -> Boolean } - -> Either ExecError ExecResult + -> Either ExecResult ExecResult -> Aff Unit checkOutputs checkers execResult = do let @@ -188,28 +185,28 @@ checkOutputs checkers execResult = do } execResult -shouldBeSuccess :: Either ExecError ExecResult -> Aff Unit +shouldBeSuccess :: Either ExecaResult ExecaResult -> Aff Unit shouldBeSuccess = checkOutputs { stdoutFile: Nothing, stderrFile: Nothing, result: isRight } -shouldBeSuccessOutput :: FilePath -> Either ExecError ExecResult -> Aff Unit +shouldBeSuccessOutput :: FilePath -> Either ExecaResult ExecaResult -> Aff Unit shouldBeSuccessOutput outFixture = checkOutputs { stdoutFile: Just outFixture, stderrFile: Nothing, result: isRight } -shouldBeSuccessErr :: FilePath -> Either ExecError ExecResult -> Aff Unit +shouldBeSuccessErr :: FilePath -> Either ExecaResult ExecaResult -> Aff Unit shouldBeSuccessErr errFixture = checkOutputs { stdoutFile: Nothing, stderrFile: Just errFixture, result: isRight } -shouldBeSuccessOutputWithErr :: FilePath -> FilePath -> Either ExecError ExecResult -> Aff Unit +shouldBeSuccessOutputWithErr :: FilePath -> FilePath -> Either ExecaResult ExecaResult -> Aff Unit shouldBeSuccessOutputWithErr outFixture errFixture = checkOutputs { stdoutFile: Just outFixture, stderrFile: Just errFixture, result: isRight } -shouldBeFailure :: Either ExecError ExecResult -> Aff Unit +shouldBeFailure :: Either ExecaResult ExecaResult -> Aff Unit shouldBeFailure = checkOutputs { stdoutFile: Nothing, stderrFile: Nothing, result: isLeft } -shouldBeFailureOutput :: FilePath -> Either ExecError ExecResult -> Aff Unit +shouldBeFailureOutput :: FilePath -> Either ExecaResult ExecaResult -> Aff Unit shouldBeFailureOutput outFixture = checkOutputs { stdoutFile: Just outFixture, stderrFile: Nothing, result: isLeft } -shouldBeFailureErr :: FilePath -> Either ExecError ExecResult -> Aff Unit +shouldBeFailureErr :: FilePath -> Either ExecaResult ExecaResult -> Aff Unit shouldBeFailureErr errFixture = checkOutputs { stdoutFile: Nothing, stderrFile: Just errFixture, result: isLeft } -shouldBeFailureOutputWithErr :: FilePath -> FilePath -> Either ExecError ExecResult -> Aff Unit +shouldBeFailureOutputWithErr :: FilePath -> FilePath -> Either ExecaResult ExecaResult -> Aff Unit shouldBeFailureOutputWithErr outFixture errFixture = checkOutputs { stdoutFile: Just outFixture, stderrFile: Just errFixture, result: isLeft } mkPackageName :: String -> PackageName diff --git a/test/Spago.purs b/test/Spago.purs index 0fe4f4ea3..262b43b4c 100644 --- a/test/Spago.purs +++ b/test/Spago.purs @@ -29,10 +29,10 @@ import Test.Spec.Reporter as Spec.Reporter import Test.Spec.Runner as Spec.Runner testConfig :: Spec.Runner.Config -testConfig = - { slow: Milliseconds 10_000.0 - , timeout: Just (Milliseconds 90_000.0) - , exit: true +testConfig = Spec.Runner.defaultConfig + { slow = Milliseconds 10_000.0 + , timeout = Just (Milliseconds 90_000.0) + , exit = true } main :: Effect Unit diff --git a/test/Spago/Build/BuildInfo.purs b/test/Spago/Build/BuildInfo.purs index 06cb39428..4fa0eb863 100644 --- a/test/Spago/Build/BuildInfo.purs +++ b/test/Spago/Build/BuildInfo.purs @@ -27,8 +27,8 @@ spec = purs <- runSpago logOptions getPurs spagoResult <- spago [ "--version" ] sVersion <- case spagoResult of - Left e -> MonadError.throwError $ Exception.error e.message - Right a -> pure a.stdout + Left r -> MonadError.throwError $ Exception.error r.message + Right r -> pure r.stdout pure $ Array.intercalate "\n" $ diff --git a/test/Spago/Build/Pedantic.purs b/test/Spago/Build/Pedantic.purs index ed23fff87..25e716982 100644 --- a/test/Spago/Build/Pedantic.purs +++ b/test/Spago/Build/Pedantic.purs @@ -255,7 +255,7 @@ defaultSetupConfig = , testMain: Nothing } -setup :: (Array String -> Aff (Either ExecError ExecResult)) -> SetupConfig -> Aff Unit +setup :: (Array String -> Aff (Either ExecResult ExecResult)) -> SetupConfig -> Aff Unit setup spago config = do spago [ "init", "--name", "pedantic" ] >>= shouldBeSuccess unless (Array.null config.installSourcePackages) do diff --git a/test/Spago/Install.purs b/test/Spago/Install.purs index f902c9807..033ea73c7 100644 --- a/test/Spago/Install.purs +++ b/test/Spago/Install.purs @@ -12,6 +12,7 @@ import Spago.Command.Init as Init import Spago.Core.Config as Config import Spago.FS as FS import Spago.Log (LogVerbosity(..)) +import Spago.Paths as Paths import Spago.Purs as Purs import Test.Spec (Spec) import Test.Spec as Spec @@ -132,7 +133,7 @@ spec = Spec.around withTempDir do } ) spago [ "install", "nonexistent-package" ] >>= shouldBeSuccess - let slashyPath = Path.concat [ testCwd, ".spago", "packages", "nonexistent-package", "spago-test%2fbranch-with-slash" ] + let slashyPath = Path.concat [ Paths.toLocalCachePackagesPath testCwd, "nonexistent-package", "spago-test%2fbranch-with-slash" ] unlessM (FS.exists slashyPath) do Assertions.fail $ "Expected path to exist: " <> slashyPath kids <- FSA.readdir slashyPath diff --git a/test/Spago/Publish.purs b/test/Spago/Publish.purs index 5fdd88286..b880cd9af 100644 --- a/test/Spago/Publish.purs +++ b/test/Spago/Publish.purs @@ -5,7 +5,6 @@ import Test.Prelude import Node.FS.Aff as FSA import Node.Platform as Platform import Node.Process as Process -import Spago.Cmd (StdinConfig(..)) import Spago.Cmd as Cmd import Spago.FS as FS import Test.Spec (Spec) @@ -64,6 +63,6 @@ doTheGitThing = do git [ "commit", "-m", "first" ] >>= shouldBeSuccess git [ "tag", "v0.0.1" ] >>= shouldBeSuccess where - git :: Array String -> Aff (Either ExecError ExecResult) + git :: Array String -> Aff (Either ExecResult ExecResult) git args = Cmd.exec "git" args $ Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false, pipeStdin = StdinNewPipe } diff --git a/test/Spago/Registry.purs b/test/Spago/Registry.purs index 019750892..1ade397f7 100644 --- a/test/Spago/Registry.purs +++ b/test/Spago/Registry.purs @@ -15,23 +15,23 @@ spec = Spec.around withTempDir do Spec.it "list package sets" \{ spago, fixture } -> do result <- spago [ "registry", "package-sets" ] let - result' = result # map \success@{ stdout } -> success - { stdout = stdout + updateStdout r = r + { stdout = r.stdout -- Take the oldest lines of output - the list of package sets will grow all the time # String.split (Pattern "\n") # Array.take 200 # String.joinWith "\n" } - shouldBeSuccessOutput (fixture "registry-list-package-sets.txt") result' + shouldBeSuccessOutput (fixture "registry-list-package-sets.txt") $ bimap updateStdout updateStdout result Spec.it "list only latest package sets for compiler" \{ spago, fixture } -> do result <- spago [ "registry", "package-sets", "--latest" ] let - result' = result # map \success@{ stdout } -> success - { stdout = stdout + updateStdout r = r + { stdout = r.stdout -- Take the oldest lines of output - the list of package sets will grow all the time # String.split (Pattern "\n") # Array.take 7 # String.joinWith "\n" } - shouldBeSuccessOutput (fixture "registry-list-package-sets-latest.txt") result' + shouldBeSuccessOutput (fixture "registry-list-package-sets-latest.txt") $ bimap updateStdout updateStdout result diff --git a/test/Spago/Run.purs b/test/Spago/Run.purs index e991929a0..6c86a4381 100644 --- a/test/Spago/Run.purs +++ b/test/Spago/Run.purs @@ -2,7 +2,6 @@ module Test.Spago.Run where import Test.Prelude -import Spago.Cmd (StdinConfig(..)) import Spago.FS as FS import Test.Spec (Spec) import Test.Spec as Spec