Android package name validator consistent with docs
Summary: I removed `$` and `_` (only from the starting substring) as they cannot be used in creating Android package name according to official android documentation. Also removed a duplicate function (there is the same one in `react-native-cli/index.js`). This fixes #7115. Closes https://github.com/facebook/react-native/pull/7127 Differential Revision: D3841253 Pulled By: mkonicek fbshipit-source-id: 677c7e4277c783180b04dee57d3ccd509e2b99d3
This commit is contained in:
parent
cc30d2f46d
commit
9289e4f7b2
|
@ -14,7 +14,7 @@ var path = require('path');
|
|||
var yeoman = require('yeoman-generator');
|
||||
|
||||
function validatePackageName(name) {
|
||||
if (!name.match(/^([a-zA-Z_$][a-zA-Z\d_$]*\.)+([a-zA-Z_$][a-zA-Z\d_$]*)$/)) {
|
||||
if (!name.match(/^([a-zA-Z][a-zA-Z\d_]*\.)+([a-zA-Z_][a-zA-Z\d_]*)$/)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -37,19 +37,7 @@ function walk(current) {
|
|||
return [].concat.apply([current], files);
|
||||
}
|
||||
|
||||
function validatePackageName(name) {
|
||||
if (!name.match(/^[$A-Z_][0-9A-Z_$]*$/i)) {
|
||||
console.error(
|
||||
'"%s" is not a valid name for a project. Please use a valid identifier ' +
|
||||
'name (alphanumeric).',
|
||||
name
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
copyAndReplace: copyAndReplace,
|
||||
walk: walk,
|
||||
validatePackageName: validatePackageName
|
||||
walk: walk
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue