@justanarthur/payload-www 1.2.1 → 1.2.2
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/dist/cli.js +3 -38
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -80,41 +80,13 @@ async function generateAsyncImportmap(config, options) {
|
|
|
80
80
|
|
|
81
81
|
// src/cli/index.ts
|
|
82
82
|
register();
|
|
83
|
-
function printHelp() {
|
|
84
|
-
console.log(`payload-www generate:async-importmap
|
|
85
|
-
|
|
86
|
-
Generate an async-importMap.ts containing only the render-path dependencies
|
|
87
|
-
(blocks + collection/global renderers) used by the public render path.
|
|
88
|
-
|
|
89
|
-
Usage:
|
|
90
|
-
payload-www generate:async-importmap --config-path <path> --output <path>
|
|
91
|
-
|
|
92
|
-
Options:
|
|
93
|
-
--config-path <path> Path to the Payload config file (TS or JS).
|
|
94
|
-
Resolved relative to the current working directory.
|
|
95
|
-
--output <path> Output file path. Created if missing.
|
|
96
|
-
--package-name <name> Custom-package key for the render-dependency lookup.
|
|
97
|
-
Defaults to "@justanarthur/payload-www".
|
|
98
|
-
--help, -h Show this help.
|
|
99
|
-
|
|
100
|
-
Example:
|
|
101
|
-
payload-www generate:async-importmap \\
|
|
102
|
-
--config-path apps/www/payload.config.ts \\
|
|
103
|
-
--output apps/www/app/\\(payload\\)/admin/asyncImportMap.ts
|
|
104
|
-
`);
|
|
105
|
-
}
|
|
106
83
|
function parseArgs(argv) {
|
|
107
84
|
const args = {
|
|
108
85
|
configPath: "",
|
|
109
|
-
output: ""
|
|
110
|
-
help: false
|
|
86
|
+
output: ""
|
|
111
87
|
};
|
|
112
88
|
for (let i = 0;i < argv.length; i++) {
|
|
113
89
|
const a = argv[i];
|
|
114
|
-
if (a === "--help" || a === "-h") {
|
|
115
|
-
args.help = true;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
90
|
if (a === "--config-path") {
|
|
119
91
|
args.configPath = argv[++i] ?? "";
|
|
120
92
|
continue;
|
|
@@ -144,14 +116,8 @@ function parseArgs(argv) {
|
|
|
144
116
|
}
|
|
145
117
|
async function main() {
|
|
146
118
|
const args = parseArgs(process.argv.slice(2));
|
|
147
|
-
if (args.help) {
|
|
148
|
-
printHelp();
|
|
149
|
-
process.exit(0);
|
|
150
|
-
}
|
|
151
119
|
if (!args.configPath || !args.output) {
|
|
152
|
-
console.error(
|
|
153
|
-
`);
|
|
154
|
-
printHelp();
|
|
120
|
+
console.error("[payload-www] --config-path and --output are required.");
|
|
155
121
|
process.exit(1);
|
|
156
122
|
}
|
|
157
123
|
const cwd = process.cwd();
|
|
@@ -178,11 +144,10 @@ async function main() {
|
|
|
178
144
|
const { writeFileSync } = await import("node:fs");
|
|
179
145
|
writeFileSync("/tmp/payload-config-dump.json", JSON.stringify(config, (k, v) => typeof v === "function" ? "[function]" : v, 2).slice(0, 200000));
|
|
180
146
|
}
|
|
181
|
-
|
|
147
|
+
await generateAsyncImportmap(config, {
|
|
182
148
|
output: path.isAbsolute(args.output) ? args.output : path.resolve(cwd, args.output),
|
|
183
149
|
...args.packageName ? { packageName: args.packageName } : {}
|
|
184
150
|
});
|
|
185
|
-
console.log(`[payload-www] wrote ${result.entries} entries to ${result.output}`);
|
|
186
151
|
}
|
|
187
152
|
main().catch((err) => {
|
|
188
153
|
console.error("[payload-www] unhandled error:");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justanarthur/payload-www",
|
|
3
3
|
"description": "Reusable Payload CMS website template — config builder, collections, globals, blocks, fields, access, hooks, metadata (JSON-LD, hreflang), page renderers, and test helpers.",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"files": [
|