Skip to content

Commit

Permalink
refactor: flatten deps and improve repo folder (#821)
Browse files Browse the repository at this point in the history
- Renames `libs/` to `src/`.
- Moves `typegate/`, `meta-cli`, `typegraph/`, `meta-lsp/` to `src/`.
- Renames `dev/` to `tools/`
- Moves `website/` to `docs/metatype.dev`/
- Moves `src/typegate/tests` to `tests/`
- Moves `src/typegraph/deno/dev` to `tools/jsr/`
- Moves `src/typegraph/deno/sdk` to `src/typegraph/deno/`
- Renames `src/deno` to `src/mt_deno`
- Bumps deno to `1.46.1`
- Bumps rust toolchain to `1.80.1`
- Moves all rust dependencies to workspace section
- Moves `tools/task-*.ts` to `tools/task/*.ts`
- Moves `cliff.toml`, `Cross.toml`, `ruff.toml` to `tools/`
- Uses deno
[workspaces](https://docs.deno.com/runtime/manual/basics/workspaces/) to
organize `src/typegraph/deno`, `src/typegate`, `tools/`, `tests/` and
more.
- Closes MET-607
- Updates poetry to 1.8.3
- Bumps metatype to version 0.4.9-rc1
- [x] Update CONTRIBUTING.md
- [x] Fix CI workflows
- [x] Fix Dockerfile
- [x] Fix all tests

#### Migration notes

- No end user changes required

- [x] The change comes with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change

---------

Co-authored-by: Estifanos Bireda <[email protected]>
  • Loading branch information
Yohe-Am and destifo authored Sep 2, 2024
1 parent 1c740bc commit d84e4ed
Show file tree
Hide file tree
Showing 1,239 changed files with 5,172 additions and 2,405 deletions.
File renamed without changes.
37 changes: 36 additions & 1 deletion .ghjk/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

904 changes: 579 additions & 325 deletions .ghjk/lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: docker/build-push-action@v6
id: dev
with:
file: dev/Dockerfile
file: tools/Dockerfile
platforms: ${{ matrix.platform }}
target: dev
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:base
Expand All @@ -44,7 +44,7 @@ jobs:
- uses: docker/build-push-action@v6
id: prd
with:
file: dev/Dockerfile
file: tools/Dockerfile
platforms: ${{ matrix.platform }}
target: prd
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:nightly
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
filters: |
website:
- '.github/**'
- 'website/**'
- 'docs/metatype.dev/**'
outputs:
website: ${{ steps.filter.outputs.website }}

Expand All @@ -39,13 +39,13 @@ jobs:
python3 -m venv .venv
source .venv/bin/activate
poetry install --no-root
cd website
cd docs/metatype.dev
pnpm install --frozen-lockfile
pnpm build
- uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: website/build
publish_dir: docs/metatype.dev/build
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
cname: metatype.dev
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,21 @@ jobs:
WASM_OPT=1 ghjk x build-tgraph
cd typegraph/python
cd src/typegraph/python
poetry build
[ "$OVERWRITE" == 'true' ] \
&& poetry publish --skip-existing \
|| poetry publish
cd -
cd typegraph/node
cd src/typegraph/node
pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
[ "$OVERWRITE" == 'true' ] \
&& (pnpm publish --no-git-checks --force || true) \
|| pnpm publish --no-git-checks
cd -
cd typegraph/deno/sdk
cd src/typegraph/deno/
ghjk x build-tgraph-ts-jsr
[ "$OVERWRITE" == 'true' ] \
&& (deno publish --allow-slow-types --allow-dirty || true) \
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
- uses: docker/build-push-action@v6
id: build
with:
file: dev/Dockerfile
file: tools/Dockerfile
platforms: ${{ matrix.platform }}
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:latest
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
Expand Down Expand Up @@ -306,7 +306,7 @@ jobs:
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc
- shell: bash
run: |
cd meta-lsp
cd src/meta-lsp
pnpm install --frozen-lockfile
cd ts-language-server
pnpm install --frozen-lockfile
Expand Down
52 changes: 21 additions & 31 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,25 @@ jobs:
filters: |
website:
- '.github/workflows/tests.yml'
- 'website/**'
meta-cli:
- '.github/workflows/tests.yml'
- 'libs/**'
- 'meta-cli/**'
- 'Cargo.lock'
- 'src/metatype.dev/**'
typegate: # for the standalone/image (not typegate tests which rely on everything)
- '.github/workflows/tests.yml'
- 'libs/**'
- 'typegate/**' # consider moving tests to other dir to improve test detection
- 'src/common/**'
- 'src/mt_deno/**'
- 'src/pyrt_wit_wire/**'
- 'src/typegate/**'
- 'src/wit/**'
- 'Cargo.lock'
full:
- '.github/workflows/tests.yml'
- 'libs/**'
- 'typegate/**'
- 'typegraph/**'
- 'meta-cli/**'
- 'Cargo.lock'
- 'src/**'
- 'tests/**'
- 'examples/**'
rust:
- '.github/workflows/tests.yml'
- 'libs/**'
- 'Cargo.lock'
outputs:
website: ${{ steps.filter.outputs.website }}
meta-cli: ${{ steps.filter.outputs.meta-cli }}
typegate: ${{ steps.filter.outputs.typegate }}
full: ${{ steps.filter.outputs.full }}
rust: ${{ steps.filter.outputs.rust }}

pre-commit:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -194,7 +184,7 @@ jobs:
uses: docker/build-push-action@v6
if: steps.check.outputs.has-permission
with:
file: dev/Dockerfile
file: tools/Dockerfile
platforms: ${{ matrix.platform }}
push: false
cache-from: type=registry,ref=docker.io/zifeo/metatype-cache:ci
Expand All @@ -208,7 +198,7 @@ jobs:
uses: docker/build-push-action@v6
if: "! steps.check.outputs.has-permission"
with:
file: dev/Dockerfile
file: tools/Dockerfile
platforms: ${{ matrix.platform }}
push: false
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/typegate:latest
Expand Down Expand Up @@ -262,6 +252,7 @@ jobs:
ghjk x install-sys | bash
ghjk x install-py
ghjk x install-wasi-adapter
source .venv/bin/activate
# this doesn't publish it but only builds it
Expand All @@ -271,7 +262,6 @@ jobs:
ghjk x dev-compose base prisma
WASM_OPT=1 ghjk x build-tgraph
ls -osha typegraph/node
ghjk x install-ts
Expand All @@ -283,16 +273,16 @@ jobs:
ghjk x test-e2e -- --coverage=coverage
# FIXME: required due to https://github.com/denoland/deno/issues/21621#issuecomment-1887870712
deno cache --import-map typegate/import_map.json \
typegate/src/main.ts \
typegate/tests/utils/*.ts \
typegate/tests/runtimes/wasm_wire/*.ts \
typegate/tests/runtimes/wasm_reflected/*.ts \
typegate/tests/runtimes/python/*.ts \
typegate/tests/e2e/self_deploy/self_deploy.ts \
typegate/tests/metagen/typegraphs/metagen.ts \
typegraph/deno/sdk/src/*.ts \
dev/*.ts
deno cache --config src/typegate/deno.jsonc \
src/typegate/src/main.ts \
tests/utils/*.ts \
tests/runtimes/wasm_wire/*.ts \
tests/runtimes/wasm_reflected/*.ts \
tests/runtimes/python/*.ts \
tests/e2e/self_deploy/self_deploy.ts \
tests/metagen/typegraphs/metagen.ts \
src/typegraph/deno/src/*.ts \
tools/*.ts
deno --unstable-worker-options --unstable-net coverage ./coverage --lcov > coverage.lcov
Expand Down
36 changes: 19 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,40 @@ crash.log
target
**/*.rs.bk

meta-lsp/ts-language-server/out/
meta-lsp/vscode-metatype-support/out/
meta-lsp/*.vsix

typegate/workers
typegate/codegen
typegate/tests/prisma-migrations
typegate/tests/e2e/cli/prisma-migrations
typegate/tests/importers/copy/
typegate/tests/**/*.wasm
src/meta-lsp/ts-language-server/out/
src/meta-lsp/vscode-metatype-support/out/
src/meta-lsp/*.vsix

src/typegate/workers
src/typegate/codegen

tests/prisma-migrations
tests/e2e/cli/prisma-migrations
tests/importers/copy/
tests/**/*.wasm

.env
typegate/native/bindings.json
src/typegate/native/bindings.json
bindings

node_modules
build
.docusaurus
.cache-loader
website/vale/Google
docs/metatype.dev/vale/Google
recipe.json
*-debug.whiz.yaml

tmp/
coverage*

typegraph/deno/sdk/src/gen
typegraph/deno/sdk/README.md
typegraph/node
typegraph/python/typegraph/gen
src/typegraph/deno/src/gen
src/typegraph/deno/README.md
src/typegraph/node
src/typegraph/python/typegraph/gen

*.egg-info/

examples/typegraphs/migrations
examples/typegraphs/**/*.wasm
libs/pyrt_wit_wire/wit_wire
src/pyrt_wit_wire/wit_wire
29 changes: 9 additions & 20 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
{
"editor.formatOnSave": true,
"files.exclude": {
"website/.docusaurus": true,
"website/node_modules": true
"docs/metatype.dev/.docusaurus": true,
"docs/metatype.dev/node_modules": true
},
"deno.disablePaths": [
"meta-lsp",
"typegraph/node",
"src/meta-lsp",
"src/typegraph/node",
"examples/templates/node",
"website"
"docs/metatype.dev"
],
// "deno.enablePaths": [
// "typegate",
// "dev",
// "examples/templates/deno",
// "examples/typegraphs",
// "typegraph/deno/dev",
// "typegraph/deno/sdk",
// "libs/metagen",
// "ghjk.ts",
// ".ghjk"
// ],
// "deno.config": "typegate/deno.jsonc",
"deno.config": "deno.jsonc",
"deno.unstable": true,
"deno.codeLens.implementations": true,
"deno.codeLens.references": true,
"deno.codeLens.referencesAllFunctions": true,
"typescript.suggest.completeFunctionCalls": true,
"typescript.inlayHints.variableTypes.enabled": true,
"typescript.inlayHints.propertyDeclarationTypes.enabled": true,
Expand All @@ -33,9 +25,6 @@
"typescript.inlayHints.variableTypes.suppressWhenTypeMatchesName": true,
"typescript.inlayHints.functionLikeReturnTypes.enabled": true,
"rust-analyzer.checkOnSave": true,
"deno.codeLens.implementations": true,
"deno.codeLens.references": true,
"deno.codeLens.referencesAllFunctions": true,
"editor.wordWrap": "on",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
Expand Down
Loading

0 comments on commit d84e4ed

Please sign in to comment.