@krapwoo/ds-viewer 0.4.1 → 0.4.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/dist/cli/init.js
CHANGED
|
@@ -2,7 +2,7 @@ import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFi
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { createInterface } from 'node:readline/promises';
|
|
4
4
|
import { execFileSync } from 'node:child_process';
|
|
5
|
-
import { preflight } from "./preflight.js";
|
|
5
|
+
import { formatPreflightIssue, preflight } from "./preflight.js";
|
|
6
6
|
import { detectComponentFolders, detectTokenFiles } from "./detect.js";
|
|
7
7
|
import { ensureAgentsFileSection } from "./agentsFile.js";
|
|
8
8
|
import { ensureGithubAction } from "./githubAction.js";
|
|
@@ -51,7 +51,7 @@ function detectIndent(raw) {
|
|
|
51
51
|
export async function initExistingProject(projectRoot, options = {}) {
|
|
52
52
|
const { errors, warnings } = preflight(projectRoot);
|
|
53
53
|
if (errors.length > 0) {
|
|
54
|
-
return { messages: errors.map(
|
|
54
|
+
return { messages: errors.map(formatPreflightIssue), written: [], exitCode: 1 };
|
|
55
55
|
}
|
|
56
56
|
const componentFolders = detectComponentFolders(projectRoot, projectRoot);
|
|
57
57
|
const tokenFiles = detectTokenFiles(projectRoot, projectRoot, (file) => readFileSync(file, 'utf8'));
|
|
@@ -218,7 +218,7 @@ export default defineConfig({
|
|
|
218
218
|
export async function initNewProject(projectRoot, options = {}) {
|
|
219
219
|
const { errors, warnings } = preflight(projectRoot);
|
|
220
220
|
if (errors.length > 0) {
|
|
221
|
-
return { messages: errors.map(
|
|
221
|
+
return { messages: errors.map(formatPreflightIssue), written: [], exitCode: 1 };
|
|
222
222
|
}
|
|
223
223
|
const packageJson = JSON.parse(readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
|
|
224
224
|
const installedPackages = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
package/dist/cli/preflight.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
/** One line per issue: the problem (or "Missing <package>.") and the command that fixes it. */
|
|
4
|
+
export function formatPreflightIssue(issue) {
|
|
5
|
+
return `${issue.problem ?? `Missing ${issue.package}.`} Run: ${issue.installCommand}`;
|
|
6
|
+
}
|
|
3
7
|
const REQUIRED_PACKAGES = ['react-native-web', 'react-dom'];
|
|
4
|
-
// @expo/metro-runtime is recommended, not required: Expo
|
|
8
|
+
// @expo/metro-runtime is recommended, not required: Expo web works without it (verified in the
|
|
5
9
|
// 0.1 spike and in native-preview's own node_modules, which has no @expo/metro-runtime installed
|
|
6
10
|
// either) — design §1 "Host requirements" only warns when it is missing.
|
|
7
11
|
const RECOMMENDED_PACKAGES = {
|
|
@@ -9,7 +13,9 @@ const RECOMMENDED_PACKAGES = {
|
|
|
9
13
|
typescript: 'npm install --save-dev typescript',
|
|
10
14
|
};
|
|
11
15
|
const MIN_NODE = [20, 19, 0];
|
|
12
|
-
|
|
16
|
+
// Lowered from 57 in 0.4.2 (owner-approved): sync, doctor, the viewer and Update now were verified
|
|
17
|
+
// end to end on a fresh Expo SDK 54 app and on Skiffr (Expo 54).
|
|
18
|
+
const MIN_EXPO = [54, 0, 0];
|
|
13
19
|
/** Accepts `x.y.z`, and a version with a missing minor/patch (e.g. `"57"`, `"^57"`) by defaulting
|
|
14
20
|
* the missing segments to 0 — a range specifier like `"^57"` must not be flagged as older than 57. */
|
|
15
21
|
function parseVersion(version) {
|
|
@@ -46,7 +52,7 @@ export function preflight(projectRoot) {
|
|
|
46
52
|
errors.push({ package: 'expo', installCommand: 'npx expo install expo' });
|
|
47
53
|
}
|
|
48
54
|
else if (!atLeast(expoVersion, MIN_EXPO)) {
|
|
49
|
-
errors.push({ package: 'expo',
|
|
55
|
+
errors.push({ package: 'expo', problem: `Expo SDK 54 or later is required (found ${expoVersion}).`, installCommand: 'npx expo install expo@^54' });
|
|
50
56
|
}
|
|
51
57
|
for (const name of REQUIRED_PACKAGES) {
|
|
52
58
|
if (!deps[name])
|
package/package.json
CHANGED
|
@@ -173,6 +173,11 @@ export function Banner({
|
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/** `StyleSheet.absoluteFill`, spelled out: React Native 0.81's types don't allow spreading
|
|
177
|
+
* `StyleSheet.absoluteFill` (and 0.86 removed `absoluteFillObject`), so this one form
|
|
178
|
+
* type-checks on both. */
|
|
179
|
+
const FILL = { position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 } as const;
|
|
180
|
+
|
|
176
181
|
const styles = StyleSheet.create({
|
|
177
182
|
actionRow: {
|
|
178
183
|
flexDirection: 'row',
|
|
@@ -235,7 +240,7 @@ const styles = StyleSheet.create({
|
|
|
235
240
|
},
|
|
236
241
|
// Translucent pressed overlay — sits above the banner bg so the tinted bg shows through.
|
|
237
242
|
pressOverlay: {
|
|
238
|
-
...
|
|
243
|
+
...FILL,
|
|
239
244
|
backgroundColor: DS_SEMANTIC.interaction.pressed,
|
|
240
245
|
borderRadius: DS_RADIUS.medium,
|
|
241
246
|
},
|
|
@@ -125,9 +125,14 @@ export function BottomSheet({ visible, onDismiss, header, children, footer, styl
|
|
|
125
125
|
);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/** `StyleSheet.absoluteFill`, spelled out: React Native 0.81's types don't allow spreading
|
|
129
|
+
* `StyleSheet.absoluteFill` (and 0.86 removed `absoluteFillObject`), so this one form
|
|
130
|
+
* type-checks on both. */
|
|
131
|
+
const FILL = { position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 } as const;
|
|
132
|
+
|
|
128
133
|
const styles = StyleSheet.create({
|
|
129
|
-
overlay: { ...
|
|
130
|
-
backdrop: { ...
|
|
134
|
+
overlay: { ...FILL, justifyContent: 'flex-end' },
|
|
135
|
+
backdrop: { ...FILL, backgroundColor: DS_SEMANTIC.element.overlayBackdrop },
|
|
131
136
|
sheet: {
|
|
132
137
|
maxHeight: MAX_HEIGHT_PERCENT,
|
|
133
138
|
backgroundColor: DS_SEMANTIC.surface.white,
|
|
@@ -63,14 +63,19 @@ export function Dialog({ visible, onDismiss, children, style }: DialogProps) {
|
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/** `StyleSheet.absoluteFill`, spelled out: React Native 0.81's types don't allow spreading
|
|
67
|
+
* `StyleSheet.absoluteFill` (and 0.86 removed `absoluteFillObject`), so this one form
|
|
68
|
+
* type-checks on both. */
|
|
69
|
+
const FILL = { position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 } as const;
|
|
70
|
+
|
|
66
71
|
const styles = StyleSheet.create({
|
|
67
72
|
overlay: {
|
|
68
|
-
...
|
|
73
|
+
...FILL,
|
|
69
74
|
alignItems: 'center',
|
|
70
75
|
justifyContent: 'center',
|
|
71
76
|
padding: DS_SPACING[800],
|
|
72
77
|
},
|
|
73
|
-
backdrop: { ...
|
|
78
|
+
backdrop: { ...FILL, backgroundColor: DS_SEMANTIC.element.overlayBackdrop },
|
|
74
79
|
card: {
|
|
75
80
|
width: '100%',
|
|
76
81
|
maxWidth: 400,
|