Skip to content

Commit 9289e4f

Browse files
radko93Facebook Github Bot 9
authored and
Facebook Github Bot 9
committed
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 #7127 Differential Revision: D3841253 Pulled By: mkonicek fbshipit-source-id: 677c7e4277c783180b04dee57d3ccd509e2b99d3
1 parent cc30d2f commit 9289e4f

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

local-cli/generator-android/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var path = require('path');
1414
var yeoman = require('yeoman-generator');
1515

1616
function validatePackageName(name) {
17-
if (!name.match(/^([a-zA-Z_$][a-zA-Z\d_$]*\.)+([a-zA-Z_$][a-zA-Z\d_$]*)$/)) {
17+
if (!name.match(/^([a-zA-Z][a-zA-Z\d_]*\.)+([a-zA-Z_][a-zA-Z\d_]*)$/)) {
1818
return false;
1919
}
2020
return true;

local-cli/generator-utils.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,7 @@ function walk(current) {
3737
return [].concat.apply([current], files);
3838
}
3939

40-
function validatePackageName(name) {
41-
if (!name.match(/^[$A-Z_][0-9A-Z_$]*$/i)) {
42-
console.error(
43-
'"%s" is not a valid name for a project. Please use a valid identifier ' +
44-
'name (alphanumeric).',
45-
name
46-
);
47-
process.exit(1);
48-
}
49-
}
50-
5140
module.exports = {
5241
copyAndReplace: copyAndReplace,
53-
walk: walk,
54-
validatePackageName: validatePackageName
42+
walk: walk
5543
};

0 commit comments

Comments
 (0)