{"action":"created","issue":{"url":"https://api.github.com/repos/jkrems/proposal-pkg-exports/issues/23","repository_url":"https://api.github.com/repos/jkrems/proposal-pkg-exports","labels_url":"https://api.github.com/repos/jkrems/proposal-pkg-exports/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/jkrems/proposal-pkg-exports/issues/23/comments","events_url":"https://api.github.com/repos/jkrems/proposal-pkg-exports/issues/23/events","html_url":"https://github.com/jkrems/proposal-pkg-exports/pull/23","id":392461269,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5NzI3NDk5","number":23,"title":"Change to `npm init` behavior","user":{"login":"GeoffreyBooth","id":456802,"node_id":"MDQ6VXNlcjQ1NjgwMg==","avatar_url":"https://avatars2.githubusercontent.com/u/456802?v=4","gravatar_id":"","url":"https://api.github.com/users/GeoffreyBooth","html_url":"https://github.com/GeoffreyBooth","followers_url":"https://api.github.com/users/GeoffreyBooth/followers","following_url":"https://api.github.com/users/GeoffreyBooth/following{/other_user}","gists_url":"https://api.github.com/users/GeoffreyBooth/gists{/gist_id}","starred_url":"https://api.github.com/users/GeoffreyBooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeoffreyBooth/subscriptions","organizations_url":"https://api.github.com/users/GeoffreyBooth/orgs","repos_url":"https://api.github.com/users/GeoffreyBooth/repos","events_url":"https://api.github.com/users/GeoffreyBooth/events{/privacy}","received_events_url":"https://api.github.com/users/GeoffreyBooth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-19T06:39:38Z","updated_at":"2018-12-19T16:48:41Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/jkrems/proposal-pkg-exports/pulls/23","html_url":"https://github.com/jkrems/proposal-pkg-exports/pull/23","diff_url":"https://github.com/jkrems/proposal-pkg-exports/pull/23.diff","patch_url":"https://github.com/jkrems/proposal-pkg-exports/pull/23.patch"},"body":"https://github.com/jkrems/proposal-pkg-exports/blob/npm-init/README.md#npm-init\r\n\r\nSo I’m working on the 5-minute tutorial for creating a “hello world” server using @guybedford’s new implementation, and I’d love to be able to tell users to just run `npm init` to generate a `package.json`, and have that `package.json` be ESM-signifying by default. Then users wouldn’t need to manually edit their `package.json` files as part of starting a new project that uses ESM syntax.\r\n\r\nThe issue is that one of the questions posed by `init` is `entry point: (index.js)`, which by default produces `\"main\": \"index.js\"` in the generated `package.json`.\r\n\r\nPerhaps NPM is outside of Node’s purview, but I think once Node had its own ESM support the NPM team would probably be okay with this question’s output changing to be ESM instead. According to this package exports proposal, it would change to `\"exports\": \"./index.js\"` as the new ESM equivalent to the previous `\"main\": \"index.js\"`.\r\n\r\nAs `npm init` is targeted toward beginners, I don’t think it’s a good place to mention concepts like “CommonJS entry point” or desired package entry point parse goal. NPM should just keep it simple and output `\"exports\"` if it’s being run under an ESM-supporting version of Node. Unless there’s a concern about users being surprised that their new app/package won’t run under older versions of Node?\r\n\r\nAlso one could argue that perhaps it should be `index.mjs` instead; I think that’s the type of question best resolved by a user survey."},"comment":{"url":"https://api.github.com/repos/jkrems/proposal-pkg-exports/issues/comments/448664592","html_url":"https://github.com/jkrems/proposal-pkg-exports/pull/23#issuecomment-448664592","issue_url":"https://api.github.com/repos/jkrems/proposal-pkg-exports/issues/23","id":448664592,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODY2NDU5Mg==","user":{"login":"guybedford","id":598730,"node_id":"MDQ6VXNlcjU5ODczMA==","avatar_url":"https://avatars1.githubusercontent.com/u/598730?v=4","gravatar_id":"","url":"https://api.github.com/users/guybedford","html_url":"https://github.com/guybedford","followers_url":"https://api.github.com/users/guybedford/followers","following_url":"https://api.github.com/users/guybedford/following{/other_user}","gists_url":"https://api.github.com/users/guybedford/gists{/gist_id}","starred_url":"https://api.github.com/users/guybedford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guybedford/subscriptions","organizations_url":"https://api.github.com/users/guybedford/orgs","repos_url":"https://api.github.com/users/guybedford/repos","events_url":"https://api.github.com/users/guybedford/events{/privacy}","received_events_url":"https://api.github.com/users/guybedford/received_events","type":"User","site_admin":false},"created_at":"2018-12-19T16:48:41Z","updated_at":"2018-12-19T16:48:41Z","author_association":"CONTRIBUTOR","body":"Perhaps just have the first question be would you like to write ES modules or CommonJS?"}}
{"actor":{"display_login":"guybedford"}}