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

Support for react native web 0.19, transforms foreach #11356

Closed
2 of 12 tasks
humaidk2 opened this issue May 4, 2023 · 8 comments
Closed
2 of 12 tasks

Support for react native web 0.19, transforms foreach #11356

humaidk2 opened this issue May 4, 2023 · 8 comments

Comments

@humaidk2
Copy link

humaidk2 commented May 4, 2023

Current behavior

On react native web 0.19, they stopped supporting transforms as an array so Header.js and headerbackbutton.web.js
are giving off errors from react navigation elements

This is with the latest react, react native, react navigation, and react native web

Expected behavior

Modify headerbackbutton.web.js to use strings instead of arrays for animation transforms.

For header.js, I'm not sure but it seems passing transform with undefined also causes issues. I guess that should be fixed on rnw side

Reproduction

will add when i get time

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Packages

  • @react-navigation/bottom-tabs
  • @react-navigation/drawer
  • @react-navigation/material-top-tabs
  • @react-navigation/stack
  • @react-navigation/native-stack
  • react-native-tab-view

Environment

  • I've removed the packages that I don't use
package version
@react-navigation/native 6.1.6
@react-navigation/bottom-tabs 6.5.7
@react-navigation/drawer 6.6.2
@react-navigation/native-stack 6.9.12
react-native-safe-area-context 4.5.2
react-native-screens 3.20.0
react-native-gesture-handler 2.9.0
react-native-reanimated 3.1.0
react-native-tab-view 3.5.1
react-native 0.71.7
node 18.13.0
yarn 3.5.1
@github-actions
Copy link

github-actions bot commented May 4, 2023

Hey @humaidk2! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

A snack link is preferred since it's the easiest way to both create and share a repro. If it's not possible to create a repro using a snack, link to a GitHub repo under your username is a good alternative. Don't link to a branch or specific file etc. as it won't be detected.

Try to keep the repro as small as possible by narrowing down the minimal amount of code needed to reproduce the issue. Don't link to your entire project or a project containing code unrelated to the issue. See "How to create a Minimal, Reproducible Example" for more information.

You can edit your original issue to include a link to the repro, or leave it as a comment. The issue will be closed automatically after a while if you don't provide a repro.

@chrisedington
Copy link

chrisedington commented May 16, 2023

Reanimated V2 is waiting for a V0.19 compatibility fix for React Navigation too:

software-mansion/react-native-reanimated#4352 (comment)

@iujisato
Copy link

iujisato commented May 18, 2023

just started a new project, right now its easier to downgrade to react-native-web 0.18.10 until the fix on reanimated is applied

danielsousaio added a commit to crowdbotics/modules that referenced this issue May 24, 2023
react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356
danielsousaio added a commit to crowdbotics/modules that referenced this issue May 31, 2023
react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356
danielsousaio added a commit to crowdbotics/modules that referenced this issue Jun 12, 2023
react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356
danielsousaio added a commit to crowdbotics/modules that referenced this issue Jun 13, 2023
* bump root package.json react-native to v0.71.7

- regenerate lockfile

* bump node to latest on .nvmrc

* set minimum node version on package.json to 16

* yarn run template

- overwrite all of the /scaffold/template directory with the
template from React Native v0.71.7
- keep /scaffold/template/custom intact

* scripts: replace all fs.rmdirSync with fs.rmSync

When running scripts with node v18.16.0 the following was logged:
[DEP0147] DeprecationWarning: In future versions of Node.js,
fs.rmdir(path, { recursive: true }) will be removed. Use
fs.rm(path, { recursive: true }) instead.

* add comment for original template.config.js

Upstream version of this config didn't change but still added a comment
for easier reference and traceability in the future.

* bump scaffold package.json version

major version bump since there are breaking changes being introduced
old projects need to be manually upgraded

* rewrite README.md

- more explicit system requirements
- remove duplicate version information that is available on the scaffold
- add meaningful commands examples

* move docs section into docs/README.md

* improve scripts/install.js comments details

* bump react-native-android docker image version

Source:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/.circleci/Dockerfiles/Dockerfile.android#L17

* bump ruby version in circleci and include Gemfile

following upstream version on the Gemfile:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/Gemfile#L1-L6

and it's inclusion in the template as well:
https://github.com/crowdbotics/modules/blob/419acef06c0e92f44bbbf88261018890d07f317a/scaffold/template/Gemfile#L1-L6

* remove custom/android/build.gradle

only the sdk version diverged from the old template version:
git diff b89bf7e:scaffold/template/android/build.gradle
b89bf7e:scaffold/template/custom/android/build.gradle

diff --git a/scaffold/template/android/build.gradle b/scaffold/template/custom/android/build.gradle
index 93232f5f..75a7fb29 100644
--- a/scaffold/template/android/build.gradle
+++ b/scaffold/template/custom/android/build.gradle
@@ -4,8 +4,8 @@ buildscript {
     ext {
         buildToolsVersion = "29.0.3"
         minSdkVersion = 21
-        compileSdkVersion = 29
-        targetSdkVersion = 29
+        compileSdkVersion = 31
+        targetSdkVersion = 31
         ndkVersion = "20.1.5948944"
     }
     repositories {

* update custom/android/app/build.gradle

previous divergence in release setup:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/build.gradle b89bf7e:scaffold/template/custom/android/app/build.gradle
diff --git a/scaffold/template/android/app/build.gradle b/scaffold/template/custom/android/app/build.gradle
index f75c1609..5f2a4948 100644
--- a/scaffold/template/android/app/build.gradle
+++ b/scaffold/template/custom/android/app/build.gradle
@@ -152,15 +152,21 @@ android {
             keyAlias 'androiddebugkey'
             keyPassword 'android'
         }
+        release {
+            storeFile file('my-upload-key.keystore')
+            storePassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+            keyAlias "$System.env.MYAPP_UPLOAD_KEY_ALIAS"
+            keyPassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+        }
     }
     buildTypes {
         debug {
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
         }
         release {
             // Caution! In production, you need to generate your own keystore file.
             // see https://reactnative.dev/docs/signed-apk-android.
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
             minifyEnabled enableProguardInReleaseBuilds
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
         }

* update custom/android/app/src/main/AndroidManifest.xml

Previous divergence in labels:
Note: The android:exported property is already true in the v0.71.7 template so
no changes there.

crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/src/main/AndroidManifest.xml b89bf7e:scaffold/template/custom/android/app/src/main/AndroidManifest.xml
diff --git a/scaffold/template/android/app/src/main/AndroidManifest.xml b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
index 6db8bad3..5d717754 100644
--- a/scaffold/template/android/app/src/main/AndroidManifest.xml
+++ b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
@@ -5,17 +5,18 @@

     <application
       android:name=".MainApplication"
-      android:label="@string/app_name"
+      android:label="@string/original_app_name"
       android:icon="@mipmap/ic_launcher"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:allowBackup="false"
       android:theme="@style/AppTheme">
       <activity
         android:name=".MainActivity"
-        android:label="@string/app_name"
+        android:label="@string/original_app_name"
         android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
         android:launchMode="singleTask"
-        android:windowSoftInputMode="adjustResize">
+        android:windowSoftInputMode="adjustResize"
+        android:exported="true">
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />

* remove custom/ios/Podfile and set NO_FLIPPER

react-native v0.71.7 now takes a NO_FLIPPER env var for
disabling/enabling the flipper tool. This replaces the use of the old
divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/ios/Podfile b89bf7e:scaffold/template/custom/ios/Podfile
diff --git a/scaffold/template/ios/Podfile b/scaffold/template/custom/ios/Podfile
index 18369a7e..ec68f9da 100644
--- a/scaffold/template/ios/Podfile
+++ b/scaffold/template/custom/ios/Podfile
@@ -21,7 +21,7 @@ target 'HelloWorld' do
   #
   # Note that if you have use_frameworks! enabled, Flipper will not work and
   # you should disable the next line.
-  use_flipper!()
+  # use_flipper!()

   post_install do |installer|
     react_native_post_install(installer)

* add typescript support in the scaffold

react-native v0.71.7 already includes Typescript support by default and
their entry component filename was changed to App.tsx

* bump major version of crowdbotics.json version

* update custom/package.json

replicate previous divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/package.json b89bf7e:scaffold/template/custom/package.json
diff --git a/scaffold/template/package.json b/scaffold/template/custom/package.json
index 0108163f..4212b2de 100644
--- a/scaffold/template/package.json
+++ b/scaffold/template/custom/package.json
@@ -7,11 +7,13 @@
     "ios": "react-native run-ios",
     "start": "react-native start",
     "test": "jest",
-    "lint": "eslint ."
+    "lint": "eslint .",
+    "web": "./node_modules/.bin/webpack-dev-server --config ./webpack.config.js --live-reload --color --mode development",
+    "web:build": "./node_modules/.bin/webpack --config ./webpack.config.js --color --mode production"
   },
   "dependencies": {
     "react": "17.0.1",
-    "react-native": "0.64.2"
+    "react-native": "0.64.4"
   },
   "devDependencies": {
     "@babel/core": "^7.12.9",
@@ -25,5 +27,13 @@
   },
   "jest": {
     "preset": "react-native"
+  },
+  "browserslist": {
+    "production": [">0.2%", "not dead", "not op_mini all"],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
   }
 }

* update custom/.gitignore

replicate previous Fastlane screenshots divergence:

crowdbotics@modules $ git diff b89bf7e:scaffold/template/_gitignore b89bf7e:scaffold/template/custom/.gitignore
diff --git a/scaffold/template/_gitignore b/scaffold/template/custom/.gitignore
index ad572e63..6399b6e0 100644
--- a/scaffold/template/_gitignore
+++ b/scaffold/template/custom/.gitignore
@@ -50,7 +50,10 @@ buck-out/

 */fastlane/report.xml
 */fastlane/Preview.html
-*/fastlane/screenshots
+
+# Commenting this out cause we need to store screenshots in the repo for
+# deployment through CircleCI.
+# */fastlane/screenshots

 # Bundle artifact
 *.jsbundle

* update custom/Gemfile

this file didn't exist in the previous react-native version template

* update custom/dependencies.json

This update is done by getting the names of all dependencies listed on
`dependencies.json` and then generating the following yarn commands.

Note: `ts-loader` was added to support Typescript in webpack builds.

```sh
yarn add axios @react-native-community/masked-view \
         @react-navigation/native react-native-gesture-handler \
         react-native-reanimated react-native-safe-area-context \
         react-native-screens @react-navigation/stack redux \
         react-redux @reduxjs/toolkit react-native-dotenv \
         react-native-responsive-screen react-native-elements \
         react-native-vector-icons react-dom \
         react-native-radio-buttons-group react-native-web
```
```sh
yarn add -D github:crowdbotics/babel-plugin-import-glob-meta \
            babel-loader url-loader webpack webpack-cli \
            webpack-dev-server babel-plugin-react-native-web \
            html-webpack-plugin ts-loader
```

Those commands are then run at `/scaffold/template` so that the semver
version ranges are resolved against the base react-native template.

The `git diff scaffold/template/package.json` of is then copied back
into `dependencies.json`

* remove deprecated react-native init version flag

This flag was removed upstream.

```sh
Error: Command failed: npx react-native init demo --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold --version 0.64.0
error Passing both "version" and "template" is not supported. The template you select determines the version of react-native used. Please use only one of these options, for example: --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold@x.y.z where x.y.z is the release of the template that contains the desired "react-native" version.
```

* add json extension to metro resolver

metro can't resolve app.json otherwise

* add root index.js

* add bin to root package.json

* add scaffold upgrade prompt

* add custom/ios/Podfile for debugging iOS build

* .circleci config - remove set ruby version on ios

* update docs/index.md

* update custom/Dockerfile node image to 18.16

* add fast-xml-parser and js-yaml dependencies

* add npx init script for migrating old apps

* add baked against latest version

* update files algorithm for App.js

* iterate files and cleanup caching mechanisms

* run babel transpile optionally based on babel flag

* fix section print for updateFiles

* add docs for upgrading scaffold

* add requirement for running the init script

* check all requirements in the script

* improve section messages for cookiecutter

* refactor manifest and baked variables

* remove python check, redudant with pipenv

* change order of mkdir arguments

* checkout previous version of scaffold on successive runs

* add json special case

minify the JSON before comparison

* add react-native-reanimated/plugin to babel config

reanimated docs instructs one to install the babel plugin
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/#babel-plugin

but our babel config didn't include it since it was made for 2.x

* support addition type for new files introduced

* replace slug mark in manifest with slug value

* add full scaffold manifest for upgrade

some stats:
- 146 files
- 55 directories
- 6 totally new files

* temporarily add branch to npx command

* github actions - upgrade node-version to 18

* fix lint issues

* rename custom/App.tsx into custom/App.js

for backwards compatibility with Studio

* add TODO notes for parsing project_slug

* add cookiecutter context onto crowdbotics.json

* copy .new file into the proper directory

all .new files were copied onto root before

* check if file exists before diffing

* improve git status

* remove untracked files on git reset action

* check whether file changed from PREVIOUS to NEW

compare the files across versions, skip if they are the same

* git add all files where upgrade is successful

* implement finding most frequent slug occurrence

* implement git diff printer and remove command

* move scaffold upgrade docs into it's own file

* remove dist/raw

this is an intermediary build artifact that is only used by
our cookie script, safe to remove and reduces repo size

* explain other lines in the package.json.diff

* fix lint issues in index.js

* introduce scaffold semver github action

checks and enforces semver version bumps at:
`scaffold/template/custom/.crowdbotics.json`

