electron-forge-docs icon indicating copy to clipboard operation
electron-forge-docs copied to clipboard

Command to create a project from the typescript template actually creates project from base template.

Open dyllandry opened this issue 2 years ago • 4 comments

I just read the getting started page and tried out the command for using the typescript template but it just ended up creating a project using the base template.

This command from the getting started page just creates a project with the base template:

npm init electron-app@latest my-app -- --template=webpack-typescript

Instead of that, this works, without the double dashes prior to the options:

npm init electron-app@latest my-app  --template=webpack-typescript

I'm using node v14.19.0 and npm 6.14.16 and my shell is zsh 5.8 (x86_64-apple-darwin21.0)

dyllandry avatar Jan 16 '23 12:01 dyllandry

Can't seem to repro on my end on NPM 8:

> npm init electron-app@latest my-app -- --template=webpack-typescript --force
✔ Locating custom template: "webpack-typescript"
✔ Initializing directory
  › ⚠ The specified path "/Users/erick.zhao/Developer/dump/my-app" is not empty. "force" was set to true, so proceeding to initialize. Files may be overwritten
✔ Preparing template
✔ Initializing template
✔ Installing template dependencies

> cat my-app/package.json | grep plugin-webpack
    "@electron-forge/plugin-webpack": "^6.0.4",

erickzhao avatar Jan 16 '23 20:01 erickzhao

Seems I can repro reliably on NPM 6, though. I think something changed with npm init between major versions. We should probably change the docs so that it can hopefully work with all NPM cersions.

erickzhao avatar Jan 16 '23 20:01 erickzhao

Yeah it worked for me as well when I swapped to node v16.19.0 using nvm which uses npm 8.19.3

Thanks for looking into this. I do think something in the docs would help, or some way of running thats npm version agnostic if possible.

dyllandry avatar Jan 17 '23 01:01 dyllandry

I'm using Node v20.11.1 and also found that this kind of command was making the base template.

I used this instead:

npx create-electron-app@latest my-app --template=vite-typescript

Ntropish avatar Jul 06 '24 13:07 Ntropish