nnw-theme 1.0.0 → 1.0.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/assets/stubs/AGENTS.md +7 -0
- package/dist/commands/init.js +18 -1
- package/package.json +1 -1
package/assets/stubs/AGENTS.md
CHANGED
|
@@ -6,6 +6,13 @@ its `fixtures/`, and `screenshots/`. The tooling is the `nnw-theme` npm package;
|
|
|
6
6
|
run it as `npx nnw-theme@1 <command>`. Never install it globally and never add
|
|
7
7
|
it to this repository. Read `npx nnw-theme@1 guide` before theme work.
|
|
8
8
|
|
|
9
|
+
If this repository is `dave-atx/netnewswire-theme-template` itself (check
|
|
10
|
+
`git remote -v`), it is the GitHub template, not a theme: do not initialize,
|
|
11
|
+
fork, or design in it. Help the user create their own repository from it with
|
|
12
|
+
**Use this template** or `gh repo create NAME --template
|
|
13
|
+
dave-atx/netnewswire-theme-template --clone`, confirming before you create it,
|
|
14
|
+
then work in that copy.
|
|
15
|
+
|
|
9
16
|
If `.nnw-theme-uninitialized` exists, run `npx nnw-theme@1 init` first and let
|
|
10
17
|
the user confirm the permanent theme identifier. Prefer CSS changes; change
|
|
11
18
|
`template.html` only when the requested structure or behavior requires it.
|
package/dist/commands/init.js
CHANGED
|
@@ -61,6 +61,23 @@ function updateReadme(root, name, creator, homepage) {
|
|
|
61
61
|
`A NetNewsWire theme by [${creator}](${homepage}).\n${IDENTITY_END}`;
|
|
62
62
|
writeFileSync(path, text.slice(0, start) + replacement + text.slice(end + IDENTITY_END.length), "utf8");
|
|
63
63
|
}
|
|
64
|
+
const TEMPLATE = "dave-atx/netnewswire-theme-template";
|
|
65
|
+
/** The theme root, or directions to create one: init starts from the template. */
|
|
66
|
+
function templateRoot() {
|
|
67
|
+
try {
|
|
68
|
+
return findRoot();
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (!(error instanceof ThemeError))
|
|
72
|
+
throw error;
|
|
73
|
+
throw new ThemeError("no theme repository here; init personalizes a copy of the theme template.\n" +
|
|
74
|
+
`Create one with "Use this template" at https://github.com/${TEMPLATE}, ` +
|
|
75
|
+
"clone it, and run init inside it. With the GitHub CLI:\n" +
|
|
76
|
+
` gh repo create my-theme --template ${TEMPLATE} --public --clone\n` +
|
|
77
|
+
" cd my-theme\n" +
|
|
78
|
+
" npx nnw-theme@1 init");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
64
81
|
async function ask(value, flag, label, fallback) {
|
|
65
82
|
if (value)
|
|
66
83
|
return value;
|
|
@@ -69,7 +86,7 @@ async function ask(value, flag, label, fallback) {
|
|
|
69
86
|
return await promptText(label, fallback);
|
|
70
87
|
}
|
|
71
88
|
export default async function init({ values }) {
|
|
72
|
-
const root =
|
|
89
|
+
const root = templateRoot();
|
|
73
90
|
let theme = findTheme(root);
|
|
74
91
|
if (!existsSync(join(root, PLACEHOLDER_MARKER))) {
|
|
75
92
|
throw new ThemeError("this repository is already initialized; run `npx nnw-theme@1 setup` to install preview tools");
|