mediamonks/pota

Cannot run plop in React template

Closed this issue · 2 comments

Expected result

When running npm run plop the plop wizard should start.

Actual result

The script will throw the following error:

> TS_NODE_PROJECT=tsconfig.tools.json node --loader ts-node/esm ./scripts/plop.ts

(node:51655) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/mickjasker/Documents/projects/video-editor/node_modules/ts-node/src/index.ts:820
    return new TSError(diagnosticText, diagnosticCodes);
           ^
TSError: ⨯ Unable to compile TypeScript:
error TS5083: Cannot read file '/Users/mickjasker/Documents/projects/video-editor/tsconfig.tools.json'.

    at createTSError (/Users/mickjasker/Documents/projects/video-editor/node_modules/ts-node/src/index.ts:820:12)
    at reportTSError (/Users/mickjasker/Documents/projects/video-editor/node_modules/ts-node/src/index.ts:824:19)
    at createFromPreloadedConfig (/Users/mickjasker/Documents/projects/video-editor/node_modules/ts-node/src/index.ts:835:36)
    at create (/Users/mickjasker/Documents/projects/video-editor/node_modules/ts-node/src/index.ts:597:10)
    at register (/Users/mickjasker/Documents/projects/video-editor/node_modules/ts-node/src/index.ts:564:15)
    at Object.registerAndCreateEsmHooks (/Users/mickjasker/Documents/projects/video-editor/node_modules/ts-node/src/esm.ts:126:34)
    at file:///Users/mickjasker/Documents/projects/video-editor/node_modules/ts-node/esm.mjs:8:7
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24) {
  diagnosticCodes: [ 5083 ]
}

Enviroment

MacOS 12.3.1
NodeJS 16.13.0
NPM 8.1.0

Possible solution

The problem seems to be that the tsconfig.tools.json is missing from the template causing the error.

Removing TS_NODE_PROJECT=tsconfig.tools.json from the script fixes the issue. If there is no other reason to have a separate tsconfig for tools this should be updated in the package.json

Seems to be that tsconfig.tools.json was (accidentally?) removed in b9ff466

The muban template still had it at that time, but that was also removed in ac9069b

I presume leaving it in the react template was an oversight, and should indeed be removed there.

FYI: There is an open PR to change the plop integration, but that cannot be used yet: #46