@embeddable.com/sdk-core 4.0.1 → 4.0.2-next.1
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/defineConfig.d.ts +2 -0
- package/lib/index.esm.js +16 -14
- package/lib/index.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/defineConfig.test.ts +1 -0
- package/src/defineConfig.ts +12 -1
- package/src/dev.ts +5 -4
- package/src/generate.test.ts +6 -5
- package/src/generate.ts +10 -12
- package/src/prepare.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embeddable.com/sdk-core",
|
|
3
|
-
"version": "4.0.1",
|
|
3
|
+
"version": "4.0.2-next.1",
|
|
4
4
|
"description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"embeddable",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@embeddable.com/core": "2.10.
|
|
44
|
-
"@embeddable.com/sdk-utils": "0.8.
|
|
43
|
+
"@embeddable.com/core": "2.10.7-next.0",
|
|
44
|
+
"@embeddable.com/sdk-utils": "0.8.2-next.0",
|
|
45
45
|
"@inquirer/prompts": "^7.2.1",
|
|
46
46
|
"@stencil/core": "^4.23.0",
|
|
47
47
|
"@swc-node/register": "^1.10.9",
|
package/src/defineConfig.test.ts
CHANGED
|
@@ -67,6 +67,7 @@ describe("defineConfig", () => {
|
|
|
67
67
|
"stencilBuild": "/embeddable-sdk/packages/core-sdk",
|
|
68
68
|
"tmpDir": "/embeddable-sdk/packages/core-sdk",
|
|
69
69
|
"viteConfig": {},
|
|
70
|
+
"webComponentRoot": "/embeddable-sdk/packages/core-sdk",
|
|
70
71
|
},
|
|
71
72
|
"core": {
|
|
72
73
|
"configsDir": "/embeddable-sdk/packages/core-sdk",
|
package/src/defineConfig.ts
CHANGED
|
@@ -60,6 +60,7 @@ export type ResolvedEmbeddableConfig = {
|
|
|
60
60
|
buildDir: string;
|
|
61
61
|
tmpDir: string;
|
|
62
62
|
customCanvasCss: string;
|
|
63
|
+
webComponentRoot: string;
|
|
63
64
|
componentDir: string;
|
|
64
65
|
stencilBuild: string;
|
|
65
66
|
archiveFile: string;
|
|
@@ -258,7 +259,17 @@ export default (config: EmbeddableConfig) => {
|
|
|
258
259
|
buildDir: path.resolve(clientRoot, ".embeddable-build"),
|
|
259
260
|
tmpDir: path.resolve(clientRoot, ".embeddable-tmp"),
|
|
260
261
|
customCanvasCss: path.resolve(clientRoot, customCanvasCss),
|
|
261
|
-
|
|
262
|
+
webComponentRoot: path.resolve(
|
|
263
|
+
clientRoot,
|
|
264
|
+
".embeddable-build",
|
|
265
|
+
"web-component",
|
|
266
|
+
),
|
|
267
|
+
componentDir: path.resolve(
|
|
268
|
+
clientRoot,
|
|
269
|
+
".embeddable-build",
|
|
270
|
+
"web-component",
|
|
271
|
+
"component",
|
|
272
|
+
),
|
|
262
273
|
stencilBuild: path.resolve(
|
|
263
274
|
clientRoot,
|
|
264
275
|
".embeddable-build",
|
package/src/dev.ts
CHANGED
|
@@ -162,7 +162,8 @@ export default async () => {
|
|
|
162
162
|
client: {
|
|
163
163
|
...defaultConfig.client,
|
|
164
164
|
buildDir,
|
|
165
|
-
|
|
165
|
+
webComponentRoot: path.resolve(buildDir, "web-component"),
|
|
166
|
+
componentDir: path.resolve(buildDir, "web-component", "component"),
|
|
166
167
|
stencilBuild: path.resolve(buildDir, "dist", "embeddable-wrapper"),
|
|
167
168
|
tmpDir: path.resolve(
|
|
168
169
|
defaultConfig.client.rootDir,
|
|
@@ -481,7 +482,7 @@ export const sendBuildChanges = async (ctx: ResolvedEmbeddableConfig) => {
|
|
|
481
482
|
filesList = [...filesList, ...cubeAndSecurityContextFileList];
|
|
482
483
|
}
|
|
483
484
|
|
|
484
|
-
|
|
485
|
+
try {
|
|
485
486
|
const token = await getToken();
|
|
486
487
|
await archive({
|
|
487
488
|
ctx,
|
|
@@ -491,11 +492,11 @@ export const sendBuildChanges = async (ctx: ResolvedEmbeddableConfig) => {
|
|
|
491
492
|
await sendBuild(ctx, { workspaceId: previewWorkspace, token });
|
|
492
493
|
} catch (e: any) {
|
|
493
494
|
sending.fail(
|
|
494
|
-
`Data models and/or security context synchronization failed with error: ${e.response?.data?.errorMessage ?? e.message ??
|
|
495
|
+
`Data models and/or security context synchronization failed with error: ${e.response?.data?.errorMessage ?? e.message ?? "Unknown error"}`,
|
|
495
496
|
);
|
|
496
497
|
return sendMessage("dataModelsAndOrSecurityContextUpdateError");
|
|
497
498
|
}
|
|
498
|
-
|
|
499
|
+
|
|
499
500
|
sending.succeed(`Data models and/or security context synchronized`);
|
|
500
501
|
sendMessage("dataModelsAndOrSecurityContextUpdateSuccess");
|
|
501
502
|
};
|
package/src/generate.test.ts
CHANGED
|
@@ -13,6 +13,7 @@ const config = {
|
|
|
13
13
|
tmpDir: "tmpDir",
|
|
14
14
|
stencilBuild: "stencilBuild",
|
|
15
15
|
componentDir: "componentDir",
|
|
16
|
+
webComponentRoot: "webComponentRoot",
|
|
16
17
|
bundleHash: "hash",
|
|
17
18
|
componentLibraries: [],
|
|
18
19
|
},
|
|
@@ -141,7 +142,7 @@ describe("generate", () => {
|
|
|
141
142
|
|
|
142
143
|
expect(loadConfig).toHaveBeenCalledWith({
|
|
143
144
|
config: {
|
|
144
|
-
configPath: "
|
|
145
|
+
configPath: "webComponentRoot/stencil.config.ts",
|
|
145
146
|
devMode: true,
|
|
146
147
|
maxConcurrentWorkers: process.platform === "win32" ? 0 : 8,
|
|
147
148
|
minifyCss: false,
|
|
@@ -150,13 +151,13 @@ describe("generate", () => {
|
|
|
150
151
|
outputTargets: [
|
|
151
152
|
{
|
|
152
153
|
type: "dist",
|
|
154
|
+
buildDir: "buildDir/dist",
|
|
153
155
|
},
|
|
154
156
|
],
|
|
155
|
-
rootDir: "
|
|
157
|
+
rootDir: "webComponentRoot",
|
|
156
158
|
sourceMap: true,
|
|
157
|
-
srcDir: "
|
|
158
|
-
tsconfig: "
|
|
159
|
-
watchDirs: ["buildDir/buildName"],
|
|
159
|
+
srcDir: "componentDir",
|
|
160
|
+
tsconfig: "webComponentRoot/tsconfig.json",
|
|
160
161
|
},
|
|
161
162
|
initTsConfig: true,
|
|
162
163
|
logger: expect.any(Function),
|
package/src/generate.ts
CHANGED
|
@@ -43,7 +43,7 @@ async function injectCSS(
|
|
|
43
43
|
.filter((fileName) => fileName.endsWith(".css"))
|
|
44
44
|
.map(
|
|
45
45
|
(fileName) =>
|
|
46
|
-
`@import '
|
|
46
|
+
`@import '../../${ctx[pluginName].outputOptions.buildName}/${fileName}';`,
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const componentLibraries = ctx.client.componentLibraries;
|
|
@@ -76,7 +76,7 @@ async function injectBundleRender(
|
|
|
76
76
|
ctx: ResolvedEmbeddableConfig,
|
|
77
77
|
pluginName: PluginName,
|
|
78
78
|
) {
|
|
79
|
-
const importStr = `import render from '
|
|
79
|
+
const importStr = `import render from '../../${ctx[pluginName].outputOptions.buildName}/${ctx[pluginName].outputOptions.fileName}';`;
|
|
80
80
|
|
|
81
81
|
let content = await fs.readFile(
|
|
82
82
|
path.resolve(ctx.core.templatesDir, "component.tsx.template"),
|
|
@@ -137,25 +137,23 @@ async function runStencil(ctx: ResolvedEmbeddableConfig): Promise<void> {
|
|
|
137
137
|
config: {
|
|
138
138
|
devMode,
|
|
139
139
|
maxConcurrentWorkers: isWindows ? 0 : 8, // workers break on windows
|
|
140
|
-
rootDir: ctx.client.
|
|
141
|
-
configPath: path.resolve(
|
|
142
|
-
|
|
140
|
+
rootDir: ctx.client.webComponentRoot,
|
|
141
|
+
configPath: path.resolve(
|
|
142
|
+
ctx.client.webComponentRoot,
|
|
143
|
+
"stencil.config.ts",
|
|
144
|
+
),
|
|
145
|
+
tsconfig: path.resolve(ctx.client.webComponentRoot, "tsconfig.json"),
|
|
143
146
|
namespace: "embeddable-wrapper",
|
|
144
|
-
srcDir:
|
|
147
|
+
srcDir: ctx.client.componentDir,
|
|
145
148
|
sourceMap: true, // always generate source maps in both dev and prod
|
|
146
149
|
minifyJs: !devMode,
|
|
147
150
|
minifyCss: !devMode,
|
|
148
151
|
outputTargets: [
|
|
149
152
|
{
|
|
150
153
|
type: "dist",
|
|
154
|
+
buildDir: path.resolve(ctx.client.buildDir, "dist"),
|
|
151
155
|
},
|
|
152
156
|
],
|
|
153
|
-
watchDirs: [
|
|
154
|
-
path.resolve(
|
|
155
|
-
ctx.client.buildDir,
|
|
156
|
-
ctx["sdk-react"].outputOptions.buildName,
|
|
157
|
-
),
|
|
158
|
-
],
|
|
159
157
|
},
|
|
160
158
|
});
|
|
161
159
|
|
package/src/prepare.ts
CHANGED
|
@@ -22,9 +22,11 @@ export async function removeIfExists(ctx: ResolvedEmbeddableConfig) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async function copyStencilConfigsToClient(ctx: ResolvedEmbeddableConfig) {
|
|
25
|
-
await fs.cp(ctx.core.configsDir, ctx.client.
|
|
25
|
+
await fs.cp(ctx.core.configsDir, ctx.client.webComponentRoot, {
|
|
26
|
+
recursive: true,
|
|
27
|
+
});
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
async function createComponentDir(dir: string) {
|
|
29
|
-
await fs.mkdir(dir);
|
|
31
|
+
await fs.mkdir(dir, { recursive: true });
|
|
30
32
|
}
|