@halospv3/hce.shared-config 2.5.0 → 2.6.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 +7 -0
- package/cjs/dotnet/createDummyNupkg.cjs +26 -0
- package/cjs/dotnet/createDummyNupkg.cjs.map +1 -0
- package/cjs/dotnet/createDummyNupkg.d.ts +2 -0
- package/cjs/dotnet/createDummyNupkg.d.ts.map +1 -0
- package/cjs/dotnet/dotnetGHPR.cjs +53 -23
- package/cjs/dotnet/dotnetGHPR.cjs.map +1 -1
- package/cjs/dotnet/dotnetGHPR.d.ts +2 -3
- package/cjs/dotnet/dotnetGHPR.d.ts.map +1 -1
- package/cjs/dotnet/dotnetGLPR.cjs +5 -5
- package/cjs/dotnet/dotnetGLPR.cjs.map +1 -1
- package/cjs/dotnet/dotnetGLPR.d.ts.map +1 -1
- package/cjs/dotnet/dotnetHelpers.cjs +4 -4
- package/cjs/dotnet/dotnetHelpers.cjs.map +1 -1
- package/cjs/dotnet/dotnetHelpers.d.ts.map +1 -1
- package/cjs/dotnet-wrapper.mjs +1 -1
- package/cjs/dotnet.cjs +6 -4
- package/cjs/dotnet.cjs.map +1 -1
- package/cjs/dotnet.d.ts +3 -2
- package/cjs/dotnet.d.ts.map +1 -1
- package/cjs/envUtils-wrapper.mjs +6 -0
- package/cjs/envUtils.cjs +37 -0
- package/cjs/envUtils.cjs.map +1 -0
- package/cjs/envUtils.d.ts +16 -0
- package/cjs/envUtils.d.ts.map +1 -0
- package/cjs/eslintConfig.cjs +3 -3
- package/cjs/eslintConfig.d.ts.map +1 -1
- package/cjs/semanticReleaseConfig.d.ts.map +1 -1
- package/cjs/semanticReleaseConfigDotnet.cjs +5 -5
- package/cjs/semanticReleaseConfigDotnet.cjs.map +1 -1
- package/cjs/semanticReleaseConfigDotnet.d.ts.map +1 -1
- package/cjs/setupGitPluginSpec.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/dotnet/createDummyNupkg.ts +30 -0
- package/src/dotnet/dotnetGHPR.ts +59 -30
- package/src/dotnet/dotnetGLPR.ts +3 -3
- package/src/dotnet/dotnetHelpers.ts +4 -5
- package/src/dotnet.ts +3 -2
- package/src/envUtils.ts +36 -0
- package/src/eslintConfig.ts +3 -3
- package/src/index.ts +1 -1
- package/src/semantic-release__git.d.ts +1 -1
- package/src/semanticReleaseConfig.ts +2 -2
- package/src/semanticReleaseConfigDotnet.ts +5 -5
- package/src/setupGitPluginSpec.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [2.6.0](https://github.com/halospv3/hce.shared/compare/v2.5.0...v2.6.0) (2024-06-07)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* add createDummyNupkg ([ed67d06](https://github.com/halospv3/hce.shared/commit/ed67d06cd06e56a78b0a9ff2e51efb83ddd94386)), closes [#406](https://github.com/halospv3/hce.shared/issues/406)
|
|
6
|
+
* add EnvUtils (getEnvVarValue, getEnv) ([f86562a](https://github.com/halospv3/hce.shared/commit/f86562aa1c19a13a612e6571ba2122bf134ba196))
|
|
7
|
+
|
|
1
8
|
## [2.5.0](https://github.com/halospv3/hce.shared/compare/v2.4.3...v2.5.0) (2024-06-04)
|
|
2
9
|
|
|
3
10
|
### Features
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const node_child_process = require('node:child_process');
|
|
4
|
+
const node_fs = require('node:fs');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
const tmp = require('tmp');
|
|
7
|
+
function createDummyNupkg() {
|
|
8
|
+
const dirResult = tmp.dirSync({
|
|
9
|
+
unsafeCleanup: true
|
|
10
|
+
});
|
|
11
|
+
const dummyPkgFullPath = path.join(dirResult.name, 'DUMMY.1.0.0.nupkg');
|
|
12
|
+
|
|
13
|
+
// delete old and possibly-poisoned nupkg
|
|
14
|
+
if (node_fs.existsSync(dummyPkgFullPath)) node_fs.unlinkSync(dummyPkgFullPath);
|
|
15
|
+
const options = {
|
|
16
|
+
cwd: dirResult.name,
|
|
17
|
+
encoding: 'utf8'
|
|
18
|
+
};
|
|
19
|
+
node_child_process.execSync('dotnet new console --name DUMMY', options);
|
|
20
|
+
const packOut = node_child_process.execSync(`dotnet pack DUMMY --configuration Release --output ${path.dirname(dummyPkgFullPath)}`, options);
|
|
21
|
+
const createdLine = packOut.replace('\r', '').split('\n').find(line => line.includes('Successfully created package'))?.trim();
|
|
22
|
+
if (!node_fs.existsSync(dummyPkgFullPath)) throw new Error(`The dummy nupkg was created, but could not be found at ${dummyPkgFullPath}. See '${createdLine}'.`);
|
|
23
|
+
return dummyPkgFullPath;
|
|
24
|
+
}
|
|
25
|
+
exports.createDummyNupkg = createDummyNupkg;
|
|
26
|
+
//# sourceMappingURL=createDummyNupkg.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDummyNupkg.cjs","sources":["../../src/dotnet/createDummyNupkg.ts"],"sourcesContent":null,"names":["dirSync","join","existsSync","unlinkSync","execSync","dirname"],"mappings":";;;;;;;AAIO,SAAS,gBAAgB,GAAG;AACnC,EAAE,MAAM,SAAS,GAAGA,WAAO,CAAC;AAC5B,IAAI,aAAa,EAAE,IAAI;AACvB,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,gBAAgB,GAAGC,SAAI,CAAC,SAAS,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;AACrE;AACA;AACA,EAAE,IAAIC,kBAAU,CAAC,gBAAgB,CAAC,EAAEC,kBAAU,CAAC,gBAAgB,CAAC,CAAC;AACjE,EAAE,MAAM,OAAO,GAAG;AAClB,IAAI,GAAG,EAAE,SAAS,CAAC,IAAI;AACvB,IAAI,QAAQ,EAAE,MAAM;AACpB,GAAG,CAAC;AACJ,EAAEC,2BAAQ,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;AACvD,EAAE,MAAM,OAAO,GAAGA,2BAAQ,CAAC,CAAC,mDAAmD,EAAEC,YAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACvH,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;AAChI,EAAE,IAAI,CAACH,kBAAU,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,KAAK,CAAC,CAAC,uDAAuD,EAAE,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1J,EAAE,OAAO,gBAAgB,CAAC;AAC1B;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDummyNupkg.d.ts","sourceRoot":"","sources":["../../src/dotnet/createDummyNupkg.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,IAAI,MAAM,CAwBzC"}
|
|
@@ -1,50 +1,74 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const strict = require('node:assert/strict');
|
|
4
|
-
const
|
|
4
|
+
const node_child_process = require('node:child_process');
|
|
5
|
+
const node_util = require('node:util');
|
|
6
|
+
const envUtils = require('../envUtils.cjs');
|
|
7
|
+
const createDummyNupkg = require('./createDummyNupkg.cjs');
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
|
-
* @todo support custom base URL for private GitHub instances
|
|
8
10
|
* @param tokenEnvVar The name of the environment variable containing the NUGET token
|
|
9
|
-
* @returns `true` if the token
|
|
11
|
+
* @returns `true` if the token can be used to push nupkg to the given Nuget registry
|
|
10
12
|
* @throws
|
|
11
13
|
* - TypeError: The environment variable ${tokenEnvVar} is undefined!
|
|
12
14
|
* - Error:
|
|
13
15
|
* - The value of the token in ${tokenEnvVar} begins with 'github_pat_' which means it's a Fine-Grained token. At the time of writing, GitHub Fine-Grained tokens cannot push packages. If you believe this is statement is outdated, report the issue at https://github.com/halospv3/hce.shared/issues/new. For more information, see https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry.
|
|
14
16
|
* - The GitHub API response header lacked "x-oauth-scopes". This indicates the token we provided is not a workflow token nor a Personal Access Token (classic) and can never have permission to push packages.
|
|
15
17
|
*/
|
|
16
|
-
async function tokenCanWritePackages(tokenEnvVar) {
|
|
18
|
+
async function tokenCanWritePackages(tokenEnvVar, url) {
|
|
17
19
|
/* double-check the token exists */
|
|
18
20
|
const info = isTokenDefined(tokenEnvVar);
|
|
19
21
|
strict.ok(info.isDefined);
|
|
22
|
+
if (url === undefined) {
|
|
23
|
+
console.debug(`tokenCanWritePackages was called without a NuGet Source URL. Defaulting to use ${`${nugetGitHubUrlBase}/\${GITHUB_REPOSITORY_OWNER}/index.json`} where GITHUB_REPOSITORY_OWNER is '${getOwner()}'`);
|
|
24
|
+
url = getNugetGitHubUrl();
|
|
25
|
+
}
|
|
26
|
+
strict.notDeepStrictEqual(url, undefined);
|
|
27
|
+
strict.notDeepStrictEqual(url, '');
|
|
20
28
|
if (info.fallback) tokenEnvVar = info.fallback;
|
|
21
|
-
const tokenValue =
|
|
29
|
+
const tokenValue = envUtils.getEnvVarValue(tokenEnvVar);
|
|
22
30
|
if (tokenValue === undefined) throw new TypeError(`The environment variable ${tokenEnvVar} is undefined!`);
|
|
23
31
|
if (tokenValue.startsWith('github_pat_')) throw new Error(`The value of the token in ${tokenEnvVar} begins with 'github_pat_' which means it's a Fine-Grained token. At the time of writing, GitHub Fine-Grained tokens cannot push packages. If you believe this is statement is outdated, report the issue at https://github.com/halospv3/hce.shared/issues/new. For more information, see https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry.`);
|
|
32
|
+
const dummyNupkgPath = createDummyNupkg.createDummyNupkg();
|
|
33
|
+
const promiseExec = node_util.promisify(node_child_process.exec);
|
|
34
|
+
try {
|
|
35
|
+
const pushResult = await promiseExec(`dotnet nuget push ${dummyNupkgPath} --source ${url} --api-key ${tokenValue} --skip-duplicate`, {
|
|
36
|
+
encoding: 'utf8'
|
|
37
|
+
});
|
|
38
|
+
const errNewline = pushResult.stderr.includes('\r\n') ? '\r\n' : pushResult.stdout.includes('\r') ? '\r' : '\n';
|
|
24
39
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
// if any *lines* start with "error: " or "Error: ", log stderr
|
|
41
|
+
const errorCount = pushResult.stderr.split(errNewline ?? '\n').filter(line => line.trim().startsWith('error: ') || line.trim().startsWith('Error: ')).length;
|
|
42
|
+
if (errorCount > 0) console.error(pushResult.stderr);
|
|
43
|
+
|
|
44
|
+
// if any lines start with "warn : ", log stdout
|
|
45
|
+
const warningCount = pushResult.stdout.split(errNewline ?? '\n').filter(line => line.trim().startsWith('warn : ')).length;
|
|
46
|
+
if (warningCount > 0) console.warn(pushResult.stdout);
|
|
47
|
+
const hasAuthError = pushResult.stderr.includes('401 (Unauthorized)');
|
|
48
|
+
|
|
49
|
+
// return true is no lines contain error indicators.
|
|
50
|
+
return errorCount === 0 && hasAuthError === false;
|
|
51
|
+
} catch (err) {
|
|
52
|
+
const stdout = err.stdout ?? '';
|
|
53
|
+
console.error(err.stack + '\n' + stdout.split('Usage: dotnet nuget push')[0]);
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
35
56
|
}
|
|
36
57
|
|
|
37
|
-
/** returns the value of
|
|
58
|
+
/** returns the value of GITHUB_REPOSITORY_OWNER */
|
|
38
59
|
function getOwner() {
|
|
39
|
-
return
|
|
60
|
+
return envUtils.getEnvVarValue('GITHUB_REPOSITORY_OWNER');
|
|
40
61
|
}
|
|
41
62
|
const nugetGitHubUrlBase = 'https://nuget.pkg.github.com';
|
|
42
63
|
|
|
43
64
|
/** @deprecated use {@link getNugetGitHubUrl()} instead. */
|
|
44
65
|
const nugetGitHubUrl = getNugetGitHubUrl();
|
|
66
|
+
|
|
67
|
+
// todo!: refactor to "return string else throw"
|
|
45
68
|
function getNugetGitHubUrl() {
|
|
46
69
|
const owner = getOwner();
|
|
47
70
|
if (owner) return `${nugetGitHubUrlBase}/${owner}/index.json`;
|
|
71
|
+
console.warn('GITHUB_REPOSITORY_OWNER is undefined! Default NuGet source for GitHub is unavailable.');
|
|
48
72
|
return undefined;
|
|
49
73
|
}
|
|
50
74
|
|
|
@@ -56,12 +80,18 @@ function getNugetGitHubUrl() {
|
|
|
56
80
|
* @returns `{isDefined: true}` if the token is defined. Else, if tokenEnvVar is 'GITHUB_TOKEN' (default) and token is defined, returns `true`. Else, if 'GH_TOKEN' is defined, returns `true`. Else, returns `false`
|
|
57
81
|
*/
|
|
58
82
|
function isTokenDefined(tokenEnvVar = 'GITHUB_TOKEN') {
|
|
83
|
+
let token = envUtils.getEnvVarValue(tokenEnvVar /* custom or GITHUB_TOKEN */);
|
|
59
84
|
if (tokenEnvVar !== 'GITHUB_TOKEN') return {
|
|
60
|
-
isDefined:
|
|
61
|
-
};
|
|
85
|
+
isDefined: token !== undefined && token !== 'undefined'
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/* GITHUB_TOKEN */
|
|
89
|
+
if (token !== undefined && token !== 'undefined') return {
|
|
62
90
|
isDefined: true
|
|
63
|
-
};
|
|
64
|
-
|
|
91
|
+
};
|
|
92
|
+
token = envUtils.getEnvVarValue('GH_TOKEN');
|
|
93
|
+
return {
|
|
94
|
+
isDefined: token !== undefined && token !== 'undefined',
|
|
65
95
|
fallback: 'GH_TOKEN'
|
|
66
96
|
};
|
|
67
97
|
}
|
|
@@ -85,7 +115,7 @@ async function getGithubNugetRegistryPair(tokenEnvVar = 'GITHUB_TOKEN', url = ge
|
|
|
85
115
|
if (_isTokenDefinedInfo.isDefined) {
|
|
86
116
|
if (_isTokenDefinedInfo.fallback) tokenEnvVar = _isTokenDefinedInfo.fallback;
|
|
87
117
|
try {
|
|
88
|
-
canTokenWritePackages = await tokenCanWritePackages(tokenEnvVar);
|
|
118
|
+
canTokenWritePackages = await tokenCanWritePackages(tokenEnvVar, url);
|
|
89
119
|
} catch (err) {
|
|
90
120
|
if (err instanceof Error) errors.push(err);else errors.push(new Error(String(err)));
|
|
91
121
|
}
|
|
@@ -105,7 +135,7 @@ async function getGithubNugetRegistryPair(tokenEnvVar = 'GITHUB_TOKEN', url = ge
|
|
|
105
135
|
url
|
|
106
136
|
};
|
|
107
137
|
const aggErr = new Error(`One more more errors occurred when getting GHPR url-token pair. Errors:\n${errors.map(v => v.stack).join('\n')}`);
|
|
108
|
-
if (
|
|
138
|
+
if (envUtils.getEnvVarValue('SKIP_TOKEN') === 'true' && aggErr.message.length > 0) {
|
|
109
139
|
console.error('WARN: errors were thrown, but SKIP_TOKEN is defined.\n' + aggErr.stack);
|
|
110
140
|
return undefined;
|
|
111
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnetGHPR.cjs","sources":["../../src/dotnet/dotnetGHPR.ts"],"sourcesContent":null,"names":["ok","
|
|
1
|
+
{"version":3,"file":"dotnetGHPR.cjs","sources":["../../src/dotnet/dotnetGHPR.ts"],"sourcesContent":null,"names":["ok","notDeepStrictEqual","getEnvVarValue","createDummyNupkg","promisify","exec"],"mappings":";;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,qBAAqB,CAAC,WAAW,EAAE,GAAG,EAAE;AAC9D;AACA,EAAE,MAAM,IAAI,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;AAC3C,EAAEA,SAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACrB,EAAE,IAAI,GAAG,KAAK,SAAS,EAAE;AACzB,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,+EAA+E,EAAE,CAAC,EAAE,kBAAkB,CAAC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GAAG;AACP,GAAG,CAAC;AACJ,EAAE,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,yEAAyE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9I,EAAE,IAAIA,uBAAc,CAAC,YAAY,CAAC,KAAK,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5E,IAAI,OAAO,CAAC,KAAK,CAAC,wDAAwD,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3F,IAAI,OAAO,SAAS,CAAC;AACrB,GAAG;AACH,EAAE,MAAM,MAAM,CAAC;AACf;;;;;;;;;"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { NuGetRegistryInfo } from './dotnetHelpers.js';
|
|
2
2
|
/**
|
|
3
|
-
* @todo support custom base URL for private GitHub instances
|
|
4
3
|
* @param tokenEnvVar The name of the environment variable containing the NUGET token
|
|
5
|
-
* @returns `true` if the token
|
|
4
|
+
* @returns `true` if the token can be used to push nupkg to the given Nuget registry
|
|
6
5
|
* @throws
|
|
7
6
|
* - TypeError: The environment variable ${tokenEnvVar} is undefined!
|
|
8
7
|
* - Error:
|
|
9
8
|
* - The value of the token in ${tokenEnvVar} begins with 'github_pat_' which means it's a Fine-Grained token. At the time of writing, GitHub Fine-Grained tokens cannot push packages. If you believe this is statement is outdated, report the issue at https://github.com/halospv3/hce.shared/issues/new. For more information, see https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry.
|
|
10
9
|
* - The GitHub API response header lacked "x-oauth-scopes". This indicates the token we provided is not a workflow token nor a Personal Access Token (classic) and can never have permission to push packages.
|
|
11
10
|
*/
|
|
12
|
-
export declare function tokenCanWritePackages(tokenEnvVar: string): Promise<boolean>;
|
|
11
|
+
export declare function tokenCanWritePackages(tokenEnvVar: string, url?: string): Promise<boolean>;
|
|
13
12
|
export declare const nugetGitHubUrlBase = "https://nuget.pkg.github.com";
|
|
14
13
|
/** @deprecated use {@link getNugetGitHubUrl()} instead. */
|
|
15
14
|
export declare const nugetGitHubUrl: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnetGHPR.d.ts","sourceRoot":"","sources":["../../src/dotnet/dotnetGHPR.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dotnetGHPR.d.ts","sourceRoot":"","sources":["../../src/dotnet/dotnetGHPR.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,oBAkD5E;AAOD,eAAO,MAAM,kBAAkB,iCAAiC,CAAC;AAEjE,2DAA2D;AAC3D,eAAO,MAAM,cAAc,EAAE,MAAM,GAAG,SAA+B,CAAC;AAGtE,wBAAgB,iBAAiB,uBAMhC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,WAAW,SAAiB,GAAG;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAetG;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC/C,WAAW,GAAE,MAAM,GAAG,cAAc,GAAG,UAA2B,EAClE,GAAG,GAAE,MAAM,GAAG,SAA+B,GAC3C,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAuDxC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
CI_API_V4_URL =
|
|
6
|
-
CI_PROJECT_ID =
|
|
3
|
+
const envUtils = require('../envUtils.cjs');
|
|
4
|
+
const _envUtils$getEnv = envUtils.getEnv(),
|
|
5
|
+
CI_API_V4_URL = _envUtils$getEnv.CI_API_V4_URL,
|
|
6
|
+
CI_PROJECT_ID = _envUtils$getEnv.CI_PROJECT_ID;
|
|
7
7
|
const nameof = {
|
|
8
8
|
CI_API_V4_URL: 'CI_API_V4_URL',
|
|
9
9
|
CI_PROJECT_ID: 'CI_PROJECT_ID'
|
|
@@ -21,7 +21,7 @@ const nugetGitLabUrl = CI_API_V4_URL && CI_PROJECT_ID ? `${CI_API_V4_URL}/projec
|
|
|
21
21
|
*/
|
|
22
22
|
function getGitlabNugetRegistryPair(tokenEnvVar = GitLabTokenEnvVar, url = nugetGitLabUrl) {
|
|
23
23
|
// yes, this is stupid. No, I won't change it.
|
|
24
|
-
if (!
|
|
24
|
+
if (!envUtils.getEnvVarValue(tokenEnvVar)) {
|
|
25
25
|
console.error(new Error(`The environment variable ${tokenEnvVar} was specified as the source of the token to push a NuGet package to GitLab, but the environment variable does not exist.`));
|
|
26
26
|
return undefined;
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnetGLPR.cjs","sources":["../../src/dotnet/dotnetGLPR.ts"],"sourcesContent":null,"names":["
|
|
1
|
+
{"version":3,"file":"dotnetGLPR.cjs","sources":["../../src/dotnet/dotnetGLPR.ts"],"sourcesContent":null,"names":["getEnv","getEnvVarValue"],"mappings":";;;;AACA,MAAM;AACN,EAAE,aAAa;AACf,EAAE,aAAa;AACf,CAAC,GAAGA,eAAM,EAAE,CAAC;AACb,MAAM,MAAM,GAAG;AACf,EAAE,aAAa,EAAE,eAAe;AAChC,EAAE,aAAa,EAAE,eAAe;AAChC,CAAC,CAAC;AACU,MAAC,iBAAiB,GAAG,eAAe;AACpC,MAAC,kBAAkB,GAAG,cAAc;AACpC,MAAC,cAAc,GAAG,aAAa,IAAI,aAAa,GAAG,CAAC,EAAE,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC,0BAA0B,CAAC,GAAG,UAAU;AAClJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,WAAW,GAAG,iBAAiB,EAAE,GAAG,GAAG,cAAc,EAAE;AAClG;AACA,EAAE,IAAI,CAACC,uBAAc,CAAC,WAAW,CAAC,EAAE;AACpC,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,yBAAyB,EAAE,WAAW,CAAC,yHAAyH,CAAC,CAAC,CAAC,CAAC;AACjM,IAAI,OAAO,SAAS,CAAC;AACrB,GAAG;AACH,EAAE,IAAI,GAAG,EAAE;AACX,IAAI,OAAO;AACX,MAAM,WAAW;AACjB,MAAM,GAAG;AACT,KAAK,CAAC;AACN,GAAG;AACH,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,0BAA0B,EAAE,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC,+EAA+E,CAAC,CAAC,CAAC,CAAC;AAC1L,EAAE,OAAO,SAAS,CAAC;AACnB;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnetGLPR.d.ts","sourceRoot":"","sources":["../../src/dotnet/dotnetGLPR.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dotnetGLPR.d.ts","sourceRoot":"","sources":["../../src/dotnet/dotnetGLPR.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAQ5D,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAChD,eAAO,MAAM,kBAAkB,oBAAgB,CAAC;AAChD,eAAO,MAAM,cAAc,EAAE,MAAM,GAAG,SAGzB,CAAC;AAEd;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,GAAE,MAA0B,EACvC,GAAG,GAAE,MAAM,GAAG,SAA0B,GACtC,iBAAiB,GAAG,SAAS,CAmB/B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const strict = require('node:assert/strict');
|
|
4
|
+
const envUtils = require('../envUtils.cjs');
|
|
5
|
+
const MSBuildProject = require('./MSBuildProject.cjs');
|
|
4
6
|
const dotnetGHPR = require('./dotnetGHPR.cjs');
|
|
5
7
|
const dotnetGLPR = require('./dotnetGLPR.cjs');
|
|
6
|
-
const MSBuildProject = require('./MSBuildProject.cjs');
|
|
7
|
-
const node_process = require('node:process');
|
|
8
8
|
function formatDotnetPublish(projectsToPublish, publishProperties) {
|
|
9
9
|
/* Fun Fact: You can define a property and get the evaluated value in the same command!
|
|
10
10
|
```pwsh
|
|
@@ -130,8 +130,8 @@ async function configureDotnetNugetPush(nupkgDir = './publish', registries = [nu
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
return registries.map(registry => {
|
|
133
|
-
const tokenValue =
|
|
134
|
-
strict.ok(
|
|
133
|
+
const tokenValue = envUtils.getEnvVarValue(registry.tokenEnvVar);
|
|
134
|
+
strict.ok(envUtils.getEnvVarValue('SKIP_TOKEN') === 'true' || tokenValue, `The environment variable ${registry.tokenEnvVar} is undefined!`);
|
|
135
135
|
`dotnet nuget push ${nupkgDir} --source ${registry.url} --token ${tokenValue ?? '**placeholder**'}`;
|
|
136
136
|
}).join(' && ');
|
|
137
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnetHelpers.cjs","sources":["../../src/dotnet/dotnetHelpers.ts"],"sourcesContent":null,"names":["MSBuildProject","MSBuildProjectPreDefinedProperties","nugetGitHubUrlBase","getGithubNugetRegistryPair","getGitlabNugetRegistryPair","
|
|
1
|
+
{"version":3,"file":"dotnetHelpers.cjs","sources":["../../src/dotnet/dotnetHelpers.ts"],"sourcesContent":null,"names":["MSBuildProject","MSBuildProjectPreDefinedProperties","nugetGitHubUrlBase","getGithubNugetRegistryPair","getGitlabNugetRegistryPair","getEnvVarValue","ok"],"mappings":";;;;;;;;AAKA,SAAS,mBAAmB,CAAC,iBAAiB,EAAE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Q,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,IAAI,iBAAiB,CAAC,CAAC,CAAC;AACxG,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnetHelpers.d.ts","sourceRoot":"","sources":["../../src/dotnet/dotnetHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dotnetHelpers.d.ts","sourceRoot":"","sources":["../../src/dotnet/dotnetHelpers.ts"],"names":[],"mappings":"AA8GA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAClC,iBAAiB,EAAE,MAAM,EAAE,EAC3B,qBAAqB,EAAE,MAAM,EAAE,GAAG,KAAK,EACvC,mBAAmB,GAAE,MAAM,EAAkB,UAU7C;AAED,MAAM,WAAW,iBAAiB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AACD,eAAO,MAAM,YAAY,EAAE,iBAG1B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC7C,QAAQ,SAAc,EACtB,UAAU,GAAE,iBAAiB,EAAmB,EAChD,YAAY,UAAO,mBA4BnB"}
|
package/cjs/dotnet-wrapper.mjs
CHANGED
package/cjs/dotnet.cjs
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const MSBuildProject = require('./dotnet/MSBuildProject.cjs');
|
|
4
|
+
const MSBuildProjectProperties = require('./dotnet/MSBuildProjectProperties.cjs');
|
|
5
|
+
const createDummyNupkg$1 = require('./dotnet/createDummyNupkg.cjs');
|
|
3
6
|
const dotnetGHPR$1 = require('./dotnet/dotnetGHPR.cjs');
|
|
4
7
|
const dotnetGLPR$1 = require('./dotnet/dotnetGLPR.cjs');
|
|
5
8
|
const dotnetHelpers$1 = require('./dotnet/dotnetHelpers.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
exports.msbuildProject = MSBuildProject;
|
|
10
|
+
exports.msbuildProjectProperties = MSBuildProjectProperties;
|
|
11
|
+
exports.createDummyNupkg = createDummyNupkg$1;
|
|
8
12
|
exports.dotnetGHPR = dotnetGHPR$1;
|
|
9
13
|
exports.dotnetGLPR = dotnetGLPR$1;
|
|
10
14
|
exports.dotnetHelpers = dotnetHelpers$1;
|
|
11
|
-
exports.msbuildProject = MSBuildProject;
|
|
12
|
-
exports.msbuildProjectProperties = MSBuildProjectProperties;
|
|
13
15
|
//# sourceMappingURL=dotnet.cjs.map
|
package/cjs/dotnet.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnet.cjs","sources":[],"sourcesContent":null,"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dotnet.cjs","sources":[],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
package/cjs/dotnet.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export * as msbuildProject from "./dotnet/MSBuildProject.js";
|
|
2
|
+
export * as msbuildProjectProperties from "./dotnet/MSBuildProjectProperties.js";
|
|
3
|
+
export * as createDummyNupkg from './dotnet/createDummyNupkg.js';
|
|
1
4
|
export * as dotnetGHPR from "./dotnet/dotnetGHPR.js";
|
|
2
5
|
export * as dotnetGLPR from "./dotnet/dotnetGLPR.js";
|
|
3
6
|
export * as dotnetHelpers from "./dotnet/dotnetHelpers.js";
|
|
4
|
-
export * as msbuildProject from "./dotnet/MSBuildProject.js";
|
|
5
|
-
export * as msbuildProjectProperties from "./dotnet/MSBuildProjectProperties.js";
|
|
6
7
|
//# sourceMappingURL=dotnet.d.ts.map
|
package/cjs/dotnet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnet.d.ts","sourceRoot":"","sources":["../src/dotnet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"dotnet.d.ts","sourceRoot":"","sources":["../src/dotnet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAA;AAC5D,OAAO,KAAK,wBAAwB,MAAM,sCAAsC,CAAA;AAChF,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAA"}
|
package/cjs/envUtils.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const dotenv = require('dotenv');
|
|
4
|
+
const node_process = require('node:process');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Load a .env file from the CWD with the given options (or defaults), returns the new value of process.env
|
|
8
|
+
* @param dotenvOptions
|
|
9
|
+
* @param overrides
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
function getEnv(dotenvOptions, overrides) {
|
|
13
|
+
dotenv.config(dotenvOptions);
|
|
14
|
+
if (overrides) Object.assign(node_process.env, overrides);
|
|
15
|
+
return node_process.env;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Get the value from the given env var. If undefined, load .env from CWD and try again or return undefined.
|
|
20
|
+
* @param envVar
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
function getEnvVarValue(envVar) {
|
|
24
|
+
let value = node_process.env[envVar];
|
|
25
|
+
if (!value) {
|
|
26
|
+
try {
|
|
27
|
+
dotenv.config();
|
|
28
|
+
} catch (err) {
|
|
29
|
+
console.error(String(err));
|
|
30
|
+
}
|
|
31
|
+
value = node_process.env[envVar];
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
exports.getEnv = getEnv;
|
|
36
|
+
exports.getEnvVarValue = getEnvVarValue;
|
|
37
|
+
//# sourceMappingURL=envUtils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envUtils.cjs","sources":["../src/envUtils.ts"],"sourcesContent":null,"names":["loadDotenv","env"],"mappings":";;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,MAAM,CAAC,aAAa,EAAE,SAAS,EAAE;AACjD,EAAEA,aAAU,CAAC,aAAa,CAAC,CAAC;AAC5B,EAAE,IAAI,SAAS,EAAE,MAAM,CAAC,MAAM,CAACC,gBAAG,EAAE,SAAS,CAAC,CAAC;AAC/C,EAAE,OAAOA,gBAAG,CAAC;AACb,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,MAAM,EAAE;AACvC,EAAE,IAAI,KAAK,GAAGA,gBAAG,CAAC,MAAM,CAAC,CAAC;AAC1B,EAAE,IAAI,CAAC,KAAK,EAAE;AACd,IAAI,IAAI;AACR,MAAMD,aAAU,EAAE,CAAC;AACnB,KAAK,CAAC,OAAO,GAAG,EAAE;AAClB,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,KAAK;AACL,IAAI,KAAK,GAAGC,gBAAG,CAAC,MAAM,CAAC,CAAC;AACxB,GAAG;AACH,EAAE,OAAO,KAAK,CAAC;AACf;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { type DotenvConfigOptions } from "dotenv";
|
|
3
|
+
/**
|
|
4
|
+
* Load a .env file from the CWD with the given options (or defaults), returns the new value of process.env
|
|
5
|
+
* @param dotenvOptions
|
|
6
|
+
* @param overrides
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function getEnv(dotenvOptions?: DotenvConfigOptions, overrides?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
10
|
+
/**
|
|
11
|
+
* Get the value from the given env var. If undefined, load .env from CWD and try again or return undefined.
|
|
12
|
+
* @param envVar
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function getEnvVarValue(envVar: string): string | undefined;
|
|
16
|
+
//# sourceMappingURL=envUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envUtils.d.ts","sourceRoot":"","sources":["../src/envUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAGxE;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,aAAa,CAAC,EAAE,mBAAmB,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAO5G;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYjE"}
|
package/cjs/eslintConfig.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const jsonc = require('eslint-plugin-jsonc');
|
|
4
|
-
const tseslint = require('typescript-eslint');
|
|
5
3
|
const eslint = require('@eslint/js');
|
|
4
|
+
const jsonc = require('eslint-plugin-jsonc');
|
|
6
5
|
const node_module = require('node:module');
|
|
6
|
+
const tseslint = require('typescript-eslint');
|
|
7
7
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
8
|
const _interopDefault = e => e && e.__esModule ? e : {
|
|
9
9
|
default: e
|
|
10
10
|
};
|
|
11
|
+
const eslint__default = /*#__PURE__*/_interopDefault(eslint);
|
|
11
12
|
const jsonc__default = /*#__PURE__*/_interopDefault(jsonc);
|
|
12
13
|
const tseslint__default = /*#__PURE__*/_interopDefault(tseslint);
|
|
13
|
-
const eslint__default = /*#__PURE__*/_interopDefault(eslint);
|
|
14
14
|
|
|
15
15
|
// CJS compatibility; it started transpiling to a top-level await after upgrading from packemon 4.0.1 to 4.1.0
|
|
16
16
|
const require$1 = node_module.createRequire(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.src || new URL('eslintConfig.cjs', document.baseURI).href);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslintConfig.d.ts","sourceRoot":"","sources":["../src/eslintConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eslintConfig.d.ts","sourceRoot":"","sources":["../src/eslintConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;;AA4BzD,wBA2DE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semanticReleaseConfig.d.ts","sourceRoot":"","sources":["../src/semanticReleaseConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"semanticReleaseConfig.d.ts","sourceRoot":"","sources":["../src/semanticReleaseConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG5D,eAAO,MAAM,cAAc,EAAE,SAAS,UAAU,EAK/C,CAAC;AAEF,eAAO,MAAM,UAAU,SAmCX,CAAC"}
|
|
@@ -8,12 +8,12 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', {
|
|
9
9
|
value: true
|
|
10
10
|
});
|
|
11
|
+
const node_util = require('node:util');
|
|
12
|
+
const debug = require('./debug.cjs');
|
|
11
13
|
const dotnetHelpers = require('./dotnet/dotnetHelpers.cjs');
|
|
14
|
+
const envUtils = require('./envUtils.cjs');
|
|
12
15
|
const semanticReleaseConfig = require('./semanticReleaseConfig.cjs');
|
|
13
16
|
const setupGitPluginSpec = require('./setupGitPluginSpec.cjs');
|
|
14
|
-
const debug = require('./debug.cjs');
|
|
15
|
-
const node_util = require('node:util');
|
|
16
|
-
const node_process = require('node:process');
|
|
17
17
|
|
|
18
18
|
/** Semantic-Release Config Factory (dotnet)
|
|
19
19
|
* A functional Semantic-Release configuration for dotnet projects
|
|
@@ -87,11 +87,11 @@ function getConfig(projectsToPublish = [], projectsToPackAndPush = []) {
|
|
|
87
87
|
}
|
|
88
88
|
const errors = [];
|
|
89
89
|
if (projectsToPublish.length === 0) {
|
|
90
|
-
const _ =
|
|
90
|
+
const _ = envUtils.getEnvVarValue("PROJECTS_TO_PUBLISH");
|
|
91
91
|
if (_ === undefined) errors.push(new Error("projectsToPublish.length must be > 0 or PROJECTS_TO_PUBLISH must be defined and contain at least one path."));else projectsToPublish = _.split(';');
|
|
92
92
|
}
|
|
93
93
|
if (projectsToPackAndPush !== false && projectsToPackAndPush.length === 0) {
|
|
94
|
-
const _ =
|
|
94
|
+
const _ = envUtils.getEnvVarValue("PROJECTS_TO_PACK_AND_PUSH");
|
|
95
95
|
if (_ === undefined) errors.push(new Error("projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path."));else projectsToPackAndPush = _.split(';');
|
|
96
96
|
}
|
|
97
97
|
if (errors.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semanticReleaseConfigDotnet.cjs","sources":["../src/semanticReleaseConfigDotnet.ts"],"sourcesContent":null,"names":["defaultPlugins","setupGitPluginSpec","configurePrepareCmd","configureDotnetNugetPush","inspect","baseConfig","
|
|
1
|
+
{"version":3,"file":"semanticReleaseConfigDotnet.cjs","sources":["../src/semanticReleaseConfigDotnet.ts"],"sourcesContent":null,"names":["defaultPlugins","setupGitPluginSpec","configurePrepareCmd","configureDotnetNugetPush","inspect","baseConfig","getEnvVarValue"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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ChB;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semanticReleaseConfigDotnet.d.ts","sourceRoot":"","sources":["../src/semanticReleaseConfigDotnet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"semanticReleaseConfigDotnet.d.ts","sourceRoot":"","sources":["../src/semanticReleaseConfigDotnet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAO5D;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAO7D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,OAAO,EACf,iBAAiB,EAAE,MAAM,EAAE,EAC3B,qBAAqB,EAAE,MAAM,EAAE,GAAG,KAAK,GACrC,OAAO,CAgBT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,iBAAiB,GAAE,MAAM,EAAO,EAAE,qBAAqB,GAAE,MAAM,EAAE,GAAG,KAAU,GAAG,OAAO,CA0CjH;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupGitPluginSpec.d.ts","sourceRoot":"","sources":["../src/setupGitPluginSpec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setupGitPluginSpec.d.ts","sourceRoot":"","sources":["../src/setupGitPluginSpec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,eAAO,MAAM,WAAW,0BAA0B,CAAC;AACnD,sEAAsE;AACtE,eAAO,MAAM,cAAc;;;CAIL,CAAC;AASvB;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CA+CtE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halospv3/hce.shared-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
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
5
|
"keywords": [
|
|
6
6
|
"halo",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"presemantic-release": "npm run pack && npm run check",
|
|
45
45
|
"semantic-release": "npx semantic-release",
|
|
46
46
|
"pretest": "npm run build",
|
|
47
|
-
"test": "
|
|
47
|
+
"test": "tsx --test ./tests/**/*.test.ts",
|
|
48
48
|
"type": "tsc --build",
|
|
49
49
|
"validate": "packemon validate",
|
|
50
50
|
"watch": "packemon watch"
|
|
@@ -137,6 +137,7 @@
|
|
|
137
137
|
"commitlintConfig": "src/commitlintConfig.ts",
|
|
138
138
|
"dotnet": "src/dotnet.ts",
|
|
139
139
|
"eslintConfig": "src/eslintConfig.ts",
|
|
140
|
+
"envUtils": "src/envUtils.ts",
|
|
140
141
|
"findStaticConfig": "src/findStaticConfig.ts",
|
|
141
142
|
"index": "src/index.ts",
|
|
142
143
|
"semanticReleaseConfig": "src/semanticReleaseConfig.ts",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { execSync, type ExecSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
2
|
+
import { existsSync, unlinkSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { dirSync } from 'tmp';
|
|
5
|
+
|
|
6
|
+
export function createDummyNupkg(): string {
|
|
7
|
+
const dirResult = dirSync({ unsafeCleanup: true });
|
|
8
|
+
const dummyPkgFullPath: string = join(dirResult.name, 'DUMMY.1.0.0.nupkg');
|
|
9
|
+
|
|
10
|
+
// delete old and possibly-poisoned nupkg
|
|
11
|
+
if (existsSync(dummyPkgFullPath))
|
|
12
|
+
unlinkSync(dummyPkgFullPath);
|
|
13
|
+
|
|
14
|
+
const options: ExecSyncOptionsWithStringEncoding = {
|
|
15
|
+
cwd: dirResult.name,
|
|
16
|
+
encoding: 'utf8'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
execSync('dotnet new console --name DUMMY', options);
|
|
20
|
+
const packOut = execSync(`dotnet pack DUMMY --configuration Release --output ${dirname(dummyPkgFullPath)}`, options);
|
|
21
|
+
|
|
22
|
+
const createdLine = packOut.replace('\r', '')
|
|
23
|
+
.split('\n')
|
|
24
|
+
.find(line => line.includes('Successfully created package'))?.trim();
|
|
25
|
+
|
|
26
|
+
if (!existsSync(dummyPkgFullPath))
|
|
27
|
+
throw new Error(`The dummy nupkg was created, but could not be found at ${dummyPkgFullPath}. See '${createdLine}'.`);
|
|
28
|
+
|
|
29
|
+
return dummyPkgFullPath;
|
|
30
|
+
}
|
package/src/dotnet/dotnetGHPR.ts
CHANGED
|
@@ -1,49 +1,74 @@
|
|
|
1
|
-
import { ok } from 'node:assert/strict';
|
|
1
|
+
import { notDeepStrictEqual, ok } from 'node:assert/strict';
|
|
2
|
+
import { exec, type ExecException } from 'node:child_process';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { getEnvVarValue } from '../envUtils.js';
|
|
5
|
+
import { createDummyNupkg } from './createDummyNupkg.js';
|
|
2
6
|
import type { NuGetRegistryInfo } from './dotnetHelpers.js';
|
|
3
|
-
import { env } from 'node:process'
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
|
-
* @todo support custom base URL for private GitHub instances
|
|
7
9
|
* @param tokenEnvVar The name of the environment variable containing the NUGET token
|
|
8
|
-
* @returns `true` if the token
|
|
10
|
+
* @returns `true` if the token can be used to push nupkg to the given Nuget registry
|
|
9
11
|
* @throws
|
|
10
12
|
* - TypeError: The environment variable ${tokenEnvVar} is undefined!
|
|
11
13
|
* - Error:
|
|
12
14
|
* - The value of the token in ${tokenEnvVar} begins with 'github_pat_' which means it's a Fine-Grained token. At the time of writing, GitHub Fine-Grained tokens cannot push packages. If you believe this is statement is outdated, report the issue at https://github.com/halospv3/hce.shared/issues/new. For more information, see https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry.
|
|
13
15
|
* - The GitHub API response header lacked "x-oauth-scopes". This indicates the token we provided is not a workflow token nor a Personal Access Token (classic) and can never have permission to push packages.
|
|
14
16
|
*/
|
|
15
|
-
export async function tokenCanWritePackages(tokenEnvVar: string) {
|
|
17
|
+
export async function tokenCanWritePackages(tokenEnvVar: string, url?: string) {
|
|
16
18
|
/* double-check the token exists */
|
|
17
19
|
const info = isTokenDefined(tokenEnvVar);
|
|
18
20
|
ok(info.isDefined)
|
|
19
21
|
|
|
22
|
+
if (url === undefined) {
|
|
23
|
+
console.debug(`tokenCanWritePackages was called without a NuGet Source URL. Defaulting to use ${`${nugetGitHubUrlBase}/\${GITHUB_REPOSITORY_OWNER}/index.json`} where GITHUB_REPOSITORY_OWNER is '${getOwner()}'`)
|
|
24
|
+
url = getNugetGitHubUrl();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
notDeepStrictEqual(url, undefined);
|
|
28
|
+
notDeepStrictEqual(url, '');
|
|
29
|
+
|
|
20
30
|
if (info.fallback)
|
|
21
31
|
tokenEnvVar = info.fallback;
|
|
22
32
|
|
|
23
|
-
const tokenValue =
|
|
33
|
+
const tokenValue = getEnvVarValue(tokenEnvVar);
|
|
24
34
|
if (tokenValue === undefined)
|
|
25
35
|
throw new TypeError(`The environment variable ${tokenEnvVar} is undefined!`)
|
|
26
36
|
|
|
27
37
|
if (tokenValue.startsWith('github_pat_'))
|
|
28
38
|
throw new Error(`The value of the token in ${tokenEnvVar} begins with 'github_pat_' which means it's a Fine-Grained token. At the time of writing, GitHub Fine-Grained tokens cannot push packages. If you believe this is statement is outdated, report the issue at https://github.com/halospv3/hce.shared/issues/new. For more information, see https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry.`)
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
const dummyNupkgPath = createDummyNupkg();
|
|
41
|
+
const promiseExec = promisify(exec);
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
const pushResult = await promiseExec(`dotnet nuget push ${dummyNupkgPath} --source ${url} --api-key ${tokenValue} --skip-duplicate`, { encoding: 'utf8' })
|
|
45
|
+
const errNewline = pushResult.stderr.includes('\r\n') ? '\r\n' : pushResult.stdout.includes('\r') ? '\r' : '\n';
|
|
46
|
+
|
|
47
|
+
// if any *lines* start with "error: " or "Error: ", log stderr
|
|
48
|
+
const errorCount = pushResult.stderr.split(errNewline ?? '\n').filter(line => line.trim().startsWith('error: ') || line.trim().startsWith('Error: ')).length;
|
|
49
|
+
if (errorCount > 0)
|
|
50
|
+
console.error(pushResult.stderr);
|
|
51
|
+
|
|
52
|
+
// if any lines start with "warn : ", log stdout
|
|
53
|
+
const warningCount = pushResult.stdout.split(errNewline ?? '\n').filter(line => line.trim().startsWith('warn : ')).length;
|
|
54
|
+
if (warningCount > 0)
|
|
55
|
+
console.warn(pushResult.stdout);
|
|
40
56
|
|
|
41
|
-
|
|
57
|
+
const hasAuthError = pushResult.stderr.includes('401 (Unauthorized)');
|
|
58
|
+
|
|
59
|
+
// return true is no lines contain error indicators.
|
|
60
|
+
return errorCount === 0 && hasAuthError === false;
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
const stdout = (err as ExecException).stdout ?? '';
|
|
64
|
+
console.error((err as ExecException).stack + '\n' + stdout.split('Usage: dotnet nuget push')[0]);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
42
67
|
}
|
|
43
68
|
|
|
44
|
-
/** returns the value of
|
|
69
|
+
/** returns the value of GITHUB_REPOSITORY_OWNER */
|
|
45
70
|
function getOwner(): string | undefined {
|
|
46
|
-
return
|
|
71
|
+
return getEnvVarValue('GITHUB_REPOSITORY_OWNER')
|
|
47
72
|
}
|
|
48
73
|
|
|
49
74
|
export const nugetGitHubUrlBase = 'https://nuget.pkg.github.com';
|
|
@@ -51,10 +76,12 @@ export const nugetGitHubUrlBase = 'https://nuget.pkg.github.com';
|
|
|
51
76
|
/** @deprecated use {@link getNugetGitHubUrl()} instead. */
|
|
52
77
|
export const nugetGitHubUrl: string | undefined = getNugetGitHubUrl();
|
|
53
78
|
|
|
79
|
+
// todo!: refactor to "return string else throw"
|
|
54
80
|
export function getNugetGitHubUrl() {
|
|
55
81
|
const owner = getOwner();
|
|
56
82
|
if (owner)
|
|
57
83
|
return `${nugetGitHubUrlBase}/${owner}/index.json`;
|
|
84
|
+
console.warn('GITHUB_REPOSITORY_OWNER is undefined! Default NuGet source for GitHub is unavailable.');
|
|
58
85
|
return undefined;
|
|
59
86
|
}
|
|
60
87
|
|
|
@@ -66,16 +93,18 @@ export function getNugetGitHubUrl() {
|
|
|
66
93
|
* @returns `{isDefined: true}` if the token is defined. Else, if tokenEnvVar is 'GITHUB_TOKEN' (default) and token is defined, returns `true`. Else, if 'GH_TOKEN' is defined, returns `true`. Else, returns `false`
|
|
67
94
|
*/
|
|
68
95
|
export function isTokenDefined(tokenEnvVar = 'GITHUB_TOKEN'): { isDefined: boolean, fallback?: string } {
|
|
96
|
+
let token = getEnvVarValue(tokenEnvVar /* custom or GITHUB_TOKEN */);
|
|
97
|
+
|
|
69
98
|
if (tokenEnvVar !== 'GITHUB_TOKEN')
|
|
70
|
-
return {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
isDefined: (
|
|
99
|
+
return { isDefined: (token !== undefined && token !== 'undefined') };
|
|
100
|
+
|
|
101
|
+
/* GITHUB_TOKEN */
|
|
102
|
+
if (token !== undefined && token !== 'undefined')
|
|
103
|
+
return { isDefined: true };
|
|
104
|
+
|
|
105
|
+
token = getEnvVarValue('GH_TOKEN');
|
|
106
|
+
return {
|
|
107
|
+
isDefined: (token !== undefined && token !== 'undefined'),
|
|
79
108
|
fallback: 'GH_TOKEN'
|
|
80
109
|
};
|
|
81
110
|
}
|
|
@@ -111,7 +140,7 @@ export async function getGithubNugetRegistryPair(
|
|
|
111
140
|
if (_isTokenDefinedInfo.fallback)
|
|
112
141
|
tokenEnvVar = _isTokenDefinedInfo.fallback;
|
|
113
142
|
try {
|
|
114
|
-
canTokenWritePackages = await tokenCanWritePackages(tokenEnvVar);
|
|
143
|
+
canTokenWritePackages = await tokenCanWritePackages(tokenEnvVar, url);
|
|
115
144
|
}
|
|
116
145
|
catch (err) {
|
|
117
146
|
if (err instanceof Error)
|
|
@@ -142,7 +171,7 @@ export async function getGithubNugetRegistryPair(
|
|
|
142
171
|
|
|
143
172
|
const aggErr = new Error(`One more more errors occurred when getting GHPR url-token pair. Errors:\n${errors.map(v => v.stack).join('\n')}`);
|
|
144
173
|
|
|
145
|
-
if (
|
|
174
|
+
if (getEnvVarValue('SKIP_TOKEN') === 'true' && aggErr.message.length > 0) {
|
|
146
175
|
console.error('WARN: errors were thrown, but SKIP_TOKEN is defined.\n' + aggErr.stack)
|
|
147
176
|
return undefined;
|
|
148
177
|
}
|
package/src/dotnet/dotnetGLPR.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { getEnv, getEnvVarValue } from '../envUtils.js';
|
|
1
2
|
import type { NuGetRegistryInfo } from './dotnetHelpers.js';
|
|
2
|
-
import { env } from "node:process"
|
|
3
3
|
|
|
4
|
-
const { CI_API_V4_URL, CI_PROJECT_ID } =
|
|
4
|
+
const { CI_API_V4_URL, CI_PROJECT_ID } = getEnv();
|
|
5
5
|
const nameof = {
|
|
6
6
|
CI_API_V4_URL: 'CI_API_V4_URL',
|
|
7
7
|
CI_PROJECT_ID: 'CI_PROJECT_ID',
|
|
@@ -26,7 +26,7 @@ export function getGitlabNugetRegistryPair(
|
|
|
26
26
|
url: string | undefined = nugetGitLabUrl,
|
|
27
27
|
): NuGetRegistryInfo | undefined {
|
|
28
28
|
// yes, this is stupid. No, I won't change it.
|
|
29
|
-
if (!
|
|
29
|
+
if (!getEnvVarValue(tokenEnvVar)) {
|
|
30
30
|
console.error(
|
|
31
31
|
new Error(
|
|
32
32
|
`The environment variable ${tokenEnvVar} was specified as the source of the token to push a NuGet package to GitLab, but the environment variable does not exist.`,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ok } from 'node:assert/strict';
|
|
2
|
+
import { getEnvVarValue } from '../envUtils.js';
|
|
3
|
+
import { MSBuildProject, MSBuildProjectPreDefinedProperties } from './MSBuildProject.js';
|
|
2
4
|
import { getGithubNugetRegistryPair, nugetGitHubUrlBase } from './dotnetGHPR.js';
|
|
3
5
|
import { getGitlabNugetRegistryPair } from './dotnetGLPR.js';
|
|
4
|
-
import { MSBuildProject, MSBuildProjectPreDefinedProperties } from './MSBuildProject.js';
|
|
5
|
-
import { env } from 'node:process';
|
|
6
|
-
|
|
7
6
|
|
|
8
7
|
function formatDotnetPublish(projectsToPublish: string[], publishProperties: string[]): string {
|
|
9
8
|
/* Fun Fact: You can define a property and get the evaluated value in the same command!
|
|
@@ -176,8 +175,8 @@ export async function configureDotnetNugetPush(
|
|
|
176
175
|
return registries
|
|
177
176
|
.map(
|
|
178
177
|
(registry) => {
|
|
179
|
-
const tokenValue =
|
|
180
|
-
ok(
|
|
178
|
+
const tokenValue = getEnvVarValue(registry.tokenEnvVar);
|
|
179
|
+
ok(getEnvVarValue('SKIP_TOKEN') === 'true' || tokenValue, `The environment variable ${registry.tokenEnvVar} is undefined!`);
|
|
181
180
|
`dotnet nuget push ${nupkgDir} --source ${registry.url} --token ${tokenValue ?? '**placeholder**'}`
|
|
182
181
|
}
|
|
183
182
|
)
|
package/src/dotnet.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export * as msbuildProject from "./dotnet/MSBuildProject.js"
|
|
2
|
+
export * as msbuildProjectProperties from "./dotnet/MSBuildProjectProperties.js"
|
|
3
|
+
export * as createDummyNupkg from './dotnet/createDummyNupkg.js'
|
|
1
4
|
export * as dotnetGHPR from "./dotnet/dotnetGHPR.js"
|
|
2
5
|
export * as dotnetGLPR from "./dotnet/dotnetGLPR.js"
|
|
3
6
|
export * as dotnetHelpers from "./dotnet/dotnetHelpers.js"
|
|
4
|
-
export * as msbuildProject from "./dotnet/MSBuildProject.js"
|
|
5
|
-
export * as msbuildProjectProperties from "./dotnet/MSBuildProjectProperties.js"
|
package/src/envUtils.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { config as loadDotenv, type DotenvConfigOptions } from "dotenv";
|
|
2
|
+
import { env } from 'node:process';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Load a .env file from the CWD with the given options (or defaults), returns the new value of process.env
|
|
6
|
+
* @param dotenvOptions
|
|
7
|
+
* @param overrides
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export function getEnv(dotenvOptions?: DotenvConfigOptions, overrides?: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
|
11
|
+
loadDotenv(dotenvOptions);
|
|
12
|
+
|
|
13
|
+
if (overrides)
|
|
14
|
+
Object.assign(env, overrides);
|
|
15
|
+
|
|
16
|
+
return env;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get the value from the given env var. If undefined, load .env from CWD and try again or return undefined.
|
|
21
|
+
* @param envVar
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export function getEnvVarValue(envVar: string): string | undefined {
|
|
25
|
+
let value = env[envVar];
|
|
26
|
+
if (!value) {
|
|
27
|
+
try {
|
|
28
|
+
loadDotenv();
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
console.error(String(err))
|
|
32
|
+
}
|
|
33
|
+
value = env[envVar];
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
}
|
package/src/eslintConfig.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import jsonc from "eslint-plugin-jsonc";
|
|
2
|
-
import tseslint from "typescript-eslint";
|
|
3
|
-
import { type TSESLint } from "@typescript-eslint/utils";
|
|
4
1
|
import eslint from "@eslint/js";
|
|
2
|
+
import { type TSESLint } from "@typescript-eslint/utils";
|
|
3
|
+
import jsonc from "eslint-plugin-jsonc";
|
|
5
4
|
import { createRequire } from "module";
|
|
5
|
+
import tseslint from "typescript-eslint";
|
|
6
6
|
|
|
7
7
|
// CJS compatibility; it started transpiling to a top-level await after upgrading from packemon 4.0.1 to 4.1.0
|
|
8
8
|
const require = createRequire(import.meta.url);
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Options as GitOptions } from '@semantic-release/git';
|
|
2
|
+
import type { Options as GithubOptions } from '@semantic-release/github';
|
|
1
3
|
import type { Options, PluginSpec } from 'semantic-release';
|
|
2
|
-
import type { Options as GitOptions } from '@semantic-release/git'
|
|
3
|
-
import type { Options as GithubOptions } from '@semantic-release/github'
|
|
4
4
|
import { DefaultOptions } from './setupGitPluginSpec.js';
|
|
5
5
|
|
|
6
6
|
export const defaultPlugins: readonly PluginSpec[] = [
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import { inspect } from 'node:util';
|
|
14
15
|
import type { Options, PluginSpec } from 'semantic-release';
|
|
16
|
+
import debug from './debug.js';
|
|
15
17
|
import { configureDotnetNugetPush, configurePrepareCmd } from './dotnet/dotnetHelpers.js';
|
|
18
|
+
import { getEnvVarValue } from './envUtils.js';
|
|
16
19
|
import { baseConfig, defaultPlugins } from './semanticReleaseConfig.js';
|
|
17
20
|
import { setupGitPluginSpec } from './setupGitPluginSpec.js';
|
|
18
|
-
import debug from './debug.js'
|
|
19
|
-
import { inspect } from 'node:util';
|
|
20
|
-
import { env } from "node:process"
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* TODO: options/params for inserts/edits. NOT ready for production. Currently, this can only add Git plugin's options if undefined or one or more is missing.
|
|
@@ -91,7 +91,7 @@ export function getConfig(projectsToPublish: string[] = [], projectsToPackAndPus
|
|
|
91
91
|
const errors: Error[] = [];
|
|
92
92
|
|
|
93
93
|
if (projectsToPublish.length === 0) {
|
|
94
|
-
const _ =
|
|
94
|
+
const _ = getEnvVarValue("PROJECTS_TO_PUBLISH");
|
|
95
95
|
if (_ === undefined)
|
|
96
96
|
errors.push(new Error("projectsToPublish.length must be > 0 or PROJECTS_TO_PUBLISH must be defined and contain at least one path."));
|
|
97
97
|
else
|
|
@@ -99,7 +99,7 @@ export function getConfig(projectsToPublish: string[] = [], projectsToPackAndPus
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (projectsToPackAndPush !== false && projectsToPackAndPush.length === 0) {
|
|
102
|
-
const _ =
|
|
102
|
+
const _ = getEnvVarValue("PROJECTS_TO_PACK_AND_PUSH")
|
|
103
103
|
if (_ === undefined)
|
|
104
104
|
errors.push(new Error("projectsToPackAndPush.length must be > 0 or PROJECTS_TO_PACK_AND_PUSH must be defined and contain at least one path."));
|
|
105
105
|
else
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PluginSpec } from 'semantic-release';
|
|
2
1
|
import type { AssetEntry, Options as GitOptions } from '@semantic-release/git';
|
|
2
|
+
import type { PluginSpec } from 'semantic-release';
|
|
3
3
|
|
|
4
4
|
export const GitPluginId = '@semantic-release/git';
|
|
5
5
|
/** As specified at https://github.com/semantic-release/git#options */
|