Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,361,330
Community Members
 
Community Events
168
Community Groups

package.json files field is ignored in Bitbucket npm publish pipeline

Trying to publish to private npm repo from bitbucket. The bundle is built and added to a folder called dist. 

 

image: node:14

pipelines:

default:

- parallel:

- step:

name: Build and Test

caches:

- node

script:

- npm install

- npm test

- step:

name: Lint the node package

script:

- npm install eslint

- npx eslint .

caches:

- node

branches:

master:

- parallel:

- step:

name: Build and Test

caches:

- node

script:

- npm install

- npm run build

- step:

name: Security Scan

script:

# Run a security scan for sensitive data.

# See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security

- pipe: atlassian/git-secrets-scan:0.5.1

- step:

name: Deploy to Production

deployment: Production

script:

# Bump versions before publishing

- npm --no-git-tag-version version "2.0.$BITBUCKET_BUILD_NUMBER" -m "Upgrade to new version"

# Publish package

- pipe: atlassian/npm-publish:0.3.2

variables:

NPM_TOKEN: $NPM_TOKEN

 

Problem is that publishing to npm, dist folder is not published. 

Folder structure after building (locally and expected)

- package-name
- dist
- index.ts
- package.json

But with the Bitbucket pipeline, only package.json is added to the package, and dist is ignored.  

Inside package.json, I've added the property

"files": [
"dist"
]

According to npm docs , files always take precedence over gitignore and npmrc. 

Verified with npm publish --dry-run locally to make sure the right files are built. And it is working fine in that case. 

 

I was able to make it work by adding entries in npmignore files (not adding dist in npmignore and adding in gitignore). But this creates a lot of redundancy. 

Will Bitbucket pipeline consider files attribute in package.json?

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

3,494 views 3 10
Read article

Atlassian Community Events