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

Convert to ESM #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

selkasse
Copy link

@selkasse selkasse commented Jun 11, 2022

WHAT

πŸ€– Generated by Copilot at 331f473

The pull request switches the codebase and the template files to use ES modules syntax instead of CommonJS syntax, and adds the type field to the package.json files to enable this change. This improves the consistency, compatibility, and performance of the codebase and the generated CLI projects. The pull request also updates and reorganizes the dependencies and the shebang line to support the use of ES modules syntax.
​

πŸ€– Generated by Copilot at 331f473

require to import
ES modules everywhere
cutting edge in spring

WHY

Adds the necessary changes for loading dependencies via ESM

HOW

πŸ€– Generated by Copilot at 331f473

  • Enable ES modules syntax for the codebase and the template files by:
  • Adding the type field with the value module to the package.json files (link, link)
  • Updating the shebang lines to use the -S and --no-warnings flags for node (link, link)
  • Replacing require and module.exports statements with import and export statements (link, link, link, link, link, link, link, link, link, link, link, link)
  • Using the fs and url modules to read and parse the package.json files of the main project and the generated CLI projects (link, link)
  • Using the url module to get the current directory of the file (link)
  • Passing the import.meta object to the cli-meow-help package as an option (link, link)
  • Reorder and update the dependencies and devDependencies sections in the package.json file of the main project (link)
    • Update the pkgs array in the utils/generate.js file to match the upgraded versions (link)
  • Rename the Store class from the data-store package to datastore in the utils/ask.js file to avoid confusion with the native Store class in Node.js (link)

import copy from 'copy-template-dir';
import alert from 'cli-alerts';
import chalk from 'chalk';
// import generateJSON from './generateJSON.js';
Copy link
Owner

Choose a reason for hiding this comment

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

Might wanna remove this comment.

@ahmadawais ahmadawais added the enhancement New feature or request label Mar 28, 2023
@ahmadawais
Copy link
Owner

@selkasse thank you for this, I have been meaning to do this for a while now. Will find some time to review, there are a couple of optimizations I need here before I can merge.

Also looking to make it TypeScript friendly.

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

Successfully merging this pull request may close these issues.

None yet

2 participants