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

fix(create-mud): include .gitignore files in created projects #1945

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

tash-2s
Copy link
Contributor

@tash-2s tash-2s commented Nov 19, 2023

This Pull Request resolves #1865, where projects created by create-mud are missing .gitignore files, specifically in versions 2.0.0-next.13 and 2.0.0-next.14.

The cause is an update in npm-packlist, used during the npm package publishing process to list target package files. The MUD's release command changeset publish relies on npm-packlist through pnpm publish.

The previous version of npm-packlist included .gitignore files by respecting the .npmignore file, but the latest version doesn't. This change is not documented in its changelog, but based on this issue's comment, it seems better not to expect .gitignore files to be included.

This PR addresses this issue by utilizing create-create-app's feature for handling .gitignore. During the build process of create-mud, .gitignore files are renamed to gitignore, ensuring their inclusion in the package. When the create-mud cli is executed, create-create-app automatically renames those gitignore files back to .gitignore for project creation.

To test the fix, you can run pnpm build && dist/cli.js test-project.

Reference: #336

Testing the npm-packlist behavior:

To observe the behavior change in npm-packlist, we can use pnpm pack or npm pack without the changes from this PR.

$ cd packages/create-mud
$ pnpm build # copy template files to dist/

# with earlier version of pnpm (npm-packlist v5)
$ npm install -g [email protected] 
$ pnpm pack
$ tar -xzf create-mud-2.0.0-next.14.tgz # extract to package/
$ ls -A package/dist/templates/vanilla # .gitignore included
.eslintrc           .gitignore          mprocs.yaml         packages
.gitattributes      .vscode             package.json        pnpm-workspace.yaml
$ rm -r create-mud-2.0.0-next.14.tgz package

# with more recent version of pnpm (npm-packlist v8)
$ npm install -g [email protected]
$ pnpm pack
$ tar -xzf create-mud-2.0.0-next.14.tgz
$ ls -A package/dist/templates/vanilla # .gitignore not included
.eslintrc           .vscode             package.json        pnpm-workspace.yaml
.gitattributes      mprocs.yaml         packages
$ rm -r create-mud-2.0.0-next.14.tgz package

@tash-2s tash-2s requested review from alvrs and holic as code owners November 19, 2023 23:01
Copy link

changeset-bot bot commented Nov 19, 2023

🦋 Changeset detected

Latest commit: 56e7f9b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
create-mud Patch
@latticexyz/abi-ts Patch
@latticexyz/block-logs-stream Patch
@latticexyz/cli Patch
@latticexyz/common Patch
@latticexyz/config Patch
@latticexyz/dev-tools Patch
@latticexyz/ecs-browser Patch
@latticexyz/faucet Patch
@latticexyz/gas-report Patch
@latticexyz/network Patch
@latticexyz/noise Patch
@latticexyz/phaserx Patch
@latticexyz/protocol-parser Patch
@latticexyz/react Patch
@latticexyz/recs Patch
@latticexyz/schema-type Patch
@latticexyz/services Patch
@latticexyz/solecs Patch
solhint-config-mud Patch
solhint-plugin-mud Patch
@latticexyz/std-client Patch
@latticexyz/std-contracts Patch
@latticexyz/store-cache Patch
@latticexyz/store-indexer Patch
@latticexyz/store-sync Patch
@latticexyz/store Patch
@latticexyz/utils Patch
@latticexyz/world-modules Patch
@latticexyz/world Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tash-2s
Copy link
Contributor Author

tash-2s commented Nov 19, 2023

It seems that pnpm downgraded npm-packlist last week due to a performance issue, which means the latest version of pnpm includes the .gitignore files without this change. However, I believe this new approach is more stable.

@holic holic merged commit 6963a9e into latticexyz:main Nov 30, 2023
10 checks passed
@tash-2s tash-2s deleted the create-mud-gitignore branch November 30, 2023 19:12
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

Successfully merging this pull request may close these issues.

create-mud projects missing .gitignore
2 participants