@mockifydev/react 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/assets/devices/iPhone 13 - Midnight.png +0 -0
- package/assets/devices/iPhone 13 - Starlight.png +0 -0
- package/assets/devices/iPhone 13 Mini - Midnight.png +0 -0
- package/assets/devices/iPhone 13 Mini - Starlight.png +0 -0
- package/assets/devices/iPhone 13 Mini.png +0 -0
- package/assets/devices/iPhone 13 Pro - Graphite.png +0 -0
- package/assets/devices/iPhone 13 Pro - Silver.png +0 -0
- package/assets/devices/iPhone 13 Pro Max - Graphite.png +0 -0
- package/assets/devices/iPhone 13 Pro Max - Silver.png +0 -0
- package/assets/devices/iPhone 13 Pro Max.png +0 -0
- package/assets/devices/iPhone 13 Pro.png +0 -0
- package/assets/devices/iPhone 13.png +0 -0
- package/assets/devices/iPhone 14 - Blue.png +0 -0
- package/assets/devices/iPhone 14 - Midnight.png +0 -0
- package/assets/devices/iPhone 14 - Purple.png +0 -0
- package/assets/devices/iPhone 14 - Red.png +0 -0
- package/assets/devices/iPhone 14 - Starlight.png +0 -0
- package/assets/devices/iPhone 14 Plus - Blue.png +0 -0
- package/assets/devices/iPhone 14 Plus - Midnight.png +0 -0
- package/assets/devices/iPhone 14 Plus - Purple.png +0 -0
- package/assets/devices/iPhone 14 Plus - Red.png +0 -0
- package/assets/devices/iPhone 14 Plus - Starlight.png +0 -0
- package/assets/devices/iPhone 14 Plus.png +0 -0
- package/assets/devices/iPhone 14 Pro - Deep Purple.png +0 -0
- package/assets/devices/iPhone 14 Pro - Gold.png +0 -0
- package/assets/devices/iPhone 14 Pro - Silver.png +0 -0
- package/assets/devices/iPhone 14 Pro - Space Black.png +0 -0
- package/assets/devices/iPhone 14 Pro Max - Deep Purple.png +0 -0
- package/assets/devices/iPhone 14 Pro Max - Gold.png +0 -0
- package/assets/devices/iPhone 14 Pro Max - Silver.png +0 -0
- package/assets/devices/iPhone 14 Pro Max - Space Black.png +0 -0
- package/assets/devices/iPhone 14 Pro Max.png +0 -0
- package/assets/devices/iPhone 14 Pro.png +0 -0
- package/assets/devices/iPhone 14.png +0 -0
- package/assets/devices/iPhone 15 - Black.png +0 -0
- package/assets/devices/iPhone 15 - Blue.png +0 -0
- package/assets/devices/iPhone 15 - Green.png +0 -0
- package/assets/devices/iPhone 15 - Pink.png +0 -0
- package/assets/devices/iPhone 15 - Yellow.png +0 -0
- package/assets/devices/iPhone 15 Plus - Black.png +0 -0
- package/assets/devices/iPhone 15 Plus - Blue.png +0 -0
- package/assets/devices/iPhone 15 Plus - Green.png +0 -0
- package/assets/devices/iPhone 15 Plus - Pink.png +0 -0
- package/assets/devices/iPhone 15 Plus - Yellow.png +0 -0
- package/assets/devices/iPhone 15 Plus.png +0 -0
- package/assets/devices/iPhone 15 Pro - Black Titanium.png +0 -0
- package/assets/devices/iPhone 15 Pro - Blue Titanium.png +0 -0
- package/assets/devices/iPhone 15 Pro - Natural Titanium.png +0 -0
- package/assets/devices/iPhone 15 Pro - White Titanium.png +0 -0
- package/assets/devices/iPhone 15 Pro Max - Black Titanium.png +0 -0
- package/assets/devices/iPhone 15 Pro Max - Blue Titanium.png +0 -0
- package/assets/devices/iPhone 15 Pro Max - Natural Titanium.png +0 -0
- package/assets/devices/iPhone 15 Pro Max - White Titanium.png +0 -0
- package/assets/devices/iPhone 15 Pro Max.png +0 -0
- package/assets/devices/iPhone 15 Pro.png +0 -0
- package/assets/devices/iPhone 15.png +0 -0
- package/assets/devices/iPhone 16 - Black.png +0 -0
- package/assets/devices/iPhone 16 - Pink.png +0 -0
- package/assets/devices/iPhone 16 - Teal.png +0 -0
- package/assets/devices/iPhone 16 - Ultramarine.png +0 -0
- package/assets/devices/iPhone 16 - White.png +0 -0
- package/assets/devices/iPhone 16 Plus - Black.png +0 -0
- package/assets/devices/iPhone 16 Plus - Pink.png +0 -0
- package/assets/devices/iPhone 16 Plus - Teal.png +0 -0
- package/assets/devices/iPhone 16 Plus - Ultramarine.png +0 -0
- package/assets/devices/iPhone 16 Plus - White.png +0 -0
- package/assets/devices/iPhone 16 Pro - Black Titanium.png +0 -0
- package/assets/devices/iPhone 16 Pro - Desert Titanium.png +0 -0
- package/assets/devices/iPhone 16 Pro - Natural Titanium.png +0 -0
- package/assets/devices/iPhone 16 Pro - White Titanium.png +0 -0
- package/assets/devices/iPhone 16 Pro Max - Black Titanium.png +0 -0
- package/assets/devices/iPhone 16 Pro Max - Desert Titanium.png +0 -0
- package/assets/devices/iPhone 16 Pro Max - Natural Titanium.png +0 -0
- package/assets/devices/iPhone 16 Pro Max - White Titanium.png +0 -0
- package/assets/devices/iPhone 17 - Black.png +0 -0
- package/assets/devices/iPhone 17 - Lavender.png +0 -0
- package/assets/devices/iPhone 17 - Mist Blue.png +0 -0
- package/assets/devices/iPhone 17 - Sage.png +0 -0
- package/assets/devices/iPhone 17 - White.png +0 -0
- package/assets/devices/iPhone 17 Pro - Cosmic Orange.png +0 -0
- package/assets/devices/iPhone 17 Pro - Deep Blue.png +0 -0
- package/assets/devices/iPhone 17 Pro - Silver.png +0 -0
- package/assets/devices/iPhone 17 Pro Max - Cosmic Orange.png +0 -0
- package/assets/devices/iPhone 17 Pro Max - Deep Blue.png +0 -0
- package/assets/devices/iPhone 17 Pro Max - Silver.png +0 -0
- package/assets/devices/iPhone Air - Cloud White.png +0 -0
- package/assets/devices/iPhone Air - Light Gold.png +0 -0
- package/assets/devices/iPhone Air - Sky Blue.png +0 -0
- package/assets/devices/iPhone Air - Space Black.png +0 -0
- package/assets/status-bar/Notch Status Bar Black.png +0 -0
- 16 Max Status Bar Black.png +0 -0
- 16 Plus Status Bar Black.png +0 -0
- package/bin/cli.mjs +146 -0
- package/dist/index.cjs +562 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +112 -0
- package/dist/index.d.ts +112 -0
- package/dist/index.js +539 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync, mkdirSync, cpSync, readdirSync } from "node:fs";
|
|
4
|
+
import { resolve, join, dirname } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const ASSETS_DIR = resolve(__dirname, "..", "assets");
|
|
9
|
+
|
|
10
|
+
const RESET = "\x1b[0m";
|
|
11
|
+
const BOLD = "\x1b[1m";
|
|
12
|
+
const DIM = "\x1b[2m";
|
|
13
|
+
const GREEN = "\x1b[32m";
|
|
14
|
+
const CYAN = "\x1b[36m";
|
|
15
|
+
const YELLOW = "\x1b[33m";
|
|
16
|
+
const RED = "\x1b[31m";
|
|
17
|
+
|
|
18
|
+
function log(msg) {
|
|
19
|
+
console.log(msg);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function success(msg) {
|
|
23
|
+
log(`${GREEN}${" \u2713"}${RESET} ${msg}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function warn(msg) {
|
|
27
|
+
log(`${YELLOW}${" !"}${RESET} ${msg}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function error(msg) {
|
|
31
|
+
log(`${RED}${" \u2717"}${RESET} ${msg}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function printHelp() {
|
|
35
|
+
log("");
|
|
36
|
+
log(`${BOLD} @mockify/react${RESET} ${DIM}— iPhone device mockups for React${RESET}`);
|
|
37
|
+
log("");
|
|
38
|
+
log(` ${BOLD}Usage:${RESET}`);
|
|
39
|
+
log(` npx @mockify/react init ${DIM}[--dest <path>]${RESET}`);
|
|
40
|
+
log("");
|
|
41
|
+
log(` ${BOLD}Commands:${RESET}`);
|
|
42
|
+
log(` init Copy device frame PNGs to your public directory (optional)`);
|
|
43
|
+
log(` ${DIM}Assets are served from CDN by default — only needed for self-hosting${RESET}`);
|
|
44
|
+
log("");
|
|
45
|
+
log(` ${BOLD}Options:${RESET}`);
|
|
46
|
+
log(` --dest Destination path ${DIM}(default: public/mockify)${RESET}`);
|
|
47
|
+
log(` --help Show this help message`);
|
|
48
|
+
log("");
|
|
49
|
+
log(` ${BOLD}Example:${RESET}`);
|
|
50
|
+
log(` ${DIM}$${RESET} npx @mockify/react init`);
|
|
51
|
+
log(` ${DIM}$${RESET} npx @mockify/react init --dest public/assets/mockify`);
|
|
52
|
+
log("");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function countFiles(dir) {
|
|
56
|
+
let count = 0;
|
|
57
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
58
|
+
if (entry.isDirectory()) {
|
|
59
|
+
count += countFiles(join(dir, entry.name));
|
|
60
|
+
} else {
|
|
61
|
+
count++;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return count;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function init(dest) {
|
|
68
|
+
log("");
|
|
69
|
+
log(`${BOLD} @mockify/react${RESET} ${DIM}init${RESET}`);
|
|
70
|
+
log("");
|
|
71
|
+
|
|
72
|
+
// Check assets exist
|
|
73
|
+
if (!existsSync(ASSETS_DIR)) {
|
|
74
|
+
error("Assets directory not found in package. Try reinstalling @mockify/react.");
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const devicesSource = join(ASSETS_DIR, "devices");
|
|
79
|
+
const statusBarSource = join(ASSETS_DIR, "status-bar");
|
|
80
|
+
|
|
81
|
+
if (!existsSync(devicesSource)) {
|
|
82
|
+
error("Device frame PNGs not found. Package may be corrupted.");
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const destPath = resolve(process.cwd(), dest);
|
|
87
|
+
const devicesDir = join(destPath, "devices");
|
|
88
|
+
const statusBarDir = join(destPath, "status-bar");
|
|
89
|
+
|
|
90
|
+
// Check if already initialized
|
|
91
|
+
if (existsSync(devicesDir)) {
|
|
92
|
+
const existing = countFiles(devicesDir);
|
|
93
|
+
warn(`${destPath} already exists (${existing} files)`);
|
|
94
|
+
log(`${DIM} Overwriting...${RESET}`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Copy device frames
|
|
98
|
+
mkdirSync(devicesDir, { recursive: true });
|
|
99
|
+
cpSync(devicesSource, devicesDir, { recursive: true });
|
|
100
|
+
const deviceCount = countFiles(devicesDir);
|
|
101
|
+
success(`Copied ${BOLD}${deviceCount}${RESET} device frame PNGs`);
|
|
102
|
+
|
|
103
|
+
// Copy status bar overlays
|
|
104
|
+
if (existsSync(statusBarSource)) {
|
|
105
|
+
mkdirSync(statusBarDir, { recursive: true });
|
|
106
|
+
cpSync(statusBarSource, statusBarDir, { recursive: true });
|
|
107
|
+
const statusCount = countFiles(statusBarDir);
|
|
108
|
+
success(`Copied ${BOLD}${statusCount}${RESET} status bar PNGs`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
log("");
|
|
112
|
+
log(` ${GREEN}${BOLD}Done!${RESET} Assets copied to ${CYAN}${dest}${RESET}`);
|
|
113
|
+
log("");
|
|
114
|
+
log(` ${BOLD}Quick start:${RESET}`);
|
|
115
|
+
log("");
|
|
116
|
+
log(` ${DIM}import { DeviceMockup, iPhone16Pro } from "@mockify/react";${RESET}`);
|
|
117
|
+
log("");
|
|
118
|
+
log(` ${DIM}<DeviceMockup device={iPhone16Pro} width={320}>${RESET}`);
|
|
119
|
+
log(` ${DIM} <img src="/screenshot.png" ... />${RESET}`);
|
|
120
|
+
log(` ${DIM}</DeviceMockup>${RESET}`);
|
|
121
|
+
log("");
|
|
122
|
+
|
|
123
|
+
if (dest !== "public/mockify") {
|
|
124
|
+
log(` ${YELLOW}Note:${RESET} Set ${BOLD}basePath="${dest.replace(/^public/, "")}"${RESET} on DeviceMockup`);
|
|
125
|
+
log("");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Parse args
|
|
130
|
+
const args = process.argv.slice(2);
|
|
131
|
+
const command = args[0];
|
|
132
|
+
|
|
133
|
+
if (!command || command === "--help" || command === "-h") {
|
|
134
|
+
printHelp();
|
|
135
|
+
process.exit(0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (command === "init") {
|
|
139
|
+
const destIdx = args.indexOf("--dest");
|
|
140
|
+
const dest = destIdx !== -1 && args[destIdx + 1] ? args[destIdx + 1] : "public/mockify";
|
|
141
|
+
init(dest);
|
|
142
|
+
} else {
|
|
143
|
+
error(`Unknown command: ${command}`);
|
|
144
|
+
printHelp();
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|