this action only get's triggered when there's some change made to the
following:
- scaffold/**
- dist/cookie/**

* remove redudant rm command and call it a document

* build: add Podfile.lock

* remove custom Podfile

only customization is debugging logs

* remove react-native-reanimated

@react-navigation/native no longer depends on it

* add override to android MainActivity.java

As suggested in the react-navigation installation instructions:
https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project

* scaffold - update fastlane README

* build: include files from pod install

* move all d5e04d8 template changes to custom

* revert gitignore changes in d5e04d8

* add --deployment to CI pod install step

* move Podfile.lock to custom

upstream template doesn't have a lockfile

* build: add missing packages

* undo all changes - only rm when untrackeds exist

* exclude addition files from comparison

* break rm into multiline rm

* improve diffing with prettier

* build: update podfile lock

* build: new xcode files

* build: xcode files update

* build: gem and pod update

* replace deprecated "@react-native-community/masked-view"

with "@react-native-masked-view/masked-view"

* make webpack config use App.js instead of App.tsx

* add react-native-reanimated dependency to the scaffold

* remove deployment flag

* configure webpack for react-native-reanimated

following 3.x docs here:
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support

* good looking welcome screen with image and text

* downgrade react-native-web upgrade gesture-handler

react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356

* make demo script use cookiecutter for both scaffolds

no longer rely on `npx react-native init` which doesn't
match what our backend does - which is to cookiecutter all scaffolds

* change order of bootstrap subcommands

* fix reanimated missing AAR on CI issue

older versions of reanimated package AAR, this is the latest old version
that includes it

* move scripts/config.js to config.js

* update index.js to support arbitrary versions

* regen custom yarn.lock

* pipenv lock

* add manifest script command

* automate manifest generation and consumption

add a new version to `config.js` and then
run `yarn run manifest` to generate a new manifest for that version

* git add cookie ios/Pods/Manifest.lock

this file was gitignored and missed before

* refactor console.log utils into config

* add scaffold/package.json check in semver script

* simplify PR template by linking checklists docs

include new checks for scaffold (all types of builds)

* document the semver script

* document the manifest script

* increase root package.json version

* remove duplicate store documentation

This file is already made available to users of the scaffold in [store/README.md](/scaffold/template/custom/store/README.md).

* remove duplicate docs/index.md

duplicate of /README.md

* introduce CHANGELOGs and redo documentation

- move @modules docs to the scaffold, users benefit from it
- remove target android/ios sdk versions, those are listed in CHANGELOG
- cleanup docs/index.md
- rename /docs files to be more meaningful
- document new semver and manifest scripts

* docs: add information about PATH requirements

cookiecutter and pg_config binaries need to be available

* process commands replace status with error checks

* yarn run bootstrap

* replace his with their

* update manifest: add modules/README.md

* fix: require node 16 and above at minimum

not including the minor version in the range forces at the very least 17

---------

Co-authored-by: Muhammad Abdullah Abid <abd@abd.dev>
@github-actions
Copy link

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.

@github-actions github-actions bot added the stale label Jun 18, 2023
@humaidk2
Copy link
Author

humaidk2 commented Jun 18, 2023

I did a quick check so for the first issue
seems someone who knows this project has to go modify

packages/elements/src/Header/HeaderBackButton.tsx

and change those transforms to only use strings for web

aka the compiled HeaderBackButton.web.js

Technically new react native has support for string transforms too so they could maybe change it completely

Also regarding the second issue,
it's not relevant to this library, seems rnw doesnt allow undefined to be passed to transform

someone already created a pr.

necolas/react-native-web#2530

@github-actions github-actions bot removed the stale label Jun 19, 2023
driverdan pushed a commit to crowdbotics/modules that referenced this issue Jul 18, 2023
* YAML file for CircleCI

* renamed process in YAML file

* renamed YAML file

* config yaml update

* step rename

* add demo directory before creating app

* added pipenv as well as dependancies

* added python3.8 installation to the pipeline

* changed docker image

* remove pipenv installation

* specified python3.8.13 version

* removed unnecessary pipeline lines

* bump root package.json react-native to v0.71.7

- regenerate lockfile

* bump node to latest on .nvmrc

* set minimum node version on package.json to 16

* yarn run template

- overwrite all of the /scaffold/template directory with the
template from React Native v0.71.7
- keep /scaffold/template/custom intact

* scripts: replace all fs.rmdirSync with fs.rmSync

When running scripts with node v18.16.0 the following was logged:
[DEP0147] DeprecationWarning: In future versions of Node.js,
fs.rmdir(path, { recursive: true }) will be removed. Use
fs.rm(path, { recursive: true }) instead.

* add comment for original template.config.js

Upstream version of this config didn't change but still added a comment
for easier reference and traceability in the future.

* bump scaffold package.json version

major version bump since there are breaking changes being introduced
old projects need to be manually upgraded

* rewrite README.md

- more explicit system requirements
- remove duplicate version information that is available on the scaffold
- add meaningful commands examples

* move docs section into docs/README.md

* improve scripts/install.js comments details

* bump react-native-android docker image version

Source:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/.circleci/Dockerfiles/Dockerfile.android#L17

* bump ruby version in circleci and include Gemfile

following upstream version on the Gemfile:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/Gemfile#L1-L6

and it's inclusion in the template as well:
https://github.com/crowdbotics/modules/blob/419acef06c0e92f44bbbf88261018890d07f317a/scaffold/template/Gemfile#L1-L6

* remove custom/android/build.gradle

only the sdk version diverged from the old template version:
git diff b89bf7e:scaffold/template/android/build.gradle
b89bf7e:scaffold/template/custom/android/build.gradle

diff --git a/scaffold/template/android/build.gradle b/scaffold/template/custom/android/build.gradle
index 93232f5f..75a7fb29 100644
--- a/scaffold/template/android/build.gradle
+++ b/scaffold/template/custom/android/build.gradle
@@ -4,8 +4,8 @@ buildscript {
     ext {
         buildToolsVersion = "29.0.3"
         minSdkVersion = 21
-        compileSdkVersion = 29
-        targetSdkVersion = 29
+        compileSdkVersion = 31
+        targetSdkVersion = 31
         ndkVersion = "20.1.5948944"
     }
     repositories {

* update custom/android/app/build.gradle

previous divergence in release setup:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/build.gradle b89bf7e:scaffold/template/custom/android/app/build.gradle
diff --git a/scaffold/template/android/app/build.gradle b/scaffold/template/custom/android/app/build.gradle
index f75c1609..5f2a4948 100644
--- a/scaffold/template/android/app/build.gradle
+++ b/scaffold/template/custom/android/app/build.gradle
@@ -152,15 +152,21 @@ android {
             keyAlias 'androiddebugkey'
             keyPassword 'android'
         }
+        release {
+            storeFile file('my-upload-key.keystore')
+            storePassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+            keyAlias "$System.env.MYAPP_UPLOAD_KEY_ALIAS"
+            keyPassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+        }
     }
     buildTypes {
         debug {
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
         }
         release {
             // Caution! In production, you need to generate your own keystore file.
             // see https://reactnative.dev/docs/signed-apk-android.
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
             minifyEnabled enableProguardInReleaseBuilds
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
         }

* update custom/android/app/src/main/AndroidManifest.xml

Previous divergence in labels:
Note: The android:exported property is already true in the v0.71.7 template so
no changes there.

crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/src/main/AndroidManifest.xml b89bf7e:scaffold/template/custom/android/app/src/main/AndroidManifest.xml
diff --git a/scaffold/template/android/app/src/main/AndroidManifest.xml b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
index 6db8bad3..5d717754 100644
--- a/scaffold/template/android/app/src/main/AndroidManifest.xml
+++ b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
@@ -5,17 +5,18 @@

     <application
       android:name=".MainApplication"
-      android:label="@string/app_name"
+      android:label="@string/original_app_name"
       android:icon="@mipmap/ic_launcher"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:allowBackup="false"
       android:theme="@style/AppTheme">
       <activity
         android:name=".MainActivity"
-        android:label="@string/app_name"
+        android:label="@string/original_app_name"
         android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
         android:launchMode="singleTask"
-        android:windowSoftInputMode="adjustResize">
+        android:windowSoftInputMode="adjustResize"
+        android:exported="true">
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />

* remove custom/ios/Podfile and set NO_FLIPPER

react-native v0.71.7 now takes a NO_FLIPPER env var for
disabling/enabling the flipper tool. This replaces the use of the old
divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/ios/Podfile b89bf7e:scaffold/template/custom/ios/Podfile
diff --git a/scaffold/template/ios/Podfile b/scaffold/template/custom/ios/Podfile
index 18369a7e..ec68f9da 100644
--- a/scaffold/template/ios/Podfile
+++ b/scaffold/template/custom/ios/Podfile
@@ -21,7 +21,7 @@ target 'HelloWorld' do
   #
   # Note that if you have use_frameworks! enabled, Flipper will not work and
   # you should disable the next line.
-  use_flipper!()
+  # use_flipper!()

   post_install do |installer|
     react_native_post_install(installer)

* add typescript support in the scaffold

react-native v0.71.7 already includes Typescript support by default and
their entry component filename was changed to App.tsx

* bump major version of crowdbotics.json version

* update custom/package.json

replicate previous divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/package.json b89bf7e:scaffold/template/custom/package.json
diff --git a/scaffold/template/package.json b/scaffold/template/custom/package.json
index 0108163f..4212b2de 100644
--- a/scaffold/template/package.json
+++ b/scaffold/template/custom/package.json
@@ -7,11 +7,13 @@
     "ios": "react-native run-ios",
     "start": "react-native start",
     "test": "jest",
-    "lint": "eslint ."
+    "lint": "eslint .",
+    "web": "./node_modules/.bin/webpack-dev-server --config ./webpack.config.js --live-reload --color --mode development",
+    "web:build": "./node_modules/.bin/webpack --config ./webpack.config.js --color --mode production"
   },
   "dependencies": {
     "react": "17.0.1",
-    "react-native": "0.64.2"
+    "react-native": "0.64.4"
   },
   "devDependencies": {
     "@babel/core": "^7.12.9",
@@ -25,5 +27,13 @@
   },
   "jest": {
     "preset": "react-native"
+  },
+  "browserslist": {
+    "production": [">0.2%", "not dead", "not op_mini all"],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
   }
 }

* update custom/.gitignore

replicate previous Fastlane screenshots divergence:

crowdbotics@modules $ git diff b89bf7e:scaffold/template/_gitignore b89bf7e:scaffold/template/custom/.gitignore
diff --git a/scaffold/template/_gitignore b/scaffold/template/custom/.gitignore
index ad572e63..6399b6e0 100644
--- a/scaffold/template/_gitignore
+++ b/scaffold/template/custom/.gitignore
@@ -50,7 +50,10 @@ buck-out/

 */fastlane/report.xml
 */fastlane/Preview.html
-*/fastlane/screenshots
+
+# Commenting this out cause we need to store screenshots in the repo for
+# deployment through CircleCI.
+# */fastlane/screenshots

 # Bundle artifact
 *.jsbundle

* update custom/Gemfile

this file didn't exist in the previous react-native version template

* update custom/dependencies.json

This update is done by getting the names of all dependencies listed on
`dependencies.json` and then generating the following yarn commands.

Note: `ts-loader` was added to support Typescript in webpack builds.

```sh
yarn add axios @react-native-community/masked-view \
         @react-navigation/native react-native-gesture-handler \
         react-native-reanimated react-native-safe-area-context \
         react-native-screens @react-navigation/stack redux \
         react-redux @reduxjs/toolkit react-native-dotenv \
         react-native-responsive-screen react-native-elements \
         react-native-vector-icons react-dom \
         react-native-radio-buttons-group react-native-web
```
```sh
yarn add -D github:crowdbotics/babel-plugin-import-glob-meta \
            babel-loader url-loader webpack webpack-cli \
            webpack-dev-server babel-plugin-react-native-web \
            html-webpack-plugin ts-loader
```

Those commands are then run at `/scaffold/template` so that the semver
version ranges are resolved against the base react-native template.

The `git diff scaffold/template/package.json` of is then copied back
into `dependencies.json`

* remove deprecated react-native init version flag

This flag was removed upstream.

```sh
Error: Command failed: npx react-native init demo --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold --version 0.64.0
error Passing both "version" and "template" is not supported. The template you select determines the version of react-native used. Please use only one of these options, for example: --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold@x.y.z where x.y.z is the release of the template that contains the desired "react-native" version.
```

* add json extension to metro resolver

metro can't resolve app.json otherwise

* add root index.js

* add bin to root package.json

* add scaffold upgrade prompt

* add custom/ios/Podfile for debugging iOS build

* .circleci config - remove set ruby version on ios

* update docs/index.md

* update custom/Dockerfile node image to 18.16

* add fast-xml-parser and js-yaml dependencies

* add npx init script for migrating old apps

* add baked against latest version

* update files algorithm for App.js

* iterate files and cleanup caching mechanisms

* run babel transpile optionally based on babel flag

* fix section print for updateFiles

* add docs for upgrading scaffold

* add requirement for running the init script

* check all requirements in the script

* improve section messages for cookiecutter

* refactor manifest and baked variables

* remove python check, redudant with pipenv

* change order of mkdir arguments

* checkout previous version of scaffold on successive runs

* add json special case

minify the JSON before comparison

* add react-native-reanimated/plugin to babel config

reanimated docs instructs one to install the babel plugin
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/#babel-plugin

but our babel config didn't include it since it was made for 2.x

* support addition type for new files introduced

* replace slug mark in manifest with slug value

* add full scaffold manifest for upgrade

some stats:
- 146 files
- 55 directories
- 6 totally new files

* temporarily add branch to npx command

* github actions - upgrade node-version to 18

* fix lint issues

* rename custom/App.tsx into custom/App.js

for backwards compatibility with Studio

* add TODO notes for parsing project_slug

* add cookiecutter context onto crowdbotics.json

* copy .new file into the proper directory

all .new files were copied onto root before

* check if file exists before diffing

* improve git status

* remove untracked files on git reset action

* check whether file changed from PREVIOUS to NEW

compare the files across versions, skip if they are the same

* git add all files where upgrade is successful

* implement finding most frequent slug occurrence

* implement git diff printer and remove command

* move scaffold upgrade docs into it's own file

* remove dist/raw

this is an intermediary build artifact that is only used by
our cookie script, safe to remove and reduces repo size

* explain other lines in the package.json.diff

* fix lint issues in index.js

* introduce scaffold semver github action

checks and enforces semver version bumps at:
`scaffold/template/custom/.crowdbotics.json`

