@magda/scripts 2.3.3 → 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
package/create-secrets/pwgen.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
16
|
+
export default generatePassword;
|
package/db/getDBConfig.js
CHANGED
package/db/getDBPool.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
13
|
+
export default getDBPool;
|
package/docker-util.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
22
|
+
export function getTags(tag, local, repository, version, name) {
|
|
23
23
|
if (tag === "auto") {
|
|
24
|
-
return
|
|
25
|
-
const tagPrefix =
|
|
26
|
-
const imageName =
|
|
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
|
-
|
|
35
|
+
export function getRepository(local, repository) {
|
|
36
36
|
return (repository && repository + "/") || (local ? "localhost:5000/" : "");
|
|
37
|
-
}
|
|
37
|
+
}
|
package/findLastModifiedFile.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
14
|
+
export default getAllPackages;
|
package/isScalaPackage.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
8
|
+
export default isScalaPackage;
|
package/isTypeScriptPackage.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
21
|
+
export default isTypeScriptPackage;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export default function (source) {
|
|
2
2
|
return source.replace(/^#!.+$/m, "");
|
|
3
|
-
}
|
|
3
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
13
|
+
export default getNodeIdByNameOrId;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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(
|
|
@@ -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
|
-
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(
|
|
@@ -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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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(
|
|
@@ -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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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(
|
|
@@ -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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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(
|
|
@@ -1,12 +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
|
-
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.")
|
|
@@ -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
|
-
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": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
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",
|
|
@@ -39,14 +45,16 @@
|
|
|
39
45
|
}
|
|
40
46
|
},
|
|
41
47
|
"dependencies": {
|
|
48
|
+
"@magda/esm-utils": "^1.0.1",
|
|
49
|
+
"@magda/typescript-common": "^3.0.0-alpha.0",
|
|
42
50
|
"ansi-styles": "^3.2.1",
|
|
43
51
|
"apidoc": "https://github.com/magda-io/apidoc",
|
|
44
52
|
"chalk": "^2.4.1",
|
|
45
53
|
"clear": "^0.1.0",
|
|
46
54
|
"cli-cursor": "^3.1.0",
|
|
47
|
-
"commander": "^
|
|
55
|
+
"commander": "^11.1.0",
|
|
48
56
|
"configstore": "^4.0.0",
|
|
49
|
-
"fs-extra": "^2.
|
|
57
|
+
"fs-extra": "^11.2.0",
|
|
50
58
|
"fuzzy": "^0.1.3",
|
|
51
59
|
"inquirer": "^6.0.0",
|
|
52
60
|
"inquirer-autocomplete-prompt": "^1.0.1",
|
|
@@ -68,9 +76,8 @@
|
|
|
68
76
|
"table": "^5.3.3",
|
|
69
77
|
"tmp": "0.0.31",
|
|
70
78
|
"toposort": "^1.0.6",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"typescript": "~4.2.4",
|
|
79
|
+
"tsx": "^4.7.0",
|
|
80
|
+
"typescript": "~5.2.2",
|
|
74
81
|
"uniqid": "^5.0.3",
|
|
75
82
|
"yaml": "^1.10.0",
|
|
76
83
|
"yargs": "^12.0.5"
|
package/retag-and-push.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
package/run-in-submodules.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { require } from "@magda/esm-utils";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import childProcess from "child_process";
|
|
6
|
+
import glob from "glob";
|
|
7
|
+
import _ from "lodash";
|
|
8
|
+
import os from "node:os";
|
|
9
|
+
import yargs from "yargs";
|
|
8
10
|
|
|
9
11
|
const lernaJson = require("../lerna.json");
|
|
10
12
|
|
|
11
|
-
const argv =
|
|
13
|
+
const argv = yargs.option("filters", {
|
|
12
14
|
alias: "f",
|
|
13
15
|
type: "string",
|
|
14
16
|
describe:
|
|
@@ -30,8 +32,8 @@ const filters = argFilters.map((string) => {
|
|
|
30
32
|
});
|
|
31
33
|
|
|
32
34
|
const jsPackages = _(lernaJson.packages)
|
|
33
|
-
.map((
|
|
34
|
-
.flatMap((
|
|
35
|
+
.map((pkg) => pkg + "/package.json")
|
|
36
|
+
.flatMap((pkg) => glob.sync(pkg))
|
|
35
37
|
.map((packagePath) => {
|
|
36
38
|
const packageJson = require(path.resolve(packagePath));
|
|
37
39
|
return packageJson;
|
|
@@ -50,7 +52,7 @@ const jsPackages = _(lernaJson.packages)
|
|
|
50
52
|
const result = childProcess.spawnSync(
|
|
51
53
|
"lerna",
|
|
52
54
|
[
|
|
53
|
-
...jsPackages.map((
|
|
55
|
+
...jsPackages.map((pkg) => "--scope " + pkg),
|
|
54
56
|
"--stream",
|
|
55
57
|
"--concurrency",
|
|
56
58
|
os.cpus().length,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { require } from "@magda/esm-utils";
|
|
3
|
+
import fse from "fs-extra";
|
|
4
|
+
import nodemon from "nodemon";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import process from "process";
|
|
6
7
|
|
|
7
8
|
const script = process.argv[2];
|
|
8
9
|
if (!script) {
|
|
@@ -47,11 +48,7 @@ nodemon({
|
|
|
47
48
|
args: process.argv.slice(3),
|
|
48
49
|
watch: watchPaths,
|
|
49
50
|
execMap: {
|
|
50
|
-
ts:
|
|
51
|
-
"node " +
|
|
52
|
-
require.resolve("ts-node/dist/bin.js") +
|
|
53
|
-
" -r " +
|
|
54
|
-
require.resolve("tsconfig-paths/register")
|
|
51
|
+
ts: "node " + " --import tsx/esm "
|
|
55
52
|
}
|
|
56
53
|
});
|
|
57
54
|
|
package/set-scss-vars.js
CHANGED
|
Binary file
|
package/create-all-tsconfigs.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const fse = require("fs-extra");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const getAllPackages = require("./getAllPackages");
|
|
5
|
-
const isTypeScriptPackage = require("./isTypeScriptPackage");
|
|
6
|
-
|
|
7
|
-
getAllPackages().forEach(function (packagePath) {
|
|
8
|
-
const packageJson = require(path.resolve(packagePath, "package.json"));
|
|
9
|
-
const isTypeScript = isTypeScriptPackage(packagePath, packageJson);
|
|
10
|
-
if (!isTypeScript) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
console.log(packagePath);
|
|
15
|
-
|
|
16
|
-
const tsConfigBuild = {
|
|
17
|
-
extends: "../tsconfig-global.json",
|
|
18
|
-
compilerOptions: {
|
|
19
|
-
declaration: true,
|
|
20
|
-
outDir: "dist",
|
|
21
|
-
baseUrl: "."
|
|
22
|
-
},
|
|
23
|
-
include: ["src"]
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
fse.writeFileSync(
|
|
27
|
-
path.resolve(packagePath, "tsconfig-build.json"),
|
|
28
|
-
JSON.stringify(tsConfigBuild, undefined, " ")
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const paths = {};
|
|
32
|
-
const dependencies = packageJson.dependencies || {};
|
|
33
|
-
Object.keys(dependencies)
|
|
34
|
-
.filter((key) => key.indexOf("@magda") === 0)
|
|
35
|
-
.forEach(function (key) {
|
|
36
|
-
paths[key + "/dist/*"] = ["./node_modules/" + key + "/src/*"];
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const tsConfig = {
|
|
40
|
-
extends: "./tsconfig-build.json",
|
|
41
|
-
compilerOptions: {
|
|
42
|
-
baseUrl: ".",
|
|
43
|
-
paths: paths
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
fse.writeFileSync(
|
|
48
|
-
path.resolve(packagePath, "tsconfig.json"),
|
|
49
|
-
JSON.stringify(tsConfig, undefined, " ")
|
|
50
|
-
);
|
|
51
|
-
});
|