Skip to content

Commit

Permalink
The big refactor. Quantum now is a CLI 🔥 (#22)
Browse files Browse the repository at this point in the history
* big refactor, becoming a CLI

* add some actions, thanks to @JoshuaKGoldberg

* move tauri cli to dependencies

* more adjustments to file generation

* typo on tauri.conf.json

* remove debugger logs

* bump version

* oops... hashbang

* add quantum logo

* small readme update
  • Loading branch information
atilafassina committed Oct 2, 2024
1 parent cb2eacc commit 63760ab
Show file tree
Hide file tree
Showing 71 changed files with 3,740 additions and 3,661 deletions.
16 changes: 16 additions & 0 deletions .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: Prepares the repo for a typical CI job

name: prepare

runs:
steps:
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: "20"
- run: pnpm install
shell: bash
using: composite
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm run test --run
type_check:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm tsc

name: CI

on:
pull_request: ~
push:
branches:
- main
158 changes: 18 additions & 140 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,150 +1,28 @@
name: Publish Release

on:
push:
branches:
# replace with your release branch, usually `main`.
- example
workflow_dispatch:
inputs:
app-slug:
description: "The slug of your app in your CrabNebula Cloud org"
required: true
default: "quantum"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
APP_CARGO_TOML: src-tauri/Cargo.toml
CN_APP_SLUG: ${{ github.event.inputs.app-slug || 'quantum' }}
group: ${{ github.workflow }}

jobs:
draft:
release:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.read_version.outputs.value }}
needs_release: ${{ steps.create_tag.outputs.tag_existed != 'true' }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Read version number
uses: SebRollen/toml-action@v1.0.2
id: read_version
with:
file: ${{ env.APP_CARGO_TOML }}
field: "package.version"

- name: Create tag
id: create_tag
uses: actions/github-script@v7
with:
script: |
const tag = "${{ steps.read_version.outputs.value }}";
const tagRef = `tags/${tag}`;
const TAG_EXISTED = "tag_existed";
async function main() {
let tagExisted = true;
try {
await github.rest.git.getRef({
ref: tagRef,
owner: context.repo.owner,
repo: context.repo.repo,
});
tagExisted = true;
core.notice(`Release skipped as tag '${tag}' already exists. Update the version in '${{ env.APP_CARGO_TOML }}' to perform a release.`);
} catch (error) {
if ("status" in error && error.status === 404) tagExisted = false;
else throw error;
}
core.setOutput(TAG_EXISTED, tagExisted);
if (!tagExisted)
await github.rest.git.createRef({
ref: `refs/${tagRef}`,
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
});
}
main();
- name: Create draft release
if: ${{ steps.create_tag.outputs.tag_existed != 'true' }}
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release draft ${{ vars.CN_APP_ID }} "${{ steps.read_version.outputs.value }}" --framework tauri
api-key: ${{ secrets.CN_API_KEY }}

build:
needs: draft
runs-on: ${{ matrix.os }}
if: ${{ needs.draft.outputs.needs_release == 'true' }}
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: false
fetch-depth: 0
ref: main
- uses: ./.github/actions/prepare
- run: pnpm build
- env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
uses: JoshuaKGoldberg/release-it-action@v0.2.2

- name: install Linux dependencies
if: matrix.host == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev webkit2gtk-4.1
name: 📡 Publish to NPM

- name: build tauri app
run: |
pnpm install
pnpm run tauri build --ci --target ${{ matrix.settings.target }}
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}

- name: upload assets
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release upload ${{ env.CN_APP_SLUG }} "${{ steps.read_version.outputs.value }}" --framework tauri
api-key: ${{ secrets.CN_API_KEY }}

