@@ -69,10 +69,6 @@ class Publish extends BaseCommand {
69
69
const spec = npa ( args [ 0 ] )
70
70
let manifest = await this . getManifest ( spec , opts )
71
71
72
- if ( manifest . publishConfig ) {
73
- flatten ( manifest . publishConfig , opts )
74
- }
75
-
76
72
// only run scripts for directory type publishes
77
73
if ( spec . type === 'directory' && ! ignoreScripts ) {
78
74
await runScript ( {
@@ -92,12 +88,8 @@ class Publish extends BaseCommand {
92
88
// so that we send the latest and greatest thing to the registry
93
89
// note that publishConfig might have changed as well!
94
90
manifest = await this . getManifest ( spec , opts )
95
- if ( manifest . publishConfig ) {
96
- flatten ( manifest . publishConfig , opts )
97
- }
98
91
99
- // note that logTar calls log.notice(), so if we ARE in silent mode,
100
- // this will do nothing, but we still want it in the debuglog if it fails.
92
+ // JSON already has the package contents
101
93
if ( ! json ) {
102
94
logTar ( pkgContents , { unicode } )
103
95
}
@@ -197,15 +189,22 @@ class Publish extends BaseCommand {
197
189
198
190
// if it's a directory, read it from the file system
199
191
// otherwise, get the full metadata from whatever it is
200
- getManifest ( spec , opts ) {
192
+ // XXX can't pacote read the manifest from a directory?
193
+ async getManifest ( spec , opts ) {
194
+ let manifest
201
195
if ( spec . type === 'directory' ) {
202
- return readJson ( `${ spec . fetchSpec } /package.json` )
196
+ manifest = await readJson ( `${ spec . fetchSpec } /package.json` )
197
+ } else {
198
+ manifest = await pacote . manifest ( spec , {
199
+ ...opts ,
200
+ fullmetadata : true ,
201
+ fullReadJson : true ,
202
+ } )
203
+ }
204
+ if ( manifest . publishConfig ) {
205
+ flatten ( manifest . publishConfig , opts )
203
206
}
204
- return pacote . manifest ( spec , {
205
- ...opts ,
206
- fullMetadata : true ,
207
- fullReadJson : true ,
208
- } )
207
+ return manifest
209
208
}
210
209
}
211
210
module . exports = Publish
0 commit comments