diff --git a/CHANGELOG.md b/CHANGELOG.md index d6d6646de..0d4ac61b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ Other improvements: cached locally. - `spago publish` now allows to publish a package with some test (but only test!) dependencies not present in the registry. +- always using forward slash as path separator in lockfile, regardless of the + platform, so that the lockfile doesn't keep changing when team members run + Spago on different platforms. ## [0.21.0] - 2023-05-04 diff --git a/src/Spago/Config.purs b/src/Spago/Config.purs index f38471148..38bce11c0 100644 --- a/src/Spago/Config.purs +++ b/src/Spago/Config.purs @@ -448,7 +448,7 @@ rootPackageToWorkspacePackage { rootPackage, workspaceDoc } = do workspacePackageToLockfilePackage :: WorkspacePackage -> Tuple PackageName Lock.WorkspaceLockPackage workspacePackageToLockfilePackage { path, package } = Tuple package.name - { path + { path: withForwardSlashes path , core: { dependencies: package.dependencies, build_plan: mempty } , test: { dependencies: foldMap _.dependencies package.test, build_plan: mempty } } diff --git a/test-fixtures/lock/1158-doubly-nested-projects/expected-lockfile.txt b/test-fixtures/lock/1158-doubly-nested-projects/expected-lockfile.txt new file mode 100644 index 000000000..dc51b243a --- /dev/null +++ b/test-fixtures/lock/1158-doubly-nested-projects/expected-lockfile.txt @@ -0,0 +1,482 @@ +workspace: + packages: + foo-bar: + path: foo/bar + core: + dependencies: + - prelude + build_plan: + - prelude + test: + dependencies: [] + build_plan: [] + root: + path: ./ + core: + dependencies: [] + build_plan: [] + test: + dependencies: [] + build_plan: [] + package_set: + address: + registry: 20.0.1 + compiler: ">=0.15.7 <0.16.0" + content: + abc-parser: 2.0.0 + ace: 9.1.0 + aff: 7.1.0 + aff-bus: 6.0.0 + aff-coroutines: 9.0.0 + aff-promise: 4.0.0 + aff-retry: 2.0.0 + affjax: 13.0.0 + affjax-node: 1.0.0 + affjax-web: 1.0.0 + ansi: 7.0.0 + argonaut: 9.0.0 + argonaut-aeson-generic: 0.4.1 + argonaut-codecs: 9.1.0 + argonaut-core: 7.0.0 + argonaut-generic: 8.0.0 + argonaut-traversals: 10.0.0 + argparse-basic: 2.0.0 + array-builder: 0.1.2 + array-search: 0.5.6 + arraybuffer: 13.2.0 + arraybuffer-builder: 3.1.0 + arraybuffer-types: 3.0.2 + arrays: 7.2.0 + arrays-zipper: 2.0.1 + ask: 1.0.0 + assert: 6.0.0 + assert-multiple: 0.3.4 + avar: 5.0.0 + 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 + 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 + channel: 1.0.0 + checked-exceptions: 3.1.1 + classless: 0.1.1 + classless-arbitrary: 0.1.1 + classless-decode-json: 0.1.1 + classless-encode-json: 0.1.3 + classnames: 2.0.0 + codec: 6.0.0 + codec-argonaut: 10.0.0 + colors: 7.0.1 + concur-core: 0.5.0 + concur-react: 0.5.0 + concurrent-queues: 3.0.0 + console: 6.0.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 + 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 + 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 + droplet: 0.6.0 + dts: 0.1.3 + dynamic-buffer: 3.0.1 + echarts-simple: 0.0.1 + effect: 4.0.0 + either: 6.1.0 + elmish: 0.9.3 + elmish-enzyme: 0.1.1 + elmish-hooks: 0.9.1 + elmish-html: 0.8.1 + elmish-testing-library: 0.3.1 + email-validate: 7.0.0 + encoding: 0.0.8 + enums: 6.0.1 + env-names: 0.3.4 + error: 2.0.0 + 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 + fetch-yoga-json: 1.1.0 + filterable: 5.0.0 + fixed-points: 7.0.0 + fixed-precision: 5.0.0 + flame: 1.3.0 + float32: 2.0.0 + foldable-traversable: 6.0.0 + foreign: 7.0.0 + foreign-object: 4.1.0 + foreign-readwrite: 3.4.0 + fork: 6.0.0 + form-urlencoded: 7.0.0 + formatters: 7.0.0 + framer-motion: 1.0.1 + free: 7.0.0 + freeap: 7.0.0 + freer-free: 0.0.1 + freet: 7.0.0 + functions: 6.0.0 + functor1: 3.0.0 + functors: 5.0.0 + fuzzy: 0.4.0 + gen: 4.0.0 + generate-values: 1.0.1 + generic-router: 0.0.1 + geojson: 0.0.2 + 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-css: 10.0.0 + halogen-echarts-simple: 0.0.4 + halogen-formless: 4.0.2 + 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-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 + humdrum: 0.0.1 + hyrule: 2.3.7 + identity: 6.0.0 + identy: 4.0.1 + indexed-db: 1.0.0 + indexed-monad: 3.0.0 + int64: 3.0.0 + integers: 6.0.0 + interpolate: 5.0.2 + invariant: 6.0.0 + jarilo: 1.0.1 + jelly: 0.10.0 + jelly-router: 0.3.0 + jelly-signal: 0.4.0 + jest: 1.0.0 + js-abort-controller: 1.0.0 + js-bigints: 2.0.0 + js-date: 8.0.0 + js-fileio: 3.0.0 + 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 + justifill: 0.5.0 + jwt: 0.0.9 + language-cst-parser: 0.12.3 + 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 + lists: 7.0.0 + literals: 1.0.2 + logging: 3.0.0 + logging-journald: 0.4.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 + matrices: 5.0.1 + matryoshka: 1.0.0 + maybe: 6.0.0 + mdast-util-from-markdown: 0.2.1 + media-types: 6.0.0 + midi: 4.0.0 + milkis: 9.0.0 + minibench: 4.0.1 + mmorph: 7.0.0 + monad-control: 5.0.0 + monad-logger: 1.3.1 + monad-loops: 0.5.0 + monad-unlift: 1.0.1 + monoid-extras: 0.0.1 + monoidal: 0.16.0 + morello: 0.4.0 + mote: 3.0.0 + motsunabe: 2.0.0 + mysql: 6.0.1 + n3: 0.1.0 + nano-id: 1.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-human-signals: 1.0.0 + node-net: 4.0.0 + node-path: 5.0.0 + node-process: 10.0.0 + node-readline: 7.0.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 + 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 + 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 + ordered-set: 0.4.0 + orders: 6.0.0 + pairs: 9.0.0 + parallel: 6.0.0 + parsing: 10.2.0 + parsing-dataview: 3.2.4 + partial: 4.0.0 + pathy: 9.0.0 + pha: 0.9.1 + phaser: 0.7.0 + pipes: 8.0.0 + pirates-charm: 0.0.1 + point-free: 1.0.0 + pointed-list: 0.5.1 + polymorphic-vectors: 4.0.0 + posix-types: 6.0.0 + precise: 6.0.0 + precise-datetime: 7.0.0 + prelude: 6.0.1 + prettier-printer: 3.0.0 + 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 + 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 + rdf: 0.1.0 + react: 11.0.0 + react-aria: 0.2.0 + react-basic: 17.0.0 + react-basic-classic: 3.0.0 + 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-storybook: 2.0.0 + react-dom: 8.0.0 + react-halo: 3.0.0 + react-icons: 1.1.1 + react-markdown: 0.1.0 + react-testing-library: 4.0.1 + react-virtuoso: 1.0.0 + read: 1.0.1 + recharts: 1.1.0 + record: 4.0.0 + record-extra: 5.0.1 + record-studio: 1.0.4 + refs: 6.0.0 + remotedata: 5.0.0 + resource: 2.0.1 + resourcet: 1.0.0 + result: 1.0.3 + return: 0.2.0 + ring-modules: 5.0.1 + rito: 0.3.2 + routing: 11.0.0 + routing-duplex: 0.7.0 + run: 5.0.0 + safe-coerce: 2.0.0 + safely: 4.0.1 + school-of-music: 1.3.0 + selection-foldable: 0.2.0 + 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 + slug: 3.0.8 + 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 + spec-quickcheck: 5.0.0 + splitmix: 2.1.0 + ssrs: 1.0.0 + st: 6.2.0 + statistics: 0.3.2 + strictlypositiveint: 1.0.1 + string-parsers: 8.0.0 + strings: 6.0.1 + 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 + 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 + tuples: 7.0.0 + two-or-more: 1.0.0 + type-equality: 4.0.1 + typedenv: 2.0.1 + typelevel: 6.0.0 + typelevel-lists: 2.1.0 + typelevel-peano: 1.0.1 + typelevel-prelude: 7.0.0 + typelevel-rows: 0.1.0 + uint: 7.0.0 + ulid: 3.0.1 + uncurried-transformers: 1.1.0 + undefined: 2.0.0 + undefined-is-not-a-problem: 1.1.0 + unfoldable: 6.0.0 + unicode: 6.0.0 + unique: 0.6.1 + unlift: 1.0.1 + unordered-collections: 3.0.1 + unsafe-coerce: 6.0.0 + unsafe-reference: 5.0.0 + untagged-to-tagged: 0.1.4 + untagged-union: 1.0.0 + uri: 9.0.0 + uuid: 9.0.0 + uuidv4: 1.0.0 + validation: 6.0.0 + variant: 8.0.0 + vectorfield: 1.0.1 + vectors: 2.1.0 + versions: 7.0.0 + visx: 0.0.2 + web-clipboard: 5.0.0 + web-cssom: 2.0.0 + web-cssom-view: 0.1.0 + web-dom: 6.0.0 + web-dom-parser: 8.0.0 + web-dom-xpath: 3.0.0 + web-encoding: 3.0.0 + web-events: 4.0.0 + web-fetch: 3.0.0 + web-file: 4.0.0 + web-geometry: 0.1.0 + web-html: 4.1.0 + web-pointerevents: 1.0.0 + web-proletarian: 1.0.0 + web-promise: 3.1.0 + web-resize-observer: 2.0.0 + web-router: 1.0.0 + web-socket: 4.0.0 + web-storage: 5.0.0 + web-streams: 3.0.0 + web-touchevents: 4.0.0 + web-uievents: 4.0.0 + web-url: 2.0.0 + web-workers: 1.1.0 + web-xhr: 5.0.1 + webextension-polyfill: 0.1.0 + 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 + extra_packages: {} +packages: + prelude: + type: registry + version: 6.0.1 + integrity: sha256-o8p6SLYmVPqzXZhQFd2hGAWEwBoXl1swxLG/scpJ0V0= + dependencies: [] diff --git a/test-fixtures/lock/1158-doubly-nested-projects/foo/bar/spago.yaml b/test-fixtures/lock/1158-doubly-nested-projects/foo/bar/spago.yaml new file mode 100644 index 000000000..07e11b04f --- /dev/null +++ b/test-fixtures/lock/1158-doubly-nested-projects/foo/bar/spago.yaml @@ -0,0 +1,4 @@ +package: + name: foo-bar + dependencies: + - prelude diff --git a/test-fixtures/lock/1158-doubly-nested-projects/spago.yaml b/test-fixtures/lock/1158-doubly-nested-projects/spago.yaml new file mode 100644 index 000000000..946e9ccee --- /dev/null +++ b/test-fixtures/lock/1158-doubly-nested-projects/spago.yaml @@ -0,0 +1,6 @@ +package: + name: root + dependencies: [] +workspace: + package_set: + registry: 20.0.1 diff --git a/test/Spago/Lock.purs b/test/Spago/Lock.purs index cad7f9f82..850478297 100644 --- a/test/Spago/Lock.purs +++ b/test/Spago/Lock.purs @@ -11,6 +11,7 @@ import Registry.Version as Version import Spago.Core.Config (Dependencies(..), ExtraPackage(..), RemotePackage(..), SetAddress(..)) import Spago.Core.Config as Config import Spago.Core.Config as Core +import Spago.FS as FS import Spago.Lock (LockEntry(..), Lockfile) import Spago.Lock as Lock import Test.Spec (Spec) @@ -18,8 +19,8 @@ import Test.Spec as Spec import Test.Spec.Assertions as Assert spec :: Spec Unit -spec = do - Spec.it "parses lockfile" do +spec = Spec.around withTempDir do + Spec.it "parses lockfile" \_ -> do case parseYaml Lock.lockfileCodec validLockfileString of Left error -> Assert.fail $ "Failed to parse: " <> CJ.DecodeError.print error @@ -28,6 +29,11 @@ spec = do Right _ -> pure unit + Spec.it "#1158: always uses forward slash separator for doubly nested projects' paths" \{ spago, fixture } -> do + FS.copyTree { src: fixture "lock/1158-doubly-nested-projects", dst: "." } + spago [ "install" ] >>= shouldBeSuccess + checkFixture "spago.lock" (fixture "lock/1158-doubly-nested-projects/expected-lockfile.txt") + validLockfile :: Lockfile validLockfile = { workspace: