eddev 0.2.0-beta.16 → 0.2.0-beta.17
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.
|
@@ -65,15 +65,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
65
65
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
69
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
70
|
-
if (ar || !(i in from)) {
|
|
71
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
72
|
-
ar[i] = from[i];
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
76
|
-
};
|
|
77
68
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
78
69
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
79
70
|
};
|
|
@@ -96,7 +87,7 @@ function requireConfig(dir) {
|
|
|
96
87
|
function createNextApp(opts) {
|
|
97
88
|
var _a;
|
|
98
89
|
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
-
var isVercel, serverlessDirectory, sendSignal, repoName, port;
|
|
90
|
+
var isVercel, serverlessDirectory, sendSignal, repoName, assetPaths, port;
|
|
100
91
|
return __generator(this, function (_b) {
|
|
101
92
|
switch (_b.label) {
|
|
102
93
|
case 0:
|
|
@@ -124,9 +115,10 @@ function createNextApp(opts) {
|
|
|
124
115
|
_b.sent();
|
|
125
116
|
_b.label = 5;
|
|
126
117
|
case 5:
|
|
127
|
-
|
|
118
|
+
assetPaths = ((_a = requireConfig(opts.baseDirectory).serverless) === null || _a === void 0 ? void 0 : _a.themeAssets) || [];
|
|
119
|
+
if (!!isVercel) return [3 /*break*/, 11];
|
|
128
120
|
// Sync important files during development, as they change
|
|
129
|
-
return [4 /*yield*/, syncFiles(opts.baseDirectory, serverlessDirectory,
|
|
121
|
+
return [4 /*yield*/, syncFiles(opts.baseDirectory, serverlessDirectory, [
|
|
130
122
|
"blocks/**/*",
|
|
131
123
|
"components/**/*",
|
|
132
124
|
"hooks/**/*",
|
|
@@ -138,8 +130,8 @@ function createNextApp(opts) {
|
|
|
138
130
|
"types.views.ts",
|
|
139
131
|
"types.blocks.ts",
|
|
140
132
|
"utils/**/*",
|
|
141
|
-
"ed.config.json"
|
|
142
|
-
]
|
|
133
|
+
"ed.config.json",
|
|
134
|
+
])
|
|
143
135
|
// Also sync APIs into the APIs folder
|
|
144
136
|
];
|
|
145
137
|
case 6:
|
|
@@ -147,45 +139,57 @@ function createNextApp(opts) {
|
|
|
147
139
|
_b.sent();
|
|
148
140
|
// Also sync APIs into the APIs folder
|
|
149
141
|
return [4 /*yield*/, syncFiles(opts.baseDirectory, (0, path_1.join)(serverlessDirectory, "pages/"), ["api/**/*"])
|
|
150
|
-
//
|
|
142
|
+
// Sync the public folder
|
|
151
143
|
];
|
|
152
144
|
case 7:
|
|
153
145
|
// Also sync APIs into the APIs folder
|
|
154
146
|
_b.sent();
|
|
155
|
-
|
|
156
|
-
return [4 /*yield*/, syncFiles(
|
|
157
|
-
// Sync favicon
|
|
158
|
-
];
|
|
147
|
+
if (!assetPaths.length) return [3 /*break*/, 9];
|
|
148
|
+
return [4 /*yield*/, syncFiles(opts.baseDirectory, (0, path_1.join)(serverlessDirectory, "public/wp-content/themes/".concat(repoName.repoName)), assetPaths)];
|
|
159
149
|
case 8:
|
|
160
|
-
// And public folder
|
|
161
150
|
_b.sent();
|
|
151
|
+
_b.label = 9;
|
|
152
|
+
case 9:
|
|
153
|
+
// Sync favicon
|
|
154
|
+
return [4 /*yield*/, syncFiles((0, path_1.join)(opts.baseDirectory), (0, path_1.join)(serverlessDirectory, "public/"), ["favicon.ico"])];
|
|
155
|
+
case 10:
|
|
162
156
|
// Sync favicon
|
|
163
|
-
|
|
164
|
-
|
|
157
|
+
_b.sent();
|
|
158
|
+
return [3 /*break*/, 15];
|
|
159
|
+
case 11:
|
|
160
|
+
if (!assetPaths.length) return [3 /*break*/, 13];
|
|
161
|
+
return [4 /*yield*/, copyFiles(opts.baseDirectory, (0, path_1.join)(serverlessDirectory, "public/wp-content/themes/".concat(repoName.repoName)), assetPaths)];
|
|
162
|
+
case 12:
|
|
163
|
+
_b.sent();
|
|
164
|
+
_b.label = 13;
|
|
165
|
+
case 13:
|
|
166
|
+
// Sync favicon
|
|
167
|
+
return [4 /*yield*/, copyFiles((0, path_1.join)(opts.baseDirectory), (0, path_1.join)(serverlessDirectory, "public/"), ["favicon.ico"])];
|
|
168
|
+
case 14:
|
|
165
169
|
// Sync favicon
|
|
166
170
|
_b.sent();
|
|
167
|
-
_b.label =
|
|
168
|
-
case
|
|
169
|
-
if (!!isVercel) return [3 /*break*/,
|
|
171
|
+
_b.label = 15;
|
|
172
|
+
case 15:
|
|
173
|
+
if (!!isVercel) return [3 /*break*/, 17];
|
|
170
174
|
sendSignal({ code: "packaging" });
|
|
171
175
|
return [4 /*yield*/, updatePackages(serverlessDirectory)];
|
|
172
|
-
case
|
|
176
|
+
case 16:
|
|
173
177
|
_b.sent();
|
|
174
|
-
_b.label =
|
|
175
|
-
case
|
|
178
|
+
_b.label = 17;
|
|
179
|
+
case 17:
|
|
176
180
|
sendSignal({ code: "compiling" });
|
|
177
181
|
// Create manifests
|
|
178
182
|
return [4 /*yield*/, initManifests(serverlessDirectory, opts.dev)
|
|
179
183
|
// Start
|
|
180
184
|
];
|
|
181
|
-
case
|
|
185
|
+
case 18:
|
|
182
186
|
// Create manifests
|
|
183
187
|
_b.sent();
|
|
184
|
-
if (!opts.dev) return [3 /*break*/,
|
|
188
|
+
if (!opts.dev) return [3 /*break*/, 21];
|
|
185
189
|
return [4 /*yield*/, getPort(3000)
|
|
186
190
|
// Write the endpoint URL to .env
|
|
187
191
|
];
|
|
188
|
-
case
|
|
192
|
+
case 19:
|
|
189
193
|
port = _b.sent();
|
|
190
194
|
// Write the endpoint URL to .env
|
|
191
195
|
(0, updateEnvFile_1.updateEnvFile)({
|
|
@@ -194,17 +198,17 @@ function createNextApp(opts) {
|
|
|
194
198
|
sendSignal({ code: "url", url: "http://127.0.0.1:".concat(port) });
|
|
195
199
|
// await devNext(serverlessDirectory, port)
|
|
196
200
|
return [4 /*yield*/, runScript(serverlessDirectory, ["dev", "--port", String(port)])];
|
|
197
|
-
case
|
|
201
|
+
case 20:
|
|
198
202
|
// await devNext(serverlessDirectory, port)
|
|
199
203
|
_b.sent();
|
|
200
|
-
return [3 /*break*/,
|
|
201
|
-
case
|
|
202
|
-
if (!opts.build) return [3 /*break*/,
|
|
204
|
+
return [3 /*break*/, 23];
|
|
205
|
+
case 21:
|
|
206
|
+
if (!opts.build) return [3 /*break*/, 23];
|
|
203
207
|
return [4 /*yield*/, runScript(serverlessDirectory, ["build"])];
|
|
204
|
-
case
|
|
208
|
+
case 22:
|
|
205
209
|
_b.sent();
|
|
206
|
-
_b.label =
|
|
207
|
-
case
|
|
210
|
+
_b.label = 23;
|
|
211
|
+
case 23: return [2 /*return*/];
|
|
208
212
|
}
|
|
209
213
|
});
|
|
210
214
|
});
|
|
@@ -288,6 +292,20 @@ function updatePackagesFile(sourceFolder, targetFolder) {
|
|
|
288
292
|
});
|
|
289
293
|
});
|
|
290
294
|
}
|
|
295
|
+
function copyFiles(sourceFolder, targetFolder, patterns) {
|
|
296
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
297
|
+
var files;
|
|
298
|
+
return __generator(this, function (_a) {
|
|
299
|
+
switch (_a.label) {
|
|
300
|
+
case 0: return [4 /*yield*/, Promise.all(patterns.map(function (pattern) { return (0, glob_promise_1.default)((0, path_1.resolve)(sourceFolder, pattern)); }))];
|
|
301
|
+
case 1:
|
|
302
|
+
files = (_a.sent()).flat();
|
|
303
|
+
console.log("Files are", files);
|
|
304
|
+
return [2 /*return*/];
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
}
|
|
291
309
|
function syncFiles(sourceFolder, targetFolder, patterns) {
|
|
292
310
|
return __awaiter(this, void 0, void 0, function () {
|
|
293
311
|
var _this = this;
|
|
@@ -401,17 +419,17 @@ function initManifests(dir, dev) {
|
|
|
401
419
|
function getPort(port) {
|
|
402
420
|
if (port === void 0) { port = 3000; }
|
|
403
421
|
return __awaiter(this, void 0, void 0, function () {
|
|
404
|
-
var createServer
|
|
422
|
+
var createServer;
|
|
405
423
|
var _this = this;
|
|
406
424
|
return __generator(this, function (_a) {
|
|
407
425
|
switch (_a.label) {
|
|
408
426
|
case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("http")); })];
|
|
409
427
|
case 1:
|
|
410
428
|
createServer = (_a.sent()).createServer;
|
|
411
|
-
for (p = port; p < port + 100; p++) { }
|
|
412
429
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
413
430
|
var server = createServer();
|
|
414
|
-
server.listen(port,
|
|
431
|
+
server.listen(port, "127.0.0.1");
|
|
432
|
+
server.on("listening", function () {
|
|
415
433
|
server.once("close", function () {
|
|
416
434
|
resolve(port);
|
|
417
435
|
});
|
|
@@ -6,48 +6,48 @@ export declare const EDConfigSchema: z.ZodObject<{
|
|
|
6
6
|
uploads: z.ZodEnum<["proxy", "remote"]>;
|
|
7
7
|
plugins: z.ZodEnum<["proxy", "remote"]>;
|
|
8
8
|
theme: z.ZodEnum<["proxy", "copy", "remote"]>;
|
|
9
|
-
|
|
9
|
+
themeAssets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
10
|
apiOnly: z.ZodOptional<z.ZodBoolean>;
|
|
11
11
|
endpoints: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
12
12
|
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
|
|
13
|
+
themeAssets?: string[] | undefined;
|
|
14
14
|
apiOnly?: boolean | undefined;
|
|
15
15
|
enabled: boolean;
|
|
16
16
|
uploads: "proxy" | "remote";
|
|
17
17
|
plugins: "proxy" | "remote";
|
|
18
|
-
theme: "
|
|
18
|
+
theme: "proxy" | "remote" | "copy";
|
|
19
19
|
endpoints: Record<string, string>;
|
|
20
20
|
}, {
|
|
21
|
-
|
|
21
|
+
themeAssets?: string[] | undefined;
|
|
22
22
|
apiOnly?: boolean | undefined;
|
|
23
23
|
enabled: boolean;
|
|
24
24
|
uploads: "proxy" | "remote";
|
|
25
25
|
plugins: "proxy" | "remote";
|
|
26
|
-
theme: "
|
|
26
|
+
theme: "proxy" | "remote" | "copy";
|
|
27
27
|
endpoints: Record<string, string>;
|
|
28
28
|
}>>;
|
|
29
29
|
devUI: z.ZodEnum<["disabled", "enabled"]>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
$schema?: string | undefined;
|
|
32
32
|
serverless?: {
|
|
33
|
-
|
|
33
|
+
themeAssets?: string[] | undefined;
|
|
34
34
|
apiOnly?: boolean | undefined;
|
|
35
35
|
enabled: boolean;
|
|
36
36
|
uploads: "proxy" | "remote";
|
|
37
37
|
plugins: "proxy" | "remote";
|
|
38
|
-
theme: "
|
|
38
|
+
theme: "proxy" | "remote" | "copy";
|
|
39
39
|
endpoints: Record<string, string>;
|
|
40
40
|
} | undefined;
|
|
41
41
|
devUI: "disabled" | "enabled";
|
|
42
42
|
}, {
|
|
43
43
|
$schema?: string | undefined;
|
|
44
44
|
serverless?: {
|
|
45
|
-
|
|
45
|
+
themeAssets?: string[] | undefined;
|
|
46
46
|
apiOnly?: boolean | undefined;
|
|
47
47
|
enabled: boolean;
|
|
48
48
|
uploads: "proxy" | "remote";
|
|
49
49
|
plugins: "proxy" | "remote";
|
|
50
|
-
theme: "
|
|
50
|
+
theme: "proxy" | "remote" | "copy";
|
|
51
51
|
endpoints: Record<string, string>;
|
|
52
52
|
} | undefined;
|
|
53
53
|
devUI: "disabled" | "enabled";
|
package/config/config-schema.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.EDConfigSchema = zod_1.z.object({
|
|
|
10
10
|
uploads: zod_1.z.enum(["proxy", "remote"]),
|
|
11
11
|
plugins: zod_1.z.enum(["proxy", "remote"]),
|
|
12
12
|
theme: zod_1.z.enum(["proxy", "copy", "remote"]),
|
|
13
|
-
|
|
13
|
+
themeAssets: zod_1.z.array(zod_1.z.string()).optional(),
|
|
14
14
|
apiOnly: zod_1.z.boolean().optional(),
|
|
15
15
|
endpoints: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
|
|
16
16
|
})
|
package/config/get-config.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
export declare function getEDConfig(dir?: string): import("zod").SafeParseReturnType<{
|
|
2
2
|
$schema?: string | undefined;
|
|
3
3
|
serverless?: {
|
|
4
|
-
|
|
4
|
+
themeAssets?: string[] | undefined;
|
|
5
5
|
apiOnly?: boolean | undefined;
|
|
6
6
|
enabled: boolean;
|
|
7
7
|
uploads: "proxy" | "remote";
|
|
8
8
|
plugins: "proxy" | "remote";
|
|
9
|
-
theme: "
|
|
9
|
+
theme: "proxy" | "remote" | "copy";
|
|
10
10
|
endpoints: Record<string, string>;
|
|
11
11
|
} | undefined;
|
|
12
12
|
devUI: "disabled" | "enabled";
|
|
13
13
|
}, {
|
|
14
14
|
$schema?: string | undefined;
|
|
15
15
|
serverless?: {
|
|
16
|
-
|
|
16
|
+
themeAssets?: string[] | undefined;
|
|
17
17
|
apiOnly?: boolean | undefined;
|
|
18
18
|
enabled: boolean;
|
|
19
19
|
uploads: "proxy" | "remote";
|
|
20
20
|
plugins: "proxy" | "remote";
|
|
21
|
-
theme: "
|
|
21
|
+
theme: "proxy" | "remote" | "copy";
|
|
22
22
|
endpoints: Record<string, string>;
|
|
23
23
|
} | undefined;
|
|
24
24
|
devUI: "disabled" | "enabled";
|
|
@@ -26,12 +26,12 @@ export declare function getEDConfig(dir?: string): import("zod").SafeParseReturn
|
|
|
26
26
|
export declare function getEDConfigUnwrapped(dir?: string): {
|
|
27
27
|
$schema?: string | undefined;
|
|
28
28
|
serverless?: {
|
|
29
|
-
|
|
29
|
+
themeAssets?: string[] | undefined;
|
|
30
30
|
apiOnly?: boolean | undefined;
|
|
31
31
|
enabled: boolean;
|
|
32
32
|
uploads: "proxy" | "remote";
|
|
33
33
|
plugins: "proxy" | "remote";
|
|
34
|
-
theme: "
|
|
34
|
+
theme: "proxy" | "remote" | "copy";
|
|
35
35
|
endpoints: Record<string, string>;
|
|
36
36
|
} | undefined;
|
|
37
37
|
devUI: "disabled" | "enabled";
|
package/config/parse-config.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
export declare function parseConfig(config: any): import("zod").SafeParseReturnType<{
|
|
2
2
|
$schema?: string | undefined;
|
|
3
3
|
serverless?: {
|
|
4
|
-
|
|
4
|
+
themeAssets?: string[] | undefined;
|
|
5
5
|
apiOnly?: boolean | undefined;
|
|
6
6
|
enabled: boolean;
|
|
7
7
|
uploads: "proxy" | "remote";
|
|
8
8
|
plugins: "proxy" | "remote";
|
|
9
|
-
theme: "
|
|
9
|
+
theme: "proxy" | "remote" | "copy";
|
|
10
10
|
endpoints: Record<string, string>;
|
|
11
11
|
} | undefined;
|
|
12
12
|
devUI: "disabled" | "enabled";
|
|
13
13
|
}, {
|
|
14
14
|
$schema?: string | undefined;
|
|
15
15
|
serverless?: {
|
|
16
|
-
|
|
16
|
+
themeAssets?: string[] | undefined;
|
|
17
17
|
apiOnly?: boolean | undefined;
|
|
18
18
|
enabled: boolean;
|
|
19
19
|
uploads: "proxy" | "remote";
|
|
20
20
|
plugins: "proxy" | "remote";
|
|
21
|
-
theme: "
|
|
21
|
+
theme: "proxy" | "remote" | "copy";
|
|
22
22
|
endpoints: Record<string, string>;
|
|
23
23
|
} | undefined;
|
|
24
24
|
devUI: "disabled" | "enabled";
|