- Use
ws-ensure.tsin this repo and create a copy of it calledws-ensure.tsfile in the root of your workspaces (e.g.D:\workspacesor/home/snshah/workspacesor any other root directory). - Update
wsReposvariable and fill out therepoUrlWithoutSchemeproperties for each repository you want to work with locally. - Execute
deno run -A ./ws-ensure.tsto idempotently clone and update your workspace repositories (run it as many times as necessary, every time you want to update and work with those repos locally).
mGit workspaces are managed by either GitHub or cloud/on-premise GitLab or any other supplier which offers HTTPs based Git repository management. mGit strategy allows multiple (single) repos to act as a monorepo with respect to retrieving and managing repositories using Visual Studio Code. While mGit does not, strictly, require VS Code, mGit commands/tasks use the VS Code *.code-workspaces file format (specifically the folders property) to define which paths will participate as an mGit monorepo.
A very specific, strictly enforced, convention is used to structure "managed" Git workspaces (repos) in the current directory where each Git manager (e.g. github.com or git.company.io) has a home path under workspaces and the repos from that server are placed in the exact same directory structure as they appear in the home server (e.g. github.com or git.company.io). For GitHub, there is only github.com/org/repo combination but for GitLab there can be unlimited depth like git.company.io/group1/subgroup1/repo.
❯ tree -d -L 4 (pwd)
└── workspaces
├── github.com
│ ├── shah
│ │ ├── uniform-resource
│ └── netspective-labs
│ └── home-polyglot
└── gitlab.company.io
└── gitlab-group-parent
└── child
└── grandchild
├── repo1
└── repo2git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command. git-xargs is not installed by default but if you need it, you can install it yourself for one-off use or let our team know and we'll have it installed as a standard home-polyglot package.
Use the Windows Package Manager to install our minimum dependencies, namely Git and Deno:
$ winget install Git.Git deno
Then you can grab ws-ensure.ts from this repo and run it:
$ cd c:\workspaces
$ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/strategy-coach/workspaces/main/ws-ensure.ts" -OutFile "./ws-ensure.ts"
# edit the ./ws-ensure.ts file to supply the GitHub repos you care about and then:
$ deno run -A ./ws-ensure.ts
These are optional but are very helpful for Windows development:
$ winget install Microsoft.Powershell Microsoft.WindowsTerminal
Use Coach Workspaces Host to prepare an opinionated Linux Engineering Sandbox and then:
mkdir -p ~/workspaces && cd ~/workspaces
curl -fsSL "https://raw.githubusercontent.com/strategy-coach/workspaces/main/ws-ensure.ts" > ./ws-ensure.ts
chmod +x ./ws-ensure.ts
# edit the ./ws-ensure.ts file to supply the GitHub repos you care about and then:
./ws-ensure.tsTODO: Add notes
mGit tasks use VS Code *.code-workspace files whose folders assume that the *.code-workspace file is in the current directory root. This allows Visual Studio Code users to set their folders for all Git managers relative to the current directory as the root.
With this feature, VSC workspaces are all fully portable using relative directories and can easily mix repos from different Git managers (e.g. GitHub, GitLab) to form a kind of monorepo.
For example, to produce the structure shown above the following my.code-workspace can be used:
{
"folders": [
{
"path": "github.com/netspective-labs/sql-aide"
},
{
"path": "github.com/opsfolio/resource-surveillance"
},
{
"path": "gitlab.company.io/gitlab-group-parent/child/grandchild/repo1"
},
{
"path": "gitlab.company.io/gitlab-group-parent/child/grandchild/repo2"
}
],
"settings": {
"git.autofetch": true
}
}