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

migrate remaining cjs files to mjs #20680

Merged
merged 9 commits into from
Dec 28, 2022
Merged

migrate remaining cjs files to mjs #20680

merged 9 commits into from
Dec 28, 2022

Conversation

Tcharl
Copy link
Contributor

@Tcharl Tcharl commented Dec 26, 2022

Migrate remaining cjs files to mjs


Please make sure the below checklist is followed for Pull Requests.

When you are still working on the PR, consider converting it to Draft (below reviewers) and adding skip-ci label, you can still see CI build result at your branch.

Copy link
Member

@mshima mshima left a comment

Choose a reason for hiding this comment

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

Use named exports instead of exporting a wrapper object.
It’s a bad practice, breaks esm lazy nature.

generators/generator-constants.mjs Outdated Show resolved Hide resolved
generators/generator-constants.mjs Outdated Show resolved Hide resolved
generators/utils.mjs Outdated Show resolved Hide resolved
generators/utils.mjs Outdated Show resolved Hide resolved
@Tcharl
Copy link
Contributor Author

Tcharl commented Dec 27, 2022

Done expert
waiting for this one and #20664 to be merged before continuing extracting functions.
My hope is that one day this platform will be easy to maintain with every business logic not duplicated and easily updatable ^^.
Keep up the fight, with faith we'll succeed!

@Tcharl Tcharl changed the title WIP - migrate remaining cjs files to mjs migrate remaining cjs files to mjs Dec 27, 2022
mshima
mshima previously approved these changes Dec 27, 2022
Copy link
Member

@mshima mshima left a comment

Choose a reason for hiding this comment

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

Just some FYI notes.

Great work.
LGTM.

@@ -25,7 +25,7 @@ import BaseGenerator from '../base/index.mjs';

import prompts from './prompts.mjs';
import statistics from '../statistics.cjs';
import constants from '../generator-constants.cjs';
import { CLIENT_MAIN_SRC_DIR, SERVER_MAIN_RES_DIR } from '../generator-constants.mjs';
Copy link
Member

Choose a reason for hiding this comment

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

We will need to use application variables instead of constants in the future for custom dirs.

const needleClient = require('./needle-client.cjs');
const constants = require('../../generator-constants.cjs');
import needleClient from './needle-client.mjs';
import { CLIENT_WEBPACK_DIR } from '../../generator-constants.mjs';
Copy link
Member

Choose a reason for hiding this comment

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

We will need to use application variables instead of constants in the future for custom dirs.

Comment on lines +135 to +139
application.MAIN_DIR = MAIN_DIR;
application.TEST_DIR = TEST_DIR;
application.SERVER_MAIN_RES_DIR = SERVER_MAIN_RES_DIR;
application.ANGULAR = ANGULAR;
application.REACT = REACT;
Copy link
Member

Choose a reason for hiding this comment

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

Will not be exported to clients in the future.
Should be variables.

Suggested change
application.MAIN_DIR = MAIN_DIR;
application.TEST_DIR = TEST_DIR;
application.SERVER_MAIN_RES_DIR = SERVER_MAIN_RES_DIR;
application.ANGULAR = ANGULAR;
application.REACT = REACT;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fully agree :-)

Co-authored-by: Daniel Franco <dandrfranco@gmail.com>
@Tcharl
Copy link
Contributor Author

Tcharl commented Dec 28, 2022

@DanielFran commited your change, can please you dismiss the review to merge?

DanielFran
DanielFran previously approved these changes Dec 28, 2022
@DanielFran
Copy link
Member

@Tcharl Can you fix the conflicts?

@DanielFran DanielFran merged commit c4da625 into jhipster:main Dec 28, 2022
@DanielFran DanielFran added this to the 8.0.0-beta.1 milestone Jun 9, 2023
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.

None yet

3 participants