create-ely 0.1.3 → 0.1.5

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 CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  The fastest way to scaffold production-ready [ElysiaJS](https://elysiajs.com) projects with [Bun](https://bun.sh).
13
13
 
14
- ![Demo](https://github.com/user-attachments/assets/67386464-eb39-4b71-8b9b-34039e2861d0)
14
+ ![Demo](./assets/demo.gif)
15
15
 
16
16
  ## Quick Start
17
17
 
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ely",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Scaffold production-ready ElysiaJS projects with ease using Bun - choose between backend-only or full-stack monorepo templates",
5
5
  "type": "module",
6
6
  "author": {
@@ -42,6 +42,7 @@
42
42
  "src",
43
43
  "templates.zip",
44
44
  "scripts/postinstall.ts",
45
+ "assets",
45
46
  "README.md",
46
47
  "LICENSE"
47
48
  ],
package/src/template.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { copyFileSync, existsSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import * as clack from '@clack/prompts';
4
+ import AdmZip from 'adm-zip';
4
5
  import {
5
6
  EXCLUDED_COPY_PATTERNS,
6
7
  TEMPLATE_PATHS,
@@ -8,6 +9,46 @@ import {
8
9
  } from './constants.ts';
9
10
  import { copyRecursive } from './utils.ts';
10
11
 
12
+ /**
13
+ * Ensures templates are extracted from zip if not already present
14
+ * This handles cases where postinstall didn't run (e.g., bunx)
15
+ *
16
+ * Bun uses a "default-secure" approach where lifecycle scripts are not
17
+ * executed by default. When users run `bunx create-ely`, the postinstall
18
+ * script doesn't run, so we extract templates at runtime instead.
19
+ */
20
+ function ensureTemplatesExtracted(): void {
21
+ const templatesPath = join(import.meta.dir, '..', 'templates');
22
+ const zipPath = join(import.meta.dir, '..', 'templates.zip');
23
+
24
+ // Templates already exist (source repo or already extracted)
25
+ if (existsSync(templatesPath)) {
26
+ return;
27
+ }
28
+
29
+ // Extract from zip if available
30
+ if (!existsSync(zipPath)) {
31
+ throw new Error(
32
+ 'templates.zip not found. Installation may be corrupted.\n' +
33
+ 'Report this issue: https://github.com/truehazker/create-ely/issues',
34
+ );
35
+ }
36
+
37
+ try {
38
+ const zip = new AdmZip(zipPath);
39
+ zip.extractAllTo(templatesPath, true);
40
+
41
+ if (!existsSync(templatesPath)) {
42
+ throw new Error('Templates folder was not created after extraction');
43
+ }
44
+ } catch (error) {
45
+ throw new Error(
46
+ `Failed to extract templates: ${error instanceof Error ? error.message : error}\n` +
47
+ 'Report this issue: https://github.com/truehazker/create-ely/issues',
48
+ );
49
+ }
50
+ }
51
+
11
52
  /**
12
53
  * Sets up the project template by copying files and installing dependencies
13
54
  * @param projectType - The type of project template to use ('backend' or 'monorepo')
@@ -21,6 +62,9 @@ export async function setupTemplate(
21
62
  const spinner = clack.spinner();
22
63
  spinner.start('Creating project...');
23
64
 
65
+ // Ensure templates are available (extract from zip if needed)
66
+ ensureTemplatesExtracted();
67
+
24
68
  const templateDir = join(import.meta.dir, '..', 'templates', projectType);
25
69
 
26
70
  copyRecursive(templateDir, targetDir, EXCLUDED_COPY_PATTERNS);
package/templates.zip CHANGED
Binary file