electron-forge / electron-forge-docs

:electron: Mirror for Electron Forge's GitBook documentation
https://electronforge.io
82 stars 143 forks source link

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

Open dyllandry opened 1 year ago

dyllandry commented 1 year ago

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)

erickzhao commented 1 year ago

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 commented 1 year ago

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.

dyllandry commented 1 year ago

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.

Ntropish commented 2 weeks ago

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