Search code examples
npmtravis-cisemantic-releasenwb

Packaged published to npm is almost empty: Just publish README, LICENSE and package.json


I have a react component project created with nwb. I'm using Travis and semantic-release to make the releases.

But now, when I publish a new version, the package published from Travis is almost empty, and only have three files: README, LICENSE and package.json.

My .travis.yml configuration...

sudo: false
language: node_js
cache:
  directories:
    - ~/.npm
notifications:
  email: false
node_js:
  - '8'
before_install:
  - npm install npm codecov.io coveralls
after_success:
  - cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
  - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
  - npm run travis-deploy-once "npm run semantic-release"
branches:
  only:
    - master

The travis build looks ok and I can't see any errors. It discovers the new version and publish it, but just publish those three files.

The public Github repository is this...

https://github.com/rigobauer/react-abc2svg

... and you can check the travis build here...

https://travis-ci.org/rigobauer/react-abc2svg/jobs/332199646

If I set a version number manually in package.json and run npm publish in my computer, then the package is published correctly.

I've tried cleaning npm caches, reinstalling all dependencies, recreating .travis.yml using semantic-release-cli setup, etc. But I always get the same result. When I try to upgrade or install the package in another project, the directory in node_modules only have those three files.

Any idea of where could be the problem?

UPDATED: I've recreated the project from scratch with nwb, reinstalling dependencies, etc. And I have the same problem.

UPDATED 2: I have the list of directories configured in package.json like this...

"files": [
    "css",
    "es",
    "lib",
    "umd"
]

... but I've also tried creating a .npmignore file. The problem persists.


Solution

  • Got it! Thanks to the semantic-release guys, I realize that I have to manually indicate to Travis to run my build script (generated with nwb). So just changing this to .travis.yml make it work...

    .......
    after_success:
      - cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
      - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
      - npm run build
      - npm run travis-deploy-once "npm run semantic-release"
    ........
    

    I thought that Travis was doing that automatically, because I have another component project made using the exactly same process, and that package was ok (and that's what was driving me crazy). After reading their answer, I re-check everything and realize that the I made the first publish of that package manually, and after that I incorporate semantic-release. The thing is that the next commits weren't related to feature or fix, so semantic-release doesn't generate a new release, and the original package was still there.