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

[#88] Change Webpack to Vite #117

Merged
merged 25 commits into from
Jan 26, 2023

Conversation

malparty
Copy link
Member

@malparty malparty commented Jul 21, 2022

What happened 👀

  • Generate an app without any add-ons
  • Migrate this app to use Vite and copy it in the vite-template folder
  • Add templating scripts (download the folder from github, rename %APP_NAME% with the provided application name in some files, ...
  • Ensure CI test work
  • Ensure local test work
  • Ensure add-ons for version-control work
  • Ensure UI Framework add-ons work

Insight 📝

Proof Of Work 📹

To test with local changes in either the ./packages/cra-template or the ./vite-temaplte/ folders, use the following commands (this is documented in the packages/cli-tool/cli README.md file)

For Vite:

  # Assuming the repository `react-temapltes` is in `~/Documents/Source/`.
  # The generated app will be in `~/Documents/Source/vite-app`
  ./bin/dev generate vite-app ~/Documents/Source/ feature/gh88-replace-webpack-with-vite

For Create React App (Webpack):

  # Assuming the repository `react-temapltes` is in `~/Documents/Source/`.
  # The generated app will be in `~/Documents/Source/webpack-app`
  ./bin/dev generate webpack-app ~/Documents/Source/ file:react-templates/packages/cra-template

I can create a WebPack (CRA) app

image

I can create a Vite app

image

Tests on a new project are passing ✅

image

@malparty malparty self-assigned this Jul 21, 2022
@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch 3 times, most recently from efead03 to e9e1d74 Compare July 21, 2022 09:24
@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch from e9e1d74 to 12e8579 Compare July 21, 2022 09:32
@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch 2 times, most recently from 957d319 to 69bc71f Compare July 22, 2022 03:06
@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch 2 times, most recently from 7de1f68 to b02c927 Compare July 25, 2022 09:35
@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch from b02c927 to abadc8a Compare July 25, 2022 09:37
@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch from efb6d69 to 40f2fff Compare July 25, 2022 10:44
@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch 10 times, most recently from 2770a85 to 9f2209a Compare July 29, 2022 06:50
@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch from 86ed083 to 1742bce Compare August 3, 2022 10:29
@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch from 9162189 to f17b325 Compare August 4, 2022 04:44
@malparty malparty marked this pull request as ready for review August 4, 2022 04:44
packages/cli-tool/README.md Outdated Show resolved Hide resolved
replaceLine(
indexScssPath,
`import 'assets/stylesheets/application.scss';`,
`import 'assets/stylesheets/application.css';`,
);
replaceLine(indexScssPath, `import '@/dummy.scss';`, `import '@/dummy.css';`);

// When using Vite
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should be doing it under if condition? I understand that it will not replace the content for the opposite case. Does this plugin have information on what we are using, vite or webpack?

Copy link
Member Author

Choose a reason for hiding this comment

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

8999c21 ✅ ;-)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is a wrong commit :) And I don't see fixes for it in other commits. I don't insist on it, just raised a question to consider whether it will be better or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

ca7ea8c ✅ 🙇

packages/cli-tool/src/template/initialize-cra-app.ts Outdated Show resolved Hide resolved
vite-template/.gitignore Show resolved Hide resolved
Copy link
Contributor

@hoangmirs hoangmirs left a comment

Choose a reason for hiding this comment

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

Can we move the vite-template folder into packages just like cra-template? 🤔

branch: string;
};

const downloadTemplateRepository = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move these functions to a helper? Then we can re-use them later as well. Just need to pass an option object, and get the expected folder

Copy link
Member Author

@malparty malparty Aug 18, 2022

Choose a reason for hiding this comment

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

2efd4b5

Please help me to review if that fits what you had in mind. I don't really like the dependence with the run-command (and so the need for the dest argument)... but I think it is hard to do it differently 🤔

@malparty
Copy link
Member Author

malparty commented Aug 18, 2022

@hoangmirs if we move the vite-template folder into the packages folder, lerna will assum it is an npm package and it generates many errors... I started that way and realized it was wrong because this vite-template folder is just static files, it should not be published or considered to as a package 🤔

Chore created in:

@malparty malparty force-pushed the feature/gh88-replace-webpack-with-vite branch from 272e58f to 2efd4b5 Compare August 18, 2022 08:07
@malparty malparty requested review from hoangmirs and Nihisil August 18, 2022 08:12
@malparty malparty requested a review from carryall August 19, 2022 07:56
Copy link
Contributor

@carryall carryall left a comment

Choose a reason for hiding this comment

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

I think we might need to do a POC to make sure we're okay to move from CRA to Vite then we can update our template structure 🤔

@carryall carryall merged commit 52288d1 into development Jan 26, 2023
@carryall carryall deleted the feature/gh88-replace-webpack-with-vite branch January 26, 2023 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change Webpack to Vite
4 participants