@magda/scripts 2.3.3 → 3.0.0-alpha.1

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.
Files changed (64) hide show
  1. package/acs-cmd/acs-cmd-admin-set.js +6 -5
  2. package/acs-cmd/acs-cmd-admin-unset.js +6 -5
  3. package/acs-cmd/acs-cmd-admin.js +3 -2
  4. package/acs-cmd/acs-cmd-assign-permission.js +7 -6
  5. package/acs-cmd/acs-cmd-assign-role.js +7 -6
  6. package/acs-cmd/acs-cmd-assign.js +3 -2
  7. package/acs-cmd/acs-cmd-create-operation.js +8 -7
  8. package/acs-cmd/acs-cmd-create-permission.js +6 -6
  9. package/acs-cmd/acs-cmd-create.js +3 -2
  10. package/acs-cmd/acs-cmd-jwt.js +6 -6
  11. package/acs-cmd/acs-cmd-list-permissions.js +5 -4
  12. package/acs-cmd/acs-cmd-list-resources.js +5 -4
  13. package/acs-cmd/acs-cmd-list-roles.js +5 -4
  14. package/acs-cmd/acs-cmd-list-users.js +5 -4
  15. package/acs-cmd/acs-cmd-list.js +3 -2
  16. package/acs-cmd/acs-cmd-remove-permission.js +7 -6
  17. package/acs-cmd/acs-cmd-remove-role.js +7 -6
  18. package/acs-cmd/acs-cmd-remove.js +3 -2
  19. package/acs-cmd/index.js +3 -2
  20. package/acs-cmd/utils.js +2 -5
  21. package/build-changed.js +8 -7
  22. package/check-release-version.js +6 -4
  23. package/create-api-key.js +7 -6
  24. package/create-docker-context-for-node-component.js +20 -15
  25. package/create-jwt-token.js +5 -5
  26. package/create-region-synonym-file.js +12 -27
  27. package/create-secrets/askQuestions.js +14 -20
  28. package/create-secrets/index.js +7 -6
  29. package/create-secrets/k8sExecution.js +9 -9
  30. package/create-secrets/preloadConfig.js +4 -4
  31. package/create-secrets/prompts/inquirer-fuzzy-path.js +9 -9
  32. package/create-secrets/prompts/list-with-transformer.js +5 -5
  33. package/create-secrets/pwgen.js +2 -2
  34. package/db/getDBConfig.js +1 -3
  35. package/db/getDBPool.js +3 -3
  36. package/docker-util.js +11 -11
  37. package/findLastModifiedFile.js +2 -2
  38. package/generate-api-documentation.js +7 -6
  39. package/generate-registry-typescript.js +5 -4
  40. package/getAllPackages.js +6 -2
  41. package/isScalaPackage.js +3 -3
  42. package/isTypeScriptPackage.js +4 -3
  43. package/loaders/remove-hashbag-loader.js +2 -2
  44. package/org-tree/getNodeIdFromNameOrId.js +2 -2
  45. package/org-tree/getUserIdFromNameOrId.js +2 -2
  46. package/org-tree/index.js +3 -2
  47. package/org-tree/org-tree-assign.js +9 -9
  48. package/org-tree/org-tree-create.js +6 -6
  49. package/org-tree/org-tree-delete.js +7 -7
  50. package/org-tree/org-tree-insert.js +8 -8
  51. package/org-tree/org-tree-move.js +8 -8
  52. package/org-tree/org-tree-unassign.js +6 -8
  53. package/org-tree/org-tree-view.js +5 -5
  54. package/package.json +18 -13
  55. package/retag-and-push.js +3 -8
  56. package/run-in-submodules.js +11 -9
  57. package/run-typescript-in-nodemon.js +6 -9
  58. package/set-scss-vars.js +1 -0
  59. package/tools/swagger-codegen-cli.jar +0 -0
  60. package/tools/swagger-codegen-cli.md +1 -1
  61. package/update-helm-chart-version.js +1 -0
  62. package/create-all-tsconfigs.js +0 -51
  63. package/create-pod-and-forward.js +0 -108
  64. package/generate-connector-jobs.js +0 -192
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env node
2
- const { askQuestions, getEnvVarInfo } = require("./askQuestions");
3
- const k8sExecution = require("./k8sExecution");
4
- const preloadConfig = require("./preloadConfig");
5
- const clear = require("clear");
6
- const chalk = require("chalk");
7
- const Configstore = require("configstore");
2
+ import { askQuestions, getEnvVarInfo } from "./askQuestions.js";
3
+ import k8sExecution from "./k8sExecution.js";
4
+ import preloadConfig from "./preloadConfig.js";
5
+ import clear from "clear";
6
+ import chalk from "chalk";
7
+ import Configstore from "configstore";
8
+ import { require } from "@magda/esm-utils";
8
9
 
