@jay-framework/wix-deploy 0.26.1 → 0.26.3
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/tools.d.ts +2 -3
- package/dist/tools.js +9 -39
- package/package.json +10 -10
package/dist/tools.d.ts
CHANGED
|
@@ -6,9 +6,8 @@ import { WixClientService } from '@jay-framework/wix-server-client';
|
|
|
6
6
|
/**
|
|
7
7
|
* wix-deploy setup hook
|
|
8
8
|
*
|
|
9
|
-
* Runs after wix-server-client setup
|
|
10
|
-
*
|
|
11
|
-
* then validates the data collection exists.
|
|
9
|
+
* Runs after wix-server-client setup, which owns config/.wix.yaml (API key or app strategy, DL #54).
|
|
10
|
+
* Reads wix.config.json for the deploy target, then validates the data collection exists.
|
|
12
11
|
*/
|
|
13
12
|
interface SetupContext {
|
|
14
13
|
configDir: string;
|
package/dist/tools.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path, { join } from "node:path";
|
|
3
|
-
import yaml from "js-yaml";
|
|
4
3
|
import { getService } from "@jay-framework/stack-server-runtime";
|
|
5
4
|
import { WIX_CLIENT_SERVICE } from "@jay-framework/wix-server-client";
|
|
6
5
|
import { collections, items } from "@wix/data";
|
|
@@ -25,7 +24,6 @@ async function setupWixDeploy(ctx) {
|
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
const wixConfigPath = path.join(ctx.projectRoot, "wix.config.json");
|
|
28
|
-
const wixYamlPath = path.join(ctx.configDir, ".wix.yaml");
|
|
29
27
|
if (!fs.existsSync(wixConfigPath)) {
|
|
30
28
|
return {
|
|
31
29
|
status: "needs-config",
|
|
@@ -34,7 +32,6 @@ async function setupWixDeploy(ctx) {
|
|
|
34
32
|
}
|
|
35
33
|
const wixConfig = JSON.parse(fs.readFileSync(wixConfigPath, "utf8"));
|
|
36
34
|
const appId = wixConfig.appId;
|
|
37
|
-
const siteId = wixConfig.siteId;
|
|
38
35
|
if (!appId) {
|
|
39
36
|
return {
|
|
40
37
|
status: "error",
|
|
@@ -42,43 +39,16 @@ async function setupWixDeploy(ctx) {
|
|
|
42
39
|
};
|
|
43
40
|
}
|
|
44
41
|
const configCreated = [];
|
|
45
|
-
if (fs.existsSync(wixYamlPath)) {
|
|
46
|
-
const content = fs.readFileSync(wixYamlPath, "utf8");
|
|
47
|
-
const config = yaml.load(content);
|
|
48
|
-
if (config) {
|
|
49
|
-
let changed = false;
|
|
50
|
-
const currentClientId = config.oauthStrategy?.clientId || "";
|
|
51
|
-
if (!currentClientId || currentClientId.startsWith("<")) {
|
|
52
|
-
if (!config.oauthStrategy) config.oauthStrategy = {};
|
|
53
|
-
config.oauthStrategy.clientId = appId;
|
|
54
|
-
changed = true;
|
|
55
|
-
configCreated.push("clientId");
|
|
56
|
-
}
|
|
57
|
-
const currentSiteId = config.apiKeyStrategy?.siteId || "";
|
|
58
|
-
if (siteId && (!currentSiteId || currentSiteId.startsWith("<"))) {
|
|
59
|
-
if (!config.apiKeyStrategy) config.apiKeyStrategy = {};
|
|
60
|
-
config.apiKeyStrategy.siteId = siteId;
|
|
61
|
-
changed = true;
|
|
62
|
-
configCreated.push("siteId");
|
|
63
|
-
}
|
|
64
|
-
if (changed) {
|
|
65
|
-
fs.writeFileSync(wixYamlPath, yaml.dump(config, { lineWidth: -1 }), "utf8");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (fs.existsSync(wixYamlPath)) {
|
|
70
|
-
const config = yaml.load(fs.readFileSync(wixYamlPath, "utf8"));
|
|
71
|
-
const apiKey = config?.apiKeyStrategy?.apiKey || "";
|
|
72
|
-
if (!apiKey || apiKey.startsWith("<")) {
|
|
73
|
-
return {
|
|
74
|
-
status: "needs-config",
|
|
75
|
-
configCreated,
|
|
76
|
-
message: "API key required — create one at https://manage.wix.com/ and add to config/.wix.yaml"
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
42
|
let collectionOk = false;
|
|
81
|
-
|
|
43
|
+
let wixClient;
|
|
44
|
+
try {
|
|
45
|
+
wixClient = getService(WIX_CLIENT_SERVICE);
|
|
46
|
+
} catch {
|
|
47
|
+
return {
|
|
48
|
+
status: "needs-config",
|
|
49
|
+
message: "Wix client not available. Run setup for wix-server-client first."
|
|
50
|
+
};
|
|
51
|
+
}
|
|
82
52
|
if (wixClient) {
|
|
83
53
|
const dataClient = wixClient.use({ items, collections });
|
|
84
54
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/wix-deploy",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Wix BaaS deployment adapter for Jay Framework — WixDataArtifactStore and entry builder",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,23 +42,23 @@
|
|
|
42
42
|
"test": "vitest run"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@jay-framework/fullstack-component": "^0.26.
|
|
46
|
-
"@jay-framework/production-server": "^0.26.
|
|
47
|
-
"@jay-framework/stack-server-runtime": "^0.26.
|
|
48
|
-
"@jay-framework/wix-server-client": "^0.26.
|
|
45
|
+
"@jay-framework/fullstack-component": "^0.26.3",
|
|
46
|
+
"@jay-framework/production-server": "^0.26.3",
|
|
47
|
+
"@jay-framework/stack-server-runtime": "^0.26.3",
|
|
48
|
+
"@jay-framework/wix-server-client": "^0.26.3",
|
|
49
49
|
"@wix/data": "^1.0.433",
|
|
50
50
|
"@wix/sdk": "^1.21.5",
|
|
51
51
|
"esbuild": "^0.21.0",
|
|
52
52
|
"js-yaml": "^4.1.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@jay-framework/compiler-jay-html": "^0.26.
|
|
56
|
-
"@jay-framework/compiler-shared": "^0.26.
|
|
55
|
+
"@jay-framework/compiler-jay-html": "^0.26.3",
|
|
56
|
+
"@jay-framework/compiler-shared": "^0.26.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@jay-framework/compiler-jay-html": "^0.26.
|
|
60
|
-
"@jay-framework/compiler-shared": "^0.26.
|
|
61
|
-
"@jay-framework/jay-stack-cli": "^0.26.
|
|
59
|
+
"@jay-framework/compiler-jay-html": "^0.26.3",
|
|
60
|
+
"@jay-framework/compiler-shared": "^0.26.3",
|
|
61
|
+
"@jay-framework/jay-stack-cli": "^0.26.3",
|
|
62
62
|
"tsup": "^8.0.0",
|
|
63
63
|
"typescript": "^5.3.3",
|
|
64
64
|
"vite": "^6.4.4",
|