diff --git a/README.md b/README.md index b6aab615..09f4304e 100644 --- a/README.md +++ b/README.md @@ -91,12 +91,10 @@ 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 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) - --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`) - --package-identifier [Android] 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`) @@ -129,13 +127,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 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) */ - 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`) */ 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) */ + 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`) */ @@ -157,7 +153,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 --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`. @@ -232,7 +228,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 --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 34a7223e..474dfe87 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(() => { info(` @@ -84,8 +84,8 @@ ${postCreateInstructions(createOptions)}`); }); }, options: [{ - 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 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', @@ -93,16 +93,8 @@ ${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 --module-name is specified', - default: 'react-native', - }, { - command: '--package-identifier [packageIdentifier]', - description: '[Android] The Java package identifier used by the Android module', + command: '--native-package-id [nativePackageId]', + description: '[Android] The native Java package identifier used for Android', default: 'com.reactlibrary', }, { command: '--platforms ', diff --git a/lib/lib.js b/lib/lib.js index db9777e2..bdf3698b 100644 --- a/lib/lib.js +++ b/lib/lib.js @@ -26,7 +26,7 @@ const normalizedOptions = require('./normalized-options'); const templates = require('../templates'); const exampleTemplates = require('../templates/example'); -const DEFAULT_PACKAGE_IDENTIFIER = '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'; @@ -67,11 +67,9 @@ 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, + 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, @@ -93,8 +91,8 @@ const generateWithNormalizedOptions = ({ execa = execaDefault, // (this can be mocked out for testing purposes) reactNativeInit = reactNativeInitDefault // (can be overridden or mocked out for testing purposes) }) => { - if (packageIdentifier === DEFAULT_PACKAGE_IDENTIFIER) { - warn(`While \`{DEFAULT_PACKAGE_IDENTIFIER}\` 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.`); } @@ -106,13 +104,10 @@ const generateWithNormalizedOptions = ({ `CREATE new React Native module with the following options: name: ${name} - root moduleName - (full package name): ${moduleName} + full package name: ${packageName} is view: ${view} - object class name prefix: ${prefix} object class name: ${objectClassName} - library modulePrefix: ${modulePrefix} -Android packageIdentifier: ${packageIdentifier} + Android nativePackageId: ${nativePackageId} platforms: ${platforms} Apple tvosEnabled: ${tvosEnabled} authorName: ${authorName} @@ -153,7 +148,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); @@ -162,9 +157,9 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} return true; }).map((template) => { const templateArgs = { - moduleName, + packageName, objectClassName, - packageIdentifier, + nativePackageId, // namespace - library API member removed since Windows platform // is now removed (may be added back someday in the future) // namespace, @@ -178,7 +173,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} useAppleNetworking, }; - return renderTemplateIfValid(fs, moduleName, template, templateArgs); + return renderTemplateIfValid(fs, packageName, template, templateArgs); })); }); }; @@ -194,9 +189,9 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} // react-native-init-func function call // which may affect the process cwd state // (absolute paths seem to be needed for the steps below function properly) - const modulePath = path.resolve('.', moduleName); + const modulePath = path.resolve('.', packageName); const pathExampleApp = path.join(modulePath, exampleName); - const exampleAppSubdirectory = path.join('.', moduleName, exampleName); + const exampleAppSubdirectory = path.join('.', packageName, exampleName); // (with the work done in a promise chain) return Promise.resolve() @@ -209,7 +204,7 @@ exampleReactNativeVersion: ${exampleReactNativeVersion} .then(() => { // Render the example template const templateArgs = { - moduleName, + packageName, objectClassName, view, useAppleNetworking, diff --git a/lib/normalized-options.js b/lib/normalized-options.js index 0e9a857e..9b8a5fb8 100644 --- a/lib/normalized-options.js +++ b/lib/normalized-options.js @@ -6,11 +6,7 @@ const { pascalCase } = require('pascal-case'); const DEFAULT_MODULE_PREFIX = 'react-native'; module.exports = (options) => { - const { name, moduleName, objectClassName } = options; - - const prefix = options.prefix || ''; - - const modulePrefix = options.modulePrefix || DEFAULT_MODULE_PREFIX; + const { name, packageName, objectClassName } = options; if (typeof name !== 'string') { throw new TypeError("Please write your library's name"); @@ -21,14 +17,14 @@ module.exports = (options) => { // const namespace = options.namespace; return Object.assign( - { name, prefix, modulePrefix }, + { name }, options, - moduleName + packageName ? {} - : { moduleName: `${modulePrefix}-${paramCase(name)}` }, + : { packageName: `${DEFAULT_MODULE_PREFIX}-${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/templates/android.js b/templates/android.js index c685e782..a3fa1a13 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: ({ nativePackageId }) => `// ${platform}/build.gradle // based on: // @@ -83,7 +83,7 @@ def configureReactNativePom(def pom) { name packageJson.title artifactId packageJson.name version = packageJson.version - group = "${packageIdentifier}" + group = "${nativePackageId}" description packageJson.description url packageJson.repository.baseUrl @@ -151,23 +151,23 @@ afterEvaluate { project -> `, }, { name: () => `${platform}/src/main/AndroidManifest.xml`, - content: ({ packageIdentifier }) => ` + content: ({ nativePackageId }) => ` + package="${nativePackageId}"> `, }, { // for module without view: - name: ({ objectClassName, packageIdentifier, view }) => + name: ({ objectClassName, nativePackageId, view }) => !view && - `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${objectClassName}Module.java`, - content: ({ objectClassName, packageIdentifier, view }) => + `${platform}/src/main/java/${nativePackageId.split('.').join('/')}/${objectClassName}Module.java`, + content: ({ objectClassName, nativePackageId, view }) => !view && `// ${objectClassName}Module.java -package ${packageIdentifier}; +package ${nativePackageId}; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; @@ -197,14 +197,14 @@ public class ${objectClassName}Module extends ReactContextBaseJavaModule { `, }, { // manager for view: - name: ({ objectClassName, packageIdentifier, view }) => + name: ({ objectClassName, nativePackageId, view }) => view && - `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${objectClassName}Manager.java`, - content: ({ objectClassName, packageIdentifier, view }) => + `${platform}/src/main/java/${nativePackageId.split('.').join('/')}/${objectClassName}Manager.java`, + content: ({ objectClassName, nativePackageId, view }) => view && `// ${objectClassName}Manager.java -package ${packageIdentifier}; +package ${nativePackageId}; import android.view.View; @@ -233,14 +233,14 @@ public class ${objectClassName}Manager extends SimpleViewManager { `, }, { // package for module without view: - name: ({ objectClassName, packageIdentifier, view }) => + name: ({ objectClassName, nativePackageId, view }) => !view && - `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${objectClassName}Package.java`, - content: ({ objectClassName, packageIdentifier, view }) => + `${platform}/src/main/java/${nativePackageId.split('.').join('/')}/${objectClassName}Package.java`, + content: ({ objectClassName, nativePackageId, view }) => !view && `// ${objectClassName}Package.java -package ${packageIdentifier}; +package ${nativePackageId}; import java.util.Arrays; import java.util.Collections; @@ -265,14 +265,14 @@ public class ${objectClassName}Package implements ReactPackage { `, }, { // package for manager for view: - name: ({ objectClassName, packageIdentifier, view }) => + name: ({ objectClassName, nativePackageId, view }) => view && - `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${objectClassName}Package.java`, - content: ({ objectClassName, packageIdentifier, view }) => + `${platform}/src/main/java/${nativePackageId.split('.').join('/')}/${objectClassName}Package.java`, + content: ({ objectClassName, nativePackageId, view }) => view && `// ${objectClassName}Package.java -package ${packageIdentifier}; +package ${nativePackageId}; import java.util.Arrays; import java.util.Collections; diff --git a/templates/example.js b/templates/example.js index cff358ea..2eef8e42 100644 --- a/templates/example.js +++ b/templates/example.js @@ -121,7 +121,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 @@ -153,7 +153,7 @@ module.exports = { }, { name: ({ exampleName, writeExamplePodfile }) => writeExamplePodfile ? `${exampleName}/ios/Podfile` : undefined, - content: ({ moduleName, exampleName }) => + content: ({ packageName, exampleName }) => outdent({ trimTrailingNewline: false })` platform :ios, '10.0' @@ -184,12 +184,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 * @@ -202,7 +202,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 e64eb77b..5f0fa269 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 99a889be..03e6f6a0 100644 --- a/templates/ios.js +++ b/templates/ios.js @@ -1,27 +1,27 @@ module.exports = platform => [{ - name: ({ moduleName }) => `${moduleName}.podspec`, - content: ({ moduleName, tvosEnabled, githubAccount, authorName, authorEmail, license, useAppleNetworking }) => - `# ${moduleName}.podspec + name: ({ packageName }) => `${packageName}.podspec`, + content: ({ packageName, tvosEnabled, githubAccount, authorName, authorEmail, license, useAppleNetworking }) => + `# ${packageName}.podspec 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,cc,cpp,m,mm,swift}" s.requires_arc = true 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 2b3350a1..680ccbb0 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 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) - --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\\") + --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 0a143a8f..5cb82e3d 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 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) - --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\\") + --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 f1927724..f8ef33a4 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 full 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": "--native-package-id [nativePackageId]", "default": "com.reactlibrary", - "description": "[Android] 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-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 c6512227..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,907 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`create alice-bobbi module with example, with prefix: null 1`] = ` -Array [ - "* 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: --------- -// main index.js - -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 -// previous 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 -// previous location: -// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle - -// These defaults should reflect the SDK versions used by -// the minimum React Native version supported. -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() - } - dependencies { - // This should reflect the Gradle plugin version used by - // the minimum React Native version supported. - classpath 'com.android.tools.build:gradle:3.4.1' - } - } -} - -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() -} - -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: --------- -// AliceBobbiModule.java - -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: --------- -// AliceBobbiPackage.java - -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; - -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: --------- -# react-native-alice-bobbi.podspec - -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,cc,cpp,m,mm,swift}\\" - s.requires_arc = true - - s.dependency \\"React\\" - # ... - # s.dependency \\"...\\" -end - - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.h -content: --------- -// AliceBobbi.h - -#import - -@interface AliceBobbi : NSObject - -@end - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.m -content: --------- -// AliceBobbi.m - -#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 */; -} - -<<<<<<<< ======== >>>>>>>> -", - Object { - "call": "reactNativeInit", - "nameArray": Array [ - "example", - ], - "options": Object { - "directory": "react-native-alice-bobbi/example", - "template": "react-native@latest", - }, - }, - "* 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: [path.resolve('.'), path.resolve('..')] -} - -<<<<<<<< ======== >>>>>>>> -", - "* 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-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..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', - packageIdentifier: 'com.alicebits', + nativePackageId: 'com.alicebits', githubAccount: 'alicebits', authorName: 'Alice', authorEmail: 'contact@alice.me', 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 4539fbb9..5141ef14 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; \`\`\` <<<<<<<< ======== >>>>>>>> @@ -108,9 +108,9 @@ content: import { NativeModules } from 'react-native'; -const { ABCAliceBobbi } = NativeModules; +const { AliceBobbi } = NativeModules; -export default ABCAliceBobbi; +export default AliceBobbi; <<<<<<<< ======== >>>>>>>> ", @@ -328,10 +328,10 @@ 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: -------- -// ABCAliceBobbiModule.java +// AliceBobbiModule.java package com.reactlibrary; @@ -340,18 +340,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 @@ -363,10 +363,10 @@ 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: -------- -// ABCAliceBobbiPackage.java +// AliceBobbiPackage.java package com.reactlibrary; @@ -379,10 +379,10 @@ import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; -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 @@ -449,28 +449,28 @@ end <<<<<<<< ======== >>>>>>>> ", - "* outputFile name: react-native-alice-bobbi/ios/ABCAliceBobbi.h + "* outputFile name: react-native-alice-bobbi/ios/AliceBobbi.h content: -------- -// ABCAliceBobbi.h +// AliceBobbi.h #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: -------- -// ABCAliceBobbi.m +// AliceBobbi.m -#import \\"ABCAliceBobbi.h\\" +#import \\"AliceBobbi.h\\" -@implementation ABCAliceBobbi +@implementation AliceBobbi RCT_EXPORT_MODULE() @@ -484,20 +484,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*$! @@ -521,7 +521,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 */ @@ -538,7 +538,7 @@ content: 134814211AA4EA7D00B7C361 /* Products */ = { isa = PBXGroup; children = ( - 134814201AA4EA6300B7C361 /* libABCAliceBobbi.a */, + 134814201AA4EA6300B7C361 /* libAliceBobbi.a */, ); name = Products; sourceTree = \\"\\"; @@ -553,9 +553,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 */, @@ -565,9 +565,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 */ @@ -584,7 +584,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; @@ -597,7 +597,7 @@ content: projectDirPath = \\"\\"; projectRoot = \\"\\"; targets = ( - 58B511DA1A9E6C8500147676 /* ABCAliceBobbi */, + 58B511DA1A9E6C8500147676 /* AliceBobbi */, ); }; /* End PBXProject section */ @@ -735,7 +735,7 @@ content: ); LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = ABCAliceBobbi; + PRODUCT_NAME = AliceBobbi; SKIP_INSTALL = YES; }; name = Debug; @@ -751,7 +751,7 @@ content: ); LIBRARY_SEARCH_PATHS = \\"$(inherited)\\"; OTHER_LDFLAGS = \\"-ObjC\\"; - PRODUCT_NAME = ABCAliceBobbi; + PRODUCT_NAME = AliceBobbi; SKIP_INSTALL = YES; }; name = Release; @@ -759,7 +759,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 */, @@ -768,7 +768,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-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-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 6a7606a5..00000000 --- a/tests/with-injection/create/with-options/with-custom-module-prefix/__snapshots__/create-with-custom-module-prefix.test.js.snap +++ /dev/null @@ -1,788 +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: --------- -// main index.js - -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 -// previous 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 -// previous location: -// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle - -// These defaults should reflect the SDK versions used by -// the minimum React Native version supported. -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() - } - dependencies { - // This should reflect the Gradle plugin version used by - // the minimum React Native version supported. - classpath 'com.android.tools.build:gradle:3.4.1' - } - } -} - -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() -} - -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: --------- -// AliceBobbiModule.java - -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: --------- -// AliceBobbiPackage.java - -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; - -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: --------- -# custom-native-alice-bobbi.podspec - -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,cc,cpp,m,mm,swift}\\" - s.requires_arc = true - - s.dependency \\"React\\" - # ... - # s.dependency \\"...\\" -end - - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/ios/AliceBobbi.h -content: --------- -// AliceBobbi.h - -#import - -@interface AliceBobbi : NSObject - -@end - -<<<<<<<< ======== >>>>>>>> -", - "* outputFile name: custom-native-alice-bobbi/ios/AliceBobbi.m -content: --------- -// AliceBobbi.m - -#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(); -}); 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 e63e50c8..4c682622 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); 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 3d870f7e..1862abb1 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_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,10 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName - (full package name): react-native-alice-bobbi + 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 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 829c18a0..de1b68b6 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_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,10 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName - (full package name): react-native-alice-bobbi + 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 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 a5fd1296..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_PACKAGE_IDENTIFIER}\` is the default package + "While \`{DEFAULT_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,10 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName - (full package name): react-native-alice-bobbi + 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 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 3dce059c..f9bd4c16 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 full 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", + "--native-package-id [nativePackageId]", + "[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 e895dca4..f1a1d693 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 full 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", + "--native-package-id [nativePackageId]", + "[Android] The native Java package identifier used for Android", [Function], "com.reactlibrary", ], @@ -218,7 +198,7 @@ Array [ }, Object { "warn": Array [ - "While \`{DEFAULT_PACKAGE_IDENTIFIER}\` is the default package + "While \`{DEFAULT_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -227,13 +207,10 @@ Array [ "CREATE new React Native module with the following options: name: test-package - root moduleName - (full package name): react-native-test-package + 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 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 8ebf297b..22927dfd 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 full 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", + "--native-package-id [nativePackageId]", + "[Android] The native Java package identifier used for Android", [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 a17e5803..639f6b68 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_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,10 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName - (full package name): react-native-alice-bobbi + 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 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 38a8cce2..8e716a89 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_NATIVE_PACKAGE_ID}\` is the default package identifier, it is recommended to customize the package identifier.", ], }, @@ -13,13 +13,10 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName - (full package name): react-native-alice-bobbi + 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 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-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 3f291b3d..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 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": "// main index.js - -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 -// previous 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 -// previous location: -// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle - -// These defaults should reflect the SDK versions used by -// the minimum React Native version supported. -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() - } - dependencies { - // This should reflect the Gradle plugin version used by - // the minimum React Native version supported. - classpath 'com.android.tools.build:gradle:3.4.1' - } - } -} - -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() -} - -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": "// AliceBobbiModule.java - -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": "// AliceBobbiPackage.java - -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; - -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": "# react-native-alice-bobbi.podspec - -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,cc,cpp,m,mm,swift}\\" - s.requires_arc = true - - s.dependency \\"React\\" - # ... - # s.dependency \\"...\\" -end - -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.h", - "theContent": "// AliceBobbi.h - -#import - -@interface AliceBobbi : NSObject - -@end -", - }, - Object { - "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.m", - "theContent": "// AliceBobbi.m - -#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 template: react-native@latest", - ], - }, - Object { - "call": "reactNativeInit", - "nameArray": Array [ - "example", - ], - "options": Object { - "directory": "react-native-alice-bobbi/example", - "template": "react-native@latest", - }, - }, - 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: [path.resolve('.'), path.resolve('..')] -} -", - }, - 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 { - "info": 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 { - "info": 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 ed845e34..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,69 +0,0 @@ -const lib = require('../../../../../../../../lib/lib.js'); - -const mockcwd = require('process').cwd(); - -// 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(mockcwd, '...').replace(/\\/g, '/'), - theContent - }); - return Promise.resolve(); - }, - ensureDir: (dir) => { - mockpushit({ ensureDir: dir.replace(mockcwd, '...').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, opts) => { - const options = { ...opts, ...(opts.cwd ? { cwd: opts.cwd.replace(mockcwd, '...').replace(/\\/g, '/') } : {}) }; - mockpushit({ commandSync: command, options }); - } -})); -jest.mock('react-native-init-func', () => (projectNameArray, opts) => { - const options = { ...opts, ...(opts.directory ? { directory: opts.directory.replace(/\\/g, '/') } : {}) }; - mockpushit({ call: 'reactNativeInit', nameArray: projectNameArray, options }); -}); -jest.mock('console', () => ({ - info: (...args) => { - mockpushit({ - info: args.map(line => line.replace(mockcwd, '...').replace(/\\/g, '/')) - }); - }, - 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(); -}); 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 a19abfbd..2279d353 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,10 @@ Array [ "CREATE new React Native module with the following options: name: alice-bobbi - root moduleName - (full package name): react-native-alice-bobbi + 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 nativePackageId: com.alicebits platforms: android,ios Apple tvosEnabled: true authorName: Alice @@ -91,10 +88,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", @@ -110,10 +107,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; \`\`\` ", }, @@ -167,9 +164,9 @@ ABCAliceBobbi; import { NativeModules } from 'react-native'; -const { ABCAliceBobbi } = NativeModules; +const { AliceBobbi } = NativeModules; -export default ABCAliceBobbi; +export default AliceBobbi; ", }, Object { @@ -381,8 +378,8 @@ afterEvaluate { project -> ", }, Object { - "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/alicebits/ABCAliceBobbiModule.java", - "theContent": "// ABCAliceBobbiModule.java + "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/alicebits/AliceBobbiModule.java", + "theContent": "// AliceBobbiModule.java package com.alicebits; @@ -391,18 +388,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 @@ -414,8 +411,8 @@ public class ABCAliceBobbiModule extends ReactContextBaseJavaModule { ", }, Object { - "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/alicebits/ABCAliceBobbiPackage.java", - "theContent": "// ABCAliceBobbiPackage.java + "outputFileName": "react-native-alice-bobbi/android/src/main/java/com/alicebits/AliceBobbiPackage.java", + "theContent": "// AliceBobbiPackage.java package com.alicebits; @@ -428,10 +425,10 @@ import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; -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 @@ -494,24 +491,24 @@ end ", }, Object { - "outputFileName": "react-native-alice-bobbi/ios/ABCAliceBobbi.h", - "theContent": "// ABCAliceBobbi.h + "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.h", + "theContent": "// AliceBobbi.h #import -@interface ABCAliceBobbi : NSObject +@interface AliceBobbi : NSObject @end ", }, Object { - "outputFileName": "react-native-alice-bobbi/ios/ABCAliceBobbi.m", - "theContent": "// ABCAliceBobbi.m + "outputFileName": "react-native-alice-bobbi/ios/AliceBobbi.m", + "theContent": "// AliceBobbi.m -#import \\"ABCAliceBobbi.h\\" +#import \\"AliceBobbi.h\\" -@implementation ABCAliceBobbi +@implementation AliceBobbi RCT_EXPORT_MODULE() @@ -525,18 +522,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; @@ -558,7 +555,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 */ @@ -575,7 +572,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu 134814211AA4EA7D00B7C361 /* Products */ = { isa = PBXGroup; children = ( - 134814201AA4EA6300B7C361 /* libABCAliceBobbi.a */, + 134814201AA4EA6300B7C361 /* libAliceBobbi.a */, ); name = Products; sourceTree = \\"\\"; @@ -590,9 +587,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 */, @@ -602,9 +599,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 */ @@ -621,7 +618,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; @@ -634,7 +631,7 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu projectDirPath = \\"\\"; projectRoot = \\"\\"; targets = ( - 58B511DA1A9E6C8500147676 /* ABCAliceBobbi */, + 58B511DA1A9E6C8500147676 /* AliceBobbi */, ); }; /* End PBXProject section */ @@ -772,7 +769,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; @@ -788,7 +785,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; @@ -796,7 +793,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 */, @@ -805,7 +802,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 +967,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 +975,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 +985,7 @@ export default class App extends Component<{}> { render() { return ( - ☆ABCAliceBobbi example☆ + ☆AliceBobbi example☆ STATUS: {this.state.status} ☆NATIVE CALLBACK MESSAGE☆ {this.state.message} 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 f05f2b59..2b227377 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 @@ -60,8 +60,7 @@ 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', + nativePackageId: 'com.alicebits', tvosEnabled: true, githubAccount: 'alicebits', authorName: 'Alice',