#What fields are required in package.json to publish the dist and typings?

21 messages · Page 1 of 1 (latest)

wind siren
#

This is my package.json:

{
  "name": "@lloydjatkinson/date-fns-additional",
  "description": "Additional functionality built on date-fns",
  "author": "Lloyd Atkinson",
  "license": "MIT",
  "version": "0.0.3",
  "keywords": [
    "date-fns",
    "date",
    "date-formatting"
  ],
  "homepage": "https://github.com/lloydjatkinson/date-fns-additional#readme",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/lloydjatkinson/date-fns-additional.git"
  },
  "bugs": {
    "url": "https://github.com/lloydjatkinson/date-fns-additional/issues"
  },
  "type": "module",
  "types": "./dist/index.d.ts",
  "module": "./dist/index.js",
  "main": "./dist/index.js",
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.js",
      "default": "./dist/index.js"
    },
    "./package.json": "./package.json"
  },
  "files": [
    "/dist"
  ],
  "devDependencies": {
    "@changesets/cli": "^2.26.0",
    "@typescript-eslint/eslint-plugin": "^5.48.1",
    "@typescript-eslint/parser": "^5.48.1",
    "@vitest/coverage-c8": "^0.27.1",
    "@vitest/ui": "^0.27.1",
    "eslint": "^8.31.0",
    "serve": "^14.1.2",
    "typedoc": "^0.23.24",
    "typescript": "^4.9.4",
    "vite": "^4.0.4",
    "vitest": "^0.27.1"
  },
  "peerDependencies": {
    "date-fns": "^2.29.3"
  },
  "scripts": {
    "build": "tsc",
    "lint": "eslint . --ext .ts,.cjs,.mjs",
    "lint:fix": "eslint . --ext .ts,.cjs,.mjs --fix",
    "test": "vitest",
    "test:ui": "vitest --ui",
    "test:types": "vitest typecheck",
    "test:coverage": "vitest run --coverage",
    "test:coverage:serve": "vitest run --coverage; serve coverage",
    "docs:build": "typedoc src/index.ts",
    "docs:serve": "typedoc src/index.ts; serve docs",
    "changeset": "changeset"
  },
  "dependencies": {
    "@changesets/changelog-github": "^0.4.8"
  }
}

However, as you can see there's nothing in node_modules when I install it. Previously, it had src too but still a missing dist. Once I added /dist to files: it results in even less being published. What am I doing wrong?

#

building does produce the files:

#

the library is on npm if you want to install it and see what I mean

versed stratus
#

try dist or /dist/*

#

ah i hadn't checked the zod example

#

well, is dist in project root?

wind siren
#

Yes it is

wind siren
#

dist without the slash actually publishes src

versed stratus
#

are you sure dist is in project root and not in src

#

/dist means dist in project root
dist means dist anywhere
so src/dist would work with the latter but not the former

wind siren
#

It's in the root next to node modules

wind siren
versed stratus
#

do you have a dist somewhere in src?

#

also maybe check the folder name and the one specified in files to make sure you don't have any invisible chars or trailing spaces or something

wind siren
#

No, I don't. Here is what I've tried so far:

files: ['/dist'] -> nothing published
files: ['dist'] -> only src published

#

yeah I suppose thats worth checking too

versed stratus
#

with dist is the entire src published?

#

hmm actually im not seeing anything

#

i installed v0.0.2, it has dist in the package.json, but im getting just the 3 files

#

and with v0.0.1 and * in files im getting everything