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

Dry-run mode #34

Open
lolo101 opened this issue Feb 26, 2024 · 14 comments
Open

Dry-run mode #34

lolo101 opened this issue Feb 26, 2024 · 14 comments

Comments

@lolo101
Copy link

lolo101 commented Feb 26, 2024

Hi !

It would be nice to have a dry-run mode to test various options before actually running the command and throwing stuff to the npm registry

@fabiospampinato
Copy link
Owner

Would this be any more useful than the already present --no-scripts flag?

@lolo101
Copy link
Author

lolo101 commented Mar 14, 2024

IDK 🙂

I cannot find any documentation about this flag in the readme or the CLI help
What does it do?

@fabiospampinato
Copy link
Owner

I should update the screenshot in the readme, it basically just turns off all pre and post scripts.

@lolo101
Copy link
Author

lolo101 commented Mar 14, 2024

I don't think I'm using it correctly 😄

$ npx bump --no-scripts

 test-project:
 v0.1.0 => v--no-scripts
 ↑ bum bum bumped!

The package.json is updated to version "--no-scripts"

@fabiospampinato
Copy link
Owner

what do you get with a npx bump --version?

@lolo101
Copy link
Author

lolo101 commented Mar 14, 2024

OMG, I'm so sorry I think I have another executable named "bump".

When I use the fully qualified name of the package I get the following:

$ npx @fabiospampinato/bump --version
3.2.2

However, I think there is some issue here :

$ npx @fabiospampinato/bump major --no-scripts
TypeError: unmatched.replaceAll is not a function or its return value is not iterable
    at getStringTruncatedWidth (file:///home/loic/.npm/_npx/a9f0ddfae1f1b021/node_modules/fast-string-truncated-width/dist/index.js:42:42)
    at truncate (file:///home/loic/.npm/_npx/a9f0ddfae1f1b021/node_modules/ansi-truncate/dist/index.js:10:44)
    at truncate (file:///home/loic/.npm/_npx/a9f0ddfae1f1b021/node_modules/tiny-truncate/dist/index.js:6:12)
    at writeLine (file:///home/loic/.npm/_npx/a9f0ddfae1f1b021/node_modules/tiny-spinner/dist/utils.js:5:12)
    at Spinner.stop (file:///home/loic/.npm/_npx/a9f0ddfae1f1b021/node_modules/tiny-spinner/dist/index.js:46:13)
    at Spinner.error (file:///home/loic/.npm/_npx/a9f0ddfae1f1b021/node_modules/tiny-spinner/dist/index.js:37:25)
    at command (file:///home/loic/.npm/_npx/a9f0ddfae1f1b021/node_modules/@fabiospampinato/bump/dist/commands/command.js:19:17)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Note: the package.json has been updated as expected

BTW with a dry run, I would expect the package.json to be left unmodified

@fabiospampinato
Copy link
Owner

Oh right this package is namespaced unfortunately.

It looks like there is a bug somewhere 🤔

BTW with a dry run, I would expect the package.json to be left unmodified

What would you expect a dry run mode to actually do?

@lolo101
Copy link
Author

lolo101 commented Mar 14, 2024

I'd expect the dry run to do nothing at all, but print a detailed log of what it would do. Just like if it would be an actual run. So I can tell if I misconfigured something, if the version is not the one I expect, or if the access to the npm repository is misconfigured, and so on

@lolo101
Copy link
Author

lolo101 commented Mar 14, 2024

For instance, you can check the dry-run mode of release-it

https://github.com/release-it/release-it/blob/main/docs/dry-runs.md

@fabiospampinato
Copy link
Owner

It makes sense, but assuming the bug you reported is fixed, wouldn't it be more or less the same as doing a bump --no-scripts, looking at the changes in git, and then discarding all local changes in git? Like I understand that having a --dry-run command could be a bit more convenient, but it would also the program more complicated for maybe not enough benefit 🤔

@lolo101
Copy link
Author

lolo101 commented Mar 18, 2024

Yes good point 🙂

I'll try this and let you know, thank you for taking the time to take a look at this request anyway 😉

@fabiospampinato
Copy link
Owner

Possibly a better suggestion, but you can just run bump version && bump changelog for example to skip making the commit and tagging it, which make resetting the changes a bit more annoying.

@fabiospampinato
Copy link
Owner

By the way are you using a version older than v15 of Node? The error you are seeing about String.prototype.replaceAll not being available seems to indicate that.

@lolo101
Copy link
Author

lolo101 commented Mar 20, 2024

All right I'm going to try that idea 🙂

Yes well seen 🙂 fnm defaults to version 14:

$ fnm list  
* v14.20.1 default
* v16.20.2
* v18.19.0
* system

I change that!

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

No branches or pull requests

2 participants