Define private registry in package.json

前端 未结 2 1922
南笙
南笙 2021-02-18 22:26

We have a private npm repository based on Sinopia

What should I define in package.json that some packages will be installed from Synopia rather then from g

2条回答
  •  一整个雨季
    2021-02-18 23:04

    The whole point of sinopia is a private registry and a proxy at the same time. You can use uplinks install all your packages from one registry entry point. Sinopia is able to route to any registry if the local storage is not able to resolve the dependency. By default, he points to npmjs .

    So, if you set your configuration like

       # a list of other known repositories we can talk to
    uplinks:
      npmjs:
        url: https://registry.npmjs.org/
    
    packages:
      '@*/*':
        # scoped packages
        access: $all
        publish: $authenticated
        proxy: npmjs
    
      '**':
        # allow all users (including non-authenticated users) to read and
        # publish all packages
        #
        # you can specify usernames/groupnames (depending on your auth plugin)
        # and three keywords: "$all", "$anonymous", "$authenticated"
        access: $all
    
        # allow all known users to publish packages
        # (anyone can register by default, remember?)
        publish: $authenticated
    
        # if package is not available locally, proxy requests to 'npmjs' registry
        proxy: npmjs
    

    You should be able to resolve all your dependencies independently of the source of each of them

    btw: sinopia has no longer maintained.

提交回复
热议问题