Last piece of the puzzle: Moving Satellite inside Telescope
Tags: git, monorepo, eslint
Published: 2022-03-12 17:06:40

This week we released Telescope 2.8 and, as part of the new release, we [moved](https://github.com/Seneca-CDOT/telescope/issues/2677) the [Satellite](https://github.com/Seneca-CDOT/satellite) project inside of the [Telescope](https://github.com/Seneca-CDOT/telescope) monorepo. Satellite is the microservice framework used by Telescope.

I am excited about this change because until now Satellite was the only piece of the telescope project that was in a separate repo. Now we will be able to work on Satellite all from within the monorepo!

This is only possible because we can publish the Satellite package to the Npmjs registry using `pnpm -r publish` as I discussed in my previous [blog post](https://dev.to/menghif/publish-packages-from-within-a-monorepo-3b96).

The initial idea was to copy the project's files over to `src/satellite` in Telescope and then add to `package.json` a [section](https://docs.npmjs.com/cli/v6/configuring-npm/package-json#people-fields-author-contributors) about the original contributors like this:

```json
{ "name" : "Barney Rubble",
  "email" : "b@rubble.com",
  "url" : "http://barnyrubble.tumblr.com/"
}
```

However this was not great because we would have lost all of the git history. Thanks to [Duke](https://github.com/DukeManh), I discovered a very useful git command called `subtree`.

## Git subtree

This is the full command:

`git subtree add --prefix src/satellite/ git@github.com:Seneca-CDOT/satellite.git HEAD`

Let's break it down.

`--prefix`: this tells git where to add the repo. In our case it's in `src/satellite`.

`git@github.com:Seneca-CDOT/satellite.git`: Satellite repo remote address.

`HEAD`: reference to the latest commit in the Telescope branch.

After successfully running the above command, we get this commit:

```console
commit 85522ffc4205da8c6a6f736073f55aaff595c382
Merge: 8360d5dc 5491bbb0
Author: Francesco Menghi <53121061+menghif@users.noreply.github.com>
Date:   Tue Mar 8 09:55:48 2022 -0500

    Add 'src/satellite/' from commit '5491bbb058d121552a3191b49199d75cfc56956b'
    
    git-subtree-dir: src/satellite
    git-subtree-mainline: 8360d5dc434878d92527bc134882ea1aed003e53
    git-subtree-split: 5491bbb058d121552a3191b49199d75cfc56956b
```

`git-subtree-mainline` is the last Telescope commit and `git-subtree-split` is the last Satellite commit.

## ESLint fixes

Once the Satellite [PR](https://github.com/Seneca-CDOT/telescope/pull/3136) was merged, I worked on the ESLint config for Satellite ([Issue](https://github.com/Seneca-CDOT/telescope/issues/3144), [PR](https://github.com/Seneca-CDOT/telescope/pull/3151)). While doing this, I discovered that all of the other package's ESLint configurations were not setup properly and so we were not actually linting our code at all.

Since we had an ESLint config for the whole repo before and now we have a config for each package within the repo, we are still getting used to the change.

Basically we were missing the `eslint` and `@senecacdot/eslint-config-telescope` dependencies in each package so the command `pnpm lint` was not actually doing anything.

This is now being fixed and tracked in this [Metabug](https://github.com/Seneca-CDOT/telescope/issues/3153). Soon ESLint will be fully functional again and faster than ever thanks to [Turborepo](https://turborepo.org/).