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

[WIP] Implement plop base #1249

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

[WIP] Implement plop base #1249

wants to merge 14 commits into from

Conversation

ptrkdan
Copy link
Collaborator

@ptrkdan ptrkdan commented May 14, 2024

[WIP: DO NOT MERGE YET]

Pull Request Checklist

  • I have checked that this pull request is not a duplicate of a pre-existing pull request
  • I have self-reviewed my changes
    • There are no spelling mistakes
    • There are no remaining debug log prints (i.e. console.log())
    • Comments were written for complex code
  • I have checked that all tests are passing (for bug fixes and enhancements)
    • CLI Test (npm run test:cli)
    • Unit Test (npm run test:modules)
    • E2E Test (npm run e2e)
  • I have added and/or modified relevant tests for my changes (for bug fixes and enhancements)
  • I have added and/or modified relevant documentations for my changes (if necessary)

Description

Context

Resolves #(issue)

Before

After

⚠️ Breaking changes

Notes

Copy link

changeset-bot bot commented May 14, 2024

🦋 Changeset detected

Latest commit: ef4f7e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
start-frontend Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

packages/start-frontend/src/index.ts Outdated Show resolved Hide resolved
.prettierignore Show resolved Hide resolved
@@ -1,7 +1,8 @@
{
"extends": "tsconfig/library.json",
"compilerOptions": {
"rootDir": "."
"rootDir": ".",
"module": "ESNext"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To allow the (dynamic) import of node-plop

@@ -326,6 +327,16 @@ async function run() {
removeEslintConfig();
}

const { default: nodePlop } = await import("node-plop");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Normally importing nodePlop throws an ERR_REQUIRE_ESM error. (See #1222 (comment))

In order to successfully build with node-plop, dynamic importing it seem to work, with the plopFile.ts exporting using CommonJS syntax.

@ptrkdan ptrkdan self-assigned this May 16, 2024
@ptrkdan ptrkdan added the CLI label May 16, 2024
@ptrkdan ptrkdan marked this pull request as ready for review May 22, 2024 10:35
@ptrkdan
Copy link
Collaborator Author

ptrkdan commented May 22, 2024

@jinmayamashita @seiya0914
I'm sorry it took long to open up the PR.
As I've mentioned in our meeting, I'm planning on using this branch/PR as a base branch for the plop implementation.
I will continue to implement the router templates on a child branch, and whoever is available may continue to work on the package.json templates.
Once the implementations are done, I will merge it all here, resolve the conflicts and then merge it to main.
However, please feel free to add your comments here! 🙏

Copy link
Collaborator

@jinmayamashita jinmayamashita left a comment

Choose a reason for hiding this comment

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

@ptrkdan LGTM, Thank you for your work! It's a good idea to create dynamic plops based on whether the router is selected or not.

I will continue to implement the router templates on a child branch, and whoever is available may continue to work on the package.json templates.

@ptrkdan @seiya0914
Since the packaging work is not a high priority, it doesn't need to be fully implemented here (though it might be worth raising as an issue).

This PR looks good, so it might be worth merging it first. Should we proceed with the packaging work?

@@ -7,5 +7,6 @@ export default defineConfig((options: Options) => ({
define: {
"process.env.BRANCH_NAME": `"${process.env.BRANCH_NAME}"`,
},
shims: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://tsup.egoist.dev/#inject-cjs-and-esm-shims
I believe it's enabled to support both ESM and CJS.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, without it, the build produces errors since the generated build includes import.meta.url

.prettierignore Show resolved Hide resolved
@ptrkdan ptrkdan linked an issue Jun 7, 2024 that may be closed by this pull request
@ptrkdan
Copy link
Collaborator Author

ptrkdan commented Sep 20, 2024

The CLI test is still failing despite merging the latest update from main.
https://github.com/monstar-lab-oss/ml-frontend/actions/runs/10935169811/job/30356449193

It looks like it's failing on the output of tree-cli. Going to investigate it further...
(It's passing locally.)

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

Successfully merging this pull request may close these issues.

[FEATURE] Use plop to generate react/base
2 participants