Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

npm init file. #43

Merged
merged 2 commits into from
Sep 29, 2016
Merged

npm init file. #43

merged 2 commits into from
Sep 29, 2016

Conversation

helio-frota
Copy link
Member

No description provided.

Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, with just a few things I'd like to see changed.

name: prompt('name', basename || package.name),
version: '0.0.1',
description: prompt(s => s),
main: prompt('entry point', 'index.js', ep => fs.writeFileSync(ep, '')),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we write the index.js file with a simple template like 'module.exports = exports = {};]\n` Just so it's non-empty and ends in a linefeed?

description: prompt(s => s),
main: prompt('entry point', 'index.js', ep => fs.writeFileSync(ep, '')),
author: 'Red Hat, Inc.',
license: 'Apache-2.0',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we write a LICENSE file that contains the following text?

Copyright 2016 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

'LICENSE',
'index.js'
],
bugs: {url: 'https://github.com/USER/' + basename + '/issues'},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not compute the base Github URL at the top of the script and use process.env.USER, then use that base here and in the couple of other places where the URL shows up (lines 24 and 33).

const user = process.env.USER || 'USER';
const repoUrl = `https://github.com/${user}/${basename}`;

Then,

bugs: {url: `${repoUrl}/issues`},

],
bugs: {url: 'https://github.com/USER/' + basename + '/issues'},
homepage: 'https://github.com/USER/' + basename,
keywords: prompt(s => s.split(/\s+/)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to get some text here for the user such as "enter keywords separated by a space"?

'tap-spec': '*',
tape: '*'
},
cleanup: function (cb) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the cleanup function do? Is it possible to display the resulting package.json and ask "is this OK?" like the default does?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what this cleanup does.
It already shows package.json and the question.
a

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh - don't know how I missed that!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np, all the others are done : ]

@@ -1,4 +1,28 @@
const fs = require('fs');
const execSync = require('child_process').execSync;

const gitUser = execSync('git config user.name').toString().replace('\n','');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this.
my machine username is different from github username so this solves the problem fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent

@lance
Copy link
Member

lance commented Sep 29, 2016

LGTM, thanks!

@lance lance merged commit 189cbc2 into bucharest-gold:master Sep 29, 2016
@helio-frota helio-frota deleted the npm-init branch September 29, 2016 14:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants