From f5044ff30eb77820174184d5534580c10f4b1f7b Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Sun, 22 Sep 2019 18:52:37 -0400 Subject: [PATCH 1/2] mandatory default package identifier for Android with blank default package identifier --- README.md | 4 ++-- lib/cli-command.js | 2 +- lib/lib.js | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fbddf347..4aef9c6a 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ Options: --prefix The prefix for the library module (Default: ``) --module-name The module library package name to be used in package.json. Default: react-native-(name in param-case) --module-prefix The module prefix for the library module, ignored if --module-name is specified (Default: `react-native`) - --package-identifier (Android only!) The package name for the Android module (Default: `com.reactlibrary`) + --package-identifier (Android only!) The package name for the Android module (Default: ``) --platforms Platforms the library module will be created for - comma separated (Default: `ios,android`) --github-account The github account where the library module is hosted (Default: `github_account`) --author-name The author's name (Default: `Your Name`) @@ -129,7 +129,7 @@ createLibraryModule({ moduleName: String, /* The module library package name to be used in package.json. Default: react-native-(name in param-case) */ modulePrefix: String, /* The module prefix for the library, ignored if moduleName is specified (Default: react-native) */ platforms: Array | String, /* Platforms the library will be created for. (Default: ['android', 'ios']) */ - packageIdentifier: String, /* (Android only!) The package name for the Android module (Default: com.reactlibrary) */ + packageIdentifier: String, /* (Android only!) The package name for the Android module (Default: ``) */ githubAccount: String, /* The github account where the library is hosted (Default: `github_account`) */ authorName: String, /* The author's name (Default: `Your Name`) */ authorEmail: String, /* The author's email (Default: `yourname@email.com`) */ diff --git a/lib/cli-command.js b/lib/cli-command.js index 197ee834..1ea3412c 100644 --- a/lib/cli-command.js +++ b/lib/cli-command.js @@ -70,7 +70,7 @@ ${postCreateInstructions(createOptions)}`); }, { command: '--package-identifier [packageIdentifier]', description: '(Android only!) The package name for the Android module', - default: 'com.reactlibrary', + default: `` }, { command: '--platforms ', description: 'Platforms the library module will be created for - comma separated', diff --git a/lib/lib.js b/lib/lib.js index 183136b0..cb0f477f 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -21,7 +21,7 @@ const normalizedOptions = require('./normalized-options'); const templates = require('../templates'); const exampleTemplates = require('../templates/example'); -const DEFAULT_PACKAGE_IDENTIFIER = 'com.reactlibrary'; +const DEFAULT_PACKAGE_IDENTIFIER = ``; const DEFAULT_PLATFORMS = ['android', 'ios']; const DEFAULT_GITHUB_ACCOUNT = 'github_account'; const DEFAULT_AUTHOR_NAME = 'Your Name'; @@ -83,9 +83,10 @@ const generateWithNormalizedOptions = ({ fs = fsExtra, // (this can be mocked out for testing purposes) execa = execaDefault, // (this can be mocked out for testing purposes) }) => { - if (packageIdentifier === DEFAULT_PACKAGE_IDENTIFIER) { - console.warn(`While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package - identifier, it is recommended to customize the package identifier.`); + if (!!platforms.indexOf('android') && !packageIdentifier) { + const message = `CREATE ERROR: no package identifier specified for Android`; + console.error(message); + throw new Error(message); } // Note that the some of these console log messages are done as From f34ba9b4a46d08f09ab277982254a4a15ba8c7fd Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Sun, 22 Sep 2019 19:01:07 -0400 Subject: [PATCH 2/2] with backticks in the updated if statement --- lib/lib.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lib.js b/lib/lib.js index cb0f477f..c7e5f8be 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -83,7 +83,7 @@ const generateWithNormalizedOptions = ({ fs = fsExtra, // (this can be mocked out for testing purposes) execa = execaDefault, // (this can be mocked out for testing purposes) }) => { - if (!!platforms.indexOf('android') && !packageIdentifier) { + if (!!platforms.indexOf(`android`) && !packageIdentifier) { const message = `CREATE ERROR: no package identifier specified for Android`; console.error(message); throw new Error(message);