@halospv3/hce.shared-config 1.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ ## [1.1.0](https://github.com/halospv3/hce.shared/compare/v1.0.5...v1.1.0) (2023-10-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * add ZipPublishDir Target ([36755ac](https://github.com/halospv3/hce.shared/commit/36755ac51586a636ee91057adda94dbff1359c73))
7
+ * **node:** adopt Packemon for project management ([daafc7f](https://github.com/halospv3/hce.shared/commit/daafc7f74939f2793b1e3b8312fe95aa832614d3))
8
+ * **node:** load, validate, and export semantic-release shareable configuration ([74c11af](https://github.com/halospv3/hce.shared/commit/74c11af149f36be5e84a9ee064caaf50522017d1))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update semantic-release monorepo ([b8dd3c2](https://github.com/halospv3/hce.shared/commit/b8dd3c2386d9f9717a7f916dcdbc1a1cc5a5f5c5))
14
+ * **deps:** update semantic-release monorepo ([f507178](https://github.com/halospv3/hce.shared/commit/f507178302719193bf323a2f9decb113c078e163))
15
+ * **dotnet:** always overwrite ZipPublishDir DestinationFile ([38ef324](https://github.com/halospv3/hce.shared/commit/38ef32430858ed1060077e7453f5f2825c7c6ab8))
16
+ * **node:** bump minimum Node version to 18.17.1 ([92f5b47](https://github.com/halospv3/hce.shared/commit/92f5b47d40d1f9832b2e9f00b49579976b465166))
17
+ * **node:** lift main function body to top-level; assign to const and export it ([c0cc133](https://github.com/halospv3/hce.shared/commit/c0cc133d9d57949339d223f8aa12c123500c4d9c))
18
+ * **node:** remove use of semantic-release's private get-config, get-logger ([658b37c](https://github.com/halospv3/hce.shared/commit/658b37c6aee922a123b3c2128f5f588372bcbd7b))
19
+ * **node:** resolve "parameter 'options' implicitly 'any'" (TS7006) ([5fd278b](https://github.com/halospv3/hce.shared/commit/5fd278bf0983f63bf41db1484fd62df133993870))
20
+ * update destination path in ZipPublishDir ([b7bfc24](https://github.com/halospv3/hce.shared/commit/b7bfc24f4917628ef9837f94d6e3f87be4b54b1b))
21
+
22
+
23
+ ### Reverts
24
+
25
+ * **node:** rename index.mts to index.ts ([f0cd2ee](https://github.com/halospv3/hce.shared/commit/f0cd2ee2bc1e1a4af7dde349d6df65c85944b035))
26
+
27
+ # Changelog
28
+
29
+ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
30
+
31
+ ## [1.0.5](https://github.com/halospv3/hce.shared/compare/v1.0.4...v1.0.5) (2023-07-17)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * **deps:** update dependency conventional-changelog-conventionalcommits to v6 ([8f283e6](https://github.com/halospv3/hce.shared/commit/8f283e63fdc03d2fe04e04c25e4283dfa757d4ff))
37
+ * **deps:** update semantic-release monorepo ([8d14404](https://github.com/halospv3/hce.shared/commit/8d1440455fe38d74f6e2a585a22dea9707659a69))
38
+ * remove leftover mrm reference ([a60a1d2](https://github.com/halospv3/hce.shared/commit/a60a1d26f68149b364fb3c155fd605b48ea1cfc8))
39
+
40
+ ## [1.0.4](https://github.com/halospv3/hce.shared/compare/v1.0.3...v1.0.4) (2023-05-26)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * **deps:** change all devDependencies to dependencies ([79a4a30](https://github.com/halospv3/hce.shared/commit/79a4a3049d8c6f5f9c91a945bb06e0b2daea3cc7))
46
+
47
+ ### 1.0.3 (2023-05-26)
48
+
49
+
50
+ ### Bug Fixes
51
+
52
+ * **dev-deps:** import deps into index.js stub ([7fdb046](https://github.com/halospv3/hce.shared/commit/7fdb04646162dc205024c2b04af945e34d57b52c))
53
+ * **dev-deps:** remove commitizen, cz-conventional-changelog ([b91155a](https://github.com/halospv3/hce.shared/commit/b91155a7d4ba81af1432c520f55e3cb09c13089c))
54
+ * remove commitizen script ([46fdf69](https://github.com/halospv3/hce.shared/commit/46fdf6929bffbf63a81a2c2bfc06fb0d92e905e3))
55
+
56
+ # Changelog
57
+
58
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
59
+
60
+ ### 1.0.2 (2021-12-29)
61
+
62
+
63
+ ### Bug Fixes
64
+
65
+ * **dev-deps:** import deps into index.js stub ([7fdb046](https://github.com/halospv3/hce.shared/commit/7fdb04646162dc205024c2b04af945e34d57b52c))
66
+ * **dev-deps:** remove commitizen, cz-conventional-changelog ([b91155a](https://github.com/halospv3/hce.shared/commit/b91155a7d4ba81af1432c520f55e3cb09c13089c))
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Noah Sherwin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # HCE.Shared
2
+ Infrastructure resources shared with other HaloSPV3 repositories.
3
+
4
+ It is recommended to "install" this repo via [Node Package Manager](#npm)
5
+
6
+ ## NPM
7
+
8
+ `npm install HaloSPV3/HCE.Shared --save-dev`
9
+
10
+ See [package.json](package.json) and [node/](node/)
11
+
12
+ ## .NET
13
+
14
+ See [dotnet/](dotnet/)
15
+
16
+ GitHub Actions workflow examples are in [dotnet/.github/workflows/](dotnet/.github/workflows/).
17
+
18
+ #### TODO:
19
+
20
+ Eventually, I hope to make boilerplate workflows useable from via relative paths e.g.
21
+ ```yml
22
+ jobs:
23
+ release:
24
+ steps:
25
+ - uses: actions/checkout@v3
26
+ - name: dotnet build/publish; copy release artifacts to './publish/'
27
+ uses: ./node_modules/@halospv3/hce.shared/dotnet/.github/workflows/dotnet-release.yml
28
+ with:
29
+ projects:
30
+ - src/lib/lib.csproj
31
+ - src/lib-sample/sample.csproj
32
+ ```
33
+
34
+ ### Directory.Build.props
35
+
36
+ Add the file `Directory.Build.props` to your repository's root directory or solution directory if you haven't already.
37
+ Then, add the following properties:
38
+ ```xml
39
+ <Project>
40
+ <PropertyGroup>
41
+ <ProjectRootDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), '.git/index'))</ProjectRootDir>
42
+ <HCESharedDir>$(ProjectRootDir)/node_modules/@halospv3/hce.shared/</HCESharedDir>
43
+ </PropertyGroup>
44
+ </Project>
45
+ ```
46
+
47
+ These may evaluate to the following:
48
+ | Property | Evaluated Value|
49
+ | - | - |
50
+ |`ProjectRootDir` | `c:\Repos\HaloSPV3\HCE.Shared\` |
51
+ |`HCESharedDir`| `c:\Repos\HaloSPV3\HCE.Shared\node_modules\@halospv3\hce.shared\` |
52
+
53
+ <br/>
54
+
55
+ If you want properties set only in a CI/CD environment (e.g. a GitHub workflow), add the following conditional property group to the props file:
56
+ ```xml, diff
57
+ <Project>
58
+ <PropertyGroup>
59
+ ...
60
+ </PropertyGroup>
61
+
62
+ <PropertyGroup Condition=" '$(CI)' == 'true' ">
63
+ <Configuration>Release</Configuration>
64
+ <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
65
+ </PropertyGroup>
66
+ </Project>
67
+ ```
68
+ > Any properties added to this conditional property group will only be evaluated when `$(CI)` is defined either as a property or as an environment variable. This is most useful for properties such as `ContinuousIntegrationBuild`.
69
+
70
+ ### GitVersion
71
+
72
+ By default, GitVersion will search only the "current directory" for `GitVersion.yml`. GitVersion has a lesser-known CLI argument, "Path" which allows users to specify the path to `GitVersion.yml`. The NuGet package `GitVersion.MSBuild` exposes this as the read-write property `$(GitVersion_Path)`.
73
+ ```xml
74
+ <PropertyGroup>
75
+ <GitVersion_Path>../SiblingDir/GitVersion.yml</GitVersion_Path>
76
+ </PropertyGroup>
77
+ ```
@@ -0,0 +1,6 @@
1
+ // Bundled with Packemon: https://packemon.dev
2
+ // This is an MJS wrapper for a sibling CJS file
3
+
4
+ import data from './index.cjs';
5
+
6
+ export default data;
package/cjs/index.cjs ADDED
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ const node_fs = require('node:fs');
4
+ const path = require('node:path');
5
+ const node_url = require('node:url');
6
+ const jsYaml = require('js-yaml');
7
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
8
+ const _interopDefault = e => e && e.__esModule ? e : {
9
+ default: e
10
+ };
11
+ const path__default = /*#__PURE__*/_interopDefault(path);
12
+ const jsYaml__default = /*#__PURE__*/_interopDefault(jsYaml);
13
+ function findStaticConfig() {
14
+ const glob = "static/.releaserc.yml";
15
+ let dirPath = node_url.fileURLToPath(path__default.default.dirname(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href));
16
+ let combinedPath = path__default.default.join(dirPath, glob);
17
+ while (!node_fs.existsSync(combinedPath)) {
18
+ /* file:// + dirname behavior on Windows. 'root' is empty when 'file://' is present.
19
+ * file:///C:/Repos
20
+ * file:///C:
21
+ * file://
22
+ * .
23
+ */
24
+ // DEBUG.log(dirPath);
25
+ // DEBUG.log(combinedPath.href);
26
+ /** Throw if we reached root. */
27
+ if (path__default.default.dirname(dirPath) === "") throw new Error(`Failed to get full path for HCE.Shared's shared configuration. HCE.Shared recursively searched parent directories for '${glob}' starting from '${path__default.default.dirname(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)}'`);
28
+ dirPath = path__default.default.dirname(dirPath);
29
+ combinedPath = path__default.default.join(dirPath, glob);
30
+ }
31
+ return combinedPath;
32
+ }
33
+ const options = jsYaml__default.default.load(node_fs.readFileSync(findStaticConfig(), {
34
+ encoding: "utf8"
35
+ }));
36
+ module.exports = options;
37
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":null,"names":["fileURLToPath","path","existsSync","jsYaml","readFileSync"],"mappings":";;;;;;;;;;;;;AAIA,SAAS,gBAAgB,GAAG;AAC5B,EAAE,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACvC,EAAE,IAAI,OAAO,GAAGA,sBAAa,CAACC,qBAAI,CAAC,OAAO,CAAC,8LAAe,CAAC,CAAC,CAAC;AAC7D,EAAE,IAAI,YAAY,GAAGA,qBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC9C,EAAE,OAAO,CAACC,kBAAU,CAAC,YAAY,CAAC,EAAE;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,IAAID,qBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,MAAM,IAAI,KAAK,CAAC,CAAC,uHAAuH,EAAE,IAAI,CAAC,iBAAiB,EAAEA,qBAAI,CAAC,OAAO,CAAC,8LAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1O,IAAI,OAAO,GAAGA,qBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACpC,IAAI,YAAY,GAAGA,qBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC5C,GAAG;AACH,EAAE,OAAO,YAAY,CAAC;AACtB,CAAC;AACI,MAAC,OAAO,GAAGE,uBAAM,CAAC,IAAI,CAACC,oBAAY,CAAC,gBAAgB,EAAE,EAAE;AAC7D,EAAE,QAAQ,EAAE,MAAM;AAClB,CAAC,CAAC;;;;"}
package/cjs/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { Options } from "semantic-release";
2
+ declare const options: Options;
3
+ /**
4
+ * Runs HCE.Shared and returns a semantic-release "shareable configuration" object.
5
+ * @type {Options}.
6
+ */
7
+ export default options;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA6BhD,QAAA,MAAM,OAAO,SAAiF,CAAC;AAE/F;;;GAGG;AACH,eAAe,OAAO,CAAC"}
@@ -0,0 +1,89 @@
1
+ name: dotnet-release
2
+
3
+ # TODO
4
+ # - Get AssemblyName, RuntimeIdentifier (RID) from Directory.Build.props, *.csproj
5
+ # - Allow workflows to be driven by the project(s)
6
+ # - support multiple ASSEMBLYNAME parameters for matrices
7
+
8
+ on:
9
+ push:
10
+ branches: [ main, develop ]
11
+ paths-ignore:
12
+ - ".github/**/*.*"
13
+ - "**/*.md"
14
+ - "**/*.txt"
15
+
16
+ permissions:
17
+ contents: write
18
+ issues: write
19
+ pull-requests: write
20
+
21
+ jobs:
22
+ release:
23
+ runs-on: ubuntu-latest
24
+ strategy: # TODO: Get variables from config file(s). May require a parent workflow to allow matrix runs.
25
+ matrix:
26
+ RID: [ "win-x86", "win-x64" ]
27
+ ASSEMBLYNAME: [ "SPV3.Loader", "SPV3.Installer", "HXE" ] #TODO: update
28
+ env:
29
+ PROJPATH: "./src/${{ matrix.ASSEMBLYNAME }}.csproj"
30
+
31
+ steps:
32
+ - name: Wait for build to succeed
33
+ uses: lewagon/wait-on-check-action@v1.3.1
34
+ with:
35
+ ref: ${{ github.ref }}
36
+ check-name: 'Build (${{matrix.RID}}, ${{matrix.ASSEMBLYNAME}})'
37
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
38
+ wait-interval: 10
39
+
40
+ ################
41
+ # SETUP
42
+ ################
43
+ - uses: actions/checkout@v4
44
+ with:
45
+ fetch-depth: 0 # Required by GitVersion
46
+ submodules: "recursive" # submodule fetch depth unknown
47
+ - uses: actions/setup-dotnet@v3
48
+ - name: Setup Node
49
+ uses: actions/setup-node@v3
50
+ - run: npm ci # Required by Semantic Release
51
+
52
+ ################
53
+ # BUILD
54
+ ################
55
+ - name: dotnet publish
56
+ run: |
57
+ dotnet publish ${{ matrix.PROJPATH }} -c Release --no-self-contained -p:ContinuousIntegrationBuild=true
58
+ src/.msb.noConfig.ps1
59
+
60
+ # required variables: TargetFramework, RuntimeIdentifier, GitVersion_FullSemVer
61
+ # TODO: replace with ZipPublishDir (see Bintoss/GroupBox.Avalonia)
62
+ - name: Compress Publish Artifacts
63
+ shell: pwsh
64
+ run: |
65
+ $archiveName = "$env:ASSEMBLYNAME.$env:RID.$env:GitVersion_FullSemVer.zip";
66
+ Compress-Archive -Path publish -DestinationPath $archiveName -CompressionLevel Optimal;
67
+
68
+ ################
69
+ # RELEASE
70
+ ################
71
+ # https://github.com/semantic-release/semantic-release
72
+ - name: Semantic Release
73
+ run: npx semantic-release
74
+ env:
75
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76
+
77
+ - name: Upload Artifact
78
+ uses: actions/upload-artifact@v3
79
+ with:
80
+ name: publish-artifacts
81
+ path: publish
82
+
83
+ - name: Publish to GitHub Packages
84
+ working-directory: publish
85
+ run: dotnet nuget push *.nupkg -s https://nuget.pkg.github.com/HaloSPV3/index.json -k ${{ secrets.GITHUB_TOKEN }}
86
+
87
+ - name: Publish to nuget.org
88
+ working-directory: publish
89
+ run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_TOKEN }}
@@ -0,0 +1,21 @@
1
+ # This workflow demonstrates the minimal requirements for
2
+ # building, publishing, and packing a CSharp Project with DotNet CLI
3
+
4
+ on:
5
+ push:
6
+ pull_request:
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ with:
14
+ submodules: 'recursive'
15
+ fetch-depth: 0
16
+
17
+ - uses: actions/setup-dotnet@v3
18
+
19
+ - run: dotnet build src/SPV3.csproj -c Release -p:ContinuousIntegrationBuild=true
20
+ # ContinuousIntegrationBuild comes from dotnet/sourcelink. Make sure Deterministic is also true!
21
+ # Alternatively, add a PropertyGroup with the condition " '$(CI)' != '' "
@@ -0,0 +1,5 @@
1
+ # https://gitversion.net/docs/reference/configuration
2
+ mode: MainLine
3
+ major-version-bump-message: "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)"
4
+ minor-version-bump-message: "^(feat)(\\([\\w\\s-]*\\))?:"
5
+ patch-version-bump-message: "^(build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?:"
@@ -0,0 +1,17 @@
1
+ <Project>
2
+ <!-- https://learn.microsoft.com/en-us/visualstudio/msbuild/zipdirectory-task?view=vs-2022 -->
3
+ <Target Name="ZipPublishDir" AfterTargets="Publish">
4
+ <PropertyGroup>
5
+ <RepoRoot>$([System.IO.Path]::GetDirectoryName($([MSBuild]::GetPathOfFileAbove('.gitignore', '$(MSBuildProjectDirectory)'))))</RepoRoot>
6
+ <Destination>$(RepoRoot)/publish/$(AssemblyName).$(Version)$(PART_RuntimeIdentifier)</Destination>
7
+ <Destination Condition="'$(RuntimeIdentifier)' != '' ">$(Destination).$(RuntimeIdentifier)</Destination>
8
+ </PropertyGroup>
9
+
10
+ <!-- https://www.nuget.org/packages/GitInfo -->
11
+
12
+ <ZipDirectory
13
+ SourceDirectory="$(PublishDir)"
14
+ DestinationFile="$(Destination).zip"
15
+ Overwrite="true" />
16
+ </Target>
17
+ </Project>
package/package.json ADDED
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "@halospv3/hce.shared-config",
3
+ "version": "1.1.0",
4
+ "description": "Automate commit message quality, changelogs, and CI/CD releases. Exports a semantic-release shareable configuration deserialized from this package's '.releaserc.yml'. Shared resources for .NET projects are also distributed with this package.",
5
+ "keywords": [
6
+ "halo",
7
+ "halo-ce",
8
+ "semantic-release",
9
+ "semantic-release-config"
10
+ ],
11
+ "type": "module",
12
+ "homepage": "https://github.com/halospv3/hce.shared#readme",
13
+ "bugs": "https://github.com/halospv3/hce.shared/issues",
14
+ "license": "MIT",
15
+ "author": "Noah Sherwin",
16
+ "files": [
17
+ "!tests/",
18
+ "CHANGELOG.md",
19
+ "cjs/**/*",
20
+ "dotnet/",
21
+ "src/**/*",
22
+ "static/**/*"
23
+ ],
24
+ "main": "./cjs/index.cjs",
25
+ "infra": "polyrepo",
26
+ "repository": "github:halospv3/hce.shared",
27
+ "scripts": {
28
+ "build": "packemon build",
29
+ "check": "npm run type && npm run test && npm run lint",
30
+ "clean": "packemon clean",
31
+ "coverage": "npm run test --coverage",
32
+ "format": "prettier --write \"./src/**/*\" \"./tests/**/*\"",
33
+ "lint": "eslint --cache --fix \"./src/**/*\" \"./tests/**/*\"",
34
+ "pack": "packemon pack --addEngines --addFiles --declaration",
35
+ "prepare": "husky install",
36
+ "presemantic-release": "npm run pack && npm run check",
37
+ "semantic-release": "npx semantic-release",
38
+ "test": "node --loader tsx --no-warnings --test ./tests/index.test.mts",
39
+ "type": "tsc",
40
+ "validate": "packemon validate",
41
+ "watch": "packemon watch"
42
+ },
43
+ "dependencies": {
44
+ "@commitlint/cli": "^17.7.1",
45
+ "@commitlint/config-conventional": "^17.8.0",
46
+ "@semantic-release/changelog": "^6.0.3",
47
+ "@semantic-release/commit-analyzer": "^11.0.0",
48
+ "@semantic-release/git": "^10.0.1",
49
+ "@semantic-release/github": "^9.0.4",
50
+ "@semantic-release/npm": "^11.0.0",
51
+ "@semantic-release/release-notes-generator": "^12.0.0",
52
+ "conventional-changelog-conventionalcommits": "^7.0.2",
53
+ "husky": "^8.0.3",
54
+ "js-yaml": "^4.1.0",
55
+ "node-fetch": "^3.3.2",
56
+ "semantic-release": "^22.0.0"
57
+ },
58
+ "devDependencies": {
59
+ "@tsconfig/node-lts": "^18.12.5",
60
+ "@types/debug": "^4.1.8",
61
+ "@types/js-yaml": "^4.0.8",
62
+ "@types/node": "^20.5.1",
63
+ "@types/semantic-release": "^20.0.1",
64
+ "@typescript-eslint/eslint-plugin": "^6.7.5",
65
+ "@typescript-eslint/parser": "^6.7.5",
66
+ "ajv": "^8.12.0",
67
+ "ajv-draft-04": "^1.0.0",
68
+ "babel-cli": "^6.26.0",
69
+ "babel-plugin-cjs-esm-interop": "^3.0.2",
70
+ "eslint": "^8.51.0",
71
+ "eslint-config-moon": "^2.0.10",
72
+ "eslint-plugin-disable": "^2.0.3",
73
+ "node-fetch": "^3.3.2",
74
+ "packemon": "^3.2.1",
75
+ "prettier": "^3.0.3",
76
+ "prettier-config-moon": "^1.1.2",
77
+ "tsconfig-moon": "^1.3.0",
78
+ "tslib": "^2.6.2",
79
+ "tsx": "^3.13.0",
80
+ "typescript": "^5.2.2"
81
+ },
82
+ "engines": {
83
+ "node": ">=16.12.0"
84
+ },
85
+ "publishConfig": {
86
+ "tag": "latest"
87
+ },
88
+ "exports": {
89
+ ".": {
90
+ "node": {
91
+ "import": "./index-wrapper.mjs",
92
+ "types": "./index.d.ts",
93
+ "require": "./index.cjs"
94
+ }
95
+ }
96
+ },
97
+ "types": "./cjs/index.d.ts",
98
+ "commitlint": {
99
+ "extends": [
100
+ "@commitlint/config-conventional"
101
+ ]
102
+ },
103
+ "packemon": {
104
+ "format": "cjs",
105
+ "platform": "node"
106
+ }
107
+ }
package/src/index.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import jsYaml from "js-yaml";
5
+ import type { Options } from "semantic-release";
6
+
7
+ function findStaticConfig(): string {
8
+ const glob = "static/.releaserc.yml";
9
+ let dirPath = fileURLToPath(path.dirname(import.meta.url));
10
+ let combinedPath = path.join(dirPath, glob);
11
+
12
+ while (!existsSync(combinedPath)) {
13
+ /* file:// + dirname behavior on Windows. 'root' is empty when 'file://' is present.
14
+ * file:///C:/Repos
15
+ * file:///C:
16
+ * file://
17
+ * .
18
+ */
19
+ // DEBUG.log(dirPath);
20
+ // DEBUG.log(combinedPath.href);
21
+ /** Throw if we reached root. */
22
+ if (path.dirname(dirPath) === "")
23
+ throw new Error(
24
+ `Failed to get full path for HCE.Shared's shared configuration. HCE.Shared recursively searched parent directories for '${glob}' starting from '${path.dirname(
25
+ import.meta.url,
26
+ )}'`,
27
+ );
28
+ dirPath = path.dirname(dirPath);
29
+ combinedPath = path.join(dirPath, glob);
30
+ }
31
+ return combinedPath;
32
+ }
33
+
34
+ const options = jsYaml.load(readFileSync(findStaticConfig(), { encoding: "utf8" })) as Options;
35
+
36
+ /**
37
+ * Runs HCE.Shared and returns a semantic-release "shareable configuration" object.
38
+ * @type {Options}.
39
+ */
40
+ export default options;
@@ -0,0 +1,31 @@
1
+ # footer contains links e.g. 3rd-party plugins, little-known features
2
+
3
+ ### global vars
4
+ # https://semantic-release.gitbook.io/semantic-release/v/beta/usage/plugins#plugin-options-configuration
5
+ preset: conventionalcommits
6
+
7
+ ###
8
+
9
+ branches: # https://semantic-release.gitbook.io/semantic-release/v/beta/usage/configuration#branches
10
+ - main
11
+ - name: develop
12
+ channel: develop
13
+ prerelease: true
14
+
15
+ plugins: # https://semantic-release.gitbook.io/semantic-release/v/beta/usage/configuration#plugins
16
+ - "@semantic-release/commit-analyzer"
17
+ - "@semantic-release/release-notes-generator"
18
+ - "@semantic-release/changelog"
19
+ - - "@semantic-release/git"
20
+ - assets:
21
+ - README.md
22
+ - CHANGELOG.md
23
+ - - "@semantic-release/github"
24
+ - assets:
25
+ - path: ./publish/*.zip
26
+ ## (OPTIONAL) export data
27
+ # https://github.com/felipecrs/semantic-release-export-data#readme
28
+
29
+ ## (OPTIONAL) update Version strings
30
+ # https://github.com/jpoehnelt/semantic-release-replace-plugin
31
+ # https://github.com/droidsolutions/semantic-release-update-file