Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leading zero crash #132

Closed
sanderschnydrig opened this issue Dec 4, 2022 · 5 comments
Closed

Leading zero crash #132

sanderschnydrig opened this issue Dec 4, 2022 · 5 comments

Comments

@sanderschnydrig
Copy link

sanderschnydrig commented Dec 4, 2022

Hi Max!

I recently migrated our project from @capacitor/assets to this one ("@trapezedev/configure": "^6.0.6"), looks very promising. However I got an error message when trying to read an environment variable with the value "0", as JSON cannot parse this.

This is the workaround I'm currently applying. I was unable to open a PR here so I'll link my fork here:

main...sanderschnydrig:trapeze:main

Cheers

@sanderschnydrig
Copy link
Author

Figured out how to create a PR 🎉 #133

@mlynch
Copy link
Contributor

mlynch commented Dec 5, 2022

Can you give me an example of the input that is breaking and the error message you're getting? I'm trying to understand what's going on to help review #133. I'm not able to reproduce it locally so I'm trying to understand. Thanks

@sanderschnydrig
Copy link
Author

sanderschnydrig commented Dec 6, 2022

Sure, this is an example of my .env file:

APP_NAME = "Example"
APP_IDENTIFIER = "com.example.app"
APP_DESCRIPTION = "Example description"
APP_VERSION="2.8.16"
BUILD_NUMBER="0"
BUILD_NUMBER_ANDROID="2081600"

The line with the BUILD_NUMBER variable breaks this tool for me when using the following configuration (relevant parts are the BUILD_NUMBER in vars and the usage of it in ios):

# REF: https://github.com/ionic-team/capacitor-configure/blob/main/examples/basic.yml
vars:
  APP_NAME:
  APP_VERSION:
  APP_IDENTIFIER:
  APP_DESCRIPTION:
  TEAM_ID:
  BASE_URL:
  NEWSAPP_PAGE_LINK:
  BUILD_NUMBER:
  BUILD_NUMBER_ANDROID:
  # PROVISIONING_PROFILE_SPECIFIER:

platforms:
  ios:
    targets:
      App:
        bundleId: $APP_IDENTIFIER
        version: $APP_VERSION
        buildNumber: $BUILD_NUMBER
        productName: $APP_NAME
        displayName: $APP_DESCRIPTION

        buildSettings:
          DEVELOPMENT_TEAM: $TEAM_ID
          PROVISIONING_PROFILE_SPECIFIER: 'match AppStore $APP_IDENTIFIER'

        entitlements:
          replace: true
          entries:
            - com.apple.developer.associated-domains: ['applinks:$BASE_URL', 'applinks:$NEWSAPP_PAGE_LINK']



  android:
    packageName: $APP_IDENTIFIER
    appName: $APP_DESCRIPTION
    versionName: $APP_VERSION
    versionCode: $BUILD_NUMBER_ANDROID

    res:
      - path: values
        file: strings.xml
        text: |
            <?xml version='1.0' encoding='utf-8'?>
            <resources>
                <string name="app_name">$APP_NAME</string>
                <string name="title_activity_main">$APP_NAME</string>
                <string name="package_name">$APP_IDENTIFIER</string>
                <string name="custom_url_scheme">$APP_IDENTIFIER</string>
            </resources>

      - path: values-v29
        file: strings.xml
        text: |
            <?xml version='1.0' encoding='utf-8'?>
            <resources>
                <string name="app_name">$APP_NAME</string>
                <string name="title_activity_main">$APP_NAME</string>
                <string name="package_name">$APP_IDENTIFIER</string>
                <string name="custom_url_scheme">$APP_IDENTIFIER</string>
            </resources>

EDIT: This is the command I'm using to run the config tool (where $capacitorConfig is pointing to the corresponding config file):

npx --yes dotenv-cli -- npx trapeze run configuration/capacitor/$capacitorConfig.yaml -y

@mlynch
Copy link
Contributor

mlynch commented Dec 9, 2022

Thanks, will look into this and review your PR soon

@mlynch
Copy link
Contributor

mlynch commented Dec 13, 2022

Fixed in #142

@mlynch mlynch closed this as completed Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants