Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimalist Command Line Interface #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bin/tld.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node

'use strict';

var tldjs = require('..');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it import index.js by default?

Copy link
Owner Author

@thom4parisot thom4parisot Sep 10, 2017

Choose a reason for hiding this comment

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

Yes it does import the index.js file of the parent path.

According to https://nodejs.org/api/modules.html#modules_folders_as_modules:

If there is no package.json file present in the directory, then Node.js will attempt to load an index.js or index.node file out of that directory.

Because there is a package.json file, if the main field would have declared a different filepath, the latter would have been loaded.


var output = tldjs.parse(process.argv[2] || '');

process.stdout.write(JSON.stringify(output, null, 2));
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"type": "git",
"url": "git://github.com/oncletom/tld.js.git"
},
"bin": {
"tldjs": "bin/tld.js"
},
"bugs": {
"url": "https://github.com/oncletom/tld.js/issues"
},
Expand Down