create-fluent-cart 0.0.0-stage → 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FluentCart Inc
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
- # Temporary Holding Version
1
+ # create-fluent-cart
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Start a new Astro store for [FluentCart](https://fluentcart.com):
4
+
5
+ ```sh
6
+ npm create fluent-cart my-store
7
+ ```
8
+
9
+ It runs `npm create astro@latest` with the FluentCart starter (`fluent-cart/headless/starter-astro`) as the template. Options after the folder go to create-astro, for example `--install`, `--git` or `--yes`. Then it prints the steps that connect the site to your store:
10
+
11
+ 1. `cp .env.example .env` and set `FCT_STORE_URL` and `FCT_STORE_KEY` (WordPress: FluentCart → Settings → Storefront API).
12
+ 2. Add `http://localhost:4321` to the allowed origins on that screen.
13
+ 3. `npx @fluent-cart/astro check --only api`, then `npm run dev`.
14
+
15
+ The WordPress site needs the FluentCart Headless plugin. The new project already holds the guide for coding agents (`AGENTS.md`, `CLAUDE.md` and the skills). After you update `@fluent-cart/astro`, refresh the guide with `npx @fluent-cart/astro init`.
16
+
17
+ MIT, © 2026 FluentCart Inc. Source: [fluent-cart/headless](https://github.com/fluent-cart/headless).
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ // npm create fluent-cart [dir] [create-astro options, e.g. --install --git --yes]
3
+ import { run } from '../lib/create.mjs';
4
+
5
+ try {
6
+ process.exitCode = await run(process.argv.slice(2));
7
+ } catch (error) {
8
+ console.error(error.message);
9
+ process.exitCode = 2;
10
+ }
package/lib/create.mjs ADDED
@@ -0,0 +1,55 @@
1
+ // `npm create fluent-cart [dir] [create-astro options]`: create-astro with the FluentCart starter as its
2
+ // template (a folder of the public repo), then the steps that connect the new site to the store.
3
+ import { spawn } from 'node:child_process';
4
+
5
+ export const TEMPLATE = 'fluent-cart/headless/starter-astro';
6
+
7
+ /** The project folder (the first argument that is not an option) and the options passed on to create-astro. */
8
+ export function parseArgs(argv) {
9
+ const index = argv.findIndex((arg) => !arg.startsWith('-'));
10
+ return index === -1 ? { dir: null, rest: argv } : { dir: argv[index], rest: [...argv.slice(0, index), ...argv.slice(index + 1)] };
11
+ }
12
+
13
+ /** The npm command line: npm create astro@latest <dir> -- --template <starter> <options>. */
14
+ export function npmArgs(argv) {
15
+ const { dir, rest } = parseArgs(argv);
16
+ if (rest.some((arg) => arg === '--template' || arg.startsWith('--template='))) {
17
+ throw new Error('create-fluent-cart sets the template itself; leave out --template.');
18
+ }
19
+ return ['create', 'astro@latest', ...(dir ? [dir] : []), '--', '--template', TEMPLATE, ...rest];
20
+ }
21
+
22
+ export function nextSteps(dir) {
23
+ const folder = dir || '<your project folder>';
24
+ return `
25
+ Next steps:
26
+
27
+ 1. cd ${folder}
28
+ 2. cp .env.example .env, then set FCT_STORE_URL (your WordPress site) and FCT_STORE_KEY.
29
+ The key is in WordPress: FluentCart → Settings → Storefront API (turn the API on there).
30
+ 3. On that screen, add http://localhost:4321 to the allowed origins.
31
+ 4. npx @fluent-cart/astro check --only api the store should answer 200
32
+ 5. npm run dev http://localhost:4321
33
+
34
+ The site needs the FluentCart Headless plugin on the WordPress site.
35
+ Coding agents: the guide is already in the project (AGENTS.md, CLAUDE.md, .agents/skills, .claude/skills).
36
+ After you update @fluent-cart/astro, run npx @fluent-cart/astro init to refresh it.
37
+ `;
38
+ }
39
+
40
+ /** Runs npm create astro with the starter; resolves with npm's exit code. */
41
+ export function run(argv, { spawnImpl = spawn, log = console.log, platform = process.platform } = {}) {
42
+ const args = npmArgs(argv);
43
+ return new Promise((resolve) => {
44
+ // npm is npm.cmd on Windows, which needs a shell
45
+ const child = spawnImpl('npm', args, { stdio: 'inherit', shell: platform === 'win32' });
46
+ child.on('error', (error) => {
47
+ log(`Could not run npm: ${error.message}`);
48
+ resolve(1);
49
+ });
50
+ child.on('exit', (code) => {
51
+ if (code === 0) log(nextSteps(parseArgs(argv).dir));
52
+ resolve(code ?? 1);
53
+ });
54
+ });
55
+ }
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "create-fluent-cart",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "npm create fluent-cart: a new Astro store for FluentCart from the official starter.",
5
+ "license": "MIT",
6
+ "author": "FluentCart Inc",
7
+ "homepage": "https://github.com/fluent-cart/headless/tree/main/create-fluent-cart#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/fluent-cart/headless.git",
11
+ "directory": "create-fluent-cart"
12
+ },
13
+ "bugs": "https://github.com/fluent-cart/headless/issues",
14
+ "keywords": ["fluentcart", "astro", "headless", "ecommerce", "create", "starter"],
15
+ "type": "module",
16
+ "bin": {
17
+ "create-fluent-cart": "bin/create-fluent-cart.mjs"
18
+ },
19
+ "files": ["bin", "lib"],
20
+ "engines": {
21
+ "node": ">=18.19"
22
+ },
23
+ "scripts": {
24
+ "test": "node --test test/*.test.mjs"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ }
29
+ }