nnw-theme 0.1.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.
@@ -24,6 +24,11 @@ stable GitHub release; and the valid ZIP asset. A useful repository description
24
24
  metadata warns but does not block publication. `npx nnw-theme@1 marketplace enable`
25
25
  adds the recommended topic through the author’s authenticated `gh` session.
26
26
 
27
+ The screenshot workflow pushes a branch and opens a pull request for review, so the
28
+ repository needs **Settings → Actions → General → Workflow permissions → Allow GitHub
29
+ Actions to create and approve pull requests**. Without it the run pushes the branch and
30
+ then fails with "GitHub Actions is not permitted to create or approve pull requests".
31
+
27
32
  Creating releases, topics, branches, pull requests, or other GitHub state is external
28
33
  mutation. Confirm the person’s intent immediately before doing it. Ordinary edits,
29
34
  local previews, checks, and packages do not need that additional confirmation.
@@ -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.
@@ -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 = findRoot();
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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nnw-theme",
3
- "version": "0.1.0",
3
+ "version": "1.0.1",
4
4
  "description": "Create, preview, check, and publish a NetNewsWire theme.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Dave Marquard",