reacticx 0.1.1

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 +52 -0
  2. package/dist/index.js +16 -0
  3. package/package.json +39 -0
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ <div align="center">
2
+ <img src="https://i.postimg.cc/5y1vMLJs/reacticx-trademark-without-trademark.png" alt="Reacticx Poster" width="800" />
3
+ </div>
4
+
5
+ <h1 align="center">
6
+ <a href="https://github.com/rit3zh/reacticx" target="_blank" rel="noopener noreferrer">
7
+ 💅
8
+ </a>
9
+ </h1>
10
+
11
+ <p align="center">
12
+ Beautiful React Native components. One command away.
13
+ </p>
14
+
15
+ <div align="center">
16
+ <p>
17
+ <a href="https://www.npmjs.com/package/reacticx">
18
+ <img src="https://img.shields.io/npm/v/reacticx.svg?style=flat-square" alt="npm version" />
19
+ </a>
20
+ <a href="https://www.npmjs.com/package/reacticx">
21
+ <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License" />
22
+ </a>
23
+ <a href="https://www.npmjs.com/package/reacticx">
24
+ <img src="https://img.shields.io/badge/build-passing-brightgreen.svg" alt="Build Status" />
25
+ </a>
26
+ <a href="https://github.com/rit3zh/reacticx/blob/main/LICENSE">
27
+ <img src="https://img.shields.io/badge/PRs-welcome-purple.svg" alt="PRs Welcome" />
28
+ </a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <img src="http://forthebadge.com/images/badges/built-with-love.svg" alt="Built with love" width="120px" />
33
+ </p>
34
+ </div>
35
+
36
+ ## 📚 Documentation
37
+
38
+ Visit our [documentation](https://glow-ui.vercel.app/) to learn more about our components and how to use them.
39
+
40
+ ## 🤝 Contributing
41
+
42
+ We welcome contributions! Please read our [contributing guidelines](CONTRIBUTING.md) to get started.
43
+
44
+ ## 📝 License
45
+
46
+ MIT © [rit3zh](https://github.com/rit3zh)
47
+
48
+ ---
49
+
50
+ <p align="center">
51
+ Made with ❤️ for the React Native community
52
+ </p>
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import{Command as J}from"commander";import C from"fs-extra";import j from"path";import n from"chalk";import A from"ora";var $="https://reacticx-ui-components.pages.dev";async function u(){let o=await fetch(`${$}/registry.json`);if(!o.ok)throw new Error("Failed to fetch registry");return o.json()}async function D(o,t){let e=o.replace(/^src\/components\//,""),s=`${$}/${e}/${t}`,i=await fetch(s);if(!i.ok)throw new Error(`Failed to fetch ${t}`);return i.text()}import m from"fs-extra";import h from"path";import w from"chalk";var x="component.config.json";async function O(){let o=h.join(process.cwd(),x);if(!await m.pathExists(o))return null;let t=await m.readJson(o);return t.outDir||(console.log(w.red(`
3
+ \u274C Invalid ${x}: missing "outDir" field`)),console.log(w.dim(`
4
+ Example config:`)),console.log(w.dim(JSON.stringify({outDir:"src/shared/ui"},null,2))),process.exit(1)),t}async function R(o){let t=h.join(process.cwd(),o);await m.pathExists(t)||await m.ensureDir(t)}async function b(o="src/shared/ui"){let t=h.join(process.cwd(),x),e={outDir:o};await m.writeJson(t,e,{spaces:2})}async function E(o,t){let e=await O();!e&&!t.dir&&(console.log(n.red(`
5
+ \u274C No component.config.json found`)),console.log(n.dim(`
6
+ Create one in your project root:`)),console.log(n.cyan(JSON.stringify({outDir:"src/shared/ui"},null,2))),console.log(n.dim(`
7
+ Or use --dir flag:`)),console.log(n.cyan(` npx reacticx add ${o} --dir src/components`)),process.exit(1));let s=t.dir||e.outDir,i=A(`Fetching ${o}...`).start();try{let r=await u(),c=r.components[o];if(!c){i.fail(n.red(`Component "${o}" not found`)),console.log(n.yellow(`
8
+ Available components:`));let a=Object.keys(r.components).sort().filter(l=>l.toLowerCase().includes(o.toLowerCase()));a.length>0?(console.log(n.dim("Did you mean:")),a.slice(0,5).forEach(l=>console.log(` - ${l}`))):console.log(n.dim('Run "npx reacticx list" to see all components')),process.exit(1)}i.text=`Adding ${o}...`,await R(s);let y=j.join(process.cwd(),s,c.category,o);await C.pathExists(y)&&!t.overwrite&&(i.warn(n.yellow(`${o} already exists. Use --overwrite to replace.`)),process.exit(1)),await C.ensureDir(y);let v=[];for(let g of c.files){let a=await D(c.path,g),l=j.join(y,g);await C.writeFile(l,a,"utf-8"),v.push(l)}i.succeed(n.green(`Added ${o}!`)),console.log(n.dim(`
9
+ Files created:`)),v.forEach(g=>{let a=j.relative(process.cwd(),g);console.log(n.dim(` ${a}`))}),console.log()}catch(r){i.fail(n.red(`Failed to add ${o}`)),console.error(r),process.exit(1)}}import p from"chalk";import I from"ora";async function F(o){let t=I("Fetching components...").start();try{let e=await u();t.stop(),console.log(p.bold(`
10
+ \u{1F4E6} Reacticx UI Components (v${e.version})
11
+ `)),console.log(p.dim(`Total: ${e.totalComponents} components
12
+ `));let s={};for(let[i,r]of Object.entries(e.components))o.category&&r.category!==o.category||(s[r.category]||(s[r.category]=[]),s[r.category].push(i));for(let[i,r]of Object.entries(s).sort())console.log(p.cyan.bold(`${i}/`)),r.sort().forEach(c=>{console.log(p.white(` ${c}`))}),console.log();console.log(p.dim("Run `npx reacticx add <component>` to add a component\n"))}catch(e){t.fail(p.red("Failed to fetch components")),console.error(e),process.exit(1)}}import d from"chalk";import P from"prompts";import L from"fs-extra";import T from"path";async function k(){console.log(d.bold(`
13
+ \u{1F680} Initialize Reacticx
14
+ `));let o=T.join(process.cwd(),"component.config.json");if(await L.pathExists(o)){let{overwrite:e}=await P({type:"confirm",name:"overwrite",message:"component.config.json already exists. Overwrite?",initial:!1});e||(console.log(d.yellow("Cancelled")),process.exit(0))}let t=await P([{type:"text",name:"outDir",message:"Where do you want to install components?",initial:"src/shared/ui"}]);t.outDir||(console.log(d.yellow("Cancelled")),process.exit(0)),await b(t.outDir),console.log(d.green(`
15
+ \u2705 Created component.config.json`)),console.log(d.dim(`
16
+ You can now run:`)),console.log(d.cyan(" npx reacticx add button")),console.log()}var f=new J;f.name("reacticx").description("Add beautiful React Native components to your project").version("0.1.0");f.command("init").description("Initialize reacticx in your project").action(k);f.command("list").description("List all available components").option("-c, --category <category>","Filter by category").action(F);f.command("add").description("Add a component to your project").argument("<component>","Component name to add").option("-o, --overwrite","Overwrite existing files",!1).option("-d, --dir <directory>","Target directory").action(E);f.parse();
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "reacticx",
3
+ "version": "0.1.1",
4
+ "description": "Add beautiful React Native components to your project",
5
+ "type": "module",
6
+ "bin": {
7
+ "reacticx": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsup",
14
+ "dev": "tsup src/index.ts --format esm --watch",
15
+ "start": "node dist/index.js"
16
+ },
17
+ "devDependencies": {
18
+ "@types/fs-extra": "^11.0.4",
19
+ "@types/node": "^20.0.0",
20
+ "@types/prompts": "^2.4.9",
21
+ "terser": "^5.46.0",
22
+ "tsup": "^8.0.0",
23
+ "typescript": "^5.0.0"
24
+ },
25
+ "dependencies": {
26
+ "chalk": "^5.3.0",
27
+ "commander": "^12.0.0",
28
+ "fs-extra": "^11.2.0",
29
+ "ora": "^8.0.0",
30
+ "prompts": "^2.4.2"
31
+ },
32
+ "keywords": [
33
+ "react-native",
34
+ "components",
35
+ "ui",
36
+ "cli"
37
+ ],
38
+ "license": "MIT"
39
+ }