codewars / discord-bot

Codewars Discord Bot
MIT License
22 stars 11 forks source link

Plop 3.x.x fails to recognize ".ts" extension #46

Closed DonaldKellett closed 2 years ago

DonaldKellett commented 2 years ago

Likely caused by #45

When running npx plop command or npx plop message-handler, Plop no longer recognizes ".ts" as a valid file extension:

$ npx plop command
[PLOP] Something went wrong with reading your plop file TypeError: Unknown file extension ".ts" for /home/dsleung/discord-bot/plopfile.ts
    at new NodeError (node:internal/errors:371:5)
    at Object.file: (node:internal/modules/esm/get_format:72:15)
    at defaultGetFormat (node:internal/modules/esm/get_format:85:38)
    at defaultLoad (node:internal/modules/esm/load:13:42)
    at ESMLoader.load (node:internal/modules/esm/loader:303:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:230:58)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:244:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
kazk commented 2 years ago

Change to plopfile.js, replace the types with jsdoc annotation:

export default function (
  /** @type {import('plop').NodePlopAPI} */
  plop
) {
}

https://github.com/plopjs/plop#typescript-declarations

Should be much faster too.