@cnpx/cnpx 0.0.2-dev.20260403062651 → 0.0.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/.turbo/turbo-build.log +49 -10
- package/README.md +110 -2
- package/out/bin.d.mts +1 -0
- package/out/bin.d.ts +1 -0
- package/out/bin.js +2 -0
- package/out/bin.mjs +2 -0
- package/out/checkForUpdate.d.mts +3 -0
- package/out/checkForUpdate.d.ts +3 -0
- package/out/checkForUpdate.js +2 -0
- package/out/checkForUpdate.mjs +2 -0
- package/out/chunk-A7RKGLUR.mjs +1 -0
- package/out/clone.d.mts +3 -0
- package/out/clone.d.ts +3 -0
- package/out/clone.js +1 -0
- package/out/clone.mjs +1 -0
- package/out/fetch.d.mts +6 -0
- package/out/fetch.d.ts +6 -0
- package/out/fetch.js +1 -0
- package/out/fetch.mjs +1 -0
- package/out/getCategories.d.mts +6 -0
- package/out/getCategories.d.ts +6 -0
- package/out/getCategories.js +2 -0
- package/out/getCategories.mjs +2 -0
- package/out/getPackageManager.d.mts +3 -0
- package/out/getPackageManager.d.ts +3 -0
- package/out/getPackageManager.js +1 -0
- package/out/getPackageManager.mjs +1 -0
- package/out/getTemplates.d.mts +5 -0
- package/out/getTemplates.d.ts +5 -0
- package/out/getTemplates.js +2 -0
- package/out/getTemplates.mjs +2 -0
- package/out/index.d.mts +9 -1
- package/out/index.d.ts +9 -1
- package/out/index.js +1 -65
- package/out/index.mjs +1 -39
- package/out/main.d.mts +3 -0
- package/out/main.d.ts +3 -0
- package/out/main.js +4 -0
- package/out/main.mjs +4 -0
- package/out/type.d.mts +24 -0
- package/out/type.d.ts +24 -0
- package/out/type.js +1 -0
- package/out/type.mjs +0 -0
- package/package.json +7 -12
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,20 +1,59 @@
|
|
|
1
1
|
|
|
2
|
-
> @cnpx/cnpx@0.0.2 build /home/runner/work/template/template/cnpx/
|
|
2
|
+
> @cnpx/cnpx@0.0.2 build /home/runner/work/template/template/cnpx/cnpx
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
5
|
+
[34mCLI[39m Building entry: src/bin.ts, src/checkForUpdate.ts, src/clone.ts, src/fetch.ts, src/getCategories.ts, src/getPackageManager.ts, src/getTemplates.ts, src/index.ts, src/main.ts, src/type.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
|
-
[34mCLI[39m Using tsup config: /home/runner/work/template/template/cnpx/
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/template/template/cnpx/cnpx/tsup.config.ts
|
|
9
9
|
[34mCLI[39m Target: esnext
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
12
|
[34mESM[39m Build start
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
[
|
|
16
|
-
[
|
|
13
|
+
Generated an empty chunk: "type".
|
|
14
|
+
Generated an empty chunk: "type".
|
|
15
|
+
[32mESM[39m [1mout/type.mjs [22m[32m0 B[39m
|
|
16
|
+
[32mESM[39m [1mout/bin.mjs [22m[32m227.00 B[39m
|
|
17
|
+
[32mESM[39m [1mout/clone.mjs [22m[32m300.00 B[39m
|
|
18
|
+
[32mESM[39m [1mout/fetch.mjs [22m[32m128.00 B[39m
|
|
19
|
+
[32mESM[39m [1mout/checkForUpdate.mjs [22m[32m1.36 KB[39m
|
|
20
|
+
[32mESM[39m [1mout/main.mjs [22m[32m1.42 KB[39m
|
|
21
|
+
[32mESM[39m [1mout/getPackageManager.mjs [22m[32m312.00 B[39m
|
|
22
|
+
[32mESM[39m [1mout/getTemplates.mjs [22m[32m589.00 B[39m
|
|
23
|
+
[32mESM[39m [1mout/getCategories.mjs [22m[32m659.00 B[39m
|
|
24
|
+
[32mESM[39m [1mout/index.mjs [22m[32m268.00 B[39m
|
|
25
|
+
[32mESM[39m [1mout/chunk-A7RKGLUR.mjs [22m[32m77.00 B[39m
|
|
26
|
+
[32mESM[39m ⚡️ Build success in 190ms
|
|
27
|
+
[32mCJS[39m [1mout/bin.js [22m[32m267.00 B[39m
|
|
28
|
+
[32mCJS[39m [1mout/clone.js [22m[32m417.00 B[39m
|
|
29
|
+
[32mCJS[39m [1mout/fetch.js [22m[32m109.00 B[39m
|
|
30
|
+
[32mCJS[39m [1mout/checkForUpdate.js [22m[32m1.44 KB[39m
|
|
31
|
+
[32mCJS[39m [1mout/getCategories.js [22m[32m659.00 B[39m
|
|
32
|
+
[32mCJS[39m [1mout/getPackageManager.js [22m[32m342.00 B[39m
|
|
33
|
+
[32mCJS[39m [1mout/index.js [22m[32m1.98 KB[39m
|
|
34
|
+
[32mCJS[39m [1mout/getTemplates.js [22m[32m584.00 B[39m
|
|
35
|
+
[32mCJS[39m [1mout/main.js [22m[32m1.57 KB[39m
|
|
36
|
+
[32mCJS[39m [1mout/type.js [22m[32m13.00 B[39m
|
|
37
|
+
[32mCJS[39m ⚡️ Build success in 192ms
|
|
17
38
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mout/
|
|
20
|
-
[32mDTS[39m [1mout/index.d.
|
|
39
|
+
[32mDTS[39m ⚡️ Build success in 1253ms
|
|
40
|
+
[32mDTS[39m [1mout/bin.d.ts [22m[32m20.00 B[39m
|
|
41
|
+
[32mDTS[39m [1mout/index.d.ts [22m[32m454.00 B[39m
|
|
42
|
+
[32mDTS[39m [1mout/checkForUpdate.d.ts [22m[32m78.00 B[39m
|
|
43
|
+
[32mDTS[39m [1mout/clone.d.ts [22m[32m104.00 B[39m
|
|
44
|
+
[32mDTS[39m [1mout/fetch.d.ts [22m[32m101.00 B[39m
|
|
45
|
+
[32mDTS[39m [1mout/getCategories.d.ts [22m[32m210.00 B[39m
|
|
46
|
+
[32mDTS[39m [1mout/getPackageManager.d.ts [22m[32m94.00 B[39m
|
|
47
|
+
[32mDTS[39m [1mout/getTemplates.d.ts [22m[32m154.00 B[39m
|
|
48
|
+
[32mDTS[39m [1mout/main.d.ts [22m[32m63.00 B[39m
|
|
49
|
+
[32mDTS[39m [1mout/type.d.ts [22m[32m477.00 B[39m
|
|
50
|
+
[32mDTS[39m [1mout/bin.d.mts [22m[32m20.00 B[39m
|
|
51
|
+
[32mDTS[39m [1mout/index.d.mts [22m[32m462.00 B[39m
|
|
52
|
+
[32mDTS[39m [1mout/checkForUpdate.d.mts [22m[32m78.00 B[39m
|
|
53
|
+
[32mDTS[39m [1mout/clone.d.mts [22m[32m104.00 B[39m
|
|
54
|
+
[32mDTS[39m [1mout/fetch.d.mts [22m[32m101.00 B[39m
|
|
55
|
+
[32mDTS[39m [1mout/getCategories.d.mts [22m[32m211.00 B[39m
|
|
56
|
+
[32mDTS[39m [1mout/getPackageManager.d.mts [22m[32m94.00 B[39m
|
|
57
|
+
[32mDTS[39m [1mout/getTemplates.d.mts [22m[32m155.00 B[39m
|
|
58
|
+
[32mDTS[39m [1mout/main.d.mts [22m[32m63.00 B[39m
|
|
59
|
+
[32mDTS[39m [1mout/type.d.mts [22m[32m477.00 B[39m
|
package/README.md
CHANGED
|
@@ -1,3 +1,111 @@
|
|
|
1
|
-
# cnpx
|
|
1
|
+
# @cnpx/cnpx
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://discord.gg/FaCCaFM74Q)
|
|
4
|
+
[](https://github.com/xcfio/template/actions)
|
|
5
|
+
[](https://www.npmjs.com/package/@cnpx/cnpx)
|
|
6
|
+
[](https://www.npmjs.com/package/@cnpx/cnpx)
|
|
7
|
+
[](https://www.npmjs.com/package/@cnpx/cnpx)
|
|
8
|
+
[](https://github.com/xcfio/template/blob/main/LICENSE)
|
|
9
|
+
|
|
10
|
+
`@cnpx/cnpx` is an interactive CLI that scaffolds projects from the
|
|
11
|
+
[`xcfio/template`](https://github.com/xcfio/template) repository.
|
|
12
|
+
|
|
13
|
+
It fetches available categories and templates from GitHub, clones your selected
|
|
14
|
+
template into a local directory, and prints the next commands to run.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Interactive prompts for project name, category, and template
|
|
19
|
+
- Live template discovery from `xcfio/template`
|
|
20
|
+
- Automatic package manager detection (`pnpm`, `yarn`, then `npm`)
|
|
21
|
+
- Update notification when a newer package version exists on npm
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
- Node.js 22+
|
|
26
|
+
- Internet access (GitHub API + npm registry)
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
Run directly without installing globally:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx @cnpx/cnpx
|
|
34
|
+
# or
|
|
35
|
+
pnpm dlx @cnpx/cnpx
|
|
36
|
+
# or
|
|
37
|
+
yarn dlx @cnpx/cnpx
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then follow the prompts:
|
|
41
|
+
|
|
42
|
+
1. Enter project name
|
|
43
|
+
2. Select a category (for example: `backend`, `frontend`)
|
|
44
|
+
3. Select a template
|
|
45
|
+
4. Confirm creation
|
|
46
|
+
|
|
47
|
+
After scaffold, the CLI prints:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cd <project-name>
|
|
51
|
+
<detected-package-manager> install
|
|
52
|
+
node --run dev
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Global Install (Optional)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm i -g @cnpx/cnpx
|
|
59
|
+
cnpx
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Programmatic API
|
|
63
|
+
|
|
64
|
+
This package also exports utility functions:
|
|
65
|
+
|
|
66
|
+
- `main()`
|
|
67
|
+
- `checkForUpdate()`
|
|
68
|
+
- `clone(name, category, template)`
|
|
69
|
+
- `getCategories()`
|
|
70
|
+
- `getTemplates(category)`
|
|
71
|
+
- `getPackageManager()`
|
|
72
|
+
- `get(url)`
|
|
73
|
+
|
|
74
|
+
Type exports:
|
|
75
|
+
|
|
76
|
+
- `FilteredGithubResponse`
|
|
77
|
+
- `GithubAPIResponse`
|
|
78
|
+
|
|
79
|
+
## Development
|
|
80
|
+
|
|
81
|
+
From `cnpx/cnpx`:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
node --run install
|
|
85
|
+
node --run dev
|
|
86
|
+
node --run build
|
|
87
|
+
node --run test
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Available scripts:
|
|
91
|
+
|
|
92
|
+
- `node --run fmt` - format source with Prettier
|
|
93
|
+
- `node --run lint` - check formatting
|
|
94
|
+
- `node --run dev` - build in watch mode with tsup
|
|
95
|
+
- `node --run build` - production build
|
|
96
|
+
- `node --run test` - type-check with `tsc --noEmit`
|
|
97
|
+
|
|
98
|
+
## Notes and Limitations
|
|
99
|
+
|
|
100
|
+
- The CLI is currently fully interactive and does not expose command-line flags.
|
|
101
|
+
- GitHub API rate limits can block category/template loading.
|
|
102
|
+
- Template cloning currently uses `force: true`; existing files in the target
|
|
103
|
+
directory may be overwritten.
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
Made with ❤️ by [xcfio](https://github.com/xcfio)
|
package/out/bin.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/out/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/out/bin.js
ADDED
package/out/bin.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var getPackageManager=require('./getPackageManager'),package_json=require('../package.json'),prompts=require('@clack/prompts'),colorette=require('colorette'),fetch=require('./fetch');function f(n){const t=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(n);return t?{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),pre:t[4]?t[4].split("."):[]}:null}function h(n,t){const r=/^\d+$/.test(n),e=/^\d+$/.test(t);if(r&&e){const o=Number(n),i=Number(t);return o<i?-1:o>i?1:0}return r&&!e?-1:!r&&e?1:n<t?-1:n>t?1:0}function b(n,t){const r=f(n),e=f(t);if(!r||!e)return n.localeCompare(t,void 0,{numeric:true,sensitivity:"base"});if(r.major!==e.major)return r.major<e.major?-1:1;if(r.minor!==e.minor)return r.minor<e.minor?-1:1;if(r.patch!==e.patch)return r.patch<e.patch?-1:1;if(r.pre.length===0&&e.pre.length===0)return 0;if(r.pre.length===0)return 1;if(e.pre.length===0)return -1;const o=Math.max(r.pre.length,e.pre.length);for(let i=0;i<o;i++){const u=r.pre[i],a=e.pre[i];if(u===void 0)return -1;if(a===void 0)return 1;const m=h(u,a);if(m!==0)return m}return 0}async function P(){try{const{data:n}=await fetch.get(`https://registry.npmjs.org/${package_json.name}/latest`);if(b(n.version,package_json.version)<=0)return;prompts.note(`Current: ${colorette.bold(package_json.version)} \u2192 Latest: ${colorette.bold(n.version)}
|
|
2
|
+
Run: ${getPackageManager.getPackageManager()} i -g ${package_json.name}`,"Update available");}catch{}}exports.checkForUpdate=P;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./chunk-A7RKGLUR.mjs';import {getPackageManager}from'./getPackageManager';import {name,version}from'../package.json';import {note}from'@clack/prompts';import {bold}from'colorette';import {get}from'./fetch';function f(n){const t=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(n);return t?{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),pre:t[4]?t[4].split("."):[]}:null}function h(n,t){const r=/^\d+$/.test(n),e=/^\d+$/.test(t);if(r&&e){const o=Number(n),i=Number(t);return o<i?-1:o>i?1:0}return r&&!e?-1:!r&&e?1:n<t?-1:n>t?1:0}function b(n,t){const r=f(n),e=f(t);if(!r||!e)return n.localeCompare(t,void 0,{numeric:true,sensitivity:"base"});if(r.major!==e.major)return r.major<e.major?-1:1;if(r.minor!==e.minor)return r.minor<e.minor?-1:1;if(r.patch!==e.patch)return r.patch<e.patch?-1:1;if(r.pre.length===0&&e.pre.length===0)return 0;if(r.pre.length===0)return 1;if(e.pre.length===0)return -1;const o=Math.max(r.pre.length,e.pre.length);for(let i=0;i<o;i++){const u=r.pre[i],a=e.pre[i];if(u===void 0)return -1;if(a===void 0)return 1;const m=h(u,a);if(m!==0)return m}return 0}async function P(){try{const{data:n}=await get(`https://registry.npmjs.org/${name}/latest`);if(b(n.version,version)<=0)return;note(`Current: ${bold(version)} \u2192 Latest: ${bold(n.version)}
|
|
2
|
+
Run: ${getPackageManager()} i -g ${name}`,"Update available");}catch{}}export{P as checkForUpdate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);export{c as a};
|
package/out/clone.d.mts
ADDED
package/out/clone.d.ts
ADDED
package/out/clone.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var prompts=require('@clack/prompts'),i=require('degit');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var i__default=/*#__PURE__*/_interopDefault(i);async function l(e,r,o){const t=prompts.spinner();t.start("Cloning repository"),await i__default.default(`xcfio/template/${r}/${o}`,{cache:true,force:true,verbose:true}).clone(e),t.stop("Template cloned successfully");}exports.clone=l;
|
package/out/clone.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'./chunk-A7RKGLUR.mjs';import {spinner}from'@clack/prompts';import i from'degit';async function l(e,r,o){const t=spinner();t.start("Cloning repository"),await i(`xcfio/template/${r}/${o}`,{cache:true,force:true,verbose:true}).clone(e),t.stop("Template cloned successfully");}export{l as clone};
|
package/out/fetch.d.mts
ADDED
package/out/fetch.d.ts
ADDED
package/out/fetch.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';async function n(a){const t=await fetch(a),e=await t.json();return {req:t,data:e}}exports.get=n;
|
package/out/fetch.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'./chunk-A7RKGLUR.mjs';async function n(a){const t=await fetch(a),e=await t.json();return {req:t,data:e}}export{n as get};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var prompts=require('@clack/prompts'),fetch=require('./fetch');const n=new Set([".github","cnpx"]);async function d(){const t=prompts.spinner();t.start("Fetching Categories");const{data:r}=await fetch.get("https://api.github.com/repos/xcfio/template/contents?ref=main");"message"in r&&(r.message.startsWith("API rate limit exceeded")?t.error("API rate limit exceeded. Please try again later."):(t.error("An unknown error occurred"),console.log(r.message),console.trace()),process.exit(1));const o=r.filter(e=>e.type==="dir"&&!n.has(e.name)).map(e=>({name:e.name,url:e.url}));return t.clear(),o}
|
|
2
|
+
exports.IgnoredDirectory=n;exports.getCategories=d;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./chunk-A7RKGLUR.mjs';import {spinner}from'@clack/prompts';import {get}from'./fetch';const n=new Set([".github","cnpx"]);async function d(){const t=spinner();t.start("Fetching Categories");const{data:r}=await get("https://api.github.com/repos/xcfio/template/contents?ref=main");"message"in r&&(r.message.startsWith("API rate limit exceeded")?t.error("API rate limit exceeded. Please try again later."):(t.error("An unknown error occurred"),console.log(r.message),console.trace()),process.exit(1));const o=r.filter(e=>e.type==="dir"&&!n.has(e.name)).map(e=>({name:e.name,url:e.url}));return t.clear(),o}
|
|
2
|
+
export{n as IgnoredDirectory,d as getCategories};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var node_child_process=require('node:child_process');let n;function p(){if(n)return n;try{return node_child_process.execSync("pnpm --version",{stdio:"ignore"}),n="pnpm","pnpm"}catch{}try{return node_child_process.execSync("yarn --version",{stdio:"ignore"}),n="yarn","yarn"}catch{}return n="npm","npm"}exports.getPackageManager=p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'./chunk-A7RKGLUR.mjs';import {execSync}from'node:child_process';let n;function p(){if(n)return n;try{return execSync("pnpm --version",{stdio:"ignore"}),n="pnpm","pnpm"}catch{}try{return execSync("yarn --version",{stdio:"ignore"}),n="yarn","yarn"}catch{}return n="npm","npm"}export{p as getPackageManager};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var prompts=require('@clack/prompts'),fetch=require('./fetch');async function f(s){const e=prompts.spinner();e.start("Fetching Templates");const{data:t}=await fetch.get(`https://api.github.com/repos/xcfio/template/contents/${s}?ref=main`);"message"in t&&(t.message.startsWith("API rate limit exceeded")?e.error("API rate limit exceeded. Please try again later."):(e.error("An unknown error occurred"),console.log(t.message),console.trace()),process.exit(1));const i=t.filter(r=>r.type==="dir").map(r=>({name:r.name,url:r.url}));return e.clear(),i}
|
|
2
|
+
exports.getTemplates=f;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./chunk-A7RKGLUR.mjs';import {spinner}from'@clack/prompts';import {get}from'./fetch';async function f(s){const e=spinner();e.start("Fetching Templates");const{data:t}=await get(`https://api.github.com/repos/xcfio/template/contents/${s}?ref=main`);"message"in t&&(t.message.startsWith("API rate limit exceeded")?e.error("API rate limit exceeded. Please try again later."):(e.error("An unknown error occurred"),console.log(t.message),console.trace()),process.exit(1));const i=t.filter(r=>r.type==="dir").map(r=>({name:r.name,url:r.url}));return e.clear(),i}
|
|
2
|
+
export{f as getTemplates};
|
package/out/index.d.mts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
export { checkForUpdate } from './checkForUpdate.mjs';
|
|
2
|
+
export { clone } from './clone.mjs';
|
|
3
|
+
export { get } from './fetch.mjs';
|
|
4
|
+
export { IgnoredDirectory, getCategories } from './getCategories.mjs';
|
|
5
|
+
export { getPackageManager } from './getPackageManager.mjs';
|
|
6
|
+
export { getTemplates } from './getTemplates.mjs';
|
|
7
|
+
export { main } from './main.mjs';
|
|
8
|
+
export { FilteredGithubResponse, GithubAPIResponse } from './type.mjs';
|
|
9
|
+
|
|
2
10
|
var version = "0.0.2";
|
|
3
11
|
|
|
4
12
|
export { version };
|
package/out/index.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
export { checkForUpdate } from './checkForUpdate.js';
|
|
2
|
+
export { clone } from './clone.js';
|
|
3
|
+
export { get } from './fetch.js';
|
|
4
|
+
export { IgnoredDirectory, getCategories } from './getCategories.js';
|
|
5
|
+
export { getPackageManager } from './getPackageManager.js';
|
|
6
|
+
export { getTemplates } from './getTemplates.js';
|
|
7
|
+
export { main } from './main.js';
|
|
8
|
+
export { FilteredGithubResponse, GithubAPIResponse } from './type.js';
|
|
9
|
+
|
|
2
10
|
var version = "0.0.2";
|
|
3
11
|
|
|
4
12
|
export { version };
|
package/out/index.js
CHANGED
|
@@ -1,65 +1 @@
|
|
|
1
|
-
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/index.ts
|
|
22
|
-
var index_exports = {};
|
|
23
|
-
__export(index_exports, {
|
|
24
|
-
version: () => version
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
|
|
28
|
-
// package.json
|
|
29
|
-
var version = "0.0.2";
|
|
30
|
-
|
|
31
|
-
// src/index.ts
|
|
32
|
-
var import_prompts = require("@clack/prompts");
|
|
33
|
-
var import_colorette = require("colorette");
|
|
34
|
-
async function main() {
|
|
35
|
-
(0, import_prompts.intro)((0, import_colorette.blue)("Create a new project"));
|
|
36
|
-
const name = await (0, import_prompts.text)({ message: "Project Name", placeholder: "Cool" });
|
|
37
|
-
if ((0, import_prompts.isCancel)(name)) {
|
|
38
|
-
(0, import_prompts.cancel)("Operation cancelled");
|
|
39
|
-
return process.exit(0);
|
|
40
|
-
}
|
|
41
|
-
const projectType = await (0, import_prompts.select)({
|
|
42
|
-
message: "Pick a project type.",
|
|
43
|
-
options: [
|
|
44
|
-
{ value: "ts", label: "TypeScript" },
|
|
45
|
-
{ value: "js", label: "JavaScript" },
|
|
46
|
-
{ value: "coffee", label: "CoffeeScript", hint: "oh no" }
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
if ((0, import_prompts.isCancel)(projectType)) {
|
|
50
|
-
(0, import_prompts.cancel)("Operation cancelled");
|
|
51
|
-
return process.exit(0);
|
|
52
|
-
}
|
|
53
|
-
const s = (0, import_prompts.spinner)();
|
|
54
|
-
s.start("Installing via npm");
|
|
55
|
-
s.stop("Installed via npm");
|
|
56
|
-
(0, import_prompts.outro)("You're all set!");
|
|
57
|
-
}
|
|
58
|
-
main().catch((err) => {
|
|
59
|
-
console.error(err);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
});
|
|
62
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
-
0 && (module.exports = {
|
|
64
|
-
version
|
|
65
|
-
});
|
|
1
|
+
'use strict';var package_json=require('../package.json'),checkForUpdate=require('./checkForUpdate'),clone=require('./clone'),fetch=require('./fetch'),getCategories=require('./getCategories'),getPackageManager=require('./getPackageManager'),getTemplates=require('./getTemplates'),main=require('./main'),type=require('./type');Object.defineProperty(exports,"version",{enumerable:true,get:function(){return package_json.version}});Object.keys(checkForUpdate).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return checkForUpdate[k]}})});Object.keys(clone).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return clone[k]}})});Object.keys(fetch).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return fetch[k]}})});Object.keys(getCategories).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return getCategories[k]}})});Object.keys(getPackageManager).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return getPackageManager[k]}})});Object.keys(getTemplates).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return getTemplates[k]}})});Object.keys(main).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return main[k]}})});Object.keys(type).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return type[k]}})});
|
package/out/index.mjs
CHANGED
|
@@ -1,39 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// package.json
|
|
4
|
-
var version = "0.0.2";
|
|
5
|
-
|
|
6
|
-
// src/index.ts
|
|
7
|
-
import { intro, outro, select, spinner, isCancel, cancel, text } from "@clack/prompts";
|
|
8
|
-
import { blue } from "colorette";
|
|
9
|
-
async function main() {
|
|
10
|
-
intro(blue("Create a new project"));
|
|
11
|
-
const name = await text({ message: "Project Name", placeholder: "Cool" });
|
|
12
|
-
if (isCancel(name)) {
|
|
13
|
-
cancel("Operation cancelled");
|
|
14
|
-
return process.exit(0);
|
|
15
|
-
}
|
|
16
|
-
const projectType = await select({
|
|
17
|
-
message: "Pick a project type.",
|
|
18
|
-
options: [
|
|
19
|
-
{ value: "ts", label: "TypeScript" },
|
|
20
|
-
{ value: "js", label: "JavaScript" },
|
|
21
|
-
{ value: "coffee", label: "CoffeeScript", hint: "oh no" }
|
|
22
|
-
]
|
|
23
|
-
});
|
|
24
|
-
if (isCancel(projectType)) {
|
|
25
|
-
cancel("Operation cancelled");
|
|
26
|
-
return process.exit(0);
|
|
27
|
-
}
|
|
28
|
-
const s = spinner();
|
|
29
|
-
s.start("Installing via npm");
|
|
30
|
-
s.stop("Installed via npm");
|
|
31
|
-
outro("You're all set!");
|
|
32
|
-
}
|
|
33
|
-
main().catch((err) => {
|
|
34
|
-
console.error(err);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
});
|
|
37
|
-
export {
|
|
38
|
-
version
|
|
39
|
-
};
|
|
1
|
+
import'./chunk-A7RKGLUR.mjs';export{version}from'../package.json';export*from'./checkForUpdate';export*from'./clone';export*from'./fetch';export*from'./getCategories';export*from'./getPackageManager';export*from'./getTemplates';export*from'./main';export*from'./type';
|
package/out/main.d.mts
ADDED
package/out/main.d.ts
ADDED
package/out/main.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
'use strict';var prompts=require('@clack/prompts'),getPackageManager=require('./getPackageManager'),checkForUpdate=require('./checkForUpdate'),getCategories=require('./getCategories'),colorette=require('colorette'),getTemplates=require('./getTemplates'),clone=require('./clone');async function H(){prompts.intro(colorette.blue("Create a new project"));const i=prompts.spinner();i.start("Checking for updates"),await checkForUpdate.checkForUpdate(),i.clear();const t=await prompts.text({message:"Project Name",placeholder:"my-project",defaultValue:"my-project"});if(prompts.isCancel(t))return prompts.cancel("Operation cancelled"),process.exit(0);const s=await getCategories.getCategories(),a=await prompts.select({message:"Select a category",options:s.map(e=>({name:e.name,value:e.name}))});if(prompts.isCancel(a))return prompts.cancel("Operation cancelled"),process.exit(0);const l=await getTemplates.getTemplates(a),n=await prompts.select({message:"Select a template",options:l.map(e=>({name:e.name,value:e.name}))});if(prompts.isCancel(n))return prompts.cancel("Operation cancelled"),process.exit(0);const m=await prompts.confirm({message:`Create project with name: ${colorette.bold(t)}, category: ${colorette.bold(a)}, template: ${colorette.bold(n)}?`});if(prompts.isCancel(m)||!m)return prompts.cancel("Operation cancelled"),process.exit(0);await clone.clone(t,a,n),prompts.note(`cd ${t}
|
|
2
|
+
${getPackageManager.getPackageManager()} install
|
|
3
|
+
node --run dev`,"To get started, run:"),prompts.outro(`\u2B50 Give a ${colorette.yellow("star")} on GitHub: https://github.com/xcfio/template`);}
|
|
4
|
+
exports.main=H;
|
package/out/main.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import'./chunk-A7RKGLUR.mjs';import {intro,spinner,text,isCancel,cancel,select,confirm,note,outro}from'@clack/prompts';import {getPackageManager}from'./getPackageManager';import {checkForUpdate}from'./checkForUpdate';import {getCategories}from'./getCategories';import {blue,bold,yellow}from'colorette';import {getTemplates}from'./getTemplates';import {clone}from'./clone';async function H(){intro(blue("Create a new project"));const i=spinner();i.start("Checking for updates"),await checkForUpdate(),i.clear();const t=await text({message:"Project Name",placeholder:"my-project",defaultValue:"my-project"});if(isCancel(t))return cancel("Operation cancelled"),process.exit(0);const s=await getCategories(),a=await select({message:"Select a category",options:s.map(e=>({name:e.name,value:e.name}))});if(isCancel(a))return cancel("Operation cancelled"),process.exit(0);const l=await getTemplates(a),n=await select({message:"Select a template",options:l.map(e=>({name:e.name,value:e.name}))});if(isCancel(n))return cancel("Operation cancelled"),process.exit(0);const m=await confirm({message:`Create project with name: ${bold(t)}, category: ${bold(a)}, template: ${bold(n)}?`});if(isCancel(m)||!m)return cancel("Operation cancelled"),process.exit(0);await clone(t,a,n),note(`cd ${t}
|
|
2
|
+
${getPackageManager()} install
|
|
3
|
+
node --run dev`,"To get started, run:"),outro(`\u2B50 Give a ${yellow("star")} on GitHub: https://github.com/xcfio/template`);}
|
|
4
|
+
export{H as main};
|
package/out/type.d.mts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type FilteredGithubResponse = Array<{
|
|
2
|
+
name: string;
|
|
3
|
+
url: string;
|
|
4
|
+
}>;
|
|
5
|
+
type GithubAPIResponse = {
|
|
6
|
+
message: string;
|
|
7
|
+
} | Array<{
|
|
8
|
+
name: string;
|
|
9
|
+
path: string;
|
|
10
|
+
sha: string;
|
|
11
|
+
size: number;
|
|
12
|
+
url: string;
|
|
13
|
+
html_url: string;
|
|
14
|
+
git_url: string;
|
|
15
|
+
download_url: null | string;
|
|
16
|
+
type: "dir" | "file";
|
|
17
|
+
_links: {
|
|
18
|
+
self: string;
|
|
19
|
+
git: string;
|
|
20
|
+
html: string;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
export type { FilteredGithubResponse, GithubAPIResponse };
|
package/out/type.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type FilteredGithubResponse = Array<{
|
|
2
|
+
name: string;
|
|
3
|
+
url: string;
|
|
4
|
+
}>;
|
|
5
|
+
type GithubAPIResponse = {
|
|
6
|
+
message: string;
|
|
7
|
+
} | Array<{
|
|
8
|
+
name: string;
|
|
9
|
+
path: string;
|
|
10
|
+
sha: string;
|
|
11
|
+
size: number;
|
|
12
|
+
url: string;
|
|
13
|
+
html_url: string;
|
|
14
|
+
git_url: string;
|
|
15
|
+
download_url: null | string;
|
|
16
|
+
type: "dir" | "file";
|
|
17
|
+
_links: {
|
|
18
|
+
self: string;
|
|
19
|
+
git: string;
|
|
20
|
+
html: string;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
export type { FilteredGithubResponse, GithubAPIResponse };
|
package/out/type.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
package/out/type.mjs
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cnpx/cnpx",
|
|
3
|
-
"version": "0.0.2
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "xcfio",
|
|
6
|
-
"homepage": "https://github.com/xcfio/template/tree/main/cnpx/
|
|
6
|
+
"homepage": "https://github.com/xcfio/template/tree/main/cnpx/cnpx#readme",
|
|
7
7
|
"type": "commonjs",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"main": "./out/index.js",
|
|
10
10
|
"module": "./out/index.mjs",
|
|
11
11
|
"bin": {
|
|
12
|
-
"cnpx": "./out/
|
|
12
|
+
"cnpx": "./out/bin.js"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
@@ -45,18 +45,13 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/degit": "^2.8.6",
|
|
47
47
|
"@types/node": "^25.0.0",
|
|
48
|
-
"
|
|
49
|
-
"tsup": "^8.5.1",
|
|
50
|
-
"vitest": "^4.0.5"
|
|
48
|
+
"tsup": "^8.5.1"
|
|
51
49
|
},
|
|
52
50
|
"scripts": {
|
|
53
|
-
"fmt": "prettier --config=.prettierrc --write src
|
|
54
|
-
"lint": "prettier --config=.prettierrc --check src
|
|
51
|
+
"fmt": "prettier --config=.prettierrc --write src",
|
|
52
|
+
"lint": "prettier --config=.prettierrc --check src",
|
|
55
53
|
"build": "tsup",
|
|
56
54
|
"dev": "tsup --watch",
|
|
57
|
-
"test": "
|
|
58
|
-
"test:run": "vitest run",
|
|
59
|
-
"test:watch": "vitest --watch",
|
|
60
|
-
"test:ui": "vitest --ui"
|
|
55
|
+
"test": "tsc --noEmit"
|
|
61
56
|
}
|
|
62
57
|
}
|