@microtronics/studio-cli 0.24.0 → 0.25.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 +11 -2
- package/dist/studio-cli.d.ts +35 -0
- package/out/api.js +62 -0
- package/out/main.js +29 -35
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.25.0 (2025-03-12)
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
### Features
|
|
7
7
|
|
|
8
|
-
* **studio-cli:**
|
|
8
|
+
* **studio-cli:** show update notification after each cli command ([c719fd8](https://bitbucket.org/microtronics-core/vscode-studio/commits/c719fd8ea6a7dda16589764d2ae77f70e006d80a))
|
|
9
|
+
|
|
10
|
+
## 0.24.1 (2025-03-12)
|
|
11
|
+
|
|
12
|
+
## 0.24.0 (2025-03-10)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **studio-cli:** correct server version to allow app type addon ([1ff035c](https://bitbucket.org/microtronics-core/vscode-studio/commits/1ff035c30ced5018228646b28b0855ba8202aceb))
|
|
9
18
|
* **studio-core:** support to download a specific app version ([30bd6b2](https://bitbucket.org/microtronics-core/vscode-studio/commits/30bd6b23db14790c55771de4d4d1622bab26edc7))
|
|
10
19
|
|
|
11
20
|
## 0.23.0 (2025-02-25)
|
package/dist/studio-cli.d.ts
CHANGED
|
@@ -115,6 +115,16 @@ declare interface BaseTagHeader {
|
|
|
115
115
|
addon_max_sources?: number;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Builds all parts of the specified project in the given working directory.
|
|
120
|
+
*
|
|
121
|
+
* @param {URI} cwd - The current working directory where the build process will be executed.
|
|
122
|
+
* @param {LocalFS} fs - The local file system instance used for file operations during the build.
|
|
123
|
+
* @param {APM.Part} part - The project part to be built.
|
|
124
|
+
* @return {Promise<any>} A promise that resolves when the build process is complete.
|
|
125
|
+
*/
|
|
126
|
+
export declare function build(cwd: URI, fs: LocalFS, part?: APM.Part): Promise<any>;
|
|
127
|
+
|
|
118
128
|
declare interface components {
|
|
119
129
|
schemas: {
|
|
120
130
|
/** @default 25 */
|
|
@@ -2003,6 +2013,18 @@ export declare namespace Helper {
|
|
|
2003
2013
|
export function defer(token: string, timeout: number, callback: any): void;
|
|
2004
2014
|
}
|
|
2005
2015
|
|
|
2016
|
+
/**
|
|
2017
|
+
* Installs the specified dependencies or all dependencies if none are provided.
|
|
2018
|
+
*
|
|
2019
|
+
* @param {URI} cwd - The current working directory where the installation process takes place.
|
|
2020
|
+
* @param {LocalFS} fs - The file system interface used for managing files during the installation process.
|
|
2021
|
+
* @param {Globals.ENV} env - The global environment configuration used during the installation.
|
|
2022
|
+
* @param {string|null} apiToken - The API token for authentication, if required, or null if not applicable.
|
|
2023
|
+
* @param {string[]} dependencies - An array of dependency strings in the format "libraryId@version". If empty, all dependencies will be installed.
|
|
2024
|
+
* @return {Promise<void>} A promise that resolves when the installation process completes successfully or logs an error if it fails.
|
|
2025
|
+
*/
|
|
2026
|
+
export declare function install(cwd: URI, fs: LocalFS, env: Globals.ENV, apiToken: string | null, dependencies: string[]): Promise<void>;
|
|
2027
|
+
|
|
2006
2028
|
export declare namespace Library {
|
|
2007
2029
|
/**
|
|
2008
2030
|
* Creates the library.tar.gz archive content
|
|
@@ -4480,6 +4502,19 @@ declare interface paths {
|
|
|
4480
4502
|
};
|
|
4481
4503
|
}
|
|
4482
4504
|
|
|
4505
|
+
/**
|
|
4506
|
+
* Publishes a package to the registry with the specified settings and configurations.
|
|
4507
|
+
*
|
|
4508
|
+
* @param {URI} cwd - The current working directory of the package.
|
|
4509
|
+
* @param {LocalFS} fs - The file system interface for reading and writing files.
|
|
4510
|
+
* @param {Globals.ENV} env - The environment configuration for the publishing process.
|
|
4511
|
+
* @param {string | null} apiToken - The API token for authentication, or null if not applicable.
|
|
4512
|
+
* @param {string | undefined} optsAllowedBackends - A semicolon-separated list of allowed backends, or '*' to allow all, or undefined if not specified.
|
|
4513
|
+
* @param {APM.TagPhase} optsPhase - The release phase tag associated with the package publishing.
|
|
4514
|
+
* @return {Promise<void>} A promise that resolves when the package has been successfully published or rejects with an error if the process fails.
|
|
4515
|
+
*/
|
|
4516
|
+
export declare function publish(cwd: URI, fs: LocalFS, env: Globals.ENV, apiToken: string | null, optsAllowedBackends: string | undefined, optsPhase: APM.TagPhase): Promise<void>;
|
|
4517
|
+
|
|
4483
4518
|
export declare namespace Registry {
|
|
4484
4519
|
export type AuthToken = string | null;
|
|
4485
4520
|
/**
|
package/out/api.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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
|
+
exports.install = install;
|
|
5
|
+
exports.build = build;
|
|
6
|
+
exports.publish = publish;
|
|
4
7
|
const dependencies_1 = require("./dependencies");
|
|
5
8
|
Object.defineProperty(exports, "Dependencies", { enumerable: true, get: function () { return dependencies_1.Dependencies; } });
|
|
6
9
|
const manifest_1 = require("./manifest");
|
|
@@ -33,4 +36,63 @@ const dfiles_1 = require("./dfiles/dfiles");
|
|
|
33
36
|
Object.defineProperty(exports, "DFILES", { enumerable: true, get: function () { return dfiles_1.DFILES; } });
|
|
34
37
|
const dotenv_1 = require("./dotenv");
|
|
35
38
|
Object.defineProperty(exports, "ENV", { enumerable: true, get: function () { return dotenv_1.ENV; } });
|
|
39
|
+
/**
|
|
40
|
+
* Installs the specified dependencies or all dependencies if none are provided.
|
|
41
|
+
*
|
|
42
|
+
* @param {URI} cwd - The current working directory where the installation process takes place.
|
|
43
|
+
* @param {LocalFS} fs - The file system interface used for managing files during the installation process.
|
|
44
|
+
* @param {Globals.ENV} env - The global environment configuration used during the installation.
|
|
45
|
+
* @param {string|null} apiToken - The API token for authentication, if required, or null if not applicable.
|
|
46
|
+
* @param {string[]} dependencies - An array of dependency strings in the format "libraryId@version". If empty, all dependencies will be installed.
|
|
47
|
+
* @return {Promise<void>} A promise that resolves when the installation process completes successfully or logs an error if it fails.
|
|
48
|
+
*/
|
|
49
|
+
async function install(cwd, fs, env, apiToken, dependencies) {
|
|
50
|
+
try {
|
|
51
|
+
if (dependencies.length > 0) {
|
|
52
|
+
for (const dependency of dependencies) {
|
|
53
|
+
const [libraryId, version] = dependency.split('@');
|
|
54
|
+
await dependencies_1.Dependencies.installDependency(cwd, fs, env, apiToken, libraryId, version || null);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return await dependencies_1.Dependencies.installDependencies(cwd, fs, env, apiToken);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
console.error(e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Builds all parts of the specified project in the given working directory.
|
|
67
|
+
*
|
|
68
|
+
* @param {URI} cwd - The current working directory where the build process will be executed.
|
|
69
|
+
* @param {LocalFS} fs - The local file system instance used for file operations during the build.
|
|
70
|
+
* @param {APM.Part} part - The project part to be built.
|
|
71
|
+
* @return {Promise<any>} A promise that resolves when the build process is complete.
|
|
72
|
+
*/
|
|
73
|
+
async function build(cwd, fs, part) {
|
|
74
|
+
return package_1.Package.buildAll(cwd, fs, part);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Publishes a package to the registry with the specified settings and configurations.
|
|
78
|
+
*
|
|
79
|
+
* @param {URI} cwd - The current working directory of the package.
|
|
80
|
+
* @param {LocalFS} fs - The file system interface for reading and writing files.
|
|
81
|
+
* @param {Globals.ENV} env - The environment configuration for the publishing process.
|
|
82
|
+
* @param {string | null} apiToken - The API token for authentication, or null if not applicable.
|
|
83
|
+
* @param {string | undefined} optsAllowedBackends - A semicolon-separated list of allowed backends, or '*' to allow all, or undefined if not specified.
|
|
84
|
+
* @param {APM.TagPhase} optsPhase - The release phase tag associated with the package publishing.
|
|
85
|
+
* @return {Promise<void>} A promise that resolves when the package has been successfully published or rejects with an error if the process fails.
|
|
86
|
+
*/
|
|
87
|
+
async function publish(cwd, fs, env, apiToken, optsAllowedBackends, optsPhase) {
|
|
88
|
+
let allowedBackends = null;
|
|
89
|
+
if (optsAllowedBackends) {
|
|
90
|
+
allowedBackends = optsAllowedBackends === '*' ? optsAllowedBackends : optsAllowedBackends.split(';');
|
|
91
|
+
const errorMessage = await manifest_1.Manifest.validateRegistryAllowedBackends(allowedBackends);
|
|
92
|
+
if (errorMessage) {
|
|
93
|
+
throw new Error(errorMessage);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
await package_1.Package.release(cwd, fs, apiToken, optsPhase, allowedBackends, env);
|
|
97
|
+
}
|
|
36
98
|
//# sourceMappingURL=api.js.map
|
package/out/main.js
CHANGED
|
@@ -7,14 +7,12 @@ const commander_1 = require("commander");
|
|
|
7
7
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
8
8
|
const cliFS_1 = require("./cliFS");
|
|
9
9
|
const vscode_uri_1 = require("vscode-uri");
|
|
10
|
-
const dependencies_1 = require("./dependencies");
|
|
11
|
-
var installDependencies = dependencies_1.Dependencies.installDependencies;
|
|
12
|
-
var installDependency = dependencies_1.Dependencies.installDependency;
|
|
13
|
-
const package_1 = require("./package/package");
|
|
14
10
|
const apm_1 = require("./package/apm");
|
|
15
11
|
const globals_1 = require("./globals");
|
|
16
|
-
const
|
|
12
|
+
const update_notifier_1 = __importDefault(require("update-notifier"));
|
|
13
|
+
const api_1 = require("./api");
|
|
17
14
|
const program = new commander_1.Command();
|
|
15
|
+
const notifier = (0, update_notifier_1.default)({ pkg: package_json_1.default });
|
|
18
16
|
// dummy cwd
|
|
19
17
|
const devPath = () => {
|
|
20
18
|
if (process.env.NODE_ENV === 'local-dev-app') {
|
|
@@ -30,6 +28,19 @@ const devPath = () => {
|
|
|
30
28
|
};
|
|
31
29
|
const cwd = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.file(process.cwd()), devPath());
|
|
32
30
|
program.version(package_json_1.default.version).usage('<command>');
|
|
31
|
+
/**
|
|
32
|
+
* Executes a task and ensures that the update available notification is sent after the task completes,
|
|
33
|
+
* regardless of whether it succeeds or fails.
|
|
34
|
+
*
|
|
35
|
+
* @param {Promise<void>} task - A promise representing the task to be executed.
|
|
36
|
+
* @return {void} This function does not return a value.
|
|
37
|
+
*/
|
|
38
|
+
function main(task) {
|
|
39
|
+
// todo add task catch handler like: https://github.com/microsoft/vscode-vsce/blob/5518f2f242983d23f1983f6dd0350474f2011543/src/main.ts#L51
|
|
40
|
+
task.finally(() => {
|
|
41
|
+
notifier.notify();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
33
44
|
function handleStudioEnv(env) {
|
|
34
45
|
process.env.STUDIO_ENV = env || globals_1.Globals.ENV.production;
|
|
35
46
|
if (env && env !== globals_1.Globals.ENV.production) {
|
|
@@ -40,6 +51,12 @@ function handleStudioEnv(env) {
|
|
|
40
51
|
function getStudioApiToken(opts) {
|
|
41
52
|
return opts?.token || null;
|
|
42
53
|
}
|
|
54
|
+
function getDefaultOptions(opts) {
|
|
55
|
+
return {
|
|
56
|
+
env: handleStudioEnv(opts.env),
|
|
57
|
+
token: getStudioApiToken(opts)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
43
60
|
/**
|
|
44
61
|
* Generic option for the STUDIO_ENV
|
|
45
62
|
*/
|
|
@@ -58,29 +75,15 @@ program
|
|
|
58
75
|
.allowExcessArguments(true)
|
|
59
76
|
.addOption(optionStudioEnv)
|
|
60
77
|
.addOption(optionStudioToken)
|
|
61
|
-
.action(
|
|
62
|
-
const env =
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
if (dependencies.length > 0) {
|
|
66
|
-
for (const dependency of dependencies) {
|
|
67
|
-
const [libraryId, version] = dependency.split('@');
|
|
68
|
-
await installDependency(cwd, cliFS_1.cliFS, env, apiToken, libraryId, version || null);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
return await installDependencies(cwd, cliFS_1.cliFS, env, apiToken);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
catch (e) {
|
|
76
|
-
console.error(e);
|
|
77
|
-
}
|
|
78
|
+
.action((dependencies, opts) => {
|
|
79
|
+
const { env, token } = getDefaultOptions(opts);
|
|
80
|
+
main((0, api_1.install)(cwd, cliFS_1.cliFS, env, token, dependencies));
|
|
78
81
|
});
|
|
79
82
|
program
|
|
80
83
|
.command('build')
|
|
81
84
|
.addOption(new commander_1.Option('-p --part <APM part>', 'APM part that should be build').choices(Object.values(apm_1.APM.Part)))
|
|
82
|
-
.action(
|
|
83
|
-
|
|
85
|
+
.action(opts => {
|
|
86
|
+
main((0, api_1.build)(cwd, cliFS_1.cliFS, opts.part));
|
|
84
87
|
});
|
|
85
88
|
const releasePhaseArguments = Object.values(apm_1.APM.TagPhase);
|
|
86
89
|
program
|
|
@@ -92,17 +95,8 @@ program
|
|
|
92
95
|
.addOption(optionStudioEnv)
|
|
93
96
|
.addOption(optionStudioToken)
|
|
94
97
|
.action(async (opts) => {
|
|
95
|
-
const env =
|
|
96
|
-
|
|
97
|
-
let allowedBackends = null;
|
|
98
|
-
if (opts.allowedBackends) {
|
|
99
|
-
allowedBackends = opts.allowedBackends === '*' ? opts.allowedBackends : opts.allowedBackends.split(';');
|
|
100
|
-
const errorMessage = await manifest_1.Manifest.validateRegistryAllowedBackends(allowedBackends);
|
|
101
|
-
if (errorMessage) {
|
|
102
|
-
throw new Error(errorMessage);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
await package_1.Package.release(cwd, cliFS_1.cliFS, token, opts.phase, allowedBackends, env);
|
|
98
|
+
const { env, token } = getDefaultOptions(opts);
|
|
99
|
+
main((0, api_1.publish)(cwd, cliFS_1.cliFS, env, token, opts.allowedBackends, opts.phase));
|
|
106
100
|
});
|
|
107
101
|
module.exports = function (argv) {
|
|
108
102
|
program.parse(argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microtronics/studio-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Microtronics Studio CLI Tool",
|
|
5
5
|
"main": "./out/api.js",
|
|
6
6
|
"typings": "./dist/studio-cli.d.ts",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"semver": "^7.6.3",
|
|
43
43
|
"tarballjs": "github:ankitrohatgi/tarballjs",
|
|
44
44
|
"tinytar-fix": "^0.1.1",
|
|
45
|
+
"update-notifier": "^7.3.1",
|
|
45
46
|
"vscode-uri": "^3.0.8",
|
|
46
47
|
"yaml": "^2.6.1"
|
|
47
48
|
},
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"@types/mocha": "^10.0.9",
|
|
57
58
|
"@types/node": "^22.9.1",
|
|
58
59
|
"@types/semver": "^7.5.6",
|
|
60
|
+
"@types/update-notifier": "^6.0.8",
|
|
59
61
|
"@types/vscode": "^1.86.2",
|
|
60
62
|
"chai": "^4.3.8",
|
|
61
63
|
"chai-as-promised": "^7.1.2",
|