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

[RFC] [BREAKING] mandatory default package identifier for Android #156

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Options:
--prefix <prefix> The prefix for the library module (Default: ``)
--module-name <moduleName> The module library package name to be used in package.json. Default: react-native-(name in param-case)
--module-prefix <modulePrefix> The module prefix for the library module, ignored if --module-name is specified (Default: `react-native`)
--package-identifier <packageIdentifier> (Android only!) The package name for the Android module (Default: `com.reactlibrary`)
--package-identifier <packageIdentifier> (Android only!) The package name for the Android module (Default: ``)
--platforms <platforms> Platforms the library module will be created for - comma separated (Default: `ios,android`)
--github-account <githubAccount> The github account where the library module is hosted (Default: `github_account`)
--author-name <authorName> The author's name (Default: `Your Name`)
Expand Down Expand Up @@ -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: `[email protected]`) */
Expand Down
2 changes: 1 addition & 1 deletion lib/cli-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <platforms>',
description: 'Platforms the library module will be created for - comma separated',
Expand Down
9 changes: 5 additions & 4 deletions lib/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down