@magda/scripts 2.3.2 → 3.0.0-alpha.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/acs-cmd/acs-cmd-admin-set.js +5 -4
- package/acs-cmd/acs-cmd-admin-unset.js +5 -4
- package/acs-cmd/acs-cmd-admin.js +3 -2
- package/acs-cmd/acs-cmd-assign-permission.js +5 -4
- package/acs-cmd/acs-cmd-assign-role.js +5 -4
- package/acs-cmd/acs-cmd-assign.js +3 -2
- package/acs-cmd/acs-cmd-create-operation.js +4 -3
- package/acs-cmd/acs-cmd-create-permission.js +4 -4
- package/acs-cmd/acs-cmd-create.js +3 -2
- package/acs-cmd/acs-cmd-jwt.js +4 -4
- package/acs-cmd/acs-cmd-list-permissions.js +5 -4
- package/acs-cmd/acs-cmd-list-resources.js +5 -4
- package/acs-cmd/acs-cmd-list-roles.js +5 -4
- package/acs-cmd/acs-cmd-list-users.js +5 -4
- package/acs-cmd/acs-cmd-list.js +3 -2
- package/acs-cmd/acs-cmd-remove-permission.js +5 -4
- package/acs-cmd/acs-cmd-remove-role.js +5 -4
- package/acs-cmd/acs-cmd-remove.js +3 -2
- package/acs-cmd/index.js +3 -2
- package/acs-cmd/utils.js +2 -5
- package/build-changed.js +8 -7
- package/check-release-version.js +6 -4
- package/create-api-key.js +7 -6
- package/create-docker-context-for-node-component.js +20 -15
- package/create-jwt-token.js +5 -5
- package/create-region-synonym-file.js +5 -5
- package/create-secrets/askQuestions.js +14 -20
- package/create-secrets/index.js +7 -6
- package/create-secrets/k8sExecution.js +9 -9
- package/create-secrets/preloadConfig.js +4 -4
- package/create-secrets/prompts/inquirer-fuzzy-path.js +9 -9
- package/create-secrets/prompts/list-with-transformer.js +5 -5
- package/create-secrets/pwgen.js +2 -2
- package/db/getDBConfig.js +1 -3
- package/db/getDBPool.js +3 -3
- package/docker-util.js +11 -11
- package/findLastModifiedFile.js +2 -2
- package/generate-api-documentation.js +7 -6
- package/generate-registry-typescript.js +5 -4
- package/getAllPackages.js +6 -2
- package/isScalaPackage.js +3 -3
- package/isTypeScriptPackage.js +4 -3
- package/loaders/remove-hashbag-loader.js +2 -2
- package/org-tree/getNodeIdFromNameOrId.js +2 -2
- package/org-tree/getUserIdFromNameOrId.js +2 -2
- package/org-tree/index.js +3 -2
- package/org-tree/org-tree-assign.js +7 -7
- package/org-tree/org-tree-create.js +5 -5
- package/org-tree/org-tree-delete.js +6 -6
- package/org-tree/org-tree-insert.js +6 -6
- package/org-tree/org-tree-move.js +6 -6
- package/org-tree/org-tree-unassign.js +5 -7
- package/org-tree/org-tree-view.js +5 -5
- package/package.json +15 -8
- package/retag-and-push.js +3 -8
- package/run-in-submodules.js +11 -9
- package/run-typescript-in-nodemon.js +6 -9
- package/set-scss-vars.js +1 -0
- package/tools/swagger-codegen-cli.jar +0 -0
- package/tools/swagger-codegen-cli.md +1 -1
- package/update-helm-chart-version.js +1 -0
- package/create-all-tsconfigs.js +0 -51
- package/create-pod-and-forward.js +0 -108
- package/generate-connector-jobs.js +0 -192
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { recordExist, ADMIN_ROLE_ID } from "./utils.js";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { recordExist, ADMIN_ROLE_ID } from "./utils.js";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
package/acs-cmd/acs-cmd-admin.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
|
-
|
|
4
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
5
6
|
|
|
6
7
|
program
|
|
7
8
|
.version(pkg.version)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { recordExist } from "./utils.js";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { recordExist } from "./utils.js";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
|
@@ -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
|
-
|
|
4
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
5
6
|
|
|
6
7
|
program
|
|
7
8
|
.version(pkg.version)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
6
7
|
|
|
7
8
|
const pool = getDBPool();
|
|
8
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { recordExist } = require("./utils");
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
7
|
|
|
8
8
|
const pool = getDBPool();
|
|
9
9
|
|
|
@@ -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
|
-
|
|
4
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
5
6
|
|
|
6
7
|
program
|
|
7
8
|
.version(pkg.version)
|
package/acs-cmd/acs-cmd-jwt.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.default;
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import buildJwt from "@magda/typescript-common/dist/session/buildJwt.js";
|
|
7
7
|
|
|
8
8
|
const DEFAULT_JWT_SECRET = "squirrel";
|
|
9
9
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { table } from "table";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { table } from "table";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { table } from "table";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { table } from "table";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
package/acs-cmd/acs-cmd-list.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
|
-
|
|
4
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
5
6
|
|
|
6
7
|
program
|
|
7
8
|
.version(pkg.version)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { recordExist } from "./utils.js";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("../package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import getDBPool from "../db/getDBPool.js";
|
|
7
|
+
import { recordExist } from "./utils.js";
|
|
7
8
|
|
|
8
9
|
const pool = getDBPool();
|
|
9
10
|
|
|
@@ -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
|
-
|
|
4
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
5
6
|
|
|
6
7
|
program
|
|
7
8
|
.version(pkg.version)
|
package/acs-cmd/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
|
-
|
|
4
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
5
6
|
|
|
6
7
|
program
|
|
7
8
|
.version(pkg.version)
|
package/acs-cmd/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
async function recordExist(pool, table, record) {
|
|
1
|
+
export async function recordExist(pool, table, record) {
|
|
2
2
|
if (!Object.keys(record).length) {
|
|
3
3
|
throw new Error("record cannot be an empty object!");
|
|
4
4
|
}
|
|
@@ -19,7 +19,4 @@ async function recordExist(pool, table, record) {
|
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const ADMIN_ROLE_ID = "00000000-0000-0003-0000-000000000000";
|
|
23
|
-
|
|
24
|
-
module.exports.recordExist = recordExist;
|
|
25
|
-
module.exports.ADMIN_ROLE_ID = ADMIN_ROLE_ID;
|
|
22
|
+
export const ADMIN_ROLE_ID = "00000000-0000-0003-0000-000000000000";
|
package/build-changed.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { require } from "@magda/esm-utils";
|
|
2
|
+
import childProcess from "child_process";
|
|
3
|
+
import getAllPackages from "./getAllPackages.js";
|
|
4
|
+
import isScalaPackage from "./isScalaPackage";
|
|
5
|
+
import findLastModifiedFile from "./findLastModifiedFile";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import toposort from "toposort";
|
|
8
|
+
import yargs from "yargs";
|
|
8
9
|
|
|
9
10
|
const argv = yargs.config().help().option("skipDocker", {
|
|
10
11
|
describe: "Skip the build/push of the docker image.",
|
package/check-release-version.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
3
|
+
const pkg = require("./package.json");
|
|
4
|
+
import path from "path";
|
|
5
|
+
import fse from "fs-extra";
|
|
6
|
+
import chalk from "chalk";
|
|
5
7
|
|
|
6
8
|
const cwdPath = process.cwd();
|
|
7
|
-
|
|
9
|
+
|
|
8
10
|
if (!pkg || !pkg["version"]) {
|
|
9
11
|
console.error(chalk.red("Cannot find package.json at: " + cwdPath));
|
|
10
12
|
process.exit(-1);
|
package/create-api-key.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
2
3
|
const pkg = require("./package.json");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import bcrypt from "bcrypt";
|
|
7
|
+
import crypto from "crypto";
|
|
8
|
+
import getDBPool from "./db/getDBPool.js";
|
|
9
|
+
import isUuid from "isuuid";
|
|
9
10
|
const { table } = require("table");
|
|
10
11
|
|
|
11
12
|
program
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
getRepository
|
|
15
|
-
} = require("./docker-util");
|
|
3
|
+
import childProcess from "child_process";
|
|
4
|
+
import fse from "fs-extra";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import process from "process";
|
|
7
|
+
import yargs from "yargs";
|
|
8
|
+
import _ from "lodash";
|
|
9
|
+
import isSubDir from "is-subdir";
|
|
10
|
+
import { getVersions, getTags, getName, getRepository } from "./docker-util.js";
|
|
11
|
+
import { __dirname as getCurDirPath, require } from "@magda/esm-utils";
|
|
12
|
+
|
|
13
|
+
const __dirname = getCurDirPath();
|
|
16
14
|
|
|
17
15
|
// --- cache dependencies data from package.json
|
|
18
16
|
const packageDependencyDataCache = {};
|
|
@@ -315,7 +313,7 @@ function preparePackage(packageDir, destDir) {
|
|
|
315
313
|
|
|
316
314
|
const productionPackages = _.uniqBy(
|
|
317
315
|
getPackageList(packageDir, path.resolve(packageDir, "..")),
|
|
318
|
-
(
|
|
316
|
+
(pkg) => pkg.path
|
|
319
317
|
);
|
|
320
318
|
|
|
321
319
|
prepareNodeModules(src, dest, productionPackages);
|
|
@@ -349,7 +347,14 @@ function prepareNodeModules(packageDir, destDir, productionPackages) {
|
|
|
349
347
|
const type = stat.isFile() ? "file" : "junction";
|
|
350
348
|
fse.ensureSymlinkSync(srcPath, dest, type);
|
|
351
349
|
} catch (e) {
|
|
352
|
-
|
|
350
|
+
// see all error codes here: https://man7.org/linux/man-pages/man2/symlink.2.html#ERRORS
|
|
351
|
+
if (e?.code === "EEXIST") {
|
|
352
|
+
//console.log(`symlink ${srcPath} already exists, skip.`);
|
|
353
|
+
// the link already exists, we choose to not attempt to overwrite it.
|
|
354
|
+
// this means that the local dependency (in nearest node_modules) will higher priority than hoisted dependency (in root node_modules).
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
throw e;
|
|
353
358
|
}
|
|
354
359
|
});
|
|
355
360
|
}
|
package/create-jwt-token.js
CHANGED
|
@@ -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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
.default;
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import isUuid from "isuuid";
|
|
7
|
+
import buildJwt from "@magda/typescript-common/dist/session/buildJwt.js";
|
|
8
8
|
|
|
9
9
|
program
|
|
10
10
|
.version(pkg.version)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import _ from "lodash";
|
|
3
|
+
import yargs from "yargs";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import request from "request";
|
|
6
|
+
import StreamArray from "stream-json/streamers/StreamArray.js";
|
|
7
7
|
|
|
8
8
|
function getDefaultRegionSourceConfig() {
|
|
9
9
|
try {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import inquirer from "inquirer";
|
|
2
|
+
import trim from "lodash/trim.js";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import moment from "moment";
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
import pwgen from "./pwgen.js";
|
|
8
|
+
import partial from "lodash/partial.js";
|
|
9
|
+
import stripJsonComments from "strip-json-comments";
|
|
10
10
|
|
|
11
11
|
const questions = [
|
|
12
12
|
{
|
|
@@ -774,7 +774,7 @@ function askStartSecretsCreationWithoutQuestions(config) {
|
|
|
774
774
|
.then((answers) => answers["deploy-now"]);
|
|
775
775
|
}
|
|
776
776
|
|
|
777
|
-
function askIfCreateNamespace(namespace) {
|
|
777
|
+
export function askIfCreateNamespace(namespace) {
|
|
778
778
|
return inquirer
|
|
779
779
|
.prompt([
|
|
780
780
|
{
|
|
@@ -796,7 +796,7 @@ function askIfCreateNamespace(namespace) {
|
|
|
796
796
|
.then((answers) => answers["if-create-namespace"]);
|
|
797
797
|
}
|
|
798
798
|
|
|
799
|
-
function askQuestions(config) {
|
|
799
|
+
export function askQuestions(config) {
|
|
800
800
|
return new Promise(function (resolve, reject) {
|
|
801
801
|
const creationTime = config.get("creation-time");
|
|
802
802
|
let p;
|
|
@@ -817,7 +817,7 @@ function askQuestions(config) {
|
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
-
function getEnvVarInfo() {
|
|
820
|
+
export function getEnvVarInfo() {
|
|
821
821
|
return questions.map((item) => ({
|
|
822
822
|
name: settingNameToEnvVarName(item.name),
|
|
823
823
|
dataType: item.dataType ? item.dataType : "string",
|
|
@@ -826,14 +826,8 @@ function getEnvVarInfo() {
|
|
|
826
826
|
}));
|
|
827
827
|
}
|
|
828
828
|
|
|
829
|
-
function settingNameToEnvVarName(settingName) {
|
|
829
|
+
export function settingNameToEnvVarName(settingName) {
|
|
830
830
|
return settingName.replace(/\-/g, "_").toUpperCase();
|
|
831
831
|
}
|
|
832
832
|
|
|
833
|
-
|
|
834
|
-
askQuestions,
|
|
835
|
-
getEnvVarInfo,
|
|
836
|
-
settingNameToEnvVarName,
|
|
837
|
-
askIfCreateNamespace,
|
|
838
|
-
settingNameToEnvVarName
|
|
839
|
-
};
|
|
833
|
+
export default askQuestions;
|
package/create-secrets/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
475
|
+
export default k8sExecution;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
103
|
+
export default preloadConfig;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import util from "util";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
117
|
+
export default InquirerFuzzyPath;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
101
|
+
export default ListWithTransformer;
|