@microtronics/studio-cli 0.16.0 → 0.18.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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
 
2
2
 
3
+ ## 0.18.0 (2025-02-13)
4
+
5
+
6
+ ### Features
7
+
8
+ * **studio-cli:** support for new qualification stages ([7511873](https://bitbucket.org/microtronics-core/vscode-studio/commits/7511873eab82fa4e1fb4be3c1b998b1a3576f5f9))
9
+
10
+ ## 0.17.0 (2025-02-13)
11
+
12
+
13
+ ### Features
14
+
15
+ * **studio-cli:** added function to validate if a given apm part is enabled or not ([1dce992](https://bitbucket.org/microtronics-core/vscode-studio/commits/1dce99291f0629aed450af5413b128b0b80f29eb))
16
+ * **studio-cli:** allow set the `MYDATANET_CUSTOMER` env ([a34297a](https://bitbucket.org/microtronics-core/vscode-studio/commits/a34297ae1e670ef665b5991d065f74e6401466e3))
17
+ * **studio-cli:** make `ENV` namespace available ([09a8b80](https://bitbucket.org/microtronics-core/vscode-studio/commits/09a8b80a1b0f99eada300e273bb84029d28132bb))
18
+ * **studio-cli:** only add dlo binarys if the dlo part is enabled ([6d106ab](https://bitbucket.org/microtronics-core/vscode-studio/commits/6d106ab411c44057ca71e04d301d1c984a6b253b))
19
+ * **studio-cli:** only start compiler if the apm part is enabled ([dfbc701](https://bitbucket.org/microtronics-core/vscode-studio/commits/dfbc70173abf81eb5635a6d360d89a2f8734868a))
20
+ * **studio-cli:** support to read `.env.local` to support local build settings ([3376dbf](https://bitbucket.org/microtronics-core/vscode-studio/commits/3376dbf16f757f06829556eb2fc1d92d628253c1))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **studio-cli:** only return boolean for `isApmPartEnabled` function ([c80468a](https://bitbucket.org/microtronics-core/vscode-studio/commits/c80468ae245b49fb1f5209fbf5a948df9f5bc7d2))
26
+ * **studio-cli:** validate if `.env.local` file exist ([eeea393](https://bitbucket.org/microtronics-core/vscode-studio/commits/eeea3932bc28a259975c4755a4f5a6a107ab34b7))
27
+
3
28
  ## 0.16.0 (2025-02-07)
4
29
 
5
30
 
@@ -5,6 +5,9 @@ import { URI } from 'vscode-uri';
5
5
 
6
6
  export declare namespace APM {
7
7
  export enum TagPhase {
8
+ alpha = "alpha",
9
+ beta = "beta",
10
+ rc = "rc",
8
11
  release = "release",
9
12
  stage = "stage",
10
13
  passive = "passive",
@@ -231,7 +234,7 @@ declare interface components {
231
234
  * @description The released phase
232
235
  * @enum {string}
233
236
  */
234
- ReleasePhases: "passive" | "stage" | "release" | "withdrawn";
237
+ ReleasePhases: "passive" | "alpha" | "beta" | "stage" | "rc" | "release" | "withdrawn";
235
238
  NewPublisher: {
236
239
  /** @description Unique id of the publisher. Can not be changed afterwards. Can only contain 'A' through 'Z', 'a' through 'z', '0' through '9' and '-'. The publisher ID must start with an alphabetic or numeric character. */
237
240
  id: string;
@@ -1782,6 +1785,23 @@ declare class DloPreCompiler {
1782
1785
  }>;
1783
1786
  }
1784
1787
 
1788
+ export declare namespace ENV {
1789
+ /**
1790
+ *
1791
+ */
1792
+ export interface ENV {
1793
+ MYDATANET_HOST?: string;
1794
+ MYDATANET_API_TOKEN?: string;
1795
+ MYDATANET_CUSTOMER?: string;
1796
+ }
1797
+ /**
1798
+ * Read/parse the supported .env file
1799
+ * @param cwd
1800
+ * @param fs
1801
+ */
1802
+ export function read(cwd: URI, fs: LocalFS): Promise<ENV.ENV>;
1803
+ }
1804
+
1785
1805
  /**
1786
1806
  * Permissions of a file.
1787
1807
  */
@@ -2130,6 +2150,14 @@ export declare namespace Manifest {
2130
2150
  export function validateRegistryAllowedBackends(allowedBackends: undefined | null | string | string[]): Promise<string | null>;
2131
2151
  export function validateApplicationIcon(cwd: URI, fs: LocalFS, manifest: Manifest.Manifest): Promise<void>;
2132
2152
  export function validateEngineSettings(manifest: Manifest.Manifest): void;
2153
+ /**
2154
+ * Validate if the given apm part is used
2155
+ * @param cwd
2156
+ * @param fs
2157
+ * @param apmPart
2158
+ * @param manifest
2159
+ */
2160
+ export function isApmPartEnabled(cwd: URI, fs: LocalFS, apmPart: APM.Part, manifest?: Manifest.Manifest): Promise<boolean>;
2133
2161
  }
2134
2162
 
2135
2163
  export declare namespace Package {
package/out/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DFILES = exports.Library = exports.APM = exports.Package = exports.DLO = exports.Globals = exports.DeviceProfiles = exports.DefaultFiles = exports.Diagnostics = exports.Helper = exports.DDE = exports.DDE_Core = exports.Registry = exports.Manifest = exports.Dependencies = void 0;
3
+ exports.ENV = exports.DFILES = exports.Library = exports.APM = exports.Package = exports.DLO = exports.Globals = exports.DeviceProfiles = exports.DefaultFiles = exports.Diagnostics = exports.Helper = exports.DDE = exports.DDE_Core = exports.Registry = exports.Manifest = exports.Dependencies = void 0;
4
4
  const dependencies_1 = require("./dependencies");
5
5
  Object.defineProperty(exports, "Dependencies", { enumerable: true, get: function () { return dependencies_1.Dependencies; } });
6
6
  const manifest_1 = require("./manifest");
@@ -31,4 +31,6 @@ const library_1 = require("./package/library");
31
31
  Object.defineProperty(exports, "Library", { enumerable: true, get: function () { return library_1.Library; } });
32
32
  const dfiles_1 = require("./dfiles/dfiles");
33
33
  Object.defineProperty(exports, "DFILES", { enumerable: true, get: function () { return dfiles_1.DFILES; } });
34
+ const dotenv_1 = require("./dotenv");
35
+ Object.defineProperty(exports, "ENV", { enumerable: true, get: function () { return dotenv_1.ENV; } });
34
36
  //# sourceMappingURL=api.js.map
@@ -65,6 +65,15 @@ class DloCompiler {
65
65
  }
66
66
  async compile(cwd, fs) {
67
67
  const manifest = await manifest_1.Manifest.read(cwd, fs);
68
+ if (!(await manifest_1.Manifest.isApmPartEnabled(cwd, fs, apm_1.APM.Part.dlo, manifest))) {
69
+ console.log('DLO not enabled. Skipped.');
70
+ return {
71
+ code: 0,
72
+ stdout: [],
73
+ stderr: [],
74
+ diagnostics: []
75
+ };
76
+ }
68
77
  await this.initDloCC();
69
78
  const precompilerDiagnostics = await this.persistDloFiles(cwd, fs, manifest);
70
79
  const mainFile = vscode_uri_1.Utils.joinPath(cwd, manifest.dlo?.mainFile || defaultFiles_1.DefaultFiles.filePaths.dlo.mainDLO);
package/out/dotenv.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ENV = void 0;
7
+ const dotenv_1 = __importDefault(require("dotenv"));
8
+ const vscode_uri_1 = require("vscode-uri");
9
+ const helper_1 = require("./helper");
10
+ const envLocalFile = '.env.local';
11
+ var ENV;
12
+ (function (ENV) {
13
+ /**
14
+ * Read/parse the supported .env file
15
+ * @param cwd
16
+ * @param fs
17
+ */
18
+ async function read(cwd, fs) {
19
+ const envPath = vscode_uri_1.Utils.joinPath(cwd, envLocalFile);
20
+ if (await fs.stat(envPath)) {
21
+ const envData = await fs.readFile(envPath);
22
+ return dotenv_1.default.parse(helper_1.Helper.convertBlobToString(envData));
23
+ }
24
+ return {};
25
+ }
26
+ ENV.read = read;
27
+ })(ENV || (exports.ENV = ENV = {}));
28
+ //# sourceMappingURL=dotenv.js.map
package/out/manifest.js CHANGED
@@ -13,6 +13,7 @@ const globals_1 = require("./globals");
13
13
  const preload_1 = __importDefault(require("semver/preload"));
14
14
  const DeviceProfiles_1 = require("./DeviceProfiles");
15
15
  var isNumeric = helper_1.Helper.isNumeric;
16
+ const apm_1 = require("./package/apm");
16
17
  // Cache to reduce the disk read requests
17
18
  const manifestCache = {
18
19
  _manifest: null,
@@ -263,6 +264,33 @@ var Manifest;
263
264
  validateHwFwOrProductId(manifest);
264
265
  }
265
266
  Manifest.validateEngineSettings = validateEngineSettings;
267
+ /**
268
+ * Validate if the given apm part is used
269
+ * @param cwd
270
+ * @param fs
271
+ * @param apmPart
272
+ * @param manifest
273
+ */
274
+ async function isApmPartEnabled(cwd, fs, apmPart, manifest) {
275
+ if (!manifest) {
276
+ manifest = await Manifest.read(cwd, fs);
277
+ }
278
+ switch (apmPart) {
279
+ case apm_1.APM.Part.dlo:
280
+ return !!manifest?.dlo?.mainFile;
281
+ case apm_1.APM.Part.blo:
282
+ return !!(manifest.blo?.buildCommand && manifest.blo?.workingPath);
283
+ case apm_1.APM.Part.pov:
284
+ return !!(manifest.pov?.details?.buildCommand && manifest.pov.details.workingPath);
285
+ // dde and dfiles are always enabled
286
+ case apm_1.APM.Part.dde:
287
+ case apm_1.APM.Part.dfiles:
288
+ return true;
289
+ default:
290
+ return false;
291
+ }
292
+ }
293
+ Manifest.isApmPartEnabled = isApmPartEnabled;
266
294
  })(Manifest || (exports.Manifest = Manifest = {}));
267
295
  function validatePOVSettings(manifest) {
268
296
  const { pov } = manifest;
@@ -12,9 +12,9 @@ var APM;
12
12
  (function (APM) {
13
13
  let TagPhase;
14
14
  (function (TagPhase) {
15
- /*alpha='alpha',
16
- beta='beta',
17
- rc='rc',*/
15
+ TagPhase["alpha"] = "alpha";
16
+ TagPhase["beta"] = "beta";
17
+ TagPhase["rc"] = "rc";
18
18
  TagPhase["release"] = "release";
19
19
  TagPhase["stage"] = "stage";
20
20
  TagPhase["passive"] = "passive";
@@ -99,8 +99,6 @@ var APM;
99
99
  apmBuffer.append(`src/${manifest_1.Manifest.fileName}`, new Blob([await manifest_1.Manifest.readAsBlob(cwd, fs)]));
100
100
  const xmlBlob = new Blob([await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.ddeXmlPath))]);
101
101
  apmBuffer.append('bin/dde/xml', xmlBlob);
102
- const amxBlob = new Blob([await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.mainAmxPath))]);
103
- apmBuffer.append('bin/dlo/amx', amxBlob);
104
102
  if (manifest.icon) {
105
103
  const appIcon = await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, manifest.icon));
106
104
  const base64 = bufferToBase64(appIcon);
@@ -113,8 +111,12 @@ var APM;
113
111
  apmBuffer.append(`previews/README.md`, new Blob([readme]));
114
112
  apmBuffer.append(`previews/CHANGELOG.md`, new Blob([changelog]));
115
113
  }
114
+ if (await manifest_1.Manifest.isApmPartEnabled(cwd, fs, APM.Part.dlo)) {
115
+ const amxBlob = new Blob([await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.mainAmxPath))]);
116
+ apmBuffer.append('bin/dlo/amx', amxBlob);
117
+ }
116
118
  // handle pov binaries
117
- if (manifest.pov?.details) {
119
+ if (await manifest_1.Manifest.isApmPartEnabled(cwd, fs, APM.Part.pov, manifest)) {
118
120
  // get files in details dir
119
121
  await insertRelativePathFilesToBuffer(cwd, fs, apmBuffer, defaultFiles_1.DefaultFiles.filePaths.dist.povDetailsPath, 'bin/pov/details');
120
122
  //site list not supported yet -> add an empty index.html
@@ -128,7 +130,7 @@ var APM;
128
130
  apmBuffer.append(`bin/dfiles/${vscode_uri_1.Utils.basename(fileName)}`, dfileBlob);
129
131
  }
130
132
  // handle blo files
131
- if (manifest.blo) {
133
+ if (await manifest_1.Manifest.isApmPartEnabled(cwd, fs, APM.Part.pov, manifest)) {
132
134
  // get files in blo dir
133
135
  await insertRelativePathFilesToBuffer(cwd, fs, apmBuffer, defaultFiles_1.DefaultFiles.filePaths.dist.bloPath, 'bin/blo');
134
136
  }
@@ -37,7 +37,7 @@ var Shell;
37
37
  */
38
38
  async function tryBuildPov(cwd, fs) {
39
39
  const manifest = await manifest_1.Manifest.read(cwd, fs);
40
- if (manifest.pov?.details?.buildCommand && manifest.pov.details.workingPath) {
40
+ if (await manifest_1.Manifest.isApmPartEnabled(cwd, fs, apm_1.APM.Part.pov)) {
41
41
  console.log('Executing POV build script', manifest.pov?.details.buildCommand);
42
42
  const { buildCommand, workingPath } = manifest.pov.details;
43
43
  const povDir = vscode_uri_1.Utils.joinPath(cwd, workingPath);
@@ -62,7 +62,7 @@ var Shell;
62
62
  */
63
63
  async function tryBuildBlo(cwd, fs) {
64
64
  const manifest = await manifest_1.Manifest.read(cwd, fs);
65
- if (manifest.blo?.buildCommand && manifest.blo?.workingPath) {
65
+ if (await manifest_1.Manifest.isApmPartEnabled(cwd, fs, apm_1.APM.Part.blo, manifest)) {
66
66
  console.log('Executing BLO build script', manifest.blo?.buildCommand);
67
67
  const { buildCommand, workingPath } = manifest.blo;
68
68
  const bloDir = vscode_uri_1.Utils.joinPath(cwd, workingPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microtronics/studio-cli",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "Microtronics Studio CLI Tool",
5
5
  "main": "./out/api.js",
6
6
  "typings": "./dist/studio-cli.d.ts",
@@ -30,19 +30,20 @@
30
30
  "ajv-keywords": "^5.1.0",
31
31
  "commander": "^12.1.0",
32
32
  "cross-fetch": "^4.0.0",
33
+ "dotenv": "^16.4.7",
34
+ "file-type-checker": "^1.1.2",
33
35
  "glob": "^11.0.1",
34
36
  "iconv-lite": "^0.6.3",
35
- "minimatch": "^10.0.1",
37
+ "image-dimensions": "^2.3.0",
36
38
  "ini": "^5.0.0",
39
+ "minimatch": "^10.0.1",
37
40
  "openapi-fetch": "^0.13.0",
38
41
  "pako": "^2.1.0",
39
42
  "semver": "^7.6.3",
40
43
  "tarballjs": "github:ankitrohatgi/tarballjs",
41
44
  "tinytar-fix": "^0.1.1",
42
45
  "vscode-uri": "^3.0.8",
43
- "yaml": "^2.6.1",
44
- "image-dimensions": "^2.3.0",
45
- "file-type-checker": "^1.1.2"
46
+ "yaml": "^2.6.1"
46
47
  },
47
48
  "engines": {
48
49
  "node": ">= 22"