9
10
  const appName = "magda-create-secrets";
10
11
  const pkg = require("../package.json");
@@ -1,14 +1,14 @@
1
- const childProcess = require("child_process");
2
- const process = require("process");
3
- const chalk = require("chalk");
4
- const trim = require("lodash/trim");
5
- const {
1
+ import childProcess from "child_process";
2
+ import process from "process";
3
+ import chalk from "chalk";
4
+ import trim from "lodash/trim.js";
5
+ import {
6
6
  getEnvVarInfo,
7
7
  askIfCreateNamespace,
8
8
  settingNameToEnvVarName
9
- } = require("./askQuestions");
10
- const Base64 = require("js-base64").Base64;
11
- const pwgen = require("./pwgen");
9
+ } from "./askQuestions.js";
10
+ import { Base64 } from "js-base64";
11
+ import pwgen from "./pwgen.js";
12
12
 
13
13
  const dbPasswordNames = [
14
14
  "authorization-db",
@@ -472,4 +472,4 @@ function getKubectlCommand(configData) {
472
472
  return clusterType === "microk8s" ? "microk8s kubectl" : "kubectl";
473
473
  }
474
474
 
475
- module.exports = k8sExecution;
475
+ export default k8sExecution;
@@ -1,6 +1,6 @@
1
- const fs = require("fs");
2
- const chalk = require("chalk");
3
- const trim = require("lodash/trim");
1
+ import fs from "fs";
2
+ import chalk from "chalk";
3
+ import trim from "lodash/trim.js";
4
4
 
5
5
  function preloadConfig(configStore, executeOption) {
6
6
  return Promise.resolve().then(function () {
@@ -100,4 +100,4 @@ function readConfigFromFile(configStore, executeOption) {
100
100
  });
101
101
  }
102
102
 
103
- module.exports = preloadConfig;
103
+ export default preloadConfig;
@@ -1,12 +1,12 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const util = require("util");
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import util from "util";
4
4
 
5
- const Choices = require("inquirer/lib/objects/choices");
6
- const InquirerAutocomplete = require("inquirer-autocomplete-prompt");
7
- const stripAnsi = require("strip-ansi");
8
- const style = require("ansi-styles");
9
- const fuzzy = require("fuzzy");
5
+ import Choices from "inquirer/lib/objects/choices.js";
6
+ import InquirerAutocomplete from "inquirer-autocomplete-prompt";
7
+ import stripAnsi from "strip-ansi";
8
+ import style from "ansi-styles";
9
+ import fuzzy from "fuzzy";
10
10
 
11
11
  const readdir_ = util.promisify(fs.readdir);
12
12
  const maxScanDepth = 2;
@@ -114,4 +114,4 @@ function getPaths(rootPath, pattern, pathFilter) {
114
114
  return filterPromise;
115
115
  }
116
116
 
117
- module.exports = InquirerFuzzyPath;
117
+ export default InquirerFuzzyPath;
@@ -1,7 +1,7 @@
1
- const List = require("inquirer/lib/prompts/list");
2
- const chalk = require("chalk");
3
- const figures = require("figures");
4
- const cliCursor = require("cli-cursor");
1
+ import List from "inquirer/lib/prompts/list.js";
2
+ import chalk from "chalk";
3
+ import figures from "figures";
4
+ import cliCursor from "cli-cursor";
5
5
 
6
6
  /**
7
7
  * A customized UI input (selection list).
@@ -98,4 +98,4 @@ function listRender(choices, pointer) {
98
98
  return output.replace(/\n$/, "");
99
99
  }
100
100
 
101
- module.exports = ListWithTransformer;
101
+ export default ListWithTransformer;
@@ -1,4 +1,4 @@
1
- const Pwgen = require("pwgen/lib/pwgen_module");
1
+ import Pwgen from "pwgen/lib/pwgen_module.js";
2
2
 
3
3
  function generatePassword(
4
4
  maxLength = 16,
@@ -13,4 +13,4 @@ function generatePassword(
13
13
  return pwgenGenerator.generate();
14
14
  }
15
15
 
16
- module.exports = generatePassword;
16
+ export default generatePassword;
package/db/getDBConfig.js CHANGED
@@ -1,4 +1,4 @@
1
- function getDBConfig() {
1
+ export default function getDBConfig() {
2
2
  const {
3
3
  POSTGRES_HOST: host,
4
4
  POSTGRES_DB: database,
@@ -15,5 +15,3 @@ function getDBConfig() {
15
15
  password: password ? password : ""
16
16
  };
17
17
  }
18
-
19
- module.exports = getDBConfig;
package/db/getDBPool.js CHANGED
@@ -1,5 +1,5 @@
1
- const pg = require("pg");
2
- const getDBConfig = require("./getDBConfig");
1
+ import pg from "pg";
2
+ import getDBConfig from "./getDBConfig.js";
3
3
 
4
4
  const pool = new pg.Pool(getDBConfig());
5
5
  pool.on("error", function (err, client) {
@@ -10,4 +10,4 @@ function getDBPool() {
10
10
  return pool;
11
11
  }
12
12
 
13
- module.exports = getDBPool;
13
+ export default getDBPool;
package/docker-util.js CHANGED
@@ -1,4 +1,4 @@
1
- exports.getVersions = function getVersions(local, version) {
1
+ export function getVersions(local, version) {
2
2
  return (
3
3
  version || [
4
4
  !local && process.env.npm_package_version
@@ -6,9 +6,9 @@ exports.getVersions = function getVersions(local, version) {
6
6
  : "latest"
7
7
  ]
8
8
  );
9
- };
9
+ }
10
10
 
11
- exports.getName = function getName(name) {
11
+ export function getName(name) {
12
12
  if (name && typeof name === "string") {
13
13
  return name;
14
14
  }
@@ -17,21 +17,21 @@ exports.getName = function getName(name) {
17
17
  : process.env.npm_package_name
18
18
  ? "data61/magda-" + process.env.npm_package_name.split("/")[1]
19
19
  : "UnnamedImage";
20
- };
20
+ }
21
21
 
22
- exports.getTags = function getTags(tag, local, repository, version, name) {
22
+ export function getTags(tag, local, repository, version, name) {
23
23
  if (tag === "auto") {
24
- return exports.getVersions(local, version).map((version) => {
25
- const tagPrefix = exports.getRepository(local, repository);
26
- const imageName = exports.getName(name);
24
+ return getVersions(local, version).map((version) => {
25
+ const tagPrefix = getRepository(local, repository);
26
+ const imageName = getName(name);
27
27
 
28
28
  return tagPrefix + imageName + ":" + version;
29
29
  });
30
30
  } else {
31
31
  return tag ? [tag] : [];
32
32
  }
33
- };
33
+ }
34
34
 
35
- exports.getRepository = function getRepository(local, repository) {
35
+ export function getRepository(local, repository) {
36
36
  return (repository && repository + "/") || (local ? "localhost:5000/" : "");
37
- };
37
+ }
@@ -1,5 +1,5 @@
1
- const fse = require("fs-extra");
2
- const klawSync = require("klaw-sync");
1
+ import fse from "fs-extra";
2
+ import klawSync from "klaw-sync";
3
3
 
4
4
  function findLastModifiedFile(path) {
5
5
  if (!fse.existsSync(path)) {
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env node
2
- const childProcess = require("child_process");
3
- const process = require("process");
4
- const yargs = require("yargs");
5
- const fs = require("fs");
6
- const path = require("path");
7
- const url = require("url");
2
+ import childProcess from "node:child_process";
3
+ import yargs from "yargs";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+ import url from "url";
7
+ import { getCurrentDirPath, require } from "@magda/esm-utils";
8
+ const __dirname = getCurrentDirPath();
8
9
 
9
10
  const argv = yargs
10
11
  .options({
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
- var spawnSync = require("child_process").spawnSync;
3
- const fs = require("fs-extra");
4
- var path = require("path");
5
-
2
+ import { spawnSync } from "node:child_process";
3
+ import fs from "fs-extra";
4
+ import path from "path";
5
+ import { __dirname as getCurDirPath, require } from "@magda/esm-utils";
6
+ const __dirname = getCurDirPath();
6
7
  const outputDir = path.resolve(process.argv[2]);
7
8
  const swaggerOutputDir = path.resolve(
8
9
  __dirname,
package/getAllPackages.js CHANGED
@@ -1,5 +1,9 @@
1
+ import { require } from "@magda/esm-utils";
1
2
  const lernaJson = require("../lerna.json");
2
- const path = require("path");
3
+ import path from "path";
4
+ import { __dirname as getCurDirPath, require } from "@magda/esm-utils";
5
+
6
+ const __dirname = getCurDirPath();
3
7
 
4
8
  function getAllPackages() {
5
9
  return lernaJson.packages.map((relativePath) =>
@@ -7,4 +11,4 @@ function getAllPackages() {
7
11
  );
8
12
  }
9
13
 
10
- module.exports = getAllPackages;
14
+ export default getAllPackages;
package/isScalaPackage.js CHANGED
@@ -1,8 +1,8 @@
1
- const fse = require("fs-extra");
2
- const path = require("path");
1
+ import fse from "fs-extra";
2
+ import path from "path";
3
3
 
4
4
  function isScalaPackage(packagePath) {
5
5
  return fse.existsSync(path.resolve(packagePath, "build.sbt"));
6
6
  }
7
7
 
8
- module.exports = isScalaPackage;
8
+ export default isScalaPackage;
@@ -1,5 +1,6 @@
1
- const fse = require("fs-extra");
2
- const path = require("path");
1
+ import fse from "fs-extra";
2
+ import path from "path";
3
+ import { require } from "@magda/esm-utils";
3
4
 
4
5
  function isTypeScriptPackage(packagePath, packageJson) {
5
6
  packageJson =
@@ -17,4 +18,4 @@ function isTypeScriptPackage(packagePath, packageJson) {
17
18
  return isTypeScript;
18
19
  }
19
20
 
20
- module.exports = isTypeScriptPackage;
21
+ export default isTypeScriptPackage;
@@ -1,3 +1,3 @@
1
- module.exports = function (source) {
1
+ export default function (source) {
2
2
  return source.replace(/^#!.+$/m, "");
3
- };
3
+ }
@@ -1,4 +1,4 @@
1
- const isUuid = require("@magda/typescript-common/dist/util/isUuid").default;
1
+ import isUuid from "@magda/typescript-common/dist/util/isUuid.js";
2
2
  async function getNodeIdByNameOrId(nameOrId, queryer) {
3
3
  if (isUuid(nameOrId)) {
4
4
  return nameOrId;
@@ -10,4 +10,4 @@ async function getNodeIdByNameOrId(nameOrId, queryer) {
10
10
  return nodes[0].id;
11
11
  }
12
12
  }
13
- module.exports = getNodeIdByNameOrId;
13
+ export default getNodeIdByNameOrId;
@@ -1,4 +1,4 @@
1
- const isUuid = require("@magda/typescript-common/dist/util/isUuid").default;
1
+ import isUuid from "@magda/typescript-common/dist/util/isUuid.js";
2
2
  async function getUserIdFromNameOrId(nameOrId, pool) {
3
3
  if (isUuid(nameOrId)) {
4
4
  return nameOrId;
@@ -13,4 +13,4 @@ async function getUserIdFromNameOrId(nameOrId, pool) {
13
13
  return result.rows[0].id;
14
14
  }
15
15
  }
16
- module.exports = getUserIdFromNameOrId;
16
+ export default getUserIdFromNameOrId;
package/org-tree/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ import { require } from "@magda/esm-utils";
2
3
  const pkg = require("../package.json");
3
- const program = require("commander");
4
- const chalk = require("chalk");
4
+ import { program } from "commander";
5
+ import chalk from "chalk";
5
6
 
6
7
  program
7
8
  .version(pkg.version)
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
+ import { require } from "@magda/esm-utils";
2
3
  const pkg = require("../package.json");
3
- const program = require("commander");
4
- const chalk = require("chalk");
5
- const NestedSetModelQueryer = require("@magda/authorization-api/dist/NestedSetModelQueryer")
6
- .default;
7
- const getDBPool = require("../db/getDBPool");
8
- const getNodeIdFromNameOrId = require("./getNodeIdFromNameOrId");
9
- const getUserIdFromNameOrId = require("./getUserIdFromNameOrId");
4
+ import { program } from "commander";
5
+ import chalk from "chalk";
6
+ import NestedSetModelQueryer from "@magda/authorization-api/dist/NestedSetModelQueryer.js";
7
+ import getDBPool from "../db/getDBPool.js";
8
+ import getNodeIdFromNameOrId from "./getNodeIdFromNameOrId.js";
9
+ import getUserIdFromNameOrId from "./getUserIdFromNameOrId.js";
10
10
 
11
11
  program
12
12
  .description(
@@ -14,8 +14,8 @@ program
14
14
  "\nBoth `userNameOrId` & `nodeNameOrId` can be either entity name or Id. \n" +
15
15
  "\tIf more than one entities are located by entity name, the first one will be used."
16
16
  )
17
- .option("<userNameOrId>", "user name or id")
18
- .option("<nodeNameOrId>", "org unit node id or name")
17
+ .argument("<userNameOrId>", "user name or id")
18
+ .argument("<nodeNameOrId>", "org unit node id or name")
19
19
  .version(pkg.version)
20
20
  .action(async (userNameOrId, parentNodeNameOrId) => {
21
21
  try {
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
+ import { require } from "@magda/esm-utils";
2
3
  const pkg = require("../package.json");
3
- const program = require("commander");
4
- const chalk = require("chalk");
5
- const NestedSetModelQueryer = require("@magda/authorization-api/dist/NestedSetModelQueryer")
6
- .default;
7
- const getDBPool = require("../db/getDBPool");
4
+ import { program } from "commander";
5
+ import chalk from "chalk";
6
+ import NestedSetModelQueryer from "@magda/authorization-api/dist/NestedSetModelQueryer.js";
7
+ import getDBPool from "../db/getDBPool.js";
8
8
 
9
9
  program
10
10
  .description(
11
11
  `Create a root tree node with specified name. You can then complete other node fields using other DB admin tools.`
12
12
  )
13
- .option("<nodeName>", "Root node name")
13
+ .argument("<nodeName>", "Root node name")
14
14
  .version(pkg.version)
15
15
  .action(async (nodeName) => {
16
16
  try {
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ import { require } from "@magda/esm-utils";
2
3
  const pkg = require("../package.json");
3
- const program = require("commander");
4
- const chalk = require("chalk");
5
- const NestedSetModelQueryer = require("@magda/authorization-api/dist/NestedSetModelQueryer")
6
- .default;
7
- const getDBPool = require("../db/getDBPool");
8
- const getNodeIdFromNameOrId = require("./getNodeIdFromNameOrId");
4
+ import { program } from "commander";
5
+ import chalk from "chalk";
6
+ import NestedSetModelQueryer from "@magda/authorization-api/dist/NestedSetModelQueryer.js";
7
+ import getDBPool from "../db/getDBPool.js";
8
+ import getNodeIdFromNameOrId from "./getNodeIdFromNameOrId.js";
9
9
 
10
10
  program
11
11
  .description(
@@ -14,7 +14,7 @@ program
14
14
  "\nIf -o or --only switch is on, only specified node will be removed and its children (if any) " +
15
15
  "will become its parent's children."
16
16
  )
17
- .option("<nodeNameOrId>", "node name or id that to be removed")
17
+ .argument("<nodeNameOrId>", "node name or id that to be removed")
18
18
  .option(
19
19
  "-o, --only",
20
20
  "If only remove specified node and left its children (if any) to its parent"
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
+ import { require } from "@magda/esm-utils";
2
3
  const pkg = require("../package.json");
3
- const program = require("commander");
4
- const chalk = require("chalk");
5
- const NestedSetModelQueryer = require("@magda/authorization-api/dist/NestedSetModelQueryer")
6
- .default;
7
- const getDBPool = require("../db/getDBPool");
8
- const getNodeIdFromNameOrId = require("./getNodeIdFromNameOrId");
4
+ import { program } from "commander";
5
+ import chalk from "chalk";
6
+ import NestedSetModelQueryer from "@magda/authorization-api/dist/NestedSetModelQueryer.js";
7
+ import getDBPool from "../db/getDBPool.js";
8
+ import getNodeIdFromNameOrId from "./getNodeIdFromNameOrId.js";
9
9
 
10
10
  program
11
11
  .description(
12
12
  "Insert a node as a child node of the specified the parent node with specified name. " +
13
13
  "\nIf the parent node name is given instead of the parent node Id, the newly created child node will be inserted to the first located parent node."
14
14
  )
15
- .option("<parentNodeNameOrId>", "parent node id or name")
16
- .option("<nodeName>", "insert node name")
15
+ .argument("<parentNodeNameOrId>", "parent node id or name")
16
+ .argument("<nodeName>", "insert node name")
17
17
  .version(pkg.version)
18
18
  .action(async (parentNodeNameOrId, nodeName) => {
19
19
  try {
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ import { require } from "@magda/esm-utils";
2
3
  const pkg = require("../package.json");
3
- const program = require("commander");
4
- const chalk = require("chalk");
5
- const NestedSetModelQueryer = require("@magda/authorization-api/dist/NestedSetModelQueryer")
6
- .default;
7
- const getDBPool = require("../db/getDBPool");
8
- const getNodeIdFromNameOrId = require("./getNodeIdFromNameOrId");
4
+ import { program } from "commander";
5
+ import chalk from "chalk";
6
+ import NestedSetModelQueryer from "@magda/authorization-api/dist/NestedSetModelQueryer.js";
7
+ import getDBPool from "../db/getDBPool.js";
8
+ import getNodeIdFromNameOrId from "./getNodeIdFromNameOrId.js";
9
9
 
10
10
  program
11
11
  .description(
@@ -13,8 +13,8 @@ program
13
13
  "\nIf the node name is given instead of the node Id, the first located node (and its dependents) will be moved." +
14
14
  "\nIf the parent node name is given instead of the parent node Id, the specifed node will be moved to the first located parent node."
15
15
  )
16
- .option("<nodeNameOrId>", "The id or name of the node to be moved")
17
- .option("<parentNodeNameOrId>", "The new parent node id or name")
16
+ .argument("<nodeNameOrId>", "The id or name of the node to be moved")
17
+ .argument("<parentNodeNameOrId>", "The new parent node id or name")
18
18
  .version(pkg.version)
19
19
  .action(async (nodeNameOrId, parentNodeNameOrId) => {
20
20
  try {
@@ -1,16 +1,14 @@
1
1
  #!/usr/bin/env node
2
+ import { require } from "@magda/esm-utils";
2
3
  const pkg = require("../package.json");
3
- const program = require("commander");
4
- const chalk = require("chalk");
5
- const NestedSetModelQueryer = require("@magda/authorization-api/dist/NestedSetModelQueryer")
6
- .default;
7
- const getDBPool = require("../db/getDBPool");
8
- const getNodeIdFromNameOrId = require("./getNodeIdFromNameOrId");
9
- const getUserIdFromNameOrId = require("./getUserIdFromNameOrId");
4
+ import { program } from "commander";
5
+ import chalk from "chalk";
6
+ import getDBPool from "../db/getDBPool.js";
7
+ import getUserIdFromNameOrId from "./getUserIdFromNameOrId.js";
10
8
 
11
9
  program
12
10
  .description("Remove the specified user to from any org unit.")
13
- .option("<userNameOrId>", "user name or id")
11
+ .argument("<userNameOrId>", "user name or id")
14
12
  .version(pkg.version)
15
13
  .action(async (userNameOrId) => {
16
14
  try {
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ import { require } from "@magda/esm-utils";
2
3
  const pkg = require("../package.json");
3
- const program = require("commander");
4
- const chalk = require("chalk");
5
- const NestedSetModelQueryer = require("@magda/authorization-api/dist/NestedSetModelQueryer")
6
- .default;
7
- const getDBPool = require("../db/getDBPool");
4
+ import { program } from "commander";
5
+ import chalk from "chalk";
6
+ import NestedSetModelQueryer from "@magda/authorization-api/dist/NestedSetModelQueryer.js";
7
+ import getDBPool from "../db/getDBPool.js";
8
8
 
9
9
  program
10
10
  .version(pkg.version)
package/package.json CHANGED
@@ -1,15 +1,21 @@
1
1
  {
2
2
  "name": "@magda/scripts",
3
- "version": "2.3.3",
3
+ "version": "3.0.0-alpha.1",
4
4
  "description": "Scripts for building, running, and deploying MAGDA",
5
5
  "license": "Apache-2.0",
6
+ "type": "module",
7
+ "exports": {
8
+ "./*.js": "./*.js",
9
+ "./package.json": "./package.json"
10
+ },
11
+ "engines": {
12
+ "node": ">=18.19.0"
13
+ },
6
14
  "bin": {
7
15
  "generate-registry-typescript": "generate-registry-typescript.js",
8
16
  "create-jwt-token": "create-jwt-token.js",
9
17
  "create-docker-context-for-node-component": "create-docker-context-for-node-component.js",
10
- "generate-connector-jobs": "generate-connector-jobs.js",
11
18
  "run-typescript-in-nodemon": "run-typescript-in-nodemon.js",
12
- "create-pod-and-forward": "create-pod-and-forward.js",
13
19
  "retag-and-push": "retag-and-push.js",
14
20
  "generate-api-documentation": "generate-api-documentation.js",
15
21
  "create-secrets": "create-secrets/index.js",
@@ -28,8 +34,7 @@
28
34
  "release": "npm publish || echo \"Skip releasing npm package @magda/scripts.\""
29
35
  },
30
36
  "devDependencies": {
31
- "@types/pg": "^8.6.5",
32
- "@types/request": "^2.48.1"
37
+ "@types/pg": "^8.6.5"
33
38
  },
34
39
  "magda": {
35
40
  "language": "javascript",
@@ -39,14 +44,16 @@
39
44
  }
40
45
  },
41
46
  "dependencies": {
47
+ "@magda/esm-utils": "^1.0.1",
48
+ "@magda/typescript-common": "^3.0.0-alpha.1",
42
49
  "ansi-styles": "^3.2.1",
43
50
  "apidoc": "https://github.com/magda-io/apidoc",
44
51
  "chalk": "^2.4.1",
45
52
  "clear": "^0.1.0",
46
53
  "cli-cursor": "^3.1.0",
47
- "commander": "^2.17.0",
54
+ "commander": "^11.1.0",
48
55
  "configstore": "^4.0.0",
49
- "fs-extra": "^2.1.2",
56
+ "fs-extra": "^11.2.0",
50
57
  "fuzzy": "^0.1.3",
51
58
  "inquirer": "^6.0.0",
52
59
  "inquirer-autocomplete-prompt": "^1.0.1",
@@ -57,20 +64,18 @@
57
64
  "klaw-sync": "^2.1.0",
58
65
  "lodash": "^4.17.5",
59
66
  "moment": "^2.19.4",
67
+ "node-fetch": "^3.3.2",
60
68
  "nodemon": "^1.11.0",
61
- "pg": "^8.7.3",
62
- "pkg": "^4.3.4",
69
+ "pg": "^8.11.3",
63
70
  "pwgen": "0.1.6",
64
- "request": "^2.88.0",
65
71
  "stream-json": "^1.1.3",
66
72
  "strip-ansi": "^4.0.0",
67
73
  "strip-json-comments": "^2.0.1",
68
74
  "table": "^5.3.3",
69
75
  "tmp": "0.0.31",
70
76
  "toposort": "^1.0.6",
71
- "ts-node": "^8.9.2",
72
- "tsconfig-paths": "^4.1.0",
73
- "typescript": "~4.2.4",
77
+ "tsx": "^4.7.0",
78
+ "typescript": "~5.3.3",
74
79
  "uniqid": "^5.0.3",
75
80
  "yaml": "^1.10.0",
76
81
  "yargs": "^12.0.5"
package/retag-and-push.js CHANGED
@@ -1,13 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const yargs = require("yargs");
4
- const childProcess = require("child_process");
5
- const {
6
- getVersions,
7
- getTags,
8
- getName,
9
- getRepository
10
- } = require("./docker-util");
3
+ import yargs from "yargs";
4
+ import * as childProcess from "child_process";
5
+ import { getVersions, getName } from "./docker-util";
11
6
 
12
7
  // Docker and ConEmu (an otherwise excellent console for Windows) don't get along.
13
8
  // See: https://github.com/Maximus5/ConEmu/issues/958 and https://github.com/moby/moby/issues/28814