gnolang / gnonative

Develop for Gno using your app's native language
Apache License 2.0
9 stars 9 forks source link

chore: centralize API usage #100

Closed D4ryl00 closed 4 months ago

D4ryl00 commented 6 months ago

This PR wants all the example apps and the Go framework to use the API in the ./api folder instead of copying the API files into their subdirectory. So if you update the API files, every app will use the latest version of them.

Fixes https://github.com/gnolang/gnonative/issues/103

jefft0 commented 4 months ago

In a fresh clone, I do make build.ios . I open and run the gnoboard Xcode project. When the app starts it prints:

iOS Bundling failed 1524ms
Unable to resolve "@bufbuild/protobuf" from "../../../api/gen/es/rpc_pb.js"
jefft0 commented 4 months ago

... The same error for Android. I do make build.android. I open and run the gnoboard Android project. When the app starts it prints:

Android Bundling failed 1278ms
Unable to resolve "@bufbuild/protobuf" from "../../../api/gen/es/rpc_pb.js"
jefft0 commented 4 months ago

Problem with Wails. In a fresh clone of this branch, I go to examples/wails and follow the new README (including patch files). wails dev prints:

    src/hooks/use-gno.ts(36,25): error TS2307: Cannot find module '@gno/api/gnonativetypes_pb' or its corresponding type declarations.
jefft0 commented 4 months ago

Problem with new-app. In a fresh clone, I enter APP_NAME=myapp make new-app. It prints:

/Applications/Xcode.app/Contents/Developer/usr/bin/make new-react-native-app OUTPUT_DIR=/Users/jefft0/temp/gnonative/examples/react-native
creating a new gno awesome project at: /Users/jefft0/temp/gnonative/examples/react-native
cd /Users/jefft0/temp/gnonative/examples/react-native && yarn create expo gnoboard --template expo-template-blank-typescript
yarn create v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Installed "create-expo@2.1.4" with binaries:
      - create-expo
[##] 2/2The directory gnoboard has files that might be overwritten:

  .eslintrc.json
  .prettierignore
  .prettierrc
  .storybook
  App.tsx
  Makefile
  REAME.md
  android
  app.json
  assets
  babel.config.js
  ios
  metro.config.js
  package.json
  src
  tsconfig.json
  yarn.lock

Try using a new directory name, or moving these files.

error Command failed.
Exit code: 1
Command: /Users/jefft0/.yarn/bin/create-expo
Arguments: gnoboard --template expo-template-blank-typescript
Directory: /Users/jefft0/temp/gnonative/examples/react-native
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
make[1]: *** [new-react-native-app] Error 1
make: *** [new-app] Error 2
jefft0 commented 4 months ago

The problems with gnoboard mentioned above are resolved.

jefft0 commented 4 months ago

The problem with make new-app for Android has been resolved. There is still a problem for iOS. I enter APP_NAME=testapp make new-app . In Xcode I open examples/react-native/testapp/ios/testapp.xcworkspace . Build gives the error:

Build input file cannot be found: '/Users/jefft0/temp/gnonative/examples/react-native/testapp/node_modules/react-native/React/Fabric/RCTThirdPartyFabricComponentsProvider.mm'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
jefft0 commented 4 months ago

The problem with make new-app with iOS is resolved.