@microtronics/studio-cli 0.61.0 → 0.62.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 +9 -3
- package/README.md +17 -0
- package/dist/main.js +54 -57
- package/dist/studio-cli.d.ts +1 -0
- package/out/api.js +137 -149
- package/out/studio-cli.d.ts +5297 -0
- package/package.json +4 -4
- package/out/DeviceProfiles.js +0 -436
- package/out/FS.js +0 -43
- package/out/crc.js +0 -93
- package/out/dde/coreDefinitions.js +0 -541
- package/out/dde/dde.js +0 -618
- package/out/dde/dynamic-dde.schema.json +0 -1061
- package/out/dde/fileGenerators/api.js +0 -688
- package/out/dde/fileGenerators/dlo.js +0 -1014
- package/out/dde/fileGenerators/dloLocalData.js +0 -387
- package/out/dde/fileGenerators/xml.js +0 -180
- package/out/dde/yamlDdePreCompiler.js +0 -889
- package/out/defaultFiles.js +0 -114
- package/out/dependencies.js +0 -578
- package/out/dfiles/dfiles.js +0 -205
- package/out/diagnostics.js +0 -10
- package/out/dlo/CustomWasmFS.js +0 -258
- package/out/dlo/compiler.js +0 -231
- package/out/dlo/dlo.js +0 -33
- package/out/dlo/dlocc.js +0 -3799
- package/out/dlo/fileSequencer.js +0 -40
- package/out/dlo/preCompiler.js +0 -442
- package/out/dotenv.js +0 -28
- package/out/globals.js +0 -402
- package/out/helper.js +0 -145
- package/out/log.js +0 -60
- package/out/manifest.js +0 -492
- package/out/myDatanetClient.js +0 -291
- package/out/package/apm.js +0 -294
- package/out/package/library.js +0 -165
- package/out/package/package.js +0 -518
- package/out/registryAPI.js +0 -326
- package/out/scriptRunner.js +0 -107
- package/out/typings/registry.js +0 -7
package/out/registryAPI.js
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
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.Registry = void 0;
|
|
7
|
-
exports.buildAuthHeader = buildAuthHeader;
|
|
8
|
-
require("cross-fetch/polyfill");
|
|
9
|
-
const openapi_fetch_1 = __importDefault(require("openapi-fetch"));
|
|
10
|
-
const globals_1 = require("./globals");
|
|
11
|
-
const preload_1 = __importDefault(require("semver/preload"));
|
|
12
|
-
const { GET, POST, PUT } = (0, openapi_fetch_1.default)();
|
|
13
|
-
function buildAuthHeader(token) {
|
|
14
|
-
if (token) {
|
|
15
|
-
return { authorization: `Bearer ${token}` };
|
|
16
|
-
}
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
var Registry;
|
|
20
|
-
(function (Registry) {
|
|
21
|
-
/**
|
|
22
|
-
* Get the actual api url based on the STUDIO_ENV
|
|
23
|
-
*/
|
|
24
|
-
Registry.getAPIUrl = (env) => {
|
|
25
|
-
let url = 'https://api.registry.microtronics.com';
|
|
26
|
-
if (env === globals_1.Globals.ENV.lucky) {
|
|
27
|
-
url = 'https://api.registry.lucky.ci.microtronics.com';
|
|
28
|
-
}
|
|
29
|
-
else if (env === globals_1.Globals.ENV.wynni) {
|
|
30
|
-
url = 'https://api.registry.wynni.ci.microtronics.com';
|
|
31
|
-
}
|
|
32
|
-
return { baseUrl: url + '/v1' };
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Fetch the library profile of the given library
|
|
36
|
-
* @param token
|
|
37
|
-
* @param publisherId
|
|
38
|
-
* @param libraryId
|
|
39
|
-
* @param env
|
|
40
|
-
*/
|
|
41
|
-
async function getLibraryProfile(token, publisherId, libraryId, env) {
|
|
42
|
-
const { data, error } = await GET('/publisher/{publisherId}/libraries/{libraryId}', {
|
|
43
|
-
...Registry.getAPIUrl(env),
|
|
44
|
-
headers: { ...buildAuthHeader(token) },
|
|
45
|
-
params: {
|
|
46
|
-
path: {
|
|
47
|
-
publisherId,
|
|
48
|
-
libraryId
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
if (error) {
|
|
53
|
-
throw new Error(error.reason);
|
|
54
|
-
}
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
Registry.getLibraryProfile = getLibraryProfile;
|
|
58
|
-
async function fetchCustomContent(token, contentURL, json = false) {
|
|
59
|
-
const response = await fetch(contentURL, {
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
headers: {
|
|
62
|
-
...buildAuthHeader(token),
|
|
63
|
-
...injectSemverHeader(true)
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
if (response.status === 200) {
|
|
67
|
-
if (json) {
|
|
68
|
-
return await response.json();
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
return await response.arrayBuffer();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
throw new Error('Failed to fetch the library content');
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
Registry.fetchCustomContent = fetchCustomContent;
|
|
79
|
-
async function getPublisher(token, publisherId, env) {
|
|
80
|
-
try {
|
|
81
|
-
const { data, error } = await GET('/publisher/{publisherId}', {
|
|
82
|
-
...Registry.getAPIUrl(env),
|
|
83
|
-
headers: { ...buildAuthHeader(token) },
|
|
84
|
-
params: {
|
|
85
|
-
path: {
|
|
86
|
-
publisherId: publisherId
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
if (error) {
|
|
91
|
-
console.error(error);
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
return data;
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
console.error(e);
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
Registry.getPublisher = getPublisher;
|
|
102
|
-
async function createNewApplication(token, publisherId, newApplication, env) {
|
|
103
|
-
try {
|
|
104
|
-
const { data, error } = await POST('/packages/{publisherId}/applications', {
|
|
105
|
-
...Registry.getAPIUrl(env),
|
|
106
|
-
headers: {
|
|
107
|
-
...buildAuthHeader(token),
|
|
108
|
-
...injectSemverHeader(true)
|
|
109
|
-
},
|
|
110
|
-
params: {
|
|
111
|
-
path: {
|
|
112
|
-
publisherId
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
body: {
|
|
116
|
-
...newApplication
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
if (error) {
|
|
120
|
-
throw new Error(error.reason);
|
|
121
|
-
}
|
|
122
|
-
return data.id;
|
|
123
|
-
}
|
|
124
|
-
catch (e) {
|
|
125
|
-
// todo log error
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
Registry.createNewApplication = createNewApplication;
|
|
130
|
-
async function getExistingApplication(token, publisherId, applicationId, env) {
|
|
131
|
-
const { data, error } = await GET('/publisher/{publisherId}/applications/{applicationId}', {
|
|
132
|
-
...Registry.getAPIUrl(env),
|
|
133
|
-
headers: {
|
|
134
|
-
...buildAuthHeader(token),
|
|
135
|
-
...injectSemverHeader(true)
|
|
136
|
-
},
|
|
137
|
-
params: {
|
|
138
|
-
path: {
|
|
139
|
-
publisherId,
|
|
140
|
-
applicationId
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
if (error) {
|
|
145
|
-
throw new Error(error.reason);
|
|
146
|
-
}
|
|
147
|
-
return data;
|
|
148
|
-
}
|
|
149
|
-
Registry.getExistingApplication = getExistingApplication;
|
|
150
|
-
async function updateExistingApplication(token, publisherId, applicationId, updatedApplication, env) {
|
|
151
|
-
try {
|
|
152
|
-
const { error } = await PUT(`/packages/{publisherId}/applications/{applicationId}`, {
|
|
153
|
-
...Registry.getAPIUrl(env),
|
|
154
|
-
headers: {
|
|
155
|
-
...buildAuthHeader(token),
|
|
156
|
-
...injectSemverHeader(true)
|
|
157
|
-
},
|
|
158
|
-
params: {
|
|
159
|
-
path: {
|
|
160
|
-
publisherId,
|
|
161
|
-
applicationId
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
body: {
|
|
165
|
-
...updatedApplication
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
if (error) {
|
|
169
|
-
throw new Error(error.reason);
|
|
170
|
-
}
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
catch (e) {
|
|
174
|
-
// todo log error
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
Registry.updateExistingApplication = updateExistingApplication;
|
|
179
|
-
async function updateExistingApplicationVersion(token, publisherId, applicationId, applicationVersion, updatedApplicationVersion, env) {
|
|
180
|
-
const isSemver = !!preload_1.default.valid(applicationVersion);
|
|
181
|
-
try {
|
|
182
|
-
const { error } = await PUT(`/packages/{publisherId}/applications/{applicationId}/versions/{applicationVersion}`, {
|
|
183
|
-
...Registry.getAPIUrl(env),
|
|
184
|
-
headers: {
|
|
185
|
-
...buildAuthHeader(token),
|
|
186
|
-
...injectSemverHeader(isSemver)
|
|
187
|
-
},
|
|
188
|
-
params: {
|
|
189
|
-
path: {
|
|
190
|
-
publisherId,
|
|
191
|
-
applicationId,
|
|
192
|
-
applicationVersion
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
body: {
|
|
196
|
-
...updatedApplicationVersion
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
if (error) {
|
|
200
|
-
throw new Error(error.reason);
|
|
201
|
-
}
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
catch (e) {
|
|
205
|
-
// todo log error
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
Registry.updateExistingApplicationVersion = updateExistingApplicationVersion;
|
|
210
|
-
async function publishApplicationVersion(token, publisherId, applicationId, version, apmTagBuffer, env) {
|
|
211
|
-
const isSemver = !!preload_1.default.valid(version);
|
|
212
|
-
const { data, error } = await POST('/packages/{publisherId}/applications/{applicationId}/versions/{applicationVersion}', {
|
|
213
|
-
...Registry.getAPIUrl(env),
|
|
214
|
-
headers: {
|
|
215
|
-
...buildAuthHeader(token),
|
|
216
|
-
...injectSemverHeader(isSemver)
|
|
217
|
-
},
|
|
218
|
-
params: {
|
|
219
|
-
path: {
|
|
220
|
-
publisherId,
|
|
221
|
-
applicationId,
|
|
222
|
-
applicationVersion: version
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
// @ts-ignore
|
|
226
|
-
body: {},
|
|
227
|
-
bodySerializer() {
|
|
228
|
-
return apmTagBuffer;
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
if (error) {
|
|
232
|
-
//@ts-ignore
|
|
233
|
-
throw new Error(error.reason || error.err || error);
|
|
234
|
-
}
|
|
235
|
-
return data;
|
|
236
|
-
}
|
|
237
|
-
Registry.publishApplicationVersion = publishApplicationVersion;
|
|
238
|
-
const NameToMimeType = {
|
|
239
|
-
'README.md': 'text/markdown',
|
|
240
|
-
'CHANGELOG.md': 'text/markdown',
|
|
241
|
-
'library.tar.gz': 'application/gzip',
|
|
242
|
-
'studio.json': 'application/json'
|
|
243
|
-
};
|
|
244
|
-
async function publishLibraryVersion(token, publisherId, libraryId, libraryVersion, files, env) {
|
|
245
|
-
try {
|
|
246
|
-
const { error } = await POST('/packages/{publisherId}/libraries/{libraryId}/versions/{libraryVersion}', {
|
|
247
|
-
...Registry.getAPIUrl(env),
|
|
248
|
-
headers: {
|
|
249
|
-
...buildAuthHeader(token),
|
|
250
|
-
...injectSemverHeader(true)
|
|
251
|
-
},
|
|
252
|
-
params: {
|
|
253
|
-
path: {
|
|
254
|
-
publisherId,
|
|
255
|
-
libraryId,
|
|
256
|
-
libraryVersion
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
//@ts-ignore
|
|
260
|
-
body: {
|
|
261
|
-
...files
|
|
262
|
-
},
|
|
263
|
-
bodySerializer(body) {
|
|
264
|
-
const fd = new FormData();
|
|
265
|
-
//@ts-ignore
|
|
266
|
-
for (const [k, v] of Object.entries(body)) {
|
|
267
|
-
// append key as filename:
|
|
268
|
-
if (v !== undefined) {
|
|
269
|
-
//@ts-ignore
|
|
270
|
-
fd.append(k, new Blob([v], { type: NameToMimeType[k] }), k);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return fd;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
if (error) {
|
|
277
|
-
throw new Error(error.reason);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
catch (e) {
|
|
281
|
-
console.error(e);
|
|
282
|
-
throw e;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
Registry.publishLibraryVersion = publishLibraryVersion;
|
|
286
|
-
async function updateApplicationFile(token, publisherId, applicationId, applicationVersion, applicationFileName, blob, env) {
|
|
287
|
-
const isSemver = !!preload_1.default.valid(applicationVersion);
|
|
288
|
-
const { error } = await POST('/packages/{publisherId}/applications/{applicationId}/versions/{applicationVersion}/files/{applicationFileName}', {
|
|
289
|
-
...Registry.getAPIUrl(env),
|
|
290
|
-
headers: {
|
|
291
|
-
...buildAuthHeader(token),
|
|
292
|
-
...injectSemverHeader(isSemver),
|
|
293
|
-
'Content-Type': 'application/octet-stream'
|
|
294
|
-
},
|
|
295
|
-
params: {
|
|
296
|
-
path: {
|
|
297
|
-
publisherId,
|
|
298
|
-
applicationId,
|
|
299
|
-
applicationVersion,
|
|
300
|
-
applicationFileName
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
//@ts-ignore
|
|
304
|
-
body: {},
|
|
305
|
-
bodySerializer() {
|
|
306
|
-
return blob;
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
if (error) {
|
|
310
|
-
throw new Error(error.reason);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
Registry.updateApplicationFile = updateApplicationFile;
|
|
314
|
-
/**
|
|
315
|
-
* inject the X-Semver header for application based requests
|
|
316
|
-
* with this header the semver versioning is required
|
|
317
|
-
*/
|
|
318
|
-
function injectSemverHeader(useSemver = false) {
|
|
319
|
-
if (useSemver) {
|
|
320
|
-
return { 'X-Semver': 'true' };
|
|
321
|
-
}
|
|
322
|
-
return {};
|
|
323
|
-
}
|
|
324
|
-
Registry.injectSemverHeader = injectSemverHeader;
|
|
325
|
-
})(Registry || (exports.Registry = Registry = {}));
|
|
326
|
-
//# sourceMappingURL=registryAPI.js.map
|
package/out/scriptRunner.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Shell = void 0;
|
|
27
|
-
const vscode_uri_1 = require("vscode-uri");
|
|
28
|
-
const manifest_1 = require("./manifest");
|
|
29
|
-
const child_process = __importStar(require("node:child_process"));
|
|
30
|
-
const apm_1 = require("./package/apm");
|
|
31
|
-
var Shell;
|
|
32
|
-
(function (Shell) {
|
|
33
|
-
/**
|
|
34
|
-
* Calls the POV build command defined within the manifest
|
|
35
|
-
* @param cwd
|
|
36
|
-
* @param fs
|
|
37
|
-
* @param logger
|
|
38
|
-
*/
|
|
39
|
-
async function tryBuildPov(cwd, fs, logger) {
|
|
40
|
-
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
41
|
-
if (await manifest_1.Manifest.isApmPartEnabled(cwd, fs, apm_1.APM.Part.pov)) {
|
|
42
|
-
logger.info('Executing POV build script', manifest.pov?.details.buildCommand);
|
|
43
|
-
const { buildCommand, workingPath } = manifest.pov.details;
|
|
44
|
-
const povDir = vscode_uri_1.Utils.joinPath(cwd, workingPath);
|
|
45
|
-
try {
|
|
46
|
-
await execShell(povDir, buildCommand, logger);
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
if (e.code) {
|
|
50
|
-
throw new Error(`APM part '${apm_1.APM.Part.pov}' has errors. Aborted.`);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
throw e;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
Shell.tryBuildPov = tryBuildPov;
|
|
59
|
-
/**
|
|
60
|
-
* Calls the BLO build command defined within the manifest
|
|
61
|
-
* @param cwd
|
|
62
|
-
* @param fs
|
|
63
|
-
* @param logger
|
|
64
|
-
*/
|
|
65
|
-
async function tryBuildBlo(cwd, fs, logger) {
|
|
66
|
-
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
67
|
-
if (await manifest_1.Manifest.isApmPartEnabled(cwd, fs, apm_1.APM.Part.blo, manifest)) {
|
|
68
|
-
logger.info('Executing BLO build script', manifest.blo?.buildCommand);
|
|
69
|
-
const { buildCommand, workingPath } = manifest.blo;
|
|
70
|
-
const bloDir = vscode_uri_1.Utils.joinPath(cwd, workingPath);
|
|
71
|
-
try {
|
|
72
|
-
await execShell(bloDir, buildCommand, logger);
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
if (e.code) {
|
|
76
|
-
throw new Error(`APM part '${apm_1.APM.Part.blo}' has errors. Aborted.`);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
throw e;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
Shell.tryBuildBlo = tryBuildBlo;
|
|
85
|
-
})(Shell || (exports.Shell = Shell = {}));
|
|
86
|
-
/**
|
|
87
|
-
* Generic shell executor
|
|
88
|
-
* @param cwd - working dir where the command should be executed in
|
|
89
|
-
* @param cmd - the shell command
|
|
90
|
-
* @param logger
|
|
91
|
-
*/
|
|
92
|
-
async function execShell(cwd, cmd, logger) {
|
|
93
|
-
return new Promise((resolve, reject) => {
|
|
94
|
-
// todo use spawn instead of exec to allow streaming to the console
|
|
95
|
-
child_process.exec(cmd, { cwd: cwd.fsPath, env: process.env }, (error, stdout, stderr) => {
|
|
96
|
-
logger.log(stdout);
|
|
97
|
-
if (stderr) {
|
|
98
|
-
logger.error(stderr);
|
|
99
|
-
}
|
|
100
|
-
if (error) {
|
|
101
|
-
reject(error);
|
|
102
|
-
}
|
|
103
|
-
resolve(null);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=scriptRunner.js.map
|
package/out/typings/registry.js
DELETED