create-payload-app 4.0.0-internal.c2b57ce → 4.0.0-internal.cd69eef
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/lib/ast/types.d.ts +2 -2
- package/dist/lib/ast/types.d.ts.map +1 -1
- package/dist/lib/configure-plugin-project.d.ts.map +1 -1
- package/dist/lib/configure-pnpm-builds.d.ts +20 -0
- package/dist/lib/configure-pnpm-builds.d.ts.map +1 -0
- package/dist/lib/configure-pnpm-builds.js +100 -0
- package/dist/lib/configure-pnpm-builds.js.map +1 -0
- package/dist/lib/create-project.d.ts.map +1 -1
- package/dist/lib/create-project.js +13 -50
- package/dist/lib/create-project.js.map +1 -1
- package/dist/lib/init-next.d.ts +1 -1
- package/dist/lib/init-next.d.ts.map +1 -1
- package/dist/lib/init-next.js +20 -4
- package/dist/lib/init-next.js.map +1 -1
- package/dist/lib/update-payload-in-project.d.ts +1 -1
- package/dist/lib/update-payload-in-project.d.ts.map +1 -1
- package/dist/lib/update-payload-in-project.js +6 -5
- package/dist/lib/update-payload-in-project.js.map +1 -1
- package/dist/lib/wrap-next-config.d.ts.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -5
- package/dist/main.js.map +1 -1
- package/dist/template/src/app/(frontend)/page.tsx +5 -2
- package/dist/template/src/app/(payload)/admin/importMap.js +15 -2
- package/dist/template/src/app/(payload)/layout.tsx +7 -1
- package/dist/template/src/collections/Folders.ts +16 -0
- package/dist/template/src/collections/Media.ts +4 -0
- package/dist/template/src/collections/Tags.ts +16 -0
- package/dist/template/src/collections/Users.ts +1 -0
- package/dist/template/src/payload-types.ts +63 -9
- package/dist/template/src/payload.config.ts +10 -2
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/casing.d.ts.map +1 -1
- package/dist/utils/log.d.ts.map +1 -1
- package/dist/utils/messages.d.ts.map +1 -1
- package/dist/utils/messages.js +1 -0
- package/dist/utils/messages.js.map +1 -1
- package/dist/utils/resolvePackageVersion.d.ts +29 -0
- package/dist/utils/resolvePackageVersion.d.ts.map +1 -0
- package/dist/utils/resolvePackageVersion.js +41 -0
- package/dist/utils/resolvePackageVersion.js.map +1 -0
- package/dist/utils/resolvePackageVersion.spec.js +77 -0
- package/dist/utils/resolvePackageVersion.spec.js.map +1 -0
- package/package.json +2 -2
- package/dist/utils/getLatestPackageVersion.d.ts +0 -17
- package/dist/utils/getLatestPackageVersion.d.ts.map +0 -1
- package/dist/utils/getLatestPackageVersion.js +0 -20
- package/dist/utils/getLatestPackageVersion.js.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default npm dist-tag used by the create-payload-app CLI when no
|
|
3
|
+
* `--payload-version` is provided. The CLI scaffolds against canary by default.
|
|
4
|
+
*/ export const DEFAULT_PAYLOAD_VERSION_TAG = 'canary';
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a package version from either an npm dist-tag (e.g. `canary`) or an
|
|
7
|
+
* explicit version number (e.g. `3.40.0`).
|
|
8
|
+
*
|
|
9
|
+
* A value matching a published dist-tag resolves to that tag's concrete version.
|
|
10
|
+
* Any other value is treated as an explicit version and verified to exist on the
|
|
11
|
+
* registry. Throws if neither a matching tag nor a published version is found.
|
|
12
|
+
*/ export async function resolvePackageVersion({ debug = false, packageName = 'payload', versionOrTag = 'latest' }) {
|
|
13
|
+
const distTags = await fetchDistTags(packageName);
|
|
14
|
+
const taggedVersion = distTags[versionOrTag];
|
|
15
|
+
if (taggedVersion) {
|
|
16
|
+
if (debug) {
|
|
17
|
+
console.log(`Resolved ${packageName}@${versionOrTag} to ${taggedVersion}`);
|
|
18
|
+
}
|
|
19
|
+
return taggedVersion;
|
|
20
|
+
}
|
|
21
|
+
await verifyVersionExists({
|
|
22
|
+
packageName,
|
|
23
|
+
version: versionOrTag
|
|
24
|
+
});
|
|
25
|
+
if (debug) {
|
|
26
|
+
console.log(`Using ${packageName}@${versionOrTag}`);
|
|
27
|
+
}
|
|
28
|
+
return versionOrTag;
|
|
29
|
+
}
|
|
30
|
+
async function fetchDistTags(packageName) {
|
|
31
|
+
const response = await fetch(`https://registry.npmjs.org/-/package/${packageName}/dist-tags`);
|
|
32
|
+
return await response.json();
|
|
33
|
+
}
|
|
34
|
+
async function verifyVersionExists({ packageName, version }) {
|
|
35
|
+
const response = await fetch(`https://registry.npmjs.org/${packageName}/${version}`);
|
|
36
|
+
if (response.status !== 200) {
|
|
37
|
+
throw new Error(`No version or tag "${version}" found for package: ${packageName}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=resolvePackageVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/resolvePackageVersion.ts"],"sourcesContent":["/**\n * Default npm dist-tag used by the create-payload-app CLI when no\n * `--payload-version` is provided. The CLI scaffolds against canary by default.\n */\nexport const DEFAULT_PAYLOAD_VERSION_TAG = 'canary'\n\n/**\n * Resolves a package version from either an npm dist-tag (e.g. `canary`) or an\n * explicit version number (e.g. `3.40.0`).\n *\n * A value matching a published dist-tag resolves to that tag's concrete version.\n * Any other value is treated as an explicit version and verified to exist on the\n * registry. Throws if neither a matching tag nor a published version is found.\n */\nexport async function resolvePackageVersion({\n debug = false,\n packageName = 'payload',\n versionOrTag = 'latest',\n}: {\n debug?: boolean\n /**\n * Package name to resolve against the npm registry.\n *\n * @default 'payload'\n */\n packageName?: string\n /**\n * An npm dist-tag (e.g. `latest`, `canary`) or an explicit version (e.g. `3.40.0`).\n *\n * @default 'latest'\n */\n versionOrTag?: string\n}): Promise<string> {\n const distTags = await fetchDistTags(packageName)\n\n const taggedVersion = distTags[versionOrTag]\n if (taggedVersion) {\n if (debug) {\n console.log(`Resolved ${packageName}@${versionOrTag} to ${taggedVersion}`)\n }\n return taggedVersion\n }\n\n await verifyVersionExists({ packageName, version: versionOrTag })\n\n if (debug) {\n console.log(`Using ${packageName}@${versionOrTag}`)\n }\n return versionOrTag\n}\n\nasync function fetchDistTags(packageName: string): Promise<Record<string, string>> {\n const response = await fetch(`https://registry.npmjs.org/-/package/${packageName}/dist-tags`)\n return (await response.json()) as Record<string, string>\n}\n\nasync function verifyVersionExists({\n packageName,\n version,\n}: {\n packageName: string\n version: string\n}): Promise<void> {\n const response = await fetch(`https://registry.npmjs.org/${packageName}/${version}`)\n if (response.status !== 200) {\n throw new Error(`No version or tag \"${version}\" found for package: ${packageName}`)\n }\n}\n"],"names":["DEFAULT_PAYLOAD_VERSION_TAG","resolvePackageVersion","debug","packageName","versionOrTag","distTags","fetchDistTags","taggedVersion","console","log","verifyVersionExists","version","response","fetch","json","status","Error"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,8BAA8B,SAAQ;AAEnD;;;;;;;CAOC,GACD,OAAO,eAAeC,sBAAsB,EAC1CC,QAAQ,KAAK,EACbC,cAAc,SAAS,EACvBC,eAAe,QAAQ,EAexB;IACC,MAAMC,WAAW,MAAMC,cAAcH;IAErC,MAAMI,gBAAgBF,QAAQ,CAACD,aAAa;IAC5C,IAAIG,eAAe;QACjB,IAAIL,OAAO;YACTM,QAAQC,GAAG,CAAC,CAAC,SAAS,EAAEN,YAAY,CAAC,EAAEC,aAAa,IAAI,EAAEG,eAAe;QAC3E;QACA,OAAOA;IACT;IAEA,MAAMG,oBAAoB;QAAEP;QAAaQ,SAASP;IAAa;IAE/D,IAAIF,OAAO;QACTM,QAAQC,GAAG,CAAC,CAAC,MAAM,EAAEN,YAAY,CAAC,EAAEC,cAAc;IACpD;IACA,OAAOA;AACT;AAEA,eAAeE,cAAcH,WAAmB;IAC9C,MAAMS,WAAW,MAAMC,MAAM,CAAC,qCAAqC,EAAEV,YAAY,UAAU,CAAC;IAC5F,OAAQ,MAAMS,SAASE,IAAI;AAC7B;AAEA,eAAeJ,oBAAoB,EACjCP,WAAW,EACXQ,OAAO,EAIR;IACC,MAAMC,WAAW,MAAMC,MAAM,CAAC,2BAA2B,EAAEV,YAAY,CAAC,EAAEQ,SAAS;IACnF,IAAIC,SAASG,MAAM,KAAK,KAAK;QAC3B,MAAM,IAAIC,MAAM,CAAC,mBAAmB,EAAEL,QAAQ,qBAAqB,EAAER,aAAa;IACpF;AACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { DEFAULT_PAYLOAD_VERSION_TAG, resolvePackageVersion } from './resolvePackageVersion.js';
|
|
3
|
+
const mockRegistry = ({ distTags, validVersions = [] })=>vi.stubGlobal('fetch', vi.fn((url)=>{
|
|
4
|
+
if (url.endsWith('/dist-tags')) {
|
|
5
|
+
return Promise.resolve({
|
|
6
|
+
json: ()=>Promise.resolve(distTags)
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
const version = url.split('/').pop() ?? '';
|
|
10
|
+
return Promise.resolve({
|
|
11
|
+
status: validVersions.includes(version) ? 200 : 404
|
|
12
|
+
});
|
|
13
|
+
}));
|
|
14
|
+
describe('resolvePackageVersion', ()=>{
|
|
15
|
+
afterEach(()=>{
|
|
16
|
+
vi.unstubAllGlobals();
|
|
17
|
+
vi.restoreAllMocks();
|
|
18
|
+
});
|
|
19
|
+
it('should resolve a dist-tag to its concrete version', async ()=>{
|
|
20
|
+
mockRegistry({
|
|
21
|
+
distTags: {
|
|
22
|
+
canary: '3.0.0-canary.abc',
|
|
23
|
+
latest: '2.9.0'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const version = await resolvePackageVersion({
|
|
27
|
+
packageName: 'payload',
|
|
28
|
+
versionOrTag: 'canary'
|
|
29
|
+
});
|
|
30
|
+
expect(version).toBe('3.0.0-canary.abc');
|
|
31
|
+
});
|
|
32
|
+
it('should default to the latest tag when no value is provided', async ()=>{
|
|
33
|
+
mockRegistry({
|
|
34
|
+
distTags: {
|
|
35
|
+
canary: '3.0.0-canary.abc',
|
|
36
|
+
latest: '2.9.0'
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const version = await resolvePackageVersion({
|
|
40
|
+
packageName: 'payload'
|
|
41
|
+
});
|
|
42
|
+
expect(version).toBe('2.9.0');
|
|
43
|
+
});
|
|
44
|
+
it('should return an explicit version when it exists on the registry', async ()=>{
|
|
45
|
+
mockRegistry({
|
|
46
|
+
distTags: {
|
|
47
|
+
latest: '2.9.0'
|
|
48
|
+
},
|
|
49
|
+
validVersions: [
|
|
50
|
+
'3.1.0'
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
const version = await resolvePackageVersion({
|
|
54
|
+
packageName: 'payload',
|
|
55
|
+
versionOrTag: '3.1.0'
|
|
56
|
+
});
|
|
57
|
+
expect(version).toBe('3.1.0');
|
|
58
|
+
});
|
|
59
|
+
it('should throw a clear error when neither a tag nor a version is found', async ()=>{
|
|
60
|
+
mockRegistry({
|
|
61
|
+
distTags: {
|
|
62
|
+
latest: '2.9.0'
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
await expect(resolvePackageVersion({
|
|
66
|
+
packageName: 'payload',
|
|
67
|
+
versionOrTag: 'nope'
|
|
68
|
+
})).rejects.toThrow('No version or tag "nope" found for package: payload');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe('DEFAULT_PAYLOAD_VERSION_TAG', ()=>{
|
|
72
|
+
it('should export DEFAULT_PAYLOAD_VERSION_TAG as "canary"', ()=>{
|
|
73
|
+
expect(DEFAULT_PAYLOAD_VERSION_TAG).toBe('canary');
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=resolvePackageVersion.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/resolvePackageVersion.spec.ts"],"sourcesContent":["import { afterEach, describe, expect, it, vi } from 'vitest'\n\nimport { DEFAULT_PAYLOAD_VERSION_TAG, resolvePackageVersion } from './resolvePackageVersion.js'\n\nconst mockRegistry = ({\n distTags,\n validVersions = [],\n}: {\n distTags: Record<string, string>\n validVersions?: string[]\n}) =>\n vi.stubGlobal(\n 'fetch',\n vi.fn((url: string) => {\n if (url.endsWith('/dist-tags')) {\n return Promise.resolve({ json: () => Promise.resolve(distTags) })\n }\n\n const version = url.split('/').pop() ?? ''\n return Promise.resolve({ status: validVersions.includes(version) ? 200 : 404 })\n }),\n )\n\ndescribe('resolvePackageVersion', () => {\n afterEach(() => {\n vi.unstubAllGlobals()\n vi.restoreAllMocks()\n })\n\n it('should resolve a dist-tag to its concrete version', async () => {\n mockRegistry({ distTags: { canary: '3.0.0-canary.abc', latest: '2.9.0' } })\n\n const version = await resolvePackageVersion({ packageName: 'payload', versionOrTag: 'canary' })\n\n expect(version).toBe('3.0.0-canary.abc')\n })\n\n it('should default to the latest tag when no value is provided', async () => {\n mockRegistry({ distTags: { canary: '3.0.0-canary.abc', latest: '2.9.0' } })\n\n const version = await resolvePackageVersion({ packageName: 'payload' })\n\n expect(version).toBe('2.9.0')\n })\n\n it('should return an explicit version when it exists on the registry', async () => {\n mockRegistry({ distTags: { latest: '2.9.0' }, validVersions: ['3.1.0'] })\n\n const version = await resolvePackageVersion({ packageName: 'payload', versionOrTag: '3.1.0' })\n\n expect(version).toBe('3.1.0')\n })\n\n it('should throw a clear error when neither a tag nor a version is found', async () => {\n mockRegistry({ distTags: { latest: '2.9.0' } })\n\n await expect(\n resolvePackageVersion({ packageName: 'payload', versionOrTag: 'nope' }),\n ).rejects.toThrow('No version or tag \"nope\" found for package: payload')\n })\n})\n\ndescribe('DEFAULT_PAYLOAD_VERSION_TAG', () => {\n it('should export DEFAULT_PAYLOAD_VERSION_TAG as \"canary\"', () => {\n expect(DEFAULT_PAYLOAD_VERSION_TAG).toBe('canary')\n })\n})\n"],"names":["afterEach","describe","expect","it","vi","DEFAULT_PAYLOAD_VERSION_TAG","resolvePackageVersion","mockRegistry","distTags","validVersions","stubGlobal","fn","url","endsWith","Promise","resolve","json","version","split","pop","status","includes","unstubAllGlobals","restoreAllMocks","canary","latest","packageName","versionOrTag","toBe","rejects","toThrow"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,SAAQ;AAE5D,SAASC,2BAA2B,EAAEC,qBAAqB,QAAQ,6BAA4B;AAE/F,MAAMC,eAAe,CAAC,EACpBC,QAAQ,EACRC,gBAAgB,EAAE,EAInB,GACCL,GAAGM,UAAU,CACX,SACAN,GAAGO,EAAE,CAAC,CAACC;QACL,IAAIA,IAAIC,QAAQ,CAAC,eAAe;YAC9B,OAAOC,QAAQC,OAAO,CAAC;gBAAEC,MAAM,IAAMF,QAAQC,OAAO,CAACP;YAAU;QACjE;QAEA,MAAMS,UAAUL,IAAIM,KAAK,CAAC,KAAKC,GAAG,MAAM;QACxC,OAAOL,QAAQC,OAAO,CAAC;YAAEK,QAAQX,cAAcY,QAAQ,CAACJ,WAAW,MAAM;QAAI;IAC/E;AAGJhB,SAAS,yBAAyB;IAChCD,UAAU;QACRI,GAAGkB,gBAAgB;QACnBlB,GAAGmB,eAAe;IACpB;IAEApB,GAAG,qDAAqD;QACtDI,aAAa;YAAEC,UAAU;gBAAEgB,QAAQ;gBAAoBC,QAAQ;YAAQ;QAAE;QAEzE,MAAMR,UAAU,MAAMX,sBAAsB;YAAEoB,aAAa;YAAWC,cAAc;QAAS;QAE7FzB,OAAOe,SAASW,IAAI,CAAC;IACvB;IAEAzB,GAAG,8DAA8D;QAC/DI,aAAa;YAAEC,UAAU;gBAAEgB,QAAQ;gBAAoBC,QAAQ;YAAQ;QAAE;QAEzE,MAAMR,UAAU,MAAMX,sBAAsB;YAAEoB,aAAa;QAAU;QAErExB,OAAOe,SAASW,IAAI,CAAC;IACvB;IAEAzB,GAAG,oEAAoE;QACrEI,aAAa;YAAEC,UAAU;gBAAEiB,QAAQ;YAAQ;YAAGhB,eAAe;gBAAC;aAAQ;QAAC;QAEvE,MAAMQ,UAAU,MAAMX,sBAAsB;YAAEoB,aAAa;YAAWC,cAAc;QAAQ;QAE5FzB,OAAOe,SAASW,IAAI,CAAC;IACvB;IAEAzB,GAAG,wEAAwE;QACzEI,aAAa;YAAEC,UAAU;gBAAEiB,QAAQ;YAAQ;QAAE;QAE7C,MAAMvB,OACJI,sBAAsB;YAAEoB,aAAa;YAAWC,cAAc;QAAO,IACrEE,OAAO,CAACC,OAAO,CAAC;IACpB;AACF;AAEA7B,SAAS,+BAA+B;IACtCE,GAAG,yDAAyD;QAC1DD,OAAOG,6BAA6BuB,IAAI,CAAC;IAC3C;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-payload-app",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.cd69eef",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"lint": "eslint .",
|
|
81
81
|
"lint:fix": "eslint . --fix",
|
|
82
82
|
"pack-template-files": "node --no-deprecation --import @swc-node/register/esm-register src/scripts/pack-template-files.ts",
|
|
83
|
-
"test": "
|
|
83
|
+
"test": "vitest --run",
|
|
84
84
|
"typecheck": "tsc"
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetches the latest version of a package from the NPM registry.
|
|
3
|
-
*
|
|
4
|
-
* Used in determining the latest version of Payload to use in the generated templates.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getLatestPackageVersion({ debug, packageName, }: {
|
|
7
|
-
debug?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Package name to fetch the latest version for based on the NPM registry URL
|
|
10
|
-
*
|
|
11
|
-
* Eg. for `'payload'`, it will fetch the version from `https://registry.npmjs.org/payload`
|
|
12
|
-
*
|
|
13
|
-
* @default 'payload'
|
|
14
|
-
*/
|
|
15
|
-
packageName?: string;
|
|
16
|
-
}): Promise<string>;
|
|
17
|
-
//# sourceMappingURL=getLatestPackageVersion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getLatestPackageVersion.d.ts","sourceRoot":"","sources":["../../src/utils/getLatestPackageVersion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,KAAa,EACb,WAAuB,GACxB,EAAE;IACD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,mBAeA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetches the latest version of a package from the NPM registry.
|
|
3
|
-
*
|
|
4
|
-
* Used in determining the latest version of Payload to use in the generated templates.
|
|
5
|
-
*/ export async function getLatestPackageVersion({ debug = false, packageName = 'payload' }) {
|
|
6
|
-
try {
|
|
7
|
-
const response = await fetch(`https://registry.npmjs.org/${packageName}`);
|
|
8
|
-
const data = await response.json();
|
|
9
|
-
const latestVersion = data['dist-tags'].latest;
|
|
10
|
-
if (debug) {
|
|
11
|
-
console.log(`Found latest version of ${packageName}: ${latestVersion}`);
|
|
12
|
-
}
|
|
13
|
-
return latestVersion;
|
|
14
|
-
} catch (error) {
|
|
15
|
-
console.error('Error fetching Payload version:', error);
|
|
16
|
-
throw error;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=getLatestPackageVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/getLatestPackageVersion.ts"],"sourcesContent":["/**\n * Fetches the latest version of a package from the NPM registry.\n *\n * Used in determining the latest version of Payload to use in the generated templates.\n */\nexport async function getLatestPackageVersion({\n debug = false,\n packageName = 'payload',\n}: {\n debug?: boolean\n /**\n * Package name to fetch the latest version for based on the NPM registry URL\n *\n * Eg. for `'payload'`, it will fetch the version from `https://registry.npmjs.org/payload`\n *\n * @default 'payload'\n */\n packageName?: string\n}) {\n try {\n const response = await fetch(`https://registry.npmjs.org/${packageName}`)\n const data = (await response.json()) as { 'dist-tags': { latest: string } }\n const latestVersion = data['dist-tags'].latest\n\n if (debug) {\n console.log(`Found latest version of ${packageName}: ${latestVersion}`)\n }\n\n return latestVersion\n } catch (error) {\n console.error('Error fetching Payload version:', error)\n throw error\n }\n}\n"],"names":["getLatestPackageVersion","debug","packageName","response","fetch","data","json","latestVersion","latest","console","log","error"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,eAAeA,wBAAwB,EAC5CC,QAAQ,KAAK,EACbC,cAAc,SAAS,EAWxB;IACC,IAAI;QACF,MAAMC,WAAW,MAAMC,MAAM,CAAC,2BAA2B,EAAEF,aAAa;QACxE,MAAMG,OAAQ,MAAMF,SAASG,IAAI;QACjC,MAAMC,gBAAgBF,IAAI,CAAC,YAAY,CAACG,MAAM;QAE9C,IAAIP,OAAO;YACTQ,QAAQC,GAAG,CAAC,CAAC,wBAAwB,EAAER,YAAY,EAAE,EAAEK,eAAe;QACxE;QAEA,OAAOA;IACT,EAAE,OAAOI,OAAO;QACdF,QAAQE,KAAK,CAAC,mCAAmCA;QACjD,MAAMA;IACR;AACF"}
|