this action only get's triggered when there's some change made to the
following:
- scaffold/**
- dist/cookie/**

* remove redudant rm command and call it a document

* build: add Podfile.lock

* remove custom Podfile

only customization is debugging logs

* remove react-native-reanimated

@react-navigation/native no longer depends on it

* add override to android MainActivity.java

As suggested in the react-navigation installation instructions:
https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project

* scaffold - update fastlane README

* build: include files from pod install

* move all d5e04d8 template changes to custom

* revert gitignore changes in d5e04d8

* add --deployment to CI pod install step

* move Podfile.lock to custom

upstream template doesn't have a lockfile

* build: add missing packages

* undo all changes - only rm when untrackeds exist

* exclude addition files from comparison

* break rm into multiline rm

* improve diffing with prettier

* build: update podfile lock

* build: new xcode files

* build: xcode files update

* build: gem and pod update

* replace deprecated "@react-native-community/masked-view"

with "@react-native-masked-view/masked-view"

* make webpack config use App.js instead of App.tsx

* add react-native-reanimated dependency to the scaffold

* remove deployment flag

* configure webpack for react-native-reanimated

following 3.x docs here:
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support

* good looking welcome screen with image and text

* downgrade react-native-web upgrade gesture-handler

react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356

* make demo script use cookiecutter for both scaffolds

no longer rely on `npx react-native init` which doesn't
match what our backend does - which is to cookiecutter all scaffolds

* change order of bootstrap subcommands

* fix reanimated missing AAR on CI issue

older versions of reanimated package AAR, this is the latest old version
that includes it

* move scripts/config.js to config.js

* update index.js to support arbitrary versions

* regen custom yarn.lock

* pipenv lock

* add manifest script command

* automate manifest generation and consumption

add a new version to `config.js` and then
run `yarn run manifest` to generate a new manifest for that version

* git add cookie ios/Pods/Manifest.lock

this file was gitignored and missed before

* refactor console.log utils into config

* add scaffold/package.json check in semver script

* simplify PR template by linking checklists docs

include new checks for scaffold (all types of builds)

* document the semver script

* document the manifest script

* increase root package.json version

* remove duplicate store documentation

This file is already made available to users of the scaffold in [store/README.md](/scaffold/template/custom/store/README.md).

* remove duplicate docs/index.md

duplicate of /README.md

* introduce CHANGELOGs and redo documentation

- move @modules docs to the scaffold, users benefit from it
- remove target android/ios sdk versions, those are listed in CHANGELOG
- cleanup docs/index.md
- rename /docs files to be more meaningful
- document new semver and manifest scripts

* docs: add information about PATH requirements

cookiecutter and pg_config binaries need to be available

* process commands replace status with error checks

* yarn run bootstrap

* replace his with their

* update manifest: add modules/README.md

* update path to dot

* persisting build/demo

* store demo as artifact

* using workspaces

* remove demo path from attach_workspace

* added test build to ios fastlane

* run new lane in ios build step

* get node and yarn versions in node job

* removed all cache commands from config

* clean yarn cache before installing

* testing with node version 16.14.2

* changed node version required

* added new lane to iOS fastfile

* added scheme to xcodebuild command

* added dynamic workspace and schema

* create new lane for only building android app

* changed build_type to debug for gradle build

* upgrade scaffold minor version

* added changelog for scaffold

* corrected changelog version

* updated scaffold/package.json

* update docker image patch

* bumped python version to 3.8.17

* decouple fastlane config

* build: adds import fastfile from git

* build: yarn run raw && yarn run cookie

* build: fastfile updates

* build: yarn run raw && yarn run cookie

* yarn run raw && yarn run cookie

* update versions

* yarn run raw && yarn run cookie

* yarn run manifest

* lint

* update changelog

* updated nextVersionSHA

* fix scaffold

* remove lane additions to Fastfiles

* spelling error

* add github to known hosts

* create .ssh directory

* corrected yaml schema

* remove mapping command

* fixed yaml schema

* temporary branch change

* set FASTLANE_CONFIG_VERSION environment variable

* se export for env var

* default FASTLANE_CONFIG_VERSION

* removed trailing space

* version commented out for testing

* fix env var

* yarn run raw && yarn run cookie

* update nextVersionSHA

* update branch and version in fastfile

* add v prefix to version

* remove equal signs

* remove v prefix

* remove version from import_from_git command

* updated changelog

* updated versions

* add new upgrade.versions to config.js

* fixed versioning

---------

Co-authored-by: Daniel <daniel.s@crowdbotics.com>
Co-authored-by: Muhammad Abdullah Abid <abd@abd.dev>
@github-actions
Copy link

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.

@github-actions github-actions bot added the stale label Jul 19, 2023
JGreenlee added a commit to JGreenlee/e-mission-phone that referenced this issue Aug 18, 2023
Compared to 0.18, it looks like 0.19 has some changes around aria/accessibility that we may benefit from.
We had been sticking with react-native-web 0.18.x because of react-navigation/react-navigation#11356
It was fixed in 0.19.7 so we can use it now.
danielsousaio added a commit to saad-abid-crowdbotics/modules that referenced this issue Aug 23, 2023
* bump root package.json react-native to v0.71.7

- regenerate lockfile

* bump node to latest on .nvmrc

* set minimum node version on package.json to 16

* yarn run template

- overwrite all of the /scaffold/template directory with the
template from React Native v0.71.7
- keep /scaffold/template/custom intact

* scripts: replace all fs.rmdirSync with fs.rmSync

When running scripts with node v18.16.0 the following was logged:
[DEP0147] DeprecationWarning: In future versions of Node.js,
fs.rmdir(path, { recursive: true }) will be removed. Use
fs.rm(path, { recursive: true }) instead.

* add comment for original template.config.js

Upstream version of this config didn't change but still added a comment
for easier reference and traceability in the future.

* bump scaffold package.json version

major version bump since there are breaking changes being introduced
old projects need to be manually upgraded

* rewrite README.md

- more explicit system requirements
- remove duplicate version information that is available on the scaffold
- add meaningful commands examples

* move docs section into docs/README.md

* improve scripts/install.js comments details

* bump react-native-android docker image version

Source:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/.circleci/Dockerfiles/Dockerfile.android#L17

* bump ruby version in circleci and include Gemfile

following upstream version on the Gemfile:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/Gemfile#L1-L6

and it's inclusion in the template as well:
https://github.com/crowdbotics/modules/blob/419acef06c0e92f44bbbf88261018890d07f317a/scaffold/template/Gemfile#L1-L6

* remove custom/android/build.gradle

only the sdk version diverged from the old template version:
git diff b89bf7e:scaffold/template/android/build.gradle
b89bf7e:scaffold/template/custom/android/build.gradle

diff --git a/scaffold/template/android/build.gradle b/scaffold/template/custom/android/build.gradle
index 93232f5f..75a7fb29 100644
--- a/scaffold/template/android/build.gradle
+++ b/scaffold/template/custom/android/build.gradle
@@ -4,8 +4,8 @@ buildscript {
     ext {
         buildToolsVersion = "29.0.3"
         minSdkVersion = 21
-        compileSdkVersion = 29
-        targetSdkVersion = 29
+        compileSdkVersion = 31
+        targetSdkVersion = 31
         ndkVersion = "20.1.5948944"
     }
     repositories {

* update custom/android/app/build.gradle

previous divergence in release setup:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/build.gradle b89bf7e:scaffold/template/custom/android/app/build.gradle
diff --git a/scaffold/template/android/app/build.gradle b/scaffold/template/custom/android/app/build.gradle
index f75c1609..5f2a4948 100644
--- a/scaffold/template/android/app/build.gradle
+++ b/scaffold/template/custom/android/app/build.gradle
@@ -152,15 +152,21 @@ android {
             keyAlias 'androiddebugkey'
             keyPassword 'android'
         }
+        release {
+            storeFile file('my-upload-key.keystore')
+            storePassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+            keyAlias "$System.env.MYAPP_UPLOAD_KEY_ALIAS"
+            keyPassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+        }
     }
     buildTypes {
         debug {
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
         }
         release {
             // Caution! In production, you need to generate your own keystore file.
             // see https://reactnative.dev/docs/signed-apk-android.
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
             minifyEnabled enableProguardInReleaseBuilds
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
         }

* update custom/android/app/src/main/AndroidManifest.xml

Previous divergence in labels:
Note: The android:exported property is already true in the v0.71.7 template so
no changes there.

crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/src/main/AndroidManifest.xml b89bf7e:scaffold/template/custom/android/app/src/main/AndroidManifest.xml
diff --git a/scaffold/template/android/app/src/main/AndroidManifest.xml b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
index 6db8bad3..5d717754 100644
--- a/scaffold/template/android/app/src/main/AndroidManifest.xml
+++ b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
@@ -5,17 +5,18 @@

     <application
       android:name=".MainApplication"
-      android:label="@string/app_name"
+      android:label="@string/original_app_name"
       android:icon="@mipmap/ic_launcher"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:allowBackup="false"
       android:theme="@style/AppTheme">
       <activity
         android:name=".MainActivity"
-        android:label="@string/app_name"
+        android:label="@string/original_app_name"
         android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
         android:launchMode="singleTask"
-        android:windowSoftInputMode="adjustResize">
+        android:windowSoftInputMode="adjustResize"
+        android:exported="true">
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />

* remove custom/ios/Podfile and set NO_FLIPPER

react-native v0.71.7 now takes a NO_FLIPPER env var for
disabling/enabling the flipper tool. This replaces the use of the old
divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/ios/Podfile b89bf7e:scaffold/template/custom/ios/Podfile
diff --git a/scaffold/template/ios/Podfile b/scaffold/template/custom/ios/Podfile
index 18369a7e..ec68f9da 100644
--- a/scaffold/template/ios/Podfile
+++ b/scaffold/template/custom/ios/Podfile
@@ -21,7 +21,7 @@ target 'HelloWorld' do
   #
   # Note that if you have use_frameworks! enabled, Flipper will not work and
   # you should disable the next line.
-  use_flipper!()
+  # use_flipper!()

   post_install do |installer|
     react_native_post_install(installer)

* add typescript support in the scaffold

react-native v0.71.7 already includes Typescript support by default and
their entry component filename was changed to App.tsx

* bump major version of crowdbotics.json version

* update custom/package.json

replicate previous divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/package.json b89bf7e:scaffold/template/custom/package.json
diff --git a/scaffold/template/package.json b/scaffold/template/custom/package.json
index 0108163f..4212b2de 100644
--- a/scaffold/template/package.json
+++ b/scaffold/template/custom/package.json
@@ -7,11 +7,13 @@
     "ios": "react-native run-ios",
     "start": "react-native start",
     "test": "jest",
-    "lint": "eslint ."
+    "lint": "eslint .",
+    "web": "./node_modules/.bin/webpack-dev-server --config ./webpack.config.js --live-reload --color --mode development",
+    "web:build": "./node_modules/.bin/webpack --config ./webpack.config.js --color --mode production"
   },
   "dependencies": {
     "react": "17.0.1",
-    "react-native": "0.64.2"
+    "react-native": "0.64.4"
   },
   "devDependencies": {
     "@babel/core": "^7.12.9",
@@ -25,5 +27,13 @@
   },
   "jest": {
     "preset": "react-native"
+  },
+  "browserslist": {
+    "production": [">0.2%", "not dead", "not op_mini all"],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
   }
 }

* update custom/.gitignore

replicate previous Fastlane screenshots divergence:

crowdbotics@modules $ git diff b89bf7e:scaffold/template/_gitignore b89bf7e:scaffold/template/custom/.gitignore
diff --git a/scaffold/template/_gitignore b/scaffold/template/custom/.gitignore
index ad572e63..6399b6e0 100644
--- a/scaffold/template/_gitignore
+++ b/scaffold/template/custom/.gitignore
@@ -50,7 +50,10 @@ buck-out/

 */fastlane/report.xml
 */fastlane/Preview.html
-*/fastlane/screenshots
+
+# Commenting this out cause we need to store screenshots in the repo for
+# deployment through CircleCI.
+# */fastlane/screenshots

 # Bundle artifact
 *.jsbundle

* update custom/Gemfile

this file didn't exist in the previous react-native version template

* update custom/dependencies.json

This update is done by getting the names of all dependencies listed on
`dependencies.json` and then generating the following yarn commands.

Note: `ts-loader` was added to support Typescript in webpack builds.

```sh
yarn add axios @react-native-community/masked-view \
         @react-navigation/native react-native-gesture-handler \
         react-native-reanimated react-native-safe-area-context \
         react-native-screens @react-navigation/stack redux \
         react-redux @reduxjs/toolkit react-native-dotenv \
         react-native-responsive-screen react-native-elements \
         react-native-vector-icons react-dom \
         react-native-radio-buttons-group react-native-web
```
```sh
yarn add -D github:crowdbotics/babel-plugin-import-glob-meta \
            babel-loader url-loader webpack webpack-cli \
            webpack-dev-server babel-plugin-react-native-web \
            html-webpack-plugin ts-loader
```

Those commands are then run at `/scaffold/template` so that the semver
version ranges are resolved against the base react-native template.

The `git diff scaffold/template/package.json` of is then copied back
into `dependencies.json`

* remove deprecated react-native init version flag

This flag was removed upstream.

```sh
Error: Command failed: npx react-native init demo --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold --version 0.64.0
error Passing both "version" and "template" is not supported. The template you select determines the version of react-native used. Please use only one of these options, for example: --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold@x.y.z where x.y.z is the release of the template that contains the desired "react-native" version.
```

* add json extension to metro resolver

metro can't resolve app.json otherwise

* add root index.js

* add bin to root package.json

* add scaffold upgrade prompt

* add custom/ios/Podfile for debugging iOS build

* .circleci config - remove set ruby version on ios

* update docs/index.md

* update custom/Dockerfile node image to 18.16

* add fast-xml-parser and js-yaml dependencies

* add npx init script for migrating old apps

* add baked against latest version

* update files algorithm for App.js

* iterate files and cleanup caching mechanisms

* run babel transpile optionally based on babel flag

* fix section print for updateFiles

* add docs for upgrading scaffold

* add requirement for running the init script

* check all requirements in the script

* improve section messages for cookiecutter

* refactor manifest and baked variables

* remove python check, redudant with pipenv

* change order of mkdir arguments

* checkout previous version of scaffold on successive runs

* add json special case

minify the JSON before comparison

* add react-native-reanimated/plugin to babel config

reanimated docs instructs one to install the babel plugin
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/#babel-plugin

but our babel config didn't include it since it was made for 2.x

* support addition type for new files introduced

* replace slug mark in manifest with slug value

* add full scaffold manifest for upgrade

some stats:
- 146 files
- 55 directories
- 6 totally new files

* temporarily add branch to npx command

* github actions - upgrade node-version to 18

* fix lint issues

* rename custom/App.tsx into custom/App.js

for backwards compatibility with Studio

* add TODO notes for parsing project_slug

* add cookiecutter context onto crowdbotics.json

* copy .new file into the proper directory

all .new files were copied onto root before

* check if file exists before diffing

* improve git status

* remove untracked files on git reset action

* check whether file changed from PREVIOUS to NEW

compare the files across versions, skip if they are the same

* git add all files where upgrade is successful

* implement finding most frequent slug occurrence

* implement git diff printer and remove command

* move scaffold upgrade docs into it's own file

* remove dist/raw

this is an intermediary build artifact that is only used by
our cookie script, safe to remove and reduces repo size

* explain other lines in the package.json.diff

* fix lint issues in index.js

* introduce scaffold semver github action

checks and enforces semver version bumps at:
`scaffold/template/custom/.crowdbotics.json`

