Using `npm publish` publishes only part of the files

In one of my repositories I’ve started publishing the files using gha.
In the same repo, when doing npm publish, the package would have publish as expected.
When I’m using the same command in the repository, only some of the files are being published.
In my package.json I’ve set npm to publish two folders:

  "files": [

Here are images from the repository’s relevant action:

You can see that the template folder exists but only a few files are packaged. The template folder has many more files and folders.

What can be the problem here? Is there anything different when publishing from gha?


1 Like

When using ls, I can see the files are already there:

When I publish locally (on my machine) the publish works as expected:

Found the issue - it was the npm version.
gha has version 6.x, while locally I’ve been using 7.x.

1 Like

Thanks for the update @YonatanKra.
Did you figure out what was the actual issue for which npm6 didn’t publish as you expected?

Yes. I had a package.json file in one of my templates. It was taken as a “real” package.json file and interfered with the actual deployment to npm.
Note to self - if you add tmpl suffix to html and js files - do the same for json files cause you can never know :slight_smile:

Ahh gotcha! Glad you caught up to that nasty one :slight_smile: