-
Notifications
You must be signed in to change notification settings - Fork 13
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
Tools to rename and remove aliases #17
Comments
Hi Dave. Does the tool already support, or have you given thought, to having conditional paths or regex patterns in paths? |
Hey @mendeza, Thanks for the message. Not 100% sure what you are asking. Can you provide some examples? FYI, the work / UI so far has developed like so:
Have had to pause development for a bit whilst I get on with real work! |
Dave, thanks for responding so quickly.
However, the npm package actually in |
Hmm. Sorry to be taking a while to get this, I'm not sure I understand. Just to clarify... The Alias CLI can update source code paths, so you could use it to rewrite your source code, perhaps:
But because the path is scoped (effectively, an absolute path) there will never be any relative path resolution to be calculated by the plugin, so the easier option would just be a simple find and replace in your IDE. The Alias API is designed to map your TypeScript supports multiple paths, so you could provide various fallbacks (which will work in TypeScript): "paths": {
"@myscope/my-package": [
"@myscope/my-package",
"@myscope/my-package-new",
"@myscope/my-package-foo"
]
} Right now, only the Jest plugin supports multiple paths, but I assume that is not what you want? Some other options: Write a custom plugin / resolverNot sure if this answers your question, but Alias HQ's has a simple plugin system, so you could write your own custom resolver: Perhaps check the path name, then use Node's NPM install aliases:https://docs.npmjs.com/cli-commands/install.html
Do any of those make sense in your case? |
Oh, absolutely. In fact, I'm using npm install aliases at the moment, and am weighing it against doing away with separate package names in favor of dist-tags. I was simply curious how deep you intended to go with your tool, so as to know where to fit it in the arsenal. Thanks for your great responsiveness! |
Well, always nice to hear new use cases! Though I still don't fully get your workflow to be honest. Another option would be |
Background
A tool to manipulate both the aliases and the source code would be useful:
Rename
I currently have a project where the path aliases are:
I would like them to be:
Remove
Also, some overly-specific aliases that I would like removed:
Proposal
Having tools to update these would be great.
UI
Not sure how it would look in the CLI right now, perhaps:
Then process.
Processing
The source code should be updated when aliases are modified:
Rename should be:
Removal would need to:
The text was updated successfully, but these errors were encountered: