create-quicklook 0.5.0 → 0.7.0

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
@@ -2,15 +2,15 @@
2
2
 
3
3
  ![License](https://img.shields.io/npm/l/create-quicklook?style=for-the-badge)
4
4
  [![Version](https://img.shields.io/npm/v/create-quicklook?style=for-the-badge)](https://www.npmjs.org/package/create-quicklook)
5
- [![Build](https://img.shields.io/github/actions/workflow/status/idleberg/create-quicklook/ci.yml?style=for-the-badge)](https://github.com/idleberg/create-quicklook/actions)
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
6
 
7
- > Create a macOS Quick Look preview with any Vite-based web framework
7
+ > Create Quick Look previews with Vite-based web frameworks
8
8
 
9
9
  ```sh
10
10
  pnpm create quicklook my-preview
11
11
  ```
12
12
 
13
- Asks for a template (SvelteKit, Astro, SolidStart, Nuxt or Analog) and whether to add a GitHub release workflow. Skip the questions with `--template <name>` and `--release` or `--no-release`.
13
+ Asks for a template (SvelteKit, Astro, SolidStart, Nuxt or Analog), the platforms to build for (macOS, Windows or both) and whether to add a GitHub release workflow. Skip the questions with `--template <name>`, `--platform macos` and/or `--platform windows`, and `--release` or `--no-release`.
14
14
 
15
15
  The project uses [quicklook-kit](https://www.npmjs.com/package/quicklook-kit); see its readme for what to do next.
16
16
 
package/dist/index.mjs CHANGED
@@ -6,8 +6,10 @@ import { basename, relative, resolve } from "node:path";
6
6
  import process from "node:process";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { parseArgs } from "node:util";
9
- import { cancel, confirm, intro, isCancel, note, outro, select, text } from "@clack/prompts";
10
- //#region src/index.ts
9
+ import { cancel, confirm, intro, isCancel, multiselect, note, outro, select, text } from "@clack/prompts";
10
+ // src/index.ts
11
+ const macosGroup = /\tmacos: \{\n[\s\S]*?\n\t\},\n/;
12
+ const windowsGroup = " windows: { id: 'QuickLook.Plugin.Example', extensions: ['example'] },\n";
11
13
  const pkgRoot = fileURLToPath(new URL("..", import.meta.url));
12
14
  const templates = (await readdir(`${pkgRoot}/templates`)).toSorted();
13
15
  const { values, positionals } = parseArgs({
@@ -18,9 +20,19 @@ const { values, positionals } = parseArgs({
18
20
  type: "string",
19
21
  short: "t"
20
22
  },
23
+ platform: {
24
+ type: "string",
25
+ short: "p",
26
+ multiple: true
27
+ },
21
28
  release: { type: "boolean" }
22
29
  }
23
30
  });
31
+ const unknownPlatform = values.platform?.find((platform) => !["macos", "windows"].includes(platform));
32
+ if (unknownPlatform) {
33
+ cancel(`--platform: expected "macos" or "windows", got "${unknownPlatform}"`);
34
+ process.exit(1);
35
+ }
24
36
  /** Exits quietly when a prompt is cancelled with Ctrl+C or Esc. */
25
37
  function answer(value) {
26
38
  if (isCancel(value)) {
@@ -43,6 +55,19 @@ const template = values.template && templates.includes(values.template) ? values
43
55
  message: "Template",
44
56
  options: templates.map((value) => ({ value }))
45
57
  }));
58
+ const platforms = values.platform ?? answer(await multiselect({
59
+ message: "Platforms",
60
+ options: [{
61
+ value: "macos",
62
+ label: "macOS",
63
+ hint: "Quick Look"
64
+ }, {
65
+ value: "windows",
66
+ label: "Windows",
67
+ hint: "QuickLook by QL-Win"
68
+ }],
69
+ initialValues: ["macos"]
70
+ }));
46
71
  const release = values.release ?? answer(await confirm({
47
72
  message: "Add a GitHub release workflow?",
48
73
  initialValue: false
@@ -53,6 +78,13 @@ await cp(`${pkgRoot}/files/biome.template.jsonc`, `${dir}/biome.jsonc`);
53
78
  await cp(`${pkgRoot}/files/ci.yml`, `${dir}/.github/workflows/ci.yml`);
54
79
  await cp(`${pkgRoot}/files/gitignore`, `${dir}/.gitignore`);
55
80
  if (release) await cp(`${pkgRoot}/files/release.yml`, `${dir}/.github/workflows/release.yml`);
81
+ const macos = platforms.includes("macos");
82
+ const windows = platforms.includes("windows");
83
+ async function edit(file, change) {
84
+ await writeFile(file, change(await readFile(file, "utf8")));
85
+ }
86
+ await edit(`${dir}/quicklook.config.ts`, (content) => content.replace(macosGroup, (group) => macos ? group : "").replace(" framework:", (line) => windows ? `${windowsGroup}${line}` : line));
87
+ await edit(`${dir}/mise.toml`, (content) => content.replace("xcodegen = \"latest\"\n", (line) => macos ? line : "").replace("node = \"24\"\n", (line) => windows ? `${line}dotnet = "10"\n` : line));
56
88
  const pkg = JSON.parse(await readFile(`${dir}/package.json`, "utf8"));
57
89
  pkg.name = basename(dir);
58
90
  const pnpm = process.env.npm_config_user_agent?.match(/^pnpm\/(\S+)/)?.[1];
@@ -73,10 +105,9 @@ try {
73
105
  }
74
106
  note([
75
107
  `cd ${relative(process.cwd(), dir)}`,
76
- "mise install # or: pnpm install, with Xcode and XcodeGen installed",
108
+ `mise install # or: pnpm install, with ${new Intl.ListFormat("en").format([...macos ? ["Xcode", "XcodeGen"] : [], ...windows ? ["the .NET SDK"] : []])} installed`,
77
109
  "pnpm dev # drop a file on the page to preview it",
78
110
  "pnpm register # build the app and register it with Quick Look"
79
111
  ].join("\n"), "Next steps");
80
112
  outro(`Created from the ${template} template.`);
81
- //#endregion
82
113
  export {};
package/files/release.yml CHANGED
@@ -3,7 +3,7 @@ name: Release
3
3
  on:
4
4
  push:
5
5
  tags:
6
- - 'v*'
6
+ - "v*"
7
7
 
8
8
  permissions:
9
9
  contents: write
@@ -26,27 +26,32 @@ jobs:
26
26
 
27
27
  - uses: jdx/mise-action@v2
28
28
 
29
- # Release builds are universal (arm64 + x86_64) by default.
29
+ # Builds every platform in quicklook.config; release builds for macOS are
30
+ # universal (arm64 + x86_64) by default.
30
31
  - run: pnpm install --frozen-lockfile && pnpm run build
31
32
  working-directory: ${{ env.PROJECT }}
32
33
  env:
33
34
  VERSION: ${{ github.ref_name }}
34
35
 
35
- - name: Package app
36
- id: package
36
+ # <App>-<tag>-macos.zip and <App>-<tag>-windows.qlplugin, for whichever were built.
37
+ - name: Package
37
38
  run: |
38
- cd "$PROJECT/.quicklook/build"
39
- app=$(ls -d *.app)
40
- zip="${app%.app}"
41
- zip="${zip// /-}-${GITHUB_REF_NAME}.zip"
42
- zip -r -9 -y "$GITHUB_WORKSPACE/$zip" "$app"
43
- cd "$GITHUB_WORKSPACE"
44
- shasum -a 256 "$zip" > SHA256SUMS
45
- echo "zip=$zip" >> "$GITHUB_OUTPUT"
39
+ mkdir release
40
+ build="$PROJECT/.quicklook/build"
41
+ for app in "$build"/macos/*.app; do
42
+ [ -e "$app" ] || continue
43
+ name=$(basename "$app" .app)
44
+ (cd "$build/macos" && zip -r -9 -y "$GITHUB_WORKSPACE/release/${name// /-}-$GITHUB_REF_NAME-macos.zip" "$name.app")
45
+ done
46
+ for plugin in "$build"/windows/*.qlplugin; do
47
+ [ -e "$plugin" ] || continue
48
+ name=$(basename "$plugin" .qlplugin)
49
+ cp "$plugin" "release/${name// /-}-$GITHUB_REF_NAME-windows.qlplugin"
50
+ done
51
+ cd release
52
+ shasum -a 256 * > SHA256SUMS
46
53
 
47
54
  - uses: softprops/action-gh-release@v2
48
55
  with:
49
- files: |
50
- ${{ steps.package.outputs.zip }}
51
- SHA256SUMS
56
+ files: release/*
52
57
  generate_release_notes: true
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-quicklook",
3
- "version": "0.5.0",
4
- "description": "Create a macOS Quick Look preview with any Vite-based web framework",
3
+ "version": "0.7.0",
4
+ "description": "Create Quick Look previews with Vite-based web frameworks",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "quicklook",
@@ -12,18 +12,18 @@
12
12
  "format": "biome check --write"
13
13
  },
14
14
  "devDependencies": {
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.5.0",
15
+ "@analogjs/vite-plugin-angular": "2.9.1",
16
+ "@angular/build": "22.2.3",
17
+ "@angular/common": "22.2.3",
18
+ "@angular/compiler": "22.2.3",
19
+ "@angular/compiler-cli": "22.2.3",
20
+ "@angular/core": "22.2.3",
21
+ "@angular/platform-browser": "22.2.3",
22
+ "@biomejs/biome": "2.6.2",
23
+ "quicklook-kit": "^0.7.0",
24
24
  "rxjs": "7.8.2",
25
25
  "tslib": "2.8.1",
26
26
  "typescript": "6.0.3",
27
- "vite": "8.3.4"
27
+ "vite": "8.3.5"
28
28
  }
29
29
  }
@@ -2,14 +2,16 @@ import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
4
  name: 'Quick Look Example',
5
- bundleId: 'com.example.QuickLookExample',
6
- types: [
7
- {
8
- id: 'com.example.QuickLookExample.example',
9
- description: 'Example File',
10
- extensions: ['example'],
11
- conformsTo: ['public.plain-text'],
12
- },
13
- ],
5
+ macos: {
6
+ bundleId: 'com.example.QuickLookExample',
7
+ types: [
8
+ {
9
+ id: 'com.example.QuickLookExample.example',
10
+ description: 'Example File',
11
+ extensions: ['example'],
12
+ conformsTo: ['public.plain-text'],
13
+ },
14
+ ],
15
+ },
14
16
  framework: 'analog',
15
17
  });
@@ -12,10 +12,10 @@
12
12
  "format": "biome check --write"
13
13
  },
14
14
  "devDependencies": {
15
- "@astrojs/check": "0.9.10",
16
- "@biomejs/biome": "2.5.15",
17
- "astro": "7.3.8",
18
- "quicklook-kit": "^0.5.0",
15
+ "@astrojs/check": "0.9.12",
16
+ "@biomejs/biome": "2.6.2",
17
+ "astro": "7.4.2",
18
+ "quicklook-kit": "^0.7.0",
19
19
  "typescript": "6.0.3"
20
20
  }
21
21
  }
@@ -2,14 +2,16 @@ import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
4
  name: 'Quick Look Example',
5
- bundleId: 'com.example.QuickLookExample',
6
- types: [
7
- {
8
- id: 'com.example.QuickLookExample.example',
9
- description: 'Example File',
10
- extensions: ['example'],
11
- conformsTo: ['public.plain-text'],
12
- },
13
- ],
5
+ macos: {
6
+ bundleId: 'com.example.QuickLookExample',
7
+ types: [
8
+ {
9
+ id: 'com.example.QuickLookExample.example',
10
+ description: 'Example File',
11
+ extensions: ['example'],
12
+ conformsTo: ['public.plain-text'],
13
+ },
14
+ ],
15
+ },
14
16
  framework: 'astro',
15
17
  });
@@ -13,11 +13,11 @@
13
13
  "format": "biome check --write"
14
14
  },
15
15
  "devDependencies": {
16
- "@biomejs/biome": "2.5.15",
17
- "nuxt": "4.6.1",
18
- "quicklook-kit": "^0.5.0",
16
+ "@biomejs/biome": "2.6.2",
17
+ "nuxt": "4.6.2",
18
+ "quicklook-kit": "^0.7.0",
19
19
  "typescript": "6.0.3",
20
- "vue": "3.5.43",
20
+ "vue": "3.5.44",
21
21
  "vue-tsc": "3.3.13"
22
22
  }
23
23
  }
@@ -2,14 +2,16 @@ import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
4
  name: 'Quick Look Example',
5
- bundleId: 'com.example.QuickLookExample',
6
- types: [
7
- {
8
- id: 'com.example.QuickLookExample.example',
9
- description: 'Example File',
10
- extensions: ['example'],
11
- conformsTo: ['public.plain-text'],
12
- },
13
- ],
5
+ macos: {
6
+ bundleId: 'com.example.QuickLookExample',
7
+ types: [
8
+ {
9
+ id: 'com.example.QuickLookExample.example',
10
+ description: 'Example File',
11
+ extensions: ['example'],
12
+ conformsTo: ['public.plain-text'],
13
+ },
14
+ ],
15
+ },
14
16
  framework: 'nuxt',
15
17
  });
@@ -12,13 +12,13 @@
12
12
  "format": "biome check --write"
13
13
  },
14
14
  "devDependencies": {
15
- "@biomejs/biome": "2.5.15",
15
+ "@biomejs/biome": "2.6.2",
16
16
  "@solidjs/router": "1.0.0",
17
17
  "@solidjs/start": "2.0.6",
18
18
  "nitro": "3.0.260903-beta",
19
- "quicklook-kit": "^0.5.0",
19
+ "quicklook-kit": "^0.7.0",
20
20
  "solid-js": "1.9.17",
21
21
  "typescript": "6.0.3",
22
- "vite": "8.3.4"
22
+ "vite": "8.3.5"
23
23
  }
24
24
  }
@@ -2,14 +2,16 @@ import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
4
  name: 'Quick Look Example',
5
- bundleId: 'com.example.QuickLookExample',
6
- types: [
7
- {
8
- id: 'com.example.QuickLookExample.example',
9
- description: 'Example File',
10
- extensions: ['example'],
11
- conformsTo: ['public.plain-text'],
12
- },
13
- ],
5
+ macos: {
6
+ bundleId: 'com.example.QuickLookExample',
7
+ types: [
8
+ {
9
+ id: 'com.example.QuickLookExample.example',
10
+ description: 'Example File',
11
+ extensions: ['example'],
12
+ conformsTo: ['public.plain-text'],
13
+ },
14
+ ],
15
+ },
14
16
  framework: 'solid-start',
15
17
  });
@@ -12,14 +12,14 @@
12
12
  "format": "biome check --write"
13
13
  },
14
14
  "devDependencies": {
15
- "@biomejs/biome": "2.5.15",
15
+ "@biomejs/biome": "2.6.2",
16
16
  "@sveltejs/adapter-static": "4.0.0",
17
- "@sveltejs/kit": "3.0.1",
17
+ "@sveltejs/kit": "3.1.0",
18
18
  "@sveltejs/vite-plugin-svelte": "7.3.1",
19
- "quicklook-kit": "^0.5.0",
19
+ "quicklook-kit": "^0.7.0",
20
20
  "svelte": "5.57.2",
21
- "svelte-check": "4.7.6",
21
+ "svelte-check": "4.7.7",
22
22
  "typescript": "6.0.3",
23
- "vite": "8.3.4"
23
+ "vite": "8.3.5"
24
24
  }
25
25
  }
@@ -2,14 +2,16 @@ import { defineConfig } from 'quicklook-kit';
2
2
 
3
3
  export default defineConfig({
4
4
  name: 'Quick Look Example',
5
- bundleId: 'com.example.QuickLookExample',
6
- types: [
7
- {
8
- id: 'com.example.QuickLookExample.example',
9
- description: 'Example File',
10
- extensions: ['example'],
11
- conformsTo: ['public.plain-text'],
12
- },
13
- ],
5
+ macos: {
6
+ bundleId: 'com.example.QuickLookExample',
7
+ types: [
8
+ {
9
+ id: 'com.example.QuickLookExample.example',
10
+ description: 'Example File',
11
+ extensions: ['example'],
12
+ conformsTo: ['public.plain-text'],
13
+ },
14
+ ],
15
+ },
14
16
  framework: 'sveltekit',
15
17
  });