@usequeek/create-theme 0.3.7 → 0.4.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.md +4 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/naming.d.ts +12 -4
- package/dist/naming.js +8 -5
- package/dist/prompts.js +1 -1
- package/dist/setup.js +14 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ and with no folder the folder is named after the theme (my-theme with --yes or n
|
|
|
16
16
|
|
|
17
17
|
--name <text> theme name (default: the folder name)
|
|
18
18
|
--templates <keys> businesses to make templates for, comma-separated (required with --yes)
|
|
19
|
-
--primary <key> the
|
|
19
|
+
--primary <key> the main template (default: the first)
|
|
20
20
|
--categories <keys> business categories (default: the templates')
|
|
21
21
|
--tags <tags> 1–6 tags for the look (required with --yes)
|
|
22
22
|
--pages <list|none> extra pages: contact, faq (default: both)
|
|
@@ -32,7 +32,9 @@ The starter is pinned to the tag matching this package's version. Everything is
|
|
|
32
32
|
|
|
33
33
|
## What you get
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
A theme is the look, a template is a business it is dressed as, and a design is one demo store of a template. Each business you pick becomes a template with one design. The main template's (`--primary`) is `theme/demo.json`; each other template's is `theme/demos/<key>.json`. `theme/theme.config.ts` declares every design with its `template` key, the business picked, so a template is never inferred from a design id. To give a template a second design later, add its demo file and declare `{ id, template, design_label, description }`; a template with two or more designs names each one by its own `design_label`.
|
|
36
|
+
|
|
37
|
+
Right after `create`, `npm run check` rejects exactly your to-do list. For a one-template theme that is four rules: `theme/placeholder-content` (the starter's placeholder products and photos, and the theme's placeholder description), `theme/structure` and `theme/template-screenshot` (each design's screenshot), and `theme/template-description` (each design's description). With two or more templates, `theme/template-versions` is added: each design must have its own home page.
|
|
36
38
|
|
|
37
39
|
The target folder must be missing, empty, or hold only `.git`. The `--force` flag allows writing into another folder but refuses file-or-folder clashes and symlinks at paths the starter writes. A regular file at the target path is always refused.
|
|
38
40
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { renameTheme, SKELETON, type Identity } from './rename.js';
|
|
|
8
8
|
/** The starter this release was tested with: its tag matches this package's version (`yarn starter:publish --tag`). */
|
|
9
9
|
export declare const STARTER: string;
|
|
10
10
|
export declare function detectPackageManager(userAgent?: string): PackageManager;
|
|
11
|
-
export declare const HELP = "Create a Queek storefront theme.\n\n npm create @usequeek/theme@latest my-theme -- --templates laundry --tags minimal\n pnpm create @usequeek/theme my-theme --templates laundry --tags minimal\n\nnpm needs -- before these flags. In a terminal, anything you leave out is asked,\nand with no folder the folder is named after the theme (my-theme with --yes or no terminal).\n\n --name <text> theme name (default: the folder name)\n --templates <keys> businesses to make templates for, comma-separated (required with --yes)\n --primary <key> the
|
|
11
|
+
export declare const HELP = "Create a Queek storefront theme.\n\n npm create @usequeek/theme@latest my-theme -- --templates laundry --tags minimal\n pnpm create @usequeek/theme my-theme --templates laundry --tags minimal\n\nnpm needs -- before these flags. In a terminal, anything you leave out is asked,\nand with no folder the folder is named after the theme (my-theme with --yes or no terminal).\n\n --name <text> theme name (default: the folder name)\n --templates <keys> businesses to make templates for, comma-separated (required with --yes)\n --primary <key> the main template (default: the first)\n --categories <keys> business categories (default: the templates')\n --tags <tags> 1\u20136 tags for the look (required with --yes)\n --pages <list|none> extra pages: contact, faq (default: both)\n --ai <list>, --no-ai AI assistants: claude, gemini (default: both; AGENTS.md unless --no-ai)\n --pm <npm|pnpm|yarn|bun>, --no-install, --no-git\n --yes, -y never prompt; take the default for everything else\n --dry-run print what would be written; write nothing\n --force allow a folder that is not empty\n --template <source> another starter: a giget source or a local folder";
|
|
12
12
|
export declare function createTheme(dir: string, answers: Answers, options: {
|
|
13
13
|
install: boolean;
|
|
14
14
|
git: boolean;
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ and with no folder the folder is named after the theme (my-theme with --yes or n
|
|
|
27
27
|
|
|
28
28
|
--name <text> theme name (default: the folder name)
|
|
29
29
|
--templates <keys> businesses to make templates for, comma-separated (required with --yes)
|
|
30
|
-
--primary <key> the
|
|
30
|
+
--primary <key> the main template (default: the first)
|
|
31
31
|
--categories <keys> business categories (default: the templates')
|
|
32
32
|
--tags <tags> 1–6 tags for the look (required with --yes)
|
|
33
33
|
--pages <list|none> extra pages: contact, faq (default: both)
|
package/dist/naming.d.ts
CHANGED
|
@@ -5,17 +5,25 @@ export declare function slugProblem(slug: string): string | null;
|
|
|
5
5
|
/** The CSS class prefix: the slug's initials, 2–4 characters, never a Queek theme's own. */
|
|
6
6
|
export declare function prefixFor(slug: string): string;
|
|
7
7
|
export interface TemplatePlan {
|
|
8
|
+
/** The design id: `default` (demo.json) for the main template, else the key (demos/<key>.json). */
|
|
8
9
|
id: string;
|
|
10
|
+
/** The business picked. */
|
|
9
11
|
key: string;
|
|
12
|
+
/** The template key theme.config.ts declares on the design (contract R2.8): the business picked. */
|
|
13
|
+
template: string;
|
|
10
14
|
label: string;
|
|
11
15
|
for: string[];
|
|
16
|
+
/** The main template, whose first design is demo.json. */
|
|
12
17
|
primary: boolean;
|
|
13
18
|
}
|
|
14
19
|
/**
|
|
15
|
-
* One
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
20
|
+
* One template per business picked, each with one design (contract R2.8:
|
|
21
|
+
* theme → template → design). The main template's design is `default`
|
|
22
|
+
* (demo.json); every other design's id is its template's key, which makes it
|
|
23
|
+
* that template's design 1. The key is the business picked, so a template is
|
|
24
|
+
* never inferred from an id. A business category makes a general template, a
|
|
25
|
+
* niche a niche one — either way `for` is just that key, so a niche never
|
|
26
|
+
* names a category (R2.7).
|
|
19
27
|
*/
|
|
20
28
|
export declare function planTemplates(keys: string[], primary?: string): TemplatePlan[];
|
|
21
29
|
/** The business categories the templates belong to, once each, in order. */
|
package/dist/naming.js
CHANGED
|
@@ -27,10 +27,13 @@ export function prefixFor(slug) {
|
|
|
27
27
|
return candidates.find((prefix) => /^[a-z][a-z0-9]{1,3}$/.test(prefix) && !RESERVED_PREFIXES.includes(prefix) && prefix !== 'core') ?? `${slug[0]}q`;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* One
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
30
|
+
* One template per business picked, each with one design (contract R2.8:
|
|
31
|
+
* theme → template → design). The main template's design is `default`
|
|
32
|
+
* (demo.json); every other design's id is its template's key, which makes it
|
|
33
|
+
* that template's design 1. The key is the business picked, so a template is
|
|
34
|
+
* never inferred from an id. A business category makes a general template, a
|
|
35
|
+
* niche a niche one — either way `for` is just that key, so a niche never
|
|
36
|
+
* names a category (R2.7).
|
|
34
37
|
*/
|
|
35
38
|
export function planTemplates(keys, primary) {
|
|
36
39
|
const unique = [...new Set(keys)];
|
|
@@ -38,7 +41,7 @@ export function planTemplates(keys, primary) {
|
|
|
38
41
|
return [];
|
|
39
42
|
const first = primary && unique.includes(primary) ? primary : unique[0];
|
|
40
43
|
const ordered = [first, ...unique.filter((key) => key !== first)];
|
|
41
|
-
return ordered.map((key, index) => ({ id: index === 0 ? 'default' : key, key, label: labelOf(key), for: [key], primary: index === 0 }));
|
|
44
|
+
return ordered.map((key, index) => ({ id: index === 0 ? 'default' : key, key, template: key, label: labelOf(key), for: [key], primary: index === 0 }));
|
|
42
45
|
}
|
|
43
46
|
/** The business categories the templates belong to, once each, in order. */
|
|
44
47
|
export function defaultCategories(keys) {
|
package/dist/prompts.js
CHANGED
|
@@ -41,7 +41,7 @@ export function clackPrompter() {
|
|
|
41
41
|
return answer(await p.autocompleteMultiselect({ message: 'Businesses to make templates for (type to search)', options: templateOptions(), required: true }));
|
|
42
42
|
},
|
|
43
43
|
async primary(keys) {
|
|
44
|
-
return answer(await p.select({ message: 'Which is the
|
|
44
|
+
return answer(await p.select({ message: 'Which template is the main one (the theme\'s first impression)?', options: keys.map(businessOption) }));
|
|
45
45
|
},
|
|
46
46
|
async categories(initial) {
|
|
47
47
|
return answer(await p.multiselect({ message: 'Business categories the theme serves', options: SERVICES.map((key) => ({ value: key, label: labelOf(key) })), initialValues: initial, required: true }));
|
package/dist/setup.js
CHANGED
|
@@ -18,7 +18,7 @@ const ts = (text) => {
|
|
|
18
18
|
const list = (items) => `[${items.map(ts).join(', ')}]`;
|
|
19
19
|
export function themeConfigSource(answers) {
|
|
20
20
|
const [primary, ...others] = answers.templates;
|
|
21
|
-
const demos = others.map((plan) => ` {\n id: ${ts(plan.id)}, label: ${ts(plan.label)}, for: ${list(plan.for)},\n description: ${ts(DESCRIPTION)},\n },`).join('\n');
|
|
21
|
+
const demos = others.map((plan) => ` {\n id: ${ts(plan.id)}, template: ${ts(plan.template)}, label: ${ts(plan.label)}, for: ${list(plan.for)},\n description: ${ts(DESCRIPTION)},\n },`).join('\n');
|
|
22
22
|
return `const config = {
|
|
23
23
|
name: ${ts(answers.name)},
|
|
24
24
|
slug: ${ts(answers.slug)},
|
|
@@ -28,10 +28,20 @@ export function themeConfigSource(answers) {
|
|
|
28
28
|
tags: ${list(answers.tags)},
|
|
29
29
|
categories: ${list(answers.categories)},
|
|
30
30
|
rank: 0,
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
31
|
+
// Theme → template → design (docs/THEME.md#templates). A template is a
|
|
32
|
+
// business the theme is dressed as; a design is one demo store of it.
|
|
33
|
+
// demo.json is the main template's first design; each demos/<id>.json here
|
|
34
|
+
// is the first design of another template, so its id is its key.
|
|
35
|
+
// \`template\` is that key: a slug for the business, never renamed once
|
|
36
|
+
// shipped. \`label\` and \`for\` are the template's. \`for\`: a whole business
|
|
37
|
+
// leads with its category, a niche names only its product keys
|
|
38
|
+
// (docs/business-vocabulary.json).
|
|
39
|
+
// To give a template a second design, add a demos/<id>.json with any unused
|
|
40
|
+
// id and declare it \`{ id, template, design_label, description }\`: it
|
|
41
|
+
// inherits the template's label and for. A template with two or more
|
|
42
|
+
// designs (three at most) names each one by its own \`design_label\`.
|
|
34
43
|
default_demo: {
|
|
44
|
+
template: ${ts(primary.template)},
|
|
35
45
|
label: ${ts(primary.label)},
|
|
36
46
|
for: ${list(primary.for)},
|
|
37
47
|
description: ${ts(DESCRIPTION)},
|