@electron-forge/core-utils 7.9.0 → 7.10.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/dist/author-name.d.ts +11 -0
- package/dist/author-name.d.ts.map +1 -0
- package/dist/author-name.js +32 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/package.json +4 -3
- package/src/author-name.ts +32 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PackagePerson } from '@electron-forge/shared-types';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the name from a package.json author field.
|
|
4
|
+
*
|
|
5
|
+
* @param author - The author object to extract the name from.
|
|
6
|
+
* @returns The name of the author.
|
|
7
|
+
*
|
|
8
|
+
* @see https://docs.npmjs.com/cli/configuring-npm/package-json#people-fields-author-contributors
|
|
9
|
+
*/
|
|
10
|
+
export declare function getNameFromAuthor(author: PackagePerson): string;
|
|
11
|
+
//# sourceMappingURL=author-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"author-name.d.ts","sourceRoot":"","sources":["../src/author-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAoB/D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getNameFromAuthor = void 0;
|
|
7
|
+
const parse_author_1 = __importDefault(require("parse-author"));
|
|
8
|
+
/**
|
|
9
|
+
* Extracts the name from a package.json author field.
|
|
10
|
+
*
|
|
11
|
+
* @param author - The author object to extract the name from.
|
|
12
|
+
* @returns The name of the author.
|
|
13
|
+
*
|
|
14
|
+
* @see https://docs.npmjs.com/cli/configuring-npm/package-json#people-fields-author-contributors
|
|
15
|
+
*/
|
|
16
|
+
function getNameFromAuthor(author) {
|
|
17
|
+
let publisher = author || '';
|
|
18
|
+
if (typeof publisher === 'string') {
|
|
19
|
+
publisher = (0, parse_author_1.default)(publisher);
|
|
20
|
+
}
|
|
21
|
+
if (typeof publisher !== 'string' &&
|
|
22
|
+
publisher &&
|
|
23
|
+
typeof publisher.name === 'string') {
|
|
24
|
+
publisher = publisher.name;
|
|
25
|
+
}
|
|
26
|
+
if (typeof publisher !== 'string') {
|
|
27
|
+
publisher = '';
|
|
28
|
+
}
|
|
29
|
+
return publisher;
|
|
30
|
+
}
|
|
31
|
+
exports.getNameFromAuthor = getNameFromAuthor;
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yLW5hbWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXV0aG9yLW5hbWUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQ0EsZ0VBQXVDO0FBRXZDOzs7Ozs7O0dBT0c7QUFDSCxTQUFnQixpQkFBaUIsQ0FBQyxNQUFxQjtJQUNyRCxJQUFJLFNBQVMsR0FBa0IsTUFBTSxJQUFJLEVBQUUsQ0FBQztJQUU1QyxJQUFJLE9BQU8sU0FBUyxLQUFLLFFBQVEsRUFBRSxDQUFDO1FBQ2xDLFNBQVMsR0FBRyxJQUFBLHNCQUFXLEVBQUMsU0FBUyxDQUFDLENBQUM7SUFDckMsQ0FBQztJQUVELElBQ0UsT0FBTyxTQUFTLEtBQUssUUFBUTtRQUM3QixTQUFTO1FBQ1QsT0FBTyxTQUFTLENBQUMsSUFBSSxLQUFLLFFBQVEsRUFDbEMsQ0FBQztRQUNELFNBQVMsR0FBRyxTQUFTLENBQUMsSUFBSSxDQUFDO0lBQzdCLENBQUM7SUFFRCxJQUFJLE9BQU8sU0FBUyxLQUFLLFFBQVEsRUFBRSxDQUFDO1FBQ2xDLFNBQVMsR0FBRyxFQUFFLENBQUM7SUFDakIsQ0FBQztJQUVELE9BQU8sU0FBUyxDQUFDO0FBQ25CLENBQUM7QUFwQkQsOENBb0JDIn0=
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./rebuild"), exports);
|
|
18
18
|
__exportStar(require("./electron-version"), exports);
|
|
19
19
|
__exportStar(require("./package-manager"), exports);
|
|
20
|
-
|
|
20
|
+
__exportStar(require("./author-name"), exports);
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLDRDQUEwQjtBQUMxQixxREFBbUM7QUFDbkMsb0RBQWtDO0FBQ2xDLGdEQUE4QiJ9
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@electron-forge/core-utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.10.0",
|
|
4
4
|
"description": "Core utilities for the Electron Forge packages",
|
|
5
5
|
"repository": "https://github.com/electron/forge",
|
|
6
6
|
"author": "Samuel Attard",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"typings": "dist/index.d.ts",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@electron-forge/shared-types": "7.
|
|
11
|
+
"@electron-forge/shared-types": "7.10.0",
|
|
12
12
|
"@electron/rebuild": "^3.7.0",
|
|
13
13
|
"@malept/cross-spawn-promise": "^2.0.0",
|
|
14
14
|
"chalk": "^4.0.0",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"find-up": "^5.0.0",
|
|
17
17
|
"fs-extra": "^10.0.0",
|
|
18
18
|
"log-symbols": "^4.0.0",
|
|
19
|
+
"parse-author": "^2.0.0",
|
|
19
20
|
"semver": "^7.2.1"
|
|
20
21
|
},
|
|
21
22
|
"engines": {
|
|
@@ -28,5 +29,5 @@
|
|
|
28
29
|
"dist",
|
|
29
30
|
"src"
|
|
30
31
|
],
|
|
31
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "aae99d35b7d50cba68c224d9f906496b6039d158"
|
|
32
33
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PackagePerson } from '@electron-forge/shared-types';
|
|
2
|
+
import parseAuthor from 'parse-author';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Extracts the name from a package.json author field.
|
|
6
|
+
*
|
|
7
|
+
* @param author - The author object to extract the name from.
|
|
8
|
+
* @returns The name of the author.
|
|
9
|
+
*
|
|
10
|
+
* @see https://docs.npmjs.com/cli/configuring-npm/package-json#people-fields-author-contributors
|
|
11
|
+
*/
|
|
12
|
+
export function getNameFromAuthor(author: PackagePerson): string {
|
|
13
|
+
let publisher: PackagePerson = author || '';
|
|
14
|
+
|
|
15
|
+
if (typeof publisher === 'string') {
|
|
16
|
+
publisher = parseAuthor(publisher);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (
|
|
20
|
+
typeof publisher !== 'string' &&
|
|
21
|
+
publisher &&
|
|
22
|
+
typeof publisher.name === 'string'
|
|
23
|
+
) {
|
|
24
|
+
publisher = publisher.name;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (typeof publisher !== 'string') {
|
|
28
|
+
publisher = '';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return publisher;
|
|
32
|
+
}
|
package/src/index.ts
CHANGED