this action only get's triggered when there's some change made to the
following:
- scaffold/**
- dist/cookie/**

* remove redudant rm command and call it a document

* build: add Podfile.lock

* remove custom Podfile

only customization is debugging logs

* remove react-native-reanimated

@react-navigation/native no longer depends on it

* add override to android MainActivity.java

As suggested in the react-navigation installation instructions:
https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project

* scaffold - update fastlane README

* build: include files from pod install

* move all d5e04d8 template changes to custom

* revert gitignore changes in d5e04d8

* add --deployment to CI pod install step

* move Podfile.lock to custom

upstream template doesn't have a lockfile

* build: add missing packages

* undo all changes - only rm when untrackeds exist

* exclude addition files from comparison

* break rm into multiline rm

* improve diffing with prettier

* build: update podfile lock

* build: new xcode files

* build: xcode files update

* build: gem and pod update

* replace deprecated "@react-native-community/masked-view"

with "@react-native-masked-view/masked-view"

* make webpack config use App.js instead of App.tsx

* add react-native-reanimated dependency to the scaffold

* remove deployment flag

* configure webpack for react-native-reanimated

following 3.x docs here:
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support

* good looking welcome screen with image and text

* downgrade react-native-web upgrade gesture-handler

react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356

* make demo script use cookiecutter for both scaffolds

no longer rely on `npx react-native init` which doesn't
match what our backend does - which is to cookiecutter all scaffolds

* change order of bootstrap subcommands

* fix reanimated missing AAR on CI issue

older versions of reanimated package AAR, this is the latest old version
that includes it

* move scripts/config.js to config.js

* update index.js to support arbitrary versions

* regen custom yarn.lock

* pipenv lock

* add manifest script command

* automate manifest generation and consumption

add a new version to `config.js` and then
run `yarn run manifest` to generate a new manifest for that version

* git add cookie ios/Pods/Manifest.lock

this file was gitignored and missed before

* refactor console.log utils into config

* add scaffold/package.json check in semver script

* simplify PR template by linking checklists docs

include new checks for scaffold (all types of builds)

* document the semver script

* document the manifest script

* increase root package.json version

* remove duplicate store documentation

This file is already made available to users of the scaffold in [store/README.md](/scaffold/template/custom/store/README.md).

* remove duplicate docs/index.md

duplicate of /README.md

* introduce CHANGELOGs and redo documentation

- move @modules docs to the scaffold, users benefit from it
- remove target android/ios sdk versions, those are listed in CHANGELOG
- cleanup docs/index.md
- rename /docs files to be more meaningful
- document new semver and manifest scripts

* docs: add information about PATH requirements

cookiecutter and pg_config binaries need to be available

* process commands replace status with error checks

* yarn run bootstrap

* replace his with their

* update manifest: add modules/README.md

* fix: require node 16 and above at minimum

not including the minor version in the range forces at the very least 17

---------

Co-authored-by: Muhammad Abdullah Abid <abd@abd.dev>
danielsousaio added a commit to saad-abid-crowdbotics/modules that referenced this issue Aug 23, 2023
* YAML file for CircleCI

* renamed process in YAML file

* renamed YAML file

* config yaml update

* step rename

* add demo directory before creating app

* added pipenv as well as dependancies

* added python3.8 installation to the pipeline

* changed docker image

* remove pipenv installation

* specified python3.8.13 version

* removed unnecessary pipeline lines

* bump root package.json react-native to v0.71.7

- regenerate lockfile

* bump node to latest on .nvmrc

* set minimum node version on package.json to 16

* yarn run template

- overwrite all of the /scaffold/template directory with the
template from React Native v0.71.7
- keep /scaffold/template/custom intact

* scripts: replace all fs.rmdirSync with fs.rmSync

When running scripts with node v18.16.0 the following was logged:
[DEP0147] DeprecationWarning: In future versions of Node.js,
fs.rmdir(path, { recursive: true }) will be removed. Use
fs.rm(path, { recursive: true }) instead.

* add comment for original template.config.js

Upstream version of this config didn't change but still added a comment
for easier reference and traceability in the future.

* bump scaffold package.json version

major version bump since there are breaking changes being introduced
old projects need to be manually upgraded

* rewrite README.md

- more explicit system requirements
- remove duplicate version information that is available on the scaffold
- add meaningful commands examples

* move docs section into docs/README.md

* improve scripts/install.js comments details

* bump react-native-android docker image version

Source:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/.circleci/Dockerfiles/Dockerfile.android#L17

* bump ruby version in circleci and include Gemfile

following upstream version on the Gemfile:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/Gemfile#L1-L6

and it's inclusion in the template as well:
https://github.com/crowdbotics/modules/blob/419acef06c0e92f44bbbf88261018890d07f317a/scaffold/template/Gemfile#L1-L6

* remove custom/android/build.gradle

only the sdk version diverged from the old template version:
git diff b89bf7e:scaffold/template/android/build.gradle
b89bf7e:scaffold/template/custom/android/build.gradle

diff --git a/scaffold/template/android/build.gradle b/scaffold/template/custom/android/build.gradle
index 93232f5f..75a7fb29 100644
--- a/scaffold/template/android/build.gradle
+++ b/scaffold/template/custom/android/build.gradle
@@ -4,8 +4,8 @@ buildscript {
     ext {
         buildToolsVersion = "29.0.3"
         minSdkVersion = 21
-        compileSdkVersion = 29
-        targetSdkVersion = 29
+        compileSdkVersion = 31
+        targetSdkVersion = 31
         ndkVersion = "20.1.5948944"
     }
     repositories {

* update custom/android/app/build.gradle

previous divergence in release setup:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/build.gradle b89bf7e:scaffold/template/custom/android/app/build.gradle
diff --git a/scaffold/template/android/app/build.gradle b/scaffold/template/custom/android/app/build.gradle
index f75c1609..5f2a4948 100644
--- a/scaffold/template/android/app/build.gradle
+++ b/scaffold/template/custom/android/app/build.gradle
@@ -152,15 +152,21 @@ android {
             keyAlias 'androiddebugkey'
             keyPassword 'android'
         }
+        release {
+            storeFile file('my-upload-key.keystore')
+            storePassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+            keyAlias "$System.env.MYAPP_UPLOAD_KEY_ALIAS"
+            keyPassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+        }
     }
     buildTypes {
         debug {
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
         }
         release {
             // Caution! In production, you need to generate your own keystore file.
             // see https://reactnative.dev/docs/signed-apk-android.
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
             minifyEnabled enableProguardInReleaseBuilds
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
         }

* update custom/android/app/src/main/AndroidManifest.xml

Previous divergence in labels:
Note: The android:exported property is already true in the v0.71.7 template so
no changes there.

crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/src/main/AndroidManifest.xml b89bf7e:scaffold/template/custom/android/app/src/main/AndroidManifest.xml
diff --git a/scaffold/template/android/app/src/main/AndroidManifest.xml b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
index 6db8bad3..5d717754 100644
--- a/scaffold/template/android/app/src/main/AndroidManifest.xml
+++ b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
@@ -5,17 +5,18 @@

     <application
       android:name=".MainApplication"
-      android:label="@string/app_name"
+      android:label="@string/original_app_name"
       android:icon="@mipmap/ic_launcher"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:allowBackup="false"
       android:theme="@style/AppTheme">
       <activity
         android:name=".MainActivity"
-        android:label="@string/app_name"
+        android:label="@string/original_app_name"
         android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
         android:launchMode="singleTask"
-        android:windowSoftInputMode="adjustResize">
+        android:windowSoftInputMode="adjustResize"
+        android:exported="true">
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />

* remove custom/ios/Podfile and set NO_FLIPPER

react-native v0.71.7 now takes a NO_FLIPPER env var for
disabling/enabling the flipper tool. This replaces the use of the old
divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/ios/Podfile b89bf7e:scaffold/template/custom/ios/Podfile
diff --git a/scaffold/template/ios/Podfile b/scaffold/template/custom/ios/Podfile
index 18369a7e..ec68f9da 100644
--- a/scaffold/template/ios/Podfile
+++ b/scaffold/template/custom/ios/Podfile
@@ -21,7 +21,7 @@ target 'HelloWorld' do
   #
   # Note that if you have use_frameworks! enabled, Flipper will not work and
   # you should disable the next line.
-  use_flipper!()
+  # use_flipper!()

   post_install do |installer|
     react_native_post_install(installer)

* add typescript support in the scaffold

react-native v0.71.7 already includes Typescript support by default and
their entry component filename was changed to App.tsx

* bump major version of crowdbotics.json version

* update custom/package.json

replicate previous divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/package.json b89bf7e:scaffold/template/custom/package.json
diff --git a/scaffold/template/package.json b/scaffold/template/custom/package.json
index 0108163f..4212b2de 100644
--- a/scaffold/template/package.json
+++ b/scaffold/template/custom/package.json
@@ -7,11 +7,13 @@
     "ios": "react-native run-ios",
     "start": "react-native start",
     "test": "jest",
-    "lint": "eslint ."
+    "lint": "eslint .",
+    "web": "./node_modules/.bin/webpack-dev-server --config ./webpack.config.js --live-reload --color --mode development",
+    "web:build": "./node_modules/.bin/webpack --config ./webpack.config.js --color --mode production"
   },
   "dependencies": {
     "react": "17.0.1",
-    "react-native": "0.64.2"
+    "react-native": "0.64.4"
   },
   "devDependencies": {
     "@babel/core": "^7.12.9",
@@ -25,5 +27,13 @@
   },
   "jest": {
     "preset": "react-native"
+  },
+  "browserslist": {
+    "production": [">0.2%", "not dead", "not op_mini all"],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
   }
 }

* update custom/.gitignore

replicate previous Fastlane screenshots divergence:

crowdbotics@modules $ git diff b89bf7e:scaffold/template/_gitignore b89bf7e:scaffold/template/custom/.gitignore
diff --git a/scaffold/template/_gitignore b/scaffold/template/custom/.gitignore
index ad572e63..6399b6e0 100644
--- a/scaffold/template/_gitignore
+++ b/scaffold/template/custom/.gitignore
@@ -50,7 +50,10 @@ buck-out/

 */fastlane/report.xml
 */fastlane/Preview.html
-*/fastlane/screenshots
+
+# Commenting this out cause we need to store screenshots in the repo for
+# deployment through CircleCI.
+# */fastlane/screenshots

 # Bundle artifact
 *.jsbundle

* update custom/Gemfile

this file didn't exist in the previous react-native version template

* update custom/dependencies.json

This update is done by getting the names of all dependencies listed on
`dependencies.json` and then generating the following yarn commands.

Note: `ts-loader` was added to support Typescript in webpack builds.

```sh
yarn add axios @react-native-community/masked-view \
         @react-navigation/native react-native-gesture-handler \
         react-native-reanimated react-native-safe-area-context \
         react-native-screens @react-navigation/stack redux \
         react-redux @reduxjs/toolkit react-native-dotenv \
         react-native-responsive-screen react-native-elements \
         react-native-vector-icons react-dom \
         react-native-radio-buttons-group react-native-web
```
```sh
yarn add -D github:crowdbotics/babel-plugin-import-glob-meta \
            babel-loader url-loader webpack webpack-cli \
            webpack-dev-server babel-plugin-react-native-web \
            html-webpack-plugin ts-loader
```

Those commands are then run at `/scaffold/template` so that the semver
version ranges are resolved against the base react-native template.

The `git diff scaffold/template/package.json` of is then copied back
into `dependencies.json`

* remove deprecated react-native init version flag

This flag was removed upstream.

```sh
Error: Command failed: npx react-native init demo --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold --version 0.64.0
error Passing both "version" and "template" is not supported. The template you select determines the version of react-native used. Please use only one of these options, for example: --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold@x.y.z where x.y.z is the release of the template that contains the desired "react-native" version.
```

* add json extension to metro resolver

metro can't resolve app.json otherwise

* add root index.js

* add bin to root package.json

* add scaffold upgrade prompt

* add custom/ios/Podfile for debugging iOS build

* .circleci config - remove set ruby version on ios

* update docs/index.md

* update custom/Dockerfile node image to 18.16

* add fast-xml-parser and js-yaml dependencies

* add npx init script for migrating old apps

* add baked against latest version

* update files algorithm for App.js

* iterate files and cleanup caching mechanisms

* run babel transpile optionally based on babel flag

* fix section print for updateFiles

* add docs for upgrading scaffold

* add requirement for running the init script

* check all requirements in the script

* improve section messages for cookiecutter

* refactor manifest and baked variables

* remove python check, redudant with pipenv

* change order of mkdir arguments

* checkout previous version of scaffold on successive runs

* add json special case

minify the JSON before comparison

* add react-native-reanimated/plugin to babel config

reanimated docs instructs one to install the babel plugin
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/#babel-plugin

but our babel config didn't include it since it was made for 2.x

* support addition type for new files introduced

* replace slug mark in manifest with slug value

* add full scaffold manifest for upgrade

some stats:
- 146 files
- 55 directories
- 6 totally new files

* temporarily add branch to npx command

* github actions - upgrade node-version to 18

* fix lint issues

* rename custom/App.tsx into custom/App.js

for backwards compatibility with Studio

* add TODO notes for parsing project_slug

* add cookiecutter context onto crowdbotics.json

* copy .new file into the proper directory

all .new files were copied onto root before

* check if file exists before diffing

* improve git status

* remove untracked files on git reset action

* check whether file changed from PREVIOUS to NEW

compare the files across versions, skip if they are the same

* git add all files where upgrade is successful

* implement finding most frequent slug occurrence

* implement git diff printer and remove command

* move scaffold upgrade docs into it's own file

* remove dist/raw

this is an intermediary build artifact that is only used by
our cookie script, safe to remove and reduces repo size

* explain other lines in the package.json.diff

* fix lint issues in index.js

* introduce scaffold semver github action

checks and enforces semver version bumps at:
`scaffold/template/custom/.crowdbotics.json`

