Git Product home page Git Product logo

example-typescript-monorepo's Introduction

Update 01/29/2020

I would avoid using this project until it has been updated to use Yarn V2. For those wanting to use a typescript monorepo look into Yarn V2. It solves most of the problems this repo tries to solve.

Example Typescript Monorepo

The purpose of this repository is to provide a clear and concise Typescript architecture based on clean architecture principles.

Setup

  • Clone the project
  • Run yarn
  • Run yarn run watch (builds the javascript from typescript)

You will need to run this before running the below commands for the separate projects.

React Native IOS

  • In a new terminal run yarn run native:start
  • In a new terminal run yarn run native:ios

API

Web

Todo:

  • React Native Android.
  • Tests

Working with React Native modules

I won't get into all the details , but I would recommend looking into yarns hoisting mechanism. Check it out here

I think react-native + modules + yarn workspaces are working more nicely(make sure yarn is up to date). But if you have issues with modules being in the wrong place I would start there.

Adding a Second Native IOS Project

Please note this steps are mostly untested, and I can't recommend you use this repository for this approach. However, I will support as best as I can.

  • checkout a new branch
  • copy the native folder and paste it into /packages
  • rename the new folder to your app name, or however you like
  • cd packages/newNativePackage
  • npm install react-native-rename -g
  • react-native-rename newNativePackageName (this can be different from folder name)
  • Modify existing /native/ paths to /newNativePackage/
    • including:
      • /package.json (copy paste scripts relating to native and rename the commands and paths associated to newNativePackage)
      • Globally search for /native and native/ in newNativePackage and rename those to newNativePackage. (ignore the ios files(I think))
  • cd packages/native and run react-native upgrade (not sure this is nessasary) Say yes to everything except .babelrc
  • cd packages/newNativePackage and run react-native upgrade (not sure this is nessasary) Say yes to everything except .babelrc
  • In both native projects delete the ios/build folders.
  • Open the projects one at a time in xcode and build/fix signing certs, etc.
  • Try running the projects via package.json scripts.

example-typescript-monorepo's People

Contributors

dalinarkholin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

example-typescript-monorepo's Issues

Multiple native apps in the same monorepo

I'm trying to add additional native apps into the repo - it's not working out.

After adding a new project in packages, essentially a copy of packages/native, I can no longer start the native app.

▶ yarn run native:start
yarn run v1.9.4
$ cd packages/native && node link-workspaces.js && node node_modules/react-native/local-cli/cli.js start --config ../../../../packages/native/rn-cli-config.js --reset-cache
fs.js:1061
  return binding.unlink(pathModule._makeLong(path));
                 ^

Error: EISDIR: illegal operation on a directory, unlink '/home/johan/dev/appar/packages/native/node_modules/react-native'
    at Object.fs.unlinkSync (fs.js:1061:18)
    at link (/home/johan/dev/appar/packages/native/link-script.js:10:8)

~

The content of packages/native/node_modules

▶ cd packages/native/node_modules && ls -la
total 112
drwxrwxr-x 28 johan johan 4096 sep  5 13:08 .
drwxrwxr-x  6 johan johan 4096 sep  5 13:08 ..
drwxrwxr-x  2 johan johan 4096 sep  5 13:08 ansi-styles
drwxrwxr-x 13 johan johan 4096 sep  5 13:08 @babel
drwxrwxr-x  4 johan johan 4096 sep  5 13:08 babylon
drwxrwxr-x  2 johan johan 4096 sep  5 13:08 .bin
drwxrwxr-x  2 johan johan 4096 sep  5 13:08 chalk
drwxrwxr-x 13 johan johan 4096 sep  5 13:08 core-js
drwxrwxr-x  3 johan johan 4096 sep  5 13:08 envinfo
drwxrwxr-x  5 johan johan 4096 sep  5 13:08 fbjs
drwxrwxr-x  3 johan johan 4096 sep  5 13:08 jest-docblock
drwxrwxr-x  4 johan johan 4096 sep  5 13:08 jest-haste-map
drwxrwxr-x  3 johan johan 4096 sep  5 13:08 jest-serializer
drwxrwxr-x  3 johan johan 4096 sep  5 13:08 jest-worker
drwxrwxr-x  4 johan johan 4096 sep  5 13:08 json5
drwxrwxr-x  4 johan johan 4096 sep  5 13:08 metro
drwxrwxr-x  4 johan johan 4096 sep  5 13:08 metro-babel7-plugin-react-transform
drwxrwxr-x  5 johan johan 4096 sep  5 13:08 metro-cache
drwxrwxr-x  6 johan johan 4096 sep  5 13:08 metro-minify-uglify
drwxrwxr-x  3 johan johan 4096 sep  5 13:08 metro-source-map
drwxrwxr-x  2 johan johan 4096 sep  5 13:08 mime-db
drwxrwxr-x  2 johan johan 4096 sep  5 13:08 mime-types
drwxrwxr-x  5 johan johan 4096 sep  5 13:08 plist
drwxrwxr-x  3 johan johan 4096 sep  5 13:08 pretty-format
drwxrwxr-x  5 johan johan 4096 sep  5 13:08 react-devtools-core
drwxrwxr-x 15 johan johan 4096 sep  5 13:08 react-native
drwxrwxr-x  2 johan johan 4096 sep  5 13:08 supports-color
drwxrwxr-x  3 johan johan 4096 sep  5 13:08 xmlbuilder

~

If I remove the added packages/theOtherApp and run yarn install in the root, I can run it again.
packages/native/node_modules is back to normal:

total 20
drwxrwxr-x 5 johan johan 4096 sep  5 12:51 .
drwxrwxr-x 6 johan johan 4096 sep  5 12:20 ..
drwxrwxr-x 5 johan johan 4096 sep  5 12:50 @babel
drwxrwxr-x 2 johan johan 4096 sep  5 12:50 .bin
drwxrwxr-x 3 johan johan 4096 sep  5 12:51 .cache
lrwxrwxrwx 1 johan johan   47 sep  5 12:51 react-native -> /home/johan/dev/appar/node_modules/react-native

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.