A React Native project used to share code between WooCommerce iOS and Android.
pod 'woocommerce-shared', '~> 0.0.1'
# Reference a commit hash
pod 'WooCommerceShared', git: 'https://github.com/woocommerce/WooCommerce-Shared.git', commit: '6cba1e9'
# Reference a branch
pod 'WooCommerceShared', git: 'https://github.com/woocommerce/WooCommerce-Shared.git', branch: 'trunk'
# Reference a local copy
pod 'WooCommerceShared', path: '../WooCommerce-Shared'
dependencies: [
.package(url: "https://github.com/woocommerce/woocommerce-shared.git", .upToNextMajor(from: "0.0.1"))
]
// Development Builds require two entries – one for the binary target:
targets: [
.binaryTarget(
name: "WooCommerceShared",
url: "https://cdn.a8c-ci.services/woocommerce-shared/[commit-hash]/WooCommerceShared.xcframework.zip",
checksum: "[Contents of https://cdn.a8c-ci.services/woocommerce-shared/[commit-hash]/WooCommerceShared.xcframework.zip.checksum.txt]"
)
]
// And a second to make the target depend on it:
.executable(name: "MyApp", targets: [
"WooCommerceShared",
])
This project uses make
for most of its operations. You probably already have it installed if you've used your computer for development tasks in the past.
To work on this project, you'll need a JS runtime. The current JS version is in the repo's .nvmrc
file, so if you have nvm
installed, it'l just work. Otherwise, you'll need that version of node
installed. If you're doing iOS development, you'll need Ruby installed – we recommend using rbenv
, which will ensure that you're running the correct version of the tooling. Lastly, this project uses yarn
as its package manager, so once you have node
installed, you'll need to run npm install -g yarn
to ensure the package manager is available everywhere.
The demo app reads user credentials from the environment.
- Create an
.env
file in the root folder. - Set (BLOG_ID and TOKEN) values for WPCom/Jetpack stores or (SITE_URL and APP_PASSWORD) for non WPCom/Jetpack values.
Example:
BLOG_ID=12345678
TOKEN='GH7J8K9WV#CF6798764DF5GHJK987'
or
SITE_URL='https://something.wordpress.com'
APP_PASSWORD='DERFTGYHUJIKOIJUHYGTFR$%=='
Note: When adding or modifying a value we need to restart the metro server in order for changes to be picked up.
Run make dev
to start working on this project locally.
Running make
(with no other arguments) will build every component of the project (if possible on the current machine). See the Makefile
for all of the individual build tasks involved in this.
Because of various CocoaPods and SwiftPM idiosyncracies around xcframework
distribution, releases are a bit tricky. To perform a release, you should:
- Create a
release/$VERSION
branch. - Adjust the version numbers in
WooCommerceShared.podspec
andpackage.json
to match your$VERSION
, then commit your changes asBump version to $VERSION
, then push your changes to GitHub.com - Wait for CI to publish the tip of your release branch, and note the commit shorthash.
- Update the URL in
Package.swift
, and update thechecksum
field with the hash printed in the build log (if you need it, it's also published tohttps://cdn.a8c-ci.services/woocommerce-shared/{commit-hash}/WooCommerceShared.xcframework.zip.checksum.txt
. - Commit your change as
Tag {$VERSION}
, then tag that commit with your version number. - Publish the tag to GitHub.com