https://github.com/metalwarrior665/ts-monorepo
https://github.com/metalwarrior665/ts-monorepo
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/metalwarrior665/ts-monorepo
- Owner: metalwarrior665
- Created: 2023-06-20T17:00:28.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-20T17:06:32.000Z (almost 2 years ago)
- Last Synced: 2024-12-30T18:28:44.288Z (4 months ago)
- Language: Dockerfile
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Apify Actor monorepo example
This repository shows how to structure a monorepo containing multiple Apify Actors,
along with shared packages used in multiple packages.## Structure
The project is structured as a NPM workspace,
with the Actors being in the `@actors` scope and packages in the `@packages` scope.The TypeScript Actors and packages are structured in one TypeScript project,
with project references ensuring that they are built in the correct topological order
based on their interdependencies.To enable testing the TypeScript Actors locally
without having to rebuild them or the TypeScript packages after every code change,
`ts-node` along with the [`tsconfig-paths`](https://github.com/dividab/tsconfig-paths) loader is used.
Since `tsconfig-paths` does not play well with ESM packages,
a custom wrapper for the loader is used, defined in `module_loader.js`.The `actors` folder contains the code of the Actors in this project.
There is one JavaScript actor and one TypeScript actor,
with their respective Dockerfiles showing how to build them on the Apify Platform correctly,
including the shared packages, but excluding the code of other actors.The `packages` folder contains simplistic packages that are used in multiple Actors.
There is one JavaScript and one TypeScript package,
and both are written as ES modules.The `shared` folder contains an input schema for both of the Actors,
which is referenced from the respective Actor's `.actor/actor.json` file.## Building monorepo Actors on the Apify platform
To build Actors from a monorepo,
you have to specify the path to the correct Actor in the Git URL of the Actor on the Apify Platform.For example, to build the TypeScript Actor from this monorepo,
you would specify this in the Actor's setup:- Git URL: `https://github.com/apify/actor-monorepo-example`
- Branch: `main`
- Folder: `actors/typescript-actor`