@microtronics/studio-cli 0.10.0 → 0.11.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 +14 -0
- package/dist/studio-cli.d.ts +69 -2
- package/out/api.d.ts.map +1 -1
- package/out/api.js +3 -1
- package/out/main.js +11 -3
- package/out/manifest.d.ts.map +1 -1
- package/out/manifest.js +44 -6
- package/out/package/apm.js +1 -25
- package/out/package/library.d.ts.map +1 -0
- package/out/package/library.js +162 -0
- package/out/package/package.d.ts.map +1 -1
- package/out/package/package.js +69 -3
- package/out/registryAPI.d.ts.map +1 -1
- package/out/registryAPI.js +48 -0
- package/package.json +2 -1
- package/studio-cli-app +4 -0
- package/studio-cli-lib +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## 0.11.0 (2025-01-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **studio-cli:** allow publishing a library project to the registry ([0eabc7d](https://bitbucket.org/microtronics-core/vscode-studio/commits/0eabc7dbf335dcd61a907eab3b56c2b4ba30f57b))
|
|
9
|
+
* **studio-cli:** validate the given version string within the studio.json ([4cb429c](https://bitbucket.org/microtronics-core/vscode-studio/commits/4cb429c37cda38cd3888b868f95efe223c11aa61))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **studio-cli:** consider during manifest validation if it is a library project ([b879aae](https://bitbucket.org/microtronics-core/vscode-studio/commits/b879aae85bced2b3bc874879ba8fa92a9928d0ae))
|
|
15
|
+
* **studio-cli:** forward studio environment to library publish function ([ba8f79f](https://bitbucket.org/microtronics-core/vscode-studio/commits/ba8f79f0fc9d05c92759a6d1ef4a11f690faba38))
|
|
16
|
+
|
|
3
17
|
## 0.10.0 (2025-01-14)
|
|
4
18
|
|
|
5
19
|
|
package/dist/studio-cli.d.ts
CHANGED
|
@@ -1901,6 +1901,34 @@ export declare namespace Helper {
|
|
|
1901
1901
|
export function patchValueWithArrayInfo(valueToPatch: any, arrayIndex: number): any;
|
|
1902
1902
|
}
|
|
1903
1903
|
|
|
1904
|
+
export declare namespace Library {
|
|
1905
|
+
/**
|
|
1906
|
+
* Creates the library.tar.gz archive content
|
|
1907
|
+
* @param cwd
|
|
1908
|
+
* @param fs
|
|
1909
|
+
*/
|
|
1910
|
+
export function createArchive(cwd: URI, fs: LocalFS): Promise<Uint8Array>;
|
|
1911
|
+
/**
|
|
1912
|
+
* Reads the project directory and returns all files that will be packed within the library.tar.gz
|
|
1913
|
+
* @param cwd
|
|
1914
|
+
* @param fs
|
|
1915
|
+
*/
|
|
1916
|
+
export function getFilesForArchive(cwd: URI, fs: LocalFS): Promise<{
|
|
1917
|
+
name: string;
|
|
1918
|
+
data: Uint8Array;
|
|
1919
|
+
modifyTime: Date;
|
|
1920
|
+
}[]>;
|
|
1921
|
+
/**
|
|
1922
|
+
* Publish new library package to the registry
|
|
1923
|
+
* @param cwd
|
|
1924
|
+
* @param fs
|
|
1925
|
+
* @param token
|
|
1926
|
+
* @param archive
|
|
1927
|
+
* @param env
|
|
1928
|
+
*/
|
|
1929
|
+
export function publishPackage(cwd: URI, fs: LocalFS, token: Registry.AuthToken, archive: Uint8Array, env?: Globals.ENV): Promise<void>;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1904
1932
|
declare interface LocalFS {
|
|
1905
1933
|
/**
|
|
1906
1934
|
* Filesystem rm function. It has to remove files or paths recursive
|
|
@@ -2001,6 +2029,12 @@ export declare namespace Manifest {
|
|
|
2001
2029
|
* @param fs
|
|
2002
2030
|
*/
|
|
2003
2031
|
export function read(cwd: URI, fs: LocalFS): Promise<Manifest>;
|
|
2032
|
+
/**
|
|
2033
|
+
* Reads the studio.json as an uint8array
|
|
2034
|
+
* @param cwd
|
|
2035
|
+
* @param fs
|
|
2036
|
+
*/
|
|
2037
|
+
export function readAsBlob(cwd: URI, fs: LocalFS): Promise<Uint8Array>;
|
|
2004
2038
|
/**
|
|
2005
2039
|
* Write the manifest to the workspace
|
|
2006
2040
|
* @param cwd
|
|
@@ -2017,8 +2051,9 @@ export declare namespace Manifest {
|
|
|
2017
2051
|
* @param cwd
|
|
2018
2052
|
* @param fs
|
|
2019
2053
|
* @param manifest
|
|
2054
|
+
* @param env
|
|
2020
2055
|
*/
|
|
2021
|
-
export function validateManifest(cwd: URI, fs: LocalFS, manifest
|
|
2056
|
+
export function validateManifest(cwd: URI, fs: LocalFS, manifest: Manifest.Manifest | null, env?: Globals.ENV): Promise<void>;
|
|
2022
2057
|
export function validateLibraryName(libraryName: string): false | "Library name can only contain 'a' through 'z', '0' through '9', '_' and '-'. The Library name must start with an alphabetic or numeric character." | "The library name is beyond permissible length of 20 characters.";
|
|
2023
2058
|
export function validateProjectName(name: string, isLibrary?: boolean): Promise<false | "Library name can only contain 'a' through 'z', '0' through '9', '_' and '-'. The Library name must start with an alphabetic or numeric character." | "The library name is beyond permissible length of 20 characters." | "Project name can only contain 'A' through 'Z', 'a' through 'z', '0' through '9', ' ', '_' and '-'. The Project name must start with an alphabetic or numeric character." | "The project name is beyond permissible length of 40 characters.">;
|
|
2024
2059
|
export function validateDescription(description: string): Promise<false | "The description must have at least 5 characters.">;
|
|
@@ -2036,14 +2071,33 @@ export declare namespace Package {
|
|
|
2036
2071
|
*/
|
|
2037
2072
|
export function buildAll(cwd: URI, fs: LocalFS, apmPart?: APM.Part): Promise<void>;
|
|
2038
2073
|
/**
|
|
2039
|
-
*
|
|
2074
|
+
* Trigger the release based on the manifest settings
|
|
2040
2075
|
* @param cwd
|
|
2041
2076
|
* @param fs
|
|
2042
2077
|
* @param token
|
|
2043
2078
|
* @param releasePhase
|
|
2044
2079
|
* @param env
|
|
2045
2080
|
*/
|
|
2081
|
+
export function release(cwd: URI, fs: LocalFS, token: Registry.AuthToken, releasePhase: APM.TagPhase, env?: Globals.ENV): Promise<void>;
|
|
2082
|
+
/**
|
|
2083
|
+
* Publish an application model tag
|
|
2084
|
+
* @param cwd
|
|
2085
|
+
* @param fs
|
|
2086
|
+
* @param manifest
|
|
2087
|
+
* @param token
|
|
2088
|
+
* @param releasePhase
|
|
2089
|
+
* @param env
|
|
2090
|
+
*/
|
|
2046
2091
|
export function releaseAPM(cwd: URI, fs: LocalFS, token: Registry.AuthToken, releasePhase: APM.TagPhase, env?: Globals.ENV): Promise<void>;
|
|
2092
|
+
/**
|
|
2093
|
+
* Publish a library project
|
|
2094
|
+
* @param cwd
|
|
2095
|
+
* @param fs
|
|
2096
|
+
* @param manifest
|
|
2097
|
+
* @param token
|
|
2098
|
+
* @param env
|
|
2099
|
+
*/
|
|
2100
|
+
export function releaseLibrary(cwd: URI, fs: LocalFS, token: Registry.AuthToken, env?: Globals.ENV): Promise<void>;
|
|
2047
2101
|
/**
|
|
2048
2102
|
* Read the projects README.md file
|
|
2049
2103
|
* validates if the file content is the initial content
|
|
@@ -2059,6 +2113,12 @@ export declare namespace Package {
|
|
|
2059
2113
|
* @param fs
|
|
2060
2114
|
*/
|
|
2061
2115
|
export function getChangelogFile(cwd: URI, fs: LocalFS): Promise<Uint8Array>;
|
|
2116
|
+
/**
|
|
2117
|
+
* Validate manifest settings that are required for the APM
|
|
2118
|
+
* @param token
|
|
2119
|
+
* @param manifest
|
|
2120
|
+
*/
|
|
2121
|
+
export function validateSpecificSettings(token: Registry.AuthToken, manifest: Manifest.Manifest): Promise<void>;
|
|
2062
2122
|
}
|
|
2063
2123
|
|
|
2064
2124
|
/**
|
|
@@ -4139,6 +4199,13 @@ export declare namespace Registry {
|
|
|
4139
4199
|
export function updateExistingApplication(token: AuthToken, publisherId: string, applicationId: string, updatedApplication: ApiNewApplication, env?: Globals.ENV): Promise<null | undefined>;
|
|
4140
4200
|
export type CreatedTagInfo = paths['/packages/{publisherId}/applications/{applicationId}/versions/{applicationVersion}']['post']['responses']['201']['content']['application/json'];
|
|
4141
4201
|
export function publishApplicationVersion(token: AuthToken, publisherId: string, applicationId: string, version: string, apmTagBuffer: FormData, env?: Globals.ENV): Promise<CreatedTagInfo>;
|
|
4202
|
+
export type LibraryFiles = {
|
|
4203
|
+
'studio.json': Uint8Array;
|
|
4204
|
+
'library.tar.gz': Uint8Array;
|
|
4205
|
+
'README.md': Uint8Array;
|
|
4206
|
+
'CHANGELOG.md': Uint8Array;
|
|
4207
|
+
};
|
|
4208
|
+
export function publishLibraryVersion(token: AuthToken, publisherId: string, libraryId: string, libraryVersion: string, files: LibraryFiles, env?: Globals.ENV): Promise<void>;
|
|
4142
4209
|
}
|
|
4143
4210
|
|
|
4144
4211
|
declare function uriToMemFsPath(path: URI): string;
|
package/out/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EACN,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,EACN,WAAW,EACX,YAAY,EACZ,cAAc,EACd,OAAO,EACP,GAAG,EACH,OAAO,EACP,GAAG,EACH,OAAO,EACP,CAAC"}
|
package/out/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.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");
|
|
@@ -27,4 +27,6 @@ const package_1 = require("./package/package");
|
|
|
27
27
|
Object.defineProperty(exports, "Package", { enumerable: true, get: function () { return package_1.Package; } });
|
|
28
28
|
const apm_1 = require("./package/apm");
|
|
29
29
|
Object.defineProperty(exports, "APM", { enumerable: true, get: function () { return apm_1.APM; } });
|
|
30
|
+
const library_1 = require("./package/library");
|
|
31
|
+
Object.defineProperty(exports, "Library", { enumerable: true, get: function () { return library_1.Library; } });
|
|
30
32
|
//# sourceMappingURL=api.js.map
|
package/out/main.js
CHANGED
|
@@ -15,8 +15,16 @@ const apm_1 = require("./package/apm");
|
|
|
15
15
|
const globals_1 = require("./globals");
|
|
16
16
|
const program = new commander_1.Command();
|
|
17
17
|
// dummy cwd
|
|
18
|
-
const devPath =
|
|
19
|
-
|
|
18
|
+
const devPath = () => {
|
|
19
|
+
if (process.env.NODE_ENV === 'local-dev-app') {
|
|
20
|
+
return './dev/app';
|
|
21
|
+
}
|
|
22
|
+
else if (process.env.NODE_ENV === 'local-dev-lib') {
|
|
23
|
+
return './dev/lib';
|
|
24
|
+
}
|
|
25
|
+
return '';
|
|
26
|
+
};
|
|
27
|
+
const cwd = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.file(process.cwd()), devPath());
|
|
20
28
|
program.version(package_json_1.default.version).usage('<command>');
|
|
21
29
|
function handleStudioEnv(env) {
|
|
22
30
|
process.env.STUDIO_ENV = env || globals_1.Globals.ENV.production;
|
|
@@ -80,7 +88,7 @@ program
|
|
|
80
88
|
.action(async (opts) => {
|
|
81
89
|
handleStudioEnv(opts.env);
|
|
82
90
|
const token = getStudioApiToken(opts);
|
|
83
|
-
await package_1.Package.
|
|
91
|
+
await package_1.Package.release(cwd, cliFS_1.cliFS, token, opts.phase, opts.env);
|
|
84
92
|
});
|
|
85
93
|
module.exports = function (argv) {
|
|
86
94
|
program.parse(argv);
|
package/out/manifest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAI/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAI/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,yBAAiB,QAAQ,CAAC;IAEzB,KAAY,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;IAE9F,UAAiB,QAAQ;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,cAAc,CAAC;QACrB,OAAO,CAAC,EAAE;YACT,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;YAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;SACrB,CAAC;QACF,OAAO,CAAC,EAAE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H,SAAsB,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAExF;IAED;;OAEG;IACH,SAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAErE;IAED;;;;;;OAMG;IACH,SAAsB,gBAAgB,CACrC,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,OAAO,EACX,QAAQ,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,EAClC,GAAG,GAAE,OAAO,CAAC,GAA4B,iBAYzC;IAED,SAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,mOAiBtD;IAED,SAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,4dAmB1E;IAED,SAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,uEAM5D;IAED,SAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,kMAe1D;IAED,SAAsB,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,2BAMzF;IAID,SAAsB,+BAA+B,CAAC,eAAe,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,2BAgB1G;CACD;AA4FD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,QAUnF"}
|
package/out/manifest.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.Manifest = void 0;
|
|
7
|
+
exports.validateProjectVersion = validateProjectVersion;
|
|
4
8
|
const vscode_uri_1 = require("vscode-uri");
|
|
5
9
|
const helper_1 = require("./helper");
|
|
6
10
|
const image_dimensions_1 = require("image-dimensions");
|
|
7
11
|
const file_type_checker_1 = require("file-type-checker");
|
|
8
12
|
const registryAPI_1 = require("./registryAPI");
|
|
13
|
+
const globals_1 = require("./globals");
|
|
14
|
+
const preload_1 = __importDefault(require("semver/preload"));
|
|
15
|
+
var isNumeric = helper_1.Helper.isNumeric;
|
|
16
|
+
const STUDIO_JSON_NAME = 'studio.json';
|
|
9
17
|
var Manifest;
|
|
10
18
|
(function (Manifest) {
|
|
11
19
|
var convertBlobToString = helper_1.Helper.convertBlobToString;
|
|
@@ -25,11 +33,20 @@ var Manifest;
|
|
|
25
33
|
* @param fs
|
|
26
34
|
*/
|
|
27
35
|
async function read(cwd, fs) {
|
|
28
|
-
const localManifest = await fs.readFile(vscode_uri_1.Utils.joinPath(cwd,
|
|
36
|
+
const localManifest = await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, STUDIO_JSON_NAME));
|
|
29
37
|
const manifestString = convertBlobToString(localManifest);
|
|
30
38
|
return JSON.parse(manifestString);
|
|
31
39
|
}
|
|
32
40
|
Manifest.read = read;
|
|
41
|
+
/**
|
|
42
|
+
* Reads the studio.json as an uint8array
|
|
43
|
+
* @param cwd
|
|
44
|
+
* @param fs
|
|
45
|
+
*/
|
|
46
|
+
async function readAsBlob(cwd, fs) {
|
|
47
|
+
return await fs.readFile(vscode_uri_1.Utils.joinPath(cwd, STUDIO_JSON_NAME));
|
|
48
|
+
}
|
|
49
|
+
Manifest.readAsBlob = readAsBlob;
|
|
33
50
|
/**
|
|
34
51
|
* Write the manifest to the workspace
|
|
35
52
|
* @param cwd
|
|
@@ -37,7 +54,7 @@ var Manifest;
|
|
|
37
54
|
* @param manifest
|
|
38
55
|
*/
|
|
39
56
|
async function write(cwd, fs, manifest) {
|
|
40
|
-
return fs.writeFile(vscode_uri_1.Utils.joinPath(cwd,
|
|
57
|
+
return fs.writeFile(vscode_uri_1.Utils.joinPath(cwd, STUDIO_JSON_NAME), JSON.stringify(manifest, null, '\t'));
|
|
41
58
|
}
|
|
42
59
|
Manifest.write = write;
|
|
43
60
|
/**
|
|
@@ -52,15 +69,19 @@ var Manifest;
|
|
|
52
69
|
* @param cwd
|
|
53
70
|
* @param fs
|
|
54
71
|
* @param manifest
|
|
72
|
+
* @param env
|
|
55
73
|
*/
|
|
56
|
-
async function validateManifest(cwd, fs, manifest) {
|
|
74
|
+
async function validateManifest(cwd, fs, manifest, env = globals_1.Globals.ENV.production) {
|
|
57
75
|
if (!manifest) {
|
|
58
76
|
manifest = await read(cwd, fs);
|
|
59
77
|
}
|
|
78
|
+
validateProjectVersion(manifest, env);
|
|
60
79
|
validatePOVSettings(manifest);
|
|
61
80
|
validateBLOSettings(manifest);
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
if (!manifest.library) {
|
|
82
|
+
validateEngineSettings(manifest);
|
|
83
|
+
await validateApplicationIcon(cwd, fs, manifest);
|
|
84
|
+
}
|
|
64
85
|
}
|
|
65
86
|
Manifest.validateManifest = validateManifest;
|
|
66
87
|
function validateLibraryName(libraryName) {
|
|
@@ -208,7 +229,7 @@ function validateHwFwOrProductId(manifest) {
|
|
|
208
229
|
async function validateApplicationIcon(cwd, fs, manifest) {
|
|
209
230
|
const iconPath = manifest.icon;
|
|
210
231
|
if (!iconPath) {
|
|
211
|
-
|
|
232
|
+
throw new Error('App icon is required for publishing an application!');
|
|
212
233
|
}
|
|
213
234
|
const iconUri = vscode_uri_1.Utils.joinPath(cwd, iconPath);
|
|
214
235
|
const iconExist = await fs.stat(iconUri);
|
|
@@ -230,4 +251,21 @@ async function validateApplicationIcon(cwd, fs, manifest) {
|
|
|
230
251
|
throw new Error(`App icon has to be of type PNG!`);
|
|
231
252
|
}
|
|
232
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Check based on the current env if the given version string is correct
|
|
256
|
+
* @param manifest
|
|
257
|
+
* @param env
|
|
258
|
+
*/
|
|
259
|
+
function validateProjectVersion(manifest, env) {
|
|
260
|
+
if (env === globals_1.Globals.ENV.lucky || Manifest.isLibraryProject(manifest)) {
|
|
261
|
+
if (!preload_1.default.valid(manifest.version)) {
|
|
262
|
+
throw new Error('"version" has to be a semantic version string!"');
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
if (!isNumeric(manifest.version)) {
|
|
267
|
+
throw new Error('"version" has to be a number!');
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
233
271
|
//# sourceMappingURL=manifest.js.map
|
package/out/package/apm.js
CHANGED
|
@@ -141,7 +141,7 @@ var APM;
|
|
|
141
141
|
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
142
142
|
if (!preventCreation) {
|
|
143
143
|
// throws if the specific setting is invalid
|
|
144
|
-
await validateSpecificSettings(token, manifest);
|
|
144
|
+
await package_1.Package.validateSpecificSettings(token, manifest);
|
|
145
145
|
}
|
|
146
146
|
const { registry } = manifest;
|
|
147
147
|
let applicationId = registry?.id;
|
|
@@ -261,28 +261,4 @@ async function addAdditionalFiles(cwd, fs, apmBuffer) {
|
|
|
261
261
|
apmBuffer.append(`bin/pov/mdn_report_template.json`, reportTemplateBlob);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
/**
|
|
265
|
-
* Validate manifest settings that are required for the APM
|
|
266
|
-
* @param token
|
|
267
|
-
* @param manifest
|
|
268
|
-
*/
|
|
269
|
-
async function validateSpecificSettings(token, manifest) {
|
|
270
|
-
const { name, publisher, description, registry } = manifest;
|
|
271
|
-
const invalidName = await manifest_1.Manifest.validateProjectName(name);
|
|
272
|
-
if (invalidName) {
|
|
273
|
-
throw new Error(`name: ${invalidName}`);
|
|
274
|
-
}
|
|
275
|
-
const invalidDescription = await manifest_1.Manifest.validateDescription(description);
|
|
276
|
-
if (invalidDescription) {
|
|
277
|
-
throw new Error(`description: ${invalidDescription}`);
|
|
278
|
-
}
|
|
279
|
-
const invalidPublisher = (await manifest_1.Manifest.validatePublisherId(publisher)) || (await manifest_1.Manifest.validatePublisherOnline(token, publisher));
|
|
280
|
-
if (invalidPublisher) {
|
|
281
|
-
throw new Error(`publisher: ${invalidPublisher}`);
|
|
282
|
-
}
|
|
283
|
-
const invalidBackends = await manifest_1.Manifest.validateRegistryAllowedBackends(registry?.allowedBackends);
|
|
284
|
-
if (invalidBackends) {
|
|
285
|
-
throw new Error(`registry: ${invalidBackends}`);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
264
|
//# sourceMappingURL=apm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/package/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA4CrC,yBAAiB,OAAO,CAAC;IACxB;;;;OAIG;IACH,SAAsB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ9E;IAED;;;;OAIG;IACH,SAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO;;;;SA2B7D;IAED;;;;;;;OAOG;IACH,SAAsB,cAAc,CACnC,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,OAAO,EACX,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,OAAO,EAAE,UAAU,EACnB,GAAG,GAAE,OAAO,CAAC,GAA4B,iBAUzC;CACD"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Library = void 0;
|
|
4
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
|
+
const helper_1 = require("../helper");
|
|
6
|
+
var convertBlobToString = helper_1.Helper.convertBlobToString;
|
|
7
|
+
const minimatch_1 = require("minimatch");
|
|
8
|
+
const registryAPI_1 = require("../registryAPI");
|
|
9
|
+
const manifest_1 = require("../manifest");
|
|
10
|
+
const package_1 = require("./package");
|
|
11
|
+
const globals_1 = require("../globals");
|
|
12
|
+
const pako = require('pako');
|
|
13
|
+
const tarball = require('tarballjs');
|
|
14
|
+
const STUDIO_IGNORE_FILE = '.studioignore';
|
|
15
|
+
//see original list: https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L1603
|
|
16
|
+
const defaultIgnore = [
|
|
17
|
+
'.vscodeignore',
|
|
18
|
+
'package-lock.json',
|
|
19
|
+
'npm-debug.log',
|
|
20
|
+
'yarn.lock',
|
|
21
|
+
'yarn-error.log',
|
|
22
|
+
'npm-shrinkwrap.json',
|
|
23
|
+
'.editorconfig',
|
|
24
|
+
'.npmrc',
|
|
25
|
+
'.yarnrc',
|
|
26
|
+
'.gitattributes',
|
|
27
|
+
'*.todo',
|
|
28
|
+
'tslint.yaml',
|
|
29
|
+
'.eslintrc*',
|
|
30
|
+
'.babelrc*',
|
|
31
|
+
'.prettierrc*',
|
|
32
|
+
'.cz-config.js',
|
|
33
|
+
'.commitlintrc*',
|
|
34
|
+
'webpack.config.js',
|
|
35
|
+
'ISSUE_TEMPLATE.md',
|
|
36
|
+
'CONTRIBUTING.md',
|
|
37
|
+
'PULL_REQUEST_TEMPLATE.md',
|
|
38
|
+
'CODE_OF_CONDUCT.md',
|
|
39
|
+
'.github',
|
|
40
|
+
'.travis.yml',
|
|
41
|
+
'appveyor.yml',
|
|
42
|
+
'**/.git',
|
|
43
|
+
'**/.git/**',
|
|
44
|
+
'**/*.vsix',
|
|
45
|
+
'**/.DS_Store',
|
|
46
|
+
'**/*.vsixmanifest',
|
|
47
|
+
'**/.vscode-test/**',
|
|
48
|
+
'**/.vscode-test-web/**'
|
|
49
|
+
];
|
|
50
|
+
defaultIgnore.push(...['**/.studio/**', '**/node_modules/**', STUDIO_IGNORE_FILE]);
|
|
51
|
+
const MINIMATCH_OPTIONS = { dot: true };
|
|
52
|
+
var Library;
|
|
53
|
+
(function (Library) {
|
|
54
|
+
/**
|
|
55
|
+
* Creates the library.tar.gz archive content
|
|
56
|
+
* @param cwd
|
|
57
|
+
* @param fs
|
|
58
|
+
*/
|
|
59
|
+
async function createArchive(cwd, fs) {
|
|
60
|
+
const tar = new tarball.TarWriter();
|
|
61
|
+
const filesToPack = await getFilesForArchive(cwd, fs);
|
|
62
|
+
filesToPack.forEach(file => {
|
|
63
|
+
tar.addFileArrayBuffer(file.name, file.data);
|
|
64
|
+
});
|
|
65
|
+
const tarBuffer = await tar.write();
|
|
66
|
+
return pako.gzip(tarBuffer);
|
|
67
|
+
}
|
|
68
|
+
Library.createArchive = createArchive;
|
|
69
|
+
/**
|
|
70
|
+
* Reads the project directory and returns all files that will be packed within the library.tar.gz
|
|
71
|
+
* @param cwd
|
|
72
|
+
* @param fs
|
|
73
|
+
*/
|
|
74
|
+
async function getFilesForArchive(cwd, fs) {
|
|
75
|
+
const files = [];
|
|
76
|
+
const { ignore, negate } = await getIgnoreNegateList(cwd, fs);
|
|
77
|
+
const allFiles = await fs.findFiles(cwd, '**/*');
|
|
78
|
+
const filteredFiles = allFiles.filter(({ path }) => {
|
|
79
|
+
const relativePath = path.slice(cwd.path.length + 1);
|
|
80
|
+
return (!ignore.some(i => (0, minimatch_1.minimatch)(relativePath, i, MINIMATCH_OPTIONS)) ||
|
|
81
|
+
negate.some(i => (0, minimatch_1.minimatch)(relativePath, i.slice(1), MINIMATCH_OPTIONS)));
|
|
82
|
+
});
|
|
83
|
+
for (const fileUri of filteredFiles) {
|
|
84
|
+
const relativePath = fileUri.path.slice(cwd.path.length + 1);
|
|
85
|
+
const [stat, blob] = await Promise.all([fs.stat(fileUri), fs.readFile(fileUri)]);
|
|
86
|
+
if (stat) {
|
|
87
|
+
files.push({
|
|
88
|
+
name: relativePath,
|
|
89
|
+
data: blob,
|
|
90
|
+
modifyTime: new Date(stat.mtime)
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return files;
|
|
95
|
+
}
|
|
96
|
+
Library.getFilesForArchive = getFilesForArchive;
|
|
97
|
+
/**
|
|
98
|
+
* Publish new library package to the registry
|
|
99
|
+
* @param cwd
|
|
100
|
+
* @param fs
|
|
101
|
+
* @param token
|
|
102
|
+
* @param archive
|
|
103
|
+
* @param env
|
|
104
|
+
*/
|
|
105
|
+
async function publishPackage(cwd, fs, token, archive, env = globals_1.Globals.ENV.production) {
|
|
106
|
+
const { publisher, name, version } = await manifest_1.Manifest.read(cwd, fs);
|
|
107
|
+
const files = {
|
|
108
|
+
'CHANGELOG.md': await package_1.Package.getChangelogFile(cwd, fs),
|
|
109
|
+
'README.md': await package_1.Package.getReadmeFile(cwd, fs, name),
|
|
110
|
+
'library.tar.gz': archive,
|
|
111
|
+
'studio.json': await manifest_1.Manifest.readAsBlob(cwd, fs)
|
|
112
|
+
};
|
|
113
|
+
return await registryAPI_1.Registry.publishLibraryVersion(token, publisher, name, version, files, env);
|
|
114
|
+
}
|
|
115
|
+
Library.publishPackage = publishPackage;
|
|
116
|
+
})(Library || (exports.Library = Library = {}));
|
|
117
|
+
/**
|
|
118
|
+
* Parse the studioignore file and returns a list of ignore files and negations
|
|
119
|
+
* @param cwd
|
|
120
|
+
* @param fs
|
|
121
|
+
*/
|
|
122
|
+
async function getIgnoreNegateList(cwd, fs) {
|
|
123
|
+
const notIgnored = ['!studio.json', `!README.md`];
|
|
124
|
+
// this code is mostly from https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L1681
|
|
125
|
+
const ignoreFile = await getIgnoreFile(cwd, fs);
|
|
126
|
+
// Parse raw ignore by splitting output into lines and filtering out empty lines and comments
|
|
127
|
+
const filteredIgnore = ignoreFile
|
|
128
|
+
.split(/[\n\r]/)
|
|
129
|
+
.map(s => s.trim())
|
|
130
|
+
.filter(s => !!s)
|
|
131
|
+
.filter(i => !/^\s*#/.test(i));
|
|
132
|
+
// Add '/**' to possible folders
|
|
133
|
+
const folderAgnosticIgnore = [
|
|
134
|
+
...filteredIgnore,
|
|
135
|
+
...filteredIgnore.filter(i => !/(^|\/)[^/]*\*[^/]*$/.test(i)).map(i => (/\/$/.test(i) ? `${i}**` : `${i}/**`))
|
|
136
|
+
];
|
|
137
|
+
// Combine with default ignore list
|
|
138
|
+
const combinedIgnoreList = [...defaultIgnore, ...folderAgnosticIgnore, ...notIgnored];
|
|
139
|
+
// Split into ignore and negate list
|
|
140
|
+
const [ignore, negate] = combinedIgnoreList.reduce((r, e) => (!/^\s*!/.test(e) ? [[...r[0], e], r[1]] : [r[0], [...r[1], e]]), [[], []]);
|
|
141
|
+
return {
|
|
142
|
+
ignore,
|
|
143
|
+
negate
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Reads the .studioignore file if exist
|
|
148
|
+
* @param cwd
|
|
149
|
+
* @param fs
|
|
150
|
+
*/
|
|
151
|
+
async function getIgnoreFile(cwd, fs) {
|
|
152
|
+
const ignoreFilePath = vscode_uri_1.Utils.joinPath(cwd, STUDIO_IGNORE_FILE);
|
|
153
|
+
const exists = await fs.stat(cwd);
|
|
154
|
+
if (exists) {
|
|
155
|
+
const ignoreFile = await fs.readFile(ignoreFilePath);
|
|
156
|
+
return convertBlobToString(ignoreFile);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return '';
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=library.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/package/package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO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,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAY7E;IAED;;;;;OAKG;IACH,SAAsB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,uBAY3D;IAED;;;;OAIG;IACH,SAAsB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,iBAwBpG;CACD"}
|
package/out/package/package.js
CHANGED
|
@@ -12,6 +12,7 @@ const compiler_1 = require("../dlo/compiler");
|
|
|
12
12
|
const scriptRunner_1 = require("../scriptRunner");
|
|
13
13
|
const manifest_1 = require("../manifest");
|
|
14
14
|
const globals_1 = require("../globals");
|
|
15
|
+
const library_1 = require("./library");
|
|
15
16
|
var Package;
|
|
16
17
|
(function (Package) {
|
|
17
18
|
/**
|
|
@@ -37,23 +38,41 @@ var Package;
|
|
|
37
38
|
}
|
|
38
39
|
Package.buildAll = buildAll;
|
|
39
40
|
/**
|
|
40
|
-
*
|
|
41
|
+
* Trigger the release based on the manifest settings
|
|
41
42
|
* @param cwd
|
|
42
43
|
* @param fs
|
|
43
44
|
* @param token
|
|
44
45
|
* @param releasePhase
|
|
45
46
|
* @param env
|
|
46
47
|
*/
|
|
48
|
+
async function release(cwd, fs, token, releasePhase, env = globals_1.Globals.ENV.production) {
|
|
49
|
+
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
50
|
+
if (manifest_1.Manifest.isLibraryProject(manifest)) {
|
|
51
|
+
await releaseLibrary(cwd, fs, token, env);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
await releaseAPM(cwd, fs, token, releasePhase, env);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
Package.release = release;
|
|
58
|
+
/**
|
|
59
|
+
* Publish an application model tag
|
|
60
|
+
* @param cwd
|
|
61
|
+
* @param fs
|
|
62
|
+
* @param manifest
|
|
63
|
+
* @param token
|
|
64
|
+
* @param releasePhase
|
|
65
|
+
* @param env
|
|
66
|
+
*/
|
|
47
67
|
async function releaseAPM(cwd, fs, token, releasePhase, env = globals_1.Globals.ENV.production) {
|
|
48
68
|
if (!Object.values(apm_1.APM.TagPhase).includes(releasePhase)) {
|
|
49
69
|
throw new Error(`ReleasePhase: ${releasePhase} is not a valid release phase`);
|
|
50
70
|
}
|
|
51
|
-
await manifest_1.Manifest.validateManifest(cwd, fs);
|
|
71
|
+
await manifest_1.Manifest.validateManifest(cwd, fs, null, env);
|
|
52
72
|
const application = await apm_1.APM.validateAccess(cwd, fs, token, false, env);
|
|
53
73
|
if (!application) {
|
|
54
74
|
return;
|
|
55
75
|
}
|
|
56
|
-
// todo validate version
|
|
57
76
|
// build the complete project
|
|
58
77
|
await buildAll(cwd, fs);
|
|
59
78
|
// update the store apm with the actual name/description/...
|
|
@@ -63,6 +82,25 @@ var Package;
|
|
|
63
82
|
console.log(`Tag "${newTag.version}" with phase "${newTag.phase}" published!`);
|
|
64
83
|
}
|
|
65
84
|
Package.releaseAPM = releaseAPM;
|
|
85
|
+
/**
|
|
86
|
+
* Publish a library project
|
|
87
|
+
* @param cwd
|
|
88
|
+
* @param fs
|
|
89
|
+
* @param manifest
|
|
90
|
+
* @param token
|
|
91
|
+
* @param env
|
|
92
|
+
*/
|
|
93
|
+
async function releaseLibrary(cwd, fs, token, env = globals_1.Globals.ENV.production) {
|
|
94
|
+
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
95
|
+
await manifest_1.Manifest.validateManifest(cwd, fs, manifest, env);
|
|
96
|
+
await validateSpecificSettings(token, manifest);
|
|
97
|
+
// build the complete project
|
|
98
|
+
await buildAll(cwd, fs);
|
|
99
|
+
const archive = await library_1.Library.createArchive(cwd, fs);
|
|
100
|
+
await library_1.Library.publishPackage(cwd, fs, token, archive, env);
|
|
101
|
+
console.log(`Library "${manifest.publisher}/${manifest.name}" with version "${manifest.version}" published!`);
|
|
102
|
+
}
|
|
103
|
+
Package.releaseLibrary = releaseLibrary;
|
|
66
104
|
/**
|
|
67
105
|
* Read the projects README.md file
|
|
68
106
|
* validates if the file content is the initial content
|
|
@@ -106,6 +144,34 @@ var Package;
|
|
|
106
144
|
return fileBlob;
|
|
107
145
|
}
|
|
108
146
|
Package.getChangelogFile = getChangelogFile;
|
|
147
|
+
/**
|
|
148
|
+
* Validate manifest settings that are required for the APM
|
|
149
|
+
* @param token
|
|
150
|
+
* @param manifest
|
|
151
|
+
*/
|
|
152
|
+
async function validateSpecificSettings(token, manifest) {
|
|
153
|
+
const { name, publisher, description, registry } = manifest;
|
|
154
|
+
const invalidName = await manifest_1.Manifest.validateProjectName(name);
|
|
155
|
+
if (invalidName) {
|
|
156
|
+
throw new Error(`name: ${invalidName}`);
|
|
157
|
+
}
|
|
158
|
+
const invalidDescription = await manifest_1.Manifest.validateDescription(description);
|
|
159
|
+
if (invalidDescription) {
|
|
160
|
+
throw new Error(`description: ${invalidDescription}`);
|
|
161
|
+
}
|
|
162
|
+
const invalidPublisher = (await manifest_1.Manifest.validatePublisherId(publisher)) || (await manifest_1.Manifest.validatePublisherOnline(token, publisher));
|
|
163
|
+
if (invalidPublisher) {
|
|
164
|
+
throw new Error(`publisher: ${invalidPublisher}`);
|
|
165
|
+
}
|
|
166
|
+
// only validate if the project is not a library project
|
|
167
|
+
if (!manifest_1.Manifest.isLibraryProject(manifest)) {
|
|
168
|
+
const invalidBackends = await manifest_1.Manifest.validateRegistryAllowedBackends(registry?.allowedBackends);
|
|
169
|
+
if (invalidBackends) {
|
|
170
|
+
throw new Error(`registry: ${invalidBackends}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
Package.validateSpecificSettings = validateSpecificSettings;
|
|
109
175
|
})(Package || (exports.Package = Package = {}));
|
|
110
176
|
/**
|
|
111
177
|
* Generates all needed files out of the dde declaration
|
package/out/registryAPI.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;IACxJ,SAAsB,yBAAyB,CAC9C,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,QAAQ,EACtB,GAAG,GAAE,OAAO,CAAC,GAA4B,GACvC,OAAO,CAAC,cAAc,CAAC,CA4BzB;IAED,KAAY,YAAY,GAAG;QAC1B,aAAa,EAAE,UAAU,CAAC;QAC1B,gBAAgB,EAAE,UAAU,CAAC;QAC7B,WAAW,EAAE,UAAU,CAAC;QACxB,cAAc,EAAE,UAAU,CAAC;KAC3B,CAAC;IAQF,SAAsB,qBAAqB,CAC1C,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,YAAY,EACnB,GAAG,GAAE,OAAO,CAAC,GAA4B,iBAwCzC;CACD"}
|
package/out/registryAPI.js
CHANGED
|
@@ -192,6 +192,54 @@ var Registry;
|
|
|
192
192
|
return data;
|
|
193
193
|
}
|
|
194
194
|
Registry.publishApplicationVersion = publishApplicationVersion;
|
|
195
|
+
const NameToMimeType = {
|
|
196
|
+
'README.md': 'text/markdown',
|
|
197
|
+
'CHANGELOG.md': 'text/markdown',
|
|
198
|
+
'library.tar.gz': 'application/gzip',
|
|
199
|
+
'studio.json': 'application/json'
|
|
200
|
+
};
|
|
201
|
+
async function publishLibraryVersion(token, publisherId, libraryId, libraryVersion, files, env = globals_1.Globals.ENV.production) {
|
|
202
|
+
try {
|
|
203
|
+
const { error } = await POST('/packages/{publisherId}/libraries/{libraryId}/versions/{libraryVersion}', {
|
|
204
|
+
...Registry.getAPIUrl(),
|
|
205
|
+
headers: {
|
|
206
|
+
...buildAuthHeader(token),
|
|
207
|
+
...headerBasedOnEnv(env)
|
|
208
|
+
},
|
|
209
|
+
params: {
|
|
210
|
+
path: {
|
|
211
|
+
publisherId,
|
|
212
|
+
libraryId,
|
|
213
|
+
libraryVersion
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
//@ts-ignore
|
|
217
|
+
body: {
|
|
218
|
+
...files
|
|
219
|
+
},
|
|
220
|
+
bodySerializer(body) {
|
|
221
|
+
const fd = new FormData();
|
|
222
|
+
//@ts-ignore
|
|
223
|
+
for (const [k, v] of Object.entries(body)) {
|
|
224
|
+
// append key as filename:
|
|
225
|
+
if (v !== undefined) {
|
|
226
|
+
//@ts-ignore
|
|
227
|
+
fd.append(k, new Blob([v], { type: NameToMimeType[k] }), k);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return fd;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
if (error) {
|
|
234
|
+
throw new Error(error.reason);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (e) {
|
|
238
|
+
console.error(e);
|
|
239
|
+
throw e;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
Registry.publishLibraryVersion = publishLibraryVersion;
|
|
195
243
|
})(Registry || (exports.Registry = Registry = {}));
|
|
196
244
|
/**
|
|
197
245
|
* inject the X-Semver header for application based requests
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microtronics/studio-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Microtronics Studio CLI Tool",
|
|
5
5
|
"main": "./out/api.js",
|
|
6
6
|
"typings": "./dist/studio-cli.d.ts",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"cross-fetch": "^4.0.0",
|
|
33
33
|
"glob": "^11.0.1",
|
|
34
34
|
"iconv-lite": "^0.6.3",
|
|
35
|
+
"minimatch": "^10.0.1",
|
|
35
36
|
"ini": "^5.0.0",
|
|
36
37
|
"openapi-fetch": "^0.13.0",
|
|
37
38
|
"pako": "^2.1.0",
|
package/studio-cli-app
ADDED
package/studio-cli-lib
ADDED