Skip to content

Commit 1f5c54d

Browse files
authored
Change terminology (Manifest -> Lockfile, Config -> Manifest) (#10)
1 parent e772b38 commit 1f5c54d

21 files changed

+177
-178
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

specs/publishPackageAsync.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ flowchart TD;
99
--> BeginPublishing
1010
1111
subgraph rbxasset
12-
AssetConfig[(rbxasset.toml)]
13-
AssetManifest[(rbxasset-manifest.toml)]
12+
AssetManifest[(rbxasset.toml)]
13+
AssetLockfile[(rbxasset.lock)]
1414
1515
BeginPublishing("publishPackageAsync()")
1616
--> AssetExists{Asset exists on Creator Store?}
1717
1818
AssetExists -- Yes --> UpdateVersion(Update asset version with new rbxm)
1919
AssetExists -- No --> CreateAsset(Create new Package asset)
2020
21-
AssetManifest -. read assetId .-> UpdateVersion
21+
AssetLockfile -. read assetId .-> UpdateVersion
2222
2323
CompareImageHashes{For each image, is there a matching hash?}
2424
CompareImageHashes -- Yes --> SyncAssetDetails
2525
CompareImageHashes -- No --> UploadImages
2626
27-
AssetManifest -. read image hashes .-> CompareImageHashes
27+
AssetLockfile -. read image hashes .-> CompareImageHashes
2828
29-
CreateAsset -. write assetId .-> AssetManifest
29+
CreateAsset -. write assetId .-> AssetLockfile
3030
3131
UploadImages(Create Image assets for the icon and previews)
3232
33-
AssetConfig -. read image paths .-> UploadImages
33+
AssetManifest -. read image paths .-> UploadImages
3434
3535
SyncAssetDetails(Sync asset name, description, icon, and distribution status to Creator Store)
36-
AssetConfig -. read name, description, distribution status .-> SyncAssetDetails
36+
AssetManifest -. read name, description, distribution status .-> SyncAssetDetails
3737
3838
UpdateVersion
3939
--> CreateAssetVersionAsync("AssetService:CreateAssetVersionAsync()")
@@ -44,7 +44,7 @@ flowchart TD;
4444
--> CompareImageHashes
4545
4646
UploadImages --> SyncAssetDetails
47-
UploadImages -. store image hash and id .-> AssetManifest
47+
UploadImages -. store image hash and id .-> AssetLockfile
4848
end
4949
5050
SyncAssetDetails

src/constants.luau

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
return {
2-
ASSET_CONFIG_FILENAME = "rbxasset.toml",
3-
ASSET_MANIFEST_FILENAME = "rbxasset-manifest.toml",
2+
ASSET_MANIFEST_FILENAME = "rbxasset.toml",
3+
ASSET_LOCKFILE_FILENAME = "rbxasset.lock",
44
}

src/init.luau

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
local types = require("@self/types")
22

3-
export type Config = types.Config
43
export type Manifest = types.Manifest
54

65
return {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
local fs = require("@lune/fs")
2+
local serde = require("@lune/serde")
3+
4+
local constants = require("@root/constants")
5+
local join = require("@root/lib/join")
6+
local logging = require("@root/logging")
7+
local types = require("@root/types")
8+
9+
type Lockfile = types.Lockfile
10+
11+
local function getOrCreateAssetLockfile(packagePath: string): Lockfile
12+
local lockfilePath = `{packagePath}/{constants.ASSET_LOCKFILE_FILENAME}`
13+
14+
-- It's expected that the lockfile won't exist in certain situations, like
15+
-- on the first upload of the asset. So we just catch any error here
16+
local content: string
17+
local success = pcall(function()
18+
content = fs.readFile(lockfilePath)
19+
end)
20+
21+
local parsedLockfile = if success then serde.decode("toml", content) else nil
22+
local lockfile: Lockfile = join({
23+
assets = {},
24+
images = {},
25+
}, parsedLockfile)
26+
27+
local isLockfileValid, message = types.validateLockfile(lockfile)
28+
assert(isLockfileValid, `failed to parse asset lockfile at {lockfilePath}: {message}`)
29+
30+
logging.debug(`loaded asset lockfile {lockfile}`)
31+
32+
return lockfile
33+
end
34+
35+
return getOrCreateAssetLockfile
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
local frktest = require("@pkg/frktest/src/frktest")
2+
local test = frktest.test
3+
local check = frktest.assert.check
4+
5+
local getOrCreateAssetLockfile = require("./getOrCreateAssetLockfile")
6+
7+
test.case("reads an asset lockfile from disk", function()
8+
local lockfile = getOrCreateAssetLockfile("examples/package")
9+
check.equal(lockfile.assets["package"].assetId, "70942996502762")
10+
end)
11+
12+
test.case("creates a blank asset lockfile when not found on disk", function()
13+
local lockfile = getOrCreateAssetLockfile("/nowhere")
14+
check.table.equal(lockfile, {
15+
assets = {},
16+
images = {},
17+
})
18+
end)

src/manifest/getOrCreateAssetManifest.luau

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/manifest/getOrCreateAssetManifest.spec.luau

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)