@seeka-labs/cli-apps-azure 3.8.8 → 3.8.10

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/dist/index.js CHANGED
@@ -217,7 +217,7 @@ var require_util = __commonJS({
217
217
  return path4;
218
218
  }
219
219
  exports2.normalize = normalize;
220
- function join(aRoot, aPath) {
220
+ function join2(aRoot, aPath) {
221
221
  if (aRoot === "") {
222
222
  aRoot = ".";
223
223
  }
@@ -249,7 +249,7 @@ var require_util = __commonJS({
249
249
  }
250
250
  return joined;
251
251
  }
252
- exports2.join = join;
252
+ exports2.join = join2;
253
253
  exports2.isAbsolute = function(aPath) {
254
254
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
255
255
  };
@@ -422,7 +422,7 @@ var require_util = __commonJS({
422
422
  parsed.path = parsed.path.substring(0, index + 1);
423
423
  }
424
424
  }
425
- sourceURL = join(urlGenerate(parsed), sourceURL);
425
+ sourceURL = join2(urlGenerate(parsed), sourceURL);
426
426
  }
427
427
  return normalize(sourceURL);
428
428
  }
@@ -1835,11 +1835,11 @@ var require_source_map_support = __commonJS({
1835
1835
  "../../node_modules/source-map-support/source-map-support.js"(exports2, module2) {
1836
1836
  var SourceMapConsumer = require_source_map().SourceMapConsumer;
1837
1837
  var path4 = require("path");
1838
- var fs7;
1838
+ var fs8;
1839
1839
  try {
1840
- fs7 = require("fs");
1841
- if (!fs7.existsSync || !fs7.readFileSync) {
1842
- fs7 = null;
1840
+ fs8 = require("fs");
1841
+ if (!fs8.existsSync || !fs8.readFileSync) {
1842
+ fs8 = null;
1843
1843
  }
1844
1844
  } catch (err) {
1845
1845
  }
@@ -1910,7 +1910,7 @@ var require_source_map_support = __commonJS({
1910
1910
  }
1911
1911
  var contents = "";
1912
1912
  try {
1913
- if (!fs7) {
1913
+ if (!fs8) {
1914
1914
  var xhr = new XMLHttpRequest();
1915
1915
  xhr.open(
1916
1916
  "GET",
@@ -1922,8 +1922,8 @@ var require_source_map_support = __commonJS({
1922
1922
  if (xhr.readyState === 4 && xhr.status === 200) {
1923
1923
  contents = xhr.responseText;
1924
1924
  }
1925
- } else if (fs7.existsSync(path5)) {
1926
- contents = fs7.readFileSync(path5, "utf8");
1925
+ } else if (fs8.existsSync(path5)) {
1926
+ contents = fs8.readFileSync(path5, "utf8");
1927
1927
  }
1928
1928
  } catch (er2) {
1929
1929
  }
@@ -2187,9 +2187,9 @@ var require_source_map_support = __commonJS({
2187
2187
  var line = +match[2];
2188
2188
  var column = +match[3];
2189
2189
  var contents = fileContentsCache[source];
2190
- if (!contents && fs7 && fs7.existsSync(source)) {
2190
+ if (!contents && fs8 && fs8.existsSync(source)) {
2191
2191
  try {
2192
- contents = fs7.readFileSync(source, "utf8");
2192
+ contents = fs8.readFileSync(source, "utf8");
2193
2193
  } catch (er2) {
2194
2194
  contents = "";
2195
2195
  }
@@ -3464,7 +3464,7 @@ var require_command = __commonJS({
3464
3464
  var EventEmitter = require("node:events").EventEmitter;
3465
3465
  var childProcess4 = require("node:child_process");
3466
3466
  var path4 = require("node:path");
3467
- var fs7 = require("node:fs");
3467
+ var fs8 = require("node:fs");
3468
3468
  var process11 = require("node:process");
3469
3469
  var { Argument: Argument2, humanReadableArgName } = require_argument();
3470
3470
  var { CommanderError: CommanderError2 } = require_error();
@@ -4458,7 +4458,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4458
4458
  * @param {string} subcommandName
4459
4459
  */
4460
4460
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
4461
- if (fs7.existsSync(executableFile)) return;
4461
+ if (fs8.existsSync(executableFile)) return;
4462
4462
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
4463
4463
  const executableMissing = `'${executableFile}' does not exist
4464
4464
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
@@ -4477,10 +4477,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
4477
4477
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
4478
4478
  function findFile(baseDir, baseName) {
4479
4479
  const localBin = path4.resolve(baseDir, baseName);
4480
- if (fs7.existsSync(localBin)) return localBin;
4480
+ if (fs8.existsSync(localBin)) return localBin;
4481
4481
  if (sourceExt.includes(path4.extname(baseName))) return void 0;
4482
4482
  const foundExt = sourceExt.find(
4483
- (ext) => fs7.existsSync(`${localBin}${ext}`)
4483
+ (ext) => fs8.existsSync(`${localBin}${ext}`)
4484
4484
  );
4485
4485
  if (foundExt) return `${localBin}${foundExt}`;
4486
4486
  return void 0;
@@ -4492,7 +4492,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4492
4492
  if (this._scriptPath) {
4493
4493
  let resolvedScriptPath;
4494
4494
  try {
4495
- resolvedScriptPath = fs7.realpathSync(this._scriptPath);
4495
+ resolvedScriptPath = fs8.realpathSync(this._scriptPath);
4496
4496
  } catch {
4497
4497
  resolvedScriptPath = this._scriptPath;
4498
4498
  }
@@ -5737,7 +5737,7 @@ var init_help_texts = __esm({
5737
5737
  azureOptions = {
5738
5738
  configFile: {
5739
5739
  description: "Path to Seeka configuration file (JSON)",
5740
- default: "./seeka/init.app.seeka.cli.config.json"
5740
+ default: "./.seeka/init.app.seeka.cli.config.json"
5741
5741
  },
5742
5742
  help: {
5743
5743
  description: "Display help information"
@@ -5777,6 +5777,12 @@ var init_help_texts = __esm({
5777
5777
  initRepoCommand = {
5778
5778
  description: "Initialize a new GitHub repository for a Seeka app with Azure deployment configuration",
5779
5779
  interactive: {
5780
+ azureFunctionResourceGroupName: {
5781
+ message: "Enter Azure Function Resource Group Name:",
5782
+ validation: {
5783
+ required: "Azure Function Resource Group Name is required"
5784
+ }
5785
+ },
5780
5786
  viteBaseUrl: {
5781
5787
  message: "Enter VITE_BASE_URL:",
5782
5788
  validation: {
@@ -5809,6 +5815,12 @@ var init_help_texts = __esm({
5809
5815
  required: "Environment name is required"
5810
5816
  }
5811
5817
  },
5818
+ azureFunctionResourceGroupName: {
5819
+ message: "Enter Azure Function Resource Group Name:",
5820
+ validation: {
5821
+ required: "Azure Function Resource Group Name is required"
5822
+ }
5823
+ },
5812
5824
  azureFuncSlotName: {
5813
5825
  message: "Enter AZURE_FUNC_SLOT_NAME (empty for production):"
5814
5826
  },
@@ -5853,6 +5865,12 @@ var init_help_texts = __esm({
5853
5865
  required: "Environment name is required"
5854
5866
  }
5855
5867
  },
5868
+ azureFunctionResourceGroupName: {
5869
+ message: "Enter Azure Function Resource Group Name:",
5870
+ validation: {
5871
+ required: "Azure Function Resource Group Name is required"
5872
+ }
5873
+ },
5856
5874
  azureFuncSlotName: {
5857
5875
  message: "Enter AZURE_FUNC_SLOT_NAME (empty for production):"
5858
5876
  }
@@ -13556,10 +13574,10 @@ var require_lib2 = __commonJS({
13556
13574
  exports2.analyse = analyse;
13557
13575
  var detectFile = (filepath, opts = {}) => new Promise((resolve2, reject) => {
13558
13576
  let fd;
13559
- const fs7 = (0, node_1.default)();
13577
+ const fs8 = (0, node_1.default)();
13560
13578
  const handler2 = (err, buffer) => {
13561
13579
  if (fd) {
13562
- fs7.closeSync(fd);
13580
+ fs8.closeSync(fd);
13563
13581
  }
13564
13582
  if (err) {
13565
13583
  reject(err);
@@ -13571,9 +13589,9 @@ var require_lib2 = __commonJS({
13571
13589
  };
13572
13590
  const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
13573
13591
  if (sampleSize > 0) {
13574
- fd = fs7.openSync(filepath, "r");
13592
+ fd = fs8.openSync(filepath, "r");
13575
13593
  let sample = Buffer.allocUnsafe(sampleSize);
13576
- fs7.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
13594
+ fs8.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
13577
13595
  if (err) {
13578
13596
  handler2(err, null);
13579
13597
  } else {
@@ -13585,22 +13603,22 @@ var require_lib2 = __commonJS({
13585
13603
  });
13586
13604
  return;
13587
13605
  }
13588
- fs7.readFile(filepath, handler2);
13606
+ fs8.readFile(filepath, handler2);
13589
13607
  });
13590
13608
  exports2.detectFile = detectFile;
13591
13609
  var detectFileSync = (filepath, opts = {}) => {
13592
- const fs7 = (0, node_1.default)();
13610
+ const fs8 = (0, node_1.default)();
13593
13611
  if (opts && opts.sampleSize) {
13594
- const fd = fs7.openSync(filepath, "r");
13612
+ const fd = fs8.openSync(filepath, "r");
13595
13613
  let sample = Buffer.allocUnsafe(opts.sampleSize);
13596
- const bytesRead = fs7.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
13614
+ const bytesRead = fs8.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
13597
13615
  if (bytesRead < opts.sampleSize) {
13598
13616
  sample = sample.subarray(0, bytesRead);
13599
13617
  }
13600
- fs7.closeSync(fd);
13618
+ fs8.closeSync(fd);
13601
13619
  return (0, exports2.detect)(sample);
13602
13620
  }
13603
- return (0, exports2.detect)(fs7.readFileSync(filepath));
13621
+ return (0, exports2.detect)(fs8.readFileSync(filepath));
13604
13622
  };
13605
13623
  exports2.detectFileSync = detectFileSync;
13606
13624
  exports2.default = {
@@ -28357,6 +28375,47 @@ var init_dist16 = __esm({
28357
28375
  }
28358
28376
  });
28359
28377
 
28378
+ // src/config/initConfig.ts
28379
+ function resolveInitConfigPath(configFilePath) {
28380
+ if (configFilePath) {
28381
+ return path2.isAbsolute(configFilePath) ? configFilePath : path2.resolve(process.cwd(), configFilePath);
28382
+ }
28383
+ const defaultPath = path2.resolve(process.cwd(), DEFAULT_INIT_CONFIG_RELATIVE_PATH);
28384
+ if (fs.existsSync(defaultPath)) {
28385
+ return defaultPath;
28386
+ }
28387
+ return defaultPath;
28388
+ }
28389
+ function readInitConfig(configPath) {
28390
+ if (!fs.existsSync(configPath)) {
28391
+ return null;
28392
+ }
28393
+ const raw = fs.readFileSync(configPath, "utf-8");
28394
+ return JSON.parse(raw);
28395
+ }
28396
+ function writeInitConfig(configPath, config) {
28397
+ fs.mkdirSync(path2.dirname(configPath), { recursive: true });
28398
+ fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}
28399
+ `, "utf-8");
28400
+ }
28401
+ function upsertInitConfig(configPath, patch) {
28402
+ const existing = readInitConfig(configPath) ?? {};
28403
+ const next = {
28404
+ ...existing,
28405
+ ...patch
28406
+ };
28407
+ writeInitConfig(configPath, next);
28408
+ }
28409
+ var fs, path2, DEFAULT_INIT_CONFIG_RELATIVE_PATH;
28410
+ var init_initConfig = __esm({
28411
+ "src/config/initConfig.ts"() {
28412
+ "use strict";
28413
+ fs = __toESM(require("fs"));
28414
+ path2 = __toESM(require("path"));
28415
+ DEFAULT_INIT_CONFIG_RELATIVE_PATH = path2.join(".seeka", "init.app.seeka.cli.config.json");
28416
+ }
28417
+ });
28418
+
28360
28419
  // ../../node_modules/@octokit/rest/node_modules/universal-user-agent/index.js
28361
28420
  function getUserAgent() {
28362
28421
  if (typeof navigator === "object" && "userAgent" in navigator) {
@@ -33162,16 +33221,16 @@ var init_libsodium = __esm({
33162
33221
  var scriptDirectory2 = "";
33163
33222
  var readAsync2, readBinary2;
33164
33223
  if (ENVIRONMENT_IS_NODE2) {
33165
- var fs8 = null;
33224
+ var fs9 = null;
33166
33225
  scriptDirectory2 = __dirname2 + "/";
33167
33226
  readBinary2 = (filename) => {
33168
33227
  filename = isFileURI2(filename) ? new URL(filename) : filename;
33169
- var ret = fs8.readFileSync(filename);
33228
+ var ret = fs9.readFileSync(filename);
33170
33229
  return ret;
33171
33230
  };
33172
33231
  readAsync2 = async (filename, binary = true) => {
33173
33232
  filename = isFileURI2(filename) ? new URL(filename) : filename;
33174
- var ret = fs8.readFileSync(filename, binary ? void 0 : "utf8");
33233
+ var ret = fs9.readFileSync(filename, binary ? void 0 : "utf8");
33175
33234
  return ret;
33176
33235
  };
33177
33236
  if (process.argv.length > 1) {
@@ -75851,16 +75910,16 @@ var init_libsodium = __esm({
75851
75910
  var scriptDirectory = "";
75852
75911
  var readAsync, readBinary;
75853
75912
  if (ENVIRONMENT_IS_NODE) {
75854
- var fs7 = null;
75913
+ var fs8 = null;
75855
75914
  scriptDirectory = __dirname2 + "/";
75856
75915
  readBinary = (filename) => {
75857
75916
  filename = isFileURI(filename) ? new URL(filename) : filename;
75858
- var ret = fs7.readFileSync(filename);
75917
+ var ret = fs8.readFileSync(filename);
75859
75918
  return ret;
75860
75919
  };
75861
75920
  readAsync = async (filename, binary = true) => {
75862
75921
  filename = isFileURI(filename) ? new URL(filename) : filename;
75863
- var ret = fs7.readFileSync(filename, binary ? void 0 : "utf8");
75922
+ var ret = fs8.readFileSync(filename, binary ? void 0 : "utf8");
75864
75923
  return ret;
75865
75924
  };
75866
75925
  if (process.argv.length > 1) {
@@ -79754,7 +79813,14 @@ __export(init_exports, {
79754
79813
  });
79755
79814
  async function initRepoCommand2(config) {
79756
79815
  try {
79757
- const { viteBaseUrl } = await dist_default12.prompt([
79816
+ const { azureFunctionResourceGroupName, viteBaseUrl } = await dist_default12.prompt([
79817
+ {
79818
+ type: "input",
79819
+ name: "azureFunctionResourceGroupName",
79820
+ message: initRepoCommand.interactive.azureFunctionResourceGroupName.message,
79821
+ default: config.azureFunctionResourceGroupName ?? "",
79822
+ validate: (input) => input.trim() !== "" || initRepoCommand.interactive.azureFunctionResourceGroupName.validation.required
79823
+ },
79758
79824
  {
79759
79825
  type: "input",
79760
79826
  name: "viteBaseUrl",
@@ -79763,6 +79829,12 @@ async function initRepoCommand2(config) {
79763
79829
  validate: (input) => input.trim() !== "" || initRepoCommand.interactive.viteBaseUrl.validation.required
79764
79830
  }
79765
79831
  ]);
79832
+ const configPath = config.__configPath ?? resolveInitConfigPath();
79833
+ upsertInitConfig(configPath, {
79834
+ orgName: config.orgName,
79835
+ appName: config.appName,
79836
+ azureFunctionResourceGroupName
79837
+ });
79766
79838
  const { octokit } = await authenticateWithGitHub();
79767
79839
  const username = await getAuthenticatedUser(octokit);
79768
79840
  const organizations = await getUserOrganizations(octokit);
@@ -79792,6 +79864,10 @@ async function initRepoCommand2(config) {
79792
79864
  {
79793
79865
  name: "AZURE_FUNC_RESOURCE_NAME",
79794
79866
  value: `seeka-app-${config.appName}`
79867
+ },
79868
+ {
79869
+ name: "AZURE_FUNC_RESOURCE_GROUP_NAME",
79870
+ value: azureFunctionResourceGroupName
79795
79871
  }
79796
79872
  ]);
79797
79873
  const prodEnvironmentName = `prod`;
@@ -79835,6 +79911,7 @@ var init_init = __esm({
79835
79911
  init_repo();
79836
79912
  init_environment();
79837
79913
  init_help_texts();
79914
+ init_initConfig();
79838
79915
  }
79839
79916
  });
79840
79917
 
@@ -79914,6 +79991,13 @@ async function initEnvironmentCommand(config) {
79914
79991
  default: `prod`,
79915
79992
  validate: (input) => input.trim() !== "" || addEnvCommand.interactive.environmentName.validation.required
79916
79993
  },
79994
+ {
79995
+ type: "input",
79996
+ name: "azureFunctionResourceGroupName",
79997
+ message: addEnvCommand.interactive.azureFunctionResourceGroupName.message,
79998
+ default: config.azureFunctionResourceGroupName ?? "",
79999
+ validate: (input) => input.trim() !== "" || addEnvCommand.interactive.azureFunctionResourceGroupName.validation.required
80000
+ },
79917
80001
  {
79918
80002
  type: "input",
79919
80003
  name: "azureFuncSlotName",
@@ -79948,6 +80032,18 @@ async function initEnvironmentCommand(config) {
79948
80032
  }
79949
80033
  ]);
79950
80034
  const { octokit } = await authenticateWithGitHub();
80035
+ const configPath = config.__configPath ?? resolveInitConfigPath();
80036
+ upsertInitConfig(configPath, {
80037
+ orgName: config.orgName,
80038
+ appName: config.appName,
80039
+ azureFunctionResourceGroupName: answers.azureFunctionResourceGroupName
80040
+ });
80041
+ await setRepositoryVariables(octokit, answers.owner, answers.repo, [
80042
+ {
80043
+ name: "AZURE_FUNC_RESOURCE_GROUP_NAME",
80044
+ value: answers.azureFunctionResourceGroupName
80045
+ }
80046
+ ]);
79951
80047
  await createEnvironment(octokit, answers.owner, answers.repo, answers.environmentName);
79952
80048
  const envVars = config.environmentVariables ?? {};
79953
80049
  const secretsToSet = [
@@ -80004,8 +80100,10 @@ var init_init2 = __esm({
80004
80100
  init_dist16();
80005
80101
  init_auth();
80006
80102
  init_environment();
80103
+ init_repo();
80007
80104
  init_help_texts();
80008
80105
  init_seekaAppSettings();
80106
+ init_initConfig();
80009
80107
  }
80010
80108
  });
80011
80109
 
@@ -80036,9 +80134,28 @@ async function updateEnvironmentCommand(config) {
80036
80134
  message: updateEnvCommand.interactive.environmentName.message,
80037
80135
  default: `prod`,
80038
80136
  validate: (input) => input.trim() !== "" || updateEnvCommand.interactive.environmentName.validation.required
80137
+ },
80138
+ {
80139
+ type: "input",
80140
+ name: "azureFunctionResourceGroupName",
80141
+ message: updateEnvCommand.interactive.azureFunctionResourceGroupName.message,
80142
+ default: config.azureFunctionResourceGroupName ?? "",
80143
+ validate: (input) => input.trim() !== "" || updateEnvCommand.interactive.azureFunctionResourceGroupName.validation.required
80039
80144
  }
80040
80145
  ]);
80041
80146
  const { octokit } = await authenticateWithGitHub();
80147
+ const configPath = config.__configPath ?? resolveInitConfigPath();
80148
+ upsertInitConfig(configPath, {
80149
+ orgName: config.orgName,
80150
+ appName: config.appName,
80151
+ azureFunctionResourceGroupName: answers.azureFunctionResourceGroupName
80152
+ });
80153
+ await setRepositoryVariables(octokit, answers.owner, answers.repo, [
80154
+ {
80155
+ name: "AZURE_FUNC_RESOURCE_GROUP_NAME",
80156
+ value: answers.azureFunctionResourceGroupName
80157
+ }
80158
+ ]);
80042
80159
  await createEnvironment(octokit, answers.owner, answers.repo, answers.environmentName);
80043
80160
  const existingVariables = await listEnvironmentVariables(
80044
80161
  octokit,
@@ -80139,8 +80256,10 @@ var init_update = __esm({
80139
80256
  init_dist16();
80140
80257
  init_auth();
80141
80258
  init_environment();
80259
+ init_repo();
80142
80260
  init_help_texts();
80143
80261
  init_seekaAppSettings();
80262
+ init_initConfig();
80144
80263
  }
80145
80264
  });
80146
80265
 
@@ -80172,7 +80291,7 @@ var {
80172
80291
  } = import_index.default;
80173
80292
 
80174
80293
  // ../cli-apps/package.json
80175
- var version = "3.8.8";
80294
+ var version = "3.8.10";
80176
80295
 
80177
80296
  // ../cli-apps/src/helpers/console/index.ts
80178
80297
  var showSeekaLogo = () => {
@@ -80220,17 +80339,16 @@ var writeSeparator = () => {
80220
80339
  // src/index.ts
80221
80340
  init_help_texts();
80222
80341
  init_dist16();
80223
- var fs6 = __toESM(require("fs"));
80224
- var path3 = __toESM(require("path"));
80225
- var DEFAULT_CONFIG_PATH = "./seeka/init.app.seeka.cli.config.json";
80342
+ var fs7 = __toESM(require("fs"));
80343
+ init_initConfig();
80226
80344
  async function loadConfig(configFilePath) {
80227
80345
  try {
80228
- const configPath = configFilePath ? path3.isAbsolute(configFilePath) ? configFilePath : path3.resolve(process.cwd(), configFilePath) : path3.resolve(process.cwd(), DEFAULT_CONFIG_PATH);
80229
- if (fs6.existsSync(configPath)) {
80230
- const configContent = fs6.readFileSync(configPath, "utf-8");
80346
+ const configPath = resolveInitConfigPath(configFilePath);
80347
+ if (fs7.existsSync(configPath)) {
80348
+ const configContent = fs7.readFileSync(configPath, "utf-8");
80231
80349
  const config = JSON.parse(configContent);
80232
80350
  console.log(`Using config file: ${configPath}`);
80233
- return config;
80351
+ return { ...config, __configPath: configPath };
80234
80352
  }
80235
80353
  if (configFilePath) {
80236
80354
  throw new Error(`Config file not found at: ${configPath}`);
@@ -80268,11 +80386,12 @@ async function getConfig(configFilePath) {
80268
80386
  console.log(` App Name: ${config.appName}
80269
80387
  `);
80270
80388
  } else {
80271
- const defaultPath = configFilePath || DEFAULT_CONFIG_PATH;
80389
+ const defaultPath = configFilePath || `./${DEFAULT_INIT_CONFIG_RELATIVE_PATH}`;
80272
80390
  console.log(`
80273
80391
  No configuration file found at ${defaultPath}. Please provide the following information:
80274
80392
  `);
80275
80393
  config = await promptForConfig();
80394
+ config.__configPath = resolveInitConfigPath(configFilePath);
80276
80395
  console.log("");
80277
80396
  }
80278
80397
  return config;