@powerlines/core 0.46.4 → 0.46.5
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/constants/log-level.cjs +3 -3
- package/dist/constants/log-level.d.cts +3 -3
- package/dist/constants/log-level.d.mts +3 -3
- package/dist/constants/log-level.mjs +3 -3
- package/dist/constants/log-level.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +22 -12
- package/dist/plugin-utils/context-helpers.d.cts +9 -1
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +9 -1
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +22 -13
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +1 -0
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +2 -2
- package/dist/plugin-utils/index.mjs +2 -2
- package/package.json +2 -2
|
@@ -45,7 +45,7 @@ const LOG_CATEGORIES = [
|
|
|
45
45
|
const DEFAULT_DEVELOPMENT_LOG_LEVEL = {
|
|
46
46
|
general: "debug",
|
|
47
47
|
fs: "info",
|
|
48
|
-
config: "
|
|
48
|
+
config: "warn",
|
|
49
49
|
plugins: "debug",
|
|
50
50
|
hooks: "debug",
|
|
51
51
|
performance: "debug",
|
|
@@ -67,9 +67,9 @@ const DEFAULT_TEST_LOG_LEVEL = {
|
|
|
67
67
|
babel: "warn"
|
|
68
68
|
};
|
|
69
69
|
const DEFAULT_PRODUCTION_LOG_LEVEL = {
|
|
70
|
-
general: "
|
|
70
|
+
general: "warn",
|
|
71
71
|
fs: "error",
|
|
72
|
-
config: "
|
|
72
|
+
config: "error",
|
|
73
73
|
plugins: "warn",
|
|
74
74
|
hooks: "warn",
|
|
75
75
|
performance: "info",
|
|
@@ -25,7 +25,7 @@ declare const LOG_CATEGORIES: readonly ["general", "fs", "performance", "config"
|
|
|
25
25
|
declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
|
|
26
26
|
readonly general: "debug";
|
|
27
27
|
readonly fs: "info";
|
|
28
|
-
readonly config: "
|
|
28
|
+
readonly config: "warn";
|
|
29
29
|
readonly plugins: "debug";
|
|
30
30
|
readonly hooks: "debug";
|
|
31
31
|
readonly performance: "debug";
|
|
@@ -47,9 +47,9 @@ declare const DEFAULT_TEST_LOG_LEVEL: {
|
|
|
47
47
|
readonly babel: "warn";
|
|
48
48
|
};
|
|
49
49
|
declare const DEFAULT_PRODUCTION_LOG_LEVEL: {
|
|
50
|
-
readonly general: "
|
|
50
|
+
readonly general: "warn";
|
|
51
51
|
readonly fs: "error";
|
|
52
|
-
readonly config: "
|
|
52
|
+
readonly config: "error";
|
|
53
53
|
readonly plugins: "warn";
|
|
54
54
|
readonly hooks: "warn";
|
|
55
55
|
readonly performance: "info";
|
|
@@ -25,7 +25,7 @@ declare const LOG_CATEGORIES: readonly ["general", "fs", "performance", "config"
|
|
|
25
25
|
declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
|
|
26
26
|
readonly general: "debug";
|
|
27
27
|
readonly fs: "info";
|
|
28
|
-
readonly config: "
|
|
28
|
+
readonly config: "warn";
|
|
29
29
|
readonly plugins: "debug";
|
|
30
30
|
readonly hooks: "debug";
|
|
31
31
|
readonly performance: "debug";
|
|
@@ -47,9 +47,9 @@ declare const DEFAULT_TEST_LOG_LEVEL: {
|
|
|
47
47
|
readonly babel: "warn";
|
|
48
48
|
};
|
|
49
49
|
declare const DEFAULT_PRODUCTION_LOG_LEVEL: {
|
|
50
|
-
readonly general: "
|
|
50
|
+
readonly general: "warn";
|
|
51
51
|
readonly fs: "error";
|
|
52
|
-
readonly config: "
|
|
52
|
+
readonly config: "error";
|
|
53
53
|
readonly plugins: "warn";
|
|
54
54
|
readonly hooks: "warn";
|
|
55
55
|
readonly performance: "info";
|
|
@@ -43,7 +43,7 @@ const LOG_CATEGORIES = [
|
|
|
43
43
|
const DEFAULT_DEVELOPMENT_LOG_LEVEL = {
|
|
44
44
|
general: "debug",
|
|
45
45
|
fs: "info",
|
|
46
|
-
config: "
|
|
46
|
+
config: "warn",
|
|
47
47
|
plugins: "debug",
|
|
48
48
|
hooks: "debug",
|
|
49
49
|
performance: "debug",
|
|
@@ -65,9 +65,9 @@ const DEFAULT_TEST_LOG_LEVEL = {
|
|
|
65
65
|
babel: "warn"
|
|
66
66
|
};
|
|
67
67
|
const DEFAULT_PRODUCTION_LOG_LEVEL = {
|
|
68
|
-
general: "
|
|
68
|
+
general: "warn",
|
|
69
69
|
fs: "error",
|
|
70
|
-
config: "
|
|
70
|
+
config: "error",
|
|
71
71
|
plugins: "warn",
|
|
72
72
|
hooks: "warn",
|
|
73
73
|
performance: "info",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-level.mjs","names":[],"sources":["../../src/constants/log-level.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const LogLevels = {\n SILENT: \"silent\",\n ERROR: \"error\",\n WARN: \"warn\",\n INFO: \"info\",\n DEBUG: \"debug\",\n TRACE: \"trace\"\n} as const;\n\nexport const LOG_LEVELS = [\n LogLevels.SILENT,\n LogLevels.ERROR,\n LogLevels.WARN,\n LogLevels.INFO,\n LogLevels.DEBUG,\n LogLevels.TRACE\n] as const;\n\nexport const LogCategories = {\n GENERAL: \"general\",\n FS: \"fs\",\n PERFORMANCE: \"performance\",\n CONFIG: \"config\",\n PLUGINS: \"plugins\",\n HOOKS: \"hooks\",\n ENV: \"env\",\n IPC: \"ipc\",\n BABEL: \"babel\",\n NETWORK: \"network\"\n} as const;\n\nexport const LOG_CATEGORIES_ARRAY = Object.values(LogCategories);\n\nexport const LOG_CATEGORIES = [\n LogCategories.GENERAL,\n LogCategories.FS,\n LogCategories.PERFORMANCE,\n LogCategories.CONFIG,\n LogCategories.PLUGINS,\n LogCategories.HOOKS,\n LogCategories.ENV,\n LogCategories.IPC,\n LogCategories.NETWORK,\n LogCategories.BABEL\n] as const;\n\nexport const DEFAULT_DEVELOPMENT_LOG_LEVEL = {\n general: \"debug\",\n fs: \"info\",\n config: \"
|
|
1
|
+
{"version":3,"file":"log-level.mjs","names":[],"sources":["../../src/constants/log-level.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const LogLevels = {\n SILENT: \"silent\",\n ERROR: \"error\",\n WARN: \"warn\",\n INFO: \"info\",\n DEBUG: \"debug\",\n TRACE: \"trace\"\n} as const;\n\nexport const LOG_LEVELS = [\n LogLevels.SILENT,\n LogLevels.ERROR,\n LogLevels.WARN,\n LogLevels.INFO,\n LogLevels.DEBUG,\n LogLevels.TRACE\n] as const;\n\nexport const LogCategories = {\n GENERAL: \"general\",\n FS: \"fs\",\n PERFORMANCE: \"performance\",\n CONFIG: \"config\",\n PLUGINS: \"plugins\",\n HOOKS: \"hooks\",\n ENV: \"env\",\n IPC: \"ipc\",\n BABEL: \"babel\",\n NETWORK: \"network\"\n} as const;\n\nexport const LOG_CATEGORIES_ARRAY = Object.values(LogCategories);\n\nexport const LOG_CATEGORIES = [\n LogCategories.GENERAL,\n LogCategories.FS,\n LogCategories.PERFORMANCE,\n LogCategories.CONFIG,\n LogCategories.PLUGINS,\n LogCategories.HOOKS,\n LogCategories.ENV,\n LogCategories.IPC,\n LogCategories.NETWORK,\n LogCategories.BABEL\n] as const;\n\nexport const DEFAULT_DEVELOPMENT_LOG_LEVEL = {\n general: \"debug\",\n fs: \"info\",\n config: \"warn\",\n plugins: \"debug\",\n hooks: \"debug\",\n performance: \"debug\",\n env: \"info\",\n ipc: \"info\",\n network: \"debug\",\n babel: \"debug\"\n} as const;\n\nexport const DEFAULT_TEST_LOG_LEVEL = {\n general: \"info\",\n fs: \"warn\",\n config: \"warn\",\n plugins: \"warn\",\n hooks: \"warn\",\n performance: \"info\",\n env: \"warn\",\n ipc: \"warn\",\n network: \"warn\",\n babel: \"warn\"\n} as const;\n\nexport const DEFAULT_PRODUCTION_LOG_LEVEL = {\n general: \"warn\",\n fs: \"error\",\n config: \"error\",\n plugins: \"warn\",\n hooks: \"warn\",\n performance: \"info\",\n env: \"error\",\n ipc: \"error\",\n network: \"error\",\n babel: \"warn\"\n} as const;\n"],"mappings":";AAkBA,MAAa,YAAY;CACvB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACR;AAED,MAAa,aAAa;CACxB,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACX;AAED,MAAa,gBAAgB;CAC3B,SAAS;CACT,IAAI;CACJ,aAAa;CACb,QAAQ;CACR,SAAS;CACT,OAAO;CACP,KAAK;CACL,KAAK;CACL,OAAO;CACP,SAAS;CACV;AAED,MAAa,uBAAuB,OAAO,OAAO,cAAc;AAEhE,MAAa,iBAAiB;CAC5B,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACf;AAED,MAAa,gCAAgC;CAC3C,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR;AAED,MAAa,yBAAyB;CACpC,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR;AAED,MAAa,+BAA+B;CAC1C,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR"}
|
|
@@ -12,22 +12,31 @@ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-stri
|
|
|
12
12
|
* @returns The organization name or undefined if not found.
|
|
13
13
|
*/
|
|
14
14
|
function getOrganizationName(context) {
|
|
15
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(context.config.organization)) return context.config.organization;
|
|
16
|
+
return getPackageJsonOrganization(context.packageJson);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get the organization name from the `package.json` file
|
|
20
|
+
*
|
|
21
|
+
* @param packageJson - The `package.json` object to extract the organization name from.
|
|
22
|
+
* @returns The organization name or undefined if not found.
|
|
23
|
+
*/
|
|
24
|
+
function getPackageJsonOrganization(packageJson) {
|
|
15
25
|
let result;
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
if ((0,
|
|
19
|
-
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0];
|
|
26
|
+
if (Array.isArray(packageJson.maintainers) && packageJson.maintainers.length > 0) {
|
|
27
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(packageJson.maintainers[0])) result = packageJson.maintainers[0].name;
|
|
28
|
+
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(packageJson.maintainers[0])) result = packageJson.maintainers[0];
|
|
20
29
|
}
|
|
21
|
-
if (!result && Array.isArray(
|
|
22
|
-
if ((0, _stryke_type_checks_is_set_object.isSetObject)(
|
|
23
|
-
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(
|
|
30
|
+
if (!result && Array.isArray(packageJson.author) && packageJson.author.length > 0) {
|
|
31
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(packageJson.author[0])) result = packageJson.author[0].name;
|
|
32
|
+
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(packageJson.author[0])) result = packageJson.author[0];
|
|
24
33
|
}
|
|
25
|
-
if (!result && Array.isArray(
|
|
26
|
-
if ((0, _stryke_type_checks_is_set_object.isSetObject)(
|
|
27
|
-
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(
|
|
34
|
+
if (!result && Array.isArray(packageJson.contributors) && packageJson.contributors.length > 0) {
|
|
35
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(packageJson.contributors[0])) result = packageJson.contributors[0].name;
|
|
36
|
+
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(packageJson.contributors[0])) result = packageJson.contributors[0];
|
|
28
37
|
}
|
|
29
|
-
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(
|
|
30
|
-
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(
|
|
38
|
+
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(packageJson.namespace)) result = packageJson.namespace?.replace(/^@/, "");
|
|
39
|
+
if (!result && (0, _stryke_type_checks_is_set_string.isSetString)(packageJson.name)) result = packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
31
40
|
return result;
|
|
32
41
|
}
|
|
33
42
|
/**
|
|
@@ -50,4 +59,5 @@ async function getWorkspaceName(context) {
|
|
|
50
59
|
|
|
51
60
|
//#endregion
|
|
52
61
|
exports.getOrganizationName = getOrganizationName;
|
|
62
|
+
exports.getPackageJsonOrganization = getPackageJsonOrganization;
|
|
53
63
|
exports.getWorkspaceName = getWorkspaceName;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UnresolvedContext } from "../types/context.cjs";
|
|
2
|
+
import { PackageJson } from "@stryke/types/package-json";
|
|
2
3
|
|
|
3
4
|
//#region src/plugin-utils/context-helpers.d.ts
|
|
4
5
|
/**
|
|
@@ -8,6 +9,13 @@ import { UnresolvedContext } from "../types/context.cjs";
|
|
|
8
9
|
* @returns The organization name or undefined if not found.
|
|
9
10
|
*/
|
|
10
11
|
declare function getOrganizationName(context: UnresolvedContext): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Get the organization name from the `package.json` file
|
|
14
|
+
*
|
|
15
|
+
* @param packageJson - The `package.json` object to extract the organization name from.
|
|
16
|
+
* @returns The organization name or undefined if not found.
|
|
17
|
+
*/
|
|
18
|
+
declare function getPackageJsonOrganization(packageJson: PackageJson): string | undefined;
|
|
11
19
|
/**
|
|
12
20
|
* Get the organization name from the context
|
|
13
21
|
*
|
|
@@ -16,5 +24,5 @@ declare function getOrganizationName(context: UnresolvedContext): string | undef
|
|
|
16
24
|
*/
|
|
17
25
|
declare function getWorkspaceName(context: UnresolvedContext): Promise<string | undefined>;
|
|
18
26
|
//#endregion
|
|
19
|
-
export { getOrganizationName, getWorkspaceName };
|
|
27
|
+
export { getOrganizationName, getPackageJsonOrganization, getWorkspaceName };
|
|
20
28
|
//# sourceMappingURL=context-helpers.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":";;;;;;AA8BA;;;;iBAAgB,mBAAA,CACd,OAAA,EAAS,iBAAA;AAeX;;;;;AA8DA;AA9DA,iBAAgB,0BAAA,CACd,WAAA,EAAa,WAAA;;;;;;;iBA6DO,gBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UnresolvedContext } from "../types/context.mjs";
|
|
2
|
+
import { PackageJson } from "@stryke/types/package-json";
|
|
2
3
|
|
|
3
4
|
//#region src/plugin-utils/context-helpers.d.ts
|
|
4
5
|
/**
|
|
@@ -8,6 +9,13 @@ import { UnresolvedContext } from "../types/context.mjs";
|
|
|
8
9
|
* @returns The organization name or undefined if not found.
|
|
9
10
|
*/
|
|
10
11
|
declare function getOrganizationName(context: UnresolvedContext): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Get the organization name from the `package.json` file
|
|
14
|
+
*
|
|
15
|
+
* @param packageJson - The `package.json` object to extract the organization name from.
|
|
16
|
+
* @returns The organization name or undefined if not found.
|
|
17
|
+
*/
|
|
18
|
+
declare function getPackageJsonOrganization(packageJson: PackageJson): string | undefined;
|
|
11
19
|
/**
|
|
12
20
|
* Get the organization name from the context
|
|
13
21
|
*
|
|
@@ -16,5 +24,5 @@ declare function getOrganizationName(context: UnresolvedContext): string | undef
|
|
|
16
24
|
*/
|
|
17
25
|
declare function getWorkspaceName(context: UnresolvedContext): Promise<string | undefined>;
|
|
18
26
|
//#endregion
|
|
19
|
-
export { getOrganizationName, getWorkspaceName };
|
|
27
|
+
export { getOrganizationName, getPackageJsonOrganization, getWorkspaceName };
|
|
20
28
|
//# sourceMappingURL=context-helpers.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":";;;;;;AA8BA;;;;iBAAgB,mBAAA,CACd,OAAA,EAAS,iBAAA;AAeX;;;;;AA8DA;AA9DA,iBAAgB,0BAAA,CACd,WAAA,EAAa,WAAA;;;;;;;iBA6DO,gBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAA"}
|
|
@@ -10,22 +10,31 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
|
10
10
|
* @returns The organization name or undefined if not found.
|
|
11
11
|
*/
|
|
12
12
|
function getOrganizationName(context) {
|
|
13
|
+
if (isSetString(context.config.organization)) return context.config.organization;
|
|
14
|
+
return getPackageJsonOrganization(context.packageJson);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the organization name from the `package.json` file
|
|
18
|
+
*
|
|
19
|
+
* @param packageJson - The `package.json` object to extract the organization name from.
|
|
20
|
+
* @returns The organization name or undefined if not found.
|
|
21
|
+
*/
|
|
22
|
+
function getPackageJsonOrganization(packageJson) {
|
|
13
23
|
let result;
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
if (!result && isSetString(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0];
|
|
24
|
+
if (Array.isArray(packageJson.maintainers) && packageJson.maintainers.length > 0) {
|
|
25
|
+
if (isSetObject(packageJson.maintainers[0])) result = packageJson.maintainers[0].name;
|
|
26
|
+
if (!result && isSetString(packageJson.maintainers[0])) result = packageJson.maintainers[0];
|
|
18
27
|
}
|
|
19
|
-
if (!result && Array.isArray(
|
|
20
|
-
if (isSetObject(
|
|
21
|
-
if (!result && isSetString(
|
|
28
|
+
if (!result && Array.isArray(packageJson.author) && packageJson.author.length > 0) {
|
|
29
|
+
if (isSetObject(packageJson.author[0])) result = packageJson.author[0].name;
|
|
30
|
+
if (!result && isSetString(packageJson.author[0])) result = packageJson.author[0];
|
|
22
31
|
}
|
|
23
|
-
if (!result && Array.isArray(
|
|
24
|
-
if (isSetObject(
|
|
25
|
-
if (!result && isSetString(
|
|
32
|
+
if (!result && Array.isArray(packageJson.contributors) && packageJson.contributors.length > 0) {
|
|
33
|
+
if (isSetObject(packageJson.contributors[0])) result = packageJson.contributors[0].name;
|
|
34
|
+
if (!result && isSetString(packageJson.contributors[0])) result = packageJson.contributors[0];
|
|
26
35
|
}
|
|
27
|
-
if (!result && isSetString(
|
|
28
|
-
if (!result && isSetString(
|
|
36
|
+
if (!result && isSetString(packageJson.namespace)) result = packageJson.namespace?.replace(/^@/, "");
|
|
37
|
+
if (!result && isSetString(packageJson.name)) result = packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
29
38
|
return result;
|
|
30
39
|
}
|
|
31
40
|
/**
|
|
@@ -47,5 +56,5 @@ async function getWorkspaceName(context) {
|
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
//#endregion
|
|
50
|
-
export { getOrganizationName, getWorkspaceName };
|
|
59
|
+
export { getOrganizationName, getPackageJsonOrganization, getWorkspaceName };
|
|
51
60
|
//# sourceMappingURL=context-helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-helpers.mjs","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport function getOrganizationName(\n context: UnresolvedContext\n): string | undefined {\n
|
|
1
|
+
{"version":3,"file":"context-helpers.mjs","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport function getOrganizationName(\n context: UnresolvedContext\n): string | undefined {\n if (isSetString(context.config.organization)) {\n return context.config.organization;\n }\n\n return getPackageJsonOrganization(context.packageJson);\n}\n\n/**\n * Get the organization name from the `package.json` file\n *\n * @param packageJson - The `package.json` object to extract the organization name from.\n * @returns The organization name or undefined if not found.\n */\nexport function getPackageJsonOrganization(\n packageJson: PackageJson\n): string | undefined {\n let result: string | undefined;\n if (\n Array.isArray(packageJson.maintainers) &&\n packageJson.maintainers.length > 0\n ) {\n if (isSetObject(packageJson.maintainers[0])) {\n result = (packageJson.maintainers[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.maintainers[0])) {\n result = packageJson.maintainers[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(packageJson.author) &&\n packageJson.author.length > 0\n ) {\n if (isSetObject(packageJson.author[0])) {\n result = (packageJson.author[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.author[0])) {\n result = packageJson.author[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(packageJson.contributors) &&\n packageJson.contributors.length > 0\n ) {\n if (isSetObject(packageJson.contributors[0])) {\n result = (packageJson.contributors[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.contributors[0])) {\n result = packageJson.contributors[0];\n }\n }\n\n if (!result && isSetString(packageJson.namespace)) {\n result = packageJson.namespace?.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(packageJson.name)) {\n result = packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport async function getWorkspaceName(\n context: UnresolvedContext\n): Promise<string | undefined> {\n let result: string | undefined;\n\n const workspaceConfig = await tryGetWorkspaceConfig(true);\n if (workspaceConfig) {\n if (isSetString(workspaceConfig.name)) {\n result = workspaceConfig.name;\n }\n\n if (!result && isSetString(workspaceConfig.namespace)) {\n result = workspaceConfig.namespace.replace(/^@/, \"\");\n }\n }\n\n if (!result && isSetString(context.packageJson.namespace)) {\n result = context.packageJson.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.name)) {\n result = context.packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgB,oBACd,SACoB;AACpB,KAAI,YAAY,QAAQ,OAAO,aAAa,CAC1C,QAAO,QAAQ,OAAO;AAGxB,QAAO,2BAA2B,QAAQ,YAAY;;;;;;;;AASxD,SAAgB,2BACd,aACoB;CACpB,IAAI;AACJ,KACE,MAAM,QAAQ,YAAY,YAAY,IACtC,YAAY,YAAY,SAAS,GACjC;AACA,MAAI,YAAY,YAAY,YAAY,GAAG,CACzC,UAAU,YAAY,YAAY,GAAwB;AAG5D,MAAI,CAAC,UAAU,YAAY,YAAY,YAAY,GAAG,CACpD,UAAS,YAAY,YAAY;;AAIrC,KACE,CAAC,UACD,MAAM,QAAQ,YAAY,OAAO,IACjC,YAAY,OAAO,SAAS,GAC5B;AACA,MAAI,YAAY,YAAY,OAAO,GAAG,CACpC,UAAU,YAAY,OAAO,GAAwB;AAGvD,MAAI,CAAC,UAAU,YAAY,YAAY,OAAO,GAAG,CAC/C,UAAS,YAAY,OAAO;;AAIhC,KACE,CAAC,UACD,MAAM,QAAQ,YAAY,aAAa,IACvC,YAAY,aAAa,SAAS,GAClC;AACA,MAAI,YAAY,YAAY,aAAa,GAAG,CAC1C,UAAU,YAAY,aAAa,GAAwB;AAG7D,MAAI,CAAC,UAAU,YAAY,YAAY,aAAa,GAAG,CACrD,UAAS,YAAY,aAAa;;AAItC,KAAI,CAAC,UAAU,YAAY,YAAY,UAAU,CAC/C,UAAS,YAAY,WAAW,QAAQ,MAAM,GAAG;AAGnD,KAAI,CAAC,UAAU,YAAY,YAAY,KAAK,CAC1C,UAAS,YAAY,KAAK,QAAQ,MAAM,GAAG,CAAC,QAAQ,SAAS,GAAG;AAGlE,QAAO;;;;;;;;AAST,eAAsB,iBACpB,SAC6B;CAC7B,IAAI;CAEJ,MAAM,kBAAkB,MAAM,sBAAsB,KAAK;AACzD,KAAI,iBAAiB;AACnB,MAAI,YAAY,gBAAgB,KAAK,CACnC,UAAS,gBAAgB;AAG3B,MAAI,CAAC,UAAU,YAAY,gBAAgB,UAAU,CACnD,UAAS,gBAAgB,UAAU,QAAQ,MAAM,GAAG;;AAIxD,KAAI,CAAC,UAAU,YAAY,QAAQ,YAAY,UAAU,CACvD,UAAS,QAAQ,YAAY,UAAU,QAAQ,MAAM,GAAG;AAG1D,KAAI,CAAC,UAAU,YAAY,QAAQ,YAAY,KAAK,CAClD,UAAS,QAAQ,YAAY,KAAK,QAAQ,MAAM,GAAG,CAAC,QAAQ,SAAS,GAAG;AAG1E,QAAO"}
|
|
@@ -39,6 +39,7 @@ exports.getDependencyConfig = require_plugin_utils_build_helpers.getDependencyCo
|
|
|
39
39
|
exports.getDocsOutputPath = require_plugin_utils_docs_helper.getDocsOutputPath;
|
|
40
40
|
exports.getHookHandler = require_plugin_utils_helpers.getHookHandler;
|
|
41
41
|
exports.getOrganizationName = require_plugin_utils_context_helpers.getOrganizationName;
|
|
42
|
+
exports.getPackageJsonOrganization = require_plugin_utils_context_helpers.getPackageJsonOrganization;
|
|
42
43
|
exports.getTextColor = require_plugin_utils_logging.getTextColor;
|
|
43
44
|
exports.getWorkspaceName = require_plugin_utils_context_helpers.getWorkspaceName;
|
|
44
45
|
exports.isBuiltinModule = require_plugin_utils_modules.isBuiltinModule;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetDependencyConfigResult, __ΩGetDependencyConfigResult, getDependencyConfig } from "./build-helpers.cjs";
|
|
2
2
|
import { CombinePluginsOptions, __ΩCombinePluginsOptions, combinePluginOptions, combinePlugins } from "./combine-plugins.cjs";
|
|
3
|
-
import { getOrganizationName, getWorkspaceName } from "./context-helpers.cjs";
|
|
3
|
+
import { getOrganizationName, getPackageJsonOrganization, getWorkspaceName } from "./context-helpers.cjs";
|
|
4
4
|
import { getDocsOutputPath } from "./docs-helper.cjs";
|
|
5
5
|
import { extend } from "./extend.cjs";
|
|
6
6
|
import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.cjs";
|
|
@@ -11,4 +11,4 @@ import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, cre
|
|
|
11
11
|
import { MergeResult, __ΩMergeResult, merge, mergeConfig } from "./merge.cjs";
|
|
12
12
|
import { isBuiltinModule } from "./modules.cjs";
|
|
13
13
|
import { replacePathTokens } from "./paths.cjs";
|
|
14
|
-
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
14
|
+
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetDependencyConfigResult, __ΩGetDependencyConfigResult, getDependencyConfig } from "./build-helpers.mjs";
|
|
2
2
|
import { CombinePluginsOptions, __ΩCombinePluginsOptions, combinePluginOptions, combinePlugins } from "./combine-plugins.mjs";
|
|
3
|
-
import { getOrganizationName, getWorkspaceName } from "./context-helpers.mjs";
|
|
3
|
+
import { getOrganizationName, getPackageJsonOrganization, getWorkspaceName } from "./context-helpers.mjs";
|
|
4
4
|
import { getDocsOutputPath } from "./docs-helper.mjs";
|
|
5
5
|
import { extend } from "./extend.mjs";
|
|
6
6
|
import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.mjs";
|
|
@@ -11,4 +11,4 @@ import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, cre
|
|
|
11
11
|
import { MergeResult, __ΩMergeResult, merge, mergeConfig } from "./merge.mjs";
|
|
12
12
|
import { isBuiltinModule } from "./modules.mjs";
|
|
13
13
|
import { replacePathTokens } from "./paths.mjs";
|
|
14
|
-
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
14
|
+
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
@@ -4,7 +4,7 @@ import { getDependencyConfig } from "./build-helpers.mjs";
|
|
|
4
4
|
import { addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey } from "./helpers.mjs";
|
|
5
5
|
import { merge, mergeConfig } from "./merge.mjs";
|
|
6
6
|
import { combinePluginOptions, combinePlugins } from "./combine-plugins.mjs";
|
|
7
|
-
import { getOrganizationName, getWorkspaceName } from "./context-helpers.mjs";
|
|
7
|
+
import { getOrganizationName, getPackageJsonOrganization, getWorkspaceName } from "./context-helpers.mjs";
|
|
8
8
|
import { getDocsOutputPath } from "./docs-helper.mjs";
|
|
9
9
|
import { extend } from "./extend.mjs";
|
|
10
10
|
import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.mjs";
|
|
@@ -12,4 +12,4 @@ import { getConfigPath } from "./get-config-path.mjs";
|
|
|
12
12
|
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.mjs";
|
|
13
13
|
import { isBuiltinModule } from "./modules.mjs";
|
|
14
14
|
|
|
15
|
-
export { addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
15
|
+
export { addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/core",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
|
|
6
6
|
"homepage": "https://stormsoftware.com",
|
|
@@ -238,5 +238,5 @@
|
|
|
238
238
|
"typescript": "^6.0.3"
|
|
239
239
|
},
|
|
240
240
|
"publishConfig": { "access": "public" },
|
|
241
|
-
"gitHead": "
|
|
241
|
+
"gitHead": "9af888c54e58a82744cc334a6b80da52429fa0ac"
|
|
242
242
|
}
|