create-quicklook 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.markdown CHANGED
@@ -1,5 +1,9 @@
1
1
  # create-quicklook
2
2
 
3
+ ![License](https://img.shields.io/npm/l/quicklook-kit?style=for-the-badge)
4
+ [![Version](https://img.shields.io/npm/v/quicklook-kit?style=for-the-badge)](https://www.npmjs.org/package/quicklook-kit)
5
+ [![Build](https://img.shields.io/github/actions/workflow/status/idleberg/quicklook-kit/ci.yml?style=for-the-badge)](https://github.com/idleberg/quicklook-kit/actions)
6
+
3
7
  > Create a macOS QuickLook preview with any Vite-based web framework
4
8
 
5
9
  ```sh
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { execFileSync } from "node:child_process";
2
3
  import { existsSync } from "node:fs";
3
4
  import { cp, readFile, readdir, writeFile } from "node:fs/promises";
4
5
  import { basename, relative, resolve } from "node:path";
@@ -47,7 +48,9 @@ const release = values.release ?? answer(await confirm({
47
48
  initialValue: false
48
49
  }));
49
50
  await cp(`${pkgRoot}/templates/${template}`, dir, { recursive: true });
50
- await cp(`${pkgRoot}/files/mise.toml`, `${dir}/mise.toml`);
51
+ for (const file of ["mise.toml", "hk.pkl"]) await cp(`${pkgRoot}/files/${file}`, `${dir}/${file}`);
52
+ await cp(`${pkgRoot}/files/biome.template.jsonc`, `${dir}/biome.jsonc`);
53
+ await cp(`${pkgRoot}/files/ci.yml`, `${dir}/.github/workflows/ci.yml`);
51
54
  await cp(`${pkgRoot}/files/gitignore`, `${dir}/.gitignore`);
52
55
  if (release) await cp(`${pkgRoot}/files/release.yml`, `${dir}/.github/workflows/release.yml`);
53
56
  const pkg = JSON.parse(await readFile(`${dir}/package.json`, "utf8"));
@@ -55,6 +58,19 @@ pkg.name = basename(dir);
55
58
  const pnpm = process.env.npm_config_user_agent?.match(/^pnpm\/(\S+)/)?.[1];
56
59
  if (pnpm) pkg.packageManager = `pnpm@${pnpm}`;
57
60
  await writeFile(`${dir}/package.json`, `${JSON.stringify(pkg, null, " ")}\n`);
61
+ function git(...args) {
62
+ execFileSync("git", args, {
63
+ cwd: dir,
64
+ stdio: "ignore"
65
+ });
66
+ }
67
+ try {
68
+ git("rev-parse", "--is-inside-work-tree");
69
+ } catch {
70
+ try {
71
+ git("init", "--quiet");
72
+ } catch {}
73
+ }
58
74
  note([
59
75
  `cd ${relative(process.cwd(), dir)}`,
60
76
  "mise install # or: pnpm install, with Xcode and XcodeGen installed",
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "formatter": {
9
+ "indentStyle": "tab",
10
+ "lineWidth": 100
11
+ },
12
+ "javascript": {
13
+ "formatter": {
14
+ "quoteStyle": "single",
15
+ "trailingCommas": "all"
16
+ }
17
+ },
18
+ "html": {
19
+ "experimentalFullSupportEnabled": true
20
+ },
21
+ "assist": {
22
+ "actions": {
23
+ "source": {
24
+ "organizeImports": "on"
25
+ }
26
+ }
27
+ }
28
+ }
package/files/ci.yml ADDED
@@ -0,0 +1,27 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ jobs:
10
+ check:
11
+ # Same runner as the release workflow, XcodeGen from mise.toml needs macOS.
12
+ runs-on: macos-15
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ # pnpm's default store on macOS.
17
+ - uses: actions/cache@v6
18
+ with:
19
+ path: ~/Library/pnpm/store
20
+ key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
21
+ restore-keys: pnpm-
22
+
23
+ - uses: jdx/mise-action@v2
24
+
25
+ - run: pnpm run lint
26
+
27
+ - run: pnpm run check
package/files/hk.pkl ADDED
@@ -0,0 +1,27 @@
1
+ amends "package://github.com/jdx/hk/releases/download/v2.5.0/hk@2.5.0#/Config.pkl"
2
+ import "package://github.com/jdx/hk/releases/download/v2.5.0/hk@2.5.0#/Builtins.pkl"
3
+
4
+ local linters = new Mapping<String, Step> {
5
+ // pnpm exec runs the project's own Biome, whatever else is on PATH.
6
+ ["biome"] = (Builtins.biome) {
7
+ // The builtin only matches JS, TS and JSON.
8
+ glob = List("**/*.{js,jsx,ts,tsx,json,jsonc,css,html,svelte,astro,vue}")
9
+ check = "pnpm exec biome check --no-errors-on-unmatched --files-ignore-unknown=true {{ files }}"
10
+ fix = "pnpm exec biome check --write --no-errors-on-unmatched --files-ignore-unknown=true {{ files }}"
11
+ }
12
+ }
13
+
14
+ hooks {
15
+ ["pre-commit"] {
16
+ fix = true
17
+ stash = "git"
18
+ steps = linters
19
+ }
20
+ ["fix"] {
21
+ fix = true
22
+ steps = linters
23
+ }
24
+ ["check"] {
25
+ steps = linters
26
+ }
27
+ }
package/files/mise.toml CHANGED
@@ -1,13 +1,21 @@
1
1
  [tools]
2
2
  node = "24"
3
3
  xcodegen = "latest"
4
+ hk = "latest"
5
+ pkl = "latest"
4
6
 
5
7
  [settings]
6
8
  # Node ships pnpm through corepack, pinned by packageManager in package.json
7
9
  node.corepack = true
8
10
 
9
11
  [env]
12
+ HK_MISE = 1
10
13
  COREPACK_ENABLE_DOWNLOAD_PROMPT = 0
14
+ _.path = ["{{config_root}}/node_modules/.bin"]
11
15
 
16
+ # The pre-commit hook needs a git repository; run `hk install --mise` after `git init`.
12
17
  [hooks]
13
- postinstall = "pnpm install"
18
+ postinstall = """
19
+ pnpm install
20
+ if git rev-parse --git-dir >/dev/null 2>&1; then hk install --mise; fi
21
+ """
package/files/release.yml CHANGED
@@ -18,6 +18,12 @@ jobs:
18
18
  steps:
19
19
  - uses: actions/checkout@v4
20
20
 
21
+ - uses: actions/cache@v6
22
+ with:
23
+ path: ~/Library/pnpm/store
24
+ key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
25
+ restore-keys: pnpm-
26
+
21
27
  - uses: jdx/mise-action@v2
22
28
 
23
29
  # Release builds are universal (arm64 + x86_64) by default.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-quicklook",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Create a macOS QuickLook preview with any Vite-based web framework",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "24.19.2",
38
- "tsdown": "0.23.0",
38
+ "tsdown": "0.23.1",
39
39
  "typescript": "6.0.3"
40
40
  },
41
41
  "dependencies": {
@@ -7,20 +7,23 @@
7
7
  "build": "quicklook build",
8
8
  "register": "quicklook build && quicklook register",
9
9
  "unregister": "quicklook unregister",
10
- "check": "ngc -p tsconfig.json --noEmit"
10
+ "check": "ngc -p tsconfig.json --noEmit",
11
+ "lint": "biome check",
12
+ "format": "biome check --write"
11
13
  },
12
14
  "devDependencies": {
13
- "@analogjs/vite-plugin-angular": "2.7.5",
14
- "@angular/build": "22.2.0",
15
- "@angular/common": "22.2.0",
16
- "@angular/compiler": "22.2.0",
17
- "@angular/compiler-cli": "22.2.0",
18
- "@angular/core": "22.2.0",
19
- "@angular/platform-browser": "22.2.0",
20
- "quicklook-kit": "^0.3.0",
15
+ "@analogjs/vite-plugin-angular": "2.8.0",
16
+ "@angular/build": "22.2.2",
17
+ "@angular/common": "22.2.2",
18
+ "@angular/compiler": "22.2.2",
19
+ "@angular/compiler-cli": "22.2.2",
20
+ "@angular/core": "22.2.2",
21
+ "@angular/platform-browser": "22.2.2",
22
+ "@biomejs/biome": "2.5.15",
23
+ "quicklook-kit": "^0.4.0",
21
24
  "rxjs": "7.8.2",
22
25
  "tslib": "2.8.1",
23
26
  "typescript": "6.0.3",
24
- "vite": "8.3.0"
27
+ "vite": "8.3.4"
25
28
  }
26
29
  }
@@ -1,11 +1,11 @@
1
1
  import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
- name: 'Example Preview',
5
- bundleId: 'com.example.ExamplePreview',
4
+ name: 'QuickLook Example',
5
+ bundleId: 'com.example.QuickLookExample',
6
6
  types: [
7
7
  {
8
- id: 'com.example.ExamplePreview.example',
8
+ id: 'com.example.QuickLookExample.example',
9
9
  description: 'Example File',
10
10
  extensions: ['example'],
11
11
  conformsTo: ['public.plain-text'],
@@ -7,12 +7,15 @@
7
7
  "build": "quicklook build",
8
8
  "register": "quicklook build && quicklook register",
9
9
  "unregister": "quicklook unregister",
10
- "check": "astro check"
10
+ "check": "astro check",
11
+ "lint": "biome check",
12
+ "format": "biome check --write"
11
13
  },
12
14
  "devDependencies": {
13
15
  "@astrojs/check": "0.9.10",
14
- "astro": "7.3.5",
15
- "quicklook-kit": "^0.3.0",
16
+ "@biomejs/biome": "2.5.15",
17
+ "astro": "7.3.8",
18
+ "quicklook-kit": "^0.4.0",
16
19
  "typescript": "6.0.3"
17
20
  }
18
21
  }
@@ -1,11 +1,11 @@
1
1
  import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
- name: 'Example Preview',
5
- bundleId: 'com.example.ExamplePreview',
4
+ name: 'QuickLook Example',
5
+ bundleId: 'com.example.QuickLookExample',
6
6
  types: [
7
7
  {
8
- id: 'com.example.ExamplePreview.example',
8
+ id: 'com.example.QuickLookExample.example',
9
9
  description: 'Example File',
10
10
  extensions: ['example'],
11
11
  conformsTo: ['public.plain-text'],
@@ -8,13 +8,16 @@
8
8
  "build": "quicklook build",
9
9
  "register": "quicklook build && quicklook register",
10
10
  "unregister": "quicklook unregister",
11
- "check": "nuxt typecheck"
11
+ "check": "nuxt typecheck",
12
+ "lint": "biome check",
13
+ "format": "biome check --write"
12
14
  },
13
15
  "devDependencies": {
14
- "nuxt": "4.5.2",
15
- "quicklook-kit": "^0.3.0",
16
+ "@biomejs/biome": "2.5.15",
17
+ "nuxt": "4.6.1",
18
+ "quicklook-kit": "^0.4.0",
16
19
  "typescript": "6.0.3",
17
20
  "vue": "3.5.43",
18
- "vue-tsc": "3.3.11"
21
+ "vue-tsc": "3.3.13"
19
22
  }
20
23
  }
@@ -1,11 +1,11 @@
1
1
  import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
- name: 'Example Preview',
5
- bundleId: 'com.example.ExamplePreview',
4
+ name: 'QuickLook Example',
5
+ bundleId: 'com.example.QuickLookExample',
6
6
  types: [
7
7
  {
8
- id: 'com.example.ExamplePreview.example',
8
+ id: 'com.example.QuickLookExample.example',
9
9
  description: 'Example File',
10
10
  extensions: ['example'],
11
11
  conformsTo: ['public.plain-text'],
@@ -7,15 +7,18 @@
7
7
  "build": "quicklook build",
8
8
  "register": "quicklook build && quicklook register",
9
9
  "unregister": "quicklook unregister",
10
- "check": "tsc --noEmit"
10
+ "check": "tsc --noEmit",
11
+ "lint": "biome check",
12
+ "format": "biome check --write"
11
13
  },
12
14
  "devDependencies": {
15
+ "@biomejs/biome": "2.5.15",
13
16
  "@solidjs/router": "1.0.0",
14
17
  "@solidjs/start": "2.0.6",
15
18
  "nitro": "3.0.260903-beta",
16
- "quicklook-kit": "^0.3.0",
19
+ "quicklook-kit": "^0.4.0",
17
20
  "solid-js": "1.9.17",
18
21
  "typescript": "6.0.3",
19
- "vite": "8.3.0"
22
+ "vite": "8.3.4"
20
23
  }
21
24
  }
@@ -1,11 +1,11 @@
1
1
  import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
- name: 'Example Preview',
5
- bundleId: 'com.example.ExamplePreview',
4
+ name: 'QuickLook Example',
5
+ bundleId: 'com.example.QuickLookExample',
6
6
  types: [
7
7
  {
8
- id: 'com.example.ExamplePreview.example',
8
+ id: 'com.example.QuickLookExample.example',
9
9
  description: 'Example File',
10
10
  extensions: ['example'],
11
11
  conformsTo: ['public.plain-text'],
@@ -13,7 +13,6 @@ export default createHandler(() => (
13
13
  {assets}
14
14
  </head>
15
15
  <body>
16
- {/* biome-ignore lint/correctness/useUniqueElementIds: the document renders once; entry-client.tsx mounts into #app. */}
17
16
  <div id="app">{children}</div>
18
17
  {scripts}
19
18
  </body>
@@ -7,16 +7,19 @@
7
7
  "build": "quicklook build",
8
8
  "register": "quicklook build && quicklook register",
9
9
  "unregister": "quicklook unregister",
10
- "check": "svelte-kit sync && svelte-check"
10
+ "check": "svelte-kit sync && svelte-check",
11
+ "lint": "biome check",
12
+ "format": "biome check --write"
11
13
  },
12
14
  "devDependencies": {
13
- "@sveltejs/adapter-static": "3.0.10",
14
- "@sveltejs/kit": "2.70.3",
15
+ "@biomejs/biome": "2.5.15",
16
+ "@sveltejs/adapter-static": "4.0.0",
17
+ "@sveltejs/kit": "3.0.1",
15
18
  "@sveltejs/vite-plugin-svelte": "7.3.1",
16
- "quicklook-kit": "^0.3.0",
17
- "svelte": "5.57.1",
19
+ "quicklook-kit": "^0.4.0",
20
+ "svelte": "5.57.2",
18
21
  "svelte-check": "4.7.6",
19
22
  "typescript": "6.0.3",
20
- "vite": "8.3.0"
23
+ "vite": "8.3.4"
21
24
  }
22
25
  }
@@ -1,11 +1,11 @@
1
1
  import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
- name: 'Example Preview',
5
- bundleId: 'com.example.ExamplePreview',
4
+ name: 'QuickLook Example',
5
+ bundleId: 'com.example.QuickLookExample',
6
6
  types: [
7
7
  {
8
- id: 'com.example.ExamplePreview.example',
8
+ id: 'com.example.QuickLookExample.example',
9
9
  description: 'Example File',
10
10
  extensions: ['example'],
11
11
  conformsTo: ['public.plain-text'],
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { browserFile, nativeFile, type QuickLookFile } from 'virtual:quicklook';
3
- import FileViewer from '$lib/FileViewer.svelte';
3
+ import FileViewer from '../lib/FileViewer.svelte';
4
4
 
5
5
  let file = $state<QuickLookFile | undefined>(nativeFile());
6
6
 
@@ -1,5 +1,6 @@
1
1
  {
2
- "extends": "./.svelte-kit/tsconfig.json",
2
+ "extends": "$app/tsconfig",
3
+ "include": ["src", "*"],
3
4
  "compilerOptions": {
4
5
  "strict": true,
5
6
  "allowImportingTsExtensions": true,
@@ -1,7 +1,17 @@
1
+ import adapter from '@sveltejs/adapter-static';
1
2
  import { sveltekit } from '@sveltejs/kit/vite';
2
3
  import { quicklook } from 'quicklook-kit/vite';
3
4
  import { defineConfig } from 'vite';
4
5
 
5
6
  export default defineConfig({
6
- plugins: [sveltekit(), quicklook()],
7
+ plugins: [
8
+ sveltekit({
9
+ // A static build; the extension serves it and sets the CSP from quicklook.config.ts.
10
+ adapter: adapter(),
11
+
12
+ // Builds a client-only app shell, which is all the preview needs.
13
+ router: { type: 'hash' },
14
+ }),
15
+ quicklook(),
16
+ ],
7
17
  });
@@ -1,11 +0,0 @@
1
- import adapter from '@sveltejs/adapter-static';
2
-
3
- /** @type {import('@sveltejs/kit').Config} */
4
- export default {
5
- kit: {
6
- // A static build; the extension serves it and sets the CSP from quicklook.config.ts.
7
- adapter: adapter(),
8
- // Builds a client-only app shell, which is all the preview needs.
9
- router: { type: 'hash' },
10
- },
11
- };