qcobjects-cli 2.5.104-beta → 2.5.106-beta

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.
Files changed (31) hide show
  1. package/VERSION +1 -1
  2. package/build-esbuild.js +64 -12
  3. package/package.json +1 -1
  4. package/public/browser/index.js +2 -1
  5. package/public/browser/index.js.map +2 -2
  6. package/public/browser/org.quickcorp.qcobjects.cli.js +2 -1
  7. package/public/browser/org.quickcorp.qcobjects.cli.js.map +2 -2
  8. package/public/browser/qcobjects-cli.js +2 -1
  9. package/public/browser/qcobjects-cli.js.map +2 -2
  10. package/public/browser/templates/apps/spa-local.html +28 -0
  11. package/public/browser/templates/apps/spa-local.js +65 -0
  12. package/public/browser/templates/pwa/sw.js +112 -0
  13. package/public/cjs/index.cjs +2 -1
  14. package/public/cjs/index.cjs.map +2 -2
  15. package/public/cjs/org.quickcorp.qcobjects.cli.cjs +2 -1
  16. package/public/cjs/org.quickcorp.qcobjects.cli.cjs.map +2 -2
  17. package/public/cjs/qcobjects-cli.cjs +2 -1
  18. package/public/cjs/qcobjects-cli.cjs.map +2 -2
  19. package/public/cjs/templates/apps/spa-local.html +28 -0
  20. package/public/cjs/templates/apps/spa-local.js +65 -0
  21. package/public/cjs/templates/pwa/sw.js +112 -0
  22. package/public/esm/index.mjs +2 -1
  23. package/public/esm/index.mjs.map +2 -2
  24. package/public/esm/org.quickcorp.qcobjects.cli.mjs +2 -1
  25. package/public/esm/org.quickcorp.qcobjects.cli.mjs.map +2 -2
  26. package/public/esm/qcobjects-cli.mjs +2 -1
  27. package/public/esm/qcobjects-cli.mjs.map +2 -2
  28. package/public/esm/templates/apps/spa-local.html +28 -0
  29. package/public/esm/templates/apps/spa-local.js +65 -0
  30. package/public/esm/templates/pwa/sw.js +112 -0
  31. package/src/org.quickcorp.qcobjects.cli.ts +2 -1
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.104-beta
1
+ 2.5.106-beta
package/build-esbuild.js CHANGED
@@ -1,7 +1,56 @@
1
1
  // build.js
2
2
  const esbuild = require("esbuild");
3
3
  const alias = require("esbuild-plugin-alias");
4
- const path = require("path");
4
+ const path = require("node:path");
5
+ const fs = require ("node:fs");
6
+
7
+ const logError = (e) => { console.error(e); process.exit(1); };
8
+ const logDebug = (e) => { console.debug(e); }
9
+
10
+ const copyDir = (source, dest, exclude) => {
11
+ source = path.resolve(source);
12
+ dest = path.resolve(dest);
13
+ const dname = path.basename(source);
14
+ const dirExcluded = (exclude.includes(dname));
15
+
16
+ const isDir = (d) => {
17
+ return (fs.existsSync(d) && fs.statSync(d).isDirectory()) ? (true) : (false);
18
+ };
19
+
20
+ const isFile = (d) => {
21
+ return (fs.existsSync(d) && fs.statSync(d).isFile()) ? (true) : (false);
22
+ }
23
+
24
+ if (isDir(source) && !dirExcluded) {
25
+ fs.mkdirSync(dest, { recursive: true });
26
+ const paths = fs.readdirSync(source, { withFileTypes: true })
27
+ const dirs = paths.filter(d => d.isDirectory());
28
+ const files = paths.filter(f => f.isFile());
29
+ (async function (paths, dirs, files, exclude) {
30
+ files.map((f) => {
31
+ const sourceFile = path.resolve(source, f.name);
32
+ const destFile = path.resolve(dest, f.name);
33
+ const fileExcluded = exclude.includes(f.name);
34
+ if (isFile(sourceFile) && !fileExcluded) {
35
+ logDebug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude}...`);
36
+ fs.copyFileSync(sourceFile, destFile);
37
+ logDebug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude}...DONE!`);
38
+ }
39
+ });
40
+ dirs.map((d) => {
41
+ const sourceDir = path.resolve(source, d.name);
42
+ const destDir = path.resolve(dest, d.name);
43
+ copyDir(sourceDir, destDir, exclude);
44
+ });
45
+ })(paths, dirs, files, exclude);
46
+ }
47
+
48
+ };
49
+
50
+ copyDir("./src/templates", "./build/templates", []);
51
+ copyDir("./src/templates", "./public/cjs/templates", []);
52
+ copyDir("./src/templates", "./public/esm/templates", []);
53
+ copyDir("./src/templates", "./public/browser/templates", []);
5
54
 
