create-indiepub 0.1.1 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +9 -118
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26,83 +26,6 @@ var codeberg = (input) => {
26
26
  subdir: subdir ? `${repo}/${subdir}` : repo
27
27
  };
28
28
  };
29
- function genPackageJson(cfg) {
30
- const name = slugify(cfg.dir.replace(/^\.\//, "")) || "my-indiepub-site";
31
- const baseDeps = {
32
- "@astrojs/cloudflare": "^12.0.0",
33
- "@iconify-json/lucide": "^1.2.0",
34
- "@indiepub/admin": "^0.1.0",
35
- "@indiepub/astro": "^0.1.0",
36
- "astro": "^5.0.0",
37
- "astro-icon": "^1.1.5",
38
- "drizzle-orm": "^0.38.0",
39
- "nanoid": "^5.0.0"
40
- };
41
- const baseDevDeps = {
42
- "@astrojs/check": "^0.9.0",
43
- "@cloudflare/workers-types": "^4.0.0",
44
- "@indiepub/types": "^0.1.0",
45
- "typescript": "^5.0.0",
46
- "wrangler": "^4.0.0"
47
- };
48
- let deps;
49
- let devDeps;
50
- if (cfg.template === "minimal") {
51
- deps = {
52
- "@astrojs/cloudflare": "^12.0.0",
53
- "@indiepub/admin": "^0.1.0",
54
- "@indiepub/astro": "^0.1.0",
55
- "astro": "^5.0.0"
56
- };
57
- devDeps = {
58
- "@cloudflare/workers-types": "^4.0.0",
59
- "typescript": "^5.0.0",
60
- "wrangler": "^4.0.0"
61
- };
62
- } else if (cfg.template === "byline") {
63
- deps = {
64
- ...baseDeps,
65
- "@indiepub/db": "^0.1.0",
66
- "@tiptap/core": "^3.20.0",
67
- "@tiptap/extension-image": "^3.20.0",
68
- "@tiptap/extension-link": "^3.20.0",
69
- "@tiptap/extension-placeholder": "^3.20.0",
70
- "@tiptap/starter-kit": "^3.20.0",
71
- "tiptap-markdown": "^0.9.0"
72
- };
73
- devDeps = { ...baseDevDeps };
74
- } else if (cfg.template === "timeline") {
75
- deps = {
76
- ...baseDeps,
77
- "@iconify-json/simple-icons": "^1.0.0"
78
- };
79
- devDeps = { ...baseDevDeps };
80
- } else {
81
- deps = { ...baseDeps };
82
- if (cfg.subscriptions) {
83
- deps["@indiepub/email"] = "^0.1.0";
84
- }
85
- devDeps = { ...baseDevDeps };
86
- }
87
- return JSON.stringify(
88
- {
89
- name,
90
- version: "0.0.1",
91
- type: "module",
92
- scripts: {
93
- dev: "astro dev",
94
- build: "astro build",
95
- preview: "astro preview",
96
- "db:migrate": "wrangler d1 migrations apply DB --local",
97
- typecheck: "astro check"
98
- },
99
- dependencies: deps,
100
- devDependencies: devDeps
101
- },
102
- null,
103
- 2
104
- ) + "\n";
105
- }
106
29
  function genAstroConfig(cfg) {
107
30
  const siteUrl = cfg.authorUrl || "https://example.com";
108
31
  const syndicationLines = [];
@@ -154,31 +77,6 @@ ${syndicationBlock}${subscriptionsBlock} }),
154
77
  });
155
78
  `;
156
79
  }
157
- function genTsconfig() {
158
- return JSON.stringify(
159
- {
160
- compilerOptions: {
161
- target: "ES2022",
162
- module: "ES2022",
163
- moduleResolution: "bundler",
164
- resolveJsonModule: true,
165
- esModuleInterop: true,
166
- strict: true,
167
- exactOptionalPropertyTypes: true,
168
- noUnusedLocals: true,
169
- noUnusedParameters: true,
170
- noFallthroughCasesInSwitch: true,
171
- skipLibCheck: true,
172
- jsx: "preserve",
173
- jsxImportSource: "react",
174
- allowImportingTsExtensions: true
175
- },
176
- include: ["src", "astro.config.mjs", ".astro/types.d.ts"]
177
- },
178
- null,
179
- 2
180
- ) + "\n";
181
- }
182
80
  function genWranglerToml(cfg) {
183
81
  const name = slugify(cfg.dir.replace(/^\.\//, "")) || "my-indiepub-site";
184
82
  return `name = "${name}"
@@ -200,10 +98,10 @@ binding = "SESSION"
200
98
  id = "YOUR_KV_NAMESPACE_ID_HERE"
201
99
  `;
202
100
  }
203
- function genNpmrc() {
101
+ function genNpmrc(licenseToken) {
204
102
  return [
205
103
  "@indiepub:registry=https://registry.indiepub.dev",
206
- "//registry.indiepub.dev/:_authToken=${INDIEPUB_NPM_TOKEN}",
104
+ `//registry.indiepub.dev/:_authToken=${licenseToken}`,
207
105
  ""
208
106
  ].join("\n");
209
107
  }
@@ -320,27 +218,20 @@ jobs:
320
218
  }
321
219
  async function scaffold(cfg) {
322
220
  const base = cfg.dir;
323
- if (cfg.template !== "minimal") {
324
- await downloadTemplate(`codeberg:indiepub/themes/${cfg.template}`, {
325
- dir: base,
326
- force: true,
327
- providers: { codeberg }
328
- });
329
- }
221
+ await downloadTemplate(`codeberg:indiepub/themes/${cfg.template}`, {
222
+ dir: base,
223
+ force: true,
224
+ silent: true,
225
+ providers: { codeberg }
226
+ });
330
227
  const files = [
331
- write(base, "package.json", genPackageJson(cfg)),
332
228
  write(base, "astro.config.mjs", genAstroConfig(cfg)),
333
- write(base, "tsconfig.json", genTsconfig()),
334
229
  write(base, "wrangler.toml", genWranglerToml(cfg)),
335
- write(base, ".npmrc", genNpmrc()),
230
+ write(base, ".npmrc", genNpmrc(cfg.licenseToken)),
336
231
  write(base, ".gitignore", genGitignore()),
337
232
  write(base, ".dev.vars.example", genDevVarsExample(cfg)),
338
233
  write(base, ".dev.vars", genDevVars(cfg.licenseToken))
339
234
  ];
340
- if (cfg.template === "minimal") {
341
- files.push(write(base, "src/env.d.ts", `/// <reference types="astro/client" />
342
- `));
343
- }
344
235
  if (cfg.githubActions) {
345
236
  files.push(write(base, ".github/workflows/deploy.yml", genGitHubWorkflow(cfg)));
346
237
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-indiepub",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-indiepub": "./dist/index.js"