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

Allow dots in bin names #7811

Merged
merged 6 commits into from Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions __tests__/__snapshots__/normalize-manifest.js.snap
Expand Up @@ -62,9 +62,12 @@ Array [

exports[`dangerous bin name: dangerous bin name 1`] = `
Array [
"foo: Invalid bin entry for \\".\\" (in \\"foo\\").",
"foo: Invalid bin entry for \\"..\\" (in \\"foo\\").",
"foo: Invalid bin entry for \\"/tmp/foo\\" (in \\"foo\\").",
"foo: Invalid bin entry for \\"../tmp/foo\\" (in \\"foo\\").",
"foo: Invalid bin entry for \\"tmp/../../foo\\" (in \\"foo\\").",
"foo: Invalid bin entry for \\"build:cli\\" (in \\"foo\\").",
"foo: No license field",
]
`;
Expand Down
@@ -1,9 +1,13 @@
{
"name": "foo",
"version": "",
"bin": {
"/tmp/foo": "main.js",
"../tmp/foo": "main.js",
"tmp/../../foo": "main.js"
}
"name": "foo",
"version": "",
"bin": {
".": "main.js",
"..": "main.js",
"/tmp/foo": "main.js",
"../tmp/foo": "main.js",
"tmp/../../foo": "main.js",
"build:cli": "main.js",
"build.cli": "main.js"
}
}
@@ -1,5 +1,7 @@
{
"name": "foo",
"version": "",
"bin": {}
"name": "foo",
"version": "",
"bin": {
"build.cli": "main.js"
}
}
2 changes: 1 addition & 1 deletion src/util/normalize-manifest/fix.js
Expand Up @@ -12,7 +12,7 @@ const semver = require('semver');
const path = require('path');
const url = require('url');

const VALID_BIN_KEYS = /^[a-z0-9_-]+$/i;
const VALID_BIN_KEYS = /^(?!\.{0,2}$)[a-z0-9._-]+$/i;

const LICENSE_RENAMES: {[key: string]: ?string} = {
'MIT/X11': 'MIT',
Expand Down