@embeddable.com/sdk-core 3.14.0-next.6 → 3.14.0
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/lib/index.esm.js +30 -11
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +22492 -0
- package/lib/index.js.map +1 -0
- package/package.json +2 -2
- package/src/build.ts +7 -0
- package/src/push.ts +25 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embeddable.com/sdk-core",
|
|
3
|
-
"version": "3.14.0
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"embeddable",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@embeddable.com/sdk-utils": "0.8.0
|
|
43
|
+
"@embeddable.com/sdk-utils": "0.8.0",
|
|
44
44
|
"@inquirer/prompts": "^7.2.1",
|
|
45
45
|
"@stencil/core": "^4.23.0",
|
|
46
46
|
"@swc-node/register": "^1.10.9",
|
package/src/build.ts
CHANGED
|
@@ -25,6 +25,13 @@ export default async () => {
|
|
|
25
25
|
removeBuildSuccessFlag();
|
|
26
26
|
const config = await provideConfig();
|
|
27
27
|
|
|
28
|
+
if (!config.plugins.length) {
|
|
29
|
+
console.warn(
|
|
30
|
+
"⚠️ No plugins found in your embeddable.config file. Example: https://github.com/embeddable-hq/vanilla-components/blob/main/embeddable.config.js#L5",
|
|
31
|
+
);
|
|
32
|
+
process.exit(0);
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
await validate(config);
|
|
29
36
|
|
|
30
37
|
await prepare(config);
|
package/src/push.ts
CHANGED
|
@@ -31,20 +31,33 @@ export default async () => {
|
|
|
31
31
|
checkNodeVersion();
|
|
32
32
|
breadcrumbs.push("checkNodeVersion");
|
|
33
33
|
const isBuildSuccess = await checkBuildSuccess();
|
|
34
|
-
|
|
34
|
+
const config = await provideConfig();
|
|
35
|
+
|
|
36
|
+
if (!isBuildSuccess && config.pushComponents) {
|
|
35
37
|
console.error(
|
|
36
38
|
"Build failed or not completed. Please run `embeddable:build` first.",
|
|
37
39
|
);
|
|
38
40
|
process.exit(1);
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
const config = await provideConfig();
|
|
42
|
-
|
|
43
43
|
if (process.argv.includes("--api-key") || process.argv.includes("-k")) {
|
|
44
44
|
spinnerPushing = ora("Using API key...").start();
|
|
45
45
|
breadcrumbs.push("push by api key");
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
try {
|
|
47
|
+
await pushByApiKey(config, spinnerPushing);
|
|
48
|
+
} catch (error: any) {
|
|
49
|
+
if (error.response?.data?.errorCode === "BUILDER-998") {
|
|
50
|
+
spinnerPushing.fail(
|
|
51
|
+
`Authentication failure. Server responded with: "${error.response?.data?.errorMessage}". Ensure that your API key is valid for the region specified in the embeddable.config.ts|js file.
|
|
52
|
+
You are trying to push to the following app url: ${config.previewBaseUrl}
|
|
53
|
+
Read more about deployment regions at https://docs.embeddable.com/deployment/deployment-regions`,
|
|
54
|
+
);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
spinnerPushing.fail("Publishing failed");
|
|
58
|
+
console.log(error.response?.data || error);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
48
61
|
publishedSectionFeedback(config, spinnerPushing);
|
|
49
62
|
spinnerPushing.succeed("Published using API key");
|
|
50
63
|
|
|
@@ -127,11 +140,13 @@ async function pushByApiKey(config: ResolvedEmbeddableConfig, spinner: any) {
|
|
|
127
140
|
}
|
|
128
141
|
|
|
129
142
|
async function verify(ctx: ResolvedEmbeddableConfig) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
143
|
+
if (ctx.pushComponents) {
|
|
144
|
+
try {
|
|
145
|
+
await fs.access(ctx.client.buildDir);
|
|
146
|
+
} catch (_e) {
|
|
147
|
+
console.error("No embeddable build was produced.");
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
135
150
|
}
|
|
136
151
|
|
|
137
152
|
// TODO: initiate login if no/invalid token.
|