Skip to content

Template's placeholderName is not replaced everywhere. #1456

@blazlew

Description

@blazlew

Environment

System:
    OS: macOS 11.4
    CPU: (8) arm64 Apple M1
    Memory: 222.09 MB / 16.00 GB
    Shell: 5.8 - /opt/homebrew/bin/zsh
  Binaries:
    Node: 15.12.0 - ~/.nvm/versions/node/v15.12.0/bin/node
    Yarn: 1.22.10 - /opt/homebrew/bin/yarn
    npm: 7.6.3 - ~/.nvm/versions/node/v15.12.0/bin/npm
    Watchman: 2021.06.07.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK:
      API Levels: 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 12.5/12E262 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_282 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Description

When using init command with --template option, template's placeholderName is not being replaced in package.json's scripts section.

Reproducible Demo

I've tried different placeholderName forms:
e.g template/package.json scripts:

"ios:dev": "react-native run-ios --scheme HelloWorldDevelopment",
"ios:dev": "react-native run-ios --scheme \"HelloWorld-Development\"",
"ios:dev": "react-native run-ios --scheme \"HelloWorldDevelopment\"",

e.g template.config.js:

module.exports = {
  placeholderName: "HelloWorld",
  titlePlaceholder: "Hello App Display Name",
  templateDir: "./template",
};
react native init MyTemplateTest --template my-template

The resulting package.json scripts:

"ios:dev": "react-native run-ios --scheme HelloWorldDevelopment",
"ios:dev": "react-native run-ios --scheme \"HelloWorld-Development\"",
"ios:dev": "react-native run-ios --scheme \"HelloWorldDevelopment\"",

Same as in template, while I expect HelloWorld to be replaced with provided project name e.g. MyTemplateTest

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions