@powerlines/core 0.48.38 → 0.48.39

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.
@@ -10,9 +10,9 @@ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-stri
10
10
  * @param context - The Powerlines plugin context.
11
11
  * @returns The organization name or undefined if not found.
12
12
  */
13
- function getOrganizationName(context) {
13
+ async function getOrganizationName(context) {
14
14
  if ((0, _stryke_type_checks_is_set_string.isSetString)(context.config.organization)) return context.config.organization;
15
- return getPackageJsonOrganization(context.packageJson);
15
+ return getPackageJsonOrganization(context.packageJson) || await getWorkspaceName(context) || context.config.name;
16
16
  }
17
17
  /**
18
18
  * Get the organization name from the `package.json` file
@@ -8,7 +8,7 @@ import { PackageJson } from "@stryke/types/package-json";
8
8
  * @param context - The Powerlines plugin context.
9
9
  * @returns The organization name or undefined if not found.
10
10
  */
11
- declare function getOrganizationName(context: UnresolvedContext): string | undefined;
11
+ declare function getOrganizationName(context: UnresolvedContext): Promise<string | undefined>;
12
12
  /**
13
13
  * Get the organization name from the `package.json` file
14
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"context-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":";;;;;;AA8BA;;;;iBAAgB,mBAAA,CACd,OAA0B,EAAjB,iBAAiB;AAe5B;;;;AAC0B;AA6D1B;AA9DA,iBAAgB,0BAAA,CACd,WAAwB,EAAX,WAAW;;;;;;;iBA6DJ,gBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAO;AAgDV;;;;;;;;AAGyB;;;;;;;;;;;;;;;AAHzB,iBAAgB,iBAAA,CACd,WAAA,UACA,OAAA,UACA,WAAA"}
1
+ {"version":3,"file":"context-helpers.d.cts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":";;;;;;AA8BA;;;;iBAAsB,mBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAO;;;;AAAA;AAkBV;;iBAAgB,0BAAA,CACd,WAAwB,EAAX,WAAW;;AAAA;AA6D1B;;;;iBAAsB,gBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAO;;;;AAAA;AAgDV;;;;;;;;AAGyB;;;;;;;;;;;iBAHT,iBAAA,CACd,WAAA,UACA,OAAA,UACA,WAAA"}
@@ -8,7 +8,7 @@ import { PackageJson } from "@stryke/types/package-json";
8
8
  * @param context - The Powerlines plugin context.
9
9
  * @returns The organization name or undefined if not found.
10
10
  */
11
- declare function getOrganizationName(context: UnresolvedContext): string | undefined;
11
+ declare function getOrganizationName(context: UnresolvedContext): Promise<string | undefined>;
12
12
  /**
13
13
  * Get the organization name from the `package.json` file
14
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":";;;;;;AA8BA;;;;iBAAgB,mBAAA,CACd,OAA0B,EAAjB,iBAAiB;AAe5B;;;;AAC0B;AA6D1B;AA9DA,iBAAgB,0BAAA,CACd,WAAwB,EAAX,WAAW;;;;;;;iBA6DJ,gBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAO;AAgDV;;;;;;;;AAGyB;;;;;;;;;;;;;;;AAHzB,iBAAgB,iBAAA,CACd,WAAA,UACA,OAAA,UACA,WAAA"}
1
+ {"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":";;;;;;AA8BA;;;;iBAAsB,mBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAO;;;;AAAA;AAkBV;;iBAAgB,0BAAA,CACd,WAAwB,EAAX,WAAW;;AAAA;AA6D1B;;;;iBAAsB,gBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAO;;;;AAAA;AAgDV;;;;;;;;AAGyB;;;;;;;;;;;iBAHT,iBAAA,CACd,WAAA,UACA,OAAA,UACA,WAAA"}
@@ -9,9 +9,9 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
9
9
  * @param context - The Powerlines plugin context.
10
10
  * @returns The organization name or undefined if not found.
11
11
  */
12
- function getOrganizationName(context) {
12
+ async function getOrganizationName(context) {
13
13
  if (isSetString(context.config.organization)) return context.config.organization;
14
- return getPackageJsonOrganization(context.packageJson);
14
+ return getPackageJsonOrganization(context.packageJson) || await getWorkspaceName(context) || context.config.name;
15
15
  }
16
16
  /**
17
17
  * Get the organization name from the `package.json` file
@@ -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 { 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\n/**\n * Format an execution ID based on the project name, command, and config index.\n *\n * @remarks\n * The execution ID is formatted as `${projectName}-${command}-#${index}`, where:\n * - `projectName` is the name of the project.\n * - `command` is the command being executed.\n * - `index` is a zero-padded number representing the execution index (starting from 1).\n *\n * @example\n * ```ts\n * const executionId = formatExecutionId(\"my-project\", \"build\", 0);\n * // This will return \"my-project-build-01\"\n *\n * const executionId2 = formatExecutionId(\"my-project\", \"test\", 5);\n * // This will return \"my-project-test-06\"\n * ```\n *\n * @param projectName - The name of the project.\n * @param command - The command being executed.\n * @param configIndex - The index of the execution (starting from 0).\n * @returns The formatted execution ID.\n */\nexport function formatExecutionId(\n projectName: string,\n command: string,\n configIndex: number = 0\n) {\n return `${projectName}-${command}-${String(configIndex + 1).padStart(2, \"0\")}`;\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgB,oBACd,SACoB;CACpB,IAAI,YAAY,QAAQ,OAAO,YAAY,GACzC,OAAO,QAAQ,OAAO;CAGxB,OAAO,2BAA2B,QAAQ,WAAW;AACvD;;;;;;;AAQA,SAAgB,2BACd,aACoB;CACpB,IAAI;CACJ,IACE,MAAM,QAAQ,YAAY,WAAW,KACrC,YAAY,YAAY,SAAS,GACjC;EACA,IAAI,YAAY,YAAY,YAAY,EAAE,GACxC,SAAU,YAAY,YAAY,GAAwB;EAG5D,IAAI,CAAC,UAAU,YAAY,YAAY,YAAY,EAAE,GACnD,SAAS,YAAY,YAAY;CAErC;CAEA,IACE,CAAC,UACD,MAAM,QAAQ,YAAY,MAAM,KAChC,YAAY,OAAO,SAAS,GAC5B;EACA,IAAI,YAAY,YAAY,OAAO,EAAE,GACnC,SAAU,YAAY,OAAO,GAAwB;EAGvD,IAAI,CAAC,UAAU,YAAY,YAAY,OAAO,EAAE,GAC9C,SAAS,YAAY,OAAO;CAEhC;CAEA,IACE,CAAC,UACD,MAAM,QAAQ,YAAY,YAAY,KACtC,YAAY,aAAa,SAAS,GAClC;EACA,IAAI,YAAY,YAAY,aAAa,EAAE,GACzC,SAAU,YAAY,aAAa,GAAwB;EAG7D,IAAI,CAAC,UAAU,YAAY,YAAY,aAAa,EAAE,GACpD,SAAS,YAAY,aAAa;CAEtC;CAEA,IAAI,CAAC,UAAU,YAAY,YAAY,SAAS,GAC9C,SAAS,YAAY,WAAW,QAAQ,MAAM,EAAE;CAGlD,IAAI,CAAC,UAAU,YAAY,YAAY,IAAI,GACzC,SAAS,YAAY,KAAK,QAAQ,MAAM,EAAE,EAAE,QAAQ,SAAS,EAAE;CAGjE,OAAO;AACT;;;;;;;AAQA,eAAsB,iBACpB,SAC6B;CAC7B,IAAI;CAEJ,MAAM,kBAAkB,MAAM,sBAAsB,IAAI;CACxD,IAAI,iBAAiB;EACnB,IAAI,YAAY,gBAAgB,IAAI,GAClC,SAAS,gBAAgB;EAG3B,IAAI,CAAC,UAAU,YAAY,gBAAgB,SAAS,GAClD,SAAS,gBAAgB,UAAU,QAAQ,MAAM,EAAE;CAEvD;CAEA,IAAI,CAAC,UAAU,YAAY,QAAQ,YAAY,SAAS,GACtD,SAAS,QAAQ,YAAY,UAAU,QAAQ,MAAM,EAAE;CAGzD,IAAI,CAAC,UAAU,YAAY,QAAQ,YAAY,IAAI,GACjD,SAAS,QAAQ,YAAY,KAAK,QAAQ,MAAM,EAAE,EAAE,QAAQ,SAAS,EAAE;CAGzE,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,kBACd,aACA,SACA,cAAsB,GACtB;CACA,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,cAAc,CAAC,EAAE,SAAS,GAAG,GAAG;AAC7E"}
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 async function getOrganizationName(\n context: UnresolvedContext\n): Promise<string | undefined> {\n if (isSetString(context.config.organization)) {\n return context.config.organization;\n }\n\n return (\n getPackageJsonOrganization(context.packageJson) ||\n (await getWorkspaceName(context)) ||\n context.config.name\n );\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\n/**\n * Format an execution ID based on the project name, command, and config index.\n *\n * @remarks\n * The execution ID is formatted as `${projectName}-${command}-#${index}`, where:\n * - `projectName` is the name of the project.\n * - `command` is the command being executed.\n * - `index` is a zero-padded number representing the execution index (starting from 1).\n *\n * @example\n * ```ts\n * const executionId = formatExecutionId(\"my-project\", \"build\", 0);\n * // This will return \"my-project-build-01\"\n *\n * const executionId2 = formatExecutionId(\"my-project\", \"test\", 5);\n * // This will return \"my-project-test-06\"\n * ```\n *\n * @param projectName - The name of the project.\n * @param command - The command being executed.\n * @param configIndex - The index of the execution (starting from 0).\n * @returns The formatted execution ID.\n */\nexport function formatExecutionId(\n projectName: string,\n command: string,\n configIndex: number = 0\n) {\n return `${projectName}-${command}-${String(configIndex + 1).padStart(2, \"0\")}`;\n}\n"],"mappings":";;;;;;;;;;;AA8BA,eAAsB,oBACpB,SAC6B;CAC7B,IAAI,YAAY,QAAQ,OAAO,YAAY,GACzC,OAAO,QAAQ,OAAO;CAGxB,OACE,2BAA2B,QAAQ,WAAW,KAC7C,MAAM,iBAAiB,OAAO,KAC/B,QAAQ,OAAO;AAEnB;;;;;;;AAQA,SAAgB,2BACd,aACoB;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,QAAQ,MAAM,EAAE;CAGzD,IAAI,CAAC,UAAU,YAAY,QAAQ,YAAY,IAAI,GACjD,SAAS,QAAQ,YAAY,KAAK,QAAQ,MAAM,EAAE,EAAE,QAAQ,SAAS,EAAE;CAGzE,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,kBACd,aACA,SACA,cAAsB,GACtB;CACA,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,cAAc,CAAC,EAAE,SAAS,GAAG,GAAG;AAC7E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/core",
3
- "version": "0.48.38",
3
+ "version": "0.48.39",
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",
@@ -375,5 +375,5 @@
375
375
  "undici-types": "^7.26.0"
376
376
  },
377
377
  "publishConfig": { "access": "public" },
378
- "gitHead": "87e51702e7912e7e0f335da1c4cff9712ec4bdba"
378
+ "gitHead": "4cac55c7d4fa52a55d2a5f8085b80929af66e595"
379
379
  }