Skip to content

Commit

Permalink
refactor: flatten repo structure (#563)
Browse files Browse the repository at this point in the history
* refactor: flatten repo structure

this makes it easier for new contributors to find where templates live

* fmt

* update syntax

* saturating sub

* revert lte syntax change

* fix manifest

* react and solid
  • Loading branch information
amrbashir authored Dec 28, 2023
1 parent 7cd8cf8 commit 5813af8
Show file tree
Hide file tree
Showing 297 changed files with 288 additions and 586 deletions.
10 changes: 5 additions & 5 deletions .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
},
"packages": {
"create-tauri-app": {
"path": "./packages/cli",
"path": ".",
"manager": "rust",
"postversion": [
"cargo check",
"node ../../.scripts/sync-scripts-tagname.js ${ release.type }",
"cp ../../create-tauri-app.ps1 ../worker/scripts",
"cp ../../create-tauri-app.sh ../worker/scripts"
"node .scripts/sync-scripts-tagname.js ${ release.type }",
"cp create-tauri-app.ps1 worker/scripts",
"cp create-tauri-app.sh worker/scripts"
],
"assets": [
{
Expand All @@ -55,7 +55,7 @@
]
},
"create-tauri-app-js": {
"path": "./packages/cli/node",
"path": "./node",
"manager": "javascript",
"dependencies": ["create-tauri-app"],
"prepublish": [],
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cli-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ on:
- dev
paths:
- '.github/workflows/cli-test.yml'
- 'packages/cli/**'
- 'src/**'
- 'Cargo.lock'
- 'Cargo.toml'
pull_request:
paths:
- '.github/workflows/cli-test.yml'
- 'packages/cli/**'
- 'src/**'
- 'Cargo.lock'
- 'Cargo.toml'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ on:
- dev
paths:
- '.github/workflows/clippy.yml'
- 'packages/cli/**'
- 'src/**'
- 'Cargo.lock'
- 'Cargo.toml'
pull_request:
paths:
- .github/workflows/clippy.yml
- packages/cli/**
- src/**
- Cargo.lock
- Cargo.toml

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-scripts-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- dev
paths:
- '.github/workflows/deploy-scripts.yml'
- 'packages/worker/**'
- 'worker/**'

jobs:
deploy:
Expand All @@ -22,6 +22,6 @@ jobs:
- uses: cloudflare/[email protected]
with:
command: publish
workingDirectory: 'packages/worker'
workingDirectory: 'worker'
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
16 changes: 8 additions & 8 deletions .github/workflows/publish-napi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
build:
defaults:
run:
working-directory: packages/cli/node
working-directory: node
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -53,13 +53,13 @@ jobs:
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |-
set -e &&
cd packages/cli/node &&
cd node &&
pnpm build --target x86_64-unknown-linux-gnu &&
strip *.node
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: set -e && cd packages/cli/node && pnpm build && strip *.node
build: set -e && cd node && pnpm build && strip *.node
- host: macos-latest
target: aarch64-apple-darwin
build: |
Expand All @@ -75,7 +75,7 @@ jobs:
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |-
set -e &&
cd packages/cli/node &&
cd node &&
pnpm build --target aarch64-unknown-linux-gnu &&
aarch64-unknown-linux-gnu-strip *.node
- host: ubuntu-latest
Expand All @@ -94,7 +94,7 @@ jobs:
build: |-
set -e &&
rustup target add aarch64-unknown-linux-musl &&
cd packages/cli/node &&
cd node &&
pnpm build --target aarch64-unknown-linux-musl &&
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
Expand Down Expand Up @@ -150,13 +150,13 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: napi-${{ matrix.settings.target }}
path: packages/cli/node/${{ env.APP_NAME }}.*.node
path: node/${{ env.APP_NAME }}.*.node
if-no-files-found: error

publish:
defaults:
run:
working-directory: packages/cli/node
working-directory: node
name: Publish
runs-on: ubuntu-latest
needs:
Expand All @@ -180,7 +180,7 @@ jobs:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: packages/cli/node/artifacts
path: node/artifacts

- name: Move artifacts
run: pnpm artifacts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/templates-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- 'dev'
paths:
- '.github/workflows/templates-test.yml'
- 'packages/cli/**'
- 'src/**'

env:
RUST_BACKTRACE: 1
Expand Down
10 changes: 5 additions & 5 deletions .scripts/generate-templates-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ matrixConfig
if (
changedFiles.some(
(e) =>
e.includes(`packages/cli/fragments/base`) ||
e.includes(`packages/cli/fragments/fragment-${t}`) ||
e.includes("packages/cli/src") ||
e.includes("packages/cli/Cargo.toml") ||
e.includes(".github/workflows/templates-test.yml"),
e.startsWith(`templates/base`) ||
e.startsWith(`templates/template-${t}`) ||
e.startsWith("src") ||
e.startsWith("Cargo.toml") ||
e.startsWith(".github/workflows/templates-test.yml"),
)
) {
outMatrix.push({
Expand Down
File renamed without changes.
53 changes: 53 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Tauri Contributing Guide

Please checkout [Tauri contributing guide](https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md).

## Development Guide

You need to have [Rust](https://www.rust-lang.org) and [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) installed.

### Testing your changes

```bash
cargo run
```

or

```bash
cargo run -- <cli arguments>
```

#### Adding a new template

> [!IMPORTANT]
> You should open a new issue first to discuss the addition of a certain template.
- Add a directory in `templates` and name it `template-<template-name>` where `<template-name>` is the name of the template and add all the files you need there.
- A template also must have a `_cta_manifest_` file which contains info about the template:

```ini
beforeDevCommand = {% pkg_manager_run_command %} dev
beforeBuildCommand = {% pkg_manager_run_command %} build
devPath = http://localhost:1420
distDir = ../dist

# the next sction is used to determine what files to copy from `templates/_assets_`
# if you introduce a new file like an icon that is shared between multiple templates,
# it should be added to `templates/_assets_` and add entry for it here
# for example: `tauri.svg` is shared between all templates so it lives in `templates/_assets_`
# and is always added to the next section
[files]
# the first part is the path of the file under `templates/_assets_`
# the second part is the path that the file will be copied to under the final template directory
tauri.svg = public/tauri.svg
```

- In `src/template.rs`, add an entry in the `Template` enum, and modify its methods if needed.
- In `src/package_manager.rs` add your new template to the appropriate package manager in the `templates` method.
- Modify `.scripts/generate-templates-matrix.js` and append the template name inside the template list for the appropriate package manager so the CI would run tests for it.
- Before making a commit, make sure to run `cargo fmt --all` and `pnpm format` in the repo root.

## Financial Contribution

Tauri is an MIT-licensed open source project. Its ongoing development can be supported via [Github Sponsors](https://github.com/sponsors/nothingismagick) or [Open Collective](https://opencollective.com/tauri). We prefer Github Sponsors as donations made are doubled through the matching fund program.
56 changes: 34 additions & 22 deletions Cargo.lock

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

Loading

0 comments on commit 5813af8

Please sign in to comment.