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

Added flag to checkout to update submodules when present. #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

patcon
Copy link

@patcon patcon commented Oct 8, 2024

Addresses #13

Want me to add an entry to CHANGELOG as well?

@patcon
Copy link
Author

patcon commented Oct 8, 2024

I needed to add a "prepare" script in order to have npm install directly from git, but it now works! This helps when ppl want to submit PRs like this, and rely on it until you have time to review. It also allows them to more easily and visible assure you that it works in their CI scripts :)

Sorry, ideally that would be another PR, but I thought these might be confusing in isolation.

Context: https://blog.jim-nielsen.com/2018/installing-and-building-an-npm-package-from-github/

To see what the prepare script does, run npm install in any project at each commit in this PR, and see how diff the folder looks in node_modules

# WITHOUT prepare script
$ npm install patcon/storybook-branch-switcher#9985ca6 --save-dev
$ ./node_modules/.bin/sb-branch-switcher
zsh: no such file or directory: ./node_modules/.bin/sb-branch-switcher
$ tree node_modules/storybook-branch-switcher
./node_modules/storybook-branch-switcher
├── LICENSE
├── README.md
├── manager.js
├── package.json
└── preview.js

# WITH prepare script
npm install patcon/storybook-branch-switcher#614c032 --save-dev
$ ./node_modules/.bin/sb-branch-switcher
😎 Your workspace looks good! ...
$ tree node_modules/storybook-branch-switcher
./node_modules/storybook-branch-switcher
├── LICENSE
├── README.md
├── dist
│   ├── cli.mjs
│   ├── cli.mjs.map
│   ├── index.d.mts
│   ├── index.d.ts
│   ├── index.js
│   ├── index.js.map
│   ├── index.mjs
│   ├── index.mjs.map
│   ├── manager.mjs
│   ├── manager.mjs.map
│   ├── preview.d.mts
│   ├── preview.d.ts
│   ├── preview.js
│   ├── preview.js.map
│   ├── preview.mjs
│   └── preview.mjs.map
├── manager.js
├── package.json
└── preview.js

2 directories, 21 files

@patcon
Copy link
Author

patcon commented Oct 8, 2024

Hm. I'm seeing some odd behavior. The git submodule init step might also be needed, for when a new submodule appears in .gitmodules between branches

EDIT: The current version works better, and uses commands closer to git's direct commands, which is probably good.

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.

1 participant