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

feat: configurable alias prefix #111

Merged
merged 3 commits into from
Jun 10, 2024
Merged

Conversation

petersalomonsen
Copy link
Contributor

@petersalomonsen petersalomonsen commented Jun 9, 2024

Configurable Alias is about having the option to not only use the alias_ when referencing common constants in your code. This can be references to a near account, an external URL or whatever you need to reference in your code.

In the updated documentation you can read about the new aliasPrefix and aliasesContainsPrefix settings, which gives you the option to use another prefix than alias and also that your aliases file contains the prefix itself in the names of the object keys.

Here's from the "Custom alias prefix" section of the documentation:

If your aliases are prefixed with another keyword than alias, you may configure this using the aliasPrefix property. You may also include the prefix in the keys of your alias json file. Here is an example:

 {
   "account": "[MAINNET_ACCOUNT_ID]",
   "aliases": ["./aliases.mainnet.json"],
   "aliasPrefix": "REPL",
   "aliasesContainsPrefix": true,
 }

and then with your aliases.mainnet.json like this:

{
  "REPL_NAME": "world"
}

If your widget file looks like this:

export default <h1>Hello ${REPL_NAME}!</h1>;

Then the alias will be replaced like this:

export default <h1>Hello world!</h1>;

This update also makes it more compatible with bos-loader so that you can more easily use existing project with replacement configurations with bos-workspaces.

fixes #109

@petersalomonsen petersalomonsen marked this pull request as ready for review June 9, 2024 14:30
elliotBraem
elliotBraem previously approved these changes Jun 10, 2024
@elliotBraem elliotBraem merged commit 12c5c59 into main Jun 10, 2024
1 check passed
@elliotBraem elliotBraem deleted the feat/109-configurable-alias-prefix branch June 10, 2024 17:55
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.

Configurable Alias prefix
2 participants