From f0acccad94fe3e1456543801079f4af1c8194282 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 13 Aug 2020 20:03:56 -0400 Subject: [PATCH 01/17] rename --module-name option to --package-name --- README.md | 8 +++---- lib/cli-command.js | 22 +++++++++---------- lib/lib.js | 20 ++++++++--------- lib/normalized-options.js | 6 ++--- templates/example.js | 10 ++++----- templates/general.js | 22 +++++++++---------- templates/ios.js | 12 +++++----- .../create-with-module-name.test.js.snap | 2 +- .../create-with-module-name.test.js | 4 ++-- 9 files changed, 53 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index e80055f6..b0485990 100644 --- a/README.md +++ b/README.md @@ -88,11 +88,11 @@ Usage: create-react-native-module [options] Options: -V, --version output the version number - --module-name The module package name to be used in package.json. Default: react-native-(name in param-case) + --package-name The module package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) --prefix DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if --object-class-name is specified (Default: ``) - --module-prefix The prefix of the generated module package name, ignored if --module-name is specified (Default: `react-native`) + --module-prefix The prefix of the generated module package name, ignored if --package-name is specified (Default: `react-native`) --package-identifier [Android] The Java package identifier used by the Android module (Default: `com.reactlibrary`) --platforms Platforms the library module will be created for - comma separated (Default: `ios,android`) --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) @@ -126,11 +126,11 @@ createLibraryModule({ ```javascript { name: String, /* The name of the library (mandatory) */ - moduleName: String, /* The module package name to be used in package.json. Default: react-native-(name in param-case) */ + packageName: String, /* The module package name to be used in package.json. Default: react-native-(name in param-case) */ view: Boolean, /* Generate the package as a very simple native view component (Default: false) */ objectClassName: String, /* The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) */ prefix: String, /* DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if objectClassName is specified (Default: ``) */ - modulePrefix: String, /* The prefix of the generated module package name, ignored if moduleName is specified (Default: `react-native`) */ + modulePrefix: String, /* The prefix of the generated module package name, ignored if packageName is specified (Default: `react-native`) */ platforms: Array | String, /* Platforms the library will be created for. (Default: ['android', 'ios']) */ packageIdentifier: String, /* [Android] The Java package identifier used by the Android module (Default: com.reactlibrary) */ tvosEnabled: Boolean, /* Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) */ diff --git a/lib/cli-command.js b/lib/cli-command.js index ed88ff84..f3cc222a 100644 --- a/lib/cli-command.js +++ b/lib/cli-command.js @@ -9,7 +9,7 @@ const normalizedOptions = require('./normalized-options'); const createLibraryModule = require('./lib'); const postCreateInstructions = ({ - moduleName, + packageName, platforms, generateExample, exampleName @@ -18,21 +18,21 @@ const postCreateInstructions = ({ YOU'RE ALL SET! ` + (generateExample ? ` -${emoji.get('bulb')} check out the example app in ${moduleName}/${exampleName} +${emoji.get('bulb')} check out the example app in ${packageName}/${exampleName} ${emoji.get('bulb')} recommended: run Metro Bundler in a new shell -${logSymbols.info} (cd ${moduleName}/${exampleName} && yarn start) +${logSymbols.info} (cd ${packageName}/${exampleName} && yarn start) ${emoji.get('bulb')} enter the following commands to run the example app: -${logSymbols.info} cd ${moduleName}/${exampleName} +${logSymbols.info} cd ${packageName}/${exampleName} ${platforms.split(',').map(platform => `${logSymbols.info} react-native run-${platform}` ).join(` `)} ${logSymbols.warning} IMPORTANT NOTICES ${logSymbols.warning} After clean checkout, these first steps are needed: -${logSymbols.info} run Yarn in ${moduleName}/${exampleName}/ios -${logSymbols.info} (cd ${moduleName}/${exampleName} && yarn) -${logSymbols.info} do \`pod install\` for iOS in ${moduleName}/${exampleName}/ios -${logSymbols.info} cd ${moduleName}/${exampleName} +${logSymbols.info} run Yarn in ${packageName}/${exampleName}/ios +${logSymbols.info} (cd ${packageName}/${exampleName} && yarn) +${logSymbols.info} do \`pod install\` for iOS in ${packageName}/${exampleName}/ios +${logSymbols.info} cd ${packageName}/${exampleName} ${logSymbols.info} (cd ios && pod install) ${logSymbols.warning} KNOWN ISSUE with adding dependencies to the library root ${logSymbols.info} see https://github.com/brodybits/create-react-native-module/issues/308 @@ -68,7 +68,7 @@ module.exports = { const createOptions = normalizedOptions(preNormalizedOptions); - const rootModuleName = createOptions.moduleName; + const rootModuleName = createOptions.packageName; return createLibraryModule(createOptions).then(() => { log(` @@ -84,7 +84,7 @@ ${postCreateInstructions(createOptions)}`); }); }, options: [{ - command: '--module-name [moduleName]', + command: '--package-name [packageName]', description: 'The module package name to be used in package.json. Default: react-native-(name in param-case)', }, { command: '--view', @@ -98,7 +98,7 @@ ${postCreateInstructions(createOptions)}`); default: '', }, { command: '--module-prefix [modulePrefix]', - description: 'The prefix of the generated module package name, ignored if --module-name is specified', + description: 'The prefix of the generated module package name, ignored if --package-name is specified', default: 'react-native', }, { command: '--package-identifier [packageIdentifier]', diff --git a/lib/lib.js b/lib/lib.js index a4a464f7..7de63dea 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -65,7 +65,7 @@ const npmAddScriptSync = (packageJsonPath, script, fs) => { const generateWithNormalizedOptions = ({ name, prefix, // (only needed for logging purposes in this function) - moduleName, + packageName, objectClassName, modulePrefix, packageIdentifier = DEFAULT_PACKAGE_IDENTIFIER, @@ -102,8 +102,8 @@ const generateWithNormalizedOptions = ({ `CREATE new React Native module with the following options: name: ${name} - root moduleName - (full package name): ${moduleName} + root packageName + (full package name): ${packageName} is view: ${view} object class name prefix: ${prefix} object class name: ${objectClassName} @@ -161,7 +161,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} info('CREATE: Generating the React Native library module'); const generateLibraryModule = () => { - return fs.ensureDir(moduleName).then(() => { + return fs.ensureDir(packageName).then(() => { return Promise.all(templates.filter((template) => { if (template.platform) { return (platforms.indexOf(template.platform) >= 0); @@ -170,7 +170,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} return true; }).map((template) => { const templateArgs = { - moduleName, + packageName, objectClassName, packageIdentifier, // namespace - library API member removed since Windows platform @@ -186,7 +186,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} useAppleNetworking, }; - return renderTemplateIfValid(fs, moduleName, template, templateArgs); + return renderTemplateIfValid(fs, packageName, template, templateArgs); })); }); }; @@ -201,7 +201,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} info( `CREATE example app with the following command: ${exampleReactNativeInitCommand}`); - const execOptions = { cwd: `./${moduleName}`, stdio: 'inherit' }; + const execOptions = { cwd: `./${packageName}`, stdio: 'inherit' }; // (with the work done in a promise chain) return Promise.resolve() @@ -215,7 +215,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} .then(() => { // Render the example template const templateArgs = { - moduleName, + packageName, objectClassName, view, useAppleNetworking, @@ -226,7 +226,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} return Promise.all( exampleTemplates.map((template) => { - return renderTemplateIfValid(fs, moduleName, template, templateArgs); + return renderTemplateIfValid(fs, packageName, template, templateArgs); }) ); }) @@ -234,7 +234,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} // Adds and link the new library return new Promise((resolve, reject) => { // determine this path before the next steps: - const pathExampleApp = `./${moduleName}/${exampleName}`; + const pathExampleApp = `./${packageName}/${exampleName}`; // postinstall workaround script *only* needed in case // the DEPRECATED --example-file-linkage option diff --git a/lib/normalized-options.js b/lib/normalized-options.js index 0e9a857e..7aca9d55 100644 --- a/lib/normalized-options.js +++ b/lib/normalized-options.js @@ -6,7 +6,7 @@ const { pascalCase } = require('pascal-case'); const DEFAULT_MODULE_PREFIX = 'react-native'; module.exports = (options) => { - const { name, moduleName, objectClassName } = options; + const { name, packageName, objectClassName } = options; const prefix = options.prefix || ''; @@ -23,9 +23,9 @@ module.exports = (options) => { return Object.assign( { name, prefix, modulePrefix }, options, - moduleName + packageName ? {} - : { moduleName: `${modulePrefix}-${paramCase(name)}` }, + : { packageName: `${modulePrefix}-${paramCase(name)}` }, objectClassName ? {} : { objectClassName: `${prefix}${pascalCase(name)}` }, diff --git a/templates/example.js b/templates/example.js index 1a89deee..e939e207 100644 --- a/templates/example.js +++ b/templates/example.js @@ -119,7 +119,7 @@ module.exports = [{ // metro.config.js workarounds needed in case of `exampleFileLinkage: false`: name: ({ exampleName, exampleFileLinkage }) => exampleFileLinkage ? undefined : `${exampleName}/metro.config.js`, - content: ({ moduleName, exampleName }) => `// metro.config.js + content: ({ packageName, exampleName }) => `// metro.config.js // // with multiple workarounds for this issue with symlinks: // https://github.com/facebook/metro/issues/1 @@ -151,7 +151,7 @@ module.exports = { }, { name: ({ exampleName, writeExamplePodfile }) => writeExamplePodfile ? `${exampleName}/ios/Podfile` : undefined, - content: ({ moduleName, exampleName }) => `platform :ios, '10.0' + content: ({ packageName, exampleName }) => `platform :ios, '10.0' target '${exampleName}' do rn_path = '../node_modules/react-native' @@ -180,12 +180,12 @@ module.exports = { 'DevSupport' ] - pod '${moduleName}', :path => '../../${moduleName}.podspec' + pod '${packageName}', :path => '../../${packageName}.podspec' end `, }, { name: ({ exampleName }) => `${exampleName}/App.js`, - content: ({ moduleName, objectClassName, view }) => + content: ({ packageName, objectClassName, view }) => `/** * Sample React Native App * @@ -198,7 +198,7 @@ module.exports = { import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View } from 'react-native'; -import ${objectClassName} from '${moduleName}';` + +import ${objectClassName} from '${packageName}';` + (!view ? ` diff --git a/templates/general.js b/templates/general.js index 871cddff..ef611e64 100644 --- a/templates/general.js +++ b/templates/general.js @@ -1,19 +1,19 @@ module.exports = [{ name: () => 'README.md', - content: ({ moduleName, objectClassName }) => - `# ${moduleName} + content: ({ packageName, objectClassName }) => + `# ${packageName} ## Getting started -\`$ npm install ${moduleName} --save\` +\`$ npm install ${packageName} --save\` ### Mostly automatic installation -\`$ react-native link ${moduleName}\` +\`$ react-native link ${packageName}\` ## Usage \`\`\`javascript -import ${objectClassName} from '${moduleName}'; +import ${objectClassName} from '${packageName}'; // TODO: What to do with the module? ${objectClassName}; @@ -21,7 +21,7 @@ ${objectClassName}; `, }, { name: () => 'package.json', - content: ({ moduleName, platforms, githubAccount, authorName, authorEmail, license }) => { + content: ({ packageName, platforms, githubAccount, authorName, authorEmail, license }) => { const files = `[ "README.md",` + @@ -30,7 +30,7 @@ ${objectClassName}; "index.js"` + (platforms.indexOf('ios') >= 0 ? `, "ios", - "${moduleName}.podspec"` : ``) + ` + "${packageName}.podspec"` : ``) + ` ]`; const peerDependencies = @@ -46,8 +46,8 @@ ${objectClassName}; }`; return `{ - "name": "${moduleName}", - "title": "${moduleName.split('-').map(word => word[0].toUpperCase() + word.substr(1)).join(' ')}", + "name": "${packageName}", + "title": "${packageName.split('-').map(word => word[0].toUpperCase() + word.substr(1)).join(' ')}", "version": "1.0.0", "description": "TODO", "main": "index.js", @@ -57,8 +57,8 @@ ${objectClassName}; }, "repository": { "type": "git", - "url": "git+https://github.com/${githubAccount}/${moduleName}.git", - "baseUrl": "https://github.com/${githubAccount}/${moduleName}" + "url": "git+https://github.com/${githubAccount}/${packageName}.git", + "baseUrl": "https://github.com/${githubAccount}/${packageName}" }, "keywords": [ "react-native" diff --git a/templates/ios.js b/templates/ios.js index 2719bb65..ff38926c 100644 --- a/templates/ios.js +++ b/templates/ios.js @@ -1,24 +1,24 @@ module.exports = platform => [{ - name: ({ moduleName }) => `${moduleName}.podspec`, - content: ({ moduleName, tvosEnabled, githubAccount, authorName, authorEmail, license, useAppleNetworking }) => `require "json" + name: ({ packageName }) => `${packageName}.podspec`, + content: ({ packageName, tvosEnabled, githubAccount, authorName, authorEmail, license, useAppleNetworking }) => `require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) Pod::Spec.new do |s| - s.name = "${moduleName}" + s.name = "${packageName}" s.version = package["version"] s.summary = package["description"] s.description = <<-DESC - ${moduleName} + ${packageName} DESC - s.homepage = "https://github.com/${githubAccount}/${moduleName}" + s.homepage = "https://github.com/${githubAccount}/${packageName}" # brief license entry: s.license = "${license}" # optional - use expanded license entry instead: # s.license = { :type => "${license}", :file => "LICENSE" } s.authors = { "${authorName}" => "${authorEmail}" } s.platforms = { :ios => "9.0"${tvosEnabled ? `, :tvos => "10.0"` : ``} } - s.source = { :git => "https://github.com/${githubAccount}/${moduleName}.git", :tag => "#{s.version}" } + s.source = { :git => "https://github.com/${githubAccount}/${packageName}.git", :tag => "#{s.version}" } s.source_files = "ios/**/*.{h,c,m,swift}" s.requires_arc = true diff --git a/tests/with-injection/create/with-options/with-module-name/__snapshots__/create-with-module-name.test.js.snap b/tests/with-injection/create/with-options/with-module-name/__snapshots__/create-with-module-name.test.js.snap index 131a2139..19cd5cfb 100644 --- a/tests/with-injection/create/with-options/with-module-name/__snapshots__/create-with-module-name.test.js.snap +++ b/tests/with-injection/create/with-options/with-module-name/__snapshots__/create-with-module-name.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`create alice-bobbi module with moduleName: 'custom-native-module' 1`] = ` +exports[`create alice-bobbi module with packageName: 'custom-native-module' 1`] = ` Array [ "* ensureDir dir: custom-native-module ", diff --git a/tests/with-injection/create/with-options/with-module-name/create-with-module-name.test.js b/tests/with-injection/create/with-options/with-module-name/create-with-module-name.test.js index 93be07d6..f927b936 100644 --- a/tests/with-injection/create/with-options/with-module-name/create-with-module-name.test.js +++ b/tests/with-injection/create/with-options/with-module-name/create-with-module-name.test.js @@ -2,14 +2,14 @@ const lib = require('../../../../../lib/lib.js'); const ioInject = require('../../../helpers/io-inject.js'); -test(`create alice-bobbi module with moduleName: 'custom-native-module'`, async () => { +test(`create alice-bobbi module with packageName: 'custom-native-module'`, async () => { const mysnap = []; const inject = ioInject(mysnap); const options = { name: 'alice-bobbi', - moduleName: 'custom-native-module' + packageName: 'custom-native-module' }; await lib(options, inject); From ea62141e92b01573d08b55fed9026a6fb2110079 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 13 Aug 2020 20:46:16 -0400 Subject: [PATCH 02/17] remove --prefix option --- README.md | 2 -- lib/cli-command.js | 4 ---- lib/lib.js | 2 -- lib/normalized-options.js | 6 ++---- .../with-options/platforms-array/platforms-array.test.js | 1 - .../with-options/create-with-example-with-options.test.js | 1 - 6 files changed, 2 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b0485990..610496af 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,6 @@ Options: --package-name The module package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --prefix DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if --object-class-name is specified (Default: ``) --module-prefix The prefix of the generated module package name, ignored if --package-name is specified (Default: `react-native`) --package-identifier [Android] The Java package identifier used by the Android module (Default: `com.reactlibrary`) --platforms Platforms the library module will be created for - comma separated (Default: `ios,android`) @@ -129,7 +128,6 @@ createLibraryModule({ packageName: String, /* The module package name to be used in package.json. Default: react-native-(name in param-case) */ view: Boolean, /* Generate the package as a very simple native view component (Default: false) */ objectClassName: String, /* The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) */ - prefix: String, /* DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if objectClassName is specified (Default: ``) */ modulePrefix: String, /* The prefix of the generated module package name, ignored if packageName is specified (Default: `react-native`) */ platforms: Array | String, /* Platforms the library will be created for. (Default: ['android', 'ios']) */ packageIdentifier: String, /* [Android] The Java package identifier used by the Android module (Default: com.reactlibrary) */ diff --git a/lib/cli-command.js b/lib/cli-command.js index f3cc222a..c02d1fcc 100644 --- a/lib/cli-command.js +++ b/lib/cli-command.js @@ -92,10 +92,6 @@ ${postCreateInstructions(createOptions)}`); }, { command: '--object-class-name [objectClassName]', description: 'The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase)', - }, { - command: '--prefix [prefix]', - description: 'DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if --object-class-name is specified', - default: '', }, { command: '--module-prefix [modulePrefix]', description: 'The prefix of the generated module package name, ignored if --package-name is specified', diff --git a/lib/lib.js b/lib/lib.js index 7de63dea..30bf5567 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -64,7 +64,6 @@ const npmAddScriptSync = (packageJsonPath, script, fs) => { const generateWithNormalizedOptions = ({ name, - prefix, // (only needed for logging purposes in this function) packageName, objectClassName, modulePrefix, @@ -105,7 +104,6 @@ const generateWithNormalizedOptions = ({ root packageName (full package name): ${packageName} is view: ${view} - object class name prefix: ${prefix} object class name: ${objectClassName} library modulePrefix: ${modulePrefix} Android packageIdentifier: ${packageIdentifier} diff --git a/lib/normalized-options.js b/lib/normalized-options.js index 7aca9d55..66ca9be7 100644 --- a/lib/normalized-options.js +++ b/lib/normalized-options.js @@ -8,8 +8,6 @@ const DEFAULT_MODULE_PREFIX = 'react-native'; module.exports = (options) => { const { name, packageName, objectClassName } = options; - const prefix = options.prefix || ''; - const modulePrefix = options.modulePrefix || DEFAULT_MODULE_PREFIX; if (typeof name !== 'string') { @@ -21,14 +19,14 @@ module.exports = (options) => { // const namespace = options.namespace; return Object.assign( - { name, prefix, modulePrefix }, + { name, modulePrefix }, options, packageName ? {} : { packageName: `${modulePrefix}-${paramCase(name)}` }, objectClassName ? {} - : { objectClassName: `${prefix}${pascalCase(name)}` }, + : { objectClassName: `${pascalCase(name)}` }, // namespace - library API member removed since Windows platform // is now removed (may be added back someday in the future) // namespace diff --git a/tests/with-injection/create/with-options/platforms-array/platforms-array.test.js b/tests/with-injection/create/with-options/platforms-array/platforms-array.test.js index 461b9c78..36fdd575 100644 --- a/tests/with-injection/create/with-options/platforms-array/platforms-array.test.js +++ b/tests/with-injection/create/with-options/platforms-array/platforms-array.test.js @@ -11,7 +11,6 @@ test('create alice-bobbi module with config options for android,ios comma separa platforms: ['android', 'ios'], tvosEnabled: true, name: 'alice-bobbi', - prefix: 'ABC', githubAccount: 'alicebits', authorName: 'Alice', authorEmail: 'contact@alice.me', diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js b/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js index b988175c..17fc40c5 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js @@ -51,7 +51,6 @@ test('create alice-bobbi module using mocked lib with logging, with example, for const options = { platforms: ['android', 'ios'], name: 'alice-bobbi', - prefix: 'ABC', packageIdentifier: 'com.alicebits', tvosEnabled: true, githubAccount: 'alicebits', From c20223922a676e04d26941cb565bc73710277c08 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 13 Aug 2020 20:47:08 -0400 Subject: [PATCH 03/17] remove --module-prefix option --- README.md | 2 -- lib/cli-command.js | 4 ---- lib/lib.js | 2 -- lib/normalized-options.js | 6 ++---- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 610496af..7db84ee6 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,6 @@ Options: --package-name The module package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --module-prefix The prefix of the generated module package name, ignored if --package-name is specified (Default: `react-native`) --package-identifier [Android] The Java package identifier used by the Android module (Default: `com.reactlibrary`) --platforms Platforms the library module will be created for - comma separated (Default: `ios,android`) --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) @@ -128,7 +127,6 @@ createLibraryModule({ packageName: String, /* The module package name to be used in package.json. Default: react-native-(name in param-case) */ view: Boolean, /* Generate the package as a very simple native view component (Default: false) */ objectClassName: String, /* The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) */ - modulePrefix: String, /* The prefix of the generated module package name, ignored if packageName is specified (Default: `react-native`) */ platforms: Array | String, /* Platforms the library will be created for. (Default: ['android', 'ios']) */ packageIdentifier: String, /* [Android] The Java package identifier used by the Android module (Default: com.reactlibrary) */ tvosEnabled: Boolean, /* Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) */ diff --git a/lib/cli-command.js b/lib/cli-command.js index c02d1fcc..0edffb29 100644 --- a/lib/cli-command.js +++ b/lib/cli-command.js @@ -92,10 +92,6 @@ ${postCreateInstructions(createOptions)}`); }, { command: '--object-class-name [objectClassName]', description: 'The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase)', - }, { - command: '--module-prefix [modulePrefix]', - description: 'The prefix of the generated module package name, ignored if --package-name is specified', - default: 'react-native', }, { command: '--package-identifier [packageIdentifier]', description: '[Android] The Java package identifier used by the Android module', diff --git a/lib/lib.js b/lib/lib.js index 30bf5567..c4a487a3 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -66,7 +66,6 @@ const generateWithNormalizedOptions = ({ name, packageName, objectClassName, - modulePrefix, packageIdentifier = DEFAULT_PACKAGE_IDENTIFIER, // namespace - library API member removed since Windows platform // is now removed (may be added back someday in the future) @@ -105,7 +104,6 @@ const generateWithNormalizedOptions = ({ (full package name): ${packageName} is view: ${view} object class name: ${objectClassName} - library modulePrefix: ${modulePrefix} Android packageIdentifier: ${packageIdentifier} platforms: ${platforms} Apple tvosEnabled: ${tvosEnabled} diff --git a/lib/normalized-options.js b/lib/normalized-options.js index 66ca9be7..9b8a5fb8 100644 --- a/lib/normalized-options.js +++ b/lib/normalized-options.js @@ -8,8 +8,6 @@ const DEFAULT_MODULE_PREFIX = 'react-native'; module.exports = (options) => { const { name, packageName, objectClassName } = options; - const modulePrefix = options.modulePrefix || DEFAULT_MODULE_PREFIX; - if (typeof name !== 'string') { throw new TypeError("Please write your library's name"); } @@ -19,11 +17,11 @@ module.exports = (options) => { // const namespace = options.namespace; return Object.assign( - { name, modulePrefix }, + { name }, options, packageName ? {} - : { packageName: `${modulePrefix}-${paramCase(name)}` }, + : { packageName: `${DEFAULT_MODULE_PREFIX}-${paramCase(name)}` }, objectClassName ? {} : { objectClassName: `${pascalCase(name)}` }, From 5043ac0839c128ea98611348208947d786dda249 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 13 Aug 2020 20:48:02 -0400 Subject: [PATCH 04/17] remove tests with null prefix --- ...with-example-with-null-prefix.test.js.snap | 888 ---------------- ...eate-with-example-with-null-prefix.test.js | 19 - ...ate-with-example-with-options.test.js.snap | 980 ------------------ .../create-with-example-with-options.test.js | 60 -- 4 files changed, 1947 deletions(-) delete mode 100644 tests/with-injection/create/with-example/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-null-prefix.test.js.snap delete mode 100644 tests/with-injection/create/with-example/with-null-options/with-null-prefix/create-with-example-with-null-prefix.test.js delete mode 100644 tests/with-mocks/lib/create/with-example/with-logging/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-options.test.js.snap delete mode 100644 tests/with-mocks/lib/create/with-example/with-logging/with-null-options/with-null-prefix/create-with-example-with-options.test.js diff --git a/tests/with-injection/create/with-example/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-null-prefix.test.js.snap b/tests/with-injection/create/with-example/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-null-prefix.test.js.snap deleted file mode 100644 index cccbd568..00000000 --- a/tests/with-injection/create/with-example/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-null-prefix.test.js.snap +++ /dev/null @@ -1,888 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`create alice-bobbi module with example, with prefix: null 1`] = ` -Array [ - "* execa.commandSync command: react-native --version options: {\\"stdio\\":\\"inherit\\"} -", - "* execa.commandSync command: yarn --version options: {\\"stdio\\":\\"inherit\\"} -", - "* ensureDir dir: react-native-alice-bobbi -", - "* ensureDir dir: react-native-alice-bobbi/ -", - "* ensureDir dir: react-native-alice-bobbi/ -", - "* ensureDir dir: react-native-alice-bobbi/ -", - "* ensureDir dir: react-native-alice-bobbi/ -", - "* ensureDir dir: react-native-alice-bobbi/android/ -", - "* ensureDir dir: react-native-alice-bobbi/android/src/main/ -", - "* ensureDir dir: react-native-alice-bobbi/android/src/main/java/com/reactlibrary/ -", - "* ensureDir dir: react-native-alice-bobbi/android/src/main/java/com/reactlibrary/ -", - "* ensureDir dir: react-native-alice-bobbi/android/ -", - "* ensureDir dir: react-native-alice-bobbi/ -", - "* ensureDir dir: react-native-alice-bobbi/ios/ -", - "* ensureDir dir: react-native-alice-bobbi/ios/ -", - "* ensureDir dir: react-native-alice-bobbi/ios/AliceBobbi.xcworkspace/ -", - "* ensureDir dir: react-native-alice-bobbi/ios/AliceBobbi.xcodeproj/ -", - "* outputFile name: react-native-alice-bobbi/README.md -content: --------- -# react-native-alice-bobbi - -## Getting started - -\`$ npm install react-native-alice-bobbi --save\` - -### Mostly automatic installation - -\`$ react-native link react-native-alice-bobbi\` - -## Usage -\`\`\`javascript -import AliceBobbi from 'react-native-alice-bobbi'; - -// TODO: What to do with the module? -AliceBobbi; -\`\`\` - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/package.json -content: --------- -{ - \\"name\\": \\"react-native-alice-bobbi\\", - \\"title\\": \\"React Native Alice Bobbi\\", - \\"version\\": \\"1.0.0\\", - \\"description\\": \\"TODO\\", - \\"main\\": \\"index.js\\", - \\"files\\": [ - \\"README.md\\", - \\"android\\", - \\"index.js\\", - \\"ios\\", - \\"react-native-alice-bobbi.podspec\\" - ], - \\"scripts\\": { - \\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\" - }, - \\"repository\\": { - \\"type\\": \\"git\\", - \\"url\\": \\"git+https://github.com/github_account/react-native-alice-bobbi.git\\", - \\"baseUrl\\": \\"https://github.com/github_account/react-native-alice-bobbi\\" - }, - \\"keywords\\": [ - \\"react-native\\" - ], - \\"author\\": { - \\"name\\": \\"Your Name\\", - \\"email\\": \\"yourname@email.com\\" - }, - \\"license\\": \\"MIT\\", - \\"licenseFilename\\": \\"LICENSE\\", - \\"readmeFilename\\": \\"README.md\\", - \\"peerDependencies\\": { - \\"react\\": \\"^16.8.1\\", - \\"react-native\\": \\">=0.60.0-rc.0 <1.0.x\\" - }, - \\"devDependencies\\": { - \\"react\\": \\"^16.9.0\\", - \\"react-native\\": \\"^0.61.5\\" - } -} - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/index.js -content: --------- -import { NativeModules } from 'react-native'; - -const { AliceBobbi } = NativeModules; - -export default AliceBobbi; - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/.gitignore -content: --------- -# OSX -# -.DS_Store - -# node.js -# -node_modules/ -npm-debug.log -yarn-error.log - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -project.xcworkspace - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml - -# BUCK -buck-out/ -\\\\.buckd/ -*.keystore - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/android/build.gradle -content: --------- -// android/build.gradle - -// based on: -// -// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle -// original location: -// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle -// -// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle -// original location: -// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle - -def DEFAULT_COMPILE_SDK_VERSION = 28 -def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3' -def DEFAULT_MIN_SDK_VERSION = 16 -def DEFAULT_TARGET_SDK_VERSION = 28 - -def safeExtGet(prop, fallback) { - rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback -} - -apply plugin: 'com.android.library' -apply plugin: 'maven' - -buildscript { - // The Android Gradle plugin is only required when opening the android folder stand-alone. - // This avoids unnecessary downloads and potential conflicts when the library is included as a - // module dependency in an application project. - // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies - if (project == rootProject) { - repositories { - google() - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' - } - } -} - -apply plugin: 'com.android.library' -apply plugin: 'maven' - -android { - compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) - buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION) - defaultConfig { - minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) - targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) - versionCode 1 - versionName \\"1.0\\" - } - lintOptions { - abortOnError false - } -} - -repositories { - // ref: https://www.baeldung.com/maven-local-repository - mavenLocal() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url \\"$rootDir/../node_modules/react-native/android\\" - } - maven { - // Android JSC is installed from npm - url \\"$rootDir/../node_modules/jsc-android/dist\\" - } - google() - jcenter() -} - -dependencies { - //noinspection GradleDynamicVersion - implementation 'com.facebook.react:react-native:+' // From node_modules -} - -def configureReactNativePom(def pom) { - def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text) - - pom.project { - name packageJson.title - artifactId packageJson.name - version = packageJson.version - group = \\"com.reactlibrary\\" - description packageJson.description - url packageJson.repository.baseUrl - - licenses { - license { - name packageJson.license - url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename - distribution 'repo' - } - } - - developers { - developer { - id packageJson.author.username - name packageJson.author.name - } - } - } -} - -afterEvaluate { project -> - // some Gradle build hooks ref: - // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html - task androidJavadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += files(android.bootClasspath) - classpath += files(project.getConfigurations().getByName('compile').asList()) - include '**/*.java' - } - - task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { - classifier = 'javadoc' - from androidJavadoc.destinationDir - } - - task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.srcDirs - include '**/*.java' - } - - android.libraryVariants.all { variant -> - def name = variant.name.capitalize() - def javaCompileTask = variant.javaCompileProvider.get() - - task \\"jar\${name}\\"(type: Jar, dependsOn: javaCompileTask) { - from javaCompileTask.destinationDir - } - } - - artifacts { - archives androidSourcesJar - archives androidJavadocJar - } - - task installArchives(type: Upload) { - configuration = configurations.archives - repositories.mavenDeployer { - // Deploy to react-native-event-bridge/maven, ready to publish to npm - repository url: \\"file://\${projectDir}/../android/maven\\" - configureReactNativePom pom - } - } -} - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/android/src/main/AndroidManifest.xml -content: --------- - - - - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/android/src/main/java/com/reactlibrary/AliceBobbiModule.java -content: --------- -package com.reactlibrary; - -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; -import com.facebook.react.bridge.Callback; - -public class AliceBobbiModule extends ReactContextBaseJavaModule { - - private final ReactApplicationContext reactContext; - - public AliceBobbiModule(ReactApplicationContext reactContext) { - super(reactContext); - this.reactContext = reactContext; - } - - @Override - public String getName() { - return \\"AliceBobbi\\"; - } - - @ReactMethod - public void sampleMethod(String stringArgument, int numberArgument, Callback callback) { - // TODO: Implement some actually useful functionality - callback.invoke(\\"Received numberArgument: \\" + numberArgument + \\" stringArgument: \\" + stringArgument); - } -} - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/android/src/main/java/com/reactlibrary/AliceBobbiPackage.java -content: --------- -package com.reactlibrary; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; -import com.facebook.react.bridge.JavaScriptModule; - -public class AliceBobbiPackage implements ReactPackage { - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - return Arrays.asList(new AliceBobbiModule(reactContext)); - } - - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } -} - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/android/README.md -content: --------- -README -====== - -If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm: - -1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed -2. Be sure to have a \`local.properties\` file in this folder that points to the Android SDK and NDK -\`\`\` -ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle -sdk.dir=/Users/{username}/Library/Android/sdk -\`\`\` -3. Delete the \`maven\` folder -4. Run \`./gradlew installArchives\` -5. Verify that latest set of generated files is in the maven folder with the correct version number - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/react-native-alice-bobbi.podspec -content: --------- -require \\"json\\" - -package = JSON.parse(File.read(File.join(__dir__, \\"package.json\\"))) - -Pod::Spec.new do |s| - s.name = \\"react-native-alice-bobbi\\" - s.version = package[\\"version\\"] - s.summary = package[\\"description\\"] - s.description = <<-DESC - react-native-alice-bobbi - DESC - s.homepage = \\"https://github.com/github_account/react-native-alice-bobbi\\" - # brief license entry: - s.license = \\"MIT\\" - # optional - use expanded license entry instead: - # s.license = { :type => \\"MIT\\", :file => \\"LICENSE\\" } - s.authors = { \\"Your Name\\" => \\"yourname@email.com\\" } - s.platforms = { :ios => \\"9.0\\" } - s.source = { :git => \\"https://github.com/github_account/react-native-alice-bobbi.git\\", :tag => \\"#{s.version}\\" } - - s.source_files = \\"ios/**/*.{h,c,m,swift}\\" - s.requires_arc = true - - s.dependency \\"React\\" - # ... - # s.dependency \\"...\\" -end - - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.h -content: --------- -#import - -@interface AliceBobbi : NSObject - -@end - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.m -content: --------- -#import \\"AliceBobbi.h\\" - -@implementation AliceBobbi - -RCT_EXPORT_MODULE() - -RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnull NSNumber *)numberArgument callback:(RCTResponseSenderBlock)callback) -{ - // TODO: Implement some actually useful functionality - callback(@[[NSString stringWithFormat: @\\"numberArgument: %@ stringArgument: %@\\", numberArgument, stringArgument]]); -} - -@end - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.xcworkspace/contents.xcworkspacedata -content: --------- - - - - - - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.xcodeproj/project.pbxproj -content: --------- -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXCopyFilesBuildPhase section */ - 58B511D91A9E6C8500147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = \\"include/$(PRODUCT_NAME)\\"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libAliceBobbi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAliceBobbi.a; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 58B511D81A9E6C8500147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libAliceBobbi.a */, - ); - name = Products; - sourceTree = \\"\\"; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 134814211AA4EA7D00B7C361 /* Products */, - ); - sourceTree = \\"\\"; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* AliceBobbi */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 58B511D81A9E6C8500147676 /* Frameworks */, - 58B511D91A9E6C8500147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = AliceBobbi; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libAliceBobbi.a */; - productType = \\"com.apple.product-type.library.static\\"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0920; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */; - compatibilityVersion = \\"Xcode 3.2\\"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = \\"\\"; - projectRoot = \\"\\"; - targets = ( - 58B511DA1A9E6C8500147676 /* AliceBobbi */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = \\"gnu++0x\\"; - CLANG_CXX_LIBRARY = \\"libc++\\"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - \\"DEBUG=1\\", - \\"$(inherited)\\", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = \\"/usr/lib/swift $(inherited)\\"; - LIBRARY_SEARCH_PATHS = ( - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(inherited)\\\\\\"\\", - ); - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = \\"gnu++0x\\"; - CLANG_CXX_LIBRARY = \\"libc++\\"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = \\"/usr/lib/swift $(inherited)\\"; - LIBRARY_SEARCH_PATHS = ( - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(inherited)\\\\\\"\\", - ); - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - \\"$(inherited)\\", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - \\"$(SRCROOT)/../../../React/**\\", - \\"$(SRCROOT)/../../react-native/React/**\\", - ); - LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; - OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = AliceBobbi; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - \\"$(inherited)\\", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - \\"$(SRCROOT)/../../../React/**\\", - \\"$(SRCROOT)/../../react-native/React/**\\", - ); - LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; - OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = AliceBobbi; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} - -<<<<<<<< ======== >>>>>>>> -", - "* execa.commandSync command: react-native init example --version react-native@latest options: {\\"cwd\\":\\"./react-native-alice-bobbi\\",\\"stdio\\":\\"inherit\\"} -", - "* ensureDir dir: react-native-alice-bobbi/example/ -", - "* ensureDir dir: react-native-alice-bobbi/example/ -", - "* outputFile name: react-native-alice-bobbi/example/metro.config.js -content: --------- -// metro.config.js -// -// with multiple workarounds for this issue with symlinks: -// https://github.com/facebook/metro/issues/1 -// -// with thanks to @johnryan () -// for the pointers to multiple workaround solutions here: -// https://github.com/facebook/metro/issues/1#issuecomment-541642857 -// -// see also this discussion: -// https://github.com/brodybits/create-react-native-module/issues/232 - -const path = require('path') - -module.exports = { - // workaround for an issue with symlinks encountered starting with - // metro@0.55 / React Native 0.61 - // (not needed with React Native 0.60 / metro@0.54) - resolver: { - extraNodeModules: new Proxy( - {}, - { get: (_, name) => path.resolve('.', 'node_modules', name) } - ) - }, - - // quick workaround for another issue with symlinks - watchFolders: ['.', '..'] -} - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/example/App.js -content: --------- -/** - * Sample React Native App - * - * adapted from App.js generated by the following command: - * - * react-native init example - * - * https://github.com/facebook/react-native - */ - -import React, { Component } from 'react'; -import { Platform, StyleSheet, Text, View } from 'react-native'; -import AliceBobbi from 'react-native-alice-bobbi'; - -export default class App extends Component<{}> { - state = { - status: 'starting', - message: '--' - }; - componentDidMount() { - AliceBobbi.sampleMethod('Testing', 123, (message) => { - this.setState({ - status: 'native callback received', - message - }); - }); - } - render() { - return ( - - ☆AliceBobbi example☆ - STATUS: {this.state.status} - ☆NATIVE CALLBACK MESSAGE☆ - {this.state.message} - - ); - } -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: '#F5FCFF', - }, - welcome: { - fontSize: 20, - textAlign: 'center', - margin: 10, - }, - instructions: { - textAlign: 'center', - color: '#333333', - marginBottom: 5, - }, -}); - -<<<<<<<< ======== >>>>>>>> -", - "* execa.commandSync command: yarn add link:../ options: {\\"cwd\\":\\"./react-native-alice-bobbi/example\\",\\"stdio\\":\\"inherit\\"} -", - "* execa.commandSync command: pod --version options: {\\"cwd\\":\\"./react-native-alice-bobbi/example/ios\\",\\"stdio\\":\\"inherit\\"} -", - "* execa.commandSync command: pod install options: {\\"cwd\\":\\"./react-native-alice-bobbi/example/ios\\",\\"stdio\\":\\"inherit\\"} -", -] -`; diff --git a/tests/with-injection/create/with-example/with-null-options/with-null-prefix/create-with-example-with-null-prefix.test.js b/tests/with-injection/create/with-example/with-null-options/with-null-prefix/create-with-example-with-null-prefix.test.js deleted file mode 100644 index 9ba5abfd..00000000 --- a/tests/with-injection/create/with-example/with-null-options/with-null-prefix/create-with-example-with-null-prefix.test.js +++ /dev/null @@ -1,19 +0,0 @@ -const lib = require('../../../../../../lib/lib.js'); - -const ioInject = require('../../../../helpers/io-inject.js'); - -test('create alice-bobbi module with example, with prefix: null', async () => { - const mysnap = []; - - const inject = ioInject(mysnap); - - const options = { - name: 'alice-bobbi', - prefix: null, - generateExample: true, - }; - - await lib(options, inject); - - expect(mysnap).toMatchSnapshot(); -}); diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-options.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-options.test.js.snap deleted file mode 100644 index a1bc2654..00000000 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-options.test.js.snap +++ /dev/null @@ -1,980 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`create alice-bobbi module using mocked lib with logging, with example, with prefix: null 1`] = ` -Array [ - Object { - "warn": Array [ - "While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package - identifier, it is recommended to customize the package identifier.", - ], - }, - Object { - "info": Array [ - "CREATE new React Native module with the following options: - - name: alice-bobbi - root moduleName - (full package name): react-native-alice-bobbi - is view: false - object class name prefix: null - object class name: AliceBobbi - library modulePrefix: react-native -Android packageIdentifier: com.reactlibrary - platforms: android,ios - Apple tvosEnabled: false - authorName: Your Name - authorEmail: yourname@email.com - author githubAccount: github_account - license: MIT - useAppleNetworking: false - - generateExample: true - exampleFileLinkage: false - exampleName: example -exampleReactNativeVersion: react-native@latest - writeExamplePodfile: false -", - ], - }, - Object { - "info": Array [ - "CREATE: Check for valid react-native-cli tool version, as needed to generate the example project", - ], - }, - Object { - "commandSync": "react-native --version", - "options": Object { - "stdio": "inherit", - }, - }, - Object { - "info": Array [ - "react-native --version ok", - ], - }, - Object { - "info": Array [ - "CREATE: Check for valid Yarn CLI tool version, as needed to generate the example project", - ], - }, - Object { - "commandSync": "yarn --version", - "options": Object { - "stdio": "inherit", - }, - }, - Object { - "info": Array [ - "yarn --version ok", - ], - }, - Object { - "info": Array [ - "CREATE: Generating the React Native library module", - ], - }, - Object { - "ensureDir": "react-native-alice-bobbi", - }, - Object { - "ensureDir": "react-native-alice-bobbi/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/android/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/android/src/main/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/android/src/main/java/com/reactlibrary/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/android/src/main/java/com/reactlibrary/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/android/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/ios/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/ios/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/ios/AliceBobbi.xcworkspace/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/ios/AliceBobbi.xcodeproj/", - }, - Object { - "outputFileName": "react-native-alice-bobbi/README.md", - "theContent": "# react-native-alice-bobbi - -## Getting started - -\`$ npm install react-native-alice-bobbi --save\` - -### Mostly automatic installation - -\`$ react-native link react-native-alice-bobbi\` - -## Usage -\`\`\`javascript -import AliceBobbi from 'react-native-alice-bobbi'; - -// TODO: What to do with the module? -AliceBobbi; -\`\`\` -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/package.json", - "theContent": "{ - \\"name\\": \\"react-native-alice-bobbi\\", - \\"title\\": \\"React Native Alice Bobbi\\", - \\"version\\": \\"1.0.0\\", - \\"description\\": \\"TODO\\", - \\"main\\": \\"index.js\\", - \\"files\\": [ - \\"README.md\\", - \\"android\\", - \\"index.js\\", - \\"ios\\", - \\"react-native-alice-bobbi.podspec\\" - ], - \\"scripts\\": { - \\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\" - }, - \\"repository\\": { - \\"type\\": \\"git\\", - \\"url\\": \\"git+https://github.com/github_account/react-native-alice-bobbi.git\\", - \\"baseUrl\\": \\"https://github.com/github_account/react-native-alice-bobbi\\" - }, - \\"keywords\\": [ - \\"react-native\\" - ], - \\"author\\": { - \\"name\\": \\"Your Name\\", - \\"email\\": \\"yourname@email.com\\" - }, - \\"license\\": \\"MIT\\", - \\"licenseFilename\\": \\"LICENSE\\", - \\"readmeFilename\\": \\"README.md\\", - \\"peerDependencies\\": { - \\"react\\": \\"^16.8.1\\", - \\"react-native\\": \\">=0.60.0-rc.0 <1.0.x\\" - }, - \\"devDependencies\\": { - \\"react\\": \\"^16.9.0\\", - \\"react-native\\": \\"^0.61.5\\" - } -} -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/index.js", - "theContent": "import { NativeModules } from 'react-native'; - -const { AliceBobbi } = NativeModules; - -export default AliceBobbi; -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/.gitignore", - "theContent": "# OSX -# -.DS_Store - -# node.js -# -node_modules/ -npm-debug.log -yarn-error.log - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -project.xcworkspace - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml - -# BUCK -buck-out/ -\\\\.buckd/ -*.keystore -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/android/build.gradle", - "theContent": "// android/build.gradle - -// based on: -// -// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle -// original location: -// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle -// -// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle -// original location: -// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle - -def DEFAULT_COMPILE_SDK_VERSION = 28 -def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3' -def DEFAULT_MIN_SDK_VERSION = 16 -def DEFAULT_TARGET_SDK_VERSION = 28 - -def safeExtGet(prop, fallback) { - rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback -} - -apply plugin: 'com.android.library' -apply plugin: 'maven' - -buildscript { - // The Android Gradle plugin is only required when opening the android folder stand-alone. - // This avoids unnecessary downloads and potential conflicts when the library is included as a - // module dependency in an application project. - // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies - if (project == rootProject) { - repositories { - google() - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' - } - } -} - -apply plugin: 'com.android.library' -apply plugin: 'maven' - -android { - compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) - buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION) - defaultConfig { - minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) - targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) - versionCode 1 - versionName \\"1.0\\" - } - lintOptions { - abortOnError false - } -} - -repositories { - // ref: https://www.baeldung.com/maven-local-repository - mavenLocal() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url \\"$rootDir/../node_modules/react-native/android\\" - } - maven { - // Android JSC is installed from npm - url \\"$rootDir/../node_modules/jsc-android/dist\\" - } - google() - jcenter() -} - -dependencies { - //noinspection GradleDynamicVersion - implementation 'com.facebook.react:react-native:+' // From node_modules -} - -def configureReactNativePom(def pom) { - def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text) - - pom.project { - name packageJson.title - artifactId packageJson.name - version = packageJson.version - group = \\"com.reactlibrary\\" - description packageJson.description - url packageJson.repository.baseUrl - - licenses { - license { - name packageJson.license - url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename - distribution 'repo' - } - } - - developers { - developer { - id packageJson.author.username - name packageJson.author.name - } - } - } -} - -afterEvaluate { project -> - // some Gradle build hooks ref: - // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html - task androidJavadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += files(android.bootClasspath) - classpath += files(project.getConfigurations().getByName('compile').asList()) - include '**/*.java' - } - - task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { - classifier = 'javadoc' - from androidJavadoc.destinationDir - } - - task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.srcDirs - include '**/*.java' - } - - android.libraryVariants.all { variant -> - def name = variant.name.capitalize() - def javaCompileTask = variant.javaCompileProvider.get() - - task \\"jar\${name}\\"(type: Jar, dependsOn: javaCompileTask) { - from javaCompileTask.destinationDir - } - } - - artifacts { - archives androidSourcesJar - archives androidJavadocJar - } - - task installArchives(type: Upload) { - configuration = configurations.archives - repositories.mavenDeployer { - // Deploy to react-native-event-bridge/maven, ready to publish to npm - repository url: \\"file://\${projectDir}/../android/maven\\" - configureReactNativePom pom - } - } -} -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/android/src/main/AndroidManifest.xml", - "theContent": " - - -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/reactlibrary/AliceBobbiModule.java", - "theContent": "package com.reactlibrary; - -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; -import com.facebook.react.bridge.Callback; - -public class AliceBobbiModule extends ReactContextBaseJavaModule { - - private final ReactApplicationContext reactContext; - - public AliceBobbiModule(ReactApplicationContext reactContext) { - super(reactContext); - this.reactContext = reactContext; - } - - @Override - public String getName() { - return \\"AliceBobbi\\"; - } - - @ReactMethod - public void sampleMethod(String stringArgument, int numberArgument, Callback callback) { - // TODO: Implement some actually useful functionality - callback.invoke(\\"Received numberArgument: \\" + numberArgument + \\" stringArgument: \\" + stringArgument); - } -} -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/reactlibrary/AliceBobbiPackage.java", - "theContent": "package com.reactlibrary; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; -import com.facebook.react.bridge.JavaScriptModule; - -public class AliceBobbiPackage implements ReactPackage { - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - return Arrays.asList(new AliceBobbiModule(reactContext)); - } - - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } -} -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/android/README.md", - "theContent": "README -====== - -If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm: - -1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed -2. Be sure to have a \`local.properties\` file in this folder that points to the Android SDK and NDK -\`\`\` -ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle -sdk.dir=/Users/{username}/Library/Android/sdk -\`\`\` -3. Delete the \`maven\` folder -4. Run \`./gradlew installArchives\` -5. Verify that latest set of generated files is in the maven folder with the correct version number -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/react-native-alice-bobbi.podspec", - "theContent": "require \\"json\\" - -package = JSON.parse(File.read(File.join(__dir__, \\"package.json\\"))) - -Pod::Spec.new do |s| - s.name = \\"react-native-alice-bobbi\\" - s.version = package[\\"version\\"] - s.summary = package[\\"description\\"] - s.description = <<-DESC - react-native-alice-bobbi - DESC - s.homepage = \\"https://github.com/github_account/react-native-alice-bobbi\\" - # brief license entry: - s.license = \\"MIT\\" - # optional - use expanded license entry instead: - # s.license = { :type => \\"MIT\\", :file => \\"LICENSE\\" } - s.authors = { \\"Your Name\\" => \\"yourname@email.com\\" } - s.platforms = { :ios => \\"9.0\\" } - s.source = { :git => \\"https://github.com/github_account/react-native-alice-bobbi.git\\", :tag => \\"#{s.version}\\" } - - s.source_files = \\"ios/**/*.{h,c,m,swift}\\" - s.requires_arc = true - - s.dependency \\"React\\" - # ... - # s.dependency \\"...\\" -end - -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.h", - "theContent": "#import - -@interface AliceBobbi : NSObject - -@end -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.m", - "theContent": "#import \\"AliceBobbi.h\\" - -@implementation AliceBobbi - -RCT_EXPORT_MODULE() - -RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnull NSNumber *)numberArgument callback:(RCTResponseSenderBlock)callback) -{ - // TODO: Implement some actually useful functionality - callback(@[[NSString stringWithFormat: @\\"numberArgument: %@ stringArgument: %@\\", numberArgument, stringArgument]]); -} - -@end -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.xcworkspace/contents.xcworkspacedata", - "theContent": " - - - - -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.xcodeproj/project.pbxproj", - "theContent": "// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXCopyFilesBuildPhase section */ - 58B511D91A9E6C8500147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = \\"include/$(PRODUCT_NAME)\\"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libAliceBobbi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAliceBobbi.a; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 58B511D81A9E6C8500147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libAliceBobbi.a */, - ); - name = Products; - sourceTree = \\"\\"; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 134814211AA4EA7D00B7C361 /* Products */, - ); - sourceTree = \\"\\"; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* AliceBobbi */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 58B511D81A9E6C8500147676 /* Frameworks */, - 58B511D91A9E6C8500147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = AliceBobbi; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libAliceBobbi.a */; - productType = \\"com.apple.product-type.library.static\\"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0920; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */; - compatibilityVersion = \\"Xcode 3.2\\"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = \\"\\"; - projectRoot = \\"\\"; - targets = ( - 58B511DA1A9E6C8500147676 /* AliceBobbi */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = \\"gnu++0x\\"; - CLANG_CXX_LIBRARY = \\"libc++\\"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - \\"DEBUG=1\\", - \\"$(inherited)\\", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = \\"/usr/lib/swift $(inherited)\\"; - LIBRARY_SEARCH_PATHS = ( - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(inherited)\\\\\\"\\", - ); - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = \\"gnu++0x\\"; - CLANG_CXX_LIBRARY = \\"libc++\\"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = \\"/usr/lib/swift $(inherited)\\"; - LIBRARY_SEARCH_PATHS = ( - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(inherited)\\\\\\"\\", - ); - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - \\"$(inherited)\\", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - \\"$(SRCROOT)/../../../React/**\\", - \\"$(SRCROOT)/../../react-native/React/**\\", - ); - LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; - OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = AliceBobbi; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - \\"$(inherited)\\", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - \\"$(SRCROOT)/../../../React/**\\", - \\"$(SRCROOT)/../../react-native/React/**\\", - ); - LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; - OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = AliceBobbi; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} -", - }, - Object { - "info": Array [ - "CREATE example app with the following command: react-native init example --version react-native@latest", - ], - }, - Object { - "commandSync": "react-native init example --version react-native@latest", - "options": Object { - "cwd": "./react-native-alice-bobbi", - "stdio": "inherit", - }, - }, - Object { - "ensureDir": "react-native-alice-bobbi/example/", - }, - Object { - "ensureDir": "react-native-alice-bobbi/example/", - }, - Object { - "outputFileName": "react-native-alice-bobbi/example/metro.config.js", - "theContent": "// metro.config.js -// -// with multiple workarounds for this issue with symlinks: -// https://github.com/facebook/metro/issues/1 -// -// with thanks to @johnryan () -// for the pointers to multiple workaround solutions here: -// https://github.com/facebook/metro/issues/1#issuecomment-541642857 -// -// see also this discussion: -// https://github.com/brodybits/create-react-native-module/issues/232 - -const path = require('path') - -module.exports = { - // workaround for an issue with symlinks encountered starting with - // metro@0.55 / React Native 0.61 - // (not needed with React Native 0.60 / metro@0.54) - resolver: { - extraNodeModules: new Proxy( - {}, - { get: (_, name) => path.resolve('.', 'node_modules', name) } - ) - }, - - // quick workaround for another issue with symlinks - watchFolders: ['.', '..'] -} -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/example/App.js", - "theContent": "/** - * Sample React Native App - * - * adapted from App.js generated by the following command: - * - * react-native init example - * - * https://github.com/facebook/react-native - */ - -import React, { Component } from 'react'; -import { Platform, StyleSheet, Text, View } from 'react-native'; -import AliceBobbi from 'react-native-alice-bobbi'; - -export default class App extends Component<{}> { - state = { - status: 'starting', - message: '--' - }; - componentDidMount() { - AliceBobbi.sampleMethod('Testing', 123, (message) => { - this.setState({ - status: 'native callback received', - message - }); - }); - } - render() { - return ( - - ☆AliceBobbi example☆ - STATUS: {this.state.status} - ☆NATIVE CALLBACK MESSAGE☆ - {this.state.message} - - ); - } -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: '#F5FCFF', - }, - welcome: { - fontSize: 20, - textAlign: 'center', - margin: 10, - }, - instructions: { - textAlign: 'center', - color: '#333333', - marginBottom: 5, - }, -}); -", - }, - Object { - "info": Array [ - "Linking the new module library to the example app", - ], - }, - Object { - "commandSync": "yarn add link:../", - "options": Object { - "cwd": "./react-native-alice-bobbi/example", - "stdio": "inherit", - }, - }, - Object { - "log": Array [ - "check for valid pod version in ./react-native-alice-bobbi/example/ios", - ], - }, - Object { - "commandSync": "pod --version", - "options": Object { - "cwd": "./react-native-alice-bobbi/example/ios", - "stdio": "inherit", - }, - }, - Object { - "log": Array [ - "running pod install in ./react-native-alice-bobbi/example/ios", - ], - }, - Object { - "commandSync": "pod install", - "options": Object { - "cwd": "./react-native-alice-bobbi/example/ios", - "stdio": "inherit", - }, - }, -] -`; diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-null-options/with-null-prefix/create-with-example-with-options.test.js b/tests/with-mocks/lib/create/with-example/with-logging/with-null-options/with-null-prefix/create-with-example-with-options.test.js deleted file mode 100644 index 6f719fbd..00000000 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-null-options/with-null-prefix/create-with-example-with-options.test.js +++ /dev/null @@ -1,60 +0,0 @@ -const lib = require('../../../../../../../../lib/lib.js'); - -// special compact mocks for this test: -const mysnap = []; -const mockpushit = x => mysnap.push(x); -jest.mock('fs-extra', () => ({ - outputFile: (outputFileName, theContent) => { - mockpushit({ - outputFileName: outputFileName.replace(/\\/g, '/'), - theContent - }); - return Promise.resolve(); - }, - ensureDir: (dir) => { - mockpushit({ ensureDir: dir.replace(/\\/g, '/') }); - return Promise.resolve(); - }, - readFileSync: (path) => { - mockpushit({ readFileSyncFromPath: path.replace(/\\/g, '/') }); - return `{ "name": "x", "scripts": { "test": "exit 1" } }`; - }, - writeFileSync: (path, json, options) => { - mockpushit({ - writeFileSyncToPath: path.replace(/\\/g, '/'), - json, - options - }); - }, -})); -jest.mock('execa', () => ({ - commandSync: (command, options) => { - mockpushit({ commandSync: command, options }); - } -})); -jest.mock('console', () => ({ - info: (...args) => { - mockpushit({ info: [].concat(args) }); - }, - log: (...args) => { - mockpushit({ log: [].concat(args) }); - }, - warn: (...args) => { - mockpushit({ warn: [].concat(args) }); - }, - error: (...args) => { - mockpushit({ error: [].concat(args) }); - }, -})); - -test('create alice-bobbi module using mocked lib with logging, with example, with prefix: null', async () => { - const options = { - name: 'alice-bobbi', - prefix: null, - generateExample: true, - }; - - await lib(options); - - expect(mysnap).toMatchSnapshot(); -}); From 588b3a391b5c0c331d127f5c31c242a5257767e3 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 13 Aug 2020 20:49:40 -0400 Subject: [PATCH 05/17] remove test with custom module prefix --- ...ate-with-custom-module-prefix.test.js.snap | 775 ------------------ .../create-with-custom-module-prefix.test.js | 18 - 2 files changed, 793 deletions(-) delete mode 100644 tests/with-injection/create/with-options/with-custom-module-prefix/__snapshots__/create-with-custom-module-prefix.test.js.snap delete mode 100644 tests/with-injection/create/with-options/with-custom-module-prefix/create-with-custom-module-prefix.test.js diff --git a/tests/with-injection/create/with-options/with-custom-module-prefix/__snapshots__/create-with-custom-module-prefix.test.js.snap b/tests/with-injection/create/with-options/with-custom-module-prefix/__snapshots__/create-with-custom-module-prefix.test.js.snap deleted file mode 100644 index 9a908323..00000000 --- a/tests/with-injection/create/with-options/with-custom-module-prefix/__snapshots__/create-with-custom-module-prefix.test.js.snap +++ /dev/null @@ -1,775 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`create alice-bobbi module with modulePrefix: 'custom-native' 1`] = ` -Array [ - "* ensureDir dir: custom-native-alice-bobbi -", - "* ensureDir dir: custom-native-alice-bobbi/ -", - "* ensureDir dir: custom-native-alice-bobbi/ -", - "* ensureDir dir: custom-native-alice-bobbi/ -", - "* ensureDir dir: custom-native-alice-bobbi/ -", - "* ensureDir dir: custom-native-alice-bobbi/android/ -", - "* ensureDir dir: custom-native-alice-bobbi/android/src/main/ -", - "* ensureDir dir: custom-native-alice-bobbi/android/src/main/java/com/reactlibrary/ -", - "* ensureDir dir: custom-native-alice-bobbi/android/src/main/java/com/reactlibrary/ -", - "* ensureDir dir: custom-native-alice-bobbi/android/ -", - "* ensureDir dir: custom-native-alice-bobbi/ -", - "* ensureDir dir: custom-native-alice-bobbi/ios/ -", - "* ensureDir dir: custom-native-alice-bobbi/ios/ -", - "* ensureDir dir: custom-native-alice-bobbi/ios/AliceBobbi.xcworkspace/ -", - "* ensureDir dir: custom-native-alice-bobbi/ios/AliceBobbi.xcodeproj/ -", - "* outputFile name: custom-native-alice-bobbi/README.md -content: --------- -# custom-native-alice-bobbi - -## Getting started - -\`$ npm install custom-native-alice-bobbi --save\` - -### Mostly automatic installation - -\`$ react-native link custom-native-alice-bobbi\` - -## Usage -\`\`\`javascript -import AliceBobbi from 'custom-native-alice-bobbi'; - -// TODO: What to do with the module? -AliceBobbi; -\`\`\` - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/package.json -content: --------- -{ - \\"name\\": \\"custom-native-alice-bobbi\\", - \\"title\\": \\"Custom Native Alice Bobbi\\", - \\"version\\": \\"1.0.0\\", - \\"description\\": \\"TODO\\", - \\"main\\": \\"index.js\\", - \\"files\\": [ - \\"README.md\\", - \\"android\\", - \\"index.js\\", - \\"ios\\", - \\"custom-native-alice-bobbi.podspec\\" - ], - \\"scripts\\": { - \\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\" - }, - \\"repository\\": { - \\"type\\": \\"git\\", - \\"url\\": \\"git+https://github.com/github_account/custom-native-alice-bobbi.git\\", - \\"baseUrl\\": \\"https://github.com/github_account/custom-native-alice-bobbi\\" - }, - \\"keywords\\": [ - \\"react-native\\" - ], - \\"author\\": { - \\"name\\": \\"Your Name\\", - \\"email\\": \\"yourname@email.com\\" - }, - \\"license\\": \\"MIT\\", - \\"licenseFilename\\": \\"LICENSE\\", - \\"readmeFilename\\": \\"README.md\\", - \\"peerDependencies\\": { - \\"react\\": \\"^16.8.1\\", - \\"react-native\\": \\">=0.60.0-rc.0 <1.0.x\\" - }, - \\"devDependencies\\": { - \\"react\\": \\"^16.9.0\\", - \\"react-native\\": \\"^0.61.5\\" - } -} - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/index.js -content: --------- -import { NativeModules } from 'react-native'; - -const { AliceBobbi } = NativeModules; - -export default AliceBobbi; - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/.gitignore -content: --------- -# OSX -# -.DS_Store - -# node.js -# -node_modules/ -npm-debug.log -yarn-error.log - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -project.xcworkspace - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml - -# BUCK -buck-out/ -\\\\.buckd/ -*.keystore - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/android/build.gradle -content: --------- -// android/build.gradle - -// based on: -// -// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle -// original location: -// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle -// -// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle -// original location: -// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle - -def DEFAULT_COMPILE_SDK_VERSION = 28 -def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3' -def DEFAULT_MIN_SDK_VERSION = 16 -def DEFAULT_TARGET_SDK_VERSION = 28 - -def safeExtGet(prop, fallback) { - rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback -} - -apply plugin: 'com.android.library' -apply plugin: 'maven' - -buildscript { - // The Android Gradle plugin is only required when opening the android folder stand-alone. - // This avoids unnecessary downloads and potential conflicts when the library is included as a - // module dependency in an application project. - // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies - if (project == rootProject) { - repositories { - google() - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' - } - } -} - -apply plugin: 'com.android.library' -apply plugin: 'maven' - -android { - compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) - buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION) - defaultConfig { - minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) - targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) - versionCode 1 - versionName \\"1.0\\" - } - lintOptions { - abortOnError false - } -} - -repositories { - // ref: https://www.baeldung.com/maven-local-repository - mavenLocal() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url \\"$rootDir/../node_modules/react-native/android\\" - } - maven { - // Android JSC is installed from npm - url \\"$rootDir/../node_modules/jsc-android/dist\\" - } - google() - jcenter() -} - -dependencies { - //noinspection GradleDynamicVersion - implementation 'com.facebook.react:react-native:+' // From node_modules -} - -def configureReactNativePom(def pom) { - def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text) - - pom.project { - name packageJson.title - artifactId packageJson.name - version = packageJson.version - group = \\"com.reactlibrary\\" - description packageJson.description - url packageJson.repository.baseUrl - - licenses { - license { - name packageJson.license - url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename - distribution 'repo' - } - } - - developers { - developer { - id packageJson.author.username - name packageJson.author.name - } - } - } -} - -afterEvaluate { project -> - // some Gradle build hooks ref: - // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html - task androidJavadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += files(android.bootClasspath) - classpath += files(project.getConfigurations().getByName('compile').asList()) - include '**/*.java' - } - - task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { - classifier = 'javadoc' - from androidJavadoc.destinationDir - } - - task androidSourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.srcDirs - include '**/*.java' - } - - android.libraryVariants.all { variant -> - def name = variant.name.capitalize() - def javaCompileTask = variant.javaCompileProvider.get() - - task \\"jar\${name}\\"(type: Jar, dependsOn: javaCompileTask) { - from javaCompileTask.destinationDir - } - } - - artifacts { - archives androidSourcesJar - archives androidJavadocJar - } - - task installArchives(type: Upload) { - configuration = configurations.archives - repositories.mavenDeployer { - // Deploy to react-native-event-bridge/maven, ready to publish to npm - repository url: \\"file://\${projectDir}/../android/maven\\" - configureReactNativePom pom - } - } -} - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/android/src/main/AndroidManifest.xml -content: --------- - - - - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/android/src/main/java/com/reactlibrary/AliceBobbiModule.java -content: --------- -package com.reactlibrary; - -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; -import com.facebook.react.bridge.Callback; - -public class AliceBobbiModule extends ReactContextBaseJavaModule { - - private final ReactApplicationContext reactContext; - - public AliceBobbiModule(ReactApplicationContext reactContext) { - super(reactContext); - this.reactContext = reactContext; - } - - @Override - public String getName() { - return \\"AliceBobbi\\"; - } - - @ReactMethod - public void sampleMethod(String stringArgument, int numberArgument, Callback callback) { - // TODO: Implement some actually useful functionality - callback.invoke(\\"Received numberArgument: \\" + numberArgument + \\" stringArgument: \\" + stringArgument); - } -} - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/android/src/main/java/com/reactlibrary/AliceBobbiPackage.java -content: --------- -package com.reactlibrary; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; -import com.facebook.react.bridge.JavaScriptModule; - -public class AliceBobbiPackage implements ReactPackage { - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - return Arrays.asList(new AliceBobbiModule(reactContext)); - } - - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } -} - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/android/README.md -content: --------- -README -====== - -If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm: - -1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed -2. Be sure to have a \`local.properties\` file in this folder that points to the Android SDK and NDK -\`\`\` -ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle -sdk.dir=/Users/{username}/Library/Android/sdk -\`\`\` -3. Delete the \`maven\` folder -4. Run \`./gradlew installArchives\` -5. Verify that latest set of generated files is in the maven folder with the correct version number - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/custom-native-alice-bobbi.podspec -content: --------- -require \\"json\\" - -package = JSON.parse(File.read(File.join(__dir__, \\"package.json\\"))) - -Pod::Spec.new do |s| - s.name = \\"custom-native-alice-bobbi\\" - s.version = package[\\"version\\"] - s.summary = package[\\"description\\"] - s.description = <<-DESC - custom-native-alice-bobbi - DESC - s.homepage = \\"https://github.com/github_account/custom-native-alice-bobbi\\" - # brief license entry: - s.license = \\"MIT\\" - # optional - use expanded license entry instead: - # s.license = { :type => \\"MIT\\", :file => \\"LICENSE\\" } - s.authors = { \\"Your Name\\" => \\"yourname@email.com\\" } - s.platforms = { :ios => \\"9.0\\" } - s.source = { :git => \\"https://github.com/github_account/custom-native-alice-bobbi.git\\", :tag => \\"#{s.version}\\" } - - s.source_files = \\"ios/**/*.{h,c,m,swift}\\" - s.requires_arc = true - - s.dependency \\"React\\" - # ... - # s.dependency \\"...\\" -end - - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/ios/AliceBobbi.h -content: --------- -#import - -@interface AliceBobbi : NSObject - -@end - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/ios/AliceBobbi.m -content: --------- -#import \\"AliceBobbi.h\\" - -@implementation AliceBobbi - -RCT_EXPORT_MODULE() - -RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnull NSNumber *)numberArgument callback:(RCTResponseSenderBlock)callback) -{ - // TODO: Implement some actually useful functionality - callback(@[[NSString stringWithFormat: @\\"numberArgument: %@ stringArgument: %@\\", numberArgument, stringArgument]]); -} - -@end - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/ios/AliceBobbi.xcworkspace/contents.xcworkspacedata -content: --------- - - - - - - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/ios/AliceBobbi.xcodeproj/project.pbxproj -content: --------- -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXCopyFilesBuildPhase section */ - 58B511D91A9E6C8500147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = \\"include/$(PRODUCT_NAME)\\"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libAliceBobbi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAliceBobbi.a; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 58B511D81A9E6C8500147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libAliceBobbi.a */, - ); - name = Products; - sourceTree = \\"\\"; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - 134814211AA4EA7D00B7C361 /* Products */, - ); - sourceTree = \\"\\"; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* AliceBobbi */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 58B511D81A9E6C8500147676 /* Frameworks */, - 58B511D91A9E6C8500147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = AliceBobbi; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libAliceBobbi.a */; - productType = \\"com.apple.product-type.library.static\\"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0920; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */; - compatibilityVersion = \\"Xcode 3.2\\"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = \\"\\"; - projectRoot = \\"\\"; - targets = ( - 58B511DA1A9E6C8500147676 /* AliceBobbi */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = \\"gnu++0x\\"; - CLANG_CXX_LIBRARY = \\"libc++\\"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - \\"DEBUG=1\\", - \\"$(inherited)\\", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = \\"/usr/lib/swift $(inherited)\\"; - LIBRARY_SEARCH_PATHS = ( - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(inherited)\\\\\\"\\", - ); - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = \\"gnu++0x\\"; - CLANG_CXX_LIBRARY = \\"libc++\\"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = \\"/usr/lib/swift $(inherited)\\"; - LIBRARY_SEARCH_PATHS = ( - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\\\\\\"\\", - \\"\\\\\\"$(inherited)\\\\\\"\\", - ); - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - \\"$(inherited)\\", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - \\"$(SRCROOT)/../../../React/**\\", - \\"$(SRCROOT)/../../react-native/React/**\\", - ); - LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; - OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = AliceBobbi; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - \\"$(inherited)\\", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - \\"$(SRCROOT)/../../../React/**\\", - \\"$(SRCROOT)/../../react-native/React/**\\", - ); - LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; - OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = AliceBobbi; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} - -<<<<<<<< ======== >>>>>>>> -", -] -`; diff --git a/tests/with-injection/create/with-options/with-custom-module-prefix/create-with-custom-module-prefix.test.js b/tests/with-injection/create/with-options/with-custom-module-prefix/create-with-custom-module-prefix.test.js deleted file mode 100644 index 87a53c6c..00000000 --- a/tests/with-injection/create/with-options/with-custom-module-prefix/create-with-custom-module-prefix.test.js +++ /dev/null @@ -1,18 +0,0 @@ -const lib = require('../../../../../lib/lib.js'); - -const ioInject = require('../../../helpers/io-inject.js'); - -test(`create alice-bobbi module with modulePrefix: 'custom-native'`, async () => { - const mysnap = []; - - const inject = ioInject(mysnap); - - const options = { - name: 'alice-bobbi', - modulePrefix: 'custom-native' - }; - - await lib(options, inject); - - expect(mysnap).toMatchSnapshot(); -}); From e200f244091f1e592b0977237cc00b2bb9075f62 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 13 Aug 2020 20:54:35 -0400 Subject: [PATCH 06/17] rename --package-identifier to --android-package-id --- README.md | 8 ++-- lib/cli-command.js | 2 +- lib/lib.js | 12 +++--- templates/android.js | 40 +++++++++---------- .../create-with-options-for-android.test.js | 2 +- .../create-with-example-with-options.test.js | 2 +- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 7db84ee6..8fe3dd35 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Options: --package-name The module package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --package-identifier [Android] The Java package identifier used by the Android module (Default: `com.reactlibrary`) + --android-package-id [Android] The Java package identifier used by the Android module (Default: `com.reactlibrary`) --platforms Platforms the library module will be created for - comma separated (Default: `ios,android`) --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account The github account where the library module is hosted (Default: `github_account`) @@ -128,7 +128,7 @@ createLibraryModule({ view: Boolean, /* Generate the package as a very simple native view component (Default: false) */ objectClassName: String, /* The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) */ platforms: Array | String, /* Platforms the library will be created for. (Default: ['android', 'ios']) */ - packageIdentifier: String, /* [Android] The Java package identifier used by the Android module (Default: com.reactlibrary) */ + androidPackageId: String, /* [Android] The Java package identifier used by the Android module (Default: com.reactlibrary) */ tvosEnabled: Boolean, /* Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) */ githubAccount: String, /* The github account where the library is hosted (Default: `github_account`) */ authorName: String, /* The author's name (Default: `Your Name`) */ @@ -150,7 +150,7 @@ createLibraryModule({ __Create the module with no view:__ ``` -create-react-native-module --prefix CB --package-identifier io.mylibrary --generate-example AliceHelper +create-react-native-module --prefix CB --android-package-id io.mylibrary --generate-example AliceHelper ``` The module would be generated in the `react-native-alice-helper` subdirectory, and the example test app would be in `react-native-alice-helper/example`. @@ -221,7 +221,7 @@ The example app shows the following indications: __Create the module with an extremely simple view:__ ``` -create-react-native-module --prefix CB --package-identifier io.mylibrary --view --generate-example CarolWidget +create-react-native-module --prefix CB --android-package-id io.mylibrary --view --generate-example CarolWidget ``` The module would be generated in the `react-native-carol-widget` subdirectory, and the example test app would be in `react-native-carol-widget/example`. diff --git a/lib/cli-command.js b/lib/cli-command.js index 0edffb29..5ea0215e 100644 --- a/lib/cli-command.js +++ b/lib/cli-command.js @@ -93,7 +93,7 @@ ${postCreateInstructions(createOptions)}`); command: '--object-class-name [objectClassName]', description: 'The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase)', }, { - command: '--package-identifier [packageIdentifier]', + command: '--android-package-id [androidPackageId]', description: '[Android] The Java package identifier used by the Android module', default: 'com.reactlibrary', }, { diff --git a/lib/lib.js b/lib/lib.js index c4a487a3..e3754b37 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -23,7 +23,7 @@ const normalizedOptions = require('./normalized-options'); const templates = require('../templates'); const exampleTemplates = require('../templates/example'); -const DEFAULT_PACKAGE_IDENTIFIER = 'com.reactlibrary'; +const DEFAULT_ANDROID_PACKAGE_ID = 'com.reactlibrary'; const DEFAULT_PLATFORMS = ['android', 'ios']; const DEFAULT_GITHUB_ACCOUNT = 'github_account'; const DEFAULT_AUTHOR_NAME = 'Your Name'; @@ -66,7 +66,7 @@ const generateWithNormalizedOptions = ({ name, packageName, objectClassName, - packageIdentifier = DEFAULT_PACKAGE_IDENTIFIER, + androidPackageId = DEFAULT_ANDROID_PACKAGE_ID, // namespace - library API member removed since Windows platform // is now removed (may be added back someday in the future) // namespace, @@ -87,8 +87,8 @@ 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) { - warn(`While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package + if (androidPackageId === DEFAULT_ANDROID_PACKAGE_ID) { + warn(`While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.`); } @@ -104,7 +104,7 @@ const generateWithNormalizedOptions = ({ (full package name): ${packageName} is view: ${view} object class name: ${objectClassName} -Android packageIdentifier: ${packageIdentifier} +Android androidPackageId: ${androidPackageId} platforms: ${platforms} Apple tvosEnabled: ${tvosEnabled} authorName: ${authorName} @@ -168,7 +168,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} const templateArgs = { packageName, objectClassName, - packageIdentifier, + androidPackageId, // namespace - library API member removed since Windows platform // is now removed (may be added back someday in the future) // namespace, diff --git a/templates/android.js b/templates/android.js index 40b32385..477f4bb2 100644 --- a/templates/android.js +++ b/templates/android.js @@ -1,6 +1,6 @@ module.exports = platform => [{ name: () => `${platform}/build.gradle`, - content: ({ packageIdentifier }) => `// ${platform}/build.gradle + content: ({ androidPackageId }) => `// ${platform}/build.gradle // based on: // @@ -84,7 +84,7 @@ def configureReactNativePom(def pom) { name packageJson.title artifactId packageJson.name version = packageJson.version - group = "${packageIdentifier}" + group = "${androidPackageId}" description packageJson.description url packageJson.repository.baseUrl @@ -152,19 +152,19 @@ afterEvaluate { project -> `, }, { name: () => `${platform}/src/main/AndroidManifest.xml`, - content: ({ packageIdentifier }) => ` + content: ({ androidPackageId }) => ` `, }, { // for module without view: - name: ({ objectClassName, packageIdentifier, view }) => + name: ({ objectClassName, androidPackageId, view }) => !view && - `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${objectClassName}Module.java`, - content: ({ objectClassName, packageIdentifier, view }) => + `${platform}/src/main/java/${androidPackageId.split('.').join('/')}/${objectClassName}Module.java`, + content: ({ objectClassName, androidPackageId, view }) => !view && - `package ${packageIdentifier}; + `package ${androidPackageId}; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; @@ -194,12 +194,12 @@ public class ${objectClassName}Module extends ReactContextBaseJavaModule { `, }, { // manager for view: - name: ({ objectClassName, packageIdentifier, view }) => + name: ({ objectClassName, androidPackageId, view }) => view && - `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${objectClassName}Manager.java`, - content: ({ objectClassName, packageIdentifier, view }) => + `${platform}/src/main/java/${androidPackageId.split('.').join('/')}/${objectClassName}Manager.java`, + content: ({ objectClassName, androidPackageId, view }) => view && - `package ${packageIdentifier}; + `package ${androidPackageId}; import android.view.View; @@ -228,12 +228,12 @@ public class ${objectClassName}Manager extends SimpleViewManager { `, }, { // package for module without view: - name: ({ objectClassName, packageIdentifier, view }) => + name: ({ objectClassName, androidPackageId, view }) => !view && - `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${objectClassName}Package.java`, - content: ({ objectClassName, packageIdentifier, view }) => + `${platform}/src/main/java/${androidPackageId.split('.').join('/')}/${objectClassName}Package.java`, + content: ({ objectClassName, androidPackageId, view }) => !view && - `package ${packageIdentifier}; + `package ${androidPackageId}; import java.util.Arrays; import java.util.Collections; @@ -259,12 +259,12 @@ public class ${objectClassName}Package implements ReactPackage { `, }, { // package for manager for view: - name: ({ objectClassName, packageIdentifier, view }) => + name: ({ objectClassName, androidPackageId, view }) => view && - `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${objectClassName}Package.java`, - content: ({ objectClassName, packageIdentifier, view }) => + `${platform}/src/main/java/${androidPackageId.split('.').join('/')}/${objectClassName}Package.java`, + content: ({ objectClassName, androidPackageId, view }) => view && - `package ${packageIdentifier}; + `package ${androidPackageId}; import java.util.Arrays; import java.util.Collections; diff --git a/tests/with-injection/create/with-options/for-android/create-with-options-for-android.test.js b/tests/with-injection/create/with-options/for-android/create-with-options-for-android.test.js index c4e33e3d..2bc3e177 100644 --- a/tests/with-injection/create/with-options/for-android/create-with-options-for-android.test.js +++ b/tests/with-injection/create/with-options/for-android/create-with-options-for-android.test.js @@ -10,7 +10,7 @@ test('create alice-bobbi module with config options for Android only', () => { const options = { platforms: ['android'], name: 'alice-bobbi', - packageIdentifier: 'com.alicebits', + androidPackageId: 'com.alicebits', githubAccount: 'alicebits', authorName: 'Alice', authorEmail: 'contact@alice.me', diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js b/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js index 17fc40c5..b3b2059c 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js @@ -51,7 +51,7 @@ test('create alice-bobbi module using mocked lib with logging, with example, for const options = { platforms: ['android', 'ios'], name: 'alice-bobbi', - packageIdentifier: 'com.alicebits', + androidPackageId: 'com.alicebits', tvosEnabled: true, githubAccount: 'alicebits', authorName: 'Alice', From 4d01da06be982f425487ea0a5c40939577b87bcd Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 13 Aug 2020 21:04:10 -0400 Subject: [PATCH 07/17] minor description updates --- README.md | 8 ++++---- lib/cli-command.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8fe3dd35..7484a8b1 100644 --- a/README.md +++ b/README.md @@ -88,10 +88,10 @@ Usage: create-react-native-module [options] Options: -V, --version output the version number - --package-name The module package name to be used in package.json. Default: react-native-(name in param-case) + --package-name The package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --android-package-id [Android] The Java package identifier used by the Android module (Default: `com.reactlibrary`) + --android-package-id The Java package identifier used by the Android module (Default: `com.reactlibrary`) --platforms Platforms the library module will be created for - comma separated (Default: `ios,android`) --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account The github account where the library module is hosted (Default: `github_account`) @@ -124,11 +124,11 @@ createLibraryModule({ ```javascript { name: String, /* The name of the library (mandatory) */ - packageName: String, /* The module package name to be used in package.json. Default: react-native-(name in param-case) */ + packageName: String, /* The package name to be used in package.json. Default: react-native-(name in param-case) */ view: Boolean, /* Generate the package as a very simple native view component (Default: false) */ objectClassName: String, /* The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) */ platforms: Array | String, /* Platforms the library will be created for. (Default: ['android', 'ios']) */ - androidPackageId: String, /* [Android] The Java package identifier used by the Android module (Default: com.reactlibrary) */ + androidPackageId: String, /* The Java package identifier used by the Android module (Default: com.reactlibrary) */ tvosEnabled: Boolean, /* Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) */ githubAccount: String, /* The github account where the library is hosted (Default: `github_account`) */ authorName: String, /* The author's name (Default: `Your Name`) */ diff --git a/lib/cli-command.js b/lib/cli-command.js index 5ea0215e..7544b488 100644 --- a/lib/cli-command.js +++ b/lib/cli-command.js @@ -85,7 +85,7 @@ ${postCreateInstructions(createOptions)}`); }, options: [{ command: '--package-name [packageName]', - description: 'The module package name to be used in package.json. Default: react-native-(name in param-case)', + description: 'The package name to be used in package.json. Default: react-native-(name in param-case)', }, { command: '--view', description: 'Generate the package as a very simple native view component', @@ -94,7 +94,7 @@ ${postCreateInstructions(createOptions)}`); description: 'The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase)', }, { command: '--android-package-id [androidPackageId]', - description: '[Android] The Java package identifier used by the Android module', + description: 'The Java package identifier used by the Android module', default: 'com.reactlibrary', }, { command: '--platforms ', From 9b5772f2d6630d2c370b55fcaa2097b2465e078d Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 13 Aug 2020 21:08:39 -0400 Subject: [PATCH 08/17] update test snapshots --- .../help/__snapshots__/cli-help.test.js.snap | 6 +- .../__snapshots__/cli-noargs.test.js.snap | 6 +- .../lib-cli-command-object-text.test.js.snap | 18 +---- .../platforms-array.test.js.snap | 66 +++++++-------- ...and-with-bogus-platforms-name.test.js.snap | 8 +- ...d-with-empty-platforms-string.test.js.snap | 8 +- ...mmand-with-logging-with-error.test.js.snap | 8 +- ...ram-with-defaults-for-android.test.js.snap | 28 +------ ...ram-with-example-with-logging.test.js.snap | 36 ++------- ...cli-program-with-missing-args.test.js.snap | 28 +------ ...te-with-example-with-defaults.test.js.snap | 8 +- .../with-yarn-error-logging.test.js.snap | 8 +- ...ate-with-example-with-options.test.js.snap | 80 +++++++++---------- 13 files changed, 110 insertions(+), 198 deletions(-) diff --git a/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap b/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap index ecabc79d..fa81aca3 100644 --- a/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap +++ b/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap @@ -7,12 +7,10 @@ creates a React Native library module for one or more platforms Options: -V, --version output the version number - --module-name [moduleName] The module package name to be used in package.json. Default: react-native-(name in param-case) + --package-name [packageName] The package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name [objectClassName] The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --prefix [prefix] DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if --object-class-name is specified (default: \\"\\") - --module-prefix [modulePrefix] The prefix of the generated module package name, ignored if --module-name is specified (default: \\"react-native\\") - --package-identifier [packageIdentifier] [Android] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") + --android-package-id [androidPackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") --platforms Platforms the library module will be created for - comma separated (default: \\"ios,android\\") --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account [githubAccount] The github account where the library module is hosted (default: \\"github_account\\") diff --git a/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap b/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap index a850969b..9907dcb7 100644 --- a/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap +++ b/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap @@ -7,12 +7,10 @@ creates a React Native library module for one or more platforms Options: -V, --version output the version number - --module-name [moduleName] The module package name to be used in package.json. Default: react-native-(name in param-case) + --package-name [packageName] The package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name [objectClassName] The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --prefix [prefix] DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if --object-class-name is specified (default: \\"\\") - --module-prefix [modulePrefix] The prefix of the generated module package name, ignored if --module-name is specified (default: \\"react-native\\") - --package-identifier [packageIdentifier] [Android] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") + --android-package-id [androidPackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") --platforms Platforms the library module will be created for - comma separated (default: \\"ios,android\\") --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account [githubAccount] The github account where the library module is hosted (default: \\"github_account\\") diff --git a/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap b/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap index fb8eedde..9b03d090 100644 --- a/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap +++ b/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap @@ -7,8 +7,8 @@ Object { "name": "create-library", "options": Array [ Object { - "command": "--module-name [moduleName]", - "description": "The module package name to be used in package.json. Default: react-native-(name in param-case)", + "command": "--package-name [packageName]", + "description": "The package name to be used in package.json. Default: react-native-(name in param-case)", }, Object { "command": "--view", @@ -19,19 +19,9 @@ Object { "description": "The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase)", }, Object { - "command": "--prefix [prefix]", - "default": "", - "description": "DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if --object-class-name is specified", - }, - Object { - "command": "--module-prefix [modulePrefix]", - "default": "react-native", - "description": "The prefix of the generated module package name, ignored if --module-name is specified", - }, - Object { - "command": "--package-identifier [packageIdentifier]", + "command": "--android-package-id [androidPackageId]", "default": "com.reactlibrary", - "description": "[Android] The Java package identifier used by the Android module", + "description": "The Java package identifier used by the Android module", }, Object { "command": "--platforms ", diff --git a/tests/with-injection/create/with-options/platforms-array/__snapshots__/platforms-array.test.js.snap b/tests/with-injection/create/with-options/platforms-array/__snapshots__/platforms-array.test.js.snap index df7addb7..28c21a9b 100644 --- a/tests/with-injection/create/with-options/platforms-array/__snapshots__/platforms-array.test.js.snap +++ b/tests/with-injection/create/with-options/platforms-array/__snapshots__/platforms-array.test.js.snap @@ -28,9 +28,9 @@ Array [ ", "* ensureDir dir: react-native-alice-bobbi/ios/ ", - "* ensureDir dir: react-native-alice-bobbi/ios/ABCAliceBobbi.xcworkspace/ + "* ensureDir dir: react-native-alice-bobbi/ios/AliceBobbi.xcworkspace/ ", - "* ensureDir dir: react-native-alice-bobbi/ios/ABCAliceBobbi.xcodeproj/ + "* ensureDir dir: react-native-alice-bobbi/ios/AliceBobbi.xcodeproj/ ", "* outputFile name: react-native-alice-bobbi/README.md content: @@ -47,10 +47,10 @@ content: ## Usage \`\`\`javascript -import ABCAliceBobbi from 'react-native-alice-bobbi'; +import AliceBobbi from 'react-native-alice-bobbi'; // TODO: What to do with the module? -ABCAliceBobbi; +AliceBobbi; \`\`\` <<<<<<<< ======== >>>>>>>> @@ -106,9 +106,9 @@ content: -------- import { NativeModules } from 'react-native'; -const { ABCAliceBobbi } = NativeModules; +const { AliceBobbi } = NativeModules; -export default ABCAliceBobbi; +export default AliceBobbi; <<<<<<<< ======== >>>>>>>> ", @@ -325,7 +325,7 @@ content: <<<<<<<< ======== >>>>>>>> ", - "* outputFile name: react-native-alice-bobbi/android/src/main/java/com/reactlibrary/ABCAliceBobbiModule.java + "* outputFile name: react-native-alice-bobbi/android/src/main/java/com/reactlibrary/AliceBobbiModule.java content: -------- package com.reactlibrary; @@ -335,18 +335,18 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.Callback; -public class ABCAliceBobbiModule extends ReactContextBaseJavaModule { +public class AliceBobbiModule extends ReactContextBaseJavaModule { private final ReactApplicationContext reactContext; - public ABCAliceBobbiModule(ReactApplicationContext reactContext) { + public AliceBobbiModule(ReactApplicationContext reactContext) { super(reactContext); this.reactContext = reactContext; } @Override public String getName() { - return \\"ABCAliceBobbi\\"; + return \\"AliceBobbi\\"; } @ReactMethod @@ -358,7 +358,7 @@ public class ABCAliceBobbiModule extends ReactContextBaseJavaModule { <<<<<<<< ======== >>>>>>>> ", - "* outputFile name: react-native-alice-bobbi/android/src/main/java/com/reactlibrary/ABCAliceBobbiPackage.java + "* outputFile name: react-native-alice-bobbi/android/src/main/java/com/reactlibrary/AliceBobbiPackage.java content: -------- package com.reactlibrary; @@ -373,10 +373,10 @@ import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import com.facebook.react.bridge.JavaScriptModule; -public class ABCAliceBobbiPackage implements ReactPackage { +public class AliceBobbiPackage implements ReactPackage { @Override public List createNativeModules(ReactApplicationContext reactContext) { - return Arrays.asList(new ABCAliceBobbiModule(reactContext)); + return Arrays.asList(new AliceBobbiModule(reactContext)); } @Override @@ -441,23 +441,23 @@ end <<<<<<<< ======== >>>>>>>> ", - "* outputFile name: react-native-alice-bobbi/ios/ABCAliceBobbi.h + "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.h content: -------- #import -@interface ABCAliceBobbi : NSObject +@interface AliceBobbi : NSObject @end <<<<<<<< ======== >>>>>>>> ", - "* outputFile name: react-native-alice-bobbi/ios/ABCAliceBobbi.m + "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.m content: -------- -#import \\"ABCAliceBobbi.h\\" +#import \\"AliceBobbi.h\\" -@implementation ABCAliceBobbi +@implementation AliceBobbi RCT_EXPORT_MODULE() @@ -471,20 +471,20 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu <<<<<<<< ======== >>>>>>>> ", - "* outputFile name: react-native-alice-bobbi/ios/ABCAliceBobbi.xcworkspace/contents.xcworkspacedata + "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.xcworkspace/contents.xcworkspacedata content: -------- + location = \\"group:AliceBobbi.xcodeproj\\"> <<<<<<<< ======== >>>>>>>> ", - "* outputFile name: react-native-alice-bobbi/ios/ABCAliceBobbi.xcodeproj/project.pbxproj + "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.xcodeproj/project.pbxproj content: -------- // !$*UTF8*$! @@ -508,7 +508,7 @@ content: /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libABCAliceBobbi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libABCAliceBobbi.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 134814201AA4EA6300B7C361 /* libAliceBobbi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAliceBobbi.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -525,7 +525,7 @@ content: 134814211AA4EA7D00B7C361 /* Products */ = { isa = PBXGroup; children = ( - 134814201AA4EA6300B7C361 /* libABCAliceBobbi.a */, + 134814201AA4EA6300B7C361 /* libAliceBobbi.a */, ); name = Products; sourceTree = \\"\\"; @@ -540,9 +540,9 @@ content: /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* ABCAliceBobbi */ = { + 58B511DA1A9E6C8500147676 /* AliceBobbi */ = { isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"ABCAliceBobbi\\" */; + buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */; buildPhases = ( 58B511D71A9E6C8500147676 /* Sources */, 58B511D81A9E6C8500147676 /* Frameworks */, @@ -552,9 +552,9 @@ content: ); dependencies = ( ); - name = ABCAliceBobbi; + name = AliceBobbi; productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libABCAliceBobbi.a */; + productReference = 134814201AA4EA6300B7C361 /* libAliceBobbi.a */; productType = \\"com.apple.product-type.library.static\\"; }; /* End PBXNativeTarget section */ @@ -571,7 +571,7 @@ content: }; }; }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"ABCAliceBobbi\\" */; + buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */; compatibilityVersion = \\"Xcode 3.2\\"; developmentRegion = en; hasScannedForEncodings = 0; @@ -584,7 +584,7 @@ content: projectDirPath = \\"\\"; projectRoot = \\"\\"; targets = ( - 58B511DA1A9E6C8500147676 /* ABCAliceBobbi */, + 58B511DA1A9E6C8500147676 /* AliceBobbi */, ); }; /* End PBXProject section */ @@ -722,7 +722,7 @@ content: ); LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = ABCAliceBobbi; + PRODUCT_NAME = AliceBobbi; SKIP_INSTALL = YES; }; name = Debug; @@ -738,7 +738,7 @@ content: ); LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = ABCAliceBobbi; + PRODUCT_NAME = AliceBobbi; SKIP_INSTALL = YES; }; name = Release; @@ -746,7 +746,7 @@ content: /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"ABCAliceBobbi\\" */ = { + 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */ = { isa = XCConfigurationList; buildConfigurations = ( 58B511ED1A9E6C8500147676 /* Debug */, @@ -755,7 +755,7 @@ content: defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"ABCAliceBobbi\\" */ = { + 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */ = { isa = XCConfigurationList; buildConfigurations = ( 58B511F01A9E6C8500147676 /* Debug */, diff --git a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap index 736d6613..5cde2d4e 100644 --- a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap +++ b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module with logging, with platforms: 'bogus' 1`] = ` Array [ Object { "warn": Array [ - "While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package + "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,11 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName + root packageName (full package name): react-native-alice-bobbi is view: false - object class name prefix: object class name: AliceBobbi - library modulePrefix: react-native -Android packageIdentifier: com.reactlibrary +Android androidPackageId: com.reactlibrary platforms: bogus Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap index 348df1db..f3ee07e9 100644 --- a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap +++ b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module with logging, with platforms: '' 1`] = ` Array [ Object { "warn": Array [ - "While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package + "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,11 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName + root packageName (full package name): react-native-alice-bobbi is view: false - object class name prefix: object class name: AliceBobbi - library modulePrefix: react-native -Android packageIdentifier: com.reactlibrary +Android androidPackageId: com.reactlibrary platforms: Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap b/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap index a5fd1296..b0ea37a2 100644 --- a/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap +++ b/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module with logging, with fs error (with defaults fo Array [ Object { "warn": Array [ - "While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package + "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,11 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName + root packageName (full package name): react-native-alice-bobbi is view: false - object class name prefix: object class name: AliceBobbi - library modulePrefix: react-native -Android packageIdentifier: com.reactlibrary +Android androidPackageId: com.reactlibrary platforms: android,ios Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap b/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap index 5f8121b6..9ed74f3a 100644 --- a/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap +++ b/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap @@ -30,8 +30,8 @@ Array [ Object { "option": Object { "args": Array [ - "--module-name [moduleName]", - "The module package name to be used in package.json. Default: react-native-(name in param-case)", + "--package-name [packageName]", + "The package name to be used in package.json. Default: react-native-(name in param-case)", [Function], undefined, ], @@ -60,28 +60,8 @@ Array [ Object { "option": Object { "args": Array [ - "--prefix [prefix]", - "DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if --object-class-name is specified", - [Function], - "", - ], - }, - }, - Object { - "option": Object { - "args": Array [ - "--module-prefix [modulePrefix]", - "The prefix of the generated module package name, ignored if --module-name is specified", - [Function], - "react-native", - ], - }, - }, - Object { - "option": Object { - "args": Array [ - "--package-identifier [packageIdentifier]", - "[Android] The Java package identifier used by the Android module", + "--android-package-id [androidPackageId]", + "The Java package identifier used by the Android module", [Function], "com.reactlibrary", ], diff --git a/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap b/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap index e3fbc78a..7af6621e 100644 --- a/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap +++ b/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap @@ -30,8 +30,8 @@ Array [ Object { "option": Object { "args": Array [ - "--module-name [moduleName]", - "The module package name to be used in package.json. Default: react-native-(name in param-case)", + "--package-name [packageName]", + "The package name to be used in package.json. Default: react-native-(name in param-case)", [Function], undefined, ], @@ -60,28 +60,8 @@ Array [ Object { "option": Object { "args": Array [ - "--prefix [prefix]", - "DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if --object-class-name is specified", - [Function], - "", - ], - }, - }, - Object { - "option": Object { - "args": Array [ - "--module-prefix [modulePrefix]", - "The prefix of the generated module package name, ignored if --module-name is specified", - [Function], - "react-native", - ], - }, - }, - Object { - "option": Object { - "args": Array [ - "--package-identifier [packageIdentifier]", - "[Android] The Java package identifier used by the Android module", + "--android-package-id [androidPackageId]", + "The Java package identifier used by the Android module", [Function], "com.reactlibrary", ], @@ -218,7 +198,7 @@ Array [ }, Object { "warn": Array [ - "While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package + "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -227,13 +207,11 @@ Array [ "CREATE new React Native module with the following options: name: test-package - root moduleName + root packageName (full package name): react-native-test-package is view: false - object class name prefix: object class name: TestPackage - library modulePrefix: react-native -Android packageIdentifier: com.reactlibrary +Android androidPackageId: com.reactlibrary platforms: android,ios Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap b/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap index 440aa269..8d3b5c8e 100644 --- a/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap +++ b/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap @@ -28,8 +28,8 @@ Array [ Object { "option": Object { "args": Array [ - "--module-name [moduleName]", - "The module package name to be used in package.json. Default: react-native-(name in param-case)", + "--package-name [packageName]", + "The package name to be used in package.json. Default: react-native-(name in param-case)", [Function], undefined, ], @@ -58,28 +58,8 @@ Array [ Object { "option": Object { "args": Array [ - "--prefix [prefix]", - "DEPRECATED: The prefix of the name of the object class to be exported by both JavaScript and native code, ignored if --object-class-name is specified", - [Function], - "", - ], - }, - }, - Object { - "option": Object { - "args": Array [ - "--module-prefix [modulePrefix]", - "The prefix of the generated module package name, ignored if --module-name is specified", - [Function], - "react-native", - ], - }, - }, - Object { - "option": Object { - "args": Array [ - "--package-identifier [packageIdentifier]", - "[Android] The Java package identifier used by the Android module", + "--android-package-id [androidPackageId]", + "The Java package identifier used by the Android module", [Function], "com.reactlibrary", ], diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap index 1fa10581..75f50af8 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module using mocked lib with logging, with example, Array [ Object { "warn": Array [ - "While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package + "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,11 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName + root packageName (full package name): react-native-alice-bobbi is view: false - object class name prefix: object class name: AliceBobbi - library modulePrefix: react-native -Android packageIdentifier: com.reactlibrary +Android androidPackageId: com.reactlibrary platforms: android,ios Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap index 9519e7e5..a70b3361 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module using mocked lib with example, with \`yarn ad Array [ Object { "warn": Array [ - "While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package + "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,11 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName + root packageName (full package name): react-native-alice-bobbi is view: false - object class name prefix: object class name: AliceBobbi - library modulePrefix: react-native -Android packageIdentifier: com.reactlibrary +Android androidPackageId: com.reactlibrary platforms: android,ios Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap index e75b8bbc..bd6beb6f 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap @@ -7,13 +7,11 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName + root packageName (full package name): react-native-alice-bobbi is view: false - object class name prefix: ABC - object class name: ABCAliceBobbi - library modulePrefix: react-native -Android packageIdentifier: com.alicebits + object class name: AliceBobbi +Android androidPackageId: com.alicebits platforms: android,ios Apple tvosEnabled: true authorName: Alice @@ -107,10 +105,10 @@ exampleReactNativeVersion: react-native@npm:react-native-tvos "ensureDir": "react-native-alice-bobbi/ios/", }, Object { - "ensureDir": "react-native-alice-bobbi/ios/ABCAliceBobbi.xcworkspace/", + "ensureDir": "react-native-alice-bobbi/ios/AliceBobbi.xcworkspace/", }, Object { - "ensureDir": "react-native-alice-bobbi/ios/ABCAliceBobbi.xcodeproj/", + "ensureDir": "react-native-alice-bobbi/ios/AliceBobbi.xcodeproj/", }, Object { "outputFileName": "react-native-alice-bobbi/README.md", @@ -126,10 +124,10 @@ exampleReactNativeVersion: react-native@npm:react-native-tvos ## Usage \`\`\`javascript -import ABCAliceBobbi from 'react-native-alice-bobbi'; +import AliceBobbi from 'react-native-alice-bobbi'; // TODO: What to do with the module? -ABCAliceBobbi; +AliceBobbi; \`\`\` ", }, @@ -181,9 +179,9 @@ ABCAliceBobbi; "outputFileName": "react-native-alice-bobbi/index.js", "theContent": "import { NativeModules } from 'react-native'; -const { ABCAliceBobbi } = NativeModules; +const { AliceBobbi } = NativeModules; -export default ABCAliceBobbi; +export default AliceBobbi; ", }, Object { @@ -394,7 +392,7 @@ afterEvaluate { project -> ", }, Object { - "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/alicebits/ABCAliceBobbiModule.java", + "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/alicebits/AliceBobbiModule.java", "theContent": "package com.alicebits; import com.facebook.react.bridge.ReactApplicationContext; @@ -402,18 +400,18 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.Callback; -public class ABCAliceBobbiModule extends ReactContextBaseJavaModule { +public class AliceBobbiModule extends ReactContextBaseJavaModule { private final ReactApplicationContext reactContext; - public ABCAliceBobbiModule(ReactApplicationContext reactContext) { + public AliceBobbiModule(ReactApplicationContext reactContext) { super(reactContext); this.reactContext = reactContext; } @Override public String getName() { - return \\"ABCAliceBobbi\\"; + return \\"AliceBobbi\\"; } @ReactMethod @@ -425,7 +423,7 @@ public class ABCAliceBobbiModule extends ReactContextBaseJavaModule { ", }, Object { - "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/alicebits/ABCAliceBobbiPackage.java", + "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/alicebits/AliceBobbiPackage.java", "theContent": "package com.alicebits; import java.util.Arrays; @@ -438,10 +436,10 @@ import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import com.facebook.react.bridge.JavaScriptModule; -public class ABCAliceBobbiPackage implements ReactPackage { +public class AliceBobbiPackage implements ReactPackage { @Override public List createNativeModules(ReactApplicationContext reactContext) { - return Arrays.asList(new ABCAliceBobbiModule(reactContext)); + return Arrays.asList(new AliceBobbiModule(reactContext)); } @Override @@ -502,19 +500,19 @@ end ", }, Object { - "outputFileName": "react-native-alice-bobbi/ios/ABCAliceBobbi.h", + "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.h", "theContent": "#import -@interface ABCAliceBobbi : NSObject +@interface AliceBobbi : NSObject @end ", }, Object { - "outputFileName": "react-native-alice-bobbi/ios/ABCAliceBobbi.m", - "theContent": "#import \\"ABCAliceBobbi.h\\" + "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.m", + "theContent": "#import \\"AliceBobbi.h\\" -@implementation ABCAliceBobbi +@implementation AliceBobbi RCT_EXPORT_MODULE() @@ -528,18 +526,18 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu ", }, Object { - "outputFileName": "react-native-alice-bobbi/ios/ABCAliceBobbi.xcworkspace/contents.xcworkspacedata", + "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.xcworkspace/contents.xcworkspacedata", "theContent": " + location = \\"group:AliceBobbi.xcodeproj\\"> ", }, Object { - "outputFileName": "react-native-alice-bobbi/ios/ABCAliceBobbi.xcodeproj/project.pbxproj", + "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.xcodeproj/project.pbxproj", "theContent": "// !$*UTF8*$! { archiveVersion = 1; @@ -561,7 +559,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libABCAliceBobbi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libABCAliceBobbi.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 134814201AA4EA6300B7C361 /* libAliceBobbi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAliceBobbi.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -578,7 +576,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu 134814211AA4EA7D00B7C361 /* Products */ = { isa = PBXGroup; children = ( - 134814201AA4EA6300B7C361 /* libABCAliceBobbi.a */, + 134814201AA4EA6300B7C361 /* libAliceBobbi.a */, ); name = Products; sourceTree = \\"\\"; @@ -593,9 +591,9 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* ABCAliceBobbi */ = { + 58B511DA1A9E6C8500147676 /* AliceBobbi */ = { isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"ABCAliceBobbi\\" */; + buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */; buildPhases = ( 58B511D71A9E6C8500147676 /* Sources */, 58B511D81A9E6C8500147676 /* Frameworks */, @@ -605,9 +603,9 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu ); dependencies = ( ); - name = ABCAliceBobbi; + name = AliceBobbi; productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libABCAliceBobbi.a */; + productReference = 134814201AA4EA6300B7C361 /* libAliceBobbi.a */; productType = \\"com.apple.product-type.library.static\\"; }; /* End PBXNativeTarget section */ @@ -624,7 +622,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu }; }; }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"ABCAliceBobbi\\" */; + buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */; compatibilityVersion = \\"Xcode 3.2\\"; developmentRegion = en; hasScannedForEncodings = 0; @@ -637,7 +635,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu projectDirPath = \\"\\"; projectRoot = \\"\\"; targets = ( - 58B511DA1A9E6C8500147676 /* ABCAliceBobbi */, + 58B511DA1A9E6C8500147676 /* AliceBobbi */, ); }; /* End PBXProject section */ @@ -775,7 +773,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu ); LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = ABCAliceBobbi; + PRODUCT_NAME = AliceBobbi; SKIP_INSTALL = YES; }; name = Debug; @@ -791,7 +789,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu ); LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = ABCAliceBobbi; + PRODUCT_NAME = AliceBobbi; SKIP_INSTALL = YES; }; name = Release; @@ -799,7 +797,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"ABCAliceBobbi\\" */ = { + 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"AliceBobbi\\" */ = { isa = XCConfigurationList; buildConfigurations = ( 58B511ED1A9E6C8500147676 /* Debug */, @@ -808,7 +806,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"ABCAliceBobbi\\" */ = { + 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"AliceBobbi\\" */ = { isa = XCConfigurationList; buildConfigurations = ( 58B511F01A9E6C8500147676 /* Debug */, @@ -970,7 +968,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View } from 'react-native'; -import ABCAliceBobbi from 'react-native-alice-bobbi'; +import AliceBobbi from 'react-native-alice-bobbi'; export default class App extends Component<{}> { state = { @@ -978,7 +976,7 @@ export default class App extends Component<{}> { message: '--' }; componentDidMount() { - ABCAliceBobbi.sampleMethod('Testing', 123, (message) => { + AliceBobbi.sampleMethod('Testing', 123, (message) => { this.setState({ status: 'native callback received', message @@ -988,7 +986,7 @@ export default class App extends Component<{}> { render() { return ( - ☆ABCAliceBobbi example☆ + ☆AliceBobbi example☆ STATUS: {this.state.status} ☆NATIVE CALLBACK MESSAGE☆ {this.state.message} From 06a7885b4e7f2756d967bb428a1d24f839c5d018 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 11 Feb 2021 01:09:11 -0500 Subject: [PATCH 09/17] update a description again --- README.md | 4 ++-- lib/cli-command.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7484a8b1..102824a7 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ Usage: create-react-native-module [options] Options: -V, --version output the version number - --package-name The package name to be used in package.json. Default: react-native-(name in param-case) + --package-name The full package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) --android-package-id The Java package identifier used by the Android module (Default: `com.reactlibrary`) @@ -124,7 +124,7 @@ createLibraryModule({ ```javascript { name: String, /* The name of the library (mandatory) */ - packageName: String, /* The package name to be used in package.json. Default: react-native-(name in param-case) */ + packageName: String, /* The full package name to be used in package.json. Default: react-native-(name in param-case) */ view: Boolean, /* Generate the package as a very simple native view component (Default: false) */ objectClassName: String, /* The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) */ platforms: Array | String, /* Platforms the library will be created for. (Default: ['android', 'ios']) */ diff --git a/lib/cli-command.js b/lib/cli-command.js index 7544b488..6e7f997f 100644 --- a/lib/cli-command.js +++ b/lib/cli-command.js @@ -85,7 +85,7 @@ ${postCreateInstructions(createOptions)}`); }, options: [{ command: '--package-name [packageName]', - description: 'The package name to be used in package.json. Default: react-native-(name in param-case)', + description: 'The full package name to be used in package.json. Default: react-native-(name in param-case)', }, { command: '--view', description: 'Generate the package as a very simple native view component', From 08c19f507cc01f89943628f79c563093efab69ae Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 11 Feb 2021 01:10:07 -0500 Subject: [PATCH 10/17] update logging of packageName (full package name) --- lib/lib.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/lib.js b/lib/lib.js index e3754b37..90582a97 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -100,8 +100,7 @@ const generateWithNormalizedOptions = ({ `CREATE new React Native module with the following options: name: ${name} - root packageName - (full package name): ${packageName} + full package name: ${packageName} is view: ${view} object class name: ${objectClassName} Android androidPackageId: ${androidPackageId} From 05a35843783c7b6f97c0f0594f6ec6dafe1d6df8 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 11 Feb 2021 01:12:48 -0500 Subject: [PATCH 11/17] update test snapshots (again) --- .../integration/cli/help/__snapshots__/cli-help.test.js.snap | 2 +- .../cli/noargs/__snapshots__/cli-noargs.test.js.snap | 2 +- .../__snapshots__/lib-cli-command-object-text.test.js.snap | 2 +- .../cli-command-with-bogus-platforms-name.test.js.snap | 3 +-- .../cli-command-with-empty-platforms-string.test.js.snap | 3 +-- .../cli-command-with-logging-with-error.test.js.snap | 3 +-- .../cli-program-with-defaults-for-android.test.js.snap | 2 +- .../cli-program-with-example-with-logging.test.js.snap | 5 ++--- .../__snapshots__/cli-program-with-missing-args.test.js.snap | 2 +- .../create-with-example-with-defaults.test.js.snap | 3 +-- .../__snapshots__/with-yarn-error-logging.test.js.snap | 3 +-- .../create-with-example-with-options.test.js.snap | 3 +-- 12 files changed, 13 insertions(+), 20 deletions(-) diff --git a/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap b/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap index fa81aca3..8f28d26e 100644 --- a/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap +++ b/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap @@ -7,7 +7,7 @@ creates a React Native library module for one or more platforms Options: -V, --version output the version number - --package-name [packageName] The package name to be used in package.json. Default: react-native-(name in param-case) + --package-name [packageName] The full package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name [objectClassName] The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) --android-package-id [androidPackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") diff --git a/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap b/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap index 9907dcb7..4859140d 100644 --- a/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap +++ b/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap @@ -7,7 +7,7 @@ creates a React Native library module for one or more platforms Options: -V, --version output the version number - --package-name [packageName] The package name to be used in package.json. Default: react-native-(name in param-case) + --package-name [packageName] The full package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name [objectClassName] The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) --android-package-id [androidPackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") diff --git a/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap b/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap index 9b03d090..aa6594d6 100644 --- a/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap +++ b/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap @@ -8,7 +8,7 @@ Object { "options": Array [ Object { "command": "--package-name [packageName]", - "description": "The package name to be used in package.json. Default: react-native-(name in param-case)", + "description": "The full package name to be used in package.json. Default: react-native-(name in param-case)", }, Object { "command": "--view", diff --git a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap index 5cde2d4e..6abea477 100644 --- a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap +++ b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap @@ -13,8 +13,7 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root packageName - (full package name): react-native-alice-bobbi + full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi Android androidPackageId: com.reactlibrary diff --git a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap index f3ee07e9..8187f855 100644 --- a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap +++ b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap @@ -13,8 +13,7 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root packageName - (full package name): react-native-alice-bobbi + full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi Android androidPackageId: com.reactlibrary diff --git a/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap b/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap index b0ea37a2..579a2f9f 100644 --- a/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap +++ b/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap @@ -13,8 +13,7 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root packageName - (full package name): react-native-alice-bobbi + full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi Android androidPackageId: com.reactlibrary diff --git a/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap b/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap index ef2ba09a..e19b9271 100644 --- a/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap +++ b/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap @@ -31,7 +31,7 @@ Array [ "option": Object { "args": Array [ "--package-name [packageName]", - "The package name to be used in package.json. Default: react-native-(name in param-case)", + "The full package name to be used in package.json. Default: react-native-(name in param-case)", [Function], undefined, ], diff --git a/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap b/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap index 9e9a29cd..8f483c38 100644 --- a/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap +++ b/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap @@ -31,7 +31,7 @@ Array [ "option": Object { "args": Array [ "--package-name [packageName]", - "The package name to be used in package.json. Default: react-native-(name in param-case)", + "The full package name to be used in package.json. Default: react-native-(name in param-case)", [Function], undefined, ], @@ -207,8 +207,7 @@ Array [ "CREATE new React Native module with the following options: name: test-package - root packageName - (full package name): react-native-test-package + full package name: react-native-test-package is view: false object class name: TestPackage Android androidPackageId: com.reactlibrary diff --git a/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap b/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap index 01f8b607..4aa53ab9 100644 --- a/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap +++ b/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap @@ -29,7 +29,7 @@ Array [ "option": Object { "args": Array [ "--package-name [packageName]", - "The package name to be used in package.json. Default: react-native-(name in param-case)", + "The full package name to be used in package.json. Default: react-native-(name in param-case)", [Function], undefined, ], diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap index 031774f2..aa40ded8 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap @@ -13,8 +13,7 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root packageName - (full package name): react-native-alice-bobbi + full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi Android androidPackageId: com.reactlibrary diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap index 005b7925..a2e060ee 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap @@ -13,8 +13,7 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root packageName - (full package name): react-native-alice-bobbi + full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi Android androidPackageId: com.reactlibrary diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap index 7e9fc4ba..d3047f4b 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap @@ -7,8 +7,7 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root packageName - (full package name): react-native-alice-bobbi + full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi Android androidPackageId: com.alicebits From d663647232229d5573bf6322cfb1b2e0366a0855 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 11 Feb 2021 18:31:52 -0500 Subject: [PATCH 12/17] rename --android-package-id to --native-package-id --- README.md | 8 ++-- lib/cli-command.js | 2 +- lib/lib.js | 12 +++--- templates/android.js | 40 +++++++++---------- .../create-with-options-for-android.test.js | 2 +- .../create-with-example-with-options.test.js | 2 +- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 102824a7..e5f12486 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Options: --package-name The full package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --android-package-id The Java package identifier used by the Android module (Default: `com.reactlibrary`) + --native-package-id The Java package identifier used by the Android module (Default: `com.reactlibrary`) --platforms Platforms the library module will be created for - comma separated (Default: `ios,android`) --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account The github account where the library module is hosted (Default: `github_account`) @@ -128,7 +128,7 @@ createLibraryModule({ view: Boolean, /* Generate the package as a very simple native view component (Default: false) */ objectClassName: String, /* The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) */ platforms: Array | String, /* Platforms the library will be created for. (Default: ['android', 'ios']) */ - androidPackageId: String, /* The Java package identifier used by the Android module (Default: com.reactlibrary) */ + nativePackageId: String, /* The Java package identifier used by the Android module (Default: com.reactlibrary) */ tvosEnabled: Boolean, /* Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) */ githubAccount: String, /* The github account where the library is hosted (Default: `github_account`) */ authorName: String, /* The author's name (Default: `Your Name`) */ @@ -150,7 +150,7 @@ createLibraryModule({ __Create the module with no view:__ ``` -create-react-native-module --prefix CB --android-package-id io.mylibrary --generate-example AliceHelper +create-react-native-module --prefix CB --native-package-id io.mylibrary --generate-example AliceHelper ``` The module would be generated in the `react-native-alice-helper` subdirectory, and the example test app would be in `react-native-alice-helper/example`. @@ -221,7 +221,7 @@ The example app shows the following indications: __Create the module with an extremely simple view:__ ``` -create-react-native-module --prefix CB --android-package-id io.mylibrary --view --generate-example CarolWidget +create-react-native-module --prefix CB --native-package-id io.mylibrary --view --generate-example CarolWidget ``` The module would be generated in the `react-native-carol-widget` subdirectory, and the example test app would be in `react-native-carol-widget/example`. diff --git a/lib/cli-command.js b/lib/cli-command.js index 6e7f997f..564b25fe 100644 --- a/lib/cli-command.js +++ b/lib/cli-command.js @@ -93,7 +93,7 @@ ${postCreateInstructions(createOptions)}`); command: '--object-class-name [objectClassName]', description: 'The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase)', }, { - command: '--android-package-id [androidPackageId]', + command: '--native-package-id [nativePackageId]', description: 'The Java package identifier used by the Android module', default: 'com.reactlibrary', }, { diff --git a/lib/lib.js b/lib/lib.js index 90582a97..19e221bd 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -23,7 +23,7 @@ const normalizedOptions = require('./normalized-options'); const templates = require('../templates'); const exampleTemplates = require('../templates/example'); -const DEFAULT_ANDROID_PACKAGE_ID = 'com.reactlibrary'; +const DEFAULT_NATIVE_PACKAGE_ID = 'com.reactlibrary'; const DEFAULT_PLATFORMS = ['android', 'ios']; const DEFAULT_GITHUB_ACCOUNT = 'github_account'; const DEFAULT_AUTHOR_NAME = 'Your Name'; @@ -66,7 +66,7 @@ const generateWithNormalizedOptions = ({ name, packageName, objectClassName, - androidPackageId = DEFAULT_ANDROID_PACKAGE_ID, + nativePackageId = DEFAULT_NATIVE_PACKAGE_ID, // namespace - library API member removed since Windows platform // is now removed (may be added back someday in the future) // namespace, @@ -87,8 +87,8 @@ const generateWithNormalizedOptions = ({ fs = fsExtra, // (this can be mocked out for testing purposes) execa = execaDefault, // (this can be mocked out for testing purposes) }) => { - if (androidPackageId === DEFAULT_ANDROID_PACKAGE_ID) { - warn(`While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package + if (nativePackageId === DEFAULT_NATIVE_PACKAGE_ID) { + warn(`While \`{DEFAULT_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.`); } @@ -103,7 +103,7 @@ const generateWithNormalizedOptions = ({ full package name: ${packageName} is view: ${view} object class name: ${objectClassName} -Android androidPackageId: ${androidPackageId} + Android nativePackageId: ${nativePackageId} platforms: ${platforms} Apple tvosEnabled: ${tvosEnabled} authorName: ${authorName} @@ -167,7 +167,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} const templateArgs = { packageName, objectClassName, - androidPackageId, + nativePackageId, // namespace - library API member removed since Windows platform // is now removed (may be added back someday in the future) // namespace, diff --git a/templates/android.js b/templates/android.js index 254942fc..8ed310b8 100644 --- a/templates/android.js +++ b/templates/android.js @@ -1,6 +1,6 @@ module.exports = platform => [{ name: () => `${platform}/build.gradle`, - content: ({ androidPackageId }) => `// ${platform}/build.gradle + content: ({ nativePackageId }) => `// ${platform}/build.gradle // based on: // @@ -79,7 +79,7 @@ def configureReactNativePom(def pom) { name packageJson.title artifactId packageJson.name version = packageJson.version - group = "${androidPackageId}" + group = "${nativePackageId}" description packageJson.description url packageJson.repository.baseUrl @@ -147,19 +147,19 @@ afterEvaluate { project -> `, }, { name: () => `${platform}/src/main/AndroidManifest.xml`, - content: ({ androidPackageId }) => ` + content: ({ nativePackageId }) => ` `, }, { // for module without view: - name: ({ objectClassName, androidPackageId, view }) => + name: ({ objectClassName, nativePackageId, view }) => !view && - `${platform}/src/main/java/${androidPackageId.split('.').join('/')}/${objectClassName}Module.java`, - content: ({ objectClassName, androidPackageId, view }) => + `${platform}/src/main/java/${nativePackageId.split('.').join('/')}/${objectClassName}Module.java`, + content: ({ objectClassName, nativePackageId, view }) => !view && - `package ${androidPackageId}; + `package ${nativePackageId}; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; @@ -189,12 +189,12 @@ public class ${objectClassName}Module extends ReactContextBaseJavaModule { `, }, { // manager for view: - name: ({ objectClassName, androidPackageId, view }) => + name: ({ objectClassName, nativePackageId, view }) => view && - `${platform}/src/main/java/${androidPackageId.split('.').join('/')}/${objectClassName}Manager.java`, - content: ({ objectClassName, androidPackageId, view }) => + `${platform}/src/main/java/${nativePackageId.split('.').join('/')}/${objectClassName}Manager.java`, + content: ({ objectClassName, nativePackageId, view }) => view && - `package ${androidPackageId}; + `package ${nativePackageId}; import android.view.View; @@ -223,12 +223,12 @@ public class ${objectClassName}Manager extends SimpleViewManager { `, }, { // package for module without view: - name: ({ objectClassName, androidPackageId, view }) => + name: ({ objectClassName, nativePackageId, view }) => !view && - `${platform}/src/main/java/${androidPackageId.split('.').join('/')}/${objectClassName}Package.java`, - content: ({ objectClassName, androidPackageId, view }) => + `${platform}/src/main/java/${nativePackageId.split('.').join('/')}/${objectClassName}Package.java`, + content: ({ objectClassName, nativePackageId, view }) => !view && - `package ${androidPackageId}; + `package ${nativePackageId}; import java.util.Arrays; import java.util.Collections; @@ -253,12 +253,12 @@ public class ${objectClassName}Package implements ReactPackage { `, }, { // package for manager for view: - name: ({ objectClassName, androidPackageId, view }) => + name: ({ objectClassName, nativePackageId, view }) => view && - `${platform}/src/main/java/${androidPackageId.split('.').join('/')}/${objectClassName}Package.java`, - content: ({ objectClassName, androidPackageId, view }) => + `${platform}/src/main/java/${nativePackageId.split('.').join('/')}/${objectClassName}Package.java`, + content: ({ objectClassName, nativePackageId, view }) => view && - `package ${androidPackageId}; + `package ${nativePackageId}; import java.util.Arrays; import java.util.Collections; diff --git a/tests/with-injection/create/with-options/for-android/create-with-options-for-android.test.js b/tests/with-injection/create/with-options/for-android/create-with-options-for-android.test.js index 2bc3e177..2542e8e9 100644 --- a/tests/with-injection/create/with-options/for-android/create-with-options-for-android.test.js +++ b/tests/with-injection/create/with-options/for-android/create-with-options-for-android.test.js @@ -10,7 +10,7 @@ test('create alice-bobbi module with config options for Android only', () => { const options = { platforms: ['android'], name: 'alice-bobbi', - androidPackageId: 'com.alicebits', + nativePackageId: 'com.alicebits', githubAccount: 'alicebits', authorName: 'Alice', authorEmail: 'contact@alice.me', diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js b/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js index b3b2059c..b0b9ade9 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-options/create-with-example-with-options.test.js @@ -51,7 +51,7 @@ test('create alice-bobbi module using mocked lib with logging, with example, for const options = { platforms: ['android', 'ios'], name: 'alice-bobbi', - androidPackageId: 'com.alicebits', + nativePackageId: 'com.alicebits', tvosEnabled: true, githubAccount: 'alicebits', authorName: 'Alice', From bdde771eb96d32552c0daa6a0c85d30b340c3801 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 11 Feb 2021 18:33:25 -0500 Subject: [PATCH 13/17] update test snapshots (yet again) --- .../cli/help/__snapshots__/cli-help.test.js.snap | 2 +- .../cli/noargs/__snapshots__/cli-noargs.test.js.snap | 2 +- .../__snapshots__/lib-cli-command-object-text.test.js.snap | 2 +- .../cli-command-with-bogus-platforms-name.test.js.snap | 4 ++-- .../cli-command-with-empty-platforms-string.test.js.snap | 4 ++-- .../cli-command-with-logging-with-error.test.js.snap | 4 ++-- .../cli-program-with-defaults-for-android.test.js.snap | 2 +- .../cli-program-with-example-with-logging.test.js.snap | 6 +++--- .../cli-program-with-missing-args.test.js.snap | 2 +- .../create-with-example-with-defaults.test.js.snap | 4 ++-- .../__snapshots__/with-yarn-error-logging.test.js.snap | 4 ++-- .../create-with-example-with-options.test.js.snap | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap b/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap index 8f28d26e..e28caef7 100644 --- a/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap +++ b/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap @@ -10,7 +10,7 @@ Options: --package-name [packageName] The full package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name [objectClassName] The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --android-package-id [androidPackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") + --native-package-id [nativePackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") --platforms Platforms the library module will be created for - comma separated (default: \\"ios,android\\") --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account [githubAccount] The github account where the library module is hosted (default: \\"github_account\\") diff --git a/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap b/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap index 4859140d..de9dbf40 100644 --- a/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap +++ b/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap @@ -10,7 +10,7 @@ Options: --package-name [packageName] The full package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name [objectClassName] The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --android-package-id [androidPackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") + --native-package-id [nativePackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") --platforms Platforms the library module will be created for - comma separated (default: \\"ios,android\\") --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account [githubAccount] The github account where the library module is hosted (default: \\"github_account\\") diff --git a/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap b/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap index aa6594d6..79002b2d 100644 --- a/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap +++ b/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap @@ -19,7 +19,7 @@ Object { "description": "The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase)", }, Object { - "command": "--android-package-id [androidPackageId]", + "command": "--native-package-id [nativePackageId]", "default": "com.reactlibrary", "description": "The Java package identifier used by the Android module", }, diff --git a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap index 6abea477..a4e8a987 100644 --- a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap +++ b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module with logging, with platforms: 'bogus' 1`] = ` Array [ Object { "warn": Array [ - "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package + "While \`{DEFAULT_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -16,7 +16,7 @@ Array [ full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi -Android androidPackageId: com.reactlibrary + Android nativePackageId: com.reactlibrary platforms: bogus Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap index 8187f855..e36a86db 100644 --- a/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap +++ b/tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module with logging, with platforms: '' 1`] = ` Array [ Object { "warn": Array [ - "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package + "While \`{DEFAULT_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -16,7 +16,7 @@ Array [ full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi -Android androidPackageId: com.reactlibrary + Android nativePackageId: com.reactlibrary platforms: Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap b/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap index 579a2f9f..4503f241 100644 --- a/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap +++ b/tests/with-mocks/cli/command/action-func/with-logging/with-error/__snapshots__/cli-command-with-logging-with-error.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module with logging, with fs error (with defaults fo Array [ Object { "warn": Array [ - "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package + "While \`{DEFAULT_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -16,7 +16,7 @@ Array [ full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi -Android androidPackageId: com.reactlibrary + Android nativePackageId: com.reactlibrary platforms: android,ios Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap b/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap index e19b9271..b95adf41 100644 --- a/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap +++ b/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap @@ -60,7 +60,7 @@ Array [ Object { "option": Object { "args": Array [ - "--android-package-id [androidPackageId]", + "--native-package-id [nativePackageId]", "The Java package identifier used by the Android module", [Function], "com.reactlibrary", diff --git a/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap b/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap index 8f483c38..def0a69d 100644 --- a/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap +++ b/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap @@ -60,7 +60,7 @@ Array [ Object { "option": Object { "args": Array [ - "--android-package-id [androidPackageId]", + "--native-package-id [nativePackageId]", "The Java package identifier used by the Android module", [Function], "com.reactlibrary", @@ -198,7 +198,7 @@ Array [ }, Object { "warn": Array [ - "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package + "While \`{DEFAULT_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -210,7 +210,7 @@ Array [ full package name: react-native-test-package is view: false object class name: TestPackage -Android androidPackageId: com.reactlibrary + Android nativePackageId: com.reactlibrary platforms: android,ios Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap b/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap index 4aa53ab9..abeeeaad 100644 --- a/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap +++ b/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap @@ -58,7 +58,7 @@ Array [ Object { "option": Object { "args": Array [ - "--android-package-id [androidPackageId]", + "--native-package-id [nativePackageId]", "The Java package identifier used by the Android module", [Function], "com.reactlibrary", diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap index aa40ded8..e1d46078 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module using mocked lib with logging, with example, Array [ Object { "warn": Array [ - "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package + "While \`{DEFAULT_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -16,7 +16,7 @@ Array [ full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi -Android androidPackageId: com.reactlibrary + Android nativePackageId: com.reactlibrary platforms: android,ios Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap index a2e060ee..2a3534c2 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap @@ -4,7 +4,7 @@ exports[`create alice-bobbi module using mocked lib with example, with \`yarn ad Array [ Object { "warn": Array [ - "While \`{DEFAULT_ANDROID_PACKAGE_ID}\` is the default package + "While \`{DEFAULT_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -16,7 +16,7 @@ Array [ full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi -Android androidPackageId: com.reactlibrary + Android nativePackageId: com.reactlibrary platforms: android,ios Apple tvosEnabled: false authorName: Your Name diff --git a/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap b/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap index d3047f4b..cefef794 100644 --- a/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap +++ b/tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap @@ -10,7 +10,7 @@ Array [ full package name: react-native-alice-bobbi is view: false object class name: AliceBobbi -Android androidPackageId: com.alicebits + Android nativePackageId: com.alicebits platforms: android,ios Apple tvosEnabled: true authorName: Alice From 77abf520f3bb91d316639e0b522142c5a663b6c4 Mon Sep 17 00:00:00 2001 From: Chris Brody Date: Thu, 11 Mar 2021 14:30:32 -0500 Subject: [PATCH 14/17] Update README.md - description of --native-package-id --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5f12486..16511fe7 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Options: --package-name The full package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --native-package-id The Java package identifier used by the Android module (Default: `com.reactlibrary`) + --native-package-id [Android] The native Java package identifier used for Android (Default: `com.reactlibrary`) --platforms Platforms the library module will be created for - comma separated (Default: `ios,android`) --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account The github account where the library module is hosted (Default: `github_account`) From f148bcb7c50d841e968660391c497e743b50dd3c Mon Sep 17 00:00:00 2001 From: Chris Brody Date: Thu, 11 Mar 2021 14:31:08 -0500 Subject: [PATCH 15/17] Update README.md - description of nativePackageId in API --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16511fe7..d4d95e32 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ createLibraryModule({ view: Boolean, /* Generate the package as a very simple native view component (Default: false) */ objectClassName: String, /* The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) */ platforms: Array | String, /* Platforms the library will be created for. (Default: ['android', 'ios']) */ - nativePackageId: String, /* The Java package identifier used by the Android module (Default: com.reactlibrary) */ + nativePackageId: String, /* [Android] The native Java package identifier used for Android (Default: `com.reactlibrary`) */ tvosEnabled: Boolean, /* Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) */ githubAccount: String, /* The github account where the library is hosted (Default: `github_account`) */ authorName: String, /* The author's name (Default: `Your Name`) */ From effaf426008d5b66d9d72032178d7b2111483fb3 Mon Sep 17 00:00:00 2001 From: Chris Brody Date: Thu, 11 Mar 2021 14:31:38 -0500 Subject: [PATCH 16/17] Update lib/cli-command.js - help text for --native-package-id --- lib/cli-command.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cli-command.js b/lib/cli-command.js index 564b25fe..688c49b8 100644 --- a/lib/cli-command.js +++ b/lib/cli-command.js @@ -94,7 +94,7 @@ ${postCreateInstructions(createOptions)}`); description: 'The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase)', }, { command: '--native-package-id [nativePackageId]', - description: 'The Java package identifier used by the Android module', + description: '[Android] The native Java package identifier used for Android', default: 'com.reactlibrary', }, { command: '--platforms ', From 6b6c9dd018e36f46512c17ff2bd7651873c45c05 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 11 Mar 2021 14:41:09 -0500 Subject: [PATCH 17/17] update test snapshots --- tests/integration/cli/help/__snapshots__/cli-help.test.js.snap | 2 +- .../cli/noargs/__snapshots__/cli-noargs.test.js.snap | 2 +- .../__snapshots__/lib-cli-command-object-text.test.js.snap | 2 +- .../cli-program-with-defaults-for-android.test.js.snap | 2 +- .../cli-program-with-example-with-logging.test.js.snap | 2 +- .../__snapshots__/cli-program-with-missing-args.test.js.snap | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap b/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap index e28caef7..8b586ee5 100644 --- a/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap +++ b/tests/integration/cli/help/__snapshots__/cli-help.test.js.snap @@ -10,7 +10,7 @@ Options: --package-name [packageName] The full package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name [objectClassName] The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --native-package-id [nativePackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") + --native-package-id [nativePackageId] [Android] The native Java package identifier used for Android (default: \\"com.reactlibrary\\") --platforms Platforms the library module will be created for - comma separated (default: \\"ios,android\\") --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account [githubAccount] The github account where the library module is hosted (default: \\"github_account\\") diff --git a/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap b/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap index de9dbf40..dcc9df16 100644 --- a/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap +++ b/tests/integration/cli/noargs/__snapshots__/cli-noargs.test.js.snap @@ -10,7 +10,7 @@ Options: --package-name [packageName] The full package name to be used in package.json. Default: react-native-(name in param-case) --view Generate the package as a very simple native view component --object-class-name [objectClassName] The name of the object class to be exported by both JavaScript and native code. Default: (name in PascalCase) - --native-package-id [nativePackageId] The Java package identifier used by the Android module (default: \\"com.reactlibrary\\") + --native-package-id [nativePackageId] [Android] The native Java package identifier used for Android (default: \\"com.reactlibrary\\") --platforms Platforms the library module will be created for - comma separated (default: \\"ios,android\\") --tvos-enabled Generate the module with tvOS build enabled (requires react-native-tvos fork, with minimum version of 0.60, and iOS platform to be enabled) --github-account [githubAccount] The github account where the library module is hosted (default: \\"github_account\\") diff --git a/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap b/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap index 79002b2d..b51a8b6a 100644 --- a/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap +++ b/tests/with-injection/cli/command/object/__snapshots__/lib-cli-command-object-text.test.js.snap @@ -21,7 +21,7 @@ Object { Object { "command": "--native-package-id [nativePackageId]", "default": "com.reactlibrary", - "description": "The Java package identifier used by the Android module", + "description": "[Android] The native Java package identifier used for Android", }, Object { "command": "--platforms ", diff --git a/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap b/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap index 1114f210..65208a38 100644 --- a/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap +++ b/tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap @@ -61,7 +61,7 @@ Array [ "option": Object { "args": Array [ "--native-package-id [nativePackageId]", - "The Java package identifier used by the Android module", + "[Android] The native Java package identifier used for Android", [Function], "com.reactlibrary", ], diff --git a/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap b/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap index 8c19e1c9..0f85fdf6 100644 --- a/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap +++ b/tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap @@ -61,7 +61,7 @@ Array [ "option": Object { "args": Array [ "--native-package-id [nativePackageId]", - "The Java package identifier used by the Android module", + "[Android] The native Java package identifier used for Android", [Function], "com.reactlibrary", ], diff --git a/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap b/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap index abeeeaad..05f37b64 100644 --- a/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap +++ b/tests/with-mocks/cli/program/with-missing-args/__snapshots__/cli-program-with-missing-args.test.js.snap @@ -59,7 +59,7 @@ Array [ "option": Object { "args": Array [ "--native-package-id [nativePackageId]", - "The Java package identifier used by the Android module", + "[Android] The native Java package identifier used for Android", [Function], "com.reactlibrary", ],