publish:
needs: [draft, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
on:
push:
branches:
- main

- name: publish release
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release publish ${{ env.CN_APP_SLUG }} "${{ needs.draft.outputs.tag_name }}" --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
permissions:
contents: write
id-token: write
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
node_modules
.vinxi
.output
tmp/
bin/
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.15.1
19 changes: 19 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://unpkg.com/release-it@17/schema/release-it.json",
"git": {
"commitMessage": "chore: release v${version}",
"requireCommits": true
},
"github": {
"autoGenerate": true,
"release": true,
"releaseName": "v${version}"
},
"npm": { "publishArgs": ["--access public", "--provenance"] },
"plugins": {
"@release-it/conventional-changelog": {
"infile": "CHANGELOG.md",
"preset": "angular"
}
}
}
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,27 @@
<img src="/docs/quantum-dark-mode.svg#gh-dark-mode-only" width="250" />
<img src="/docs/quantum-dark-mode.svg#gh-light-mode-only" width="250" />
<h1>Quantum</h1>
<p>This template should help get you started developing with Tauri + SolidStart + TypeScript.</p>
<p>A big leap developing with Tauri + SolidStart + TypeScript.</p>
</div>

> [!note]
> Tauri v2 is already considered stable, it is currently at the **Release Candidate** stage. This means only minor fixes are expected towards the stable release.
## Cloning it 🐑

You can use the Template button on the GitHub UI and shallow clone this repository. Or, do it with degit:
## Let's get going! 🐑

```sh
npx degit atilafassina/quantum
pnpm create quantum
```

Alternatively, good old `git clone` can also work. It's recommended to make a shallow clone so it doesn't bring entire repository history:
```sh
npm create quantum
```

```sh
git clone --depth 1 https://github.com/atilafassina/quantum
yarn create quantum
```

## Running 🚤

Once scaffolding is done, you can `cd` into your project, install dependencies and start rocking! 🤘

The snippets below use [PNPM](https://pnpm.io) as the package manager and task runner, but Yarn, NPM, Bun, or Cargo should also work with the appropriate syntax.

> 🛟 Check the [Tauri Docs](https://v2.tauri.app/) for more guidance on building your app.
Expand Down Expand Up @@ -127,4 +126,8 @@ Stripping symbols from generated code is generally recommended for release build

---

<img width="50" src="/public/tauri.svg" />
<div align="center">

[Atila.io](https://atila.io)

</div>
Empty file added fixtures/empty.txt
Empty file.
Empty file added fixtures/test-gen/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions fixtures/text.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello world
63 changes: 39 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,50 @@
{
"name": "quantum",
"private": true,
"name": "create-quantum",
"version": "0.0.8",
"type": "module",
"description": "",
"main": "./lib/index.js",
"license": "MIT",
"repository": {
"type": "git",
"url": "htttps://github.com/atilafassina/quantum"
},
"bin": {
"create-quantum": "./bin/run.js"
},
"files": [
"bin/",
"package.json",
"README.md"
],
"scripts": {
"start": "vinxi start",
"dev": "vinxi dev",
"build": "vinxi build",
"serve": "vinxi serve",
"tauri": "tauri",
"format": "prettier --write src"
"release-it": "release-it",
"build": "tsup",
"test": "vitest",
"dry": "pnpm build && node ./bin/run.js --debug"
},
"author": {
"name": "@AtilaFassina",
"url": "https://atila.io"
},
"license": "MIT",
"dependencies": {
"@solidjs/router": "^0.13.6",
"@solidjs/start": "^1.0.6",
"@tauri-apps/api": "2.0.0-rc.0",
"@tauri-apps/plugin-shell": "2.0.0-rc.0",
"solid-js": "^1.8.19",
"tailwindcss": "^3.4.7",
"vinxi": "^0.4.0"
"@clack/prompts": "^0.7.0",
"@tauri-apps/cli": "2.0.0-rc.17",
"gradient-string": "^3.0.0"
},
"devDependencies": {
"@tauri-apps/cli": "2.0.0-rc.0",
"autoprefixer": "^10.4.20",
"internal-ip": "^7.0.0",
"postcss": "^8.4.41",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.5.14",
"@release-it/conventional-changelog": "^8.0.2",
"@types/node": "^22.7.4",
"release-it": "^17.6.0",
"release-it-pnpm": "^4.6.3",
"tsup": "^8.2.4",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite-plugin-solid": "^2.10.2"
"vitest": "^2.1.1"
},
"engines": {
"node": ">=20"
},
"publishConfig": {
"provenance": "true"
}
}
Loading

0 comments on commit 63760ab

Please sign in to comment.