Skip to content

Commit

Permalink
Test npm publish (#3554)
Browse files Browse the repository at this point in the history
## About the changes

https://github.blog/changelog/2022-10-24-npm-v9-0-0-released/ introduced
a breaking change in the way they handle files inside package.json which
caused some issues with the way we pack and distribute Unleash:

> npm pack now follows a strict order of operations when applying ignore
rules. If a files array is present in the package.json, then rules in
.gitignore and .npmignore files from the root will be ignored.

What we discovered is that when having a nested .gitignore (the one we
have inside frontend), `npm publish` was taking that nested .gitignore
into account (despite the fact that we also have a package.json with
files inside the same folder). We tricked this by removing the `build`
folder from `frontend/.gitignore` and instead adding it into the root
`.gitignore` which is being ignored by `npm publish` following what's
stated in the release note above.

-----------------

Co-authored-by: Gard Rimestad <gard@getunleash.io>
  • Loading branch information
gastonfournier and Gard Rimestad committed Apr 18, 2023
1 parent 2e4126c commit 201c868
Show file tree
Hide file tree
Showing 6 changed files with 7,450 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/release.yaml
Expand Up @@ -24,9 +24,6 @@ jobs:
run: |
yarn install --frozen-lockfile
yarn --cwd ./frontend install --frozen-lockfile
ls -l ./frontend
ls -l ./frontend/build
npm publish --dry-run
- name: Publish to npm
run: |
LATEST=$(npm show unleash-server version)
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -50,7 +50,8 @@ package-lock.json
/website/i18n/*
.env

#report.json
# Ignore frontend build
frontend/build

# Generated docs
website/docs/reference/api/**/sidebar.js
Expand Down
1 change: 0 additions & 1 deletion frontend/.gitignore
Expand Up @@ -41,7 +41,6 @@ typings/

# Built
dist
build

# IDE
.idea/
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Expand Up @@ -4,7 +4,7 @@
"private": true,
"files": [
"index.js",
"build/"
"build"
],
"engines": {
"node": ">=18"
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -12,6 +12,7 @@
"dist",
"docs",
"frontend/build",
"frontend/build/*",
"frontend/index.js",
"frontend/package.json"
],
Expand Down

0 comments on commit 201c868

Please sign in to comment.