this action only get's triggered when there's some change made to the
following:
- scaffold/**
- dist/cookie/**

* remove redudant rm command and call it a document

* build: add Podfile.lock

* remove custom Podfile

only customization is debugging logs

* remove react-native-reanimated

@react-navigation/native no longer depends on it

* add override to android MainActivity.java

As suggested in the react-navigation installation instructions:
https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project

* scaffold - update fastlane README

* build: include files from pod install

* move all d5e04d8 template changes to custom

* revert gitignore changes in d5e04d8

* add --deployment to CI pod install step

* move Podfile.lock to custom

upstream template doesn't have a lockfile

* build: add missing packages

* undo all changes - only rm when untrackeds exist

* exclude addition files from comparison

* break rm into multiline rm

* improve diffing with prettier

* build: update podfile lock

* build: new xcode files

* build: xcode files update

* build: gem and pod update

* replace deprecated "@react-native-community/masked-view"

with "@react-native-masked-view/masked-view"

* make webpack config use App.js instead of App.tsx

* add react-native-reanimated dependency to the scaffold

* remove deployment flag

* configure webpack for react-native-reanimated

following 3.x docs here:
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support

* good looking welcome screen with image and text

* downgrade react-native-web upgrade gesture-handler

react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356

* make demo script use cookiecutter for both scaffolds

no longer rely on `npx react-native init` which doesn't
match what our backend does - which is to cookiecutter all scaffolds

* change order of bootstrap subcommands

* fix reanimated missing AAR on CI issue

older versions of reanimated package AAR, this is the latest old version
that includes it

* move scripts/config.js to config.js

* update index.js to support arbitrary versions

* regen custom yarn.lock

* pipenv lock

* add manifest script command

* automate manifest generation and consumption

add a new version to `config.js` and then
run `yarn run manifest` to generate a new manifest for that version

* git add cookie ios/Pods/Manifest.lock

this file was gitignored and missed before

* refactor console.log utils into config

* add scaffold/package.json check in semver script

* simplify PR template by linking checklists docs

include new checks for scaffold (all types of builds)

* document the semver script

* document the manifest script

* increase root package.json version

* remove duplicate store documentation

This file is already made available to users of the scaffold in [store/README.md](/scaffold/template/custom/store/README.md).

* remove duplicate docs/index.md

duplicate of /README.md

* introduce CHANGELOGs and redo documentation

- move @modules docs to the scaffold, users benefit from it
- remove target android/ios sdk versions, those are listed in CHANGELOG
- cleanup docs/index.md
- rename /docs files to be more meaningful
- document new semver and manifest scripts

* docs: add information about PATH requirements

cookiecutter and pg_config binaries need to be available

* process commands replace status with error checks

* yarn run bootstrap

* replace his with their

* update manifest: add modules/README.md

* update path to dot

* persisting build/demo

* store demo as artifact

* using workspaces

* remove demo path from attach_workspace

* added test build to ios fastlane

* run new lane in ios build step

* get node and yarn versions in node job

* removed all cache commands from config

* clean yarn cache before installing

* testing with node version 16.14.2

* changed node version required

* added new lane to iOS fastfile

* added scheme to xcodebuild command

* added dynamic workspace and schema

* create new lane for only building android app

* changed build_type to debug for gradle build

* upgrade scaffold minor version

* added changelog for scaffold

* corrected changelog version

* updated scaffold/package.json

* update docker image patch

* bumped python version to 3.8.17

* decouple fastlane config

* build: adds import fastfile from git

* build: yarn run raw && yarn run cookie

* build: fastfile updates

* build: yarn run raw && yarn run cookie

* yarn run raw && yarn run cookie

* update versions

* yarn run raw && yarn run cookie

* yarn run manifest

* lint

* update changelog

* updated nextVersionSHA

* fix scaffold

* remove lane additions to Fastfiles

* spelling error

* add github to known hosts

* create .ssh directory

* corrected yaml schema

* remove mapping command

* fixed yaml schema

* temporary branch change

* set FASTLANE_CONFIG_VERSION environment variable

* se export for env var

* default FASTLANE_CONFIG_VERSION

* removed trailing space

* version commented out for testing

* fix env var

* yarn run raw && yarn run cookie

* update nextVersionSHA

* update branch and version in fastfile

* add v prefix to version

* remove equal signs

* remove v prefix

* remove version from import_from_git command

* updated changelog

* updated versions

* add new upgrade.versions to config.js

* fixed versioning

---------

Co-authored-by: Daniel <daniel.s@crowdbotics.com>
Co-authored-by: Muhammad Abdullah Abid <abd@abd.dev>
danielsousaio added a commit to saad-abid-crowdbotics/modules that referenced this issue Aug 23, 2023
* bump root package.json react-native to v0.71.7

- regenerate lockfile

* bump node to latest on .nvmrc

* set minimum node version on package.json to 16

* yarn run template

- overwrite all of the /scaffold/template directory with the
template from React Native v0.71.7
- keep /scaffold/template/custom intact

* scripts: replace all fs.rmdirSync with fs.rmSync

When running scripts with node v18.16.0 the following was logged:
[DEP0147] DeprecationWarning: In future versions of Node.js,
fs.rmdir(path, { recursive: true }) will be removed. Use
fs.rm(path, { recursive: true }) instead.

* add comment for original template.config.js

Upstream version of this config didn't change but still added a comment
for easier reference and traceability in the future.

* bump scaffold package.json version

major version bump since there are breaking changes being introduced
old projects need to be manually upgraded

* rewrite README.md

- more explicit system requirements
- remove duplicate version information that is available on the scaffold
- add meaningful commands examples

* move docs section into docs/README.md

* improve scripts/install.js comments details

* bump react-native-android docker image version

Source:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/.circleci/Dockerfiles/Dockerfile.android#L17

* bump ruby version in circleci and include Gemfile

following upstream version on the Gemfile:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/Gemfile#L1-L6

and it's inclusion in the template as well:
https://github.com/crowdbotics/modules/blob/419acef06c0e92f44bbbf88261018890d07f317a/scaffold/template/Gemfile#L1-L6

* remove custom/android/build.gradle

only the sdk version diverged from the old template version:
git diff b89bf7e:scaffold/template/android/build.gradle
b89bf7e:scaffold/template/custom/android/build.gradle

diff --git a/scaffold/template/android/build.gradle b/scaffold/template/custom/android/build.gradle
index 93232f5f..75a7fb29 100644
--- a/scaffold/template/android/build.gradle
+++ b/scaffold/template/custom/android/build.gradle
@@ -4,8 +4,8 @@ buildscript {
     ext {
         buildToolsVersion = "29.0.3"
         minSdkVersion = 21
-        compileSdkVersion = 29
-        targetSdkVersion = 29
+        compileSdkVersion = 31
+        targetSdkVersion = 31
         ndkVersion = "20.1.5948944"
     }
     repositories {

* update custom/android/app/build.gradle

previous divergence in release setup:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/build.gradle b89bf7e:scaffold/template/custom/android/app/build.gradle
diff --git a/scaffold/template/android/app/build.gradle b/scaffold/template/custom/android/app/build.gradle
index f75c1609..5f2a4948 100644
--- a/scaffold/template/android/app/build.gradle
+++ b/scaffold/template/custom/android/app/build.gradle
@@ -152,15 +152,21 @@ android {
             keyAlias 'androiddebugkey'
             keyPassword 'android'
         }
+        release {
+            storeFile file('my-upload-key.keystore')
+            storePassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+            keyAlias "$System.env.MYAPP_UPLOAD_KEY_ALIAS"
+            keyPassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+        }
     }
     buildTypes {
         debug {
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
         }
         release {
             // Caution! In production, you need to generate your own keystore file.
             // see https://reactnative.dev/docs/signed-apk-android.
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
             minifyEnabled enableProguardInReleaseBuilds
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
         }

* update custom/android/app/src/main/AndroidManifest.xml

Previous divergence in labels:
Note: The android:exported property is already true in the v0.71.7 template so
no changes there.

crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/src/main/AndroidManifest.xml b89bf7e:scaffold/template/custom/android/app/src/main/AndroidManifest.xml
diff --git a/scaffold/template/android/app/src/main/AndroidManifest.xml b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
index 6db8bad3..5d717754 100644
--- a/scaffold/template/android/app/src/main/AndroidManifest.xml
+++ b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
@@ -5,17 +5,18 @@

     <application
       android:name=".MainApplication"
-      android:label="@string/app_name"
+      android:label="@string/original_app_name"
       android:icon="@mipmap/ic_launcher"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:allowBackup="false"
       android:theme="@style/AppTheme">
       <activity
         android:name=".MainActivity"
-        android:label="@string/app_name"
+        android:label="@string/original_app_name"
         android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
         android:launchMode="singleTask"
-        android:windowSoftInputMode="adjustResize">
+        android:windowSoftInputMode="adjustResize"
+        android:exported="true">
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />

* remove custom/ios/Podfile and set NO_FLIPPER

react-native v0.71.7 now takes a NO_FLIPPER env var for
disabling/enabling the flipper tool. This replaces the use of the old
divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/ios/Podfile b89bf7e:scaffold/template/custom/ios/Podfile
diff --git a/scaffold/template/ios/Podfile b/scaffold/template/custom/ios/Podfile
index 18369a7e..ec68f9da 100644
--- a/scaffold/template/ios/Podfile
+++ b/scaffold/template/custom/ios/Podfile
@@ -21,7 +21,7 @@ target 'HelloWorld' do
   #
   # Note that if you have use_frameworks! enabled, Flipper will not work and
   # you should disable the next line.
-  use_flipper!()
+  # use_flipper!()

   post_install do |installer|
     react_native_post_install(installer)

* add typescript support in the scaffold

react-native v0.71.7 already includes Typescript support by default and
their entry component filename was changed to App.tsx

* bump major version of crowdbotics.json version

* update custom/package.json

replicate previous divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/package.json b89bf7e:scaffold/template/custom/package.json
diff --git a/scaffold/template/package.json b/scaffold/template/custom/package.json
index 0108163f..4212b2de 100644
--- a/scaffold/template/package.json
+++ b/scaffold/template/custom/package.json
@@ -7,11 +7,13 @@
     "ios": "react-native run-ios",
     "start": "react-native start",
     "test": "jest",
-    "lint": "eslint ."
+    "lint": "eslint .",
+    "web": "./node_modules/.bin/webpack-dev-server --config ./webpack.config.js --live-reload --color --mode development",
+    "web:build": "./node_modules/.bin/webpack --config ./webpack.config.js --color --mode production"
   },
   "dependencies": {
     "react": "17.0.1",
-    "react-native": "0.64.2"
+    "react-native": "0.64.4"
   },
   "devDependencies": {
     "@babel/core": "^7.12.9",
@@ -25,5 +27,13 @@
   },
   "jest": {
     "preset": "react-native"
+  },
+  "browserslist": {
+    "production": [">0.2%", "not dead", "not op_mini all"],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
   }
 }

* update custom/.gitignore

replicate previous Fastlane screenshots divergence:

crowdbotics@modules $ git diff b89bf7e:scaffold/template/_gitignore b89bf7e:scaffold/template/custom/.gitignore
diff --git a/scaffold/template/_gitignore b/scaffold/template/custom/.gitignore
index ad572e63..6399b6e0 100644
--- a/scaffold/template/_gitignore
+++ b/scaffold/template/custom/.gitignore
@@ -50,7 +50,10 @@ buck-out/

 */fastlane/report.xml
 */fastlane/Preview.html
-*/fastlane/screenshots
+
+# Commenting this out cause we need to store screenshots in the repo for
+# deployment through CircleCI.
+# */fastlane/screenshots

 # Bundle artifact
 *.jsbundle

* update custom/Gemfile

this file didn't exist in the previous react-native version template

* update custom/dependencies.json

This update is done by getting the names of all dependencies listed on
`dependencies.json` and then generating the following yarn commands.

Note: `ts-loader` was added to support Typescript in webpack builds.

```sh
yarn add axios @react-native-community/masked-view \
         @react-navigation/native react-native-gesture-handler \
         react-native-reanimated react-native-safe-area-context \
         react-native-screens @react-navigation/stack redux \
         react-redux @reduxjs/toolkit react-native-dotenv \
         react-native-responsive-screen react-native-elements \
         react-native-vector-icons react-dom \
         react-native-radio-buttons-group react-native-web
```
```sh
yarn add -D github:crowdbotics/babel-plugin-import-glob-meta \
            babel-loader url-loader webpack webpack-cli \
            webpack-dev-server babel-plugin-react-native-web \
            html-webpack-plugin ts-loader
```

Those commands are then run at `/scaffold/template` so that the semver
version ranges are resolved against the base react-native template.

The `git diff scaffold/template/package.json` of is then copied back
into `dependencies.json`

* remove deprecated react-native init version flag

This flag was removed upstream.

```sh
Error: Command failed: npx react-native init demo --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold --version 0.64.0
error Passing both "version" and "template" is not supported. The template you select determines the version of react-native used. Please use only one of these options, for example: --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold@x.y.z where x.y.z is the release of the template that contains the desired "react-native" version.
```

* add json extension to metro resolver

metro can't resolve app.json otherwise

* add root index.js

* add bin to root package.json

* add scaffold upgrade prompt

* add custom/ios/Podfile for debugging iOS build

* .circleci config - remove set ruby version on ios

* update docs/index.md

* update custom/Dockerfile node image to 18.16

* add fast-xml-parser and js-yaml dependencies

* add npx init script for migrating old apps

* add baked against latest version

* update files algorithm for App.js

* iterate files and cleanup caching mechanisms

* run babel transpile optionally based on babel flag

* fix section print for updateFiles

* add docs for upgrading scaffold

* add requirement for running the init script

* check all requirements in the script

* improve section messages for cookiecutter

* refactor manifest and baked variables

* remove python check, redudant with pipenv

* change order of mkdir arguments

* checkout previous version of scaffold on successive runs

* add json special case

minify the JSON before comparison

* add react-native-reanimated/plugin to babel config

reanimated docs instructs one to install the babel plugin
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/#babel-plugin

but our babel config didn't include it since it was made for 2.x

* support addition type for new files introduced

* replace slug mark in manifest with slug value

* add full scaffold manifest for upgrade

some stats:
- 146 files
- 55 directories
- 6 totally new files

* temporarily add branch to npx command

* github actions - upgrade node-version to 18

* fix lint issues

* rename custom/App.tsx into custom/App.js

for backwards compatibility with Studio

* add TODO notes for parsing project_slug

* add cookiecutter context onto crowdbotics.json

* copy .new file into the proper directory

all .new files were copied onto root before

* check if file exists before diffing

* improve git status

* remove untracked files on git reset action

* check whether file changed from PREVIOUS to NEW

compare the files across versions, skip if they are the same

* git add all files where upgrade is successful

* implement finding most frequent slug occurrence

* implement git diff printer and remove command

* move scaffold upgrade docs into it's own file

* remove dist/raw

this is an intermediary build artifact that is only used by
our cookie script, safe to remove and reduces repo size

* explain other lines in the package.json.diff

* fix lint issues in index.js

* introduce scaffold semver github action

checks and enforces semver version bumps at:
`scaffold/template/custom/.crowdbotics.json`

