2015-10-17 5 views

risposta

38

GitHub è il mantenimento di un namespace per ogni PR nel repository originale, quindi funziona anche:

npm install <user>/<repo>#pull/<id>/head 

NOTE: It doesn't seeem to be working with NPM v. 5. See the comment below .

ad esempio:

npm i --save-dev json-schema-faker/json-schema-faker#pull/129/head 

o con yarn:

yarn add <user>/<repo>#<id>/head 

ad esempio:

yarn add json-schema-faker/json-schema-faker#129/head 

notare che in caso Yarn non c'è pull/ segmento nel pacchetto iden tifier.

Questo può essere utile se è necessario automatizzare l'installazione o il repository/derivazione da cui viene rimosso l'originario PR. Vedi anche Modifying an inactive pull request locally su GitHub.

+0

Questo funziona, ma: Come installo più richieste pull (e unirle)? – Munchkin

+2

@Munchkin Non penso che sia qualcosa che dovresti fare con NPM stesso. Forse forzi il repository, unisci i PR nella tua forcella e installa da lì? –

+2

Yarn (o Github più?) Non sembra supportare il pull nel tag. Quindi per l'esempio sopra sarebbe: json-schema-faker/json-schema-faker # 129/head. C'è anche un suffisso 'fusione' (piuttosto che 'testa') per alcuni PR ma non so cosa significhi. –

14

"How to install NodeJS package from GitHub directly?" indica che è possibile specificare un ramo.

Quindi, se si conosce il pronti contro termine e il ramo da cui un PR viene da, si può fare un:

npm install git+https://github.com/user/repo.git#branch 

Worth saying that you might need to escape the # to use a specific branch from the shell, i.e.:

npm install git+https://github.com/user/repo.git\#branch 

Note that repository you want to install must be a npm module, it must contain a package.json file or else you will get this error:

Error: ENOENT, open 'tmp.tgz-unpack/package.json'.