Preact-cli: preact create does not write the proper name in the package.json file

Created on 17 Oct 2017  Â·  5Comments  Â·  Source: preactjs/preact-cli

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Package.json name property is not overriden (i.e. it maintains the placeholder "name": "{{ name }}")

If the current behavior is a bug, please provide the steps to reproduce.

Run the following steps:

preact create default some-name
cd some-name
yarn

The following error is thrown:
error package.json: Name contains illegal characters

If we pass a --name parameter, all works as expected. E.g. preact create default some-name --name some-name.

What is the expected behavior?

Either reflect the parameter requirement in the documentation or automatically map the project name.

The name property should be overwritten in the package.json file:
{ "name": "some-name" ... }

Please mention other relevant information.

  • node 8.6.0
  • npm 5.5.1
  • yarn 1.2.1
  • MacOS Hight Sierra
bug

Most helpful comment

Thanks. Looks like I missed a default assignment.

In the meantime, use --name YourName. That will work.

All 5 comments

Thanks. Looks like I missed a default assignment.

In the meantime, use --name YourName. That will work.

Thanks @lukeed. Yes, I am using that parameter. Already edited the issue :)

I've came across this issue also, and seems like it silently fails to run npm install printing a ✔ Done!when it maybe should print an error. This is probably because of the invalid package.json and a permissive exec of npm install.

the problem also appears in manifest.json as:
"name": "{{ name }}",
"short_name": "{{ name }}",

@mutebg Correct. Just waiting on a fellow team member to scoot it in for a quick 2.0.2 fix

Was this page helpful?
0 / 5 - 0 ratings