1つのプロジェクトディレクト内で複数のプロジェクトを格納するタイプ。
※他のスクリプト系とDenoは運用コンセプトが異なるので
1.Deno自体をバージョン毎に使い分ける必要はない
2.外部ライブラリのバージョンを意識するだけ(importで互換性指定が可能)
# ディレクトリ構造
[ユーザー名]-deno-world
├── .vscode
├── .gitignore
├── deno.json 全体の共通設定
├── scripts/
│ └── backup.ts 全体バックアップ
├── dist/ 生成した配布物
├── apps/
│ ├── app1/ ワークスペース1
│ │ ├── deno.json WSの専用設定
│ │ ├── scripts/
│ │ │ └── build.ts 配布物生成
│ │ ├── src/
│ │ │ ├── main.ts
│ │ │ └── shared/ WS内専用の共有コード
│ │ └── test/
│ └── app2/ ワークスペース2
├── shared/ 全体の共有コード/ライブラリ
│ └── mod.ts
└── playground/ 実験コード
# 設定
## .vscode/settings.json
{
"deno.enable": true,
"deno.lint": true,
"deno.cacheOnSave": true,
"deno.suggest.imports.autoDiscover": true
}
## .gitignore
## ./deno.json
{
"workspace": [
"./apps/*",
"./shared",
"./playground/*"
],
"tasks": {
"check-update": "deno outdated",
"update": "deno outdated --update",
"backup": "deno run --allow-read --allow-write --allow-run scripts/backup.ts",
"test-all": "deno test --allow-all",
"lint-all": "deno lint",
"start-app1": "deno task --cwd apps/app1 start",
"build-app1": "deno task --cwd apps/app1 build"
},
"imports": {
"@shared/root": "./shared/mod.ts"
}
}
##./apps/app1/deno.json
{
"name": "app1",
"version": "0.1.0",
"tasks": {
"start": "deno run --allow-all src/main.ts",
"build": "deno run --allow-all scripts/build.ts"
},
"imports": {
"@shared/local": "./src/shared/mod.ts"
}
}