From 8f8a9c54f15e82c5943d07dc4783a5c9076dbf1f Mon Sep 17 00:00:00 2001 From: Chris Brody Date: Tue, 16 Mar 2021 13:43:57 -0400 Subject: [PATCH] fix: do not add react-native package prefix if not needed (#435) * fix: do not add react-native package prefix if not needed * add test * add test snapshot --- lib/normalized-options.js | 15 +- .../create-with-no-prefix-needed.test.js.snap | 788 ++++++++++++++++++ .../create-with-no-prefix-needed.test.js | 16 + 3 files changed, 814 insertions(+), 5 deletions(-) create mode 100644 tests/with-injection/create/with-defaults/no-prefix-needed/__snapshots__/create-with-no-prefix-needed.test.js.snap create mode 100644 tests/with-injection/create/with-defaults/no-prefix-needed/create-with-no-prefix-needed.test.js diff --git a/lib/normalized-options.js b/lib/normalized-options.js index 88d7881f..4015a5ad 100644 --- a/lib/normalized-options.js +++ b/lib/normalized-options.js @@ -2,7 +2,15 @@ const { paramCase } = require('param-case'); const { pascalCase } = require('pascal-case'); -const PACKAGE_PREFIX = 'react-native'; +const PACKAGE_NAME_PREFIX = 'react-native-'; + +function transformPackageName (name) { + const paramCaseName = paramCase(name); + + return paramCaseName.startsWith(PACKAGE_NAME_PREFIX) + ? paramCaseName + : PACKAGE_NAME_PREFIX + paramCaseName; +} module.exports = (options) => { const { name, packageName, objectClassName } = options; @@ -20,10 +28,7 @@ module.exports = (options) => { options, packageName ? {} - : { - // TODO: do not add PACKAGE_PREFIX if it is not needed - packageName: `${PACKAGE_PREFIX}-${paramCase(name)}` - }, + : { packageName: transformPackageName(name) }, objectClassName ? {} : { objectClassName: `${pascalCase(name)}` }, diff --git a/tests/with-injection/create/with-defaults/no-prefix-needed/__snapshots__/create-with-no-prefix-needed.test.js.snap b/tests/with-injection/create/with-defaults/no-prefix-needed/__snapshots__/create-with-no-prefix-needed.test.js.snap new file mode 100644 index 00000000..4c2878a3 --- /dev/null +++ b/tests/with-injection/create/with-defaults/no-prefix-needed/__snapshots__/create-with-no-prefix-needed.test.js.snap @@ -0,0 +1,788 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`create with defaults, with no prefix needed 1`] = ` +Array [ + "* ensureDir dir: react-native-alice +", + "* ensureDir dir: react-native-alice/ +", + "* ensureDir dir: react-native-alice/ +", + "* ensureDir dir: react-native-alice/ +", + "* ensureDir dir: react-native-alice/ +", + "* ensureDir dir: react-native-alice/android/ +", + "* ensureDir dir: react-native-alice/android/src/main/ +", + "* ensureDir dir: react-native-alice/android/src/main/java/com/reactlibrary/ +", + "* ensureDir dir: react-native-alice/android/src/main/java/com/reactlibrary/ +", + "* ensureDir dir: react-native-alice/android/ +", + "* ensureDir dir: react-native-alice/ +", + "* ensureDir dir: react-native-alice/ios/ +", + "* ensureDir dir: react-native-alice/ios/ +", + "* ensureDir dir: react-native-alice/ios/ReactNativeAlice.xcworkspace/ +", + "* ensureDir dir: react-native-alice/ios/ReactNativeAlice.xcodeproj/ +", + "* outputFile name: react-native-alice/README.md +content: +-------- +# react-native-alice + +## Getting started + +\`$ npm install react-native-alice --save\` + +### Mostly automatic installation + +\`$ react-native link react-native-alice\` + +## Usage +\`\`\`javascript +import ReactNativeAlice from 'react-native-alice'; + +// TODO: What to do with the module? +ReactNativeAlice; +\`\`\` + +<<<<<<<< ======== >>>>>>>> +", + "* outputFile name: react-native-alice/package.json +content: +-------- +{ + \\"name\\": \\"react-native-alice\\", + \\"title\\": \\"React Native Alice\\", + \\"version\\": \\"1.0.0\\", + \\"description\\": \\"TODO\\", + \\"main\\": \\"index.js\\", + \\"files\\": [ + \\"README.md\\", + \\"android\\", + \\"index.js\\", + \\"ios\\", + \\"react-native-alice.podspec\\" + ], + \\"scripts\\": { + \\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\" + }, + \\"repository\\": { + \\"type\\": \\"git\\", + \\"url\\": \\"git+https://github.com/github_account/react-native-alice.git\\", + \\"baseUrl\\": \\"https://github.com/github_account/react-native-alice\\" + }, + \\"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/index.js +content: +-------- +// main index.js + +import { NativeModules } from 'react-native'; + +const { ReactNativeAlice } = NativeModules; + +export default ReactNativeAlice; + +<<<<<<<< ======== >>>>>>>> +", + "* outputFile name: react-native-alice/.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/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/android/src/main/AndroidManifest.xml +content: +-------- + + + + + + +<<<<<<<< ======== >>>>>>>> +", + "* outputFile name: react-native-alice/android/src/main/java/com/reactlibrary/ReactNativeAliceModule.java +content: +-------- +// ReactNativeAliceModule.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 ReactNativeAliceModule extends ReactContextBaseJavaModule { + + private final ReactApplicationContext reactContext; + + public ReactNativeAliceModule(ReactApplicationContext reactContext) { + super(reactContext); + this.reactContext = reactContext; + } + + @Override + public String getName() { + return \\"ReactNativeAlice\\"; + } + + @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/android/src/main/java/com/reactlibrary/ReactNativeAlicePackage.java +content: +-------- +// ReactNativeAlicePackage.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 ReactNativeAlicePackage implements ReactPackage { + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + return Arrays.asList(new ReactNativeAliceModule(reactContext)); + } + + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } +} + +<<<<<<<< ======== >>>>>>>> +", + "* outputFile name: react-native-alice/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/react-native-alice.podspec +content: +-------- +# react-native-alice.podspec + +require \\"json\\" + +package = JSON.parse(File.read(File.join(__dir__, \\"package.json\\"))) + +Pod::Spec.new do |s| + s.name = \\"react-native-alice\\" + s.version = package[\\"version\\"] + s.summary = package[\\"description\\"] + s.description = <<-DESC + react-native-alice + DESC + s.homepage = \\"https://github.com/github_account/react-native-alice\\" + # 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.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/ios/ReactNativeAlice.h +content: +-------- +// ReactNativeAlice.h + +#import + +@interface ReactNativeAlice : NSObject + +@end + +<<<<<<<< ======== >>>>>>>> +", + "* outputFile name: react-native-alice/ios/ReactNativeAlice.m +content: +-------- +// ReactNativeAlice.m + +#import \\"ReactNativeAlice.h\\" + + +@implementation ReactNativeAlice + +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/ios/ReactNativeAlice.xcworkspace/contents.xcworkspacedata +content: +-------- + + + + + + +<<<<<<<< ======== >>>>>>>> +", + "* outputFile name: react-native-alice/ios/ReactNativeAlice.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 /* libReactNativeAlice.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactNativeAlice.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 /* libReactNativeAlice.a */, + ); + name = Products; + sourceTree = \\"\\"; + }; + 58B511D21A9E6C8500147676 = { + isa = PBXGroup; + children = ( + 134814211AA4EA7D00B7C361 /* Products */, + ); + sourceTree = \\"\\"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 58B511DA1A9E6C8500147676 /* ReactNativeAlice */ = { + isa = PBXNativeTarget; + buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"ReactNativeAlice\\" */; + buildPhases = ( + 58B511D71A9E6C8500147676 /* Sources */, + 58B511D81A9E6C8500147676 /* Frameworks */, + 58B511D91A9E6C8500147676 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ReactNativeAlice; + productName = RCTDataManager; + productReference = 134814201AA4EA6300B7C361 /* libReactNativeAlice.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 \\"ReactNativeAlice\\" */; + compatibilityVersion = \\"Xcode 3.2\\"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 58B511D21A9E6C8500147676; + productRefGroup = 58B511D21A9E6C8500147676; + projectDirPath = \\"\\"; + projectRoot = \\"\\"; + targets = ( + 58B511DA1A9E6C8500147676 /* ReactNativeAlice */, + ); + }; +/* 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 = ReactNativeAlice; + 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 = ReactNativeAlice; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject \\"ReactNativeAlice\\" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 58B511ED1A9E6C8500147676 /* Debug */, + 58B511EE1A9E6C8500147676 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget \\"ReactNativeAlice\\" */ = { + 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-defaults/no-prefix-needed/create-with-no-prefix-needed.test.js b/tests/with-injection/create/with-defaults/no-prefix-needed/create-with-no-prefix-needed.test.js new file mode 100644 index 00000000..3cd58c85 --- /dev/null +++ b/tests/with-injection/create/with-defaults/no-prefix-needed/create-with-no-prefix-needed.test.js @@ -0,0 +1,16 @@ +const lib = require('../../../../../lib/lib.js'); + +const ioInject = require('../../../helpers/io-inject.js'); + +test('create with defaults, with no prefix needed', () => { + const mysnap = []; + + const inject = ioInject(mysnap); + + const options = { + name: 'react-native-alice', + }; + + return lib(options, inject) + .then(() => { expect(mysnap).toMatchSnapshot(); }); +});