@hyprcart/create-app 1.0.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/README.md +11 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @hyprcart/create-app
|
|
2
|
+
|
|
3
|
+
Bootstrap a standalone Hyprcart app project.
|
|
4
|
+
|
|
5
|
+
After the public npm release is published, run:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm create @hyprcart/app@latest reviews-badge -- --template storefront-block
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The package delegates to `@hyprcart/cli` and creates a project with manifest, source, fixtures, locales, tests, Playwright preview placeholder, and app scripts.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { runCli } from "@hyprcart/cli";
|
|
5
|
+
import { realpathSync } from "fs";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
async function createHyprcartApp(argv = process.argv.slice(2)) {
|
|
8
|
+
const args = normalizeCreateArgs(argv);
|
|
9
|
+
const name = positionalArgs(args)[0] ?? "my-hyprcart-app";
|
|
10
|
+
const forwardedFlags = args.filter((arg, index) => arg.startsWith("--") || args[index - 1]?.startsWith("--"));
|
|
11
|
+
return runCli(["app", "init", name, ...forwardedFlags]);
|
|
12
|
+
}
|
|
13
|
+
function normalizeCreateArgs(argv) {
|
|
14
|
+
return argv.filter((arg) => arg !== "--");
|
|
15
|
+
}
|
|
16
|
+
function positionalArgs(args) {
|
|
17
|
+
return args.filter((arg, index) => !arg.startsWith("--") && !args[index - 1]?.startsWith("--"));
|
|
18
|
+
}
|
|
19
|
+
if (isCliEntryPoint()) {
|
|
20
|
+
const result = await createHyprcartApp();
|
|
21
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
22
|
+
`);
|
|
23
|
+
process.exit(result.ok ? 0 : 1);
|
|
24
|
+
}
|
|
25
|
+
function isCliEntryPoint() {
|
|
26
|
+
try {
|
|
27
|
+
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1] ?? "");
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
createHyprcartApp
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { runCli } from \"@hyprcart/cli\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nexport async function createHyprcartApp(argv = process.argv.slice(2)) {\n const args = normalizeCreateArgs(argv);\n const name = positionalArgs(args)[0] ?? \"my-hyprcart-app\";\n const forwardedFlags = args.filter((arg, index) => arg.startsWith(\"--\") || args[index - 1]?.startsWith(\"--\"));\n return runCli([\"app\", \"init\", name, ...forwardedFlags]);\n}\n\nfunction normalizeCreateArgs(argv: string[]): string[] {\n return argv.filter((arg) => arg !== \"--\");\n}\n\nfunction positionalArgs(args: string[]): string[] {\n return args.filter((arg, index) => !arg.startsWith(\"--\") && !args[index - 1]?.startsWith(\"--\"));\n}\n\nif (isCliEntryPoint()) {\n const result = await createHyprcartApp();\n process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n process.exit(result.ok ? 0 : 1);\n}\n\nfunction isCliEntryPoint() {\n try {\n return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1] ?? \"\");\n } catch {\n return false;\n }\n}\n"],"mappings":";;;AAAA,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAE9B,eAAsB,kBAAkB,OAAO,QAAQ,KAAK,MAAM,CAAC,GAAG;AACpE,QAAM,OAAO,oBAAoB,IAAI;AACrC,QAAM,OAAO,eAAe,IAAI,EAAE,CAAC,KAAK;AACxC,QAAM,iBAAiB,KAAK,OAAO,CAAC,KAAK,UAAU,IAAI,WAAW,IAAI,KAAK,KAAK,QAAQ,CAAC,GAAG,WAAW,IAAI,CAAC;AAC5G,SAAO,OAAO,CAAC,OAAO,QAAQ,MAAM,GAAG,cAAc,CAAC;AACxD;AAEA,SAAS,oBAAoB,MAA0B;AACrD,SAAO,KAAK,OAAO,CAAC,QAAQ,QAAQ,IAAI;AAC1C;AAEA,SAAS,eAAe,MAA0B;AAChD,SAAO,KAAK,OAAO,CAAC,KAAK,UAAU,CAAC,IAAI,WAAW,IAAI,KAAK,CAAC,KAAK,QAAQ,CAAC,GAAG,WAAW,IAAI,CAAC;AAChG;AAEA,IAAI,gBAAgB,GAAG;AACrB,QAAM,SAAS,MAAM,kBAAkB;AACvC,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,CAAI;AAC3D,UAAQ,KAAK,OAAO,KAAK,IAAI,CAAC;AAChC;AAEA,SAAS,kBAAkB;AACzB,MAAI;AACF,WAAO,aAAa,cAAc,YAAY,GAAG,CAAC,MAAM,aAAa,QAAQ,KAAK,CAAC,KAAK,EAAE;AAAA,EAC5F,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hyprcart/create-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Bootstrap a standalone Hyprcart app project.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"create-app": "./dist/index.js",
|
|
17
|
+
"create-hyprcart-app": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@hyprcart/cli": "1.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.10.5",
|
|
32
|
+
"tsup": "^8.3.5",
|
|
33
|
+
"typescript": "^5.7.2",
|
|
34
|
+
"vitest": "^4.0.18",
|
|
35
|
+
"@repo/typescript-config": "0.0.1"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup && node -e \"const fs=require('fs');const p='dist/index.js';fs.chmodSync(p,0o755)\"",
|
|
39
|
+
"dev": "tsup --watch",
|
|
40
|
+
"lint": "tsc --noEmit",
|
|
41
|
+
"type-check": "tsc --noEmit",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"clean": "rm -rf dist .turbo"
|
|
44
|
+
}
|
|
45
|
+
}
|