this action only get's triggered when there's some change made to the
following:
- scaffold/**
- dist/cookie/**

* remove redudant rm command and call it a document

* build: add Podfile.lock

* remove custom Podfile

only customization is debugging logs

* remove react-native-reanimated

@react-navigation/native no longer depends on it

* add override to android MainActivity.java

As suggested in the react-navigation installation instructions:
https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project

* scaffold - update fastlane README

* build: include files from pod install

* move all d5e04d8 template changes to custom

* revert gitignore changes in d5e04d8

* add --deployment to CI pod install step

* move Podfile.lock to custom

upstream template doesn't have a lockfile

* build: add missing packages

* undo all changes - only rm when untrackeds exist

* exclude addition files from comparison

* break rm into multiline rm

* improve diffing with prettier

* build: update podfile lock

* build: new xcode files

* build: xcode files update

* build: gem and pod update

* replace deprecated "@react-native-community/masked-view"

with "@react-native-masked-view/masked-view"

* make webpack config use App.js instead of App.tsx

* add react-native-reanimated dependency to the scaffold

* remove deployment flag

* configure webpack for react-native-reanimated

following 3.x docs here:
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support

* good looking welcome screen with image and text

* downgrade react-native-web upgrade gesture-handler

react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356

* make demo script use cookiecutter for both scaffolds

no longer rely on `npx react-native init` which doesn't
match what our backend does - which is to cookiecutter all scaffolds

* change order of bootstrap subcommands

* fix reanimated missing AAR on CI issue

older versions of reanimated package AAR, this is the latest old version
that includes it

* move scripts/config.js to config.js

* update index.js to support arbitrary versions

* regen custom yarn.lock

* pipenv lock

* add manifest script command

* automate manifest generation and consumption

add a new version to `config.js` and then
run `yarn run manifest` to generate a new manifest for that version

* git add cookie ios/Pods/Manifest.lock

this file was gitignored and missed before

* refactor console.log utils into config

* add scaffold/package.json check in semver script

* simplify PR template by linking checklists docs

include new checks for scaffold (all types of builds)

* document the semver script

* document the manifest script

* increase root package.json version

* remove duplicate store documentation

This file is already made available to users of the scaffold in [store/README.md](/scaffold/template/custom/store/README.md).

* remove duplicate docs/index.md

duplicate of /README.md

* introduce CHANGELOGs and redo documentation

- move @modules docs to the scaffold, users benefit from it
- remove target android/ios sdk versions, those are listed in CHANGELOG
- cleanup docs/index.md
- rename /docs files to be more meaningful
- document new semver and manifest scripts

* docs: add information about PATH requirements

cookiecutter and pg_config binaries need to be available

* process commands replace status with error checks

* yarn run bootstrap

* replace his with their

* update manifest: add modules/README.md

* fix: require node 16 and above at minimum

not including the minor version in the range forces at the very least 17

---------

Co-authored-by: Muhammad Abdullah Abid <abd@abd.dev>
danielsousaio added a commit to saad-abid-crowdbotics/modules that referenced this issue Aug 23, 2023
* YAML file for CircleCI

* renamed process in YAML file

* renamed YAML file

* config yaml update

* step rename

* add demo directory before creating app

* added pipenv as well as dependancies

* added python3.8 installation to the pipeline

* changed docker image

* remove pipenv installation

* specified python3.8.13 version

* removed unnecessary pipeline lines

* bump root package.json react-native to v0.71.7

- regenerate lockfile

* bump node to latest on .nvmrc

* set minimum node version on package.json to 16

* yarn run template

- overwrite all of the /scaffold/template directory with the
template from React Native v0.71.7
- keep /scaffold/template/custom intact

* scripts: replace all fs.rmdirSync with fs.rmSync

When running scripts with node v18.16.0 the following was logged:
[DEP0147] DeprecationWarning: In future versions of Node.js,
fs.rmdir(path, { recursive: true }) will be removed. Use
fs.rm(path, { recursive: true }) instead.

* add comment for original template.config.js

Upstream version of this config didn't change but still added a comment
for easier reference and traceability in the future.

* bump scaffold package.json version

major version bump since there are breaking changes being introduced
old projects need to be manually upgraded

* rewrite README.md

- more explicit system requirements
- remove duplicate version information that is available on the scaffold
- add meaningful commands examples

* move docs section into docs/README.md

* improve scripts/install.js comments details

* bump react-native-android docker image version

Source:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/.circleci/Dockerfiles/Dockerfile.android#L17

* bump ruby version in circleci and include Gemfile

following upstream version on the Gemfile:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/Gemfile#L1-L6

and it's inclusion in the template as well:
https://github.com/crowdbotics/modules/blob/419acef06c0e92f44bbbf88261018890d07f317a/scaffold/template/Gemfile#L1-L6

* remove custom/android/build.gradle

only the sdk version diverged from the old template version:
git diff b89bf7e:scaffold/template/android/build.gradle
b89bf7e:scaffold/template/custom/android/build.gradle

diff --git a/scaffold/template/android/build.gradle b/scaffold/template/custom/android/build.gradle
index 93232f5f..75a7fb29 100644
--- a/scaffold/template/android/build.gradle
+++ b/scaffold/template/custom/android/build.gradle
@@ -4,8 +4,8 @@ buildscript {
     ext {
         buildToolsVersion = "29.0.3"
         minSdkVersion = 21
-        compileSdkVersion = 29
-        targetSdkVersion = 29
+        compileSdkVersion = 31
+        targetSdkVersion = 31
         ndkVersion = "20.1.5948944"
     }
     repositories {

* update custom/android/app/build.gradle

previous divergence in release setup:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/build.gradle b89bf7e:scaffold/template/custom/android/app/build.gradle
diff --git a/scaffold/template/android/app/build.gradle b/scaffold/template/custom/android/app/build.gradle
index f75c1609..5f2a4948 100644
--- a/scaffold/template/android/app/build.gradle
+++ b/scaffold/template/custom/android/app/build.gradle
@@ -152,15 +152,21 @@ android {
             keyAlias 'androiddebugkey'
             keyPassword 'android'
         }
+        release {
+            storeFile file('my-upload-key.keystore')
+            storePassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+            keyAlias "$System.env.MYAPP_UPLOAD_KEY_ALIAS"
+            keyPassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+        }
     }
     buildTypes {
         debug {
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
         }
         release {
             // Caution! In production, you need to generate your own keystore file.
             // see https://reactnative.dev/docs/signed-apk-android.
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
             minifyEnabled enableProguardInReleaseBuilds
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
         }

* update custom/android/app/src/main/AndroidManifest.xml

Previous divergence in labels:
Note: The android:exported property is already true in the v0.71.7 template so
no changes there.

crowdbotics@modules $ git diff b89bf7e:scaffold/template/android/app/src/main/AndroidManifest.xml b89bf7e:scaffold/template/custom/android/app/src/main/AndroidManifest.xml
diff --git a/scaffold/template/android/app/src/main/AndroidManifest.xml b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
index 6db8bad3..5d717754 100644
--- a/scaffold/template/android/app/src/main/AndroidManifest.xml
+++ b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
@@ -5,17 +5,18 @@

     <application
       android:name=".MainApplication"
-      android:label="@string/app_name"
+      android:label="@string/original_app_name"
       android:icon="@mipmap/ic_launcher"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:allowBackup="false"
       android:theme="@style/AppTheme">
       <activity
         android:name=".MainActivity"
-        android:label="@string/app_name"
+        android:label="@string/original_app_name"
         android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
         android:launchMode="singleTask"
-        android:windowSoftInputMode="adjustResize">
+        android:windowSoftInputMode="adjustResize"
+        android:exported="true">
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />

* remove custom/ios/Podfile and set NO_FLIPPER

react-native v0.71.7 now takes a NO_FLIPPER env var for
disabling/enabling the flipper tool. This replaces the use of the old
divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/ios/Podfile b89bf7e:scaffold/template/custom/ios/Podfile
diff --git a/scaffold/template/ios/Podfile b/scaffold/template/custom/ios/Podfile
index 18369a7e..ec68f9da 100644
--- a/scaffold/template/ios/Podfile
+++ b/scaffold/template/custom/ios/Podfile
@@ -21,7 +21,7 @@ target 'HelloWorld' do
   #
   # Note that if you have use_frameworks! enabled, Flipper will not work and
   # you should disable the next line.
-  use_flipper!()
+  # use_flipper!()

   post_install do |installer|
     react_native_post_install(installer)

* add typescript support in the scaffold

react-native v0.71.7 already includes Typescript support by default and
their entry component filename was changed to App.tsx

* bump major version of crowdbotics.json version

* update custom/package.json

replicate previous divergence:
crowdbotics@modules $ git diff b89bf7e:scaffold/template/package.json b89bf7e:scaffold/template/custom/package.json
diff --git a/scaffold/template/package.json b/scaffold/template/custom/package.json
index 0108163f..4212b2de 100644
--- a/scaffold/template/package.json
+++ b/scaffold/template/custom/package.json
@@ -7,11 +7,13 @@
     "ios": "react-native run-ios",
     "start": "react-native start",
     "test": "jest",
-    "lint": "eslint ."
+    "lint": "eslint .",
+    "web": "./node_modules/.bin/webpack-dev-server --config ./webpack.config.js --live-reload --color --mode development",
+    "web:build": "./node_modules/.bin/webpack --config ./webpack.config.js --color --mode production"
   },
   "dependencies": {
     "react": "17.0.1",
-    "react-native": "0.64.2"
+    "react-native": "0.64.4"
   },
   "devDependencies": {
     "@babel/core": "^7.12.9",
@@ -25,5 +27,13 @@
   },
   "jest": {
     "preset": "react-native"
+  },
+  "browserslist": {
+    "production": [">0.2%", "not dead", "not op_mini all"],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
   }
 }

* update custom/.gitignore

replicate previous Fastlane screenshots divergence:

crowdbotics@modules $ git diff b89bf7e:scaffold/template/_gitignore b89bf7e:scaffold/template/custom/.gitignore
diff --git a/scaffold/template/_gitignore b/scaffold/template/custom/.gitignore
index ad572e63..6399b6e0 100644
--- a/scaffold/template/_gitignore
+++ b/scaffold/template/custom/.gitignore
@@ -50,7 +50,10 @@ buck-out/

 */fastlane/report.xml
 */fastlane/Preview.html
-*/fastlane/screenshots
+
+# Commenting this out cause we need to store screenshots in the repo for
+# deployment through CircleCI.
+# */fastlane/screenshots

 # Bundle artifact
 *.jsbundle

* update custom/Gemfile

this file didn't exist in the previous react-native version template

* update custom/dependencies.json

This update is done by getting the names of all dependencies listed on
`dependencies.json` and then generating the following yarn commands.

Note: `ts-loader` was added to support Typescript in webpack builds.

```sh
yarn add axios @react-native-community/masked-view \
         @react-navigation/native react-native-gesture-handler \
         react-native-reanimated react-native-safe-area-context \
         react-native-screens @react-navigation/stack redux \
         react-redux @reduxjs/toolkit react-native-dotenv \
         react-native-responsive-screen react-native-elements \
         react-native-vector-icons react-dom \
         react-native-radio-buttons-group react-native-web
```
```sh
yarn add -D github:crowdbotics/babel-plugin-import-glob-meta \
            babel-loader url-loader webpack webpack-cli \
            webpack-dev-server babel-plugin-react-native-web \
            html-webpack-plugin ts-loader
```

Those commands are then run at `/scaffold/template` so that the semver
version ranges are resolved against the base react-native template.

The `git diff scaffold/template/package.json` of is then copied back
into `dependencies.json`

* remove deprecated react-native init version flag

This flag was removed upstream.

```sh
Error: Command failed: npx react-native init demo --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold --version 0.64.0
error Passing both "version" and "template" is not supported. The template you select determines the version of react-native used. Please use only one of these options, for example: --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold@x.y.z where x.y.z is the release of the template that contains the desired "react-native" version.
```

* add json extension to metro resolver

metro can't resolve app.json otherwise

* add root index.js

* add bin to root package.json

* add scaffold upgrade prompt

* add custom/ios/Podfile for debugging iOS build

* .circleci config - remove set ruby version on ios

* update docs/index.md

* update custom/Dockerfile node image to 18.16

* add fast-xml-parser and js-yaml dependencies

* add npx init script for migrating old apps

* add baked against latest version

* update files algorithm for App.js

* iterate files and cleanup caching mechanisms

* run babel transpile optionally based on babel flag

* fix section print for updateFiles

* add docs for upgrading scaffold

* add requirement for running the init script

* check all requirements in the script

* improve section messages for cookiecutter

* refactor manifest and baked variables

* remove python check, redudant with pipenv

* change order of mkdir arguments

* checkout previous version of scaffold on successive runs

* add json special case

minify the JSON before comparison

* add react-native-reanimated/plugin to babel config

reanimated docs instructs one to install the babel plugin
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/#babel-plugin

but our babel config didn't include it since it was made for 2.x

* support addition type for new files introduced

* replace slug mark in manifest with slug value

* add full scaffold manifest for upgrade

some stats:
- 146 files
- 55 directories
- 6 totally new files

* temporarily add branch to npx command

* github actions - upgrade node-version to 18

* fix lint issues

* rename custom/App.tsx into custom/App.js

for backwards compatibility with Studio

* add TODO notes for parsing project_slug

* add cookiecutter context onto crowdbotics.json

* copy .new file into the proper directory

all .new files were copied onto root before

* check if file exists before diffing

* improve git status

* remove untracked files on git reset action

* check whether file changed from PREVIOUS to NEW

compare the files across versions, skip if they are the same

* git add all files where upgrade is successful

* implement finding most frequent slug occurrence

* implement git diff printer and remove command

* move scaffold upgrade docs into it's own file

* remove dist/raw

this is an intermediary build artifact that is only used by
our cookie script, safe to remove and reduces repo size

* explain other lines in the package.json.diff

* fix lint issues in index.js

* introduce scaffold semver github action

checks and enforces semver version bumps at:
`scaffold/template/custom/.crowdbotics.json`

