Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ check-program = $(foreach exec,$(1),$(if $(shell PATH="$(PATH)" which $(exec)),,
# Get the temporary directory of the system
TEMPDIR := $(shell dirname $(shell mktemp -u))

APP_NAME := gnoboard
APP_NAME ?= gnoboard

# Define the directory that contains the current Makefile
make_dir := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
Expand Down Expand Up @@ -70,8 +70,8 @@ fclean:

# - API : Handle API generation and cleaning

api.generate: _api.generate.protocol
api.clean: _api.clean.protocol
api.generate: _api.generate.protocol _api.generate.modules
api.clean: _api.clean.protocol _api.clean.modules

# - API - rpc

Expand All @@ -97,7 +97,14 @@ $(gen_sum): $(gen_src)
go mod tidy \
)

.PHONY: api.generate _api.generate.protocol _api.clean.protocol
_api.generate.modules:
$(call check-program, yarn)
cd api; yarn

_api.clean.modules:
cd api; rm -fr node_modules

.PHONY: api.generate _api.generate.protocol _api.generate.modules _api.clean.protocol _api.clean.modules

# - Bind : Handle gomobile bind

Expand Down Expand Up @@ -168,6 +175,7 @@ asdf.install_tools: asdf.add_plugins
# Script to create a new app

yarn_basic_dependencies := @bufbuild/protobuf @connectrpc/connect @connectrpc/connect-web react-native-polyfill-globals react-native-url-polyfill web-streams-polyfill react-native-get-random-values text-encoding base-64 react-native-fetch-api
yarn_basic_dev_dependencies = @tsconfig/react-native babel-plugin-module-resolver
OUTPUT_DIR := $(make_dir)/examples/react-native

new-app:
Expand All @@ -189,25 +197,25 @@ new-react-native-app:
@echo "Creating ios and android folders"
cd $(OUTPUT_DIR)/$(APP_NAME) && yarn expo prebuild
@echo "Installing yarn dependencies"
cd $(OUTPUT_DIR)/$(APP_NAME) && yarn add ${yarn_basic_dependencies}
cd $(OUTPUT_DIR)/$(APP_NAME) && yarn add ${yarn_basic_dependencies} && yarn add -D ${yarn_basic_dev_dependencies}
@echo "Building GnoCore.xcframework for the new app"
$(MAKE) build.ios APP_NAME=$(APP_NAME) APP_OUTPUT_DIR=$(OUTPUT_DIR)/$(APP_NAME)

# copy js files from gnoboard to the new app
copy-js-files:
$(call check-program, jq)
@echo "Copying js files"
@mkdir -p $(OUTPUT_DIR)/$(APP_NAME)/src/api
@mkdir -p $(OUTPUT_DIR)/$(APP_NAME)/src/grpc
@mkdir -p $(OUTPUT_DIR)/$(APP_NAME)/src/hooks
@cp -r $(gnoboard_dir)/src/api $(OUTPUT_DIR)/$(APP_NAME)/src
@cp -r $(gnoboard_dir)/src/grpc $(OUTPUT_DIR)/$(APP_NAME)/src
@cp -r $(gnoboard_dir)/src/hooks $(OUTPUT_DIR)/$(APP_NAME)/src
@cp -r $(gnoboard_dir)/src/native_modules $(OUTPUT_DIR)/$(APP_NAME)/src
@cp -r $(gnoboard_dir)/Makefile $(OUTPUT_DIR)/$(APP_NAME)
@cp -r $(gnoboard_dir)/android/.gitignore $(OUTPUT_DIR)/$(APP_NAME)/android
@cp -r $(gnoboard_dir)/ios/.gitignore $(OUTPUT_DIR)/$(APP_NAME)/ios
@cp $(make_dir)/templates/tsconfig.json $(OUTPUT_DIR)/$(APP_NAME)/tsconfig.json
@cp $(make_dir)/templates/babel.config.js $(OUTPUT_DIR)/$(APP_NAME)/babel.config.js
@cp $(make_dir)/templates/metro.config.js $(OUTPUT_DIR)/$(APP_NAME)/metro.config.js
@cp $(make_dir)/templates/App.tsx $(OUTPUT_DIR)/$(APP_NAME)/App.tsx

# build GnoCore.xcframework for the new app
Expand All @@ -217,6 +225,7 @@ new-app-build-ios:
@cp -r $(gnoboard_dir)/ios/gnoboard/Sources $(OUTPUT_DIR)/$(APP_NAME)/ios/$(APP_NAME)/
@cp $(gnoboard_dir)/ios/gnoboard/gnoboard-Bridging-Header.h $(OUTPUT_DIR)/$(APP_NAME)/ios/$(APP_NAME)/$(APP_NAME)-Bridging-Header.h
@cp -r $(gnoboard_dir)/ios/Sources $(OUTPUT_DIR)/$(APP_NAME)/ios/
@cd $(OUTPUT_DIR)/$(APP_NAME) && $(MAKE) ios/$(APP_NAME).xcworkspace TEMPLATE_PROJECT=$(APP_NAME)

JSON_FILE := $(OUTPUT_DIR)/$(APP_NAME)/app.json
# add tsconfigPaths entry to app.json
Expand Down
1 change: 1 addition & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 1 addition & 1 deletion api/gen/es/rpc_pb.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.6.0
// @generated by protoc-gen-es v1.7.2
// @generated from file rpc.proto (package land.gno.gnonative.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
2 changes: 1 addition & 1 deletion api/gen/es/rpc_pb.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.6.0
// @generated by protoc-gen-es v1.7.2
// @generated from file rpc.proto (package land.gno.gnonative.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
5 changes: 2 additions & 3 deletions api/gen/go/_goconnect/rpc.connect.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "api",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.23.6",
"@bufbuild/protobuf": "^1.6.0"
}
}
20 changes: 20 additions & 0 deletions api/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@babel/runtime@^7.23.6":
version "7.23.6"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.6.tgz#c05e610dc228855dc92ef1b53d07389ed8ab521d"
integrity sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==
dependencies:
regenerator-runtime "^0.14.0"

"@bufbuild/protobuf@^1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-1.6.0.tgz#c33128f70330312e2bd78fd7e988576595b8f74d"
integrity sha512-hp19vSFgNw3wBBcVBx5qo5pufCqjaJ0Cfk5H/pfjNOfNWU+4/w0QVOmfAOZNRrNWRrVuaJWxcN8P2vhOkkzbBQ==

regenerator-runtime@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45"
integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==
109 changes: 0 additions & 109 deletions examples/electron/README.md

This file was deleted.

1 change: 1 addition & 0 deletions examples/react-native/gnoboard/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = function (api) {
extensions: ['.ios.js', '.android.js', '.js', '.ts', '.tsx', '.json'],
alias: {
'@gno': './src/',
'@api': '../../../api/gen/es',
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
"FB_SONARKIT_ENABLED=1",
);
INFOPLIST_FILE = gnoboard/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -436,7 +436,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = gnoboard/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -526,8 +526,8 @@
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
"-Wl -ld_classic ",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -598,8 +598,8 @@
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
"-Wl -ld_classic ",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down
14 changes: 14 additions & 0 deletions examples/react-native/gnoboard/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
const { mergeConfig } = require('metro-config');
const path = require('path');

/** @type {import('expo/metro-config').MetroConfig} */
// const config = getDefaultConfig(__dirname);
//
// module.exports = config;
const config = {
watchFolders: [path.resolve(__dirname + '/../../../api')],
};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);
Loading