Skip to content

Commit 0d60a4e

Browse files
Remove legacy importer and related legacy code (#738)
1 parent 7d3e745 commit 0d60a4e

File tree

29 files changed

+632
-4530
lines changed

29 files changed

+632
-4530
lines changed

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ nixfmt *.nix nix/**/*.nix
8484
- `app-e2e/` — E2E tests for the server API.
8585
- `lib/`**Public library** for consumers (Spago, Pursuit, etc.). Only types and functions useful to external tools belong here. Avoid implementation-specific code.
8686
- `foreign/` — FFI bindings to JavaScript libraries.
87-
- `scripts/` — Runnable modules for registry tasks (LegacyImporter, PackageTransferrer, PackageSetUpdater, etc.). Run via `nix run .#legacy-importer`, etc.
87+
- `scripts/` — Runnable modules for registry tasks (PackageTransferrer, PackageSetUpdater, DailyImporter, etc.). Run via `nix run .#package-transferrer`, etc.
8888
- `test-utils/` — Shared test utilities.
8989
- `db/` — SQLite schemas and migrations (use `dbmate up` to initialize).
9090
- `types/` — Dhall type specifications.

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ nix run .#server
127127
You can also run any of the modules listed in the [scripts](./scripts/) directory by converting the camel-case file name to kebab-case, such as:
128128

129129
```sh
130-
# To run `LegacyImporter.purs`
131-
nix run .#legacy-importer
132-
133130
# To run `PackageTransferrer.purs`
134131
nix run .#package-transferrer
132+
133+
# To run `DailyImporter.purs`
134+
nix run .#daily-importer
135135
```
136136

137137
### Required Environment Variables

SPEC.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ This specification defines the data formats used by the registry, the operations
66

77
## 1. Introduction
88

9-
The PureScript Registry is an independent package registry for PureScript. It was created after the Bower registry (which PureScript previously relied on for package distribution) stopped accepting new submissions in 2020. Initially package names were tracked in a simple `new-packages.json` file so that package managers like Spago and package sets tooling could continue to function. The full registry replaced this stopgap with a complete system.
9+
The PureScript Registry is an independent package registry for PureScript. It was created after the Bower registry (which PureScript previously relied on for package distribution) stopped accepting new submissions in 2020.
1010

11-
Packages from the Bower registry and `new-packages.json` file have been grandfathered into the registry so long as they satisfy registry requirements. The most restrictive requirement is that package versions compile with at least one compiler version from 0.13.0 onwards. This means packages published prior to May 2019 are not in the registry and can only be used with legacy package managers (Bower, legacy Spago).
11+
Packages from the Bower registry have been grandfathered into the registry so long as they satisfy registry requirements. The most restrictive requirement is that package versions compile with at least one compiler version from 0.13.0 onwards. This means packages published prior to May 2019 are not in the registry and can only be used with legacy package managers (Bower, legacy Spago).
1212

1313
The registry addresses several limitations of Bower and introduces new features of its own:
1414

app-e2e/src/Test/E2E/Endpoint/Publish.purs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,28 @@ spec = do
6868
let actualCompilers = Set.fromFoldable $ NEA.toArray publishedMetaAfter.compilers
6969
Assert.shouldEqual actualCompilers expectedCompilers
7070

71+
Spec.describe "Publish with spago.dhall manifest" do
72+
Spec.it "can publish slug@3.0.0 which uses spago.dhall format" do
73+
{ jobId } <- Client.publish Fixtures.slugPublishData
74+
job <- Env.pollJobOrFail jobId
75+
Assert.shouldSatisfy (V1.jobInfo job).finishedAt isJust
76+
77+
uploadOccurred <- Env.hasStorageUpload Fixtures.slug
78+
unless uploadOccurred do
79+
storageRequests <- WireMock.getStorageRequests
80+
WireMock.failWithRequests "Expected S3 PUT for slug/3.0.0.tar.gz" storageRequests
81+
82+
Metadata metadata <- Env.readMetadata Fixtures.slug.name
83+
case Map.lookup Fixtures.slug.version metadata.published of
84+
Nothing -> Assert.fail $ "Expected version " <> Version.print Fixtures.slug.version <> " in metadata published versions"
85+
Just publishedMeta -> do
86+
Assert.shouldSatisfy (Sha256.print publishedMeta.hash) (not <<< String.null)
87+
88+
manifestEntries <- Env.readManifestIndexEntry Fixtures.slug.name
89+
let hasVersion = Array.any (\(Manifest m) -> m.version == Fixtures.slug.version) manifestEntries
90+
unless hasVersion do
91+
Assert.fail $ "Expected version " <> Version.print Fixtures.slug.version <> " in manifest index"
92+
7193
Spec.describe "Publish state machine" do
7294
Spec.it "returns same jobId for duplicate publish requests" do
7395
{ jobId: id1 } <- Client.publish Fixtures.effectPublishData

app-e2e/src/Test/E2E/Support/Fixtures.purs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ module Test.E2E.Support.Fixtures
55
, effect
66
, console
77
, prelude
8+
, slug
89
, unsafeCoerce
910
, effectPublishData
1011
, effectPublishDataDifferentLocation
1112
, consolePublishData
13+
, slugPublishData
1214
, unsafeCoercePublishData
1315
, failingTransferData
1416
, nonexistentTransferData
@@ -53,6 +55,10 @@ console = { name: Utils.unsafePackageName "console", version: Utils.unsafeVersio
5355
prelude :: PackageFixture
5456
prelude = { name: Utils.unsafePackageName "prelude", version: Utils.unsafeVersion "6.0.1" }
5557

58+
-- | slug@3.0.0 fixture package (uses spago.dhall manifest format)
59+
slug :: PackageFixture
60+
slug = { name: Utils.unsafePackageName "slug", version: Utils.unsafeVersion "3.0.0" }
61+
5662
-- | Standard publish data for effect@4.0.0, used by E2E tests.
5763
-- | This matches the fixtures in app/fixtures/github-packages/effect-4.0.0
5864
effectPublishData :: Operation.PublishData
@@ -101,6 +107,23 @@ consolePublishData =
101107
, version: console.version
102108
}
103109

110+
-- | Publish data for slug@3.0.0, used for spago.dhall manifest format test.
111+
-- | Slug depends on prelude only and uses spago.dhall as its manifest format.
112+
-- | This matches the fixtures in app/fixtures/github-packages/slug-3.0.0
113+
slugPublishData :: Operation.PublishData
114+
slugPublishData =
115+
{ name: slug.name
116+
, location: Just $ GitHub
117+
{ owner: "purescript"
118+
, repo: "purescript-slug"
119+
, subdir: Nothing
120+
}
121+
, ref: "v3.0.0"
122+
, compiler: Just $ Utils.unsafeVersion "0.15.10"
123+
, resolutions: Nothing
124+
, version: slug.version
125+
}
126+
104127
-- | Publish data for unsafe-coerce@6.0.0, used by package set tests.
105128
-- | Has no dependencies. Published first to create the tarball before adding to package set.
106129
unsafeCoercePublishData :: Operation.PublishData
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Thomas Honeyman
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- Minimal packages.dhall for testing - defines only required dependencies inline
2+
{ prelude =
3+
{ dependencies = [] : List Text
4+
, repo = "https://github.com/purescript/purescript-prelude.git"
5+
, version = "v6.0.1"
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{ name = "slug"
2+
, license = "MIT"
3+
, repository = "https://github.com/purescript/purescript-slug"
4+
, dependencies = [ "prelude" ]
5+
, packages = ./packages.dhall
6+
, sources = [ "src/**/*.purs" ]
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module Slug where
2+
3+
import Prelude
4+
5+
-- | A URL-safe slug.
6+
newtype Slug = Slug String
7+
8+
derive instance eqSlug :: Eq Slug
9+
derive instance ordSlug :: Ord Slug
10+
11+
-- | Convert a Slug to a String.
12+
toString :: Slug -> String
13+
toString (Slug s) = s
-30.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)