File tree Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,13 @@ async function verifyConditions(pluginConfig, context) {
42
42
}
43
43
44
44
async function prepare ( pluginConfig , context ) {
45
- let pkg ;
46
45
const errors = verified ? [ ] : verifyNpmConfig ( pluginConfig ) ;
47
46
48
47
setLegacyToken ( context ) ;
49
48
50
49
try {
51
50
// Reload package.json in case a previous external step updated it
52
- pkg = await getPkg ( pluginConfig , context ) ;
51
+ const pkg = await getPkg ( pluginConfig , context ) ;
53
52
if ( ! verified && pluginConfig . npmPublish !== false && pkg . private !== true ) {
54
53
await verifyNpmAuth ( pluginConfig , pkg , context ) ;
55
54
}
Original file line number Diff line number Diff line change @@ -4,26 +4,19 @@ const AggregateError = require('aggregate-error');
4
4
const getError = require ( './get-error' ) ;
5
5
6
6
module . exports = async ( { pkgRoot} , { cwd} ) => {
7
- const errors = [ ] ;
8
- let pkg ;
9
-
10
7
try {
11
- pkg = await readPkg ( { cwd : pkgRoot ? path . resolve ( cwd , String ( pkgRoot ) ) : cwd } ) ;
8
+ const pkg = await readPkg ( { cwd : pkgRoot ? path . resolve ( cwd , String ( pkgRoot ) ) : cwd } ) ;
12
9
13
10
if ( ! pkg . name ) {
14
- errors . push ( getError ( 'ENOPKGNAME' ) ) ;
11
+ throw getError ( 'ENOPKGNAME' ) ;
15
12
}
13
+
14
+ return pkg ;
16
15
} catch ( error ) {
17
16
if ( error . code === 'ENOENT' ) {
18
- errors . push ( getError ( 'ENOPKG' ) ) ;
17
+ throw new AggregateError ( [ getError ( 'ENOPKG' ) ] ) ;
19
18
} else {
20
- errors . push ( error ) ;
19
+ throw new AggregateError ( [ error ] ) ;
21
20
}
22
21
}
23
-
24
- if ( errors . length > 0 ) {
25
- throw new AggregateError ( errors ) ;
26
- }
27
-
28
- return pkg ;
29
22
} ;
You can’t perform that action at this time.
0 commit comments