@microtronics/studio-cli 0.15.0 → 0.16.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,22 @@
1
1
 
2
2
 
3
+ ## 0.16.0 (2025-02-07)
4
+
5
+
6
+ ### Features
7
+
8
+ * **studio-cli:** add the `history.json` to the store tag ([70086be](https://bitbucket.org/microtronics-core/vscode-studio/commits/70086be5ef2100ba6bf0e699d242bf9d02d7e347))
9
+ * **studio-cli:** add the `studio.json` to the store tag ([6e23a79](https://bitbucket.org/microtronics-core/vscode-studio/commits/6e23a793f8d7c7ebc8a5044d86002d965ac484eb))
10
+ * **studio-cli:** introduced new manifest property `type` ([edbd5cb](https://bitbucket.org/microtronics-core/vscode-studio/commits/edbd5cbb11198f6659be42560642676258c6ca66))
11
+ * **studio-cli:** prevent generating `history.json` for library projects ([00e45c0](https://bitbucket.org/microtronics-core/vscode-studio/commits/00e45c02b07147a157b0c3fedb3217988c0ea225))
12
+
13
+ ## 0.15.1 (2025-01-31)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **studio-cli:** didn't allow that allowedBackends are null ([6335dab](https://bitbucket.org/microtronics-core/vscode-studio/commits/6335dab9eb7e783faa4354da304989f3adc79be0))
19
+
3
20
  ## 0.15.0 (2025-01-31)
4
21
 
5
22
 
@@ -2021,12 +2021,24 @@ declare interface LocalFS {
2021
2021
  }
2022
2022
 
2023
2023
  export declare namespace Manifest {
2024
+ /**
2025
+ * The source filename where the information is stored in
2026
+ */
2027
+ const fileName = "studio.json";
2024
2028
  export type DeviceProfiles = 'm22x' | 'm23x' | 'nrf91' | 'm2blegw' | 'm2easyv3' | 'm2easyiot';
2029
+ /**
2030
+ * Type of the iot app project
2031
+ */
2032
+ export enum ProjectTypes {
2033
+ app = "app",
2034
+ library = "library"
2035
+ }
2025
2036
  export interface Manifest {
2026
2037
  version: string;
2027
2038
  name: string;
2028
2039
  publisher: string;
2029
2040
  description: string;
2041
+ type: ProjectTypes;
2030
2042
  legacyProject?: boolean;
2031
2043
  icon?: string;
2032
2044
  dpid: DeviceProfiles;
@@ -2035,6 +2047,9 @@ export declare namespace Manifest {
2035
2047
  hwfw?: string[];
2036
2048
  productId?: string[];
2037
2049
  };
2050
+ /**
2051
+ * @deprecated
2052
+ */
2038
2053
  library?: boolean;
2039
2054
  libraryDependencies?: Dependencies;
2040
2055
  libraryDevDependencies?: Dependencies;
@@ -2098,7 +2113,7 @@ export declare namespace Manifest {
2098
2113
  /**
2099
2114
  * Check if the current project is a library project
2100
2115
  */
2101
- export function isLibraryProject(manifest: Manifest.Manifest): boolean;
2116
+ export function isLibrary(manifest: Manifest.Manifest): boolean;
2102
2117
  /**
2103
2118
  * Validates if the properties within
2104
2119
  * @param cwd
package/out/dde/dde.js CHANGED
@@ -275,7 +275,7 @@ var DDE;
275
275
  */
276
276
  async function exportOpenApi(cwd, fs, ddeMap) {
277
277
  const manifest = await manifest_1.Manifest.read(cwd, fs);
278
- const isLibrary = manifest.library;
278
+ const isLibrary = manifest_1.Manifest.isLibrary(manifest);
279
279
  // remove previous api description:
280
280
  const previousOpenAPIFileName = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.path, 'dde-api.yaml');
281
281
  await fs.rm(previousOpenAPIFileName).catch(() => { });
@@ -330,7 +330,7 @@ async function getDependencies(cwd, fs, manifest) {
330
330
  }
331
331
  }
332
332
  // push library projects dde file also into the list
333
- if (manifest_1.Manifest.isLibraryProject(manifest)) {
333
+ if (manifest_1.Manifest.isLibrary(manifest)) {
334
334
  const projectLibPath = vscode_uri_1.Utils.joinPath(cwd, `/${exports.DDE_PATH}/${manifest.name}.dde`);
335
335
  if (await fs.stat(projectLibPath)) {
336
336
  ddeFiles.push({
@@ -62,7 +62,7 @@ function getPawnTypeDefinition(field) {
62
62
  }
63
63
  const MICROTRONICS_DLO_CORE = 'Microtronics/dlo-core';
64
64
  function getRequiredDloCoreVersion(manifest) {
65
- if (manifest_1.Manifest.isLibraryProject(manifest) && manifest.name === 'dlo-core') {
65
+ if (manifest_1.Manifest.isLibrary(manifest) && manifest.name === 'dlo-core') {
66
66
  return manifest.version;
67
67
  }
68
68
  else if (manifest.libraryDependencies && Object.hasOwn(manifest.libraryDependencies, MICROTRONICS_DLO_CORE)) {
@@ -35,7 +35,6 @@ const pako = require('pako');
35
35
  exports.LIB_DEPS_PATH = '.studio/libdeps';
36
36
  var Dependencies;
37
37
  (function (Dependencies) {
38
- var isLibraryProject = manifest_1.Manifest.isLibraryProject;
39
38
  /**
40
39
  * Just combine all dependencies in one object
41
40
  * Optional devDependencies can be excluded
@@ -323,7 +322,7 @@ var Dependencies;
323
322
  }
324
323
  }
325
324
  // add current project file if it is a library project
326
- if (isLibraryProject(manifest)) {
325
+ if (manifest_1.Manifest.isLibrary(manifest)) {
327
326
  const incPath = vscode_uri_1.Utils.joinPath(cwd, defaultApmPath, `${manifest.name}.${includeExtension}`);
328
327
  if (await fs.stat(incPath)) {
329
328
  apmDependencies.push({
@@ -111,7 +111,7 @@ class DloPreCompiler {
111
111
  // console.log('MANGLED LIB', baseName, mangleDDEFunctions);
112
112
  }
113
113
  }
114
- else if (manifest_1.Manifest.isLibraryProject(manifest) && baseName === `${manifest.name}.inc`) {
114
+ else if (manifest_1.Manifest.isLibrary(manifest) && baseName === `${manifest.name}.inc`) {
115
115
  mangleDDEFunctions = helper_1.Helper.generateHashForLibraryName(manifest.name);
116
116
  // console.log('MANGLED PROJECT LIB', baseName, mangleDDEFunctions);
117
117
  }
package/out/globals.js CHANGED
@@ -63,7 +63,7 @@ var Globals;
63
63
  }
64
64
  }
65
65
  // load the library projects specific ini file
66
- if (manifest_1.Manifest.isLibraryProject(manifest)) {
66
+ if (manifest_1.Manifest.isLibrary(manifest)) {
67
67
  const libIni = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dlo.path, `${manifest.name}.ini`);
68
68
  if (await fs.stat(libIni)) {
69
69
  const iniContent = await readIniFile(fs, libIni);
package/out/manifest.js CHANGED
@@ -13,7 +13,6 @@ 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 STUDIO_JSON_NAME = 'studio.json';
17
16
  // Cache to reduce the disk read requests
18
17
  const manifestCache = {
19
18
  _manifest: null,
@@ -39,6 +38,18 @@ const manifestCache = {
39
38
  var Manifest;
40
39
  (function (Manifest) {
41
40
  var convertBlobToString = helper_1.Helper.convertBlobToString;
41
+ /**
42
+ * The source filename where the information is stored in
43
+ */
44
+ Manifest.fileName = 'studio.json';
45
+ /**
46
+ * Type of the iot app project
47
+ */
48
+ let ProjectTypes;
49
+ (function (ProjectTypes) {
50
+ ProjectTypes["app"] = "app";
51
+ ProjectTypes["library"] = "library";
52
+ })(ProjectTypes = Manifest.ProjectTypes || (Manifest.ProjectTypes = {}));
42
53
  let BloAccessLevel;
43
54
  (function (BloAccessLevel) {
44
55
  BloAccessLevel["restricted"] = "restricted";
@@ -55,7 +66,7 @@ var Manifest;
55
66
  * @param fs
56
67
  */
57
68
  async function read(cwd, fs) {
58
- const manifestUri = vscode_uri_1.Utils.joinPath(cwd, STUDIO_JSON_NAME);
69
+ const manifestUri = vscode_uri_1.Utils.joinPath(cwd, Manifest.fileName);
59
70
  const manifestStat = await fs.stat(manifestUri);
60
71
  // if the manifest was modified, reload the cache
61
72
  if (manifestCache.manifest === null ||
@@ -77,7 +88,7 @@ var Manifest;
77
88
  * @param fs
78
89
  */
79
90
  async function readAsBlob(cwd, fs) {
80
- return await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, STUDIO_JSON_NAME));
91
+ return await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, Manifest.fileName));
81
92
  }
82
93
  Manifest.readAsBlob = readAsBlob;
83
94
  /**
@@ -91,16 +102,21 @@ var Manifest;
91
102
  // patch the options if they are not valid for a specific device profile
92
103
  patchDloCompileOptionsBasedOnDpid(manifest);
93
104
  removeDeprecatedOptions(manifest);
94
- return fs.writeFile(vscode_uri_1.Utils.joinPath(cwd, STUDIO_JSON_NAME), JSON.stringify(manifest, null, '\t'));
105
+ return fs.writeFile(vscode_uri_1.Utils.joinPath(cwd, Manifest.fileName), JSON.stringify(manifest, null, '\t'));
95
106
  }
96
107
  Manifest.write = write;
97
108
  /**
98
109
  * Check if the current project is a library project
99
110
  */
100
- function isLibraryProject(manifest) {
101
- return !!manifest.library;
111
+ function isLibrary(manifest) {
112
+ if (manifest.library !== undefined) {
113
+ return manifest.library;
114
+ }
115
+ else {
116
+ return manifest.type === ProjectTypes.library;
117
+ }
102
118
  }
103
- Manifest.isLibraryProject = isLibraryProject;
119
+ Manifest.isLibrary = isLibrary;
104
120
  /**
105
121
  * Validates if the properties within
106
122
  * @param cwd
@@ -194,6 +210,9 @@ var Manifest;
194
210
  if (allowedBackends === undefined) {
195
211
  return 'Allowed backends not specified yet';
196
212
  }
213
+ if (allowedBackends === null) {
214
+ return null;
215
+ }
197
216
  if (Array.isArray(allowedBackends) || allowedBackends?.includes(';')) {
198
217
  const validationArray = allowedBackends?.includes(';') ? allowedBackends.split(';') : allowedBackends;
199
218
  for (const domain of validationArray) {
@@ -292,7 +311,7 @@ function validateHwFwOrProductId(manifest) {
292
311
  * @param env
293
312
  */
294
313
  function validateProjectVersion(manifest, env) {
295
- if (env === globals_1.Globals.ENV.lucky || Manifest.isLibraryProject(manifest)) {
314
+ if (env === globals_1.Globals.ENV.lucky || Manifest.isLibrary(manifest)) {
296
315
  if (!preload_1.default.valid(manifest.version)) {
297
316
  throw new Error('"version" has to be a semantic version string!"');
298
317
  }
@@ -96,6 +96,7 @@ var APM;
96
96
  async function createBuffer(cwd, fs, manifest, tagHeader) {
97
97
  const apmBuffer = new FormData();
98
98
  apmBuffer.append('tag', JSON.stringify(tagHeader));
99
+ apmBuffer.append(`src/${manifest_1.Manifest.fileName}`, new Blob([await manifest_1.Manifest.readAsBlob(cwd, fs)]));
99
100
  const xmlBlob = new Blob([await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.ddeXmlPath))]);
100
101
  apmBuffer.append('bin/dde/xml', xmlBlob);
101
102
  const amxBlob = new Blob([await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.mainAmxPath))]);
@@ -257,5 +258,7 @@ async function addAdditionalFiles(cwd, fs, apmBuffer) {
257
258
  const reportTemplateBlob = new Blob([await fs.readFile(reportTemplate)]);
258
259
  apmBuffer.append(`bin/pov/mdn_report_template.json`, reportTemplateBlob);
259
260
  }
261
+ const historyPath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.dist.historyJson);
262
+ apmBuffer.append(`src/dde/${manifest_1.Manifest.fileName}`, new Blob([await fs.readFile(historyPath)]));
260
263
  }
261
264
  //# sourceMappingURL=apm.js.map
@@ -51,7 +51,7 @@ var Package;
51
51
  */
52
52
  async function release(cwd, fs, token, releasePhase, env = globals_1.Globals.ENV.production) {
53
53
  const manifest = await manifest_1.Manifest.read(cwd, fs);
54
- if (manifest_1.Manifest.isLibraryProject(manifest)) {
54
+ if (manifest_1.Manifest.isLibrary(manifest)) {
55
55
  await releaseLibrary(cwd, fs, token, env);
56
56
  }
57
57
  else {
@@ -155,7 +155,7 @@ var Package;
155
155
  async function validatePublishSettings(cwd, fs, token) {
156
156
  const manifest = await manifest_1.Manifest.read(cwd, fs);
157
157
  const { name, publisher, description } = manifest;
158
- const invalidName = manifest_1.Manifest.validateProjectName(name, manifest_1.Manifest.isLibraryProject(manifest));
158
+ const invalidName = manifest_1.Manifest.validateProjectName(name, manifest_1.Manifest.isLibrary(manifest));
159
159
  if (invalidName) {
160
160
  throw new Error(`name: ${invalidName}`);
161
161
  }
@@ -168,7 +168,7 @@ var Package;
168
168
  throw new Error(`publisher: ${invalidPublisher}`);
169
169
  }
170
170
  // only validate if the project is not a library project
171
- if (!manifest_1.Manifest.isLibraryProject(manifest)) {
171
+ if (!manifest_1.Manifest.isLibrary(manifest)) {
172
172
  await manifest_1.Manifest.validateApplicationIcon(cwd, fs, manifest);
173
173
  manifest_1.Manifest.validateEngineSettings(manifest);
174
174
  }
@@ -198,7 +198,11 @@ async function buildDDE(cwd, fs) {
198
198
  throwIfDiagnosticsHaveError(apm_1.APM.Part.dde, result.diagnostics);
199
199
  if (result.ddeJSON) {
200
200
  await dde_1.DDE.exportMyDatanetXML(cwd, fs, result.ddeJSON);
201
- await dde_1.DDE.exportHistoryJson(cwd, fs, result.ddeJSON);
201
+ const manifest = await manifest_1.Manifest.read(cwd, fs);
202
+ // a library does not need a history.json
203
+ if (!manifest_1.Manifest.isLibrary(manifest)) {
204
+ await dde_1.DDE.exportHistoryJson(cwd, fs, result.ddeJSON);
205
+ }
202
206
  await dde_1.DDE.exportOpenApi(cwd, fs, result.ddeJSON);
203
207
  await dde_1.DDE.exportAutoDloFiles(cwd, fs, result.ddeJSON);
204
208
  await dlo_1.DLO.exportDloConfig(cwd, fs);
package/package.json CHANGED
@@ -1,76 +1,76 @@
1
- {
2
- "name": "@microtronics/studio-cli",
3
- "version": "0.15.0",
4
- "description": "Microtronics Studio CLI Tool",
5
- "main": "./out/api.js",
6
- "typings": "./dist/studio-cli.d.ts",
7
- "bin": {
8
- "studio-cli": "studio-cli"
9
- },
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "scripts": {
14
- "release": "release-it --ci",
15
- "compile": "npm run build:registryApiTypings && tsc",
16
- "api": "api-extractor run --local --verbose",
17
- "build": "npm run compile && npm run api",
18
- "watch:build": "npm run compile -- --watch",
19
- "test": "cross-env STUDIO_ENV=lucky mocha",
20
- "test-ci": "cross-env STUDIO_ENV=lucky mocha --reporter mocha-junit-reporter",
21
- "watch:test": "npm run test -- --watch",
22
- "prepublishOnly": "npm run build",
23
- "build:registryApiTypings": "npx openapi-typescript https://api.registry.stage.microtronics.com/v1/openapi.yaml -o ./src/typings/registry.ts"
24
- },
25
- "author": "Microtronics",
26
- "license": "ISC",
27
- "dependencies": {
28
- "ajv": "^8.17.1",
29
- "ajv-formats": "^3.0.1",
30
- "ajv-keywords": "^5.1.0",
31
- "commander": "^12.1.0",
32
- "cross-fetch": "^4.0.0",
33
- "glob": "^11.0.1",
34
- "iconv-lite": "^0.6.3",
35
- "minimatch": "^10.0.1",
36
- "ini": "^5.0.0",
37
- "openapi-fetch": "^0.13.0",
38
- "pako": "^2.1.0",
39
- "semver": "^7.6.3",
40
- "tarballjs": "github:ankitrohatgi/tarballjs",
41
- "tinytar-fix": "^0.1.1",
42
- "vscode-uri": "^3.0.8",
43
- "yaml": "^2.6.1",
44
- "image-dimensions": "^2.3.0",
45
- "file-type-checker": "^1.1.2"
46
- },
47
- "engines": {
48
- "node": ">= 22"
49
- },
50
- "devDependencies": {
51
- "@microsoft/api-extractor": "^7.47.11",
52
- "@types/chai": "^4.3.6",
53
- "@types/chai-as-promised": "^7.1.5",
54
- "@types/ini": "^4.1.1",
55
- "@types/mocha": "^10.0.9",
56
- "@types/node": "^22.9.1",
57
- "@types/semver": "^7.5.6",
58
- "@types/vscode": "^1.86.2",
59
- "chai": "^4.3.8",
60
- "chai-as-promised": "^7.1.2",
61
- "cross-env": "^7.0.3",
62
- "mocha": "^10.8.2",
63
- "mocha-junit-reporter": "^2.2.1",
64
- "openapi-typescript": "^7.6.0",
65
- "ts-node": "^10.9.2",
66
- "typescript": "^5.6.3"
67
- },
68
- "mocha": {
69
- "require": [
70
- "ts-node/register"
71
- ],
72
- "watch-files": "src/**",
73
- "spec": "./test/**/*.spec.ts",
74
- "recursive": true
75
- }
76
- }
1
+ {
2
+ "name": "@microtronics/studio-cli",
3
+ "version": "0.16.0",
4
+ "description": "Microtronics Studio CLI Tool",
5
+ "main": "./out/api.js",
6
+ "typings": "./dist/studio-cli.d.ts",
7
+ "bin": {
8
+ "studio-cli": "studio-cli"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "scripts": {
14
+ "release": "release-it --ci",
15
+ "compile": "npm run build:registryApiTypings && tsc",
16
+ "api": "api-extractor run --local --verbose",
17
+ "build": "npm run compile && npm run api",
18
+ "watch:build": "npm run compile -- --watch",
19
+ "test": "cross-env STUDIO_ENV=lucky mocha",
20
+ "test-ci": "cross-env STUDIO_ENV=lucky mocha --reporter mocha-junit-reporter",
21
+ "watch:test": "npm run test -- --watch",
22
+ "prepublishOnly": "npm run build",
23
+ "build:registryApiTypings": "npx openapi-typescript https://api.registry.stage.microtronics.com/v1/openapi.yaml -o ./src/typings/registry.ts"
24
+ },
25
+ "author": "Microtronics",
26
+ "license": "ISC",
27
+ "dependencies": {
28
+ "ajv": "^8.17.1",
29
+ "ajv-formats": "^3.0.1",
30
+ "ajv-keywords": "^5.1.0",
31
+ "commander": "^12.1.0",
32
+ "cross-fetch": "^4.0.0",
33
+ "glob": "^11.0.1",
34
+ "iconv-lite": "^0.6.3",
35
+ "minimatch": "^10.0.1",
36
+ "ini": "^5.0.0",
37
+ "openapi-fetch": "^0.13.0",
38
+ "pako": "^2.1.0",
39
+ "semver": "^7.6.3",
40
+ "tarballjs": "github:ankitrohatgi/tarballjs",
41
+ "tinytar-fix": "^0.1.1",
42
+ "vscode-uri": "^3.0.8",
43
+ "yaml": "^2.6.1",
44
+ "image-dimensions": "^2.3.0",
45
+ "file-type-checker": "^1.1.2"
46
+ },
47
+ "engines": {
48
+ "node": ">= 22"
49
+ },
50
+ "devDependencies": {
51
+ "@microsoft/api-extractor": "^7.47.11",
52
+ "@types/chai": "^4.3.6",
53
+ "@types/chai-as-promised": "^7.1.5",
54
+ "@types/ini": "^4.1.1",
55
+ "@types/mocha": "^10.0.9",
56
+ "@types/node": "^22.9.1",
57
+ "@types/semver": "^7.5.6",
58
+ "@types/vscode": "^1.86.2",
59
+ "chai": "^4.3.8",
60
+ "chai-as-promised": "^7.1.2",
61
+ "cross-env": "^7.0.3",
62
+ "mocha": "^10.8.2",
63
+ "mocha-junit-reporter": "^2.2.1",
64
+ "openapi-typescript": "^7.6.0",
65
+ "ts-node": "^10.9.2",
66
+ "typescript": "^5.6.3"
67
+ },
68
+ "mocha": {
69
+ "require": [
70
+ "ts-node/register"
71
+ ],
72
+ "watch-files": "src/**",
73
+ "spec": "./test/**/*.spec.ts",
74
+ "recursive": true
75
+ }
76
+ }