moracarta 2.1.0 → 2.1.2

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
@@ -1,6 +1,9 @@
1
1
  # Moracarta
2
2
 
3
- **Create your own personalized love-letter website and deploy it completely for free.**
3
+ **Create your own personalized love-letter website and deploy it completely for free. Available as an npm package**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/moracarta)](https://www.npmjs.com/package/moracarta)
6
+ [![npm downloads](https://img.shields.io/npm/dt/moracarta)](https://www.npmjs.com/package/moracarta)
4
7
 
5
8
  🌐 **[Live Demo](https://moracarta.pages.dev/)**
6
9
 
@@ -12,17 +15,16 @@
12
15
  🌐 Free web deployment
13
16
  šŸ”’ No database required
14
17
 
15
- ## **Get your own working URL in less than 5 minutes**
18
+ ## **You can have your own working URL in less than 5 minutes**
16
19
 
17
20
  **And it's as simple as:**
18
21
 
19
22
  ```bash
20
- git clone https://github.com/WesleyHanauer/moracarta
21
- cd moracarta
22
- npm install
23
- moracarta setup
24
- moracarta build
25
- moracarta deploy
23
+ npm init -y
24
+ npm i moracarta
25
+ npx moracarta setup
26
+ npx moracarta build
27
+ npx moracarta deploy
26
28
  ```
27
29
 
28
30
  ### App Demo
package/package.json CHANGED
@@ -1,10 +1,37 @@
1
1
  {
2
2
  "name": "moracarta",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "type": "module",
5
5
  "description": "",
6
+ "license": "MIT",
6
7
  "main": "index.js",
7
- "files": [ "index.html", "vite.config.mjs", "public", "src/commands", "src/config/fonts.js", "src/data/letters.example.js", "src/data/lettersLoader.js", "src/i18n", "src/scripts", "src/services", "src/styles", "src/views" ],
8
+ "keywords": [
9
+ "cli",
10
+ "scaffold",
11
+ "static-site",
12
+ "cloudflare",
13
+ "wrangler",
14
+ "gift",
15
+ "envelope",
16
+ "letters",
17
+ "romantic",
18
+ "html-css-js"
19
+ ],
20
+ "files": [
21
+ "index.html",
22
+ "vite.config.mjs",
23
+ "public",
24
+ "src/commands",
25
+ "src/config/fonts.js",
26
+ "src/data/letters.example.js",
27
+ "src/data/lettersLoader.js",
28
+ "src/i18n",
29
+ "src/scripts",
30
+ "src/services",
31
+ "src/styles",
32
+ "src/views"
33
+ ],
34
+ "postinstall": "node src/commands/postinstall.js",
8
35
  "bin": {
9
36
  "moracarta": "src/commands/cliConfig.js"
10
37
  },
@@ -20,9 +47,7 @@
20
47
  "type": "git",
21
48
  "url": "git+https://github.com/WesleyHanauer/moracarta.git"
22
49
  },
23
- "keywords": [],
24
50
  "author": "",
25
- "license": "ISC",
26
51
  "bugs": {
27
52
  "url": "https://github.com/WesleyHanauer/moracarta/issues"
28
53
  },
@@ -20,13 +20,34 @@ const VITE_ARGS = {
20
20
  preview: ["preview"]
21
21
  };
22
22
 
23
+ const HELP_TEXT = `
24
+ šŸ’Œ Moracarta — build your own love-letter website
25
+
26
+ Usage: moracarta <command>
27
+
28
+ Commands:
29
+ setup Scaffold the site into your project and configure it interactively
30
+ add Add a letter from a public Google Docs tab
31
+ remove Remove a letter you've already added
32
+ dev Start the local dev server to preview your site
33
+ build Build the site for production
34
+ preview Preview the production build locally
35
+ deploy Build and deploy the site to Cloudflare Pages
36
+
37
+ Run 'moracarta setup' first if you haven't already.
38
+ `;
39
+
23
40
  const command = process.argv[2];
24
41
  const commandArguments = process.argv.slice(3);
25
42
 
43
+ if (!command || command === "--help" || command === "-h") {
44
+ console.log(HELP_TEXT);
45
+ process.exit(0);
46
+ }
47
+
26
48
  if (!COMMANDS.has(command)) {
27
- console.error(
28
- "Usage: moracarta <setup|dev|build|preview|deploy|add|remove> [options]"
29
- );
49
+ console.error(`Unknown command: ${command}`);
50
+ console.log(HELP_TEXT);
30
51
  process.exit(1);
31
52
  }
32
53
 
@@ -0,0 +1,17 @@
1
+ import { resolve } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ const packageRoot = resolve(fileURLToPath(new URL("../..", import.meta.url)));
5
+
6
+ // npm sets INIT_CWD to wherever the install was actually run from.
7
+ // If that's this repo itself, we're installing moracarta's own
8
+ // dependencies for development, not installing moracarta as a
9
+ // package, so skip the message.
10
+ const initCwd = process.env.INIT_CWD;
11
+
12
+ if (initCwd && resolve(initCwd) === packageRoot) {
13
+ process.exit(0);
14
+ }
15
+
16
+ console.log("\nšŸ’Œ Thanks for installing Moracarta!");
17
+ console.log("Run 'npx moracarta --help' to see available commands.\n");