this action only get's triggered when there's some change made to the
following:
- scaffold/**
- dist/cookie/**

* remove redudant rm command and call it a document

* build: add Podfile.lock

* remove custom Podfile

only customization is debugging logs

* remove react-native-reanimated

@react-navigation/native no longer depends on it

* add override to android MainActivity.java

As suggested in the react-navigation installation instructions:
https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project

* scaffold - update fastlane README

* build: include files from pod install

* move all d5e04d8 template changes to custom

* revert gitignore changes in d5e04d8

* add --deployment to CI pod install step

* move Podfile.lock to custom

upstream template doesn't have a lockfile

* build: add missing packages

* undo all changes - only rm when untrackeds exist

* exclude addition files from comparison

* break rm into multiline rm

* improve diffing with prettier

* build: update podfile lock

* build: new xcode files

* build: xcode files update

* build: gem and pod update

* replace deprecated "@react-native-community/masked-view"

with "@react-native-masked-view/masked-view"

* make webpack config use App.js instead of App.tsx

* add react-native-reanimated dependency to the scaffold

* remove deployment flag

* configure webpack for react-native-reanimated

following 3.x docs here:
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support

* good looking welcome screen with image and text

* downgrade react-native-web upgrade gesture-handler

react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356

* make demo script use cookiecutter for both scaffolds

no longer rely on `npx react-native init` which doesn't
match what our backend does - which is to cookiecutter all scaffolds

* change order of bootstrap subcommands

* fix reanimated missing AAR on CI issue

older versions of reanimated package AAR, this is the latest old version
that includes it

* move scripts/config.js to config.js

* update index.js to support arbitrary versions

* regen custom yarn.lock

* pipenv lock

* add manifest script command

* automate manifest generation and consumption

add a new version to `config.js` and then
run `yarn run manifest` to generate a new manifest for that version

* git add cookie ios/Pods/Manifest.lock

this file was gitignored and missed before

* refactor console.log utils into config

* add scaffold/package.json check in semver script

* simplify PR template by linking checklists docs

include new checks for scaffold (all types of builds)

* document the semver script

* document the manifest script

* increase root package.json version

* remove duplicate store documentation

This file is already made available to users of the scaffold in [store/README.md](/scaffold/template/custom/store/README.md).

* remove duplicate docs/index.md

duplicate of /README.md

* introduce CHANGELOGs and redo documentation

- move @modules docs to the scaffold, users benefit from it
- remove target android/ios sdk versions, those are listed in CHANGELOG
- cleanup docs/index.md
- rename /docs files to be more meaningful
- document new semver and manifest scripts

* docs: add information about PATH requirements

cookiecutter and pg_config binaries need to be available

* process commands replace status with error checks

* yarn run bootstrap

* replace his with their

* update manifest: add modules/README.md

* update path to dot

* persisting build/demo

* store demo as artifact

* using workspaces

* remove demo path from attach_workspace

* added test build to ios fastlane

* run new lane in ios build step

* get node and yarn versions in node job

* removed all cache commands from config

* clean yarn cache before installing

* testing with node version 16.14.2

* changed node version required

* added new lane to iOS fastfile

* added scheme to xcodebuild command

* added dynamic workspace and schema

* create new lane for only building android app

* changed build_type to debug for gradle build

* upgrade scaffold minor version

* added changelog for scaffold

* corrected changelog version

* updated scaffold/package.json

* update docker image patch

* bumped python version to 3.8.17

* decouple fastlane config

* build: adds import fastfile from git

* build: yarn run raw && yarn run cookie

* build: fastfile updates

* build: yarn run raw && yarn run cookie

* yarn run raw && yarn run cookie

* update versions

* yarn run raw && yarn run cookie

* yarn run manifest

* lint

* update changelog

* updated nextVersionSHA

* fix scaffold

* remove lane additions to Fastfiles

* spelling error

* add github to known hosts

* create .ssh directory

* corrected yaml schema

* remove mapping command

* fixed yaml schema

* temporary branch change

* set FASTLANE_CONFIG_VERSION environment variable

* se export for env var

* default FASTLANE_CONFIG_VERSION

* removed trailing space

* version commented out for testing

* fix env var

* yarn run raw && yarn run cookie

* update nextVersionSHA

* update branch and version in fastfile

* add v prefix to version

* remove equal signs

* remove v prefix

* remove version from import_from_git command

* updated changelog

* updated versions

* add new upgrade.versions to config.js

* fixed versioning

---------

Co-authored-by: Daniel <daniel.s@crowdbotics.com>
Co-authored-by: Muhammad Abdullah Abid <abd@abd.dev>
@humaidk2
Copy link
Author

humaidk2 commented Sep 2, 2023

Just a small fyi,

We did test everything with all the latest libraries and this ossue is definitely resolved.

@github-actions
Copy link

github-actions bot commented Sep 2, 2023

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

danielsousaio added a commit to crowdbotics/modules that referenced this issue Nov 23, 2023
* bump root package.json react-native to v0.71.7

- regenerate lockfile

* bump node to latest on .nvmrc

* set minimum node version on package.json to 16

* yarn run template

- overwrite all of the /scaffold/template directory with the
template from React Native v0.71.7
- keep /scaffold/template/custom intact

* scripts: replace all fs.rmdirSync with fs.rmSync

When running scripts with node v18.16.0 the following was logged:
[DEP0147] DeprecationWarning: In future versions of Node.js,
fs.rmdir(path, { recursive: true }) will be removed. Use
fs.rm(path, { recursive: true }) instead.

* add comment for original template.config.js

Upstream version of this config didn't change but still added a comment
for easier reference and traceability in the future.

* bump scaffold package.json version

major version bump since there are breaking changes being introduced
old projects need to be manually upgraded

* rewrite README.md

- more explicit system requirements
- remove duplicate version information that is available on the scaffold
- add meaningful commands examples

* move docs section into docs/README.md

* improve scripts/install.js comments details

* bump react-native-android docker image version

Source:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/.circleci/Dockerfiles/Dockerfile.android#L17

* bump ruby version in circleci and include Gemfile

following upstream version on the Gemfile:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/Gemfile#L1-L6

and it's inclusion in the template as well:
https://github.com/crowdbotics/modules/blob/419acef06c0e92f44bbbf88261018890d07f317a/scaffold/template/Gemfile#L1-L6

* remove custom/android/build.gradle

only the sdk version diverged from the old template version:
git diff f8c1dbc:scaffold/template/android/build.gradle
f8c1dbc:scaffold/template/custom/android/build.gradle

diff --git a/scaffold/template/android/build.gradle b/scaffold/template/custom/android/build.gradle
index 93232f5f..75a7fb29 100644
--- a/scaffold/template/android/build.gradle
+++ b/scaffold/template/custom/android/build.gradle
@@ -4,8 +4,8 @@ buildscript {
     ext {
         buildToolsVersion = "29.0.3"
         minSdkVersion = 21
-        compileSdkVersion = 29
-        targetSdkVersion = 29
+        compileSdkVersion = 31
+        targetSdkVersion = 31
         ndkVersion = "20.1.5948944"
     }
     repositories {

* update custom/android/app/build.gradle

previous divergence in release setup:
crowdbotics@modules $ git diff f8c1dbc:scaffold/template/android/app/build.gradle f8c1dbc:scaffold/template/custom/android/app/build.gradle
diff --git a/scaffold/template/android/app/build.gradle b/scaffold/template/custom/android/app/build.gradle
index f75c1609..5f2a4948 100644
--- a/scaffold/template/android/app/build.gradle
+++ b/scaffold/template/custom/android/app/build.gradle
@@ -152,15 +152,21 @@ android {
             keyAlias 'androiddebugkey'
             keyPassword 'android'
         }
+        release {
+            storeFile file('my-upload-key.keystore')
+            storePassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+            keyAlias "$System.env.MYAPP_UPLOAD_KEY_ALIAS"
+            keyPassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+        }
     }
     buildTypes {
         debug {
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
         }
         release {
             // Caution! In production, you need to generate your own keystore file.
             // see https://reactnative.dev/docs/signed-apk-android.
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
             minifyEnabled enableProguardInReleaseBuilds
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
         }

* update custom/android/app/src/main/AndroidManifest.xml

Previous divergence in labels:
Note: The android:exported property is already true in the v0.71.7 template so
no changes there.

crowdbotics@modules $ git diff f8c1dbc:scaffold/template/android/app/src/main/AndroidManifest.xml f8c1dbc:scaffold/template/custom/android/app/src/main/AndroidManifest.xml
diff --git a/scaffold/template/android/app/src/main/AndroidManifest.xml b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
index 6db8bad3..5d717754 100644
--- a/scaffold/template/android/app/src/main/AndroidManifest.xml
+++ b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
@@ -5,17 +5,18 @@

     <application
       android:name=".MainApplication"
-      android:label="@string/app_name"
+      android:label="@string/original_app_name"
       android:icon="@mipmap/ic_launcher"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:allowBackup="false"
       android:theme="@style/AppTheme">
       <activity
         android:name=".MainActivity"
-        android:label="@string/app_name"
+        android:label="@string/original_app_name"
         android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
         android:launchMode="singleTask"
-        android:windowSoftInputMode="adjustResize">
+        android:windowSoftInputMode="adjustResize"
+        android:exported="true">
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />

* remove custom/ios/Podfile and set NO_FLIPPER

react-native v0.71.7 now takes a NO_FLIPPER env var for
disabling/enabling the flipper tool. This replaces the use of the old
divergence:
crowdbotics@modules $ git diff f8c1dbc:scaffold/template/ios/Podfile f8c1dbc:scaffold/template/custom/ios/Podfile
diff --git a/scaffold/template/ios/Podfile b/scaffold/template/custom/ios/Podfile
index 18369a7e..ec68f9da 100644
--- a/scaffold/template/ios/Podfile
+++ b/scaffold/template/custom/ios/Podfile
@@ -21,7 +21,7 @@ target 'HelloWorld' do
   #
   # Note that if you have use_frameworks! enabled, Flipper will not work and
   # you should disable the next line.
-  use_flipper!()
+  # use_flipper!()

   post_install do |installer|
     react_native_post_install(installer)

* add typescript support in the scaffold

react-native v0.71.7 already includes Typescript support by default and
their entry component filename was changed to App.tsx

* bump major version of crowdbotics.json version

* update custom/package.json

replicate previous divergence:
crowdbotics@modules $ git diff f8c1dbc:scaffold/template/package.json f8c1dbc:scaffold/template/custom/package.json
diff --git a/scaffold/template/package.json b/scaffold/template/custom/package.json
index 0108163f..4212b2de 100644
--- a/scaffold/template/package.json
+++ b/scaffold/template/custom/package.json
@@ -7,11 +7,13 @@
     "ios": "react-native run-ios",
     "start": "react-native start",
     "test": "jest",
-    "lint": "eslint ."
+    "lint": "eslint .",
+    "web": "./node_modules/.bin/webpack-dev-server --config ./webpack.config.js --live-reload --color --mode development",
+    "web:build": "./node_modules/.bin/webpack --config ./webpack.config.js --color --mode production"
   },
   "dependencies": {
     "react": "17.0.1",
-    "react-native": "0.64.2"
+    "react-native": "0.64.4"
   },
   "devDependencies": {
     "@babel/core": "^7.12.9",
@@ -25,5 +27,13 @@
   },
   "jest": {
     "preset": "react-native"
+  },
+  "browserslist": {
+    "production": [">0.2%", "not dead", "not op_mini all"],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
   }
 }

* update custom/.gitignore

replicate previous Fastlane screenshots divergence:

crowdbotics@modules $ git diff f8c1dbc:scaffold/template/_gitignore f8c1dbc:scaffold/template/custom/.gitignore
diff --git a/scaffold/template/_gitignore b/scaffold/template/custom/.gitignore
index ad572e63..6399b6e0 100644
--- a/scaffold/template/_gitignore
+++ b/scaffold/template/custom/.gitignore
@@ -50,7 +50,10 @@ buck-out/

 */fastlane/report.xml
 */fastlane/Preview.html
-*/fastlane/screenshots
+
+# Commenting this out cause we need to store screenshots in the repo for
+# deployment through CircleCI.
+# */fastlane/screenshots

 # Bundle artifact
 *.jsbundle

* update custom/Gemfile

this file didn't exist in the previous react-native version template

* update custom/dependencies.json

This update is done by getting the names of all dependencies listed on
`dependencies.json` and then generating the following yarn commands.

Note: `ts-loader` was added to support Typescript in webpack builds.

```sh
yarn add axios @react-native-community/masked-view \
         @react-navigation/native react-native-gesture-handler \
         react-native-reanimated react-native-safe-area-context \
         react-native-screens @react-navigation/stack redux \
         react-redux @reduxjs/toolkit react-native-dotenv \
         react-native-responsive-screen react-native-elements \
         react-native-vector-icons react-dom \
         react-native-radio-buttons-group react-native-web
```
```sh
yarn add -D github:crowdbotics/babel-plugin-import-glob-meta \
            babel-loader url-loader webpack webpack-cli \
            webpack-dev-server babel-plugin-react-native-web \
            html-webpack-plugin ts-loader
```

Those commands are then run at `/scaffold/template` so that the semver
version ranges are resolved against the base react-native template.

The `git diff scaffold/template/package.json` of is then copied back
into `dependencies.json`

* remove deprecated react-native init version flag

This flag was removed upstream.

```sh
Error: Command failed: npx react-native init demo --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold --version 0.64.0
error Passing both "version" and "template" is not supported. The template you select determines the version of react-native used. Please use only one of these options, for example: --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold@x.y.z where x.y.z is the release of the template that contains the desired "react-native" version.
```

* add json extension to metro resolver

metro can't resolve app.json otherwise

* add root index.js

* add bin to root package.json

* add scaffold upgrade prompt

* add custom/ios/Podfile for debugging iOS build

* .circleci config - remove set ruby version on ios

* update docs/index.md

* update custom/Dockerfile node image to 18.16

* add fast-xml-parser and js-yaml dependencies

* add npx init script for migrating old apps

* add baked against latest version

* update files algorithm for App.js

* iterate files and cleanup caching mechanisms

* run babel transpile optionally based on babel flag

* fix section print for updateFiles

* add docs for upgrading scaffold

* add requirement for running the init script

* check all requirements in the script

* improve section messages for cookiecutter

* refactor manifest and baked variables

* remove python check, redudant with pipenv

* change order of mkdir arguments

* checkout previous version of scaffold on successive runs

* add json special case

minify the JSON before comparison

* add react-native-reanimated/plugin to babel config

reanimated docs instructs one to install the babel plugin
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/#babel-plugin

but our babel config didn't include it since it was made for 2.x

* support addition type for new files introduced

* replace slug mark in manifest with slug value

* add full scaffold manifest for upgrade

some stats:
- 146 files
- 55 directories
- 6 totally new files

* temporarily add branch to npx command

* github actions - upgrade node-version to 18

* fix lint issues

* rename custom/App.tsx into custom/App.js

for backwards compatibility with Studio

* add TODO notes for parsing project_slug

* add cookiecutter context onto crowdbotics.json

* copy .new file into the proper directory

all .new files were copied onto root before

* check if file exists before diffing

* improve git status

* remove untracked files on git reset action

* check whether file changed from PREVIOUS to NEW

compare the files across versions, skip if they are the same

* git add all files where upgrade is successful

* implement finding most frequent slug occurrence

* implement git diff printer and remove command

* move scaffold upgrade docs into it's own file

* remove dist/raw

this is an intermediary build artifact that is only used by
our cookie script, safe to remove and reduces repo size

* explain other lines in the package.json.diff

* fix lint issues in index.js

* introduce scaffold semver github action

checks and enforces semver version bumps at:
`scaffold/template/custom/.crowdbotics.json`

