@embeddable.com/sdk-core 3.14.2-next.1 → 3.14.2-next.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/lib/index.esm.js +9 -25
- package/lib/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/buildGlobalHooks.int.test.ts +3 -0
- package/src/buildGlobalHooks.ts +2 -1
- package/src/buildGlobalHooks.unit.test.ts +4 -0
- package/src/cleanup.ts +5 -0
- package/src/validate.ts +3 -24
- package/lib/index.js +0 -22492
- package/lib/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embeddable.com/sdk-core",
|
|
3
|
-
"version": "3.14.2-next.
|
|
3
|
+
"version": "3.14.2-next.2",
|
|
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/core": "2.10.
|
|
43
|
+
"@embeddable.com/core": "2.10.2-next.0",
|
|
44
44
|
"@embeddable.com/sdk-utils": "0.8.0",
|
|
45
45
|
"@inquirer/prompts": "^7.2.1",
|
|
46
46
|
"@stencil/core": "^4.23.0",
|
|
@@ -15,6 +15,7 @@ import path from "node:path";
|
|
|
15
15
|
|
|
16
16
|
const rootDir = path.resolve("fake", "root");
|
|
17
17
|
const buildDir = path.resolve("fake", "build");
|
|
18
|
+
const tmpDir = path.resolve("fake", "tmp");
|
|
18
19
|
const srcDir = path.resolve("fake", "src");
|
|
19
20
|
const lifecycleFile = path.resolve("fake", "root", "embeddable.lifecycle.ts");
|
|
20
21
|
const themFile = path.resolve("fake", "root", "embeddable.theme.ts");
|
|
@@ -91,6 +92,7 @@ describe("buildGlobalHooks (Integration Tests)", () => {
|
|
|
91
92
|
client: {
|
|
92
93
|
srcDir,
|
|
93
94
|
buildDir,
|
|
95
|
+
tmpDir,
|
|
94
96
|
rootDir,
|
|
95
97
|
lifecycleHooksFile: lifecycleFile,
|
|
96
98
|
customizationFile: themFile,
|
|
@@ -188,6 +190,7 @@ describe("buildGlobalHooks (Integration Tests)", () => {
|
|
|
188
190
|
client: {
|
|
189
191
|
srcDir,
|
|
190
192
|
buildDir,
|
|
193
|
+
tmpDir,
|
|
191
194
|
rootDir,
|
|
192
195
|
lifecycleHooksFile: lifecycleFile,
|
|
193
196
|
customizationFile: themFile,
|
package/src/buildGlobalHooks.ts
CHANGED
|
@@ -23,6 +23,7 @@ export default async (ctx: ResolvedEmbeddableConfig) => {
|
|
|
23
23
|
const progress = watch ? undefined : ora("Building global hooks...").start();
|
|
24
24
|
|
|
25
25
|
try {
|
|
26
|
+
await fs.mkdir(ctx.client.tmpDir, { recursive: true });
|
|
26
27
|
const { fileName: themeProvider, watcher: themeWatcher } =
|
|
27
28
|
await buildThemeHook(ctx);
|
|
28
29
|
const { lifecycleHooks, watcher: lifecycleWatcher } =
|
|
@@ -232,7 +233,7 @@ async function cleanupTemporaryHookFile(ctx: ResolvedEmbeddableConfig) {
|
|
|
232
233
|
* Get the path to the temporary hook file in the build directory.
|
|
233
234
|
*/
|
|
234
235
|
function getTempHookFilePath(ctx: ResolvedEmbeddableConfig): string {
|
|
235
|
-
return path.resolve(ctx.client.
|
|
236
|
+
return path.resolve(ctx.client.tmpDir, TEMP_JS_HOOK_FILE);
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
function waitForInitialBuild(watcher: RollupWatcher): Promise<void> {
|
|
@@ -70,6 +70,7 @@ describe("buildGlobalHooks (Unit Tests)", () => {
|
|
|
70
70
|
client: {
|
|
71
71
|
srcDir: path.resolve(process.cwd(), "fake", "src"),
|
|
72
72
|
buildDir: path.resolve(process.cwd(), "fake", "build"),
|
|
73
|
+
tmpDir: path.resolve(process.cwd(), "fake", "tmp"),
|
|
73
74
|
rootDir: path.resolve(process.cwd(), "fake", "root"),
|
|
74
75
|
lifecycleHooksFile: lifecyclePath,
|
|
75
76
|
componentLibraries: [],
|
|
@@ -113,6 +114,7 @@ describe("buildGlobalHooks (Unit Tests)", () => {
|
|
|
113
114
|
client: {
|
|
114
115
|
srcDir: path.resolve(process.cwd(), "fake", "src"),
|
|
115
116
|
buildDir: path.resolve(process.cwd(), "fake", "build"),
|
|
117
|
+
tmpDir: path.resolve(process.cwd(), "fake", "tmp"),
|
|
116
118
|
rootDir: path.resolve(process.cwd(), "fake", "root"),
|
|
117
119
|
lifecycleHooksFile: lifecyclePath,
|
|
118
120
|
customizationFile: themePath,
|
|
@@ -190,6 +192,7 @@ describe("buildGlobalHooks (Unit Tests)", () => {
|
|
|
190
192
|
client: {
|
|
191
193
|
srcDir: path.resolve(process.cwd(), "fake", "src"),
|
|
192
194
|
buildDir: path.resolve(process.cwd(), "fake", "build"),
|
|
195
|
+
tmpDir: path.resolve(process.cwd(), "fake", "tmp"),
|
|
193
196
|
rootDir: path.resolve(process.cwd(), "fake", "root"),
|
|
194
197
|
lifecycleHooksFile: lifecyclePath,
|
|
195
198
|
customizationFile: themePath,
|
|
@@ -242,6 +245,7 @@ describe("buildGlobalHooks (Unit Tests)", () => {
|
|
|
242
245
|
client: {
|
|
243
246
|
srcDir: path.resolve(process.cwd(), "fake", "src"),
|
|
244
247
|
buildDir: path.resolve(process.cwd(), "fake", "build"),
|
|
248
|
+
tmpDir: path.resolve(process.cwd(), "fake", "tmp"),
|
|
245
249
|
rootDir: path.resolve(process.cwd(), "fake", "root"),
|
|
246
250
|
lifecycleHooksFile: lifecyclePath,
|
|
247
251
|
customizationFile: themePath,
|
package/src/cleanup.ts
CHANGED
|
@@ -75,6 +75,11 @@ export async function createManifest({
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
async function extractBuild(ctx: ResolvedEmbeddableConfig) {
|
|
78
|
+
// Ensure tmpDir is removed before attempting to rename a directory to it.
|
|
79
|
+
// This helps prevent EPERM errors on Windows if tmpDir already exists and is non-empty
|
|
80
|
+
// from a previous failed run or other reasons.
|
|
81
|
+
await fs.rm(ctx.client.tmpDir, { recursive: true, force: true });
|
|
82
|
+
|
|
78
83
|
const stencilBuildFiles = await findFiles(
|
|
79
84
|
ctx.client.stencilBuild,
|
|
80
85
|
/embeddable-wrapper.esm-[a-z0-9]+\.js/,
|
package/src/validate.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import * as YAML from "yaml";
|
|
3
3
|
import { errorFormatter, findFiles } from "@embeddable.com/sdk-utils";
|
|
4
|
+
import { DIMENSION_TYPES, MEASURE_TYPES } from "@embeddable.com/core";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import ora from "ora";
|
|
6
7
|
import { checkNodeVersion } from "./utils";
|
|
@@ -170,28 +171,6 @@ export async function clientContextValidation(filesList: [string, string][]) {
|
|
|
170
171
|
return errors;
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
enum MeasureTypeEnum {
|
|
174
|
-
string = "string",
|
|
175
|
-
time = "time",
|
|
176
|
-
boolean = "boolean",
|
|
177
|
-
number = "number",
|
|
178
|
-
count = "count",
|
|
179
|
-
count_distinct = "count_distinct",
|
|
180
|
-
count_distinct_approx = "count_distinct_approx",
|
|
181
|
-
sum = "sum",
|
|
182
|
-
avg = "avg",
|
|
183
|
-
min = "min",
|
|
184
|
-
max = "max",
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
enum DimensionTypeEnum {
|
|
188
|
-
string = "string",
|
|
189
|
-
time = "time",
|
|
190
|
-
boolean = "boolean",
|
|
191
|
-
number = "number",
|
|
192
|
-
geo = "geo",
|
|
193
|
-
}
|
|
194
|
-
|
|
195
174
|
const cubeModelSchema = z
|
|
196
175
|
.object({
|
|
197
176
|
cubes: z
|
|
@@ -200,14 +179,14 @@ const cubeModelSchema = z
|
|
|
200
179
|
dimensions: z
|
|
201
180
|
.object({
|
|
202
181
|
name: z.string(),
|
|
203
|
-
type: z.
|
|
182
|
+
type: z.enum(DIMENSION_TYPES),
|
|
204
183
|
})
|
|
205
184
|
.array()
|
|
206
185
|
.optional(),
|
|
207
186
|
measures: z
|
|
208
187
|
.object({
|
|
209
188
|
name: z.string(),
|
|
210
|
-
type: z.
|
|
189
|
+
type: z.enum(MEASURE_TYPES),
|
|
211
190
|
})
|
|
212
191
|
.array()
|
|
213
192
|
.optional(),
|