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

Feature: Path alias replacement #15

Merged
merged 2 commits into from
Jul 1, 2022
Merged

Conversation

oscar60310
Copy link
Contributor

@oscar60310 oscar60310 commented Jun 17, 2022

I created a simple script to replace the alias import such as "@vulcan/core/container" with relative pathes.

before

const template_engine_1 = require("@vulcan/core/template-engine");

after

const template_engine_1 = require("../../../../../../../lib/template-engine/index");

@oscar60310 oscar60310 requested review from kokokuo and wwwy3y3 June 17, 2022 07:19
@oscar60310 oscar60310 force-pushed the feature/path-alias-replacement branch from 6607919 to 32d8b72 Compare June 22, 2022 10:11
Copy link
Contributor

@kokokuo kokokuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, LGTM 👍

};

content = content.replace(requireRegex(packageName), replacePath);
content = content.replace(importRegex(packageName), (s, _, matched) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I check the MDN replace and another example, seems the matched is the first argument and original string is the latest argument, should we check it again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! I updated the variable name, but the logic was correct~

@oscar60310 oscar60310 force-pushed the feature/builder-pattern-te branch from e878082 to 20a8dce Compare June 30, 2022 08:25
@oscar60310 oscar60310 force-pushed the feature/path-alias-replacement branch from 32d8b72 to 48db8eb Compare July 1, 2022 09:46
@oscar60310 oscar60310 force-pushed the feature/path-alias-replacement branch from 48db8eb to 67598d7 Compare July 1, 2022 10:05
@oscar60310
Copy link
Contributor Author

@kokokuo I've fixed the issues.

Base automatically changed from feature/builder-pattern-te to develop July 1, 2022 10:29
@kokokuo kokokuo merged commit 173b194 into develop Jul 1, 2022
@kokokuo kokokuo deleted the feature/path-alias-replacement branch July 1, 2022 10:30
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.

None yet

2 participants