this action only get's triggered when there's some change made to the
following:
- scaffold/**
- dist/cookie/**

* remove redudant rm command and call it a document

* build: add Podfile.lock

* remove custom Podfile

only customization is debugging logs

* remove react-native-reanimated

@react-navigation/native no longer depends on it

* add override to android MainActivity.java

As suggested in the react-navigation installation instructions:
https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project

* scaffold - update fastlane README

* build: include files from pod install

* move all d5e04d8 template changes to custom

* revert gitignore changes in d5e04d8

* add --deployment to CI pod install step

* move Podfile.lock to custom

upstream template doesn't have a lockfile

* build: add missing packages

* undo all changes - only rm when untrackeds exist

* exclude addition files from comparison

* break rm into multiline rm

* improve diffing with prettier

* build: update podfile lock

* build: new xcode files

* build: xcode files update

* build: gem and pod update

* replace deprecated "@react-native-community/masked-view"

with "@react-native-masked-view/masked-view"

* make webpack config use App.js instead of App.tsx

* add react-native-reanimated dependency to the scaffold

* remove deployment flag

* configure webpack for react-native-reanimated

following 3.x docs here:
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support

* good looking welcome screen with image and text

* downgrade react-native-web upgrade gesture-handler

react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356

* make demo script use cookiecutter for both scaffolds

no longer rely on `npx react-native init` which doesn't
match what our backend does - which is to cookiecutter all scaffolds

* change order of bootstrap subcommands

* fix reanimated missing AAR on CI issue

older versions of reanimated package AAR, this is the latest old version
that includes it

* move scripts/config.js to config.js

* update index.js to support arbitrary versions

* regen custom yarn.lock

* pipenv lock

* add manifest script command

* automate manifest generation and consumption

add a new version to `config.js` and then
run `yarn run manifest` to generate a new manifest for that version

* git add cookie ios/Pods/Manifest.lock

this file was gitignored and missed before

* refactor console.log utils into config

* add scaffold/package.json check in semver script

* simplify PR template by linking checklists docs

include new checks for scaffold (all types of builds)

* document the semver script

* document the manifest script

* increase root package.json version

* remove duplicate store documentation

This file is already made available to users of the scaffold in [store/README.md](/scaffold/template/custom/store/README.md).

* remove duplicate docs/index.md

duplicate of /README.md

* introduce CHANGELOGs and redo documentation

- move @modules docs to the scaffold, users benefit from it
- remove target android/ios sdk versions, those are listed in CHANGELOG
- cleanup docs/index.md
- rename /docs files to be more meaningful
- document new semver and manifest scripts

* docs: add information about PATH requirements

cookiecutter and pg_config binaries need to be available

* process commands replace status with error checks

* yarn run bootstrap

* replace his with their

* update manifest: add modules/README.md

* fix: require node 16 and above at minimum

not including the minor version in the range forces at the very least 17

---------

Co-authored-by: Muhammad Abdullah Abid <abd@abd.dev>
danielsousaio added a commit to crowdbotics/modules that referenced this issue Nov 23, 2023
* YAML file for CircleCI

* renamed process in YAML file

* renamed YAML file

* config yaml update

* step rename

* add demo directory before creating app

* added pipenv as well as dependancies

* added python3.8 installation to the pipeline

* changed docker image

* remove pipenv installation

* specified python3.8.13 version

* removed unnecessary pipeline lines

* bump root package.json react-native to v0.71.7

- regenerate lockfile

* bump node to latest on .nvmrc

* set minimum node version on package.json to 16

* yarn run template

- overwrite all of the /scaffold/template directory with the
template from React Native v0.71.7
- keep /scaffold/template/custom intact

* scripts: replace all fs.rmdirSync with fs.rmSync

When running scripts with node v18.16.0 the following was logged:
[DEP0147] DeprecationWarning: In future versions of Node.js,
fs.rmdir(path, { recursive: true }) will be removed. Use
fs.rm(path, { recursive: true }) instead.

* add comment for original template.config.js

Upstream version of this config didn't change but still added a comment
for easier reference and traceability in the future.

* bump scaffold package.json version

major version bump since there are breaking changes being introduced
old projects need to be manually upgraded

* rewrite README.md

- more explicit system requirements
- remove duplicate version information that is available on the scaffold
- add meaningful commands examples

* move docs section into docs/README.md

* improve scripts/install.js comments details

* bump react-native-android docker image version

Source:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/.circleci/Dockerfiles/Dockerfile.android#L17

* bump ruby version in circleci and include Gemfile

following upstream version on the Gemfile:
https://github.com/facebook/react-native/blob/6115ce53a2df4449769e4b9b6ca95fc29955fff0/Gemfile#L1-L6

and it's inclusion in the template as well:
https://github.com/crowdbotics/modules/blob/419acef06c0e92f44bbbf88261018890d07f317a/scaffold/template/Gemfile#L1-L6

* remove custom/android/build.gradle

only the sdk version diverged from the old template version:
git diff f8c1dbc:scaffold/template/android/build.gradle
f8c1dbc:scaffold/template/custom/android/build.gradle

diff --git a/scaffold/template/android/build.gradle b/scaffold/template/custom/android/build.gradle
index 93232f5f..75a7fb29 100644
--- a/scaffold/template/android/build.gradle
+++ b/scaffold/template/custom/android/build.gradle
@@ -4,8 +4,8 @@ buildscript {
     ext {
         buildToolsVersion = "29.0.3"
         minSdkVersion = 21
-        compileSdkVersion = 29
-        targetSdkVersion = 29
+        compileSdkVersion = 31
+        targetSdkVersion = 31
         ndkVersion = "20.1.5948944"
     }
     repositories {

* update custom/android/app/build.gradle

previous divergence in release setup:
crowdbotics@modules $ git diff f8c1dbc:scaffold/template/android/app/build.gradle f8c1dbc:scaffold/template/custom/android/app/build.gradle
diff --git a/scaffold/template/android/app/build.gradle b/scaffold/template/custom/android/app/build.gradle
index f75c1609..5f2a4948 100644
--- a/scaffold/template/android/app/build.gradle
+++ b/scaffold/template/custom/android/app/build.gradle
@@ -152,15 +152,21 @@ android {
             keyAlias 'androiddebugkey'
             keyPassword 'android'
         }
+        release {
+            storeFile file('my-upload-key.keystore')
+            storePassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+            keyAlias "$System.env.MYAPP_UPLOAD_KEY_ALIAS"
+            keyPassword "$System.env.MYAPP_UPLOAD_KEY_PASSWORD"
+        }
     }
     buildTypes {
         debug {
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
         }
         release {
             // Caution! In production, you need to generate your own keystore file.
             // see https://reactnative.dev/docs/signed-apk-android.
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
             minifyEnabled enableProguardInReleaseBuilds
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
         }

* update custom/android/app/src/main/AndroidManifest.xml

Previous divergence in labels:
Note: The android:exported property is already true in the v0.71.7 template so
no changes there.

crowdbotics@modules $ git diff f8c1dbc:scaffold/template/android/app/src/main/AndroidManifest.xml f8c1dbc:scaffold/template/custom/android/app/src/main/AndroidManifest.xml
diff --git a/scaffold/template/android/app/src/main/AndroidManifest.xml b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
index 6db8bad3..5d717754 100644
--- a/scaffold/template/android/app/src/main/AndroidManifest.xml
+++ b/scaffold/template/custom/android/app/src/main/AndroidManifest.xml
@@ -5,17 +5,18 @@

     <application
       android:name=".MainApplication"
-      android:label="@string/app_name"
+      android:label="@string/original_app_name"
       android:icon="@mipmap/ic_launcher"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:allowBackup="false"
       android:theme="@style/AppTheme">
       <activity
         android:name=".MainActivity"
-        android:label="@string/app_name"
+        android:label="@string/original_app_name"
         android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
         android:launchMode="singleTask"
-        android:windowSoftInputMode="adjustResize">
+        android:windowSoftInputMode="adjustResize"
+        android:exported="true">
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />

* remove custom/ios/Podfile and set NO_FLIPPER

react-native v0.71.7 now takes a NO_FLIPPER env var for
disabling/enabling the flipper tool. This replaces the use of the old
divergence:
crowdbotics@modules $ git diff f8c1dbc:scaffold/template/ios/Podfile f8c1dbc:scaffold/template/custom/ios/Podfile
diff --git a/scaffold/template/ios/Podfile b/scaffold/template/custom/ios/Podfile
index 18369a7e..ec68f9da 100644
--- a/scaffold/template/ios/Podfile
+++ b/scaffold/template/custom/ios/Podfile
@@ -21,7 +21,7 @@ target 'HelloWorld' do
   #
   # Note that if you have use_frameworks! enabled, Flipper will not work and
   # you should disable the next line.
-  use_flipper!()
+  # use_flipper!()

   post_install do |installer|
     react_native_post_install(installer)

* add typescript support in the scaffold

react-native v0.71.7 already includes Typescript support by default and
their entry component filename was changed to App.tsx

* bump major version of crowdbotics.json version

* update custom/package.json

replicate previous divergence:
crowdbotics@modules $ git diff f8c1dbc:scaffold/template/package.json f8c1dbc:scaffold/template/custom/package.json
diff --git a/scaffold/template/package.json b/scaffold/template/custom/package.json
index 0108163f..4212b2de 100644
--- a/scaffold/template/package.json
+++ b/scaffold/template/custom/package.json
@@ -7,11 +7,13 @@
     "ios": "react-native run-ios",
     "start": "react-native start",
     "test": "jest",
-    "lint": "eslint ."
+    "lint": "eslint .",
+    "web": "./node_modules/.bin/webpack-dev-server --config ./webpack.config.js --live-reload --color --mode development",
+    "web:build": "./node_modules/.bin/webpack --config ./webpack.config.js --color --mode production"
   },
   "dependencies": {
     "react": "17.0.1",
-    "react-native": "0.64.2"
+    "react-native": "0.64.4"
   },
   "devDependencies": {
     "@babel/core": "^7.12.9",
@@ -25,5 +27,13 @@
   },
   "jest": {
     "preset": "react-native"
+  },
+  "browserslist": {
+    "production": [">0.2%", "not dead", "not op_mini all"],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
   }
 }

* update custom/.gitignore

replicate previous Fastlane screenshots divergence:

crowdbotics@modules $ git diff f8c1dbc:scaffold/template/_gitignore f8c1dbc:scaffold/template/custom/.gitignore
diff --git a/scaffold/template/_gitignore b/scaffold/template/custom/.gitignore
index ad572e63..6399b6e0 100644
--- a/scaffold/template/_gitignore
+++ b/scaffold/template/custom/.gitignore
@@ -50,7 +50,10 @@ buck-out/

 */fastlane/report.xml
 */fastlane/Preview.html
-*/fastlane/screenshots
+
+# Commenting this out cause we need to store screenshots in the repo for
+# deployment through CircleCI.
+# */fastlane/screenshots

 # Bundle artifact
 *.jsbundle

* update custom/Gemfile

this file didn't exist in the previous react-native version template

* update custom/dependencies.json

This update is done by getting the names of all dependencies listed on
`dependencies.json` and then generating the following yarn commands.

Note: `ts-loader` was added to support Typescript in webpack builds.

```sh
yarn add axios @react-native-community/masked-view \
         @react-navigation/native react-native-gesture-handler \
         react-native-reanimated react-native-safe-area-context \
         react-native-screens @react-navigation/stack redux \
         react-redux @reduxjs/toolkit react-native-dotenv \
         react-native-responsive-screen react-native-elements \
         react-native-vector-icons react-dom \
         react-native-radio-buttons-group react-native-web
```
```sh
yarn add -D github:crowdbotics/babel-plugin-import-glob-meta \
            babel-loader url-loader webpack webpack-cli \
            webpack-dev-server babel-plugin-react-native-web \
            html-webpack-plugin ts-loader
```

Those commands are then run at `/scaffold/template` so that the semver
version ranges are resolved against the base react-native template.

The `git diff scaffold/template/package.json` of is then copied back
into `dependencies.json`

* remove deprecated react-native init version flag

This flag was removed upstream.

```sh
Error: Command failed: npx react-native init demo --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold --version 0.64.0
error Passing both "version" and "template" is not supported. The template you select determines the version of react-native used. Please use only one of these options, for example: --template file:/home/daniel/code/github.com/crowdbotics@modules/scaffold@x.y.z where x.y.z is the release of the template that contains the desired "react-native" version.
```

* add json extension to metro resolver

metro can't resolve app.json otherwise

* add root index.js

* add bin to root package.json

* add scaffold upgrade prompt

* add custom/ios/Podfile for debugging iOS build

* .circleci config - remove set ruby version on ios

* update docs/index.md

* update custom/Dockerfile node image to 18.16

* add fast-xml-parser and js-yaml dependencies

* add npx init script for migrating old apps

* add baked against latest version

* update files algorithm for App.js

* iterate files and cleanup caching mechanisms

* run babel transpile optionally based on babel flag

* fix section print for updateFiles

* add docs for upgrading scaffold

* add requirement for running the init script

* check all requirements in the script

* improve section messages for cookiecutter

* refactor manifest and baked variables

* remove python check, redudant with pipenv

* change order of mkdir arguments

* checkout previous version of scaffold on successive runs

* add json special case

minify the JSON before comparison

* add react-native-reanimated/plugin to babel config

reanimated docs instructs one to install the babel plugin
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/#babel-plugin

but our babel config didn't include it since it was made for 2.x

* support addition type for new files introduced

* replace slug mark in manifest with slug value

* add full scaffold manifest for upgrade

some stats:
- 146 files
- 55 directories
- 6 totally new files

* temporarily add branch to npx command

* github actions - upgrade node-version to 18

* fix lint issues

* rename custom/App.tsx into custom/App.js

for backwards compatibility with Studio

* add TODO notes for parsing project_slug

* add cookiecutter context onto crowdbotics.json

* copy .new file into the proper directory

all .new files were copied onto root before

* check if file exists before diffing

* improve git status

* remove untracked files on git reset action

* check whether file changed from PREVIOUS to NEW

compare the files across versions, skip if they are the same

* git add all files where upgrade is successful

* implement finding most frequent slug occurrence

* implement git diff printer and remove command

* move scaffold upgrade docs into it's own file

* remove dist/raw

this is an intermediary build artifact that is only used by
our cookie script, safe to remove and reduces repo size

* explain other lines in the package.json.diff

* fix lint issues in index.js

* introduce scaffold semver github action

checks and enforces semver version bumps at:
`scaffold/template/custom/.crowdbotics.json`

this action only get's triggered when there's some change made to the
following:
- scaffold/**
- dist/cookie/**

* remove redudant rm command and call it a document

* build: add Podfile.lock

* remove custom Podfile

only customization is debugging logs

* remove react-native-reanimated

@react-navigation/native no longer depends on it

* add override to android MainActivity.java

As suggested in the react-navigation installation instructions:
https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project

* scaffold - update fastlane README

* build: include files from pod install

* move all d5e04d8 template changes to custom

* revert gitignore changes in d5e04d8

* add --deployment to CI pod install step

* move Podfile.lock to custom

upstream template doesn't have a lockfile

* build: add missing packages

* undo all changes - only rm when untrackeds exist

* exclude addition files from comparison

* break rm into multiline rm

* improve diffing with prettier

* build: update podfile lock

* build: new xcode files

* build: xcode files update

* build: gem and pod update

* replace deprecated "@react-native-community/masked-view"

with "@react-native-masked-view/masked-view"

* make webpack config use App.js instead of App.tsx

* add react-native-reanimated dependency to the scaffold

* remove deployment flag

* configure webpack for react-native-reanimated

following 3.x docs here:
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support

* good looking welcome screen with image and text

* downgrade react-native-web upgrade gesture-handler

react-native-web deprecated animating style array values in v0.19.0:
> [change] Deprecate transform style array values. Use space-separated string functions.
https://github.com/necolas/react-native-web/releases/tag/0.19.0

Until react-native-navigation and react-native-reanimated fixes this
upstream we need to downgrade react-native-web for being able to show
navigation headers on web

Read more about this on this issue:
react-navigation/react-navigation#11356

* make demo script use cookiecutter for both scaffolds

no longer rely on `npx react-native init` which doesn't
match what our backend does - which is to cookiecutter all scaffolds

* change order of bootstrap subcommands

* fix reanimated missing AAR on CI issue

older versions of reanimated package AAR, this is the latest old version
that includes it

* move scripts/config.js to config.js

* update index.js to support arbitrary versions

* regen custom yarn.lock

* pipenv lock

* add manifest script command

* automate manifest generation and consumption

add a new version to `config.js` and then
run `yarn run manifest` to generate a new manifest for that version

* git add cookie ios/Pods/Manifest.lock

this file was gitignored and missed before

* refactor console.log utils into config

* add scaffold/package.json check in semver script

* simplify PR template by linking checklists docs

include new checks for scaffold (all types of builds)

* document the semver script

* document the manifest script

* increase root package.json version

* remove duplicate store documentation

This file is already made available to users of the scaffold in [store/README.md](/scaffold/template/custom/store/README.md).

* remove duplicate docs/index.md

duplicate of /README.md

* introduce CHANGELOGs and redo documentation

- move @modules docs to the scaffold, users benefit from it
- remove target android/ios sdk versions, those are listed in CHANGELOG
- cleanup docs/index.md
- rename /docs files to be more meaningful
- document new semver and manifest scripts

* docs: add information about PATH requirements

cookiecutter and pg_config binaries need to be available

* process commands replace status with error checks

* yarn run bootstrap

* replace his with their

* update manifest: add modules/README.md

* update path to dot

* persisting build/demo

* store demo as artifact

* using workspaces

* remove demo path from attach_workspace

* added test build to ios fastlane

* run new lane in ios build step

* get node and yarn versions in node job

* removed all cache commands from config

* clean yarn cache before installing

* testing with node version 16.14.2

* changed node version required

* added new lane to iOS fastfile

* added scheme to xcodebuild command

* added dynamic workspace and schema

* create new lane for only building android app

* changed build_type to debug for gradle build

* upgrade scaffold minor version

* added changelog for scaffold

* corrected changelog version

* updated scaffold/package.json

* update docker image patch

* bumped python version to 3.8.17

* decouple fastlane config

* build: adds import fastfile from git

* build: yarn run raw && yarn run cookie

* build: fastfile updates

* build: yarn run raw && yarn run cookie

* yarn run raw && yarn run cookie

* update versions

* yarn run raw && yarn run cookie

* yarn run manifest

* lint

* update changelog

* updated nextVersionSHA

* fix scaffold

* remove lane additions to Fastfiles

* spelling error

* add github to known hosts

* create .ssh directory

* corrected yaml schema

* remove mapping command

* fixed yaml schema

* temporary branch change

* set FASTLANE_CONFIG_VERSION environment variable

* se export for env var

* default FASTLANE_CONFIG_VERSION

* removed trailing space

* version commented out for testing

* fix env var

* yarn run raw && yarn run cookie

* update nextVersionSHA

* update branch and version in fastfile

* add v prefix to version

* remove equal signs

* remove v prefix

* remove version from import_from_git command

* updated changelog

* updated versions

* add new upgrade.versions to config.js

* fixed versioning

---------

Co-authored-by: Daniel <daniel.s@crowdbotics.com>
Co-authored-by: Muhammad Abdullah Abid <abd@abd.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants