Search code examples
npmnpm-installnpm-registry

custom registry - why only package.json extracted?


For security reasons I need to setup a custom npm-registry.

I configure a local http-registry (nginx) using this command:

npm config set @example:registry=http://localhost/

Then I place two files to nginx

.
..
@example%2fmodel
model.tgz

The contents of @example%2fmodel is:

{
  "name":"Model", 
  "dist-tags":{"foo":"1.0.0"},
  "versions":{
    "1.0.0":{
      "version":"1.0.0", 
      "dist":{"tarball":"model.tgz"}
    }
  }
}

The content of model.tgz is the package.json and the Model.ts.

The the Model.ts (from tarball) is:

export const URL = 'https://example.com/';
export const USER = 'apiv2';
export const PASS = '***';

The package.json (from tarball) is:

{"name":"Model","version":"1.0.0","files":"*.ts"}

As you can see, its all minimal and all straightforward.

Then I do a:

npm install @example/model
added 1 package in 0.347s
npm info ok

That worked well. But my Model.ts is missing


Solution

  • Ah I solved it myself,

    I had to create a subdirectory called package in the tgz. And the main must be a ecmascript-file.