@microtronics/studio-cli 0.20.0 → 0.21.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,11 +1,18 @@
1
1
 
2
2
 
3
- ## 0.20.0 (2025-02-25)
3
+ ## 0.21.0 (2025-02-25)
4
4
 
5
5
 
6
6
  ### Features
7
7
 
8
- * **studio-cli:** add wynni env to cli ([6864b8b](https://bitbucket.org/microtronics-core/vscode-studio/commits/6864b8ba5877efe577af799253e6c26ab71053d9))
8
+ * **studio-cli:** added publish option `--allowedBackends` ([7cf0873](https://bitbucket.org/microtronics-core/vscode-studio/commits/7cf08737bbc994fd16a3a76604a6550f3284df60))
9
+
10
+ ## 0.20.0 (2025-02-25)
11
+
12
+
13
+ ### Features
14
+
15
+ * **studio-cli:** add wynni env to cli ([6864b8b](https://bitbucket.org/microtronics-core/vscode-studio/commits/6864b8ba5877efe577af799253e6c26ab71053d9))
9
16
  * **studio-cli:** manifest support for `pov.details.lowLevel:boolean` ([9ae0dab](https://bitbucket.org/microtronics-core/vscode-studio/commits/9ae0dabe1dbacb4af3fe549ba767e712fc70be07))
10
17
 
11
18
  ## 0.19.2 (2025-02-21)
@@ -2200,18 +2200,20 @@ export declare namespace Package {
2200
2200
  * @param fs
2201
2201
  * @param token
2202
2202
  * @param releasePhase
2203
+ * @param allowedBackends
2203
2204
  * @param env
2204
2205
  */
2205
- export function release(cwd: URI, fs: LocalFS, token: Registry.AuthToken, releasePhase: APM.TagPhase, env?: Globals.ENV): Promise<void>;
2206
+ export function release(cwd: URI, fs: LocalFS, token: Registry.AuthToken, releasePhase: APM.TagPhase, allowedBackends: Registry.ApiNewApplication['allowedBackends'], env?: Globals.ENV): Promise<void>;
2206
2207
  /**
2207
2208
  * Publish an application model tag
2208
2209
  * @param cwd
2209
2210
  * @param fs
2210
2211
  * @param token
2211
2212
  * @param releasePhase
2213
+ * @param allowedBackends
2212
2214
  * @param env
2213
2215
  */
2214
- export function releaseAPM(cwd: URI, fs: LocalFS, token: Registry.AuthToken, releasePhase: APM.TagPhase, env?: Globals.ENV): Promise<void>;
2216
+ export function releaseAPM(cwd: URI, fs: LocalFS, token: Registry.AuthToken, releasePhase: APM.TagPhase, allowedBackends?: Registry.ApiNewApplication['allowedBackends'], env?: Globals.ENV): Promise<void>;
2215
2217
  /**
2216
2218
  * Publish a library project
2217
2219
  * @param cwd
package/out/main.js CHANGED
@@ -13,6 +13,7 @@ var installDependency = dependencies_1.Dependencies.installDependency;
13
13
  const package_1 = require("./package/package");
14
14
  const apm_1 = require("./package/apm");
15
15
  const globals_1 = require("./globals");
16
+ const manifest_1 = require("./manifest");
16
17
  const program = new commander_1.Command();
17
18
  // dummy cwd
18
19
  const devPath = () => {
@@ -86,12 +87,21 @@ program
86
87
  .addOption(new commander_1.Option('-ph --phase <release phase>', 'specify a release phase')
87
88
  .choices(releasePhaseArguments)
88
89
  .default('release'))
90
+ .addOption(new commander_1.Option('--allowedBackends <null|*|server.xz;server.yz>', 'specify the allowedBackends deployment for this version.').default(null))
89
91
  .addOption(optionStudioEnv)
90
92
  .addOption(optionStudioToken)
91
93
  .action(async (opts) => {
92
94
  handleStudioEnv(opts.env);
93
95
  const token = getStudioApiToken(opts);
94
- await package_1.Package.release(cwd, cliFS_1.cliFS, token, opts.phase, opts.env);
96
+ let allowedBackends = null;
97
+ if (opts.allowedBackends) {
98
+ allowedBackends = opts.allowedBackends === '*' ? opts.allowedBackends : opts.allowedBackends.split(';');
99
+ const errorMessage = await manifest_1.Manifest.validateRegistryAllowedBackends(allowedBackends);
100
+ if (errorMessage) {
101
+ throw new Error(errorMessage);
102
+ }
103
+ }
104
+ await package_1.Package.release(cwd, cliFS_1.cliFS, token, opts.phase, allowedBackends, opts.env);
95
105
  });
96
106
  module.exports = function (argv) {
97
107
  program.parse(argv);
@@ -10,6 +10,7 @@ const dde_1 = require("../dde/dde");
10
10
  const dlo_1 = require("../dlo/dlo");
11
11
  const compiler_1 = require("../dlo/compiler");
12
12
  const scriptRunner_1 = require("../scriptRunner");
13
+ const registryAPI_1 = require("../registryAPI");
13
14
  const manifest_1 = require("../manifest");
14
15
  const globals_1 = require("../globals");
15
16
  const library_1 = require("./library");
@@ -47,15 +48,16 @@ var Package;
47
48
  * @param fs
48
49
  * @param token
49
50
  * @param releasePhase
51
+ * @param allowedBackends
50
52
  * @param env
51
53
  */
52
- async function release(cwd, fs, token, releasePhase, env = globals_1.Globals.ENV.production) {
54
+ async function release(cwd, fs, token, releasePhase, allowedBackends, env = globals_1.Globals.ENV.production) {
53
55
  const manifest = await manifest_1.Manifest.read(cwd, fs);
54
56
  if (manifest_1.Manifest.isLibrary(manifest)) {
55
57
  await releaseLibrary(cwd, fs, token, env);
56
58
  }
57
59
  else {
58
- await releaseAPM(cwd, fs, token, releasePhase, env);
60
+ await releaseAPM(cwd, fs, token, releasePhase, allowedBackends, env);
59
61
  }
60
62
  }
61
63
  Package.release = release;
@@ -65,9 +67,10 @@ var Package;
65
67
  * @param fs
66
68
  * @param token
67
69
  * @param releasePhase
70
+ * @param allowedBackends
68
71
  * @param env
69
72
  */
70
- async function releaseAPM(cwd, fs, token, releasePhase, env = globals_1.Globals.ENV.production) {
73
+ async function releaseAPM(cwd, fs, token, releasePhase, allowedBackends = null, env = globals_1.Globals.ENV.production) {
71
74
  if (!Object.values(apm_1.APM.TagPhase).includes(releasePhase)) {
72
75
  throw new Error(`ReleasePhase: ${releasePhase} is not a valid release phase`);
73
76
  }
@@ -82,6 +85,14 @@ var Package;
82
85
  await apm_1.APM.updateProfile(cwd, fs, token, env);
83
86
  const tagContent = await apm_1.APM.createTag(cwd, fs, releasePhase);
84
87
  const newTag = await apm_1.APM.publishTag(cwd, fs, token, tagContent, env);
88
+ if (allowedBackends !== null) {
89
+ const manifest = await manifest_1.Manifest.read(cwd, fs);
90
+ // update tag with content
91
+ await registryAPI_1.Registry.updateExistingApplicationVersion(token, manifest.publisher, manifest.registry?.id, manifest.version, {
92
+ allowedBackends
93
+ }, globals_1.Globals.ENV.lucky);
94
+ console.log(`Tag "${newTag.version}" with phase "${newTag.phase}" shared with ${[...allowedBackends].join(';')}!`);
95
+ }
85
96
  console.log(`Tag "${newTag.version}" with phase "${newTag.phase}" published!`);
86
97
  }
87
98
  Package.releaseAPM = releaseAPM;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microtronics/studio-cli",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Microtronics Studio CLI Tool",
5
5
  "main": "./out/api.js",
6
6
  "typings": "./dist/studio-cli.d.ts",
@@ -20,7 +20,7 @@
20
20
  "test-ci": "cross-env STUDIO_ENV=lucky mocha --reporter mocha-junit-reporter",
21
21
  "watch:test": "npm run test -- --watch",
22
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"
23
+ "build:registryApiTypings": "npx openapi-typescript https://api.registry.wynni.ci.microtronics.com/v1/openapi.yaml -o ./src/typings/registry.ts"
24
24
  },
25
25
  "author": "Microtronics",
26
26
  "license": "ISC",