6
55
  const baseSettings = {
7
56
  entryPoints: ["src/**/*.ts"], // Your entry file
@@ -11,7 +60,7 @@ const baseSettings = {
11
60
  target: ["esnext"], // Adjust based on your target environment
12
61
  tsconfig: "tsconfig.json", // Path to your tsconfig.json,
13
62
  globalName: "global",
14
- minify:false,
63
+ minify: false,
15
64
  keepNames: true,
16
65
  sourcemap: true,
17
66
  splitting: false,
@@ -22,48 +71,51 @@ const baseSettings = {
22
71
  })
23
72
  ],
24
73
  external: ["os", "path", "http", "url",
25
- "child_process", "events", "fs", "process",
26
- "node:fs", "node:os", "node:child_process",
74
+ "child_process", "events", "fs", "process",
75
+ "node:fs", "node:os", "node:child_process",
27
76
  "node:path", "readline", "node:net", "node:repl",
28
- "node:vm", "http2", "vm", "qcobjects", "qcobjects-sdk",
77
+ "node:vm", "http2", "vm", "qcobjects", "qcobjects-sdk",
29
78
  "../package.json", "package.json", "./package.json"
30
79
  ]
31
80
  };
32
81
 
33
- const cjsSettings = {...baseSettings,
82
+ const cjsSettings = {
83
+ ...baseSettings,
34
84
  entryPoints: ["src/**/*.ts"], // Your entry file
35
85
  outdir: "public/cjs", // Output dir
36
86
  format: "cjs", // or "esm" depending on your module system
37
87
  platform: "node", // or "browser" depending on your target environment
38
88
  outExtension: {
39
- ".js":".cjs"
89
+ ".js": ".cjs"
40
90
  }
41
91
 
42
92
  };
43
93
 
44
- const esmSettings = {...baseSettings,
94
+ const esmSettings = {
95
+ ...baseSettings,
45
96
  entryPoints: ["src/**/*.ts"], // Your entry file
46
97
  outdir: "public/esm", // Output dir
47
98
  format: "esm", // or "esm" depending on your module system
48
99
  platform: "browser", // or "browser" depending on your target environment
49
100
  outExtension: {
50
- ".js":".mjs"
101
+ ".js": ".mjs"
51
102
  }
52
103
 
53
104
  };
54
105
 
55
- const browserSettings = {...baseSettings,
106
+ const browserSettings = {
107
+ ...baseSettings,
56
108
  entryPoints: ["src/**/*.ts"], // Your entry file
57
109
  bundle: true,
58
110
  outdir: "public/browser", // Output dir
59
111
  format: "iife", // or "esm" depending on your module system
60
112
  platform: "browser", // or "browser" depending on your target environment
61
113
  outExtension: {
62
- ".js":".js"
114
+ ".js": ".js"
63
115
  }
64
116
  };
65
117
 
66
- const logError = (e) => {console.log(e);process.exit(1);};
118
+
67
119
 
68
120
  esbuild.build(cjsSettings).catch(logError);
69
121
  esbuild.build(esmSettings).catch(logError);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qcobjects-cli",
3
- "version": "2.5.104-beta",
3
+ "version": "2.5.106-beta",
4
4
  "description": "qcobjects cli command line tool",
5
5
  "main": "public/cjs/index.cjs",
6
6
  "module": "public/esm/index.mjs",
@@ -3878,7 +3878,7 @@ Enjoy!
3878
3878
  }
3879
3879
  generateServiceWorker(appName, dirPrefix = "./") {
3880
3880
  const writeContent = /* @__PURE__ */ __name((component) => {
3881
- const parsedText = component.parseTemplate(component.template);
3881
+ const parsedText = component.parsedAssignmentText;
3882
3882
  logger7.debug("Starting to write the sw file...");
3883
3883
  fs2.writeFile(`${dirPrefix}/sw.js`, parsedText, (err) => {
3884
3884
  if (err) {
@@ -3908,6 +3908,7 @@ Enjoy!
3908
3908
  template = "";
3909
3909
  constructor({ name, data }) {
3910
3910
  super({ name, data });
3911
+ this.data = data;
3911
3912
  }
3912
3913
  done({ request, component }) {
3913
3914
  super.done({ request, component });