Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Publish Dynamically Generated Packages #2151

Closed
darthtrevino opened this issue Jun 21, 2019 · 6 comments
Closed

Cannot Publish Dynamically Generated Packages #2151

darthtrevino opened this issue Jun 21, 2019 · 6 comments

Comments

@darthtrevino
Copy link

Expected Behavior

In this repository: https://github.com/react-dnd/react-dnd, there are a handful of packages that are dynamically created when running yarn build. These are the CommonJS variants of the core packages.

When I run a release, I expect that my packages are all published and that the repository is tagged appropriately.

Current Behavior

When the release command is run, the semver questions are asked and the versions are bumped, but action fails when creating github tags. Logs are pasted below.

Possible Solution

If package.json files are .gitignored, then don't add them in the git add step.

lerna-debug.log

107 error Error: Command failed: git add -- packages/core/dnd-core/package.json packages/core/react-dnd/package.json packages/testing/test-backend/package.json packages/alternative_builds/cjs/dnd-core/package.json packages/core/html5-backend/package.json packages/alternative_builds/cjs/react-dnd/package.json packages/alternative_builds/cjs/test-backend/package.json packages/testing/test-utils/package.json packages/alternative_builds/cjs/test-utils/package.json packages/documentation/examples-decorators/package.json packages/alternative_builds/cjs/html5-backend/package.json packages/alternative_builds/umd/package.json packages/documentation/examples-hooks/package.json packages/documentation/docsite/package.json lerna.json
107 error The following paths are ignored by one of your .gitignore files:
107 error packages/alternative_builds/cjs
107 error Use -f if you really want to add them.
107 error
107 error     at makeError (/Users/christrevino/Workspace/oss/react-dnd/node_modules/execa/index.js:174:9)
107 error     at /Users/christrevino/Workspace/oss/react-dnd/node_modules/execa/index.js:278:16

Your Environment

Executable Version
lerna --version 3.15.0
npm --version 6.9.0
yarn --version 1.16.0
node --version 12.4.0
OS Version
MacOS Mojave
@evocateur
Copy link
Member

I guess I wouldn't expect this to be the case (generating content that you then want to be versioned)?

I thought everyone provided separate entries (module, unpkg, etc) for the various flavors of builds, nowadays. I see you've basically done what I would recommend, which is commit the alternative builds as fully-fledged Lerna packages so the git commands work.

@darthtrevino
Copy link
Author

It’s kind of a weird case, for sure. I would prefer to not check those packages in, since they’re created from scripts.

The latest versions of react-dnd ship with esm by default and ”type”: “module” enabled in package.json. This can be painful for users who want SSR in node without transforming the library. To accomodate these users we generated the -cjs packages to work well in the node ecosystem without flags, module-mapping, or lib-processing. I’m not sure if it’s the best approach, but it lets the library be a bit more future-leaning. Hopefully they go away when harmony modules are enabled by default.

@evocateur
Copy link
Member

For the immediate problem, I think we might be able to add the -u flag to the git add call here (before the -- obvs):

return childProcess.exec("git", ["add", "--", ...filePaths], opts);

Quick testing locally indicates that git add -u does ignore the untracked files, even when explicitly listed in the file arguments. Not sure what the version limitation on -u is, though...

@rozbo
Copy link

rozbo commented Oct 16, 2019

any plan to fix this ? cause I want a package to test and don't want to share it to other one.

@fictivecreations
Copy link
Contributor

I'm also wondering if there's any plan to fix this moving forward? I've got a project with a similar setup to the OP and would love to see a solution to this.

@fictivecreations
Copy link
Contributor

@evocateur Is there a reason you need to exactly specify all the files in the git add? Why not just use git add . instead? That would ignore the the .gitignore files and should add any new untracked files that aren't in the .gitignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants