From b878bcf169473e86d34e7228daeba1bd93eabdf1 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 6 Jul 2024 22:10:49 -0700 Subject: [PATCH] search parent dirs for workspace https://github.com/purescript/spago/issues/1237 --- spago.lock | 1785 +++++++++++++++++++---------------------- src/Spago/Config.purs | 52 +- src/Spago/Paths.purs | 13 + test/Spago/Paths.purs | 21 + 4 files changed, 905 insertions(+), 966 deletions(-) create mode 100644 test/Spago/Paths.purs diff --git a/spago.lock b/spago.lock index 1d0f00734..ea0b151e9 100644 --- a/spago.lock +++ b/spago.lock @@ -2,977 +2,840 @@ workspace: packages: docs-search-client-halogen: path: docs-search/client-halogen - core: - dependencies: - - aff - - aff-promise - - arrays - - codec-json - - control - - css - - docs-search-common - - effect - - either - - foldable-traversable - - halogen - - halogen-css - - halogen-subscriptions - - js-uri - - json - - language-purescript - - lists - - markdown-it - - markdown-it-halogen - - maybe - - newtype - - ordered-collections - - prelude - - profunctor-lenses - - search-trie - - strings - - tuples - - web-dom - - web-events - - web-html - - web-storage - - web-uievents - build_plan: - - aff - - aff-promise - - argonaut-core - - arrays - - avar - - bifunctors - - catenable-lists - - codec - - codec-json - - colors - - console - - const - - contravariant - - control - - css - - datetime - - distributive - - docs-search-common - - dom-indexed - - effect - - either - - enums - - exceptions - - exists - - fixed-points - - foldable-traversable - - foreign - - foreign-object - - fork - - formatters - - free - - freeap - - functions - - functors - - gen - - halogen - - halogen-css - - halogen-subscriptions - - halogen-vdom - - html-parser-halogen - - identity - - integers - - invariant - - js-date - - js-promise - - js-uri - - json - - json-codecs - - language-purescript - - lazy - - lcg - - lists - - markdown-it - - markdown-it-halogen - - maybe - - media-types - - newtype - - nonempty - - now - - nullable - - numbers - - options - - ordered-collections - - orders - - parallel - - parsing - - partial - - prelude - - profunctor - - profunctor-lenses - - quickcheck - - quickcheck-laws - - random - - record - - refs - - safe-coerce - - search-trie - - st - - string-parsers - - strings - - tailrec - - these - - transformers - - tuples - - type-equality - - typelevel-prelude - - unfoldable - - unicode - - unsafe-coerce - - unsafe-reference - - variant - - versions - - web-clipboard - - web-dom - - web-events - - web-file - - web-html - - web-pointerevents - - web-storage - - web-touchevents - - web-uievents - test: - dependencies: [] - build_plan: [] + dependencies: + - aff + - aff-promise + - arrays + - codec-json + - control + - css + - docs-search-common + - effect + - either + - foldable-traversable + - halogen + - halogen-css + - halogen-subscriptions + - js-uri + - json + - language-purescript + - lists + - markdown-it + - markdown-it-halogen + - maybe + - newtype + - ordered-collections + - prelude + - profunctor-lenses + - search-trie + - strings + - tuples + - web-dom + - web-events + - web-html + - web-storage + - web-uievents + test_dependencies: [] + build_plan: + - aff + - aff-promise + - argonaut-core + - arrays + - avar + - bifunctors + - catenable-lists + - codec + - codec-json + - colors + - console + - const + - contravariant + - control + - css + - datetime + - distributive + - docs-search-common + - dom-indexed + - effect + - either + - enums + - exceptions + - exists + - fixed-points + - foldable-traversable + - foreign + - foreign-object + - fork + - formatters + - free + - freeap + - functions + - functors + - gen + - halogen + - halogen-css + - halogen-subscriptions + - halogen-vdom + - html-parser-halogen + - identity + - integers + - invariant + - js-date + - js-promise + - js-uri + - json + - json-codecs + - language-purescript + - lazy + - lcg + - lists + - markdown-it + - markdown-it-halogen + - maybe + - media-types + - newtype + - nonempty + - now + - nullable + - numbers + - options + - ordered-collections + - orders + - parallel + - parsing + - partial + - prelude + - profunctor + - profunctor-lenses + - quickcheck + - quickcheck-laws + - random + - record + - refs + - safe-coerce + - search-trie + - st + - string-parsers + - strings + - tailrec + - these + - transformers + - tuples + - type-equality + - typelevel-prelude + - unfoldable + - unicode + - unsafe-coerce + - unsafe-reference + - variant + - versions + - web-clipboard + - web-dom + - web-events + - web-file + - web-html + - web-pointerevents + - web-storage + - web-touchevents + - web-uievents docs-search-common: path: docs-search/common - core: - dependencies: - - aff - - aff-promise - - argonaut-core - - arrays - - bifunctors - - codec - - codec-json - - control - - effect - - either - - exceptions - - foldable-traversable - - json - - json-codecs - - language-purescript - - lists - - maybe - - newtype - - ordered-collections - - prelude - - profunctor - - profunctor-lenses - - safe-coerce - - search-trie - - string-parsers - - strings - - transformers - - tuples - - unsafe-coerce - - variant - build_plan: - - aff - - aff-promise - - argonaut-core - - arrays - - bifunctors - - codec - - codec-json - - console - - const - - contravariant - - control - - datetime - - distributive - - effect - - either - - enums - - exceptions - - exists - - fixed-points - - foldable-traversable - - foreign - - foreign-object - - formatters - - functions - - functors - - gen - - identity - - integers - - invariant - - json - - json-codecs - - language-purescript - - lazy - - lcg - - lists - - maybe - - newtype - - nonempty - - nullable - - numbers - - ordered-collections - - orders - - parallel - - parsing - - partial - - prelude - - profunctor - - profunctor-lenses - - quickcheck - - quickcheck-laws - - random - - record - - refs - - safe-coerce - - search-trie - - st - - string-parsers - - strings - - tailrec - - these - - transformers - - tuples - - type-equality - - typelevel-prelude - - unfoldable - - unicode - - unsafe-coerce - - variant - - versions - test: - dependencies: [] - build_plan: [] + dependencies: + - aff + - aff-promise + - argonaut-core + - arrays + - bifunctors + - codec + - codec-json + - control + - effect + - either + - exceptions + - foldable-traversable + - json + - json-codecs + - language-purescript + - lists + - maybe + - newtype + - ordered-collections + - prelude + - profunctor + - profunctor-lenses + - safe-coerce + - search-trie + - string-parsers + - strings + - transformers + - tuples + - unsafe-coerce + - variant + test_dependencies: [] + build_plan: + - aff + - aff-promise + - argonaut-core + - arrays + - bifunctors + - codec + - codec-json + - console + - const + - contravariant + - control + - datetime + - distributive + - effect + - either + - enums + - exceptions + - exists + - fixed-points + - foldable-traversable + - foreign + - foreign-object + - formatters + - functions + - functors + - gen + - identity + - integers + - invariant + - json + - json-codecs + - language-purescript + - lazy + - lcg + - lists + - maybe + - newtype + - nonempty + - nullable + - numbers + - ordered-collections + - orders + - parallel + - parsing + - partial + - prelude + - profunctor + - profunctor-lenses + - quickcheck + - quickcheck-laws + - random + - record + - refs + - safe-coerce + - search-trie + - st + - string-parsers + - strings + - tailrec + - these + - transformers + - tuples + - type-equality + - typelevel-prelude + - unfoldable + - unicode + - unsafe-coerce + - variant + - versions docs-search-index: path: docs-search/index - core: - dependencies: - - aff - - argonaut-core - - arrays - - codec-json - - console - - docs-search-common - - effect - - either - - foldable-traversable - - identity - - json - - json-codecs - - language-purescript - - lists - - maybe - - newtype - - node-buffer - - node-fs - - node-path - - node-process - - ordered-collections - - prelude - - profunctor - - search-trie - - string-parsers - - strings - - tuples - - unsafe-coerce - build_plan: - - aff - - aff-promise - - argonaut-core - - arraybuffer-types - - arrays - - bifunctors - - codec - - codec-json - - console - - const - - contravariant - - control - - datetime - - distributive - - docs-search-common - - effect - - either - - enums - - exceptions - - exists - - fixed-points - - foldable-traversable - - foreign - - foreign-object - - formatters - - functions - - functors - - gen - - identity - - integers - - invariant - - js-date - - json - - json-codecs - - language-purescript - - lazy - - lcg - - lists - - maybe - - newtype - - node-buffer - - node-event-emitter - - node-fs - - node-path - - node-process - - node-streams - - nonempty - - now - - nullable - - numbers - - ordered-collections - - orders - - parallel - - parsing - - partial - - posix-types - - prelude - - profunctor - - profunctor-lenses - - quickcheck - - quickcheck-laws - - random - - record - - refs - - safe-coerce - - search-trie - - st - - string-parsers - - strings - - tailrec - - these - - transformers - - tuples - - type-equality - - typelevel-prelude - - unfoldable - - unicode - - unsafe-coerce - - variant - - versions - test: - dependencies: - - exceptions - - spec - - spec-node - build_plan: - - aff - - ansi - - argonaut-codecs - - argonaut-core - - arraybuffer-types - - arrays - - avar - - bifunctors - - catenable-lists - - console - - const - - contravariant - - control - - datetime - - distributive - - effect - - either - - enums - - exceptions - - exists - - exitcodes - - foldable-traversable - - foreign - - foreign-object - - fork - - free - - functions - - functors - - gen - - identity - - integers - - invariant - - js-date - - lazy - - lists - - maybe - - mmorph - - newtype - - node-buffer - - node-event-emitter - - node-fs - - node-path - - node-process - - node-streams - - nonempty - - now - - nullable - - numbers - - open-memoize - - optparse - - ordered-collections - - orders - - parallel - - partial - - pipes - - posix-types - - prelude - - profunctor - - psci-support - - record - - refs - - safe-coerce - - spec - - spec-node - - st - - strings - - tailrec - - transformers - - tuples - - type-equality - - typelevel-prelude - - unfoldable - - unsafe-coerce + dependencies: + - aff + - argonaut-core + - arrays + - codec-json + - console + - docs-search-common + - effect + - either + - foldable-traversable + - identity + - json + - json-codecs + - language-purescript + - lists + - maybe + - newtype + - node-buffer + - node-fs + - node-path + - node-process + - ordered-collections + - prelude + - profunctor + - search-trie + - string-parsers + - strings + - tuples + - unsafe-coerce + test_dependencies: + - exceptions + - spec + - spec-node + build_plan: + - aff + - aff-promise + - ansi + - argonaut-codecs + - argonaut-core + - arraybuffer-types + - arrays + - avar + - bifunctors + - catenable-lists + - codec + - codec-json + - console + - const + - contravariant + - control + - datetime + - distributive + - docs-search-common + - effect + - either + - enums + - exceptions + - exists + - exitcodes + - fixed-points + - foldable-traversable + - foreign + - foreign-object + - fork + - formatters + - free + - functions + - functors + - gen + - identity + - integers + - invariant + - js-date + - json + - json-codecs + - language-purescript + - lazy + - lcg + - lists + - maybe + - mmorph + - newtype + - node-buffer + - node-event-emitter + - node-fs + - node-path + - node-process + - node-streams + - nonempty + - now + - nullable + - numbers + - open-memoize + - optparse + - ordered-collections + - orders + - parallel + - parsing + - partial + - pipes + - posix-types + - prelude + - profunctor + - profunctor-lenses + - psci-support + - quickcheck + - quickcheck-laws + - random + - record + - refs + - safe-coerce + - search-trie + - spec + - spec-node + - st + - string-parsers + - strings + - tailrec + - these + - transformers + - tuples + - type-equality + - typelevel-prelude + - unfoldable + - unicode + - unsafe-coerce + - variant + - versions spago: path: ./ - core: - dependencies: - - aff - - aff-promise - - affjax - - affjax-node - - ansi - - argonaut-core - - arrays - - avar - - codec - - codec-json - - console - - control - - datetime - - docs-search-common - - docs-search-index - - dodo-printer - - effect - - either - - enums - - filterable - - foldable-traversable - - foreign-object - - formatters - - functions - - graphs - - http-methods - - integers - - json - - lists - - maybe - - newtype - - node-buffer - - node-child-process - - node-execa - - node-fs - - node-path - - node-process - - now - - nullable - - ordered-collections - - parallel - - partial - - posix-types - - prelude - - profunctor - - record - - refs - - registry-lib - - routing-duplex - - spago-core - - strings - - strings-extra - - transformers - - tuples - - unfoldable - - unicode - - unsafe-coerce - build_plan: - - aff - - aff-promise - - affjax - - affjax-node - - ansi - - argonaut-core - - arraybuffer-types - - arrays - - assert - - avar - - bifunctors - - catenable-lists - - codec - - codec-json - - console - - const - - contravariant - - control - - datetime - - distributive - - docs-search-common - - docs-search-index - - dodo-printer - - effect - - either - - enums - - exceptions - - exists - - filterable - - fixed-points - - foldable-traversable - - foreign - - foreign-object - - form-urlencoded - - formatters - - free - - functions - - functors - - gen - - graphs - - http-methods - - identity - - integers - - invariant - - js-date - - js-timers - - js-uri - - json - - json-codecs - - language-cst-parser - - language-purescript - - lazy - - lcg - - lists - - maybe - - media-types - - newtype - - node-buffer - - node-child-process - - node-event-emitter - - node-execa - - node-fs - - node-human-signals - - node-os - - node-path - - node-process - - node-streams - - nonempty - - now - - nullable - - numbers - - ordered-collections - - orders - - parallel - - parsing - - partial - - posix-types - - prelude - - profunctor - - profunctor-lenses - - quickcheck - - quickcheck-laws - - random - - record - - refs - - registry-lib - - routing-duplex - - safe-coerce - - search-trie - - spago-core - - st - - string-parsers - - strings - - strings-extra - - stringutils - - tailrec - - these - - transformers - - tuples - - type-equality - - typelevel-prelude - - unfoldable - - unicode - - unsafe-coerce - - unsafe-reference - - variant - - versions - - web-dom - - web-events - - web-file - - web-html - - web-storage - - web-xhr - test: - dependencies: - - exceptions - - identity - - quickcheck - - spec - - spec-node - build_plan: - - aff - - ansi - - argonaut-codecs - - argonaut-core - - arraybuffer-types - - arrays - - avar - - bifunctors - - catenable-lists - - console - - const - - contravariant - - control - - datetime - - distributive - - effect - - either - - enums - - exceptions - - exists - - exitcodes - - foldable-traversable - - foreign - - foreign-object - - fork - - free - - functions - - functors - - gen - - identity - - integers - - invariant - - js-date - - lazy - - lcg - - lists - - maybe - - mmorph - - newtype - - node-buffer - - node-event-emitter - - node-fs - - node-path - - node-process - - node-streams - - nonempty - - now - - nullable - - numbers - - open-memoize - - optparse - - ordered-collections - - orders - - parallel - - partial - - pipes - - posix-types - - prelude - - profunctor - - psci-support - - quickcheck - - random - - record - - refs - - safe-coerce - - spec - - spec-node - - st - - strings - - tailrec - - transformers - - tuples - - type-equality - - typelevel-prelude - - unfoldable - - unsafe-coerce + dependencies: + - aff + - aff-promise + - affjax + - affjax-node + - ansi + - argonaut-core + - arrays + - avar + - codec + - codec-json + - console + - control + - datetime + - docs-search-common + - docs-search-index + - dodo-printer + - effect + - either + - enums + - filterable + - foldable-traversable + - foreign-object + - formatters + - functions + - graphs + - http-methods + - integers + - json + - lists + - maybe + - newtype + - node-buffer + - node-child-process + - node-execa + - node-fs + - node-path + - node-process + - now + - nullable + - ordered-collections + - parallel + - partial + - posix-types + - prelude + - profunctor + - record + - refs + - registry-lib + - routing-duplex + - spago-core + - strings + - strings-extra + - transformers + - tuples + - unfoldable + - unicode + - unsafe-coerce + test_dependencies: + - exceptions + - identity + - quickcheck + - spec + - spec-node + build_plan: + - aff + - aff-promise + - affjax + - affjax-node + - ansi + - argonaut-codecs + - argonaut-core + - arraybuffer-types + - arrays + - assert + - avar + - bifunctors + - catenable-lists + - codec + - codec-json + - console + - const + - contravariant + - control + - datetime + - distributive + - docs-search-common + - docs-search-index + - dodo-printer + - effect + - either + - enums + - exceptions + - exists + - exitcodes + - filterable + - fixed-points + - foldable-traversable + - foreign + - foreign-object + - fork + - form-urlencoded + - formatters + - free + - functions + - functors + - gen + - graphs + - http-methods + - identity + - integers + - invariant + - js-date + - js-timers + - js-uri + - json + - json-codecs + - language-cst-parser + - language-purescript + - lazy + - lcg + - lists + - maybe + - media-types + - mmorph + - newtype + - node-buffer + - node-child-process + - node-event-emitter + - node-execa + - node-fs + - node-human-signals + - node-os + - node-path + - node-process + - node-streams + - nonempty + - now + - nullable + - numbers + - open-memoize + - optparse + - ordered-collections + - orders + - parallel + - parsing + - partial + - pipes + - posix-types + - prelude + - profunctor + - profunctor-lenses + - psci-support + - quickcheck + - quickcheck-laws + - random + - record + - refs + - registry-lib + - routing-duplex + - safe-coerce + - search-trie + - spago-core + - spec + - spec-node + - st + - string-parsers + - strings + - strings-extra + - stringutils + - tailrec + - these + - transformers + - tuples + - type-equality + - typelevel-prelude + - unfoldable + - unicode + - unsafe-coerce + - unsafe-reference + - variant + - versions + - web-dom + - web-events + - web-file + - web-html + - web-storage + - web-xhr spago-bin: path: bin - core: - dependencies: - - aff - - arrays - - avar - - codec-json - - control - - foldable-traversable - - lists - - maybe - - node-path - - node-process - - now - - optparse - - ordered-collections - - prelude - - record - - registry-lib - - spago - - spago-core - - strings - - transformers - - unsafe-coerce - build_plan: - - aff - - aff-promise - - affjax - - affjax-node - - ansi - - argonaut-core - - arraybuffer-types - - arrays - - assert - - avar - - bifunctors - - catenable-lists - - codec - - codec-json - - console - - const - - contravariant - - control - - datetime - - distributive - - docs-search-common - - docs-search-index - - dodo-printer - - effect - - either - - enums - - exceptions - - exists - - exitcodes - - filterable - - fixed-points - - foldable-traversable - - foreign - - foreign-object - - form-urlencoded - - formatters - - free - - functions - - functors - - gen - - graphs - - http-methods - - identity - - integers - - invariant - - js-date - - js-timers - - js-uri - - json - - json-codecs - - language-cst-parser - - language-purescript - - lazy - - lcg - - lists - - maybe - - media-types - - newtype - - node-buffer - - node-child-process - - node-event-emitter - - node-execa - - node-fs - - node-human-signals - - node-os - - node-path - - node-process - - node-streams - - nonempty - - now - - nullable - - numbers - - open-memoize - - optparse - - ordered-collections - - orders - - parallel - - parsing - - partial - - posix-types - - prelude - - profunctor - - profunctor-lenses - - psci-support - - quickcheck - - quickcheck-laws - - random - - record - - refs - - registry-lib - - routing-duplex - - safe-coerce - - search-trie - - spago - - spago-core - - st - - string-parsers - - strings - - strings-extra - - stringutils - - tailrec - - these - - transformers - - tuples - - type-equality - - typelevel-prelude - - unfoldable - - unicode - - unsafe-coerce - - unsafe-reference - - variant - - versions - - web-dom - - web-events - - web-file - - web-html - - web-storage - - web-xhr - test: - dependencies: [] - build_plan: [] + dependencies: + - aff + - arrays + - avar + - codec-json + - control + - foldable-traversable + - lists + - maybe + - node-path + - node-process + - now + - optparse + - ordered-collections + - prelude + - record + - registry-lib + - spago + - spago-core + - strings + - transformers + - unsafe-coerce + test_dependencies: [] + build_plan: + - aff + - aff-promise + - affjax + - affjax-node + - ansi + - argonaut-codecs + - argonaut-core + - arraybuffer-types + - arrays + - assert + - avar + - bifunctors + - catenable-lists + - codec + - codec-json + - console + - const + - contravariant + - control + - datetime + - distributive + - docs-search-common + - docs-search-index + - dodo-printer + - effect + - either + - enums + - exceptions + - exists + - exitcodes + - filterable + - fixed-points + - foldable-traversable + - foreign + - foreign-object + - fork + - form-urlencoded + - formatters + - free + - functions + - functors + - gen + - graphs + - http-methods + - identity + - integers + - invariant + - js-date + - js-timers + - js-uri + - json + - json-codecs + - language-cst-parser + - language-purescript + - lazy + - lcg + - lists + - maybe + - media-types + - mmorph + - newtype + - node-buffer + - node-child-process + - node-event-emitter + - node-execa + - node-fs + - node-human-signals + - node-os + - node-path + - node-process + - node-streams + - nonempty + - now + - nullable + - numbers + - open-memoize + - optparse + - ordered-collections + - orders + - parallel + - parsing + - partial + - pipes + - posix-types + - prelude + - profunctor + - profunctor-lenses + - psci-support + - quickcheck + - quickcheck-laws + - random + - record + - refs + - registry-lib + - routing-duplex + - safe-coerce + - search-trie + - spago + - spago-core + - spec + - spec-node + - st + - string-parsers + - strings + - strings-extra + - stringutils + - tailrec + - these + - transformers + - tuples + - type-equality + - typelevel-prelude + - unfoldable + - unicode + - unsafe-coerce + - unsafe-reference + - variant + - versions + - web-dom + - web-events + - web-file + - web-html + - web-storage + - web-xhr spago-core: path: core - core: - dependencies: - - aff - - arrays - - bifunctors - - codec - - codec-json - - console - - control - - datetime - - dodo-printer - - effect - - either - - exceptions - - filterable - - foldable-traversable - - functions - - identity - - integers - - json - - lists - - maybe - - newtype - - node-buffer - - node-fs - - node-path - - node-process - - now - - ordered-collections - - partial - - prelude - - profunctor - - refs - - registry-lib - - strings - - stringutils - - transformers - - tuples - build_plan: - - aff - - ansi - - arraybuffer-types - - arrays - - assert - - avar - - bifunctors - - catenable-lists - - codec - - codec-json - - console - - const - - contravariant - - control - - datetime - - distributive - - dodo-printer - - effect - - either - - enums - - exceptions - - exists - - filterable - - fixed-points - - foldable-traversable - - foreign - - foreign-object - - formatters - - free - - functions - - functors - - gen - - graphs - - identity - - integers - - invariant - - js-date - - js-uri - - json - - language-cst-parser - - lazy - - lcg - - lists - - maybe - - newtype - - node-buffer - - node-event-emitter - - node-fs - - node-path - - node-process - - node-streams - - nonempty - - now - - nullable - - numbers - - ordered-collections - - orders - - parallel - - parsing - - partial - - posix-types - - prelude - - profunctor - - profunctor-lenses - - quickcheck - - random - - record - - refs - - registry-lib - - routing-duplex - - safe-coerce - - st - - strings - - stringutils - - tailrec - - transformers - - tuples - - type-equality - - typelevel-prelude - - unfoldable - - unicode - - unsafe-coerce - - variant - test: - dependencies: [] - build_plan: [] + dependencies: + - aff + - arrays + - bifunctors + - codec + - codec-json + - console + - control + - datetime + - dodo-printer + - effect + - either + - exceptions + - filterable + - foldable-traversable + - functions + - identity + - integers + - json + - lists + - maybe + - newtype + - node-buffer + - node-fs + - node-path + - node-process + - now + - ordered-collections + - partial + - prelude + - profunctor + - refs + - registry-lib + - strings + - stringutils + - transformers + - tuples + test_dependencies: [] + build_plan: + - aff + - ansi + - arraybuffer-types + - arrays + - assert + - avar + - bifunctors + - catenable-lists + - codec + - codec-json + - console + - const + - contravariant + - control + - datetime + - distributive + - dodo-printer + - effect + - either + - enums + - exceptions + - exists + - filterable + - fixed-points + - foldable-traversable + - foreign + - foreign-object + - formatters + - free + - functions + - functors + - gen + - graphs + - identity + - integers + - invariant + - js-date + - js-uri + - json + - language-cst-parser + - lazy + - lcg + - lists + - maybe + - newtype + - node-buffer + - node-event-emitter + - node-fs + - node-path + - node-process + - node-streams + - nonempty + - now + - nullable + - numbers + - ordered-collections + - orders + - parallel + - parsing + - partial + - posix-types + - prelude + - profunctor + - profunctor-lenses + - quickcheck + - random + - record + - refs + - registry-lib + - routing-duplex + - safe-coerce + - st + - strings + - stringutils + - tailrec + - transformers + - tuples + - type-equality + - typelevel-prelude + - unfoldable + - unicode + - unsafe-coerce + - variant package_set: address: registry: 56.4.0 diff --git a/src/Spago/Config.purs b/src/Spago/Config.purs index 38bce11c0..29ae4e4ee 100644 --- a/src/Spago/Config.purs +++ b/src/Spago/Config.purs @@ -38,6 +38,7 @@ import Data.Enum as Enum import Data.Graph as Graph import Data.HTTP.Method as Method import Data.Int as Int +import Data.List (List(..)) import Data.Map as Map import Data.Nullable (Nullable) import Data.Nullable as Nullable @@ -164,6 +165,17 @@ type ReadWorkspaceOptions = , migrateConfig :: Boolean } +type PrelimWorkspace = + { backend :: Maybe Core.BackendConfig + , buildOpts :: Maybe + { censorLibraryWarnings :: Maybe Core.CensorBuildWarnings + , output :: Maybe String + , statVerbosity :: Maybe Core.StatVerbosity + } + , extraPackages :: Maybe (Map PackageName Core.ExtraPackage) + , packageSet :: Maybe Core.SetAddress + } + -- | Reads all the configurations in the tree and builds up the Map of local -- | packages to be integrated in the package set readWorkspace :: ∀ a. ReadWorkspaceOptions -> Spago (Registry.RegistryEnv a) Workspace @@ -180,6 +192,36 @@ readWorkspace { maybeSelectedPackage, pureBuild, migrateConfig } = do false, true -> logWarn $ "Your " <> path <> " is using an outdated format. Run Spago with the --migrate flag to update it to the latest version." _, false -> pure unit + logInfo "Gathering all the spago configs higher in the tree..." + let + higherPaths :: List FilePath + higherPaths = Array.toUnfoldable $ Paths.toGitSearchPath Paths.cwd + + checkForWorkspace :: forall b. FilePath + -> Spago (LogEnv b) (Maybe PrelimWorkspace) + checkForWorkspace config = do + result <- readConfig config + case result of + Left _ -> pure Nothing + Right { yaml: { workspace: Nothing } } -> pure Nothing + Right { yaml: { workspace: Just ws } } -> pure (Just ws) + + searchHigherPaths :: forall b. List FilePath -> Spago (LogEnv b) (Maybe PrelimWorkspace) + searchHigherPaths Nil = pure Nothing + searchHigherPaths (path : otherPaths) = do + mYaml :: Maybe String <- map Array.head $ liftAff $ Glob.gitignoringGlob path [ "./spago.yaml" ] + case mYaml of + Nothing -> searchHigherPaths otherPaths + Just foundSpagoYaml -> do + mWorkspace :: Maybe PrelimWorkspace <- checkForWorkspace foundSpagoYaml + case mWorkspace of + Nothing -> searchHigherPaths otherPaths + workspace -> pure workspace + + mHigherConfigPath <- searchHigherPaths higherPaths + for_ mHigherConfigPath $ \_ -> do + logDebug $ [ toDoc "Found workspace at higher path: " ] + -- First try to read the config in the root. It _has_ to contain a workspace -- configuration, or we fail early. { workspace, package: maybePackage, workspaceDoc } <- readConfig "spago.yaml" >>= case _ of @@ -199,10 +241,10 @@ readWorkspace { maybeSelectedPackage, pureBuild, migrateConfig } = do doMigrateConfig "spago.yaml" config pure { workspace, package, workspaceDoc: doc } - logDebug "Gathering all the spago configs in the tree..." - otherConfigPaths <- liftAff $ Glob.gitignoringGlob Paths.cwd [ "**/spago.yaml" ] - unless (Array.null otherConfigPaths) do - logDebug $ [ toDoc "Found packages at these paths:", Log.indent $ Log.lines (map toDoc otherConfigPaths) ] + logDebug "Gathering all the spago configs lower in the tree..." + otherLowerConfigPaths <- liftAff $ Glob.gitignoringGlob Paths.cwd [ "**/spago.yaml" ] + unless (Array.null otherLowerConfigPaths) do + logDebug $ [ toDoc "Found packages at these lower paths:", Log.indent $ Log.lines (map toDoc otherLowerConfigPaths) ] -- We read all of them in, and only read the package section, if any. let @@ -220,7 +262,7 @@ readWorkspace { maybeSelectedPackage, pureBuild, migrateConfig } = do Right config -> do Right { config, hasTests, configPath: path, packagePath: Path.dirname path } - { right: otherPackages, left: failedPackages } <- partitionMap identity <$> traverse readWorkspaceConfig otherConfigPaths + { right: otherPackages, left: failedPackages } <- partitionMap identity <$> traverse readWorkspaceConfig otherLowerConfigPaths unless (Array.null failedPackages) do logWarn $ [ toDoc "Failed to read some configs:" ] <> failedPackages diff --git a/src/Spago/Paths.purs b/src/Spago/Paths.purs index e2b3ccc8a..cdb4ba0a4 100644 --- a/src/Spago/Paths.purs +++ b/src/Spago/Paths.purs @@ -6,6 +6,8 @@ import Effect.Unsafe (unsafePerformEffect) import Node.Path (FilePath) import Node.Path as Path import Node.Process as Process +import Data.Array (cons, replicate, reverse) +import Data.String (joinWith) type NodePaths = { config :: FilePath @@ -44,6 +46,17 @@ toLocalCachePackagesPath rootDir = Path.concat [ toLocalCachePath rootDir, "p" ] toLocalCacheGitPath :: FilePath -> FilePath toLocalCacheGitPath rootDir = Path.concat [ toLocalCachePath rootDir, "g" ] +-- search maximum 4 levels up the tree to find the Git project, if it exists +toGitSearchPath :: FilePath -> Array FilePath +toGitSearchPath rootDir = reverse $ makeSearchPaths rootDir 2 where + makeSearchPath :: FilePath -> Int -> FilePath + makeSearchPath wd i = joinWith "" $ cons wd $ cons "/" $ replicate i "../" + + makeSearchPaths :: FilePath -> Int -> Array FilePath + makeSearchPaths wd 0 = pure wd + makeSearchPaths wd i | i > 0 = cons (makeSearchPath wd i) (makeSearchPaths wd (i - 1)) + makeSearchPaths _ _ = mempty + registryPath ∷ FilePath registryPath = Path.concat [ globalCachePath, "registry" ] diff --git a/test/Spago/Paths.purs b/test/Spago/Paths.purs new file mode 100644 index 000000000..fa4c5bf9f --- /dev/null +++ b/test/Spago/Paths.purs @@ -0,0 +1,21 @@ +module Test.Spago.Paths where + +import Test.Prelude + +import Test.Spec (Spec) +import Test.Spec as Spec +import Test.Spec.Assertions as Assert + +import Spago.Paths (toGitSearchPath) + +spec :: Spec Unit +spec = Spec.around withTempDir do + Spec.describe "paths" do + Spec.it "generate four paths to parent directories of working directory, plus working directory" \ _ -> do + toGitSearchPath "~/a/b/c/d/e" `Assert.shouldEqual` + [ "~/a/b/c/d/e" + , "~/a/b/c/d/e/../" + , "~/a/b/c/d/e/../../" + , "~/a/b/c/d/e/../../../" + , "~/a/b/c/d/e/../../../../" + ]