JohnWeisz / TypedJSON

Typed JSON parsing and serializing for TypeScript that preserves type information.
MIT License
603 stars 64 forks source link

Whitelist package contents #132

Closed MatthiasKunnen closed 4 years ago

MatthiasKunnen commented 4 years ago

Instead of blacklisting unwanted files for npm packing (.npmignore), whitelist wanted ones. Blacklisting, by nature, can easily result in unwanted files getting packed. Case in point, the package currently contains the following files:

node_modules/typedjson
├── coverage ❌
│   └── lcov.info ❌
├── js
│   ├── parser.d.ts
│   ├── typedjson
│   │   ├── deserializer.d.ts
│   │   ├── helpers.d.ts
│   │   ├── json-array-member.d.ts
│   │   ├── json-map-member.d.ts
│   │   ├── json-member.d.ts
│   │   ├── json-object.d.ts
│   │   ├── json-set-member.d.ts
│   │   ├── metadata.d.ts
│   │   ├── options-base.d.ts
│   │   ├── serializer.d.ts
│   │   ├── to-json.d.ts
│   │   └── types.d.ts
│   ├── typedjson.d.ts
│   ├── typedjson.js
│   ├── typedjson.js.map
│   ├── typedjson.min.js
│   └── typedjson.min.js.map
├── license.md
├── nyc.config.js  ❌
├── .nyc_output ❌
│   ├── 24892588-7b80-4b20-b951-42179426f7df.json ❌
│   ├── a16100f3-cb79-4c53-abcc-a04a89fa0d53.json ❌
│   └── processinfo ❌
│       ├── 24892588-7b80-4b20-b951-42179426f7df.json ❌
│       ├── a16100f3-cb79-4c53-abcc-a04a89fa0d53.json ❌
│       └── index.json ❌
├── package.json
└── readme.md

 ❌ marks files that I believe to be added erroneously

About the files key in package.json: files such as the readme get packed by default, see https://docs.npmjs.com/files/package.json#files. Testing which files are going to be packed can be done using npm pack.

Neos3452 commented 4 years ago

Thanks a lot!