create-fcomurs-theme 0.1.0 → 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 (3) hide show
  1. package/README.md +17 -15
  2. package/index.js +38 -35
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,15 +1,17 @@
1
- # create-fcomurs-theme
2
-
3
- Start a new theme for [fcomurs](https://fcomurs.com):
4
-
5
- ```bash
6
- npm create fcomurs-theme@latest my-theme
7
- cd my-theme
8
- npm install
9
- npx fcomurs-theme login --store <your store>
10
- npm run dev -- --store <your store>
11
- ```
12
-
13
- It makes `./my-theme`: a theme that passes `check` straight away, with npm scripts for the [`fcomurs-theme`](https://www.npmjs.com/package/fcomurs-theme) CLI.
14
-
15
- Step by step: https://doc.fcomurs.com/en/first-theme · বাংলা: https://doc.fcomurs.com/bn/first-theme
1
+ # create-fcomurs-theme
2
+
3
+ Start a new theme for [fcomurs](https://fcomurs.com):
4
+
5
+ ```bash
6
+ npm create fcomurs-theme@latest my-theme
7
+ cd my-theme
8
+ npm install
9
+ npx fcomurs-theme login --store <your store>
10
+ npm run dev -- --store <your store>
11
+ ```
12
+
13
+ Prefer React? `npm create fcomurs-theme@latest my-theme -- --react` makes its section a React component (`section.tsx`, with [`@fcomurs/theme`](https://www.npmjs.com/package/@fcomurs/theme)).
14
+
15
+ It makes `./my-theme`: a theme that passes `check` straight away, with npm scripts for the [`fcomurs-theme`](https://www.npmjs.com/package/fcomurs-theme) CLI.
16
+
17
+ Step by step: https://doc.fcomurs.com/en/first-theme · বাংলা: https://doc.fcomurs.com/bn/first-theme
package/index.js CHANGED
@@ -1,35 +1,38 @@
1
- #!/usr/bin/env node
2
- // npm create fcomurs-theme@latest [name]
3
- //
4
- // Asks for a theme name (unless given), then makes ./<name>: a theme that
5
- // passes `check` straight away, with package.json scripts for the CLI
6
- // (fcomurs-theme). Nothing else: the CLI does the rest.
7
-
8
- const readline = require('readline');
9
- const { main } = require('fcomurs-theme');
10
-
11
- /** "My Store Theme" → "my-store-theme": what a theme folder may be called. */
12
- const slug = (s) =>
13
- String(s || '')
14
- .toLowerCase()
15
- .replace(/[^a-z0-9]+/g, '-')
16
- .replace(/^[^a-z]+|-+$/g, '')
17
- .slice(0, 40);
18
-
19
- const ask = (question) =>
20
- new Promise((resolve) => {
21
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
22
- rl.question(question, (answer) => {
23
- rl.close();
24
- resolve(answer);
25
- });
26
- });
27
-
28
- (async () => {
29
- let name = slug(process.argv[2]);
30
- if (!name) {
31
- console.log('Welcome to fcomurs theme development.\n');
32
- name = slug(await ask('Theme name (my-theme): ')) || 'my-theme';
33
- }
34
- process.exitCode = await main(['new', name]);
35
- })();
1
+ #!/usr/bin/env node
2
+ // npm create fcomurs-theme@latest [name] [-- --react]
3
+ //
4
+ // Asks for a theme name (unless given), then makes ./<name>: a theme that
5
+ // passes `check` straight away, with package.json scripts for the CLI
6
+ // (fcomurs-theme). Nothing else: the CLI does the rest.
7
+
8
+ const readline = require('readline');
9
+ const { main } = require('fcomurs-theme');
10
+
11
+ /** "My Store Theme" → "my-store-theme": what a theme folder may be called. */
12
+ const slug = (s) =>
13
+ String(s || '')
14
+ .toLowerCase()
15
+ .replace(/[^a-z0-9]+/g, '-')
16
+ .replace(/^[^a-z]+|-+$/g, '')
17
+ .slice(0, 40);
18
+
19
+ const ask = (question) =>
20
+ new Promise((resolve) => {
21
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
22
+ rl.question(question, (answer) => {
23
+ rl.close();
24
+ resolve(answer);
25
+ });
26
+ });
27
+
28
+ (async () => {
29
+ // --react: its section is a React component (section.tsx) with a Motion island.
30
+ const args = process.argv.slice(2);
31
+ const react = args.includes('--react');
32
+ let name = slug(args.find((a) => !a.startsWith('--')));
33
+ if (!name) {
34
+ console.log('Welcome to fcomurs theme development.\n');
35
+ name = slug(await ask('Theme name (my-theme): ')) || 'my-theme';
36
+ }
37
+ process.exitCode = await main(['new', name, ...(react ? ['--react'] : [])]);
38
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fcomurs-theme",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Start a new fcomurs theme: npm create fcomurs-theme@latest",
5
5
  "keywords": [
6
6
  "fcomurs",
@@ -21,6 +21,6 @@
21
21
  "node": ">=20"
22
22
  },
23
23
  "dependencies": {
24
- "fcomurs-theme": "^0.1.0"
24
+ "fcomurs-theme": "^0.2.0"
25
25
  }
26
- }
26
+ }