create-fcomurs-theme 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +17 -3
- package/index.js +38 -0
- package/package.json +24 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Foxses Studio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
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
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-fcomurs-theme",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Start a new fcomurs theme: npm create fcomurs-theme@latest",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"fcomurs",
|
|
7
|
+
"theme",
|
|
8
|
+
"create"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://doc.fcomurs.com/en/first-theme",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"bin": {
|
|
13
|
+
"create-fcomurs-theme": "index.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"index.js",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"fcomurs-theme": "^0.2.0"
|
|
25
|
+
}
|
|
26
|
+
}
|