@embeddable.com/sdk-core 3.2.2 → 3.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddable.com/sdk-core",
3
- "version": "3.2.2",
3
+ "version": "3.3.0",
4
4
  "description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
5
5
  "keywords": [
6
6
  "embeddable",
@@ -41,7 +41,7 @@
41
41
  "@swc-node/register": "^1.9.0",
42
42
  "archiver": "^5.3.1",
43
43
  "axios": "^1.7.2",
44
- "chokidar": "^3.5.3",
44
+ "chokidar": "^3.6.0",
45
45
  "finalhandler": "^1.2.0",
46
46
  "formdata-node": "^6.0.3",
47
47
  "minimist": "^1.2.8",
package/src/buildTypes.ts CHANGED
@@ -32,14 +32,17 @@ async function generate(ctx: any) {
32
32
  .concat(optionsFiles)
33
33
  .map(
34
34
  ([_fileName, filePath]) =>
35
- `import './${path
35
+ `import '../${path
36
36
  .relative(ctx.client.rootDir, filePath)
37
37
  .replaceAll("\\", "/")}';`,
38
38
  )
39
39
  .join("\n");
40
40
 
41
41
  await fs.writeFile(
42
- path.resolve(ctx.client.rootDir, ctx.outputOptions.typesEntryPointFilename),
42
+ path.resolve(
43
+ ctx.client.buildDir,
44
+ ctx.outputOptions.typesEntryPointFilename,
45
+ ),
43
46
  typeImports,
44
47
  );
45
48
  }
@@ -51,7 +54,7 @@ async function build(ctx: any) {
51
54
  emptyOutDir: false,
52
55
  lib: {
53
56
  entry: path.resolve(
54
- ctx.client.rootDir,
57
+ ctx.client.buildDir,
55
58
  ctx.outputOptions.typesEntryPointFilename,
56
59
  ),
57
60
  formats: ["es"],
@@ -71,6 +74,6 @@ async function build(ctx: any) {
71
74
 
72
75
  async function cleanup(ctx: any) {
73
76
  await fs.rm(
74
- path.resolve(ctx.client.rootDir, "embeddable-types-entry-point.js"),
77
+ path.resolve(ctx.client.buildDir, "embeddable-types-entry-point.js"),
75
78
  );
76
79
  }
package/src/dev.ts CHANGED
@@ -34,13 +34,29 @@ let ora: any;
34
34
  let previewWorkspace: string;
35
35
 
36
36
  const SERVER_PORT = 8926;
37
+ const BUILD_DEV_DIR = ".embeddable-dev-build";
37
38
 
38
39
  const buildWebComponent = async (config: any) => {
39
40
  await generate(config, "sdk-react");
40
41
  };
41
42
 
43
+ const addToGitingore = async () => {
44
+ try {
45
+ const fs = require("fs").promises;
46
+ const gitignorePath = path.resolve(process.cwd(), ".gitignore");
47
+ const gitignoreContent = await fs.readFile(gitignorePath, "utf8");
48
+
49
+ if (!gitignoreContent.includes(BUILD_DEV_DIR)) {
50
+ await fs.appendFile(gitignorePath, `\n${BUILD_DEV_DIR}\n`);
51
+ }
52
+ } catch (e) {
53
+ // ignore
54
+ }
55
+ };
56
+
42
57
  export default async () => {
43
58
  checkNodeVersion();
59
+ addToGitingore();
44
60
 
45
61
  const http = require("http");
46
62
  ora = (await oraP).default;
@@ -50,13 +66,27 @@ export default async () => {
50
66
  const logger = createNodeLogger({ process });
51
67
  const sys = createNodeSys({ process });
52
68
 
69
+ const defaultConfig = await provideConfig();
70
+
71
+ const buildDir = path.resolve(
72
+ defaultConfig.client.rootDir,
73
+ ".embeddable-dev-build",
74
+ );
75
+
53
76
  const config = {
77
+ ...defaultConfig,
54
78
  dev: {
55
79
  watch: true,
56
80
  logger,
57
81
  sys,
58
82
  },
59
- ...(await provideConfig()),
83
+ client: {
84
+ ...defaultConfig.client,
85
+ buildDir: buildDir,
86
+ componentDir: path.resolve(buildDir, "component"),
87
+ stencilBuild: path.resolve(buildDir, "dist", "embeddable-wrapper"),
88
+ tmpDir: path.resolve(defaultConfig.client.rootDir, ".embeddable-dev-tmp"),
89
+ },
60
90
  };
61
91
 
62
92
  await prepare(config);
@@ -1,19 +1,7 @@
1
1
  import * as fsP from "node:fs/promises";
2
2
  import * as fs from "node:fs";
3
- import * as path from "node:path";
4
3
 
5
4
  export default async (ctx: any) => {
6
- const componentsEntryPath = path.resolve(
7
- ctx.client.rootDir,
8
- ctx.outputOptions.componentsEntryPointFilename,
9
- );
10
- const typesEntryPath = path.resolve(
11
- ctx.client.rootDir,
12
- ctx.outputOptions.typesEntryPointFilename,
13
- );
14
-
15
5
  if (fs.existsSync(ctx.client.buildDir))
16
6
  await fsP.rm(ctx.client.buildDir, { recursive: true });
17
- if (fs.existsSync(componentsEntryPath)) await fsP.rm(componentsEntryPath);
18
- if (fs.existsSync(typesEntryPath)) await fsP.rm(typesEntryPath);
19
7
  };