@nimiplatform/app-tools 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/lib/index.mjs ADDED
@@ -0,0 +1,93 @@
1
+ import { existsSync, mkdirSync, readdirSync, statSync, writeFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { createAppScaffold } from './app-scaffold.mjs';
4
+ import { doctorApp, updateApp } from './app-doctor-update.mjs';
5
+
6
+ const SDK_VERSION = '^0.5.15';
7
+ const APP_TOOLS_VERSION = '^0.1.0';
8
+ const KIT_VERSION = '^0.1.0';
9
+ const REACT_VERSION = '^19.1.0';
10
+ const REACT_DOM_VERSION = '^19.1.0';
11
+ const TYPESCRIPT_VERSION = '^5.9.3';
12
+ const TSX_VERSION = '^4.21.0';
13
+ const NODE_TYPES_VERSION = '^24.10.1';
14
+ const REACT_TYPES_VERSION = '^19.2.14';
15
+ const REACT_DOM_TYPES_VERSION = '^19.2.3';
16
+ const VITE_VERSION = '^7.2.4';
17
+ const VITE_REACT_PLUGIN_VERSION = '^5.1.1';
18
+ const TAURI_API_VERSION = '^2.9.1';
19
+ const NIMI_SHELL_TAURI_VERSION = '0.1.0';
20
+ const AI_SDK_VERSION = '^6.0.85';
21
+
22
+ function ensureDirEmptyOrMissing(targetDir) {
23
+ if (!existsSync(targetDir)) {
24
+ return;
25
+ }
26
+ const stat = statSync(targetDir);
27
+ if (!stat.isDirectory()) {
28
+ throw new Error(`Refusing to scaffold into non-directory path: ${targetDir}`);
29
+ }
30
+ const entries = readdirSync(targetDir);
31
+ if (entries.length === 0) {
32
+ return;
33
+ }
34
+ if (entries.length === 1 && entries[0] === '.git' && statSync(path.join(targetDir, '.git')).isDirectory()) {
35
+ return;
36
+ }
37
+ throw new Error(`Refusing to scaffold into non-empty directory: ${targetDir}`);
38
+ }
39
+
40
+ function createFileTree(baseDir, files) {
41
+ for (const file of files) {
42
+ const targetPath = path.join(baseDir, file.path);
43
+ mkdirSync(path.dirname(targetPath), { recursive: true });
44
+ writeFileSync(targetPath, file.content);
45
+ }
46
+ }
47
+
48
+ function appScaffoldVersions() {
49
+ return {
50
+ sdkVersion: SDK_VERSION,
51
+ appToolsVersion: APP_TOOLS_VERSION,
52
+ aiSdkVersion: AI_SDK_VERSION,
53
+ kitVersion: KIT_VERSION,
54
+ reactVersion: REACT_VERSION,
55
+ reactDomVersion: REACT_DOM_VERSION,
56
+ tsxVersion: TSX_VERSION,
57
+ typescriptVersion: TYPESCRIPT_VERSION,
58
+ nodeTypesVersion: NODE_TYPES_VERSION,
59
+ reactTypesVersion: REACT_TYPES_VERSION,
60
+ reactDomTypesVersion: REACT_DOM_TYPES_VERSION,
61
+ viteVersion: VITE_VERSION,
62
+ viteReactPluginVersion: VITE_REACT_PLUGIN_VERSION,
63
+ tauriApiVersion: TAURI_API_VERSION,
64
+ nimiShellTauriVersion: NIMI_SHELL_TAURI_VERSION,
65
+ };
66
+ }
67
+
68
+ export function createApp(cwd, options = {}) {
69
+ createAppScaffold({
70
+ cwd,
71
+ options: {
72
+ dir: options.dir,
73
+ profile: options.profile,
74
+ appId: options.appId,
75
+ name: options.name,
76
+ title: options.title,
77
+ packageName: options.packageName,
78
+ author: options.author,
79
+ },
80
+ versions: appScaffoldVersions(),
81
+ createFileTree,
82
+ ensureDirEmptyOrMissing,
83
+ mkdirSync,
84
+ });
85
+ }
86
+
87
+ export function doctorAppScaffold(cwd, options = {}) {
88
+ return doctorApp(cwd, options, appScaffoldVersions());
89
+ }
90
+
91
+ export function updateAppScaffold(cwd, options = {}) {
92
+ return updateApp(cwd, options, appScaffoldVersions());
93
+ }
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@nimiplatform/app-tools",
3
+ "version": "0.1.0",
4
+ "license": "Apache-2.0",
5
+ "type": "module",
6
+ "private": false,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/nimiplatform/nimi",
10
+ "directory": "app-tools"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "provenance": true
15
+ },
16
+ "bin": {
17
+ "nimi-app": "./bin/nimi-app.mjs"
18
+ },
19
+ "files": [
20
+ "bin",
21
+ "lib",
22
+ "README.md"
23
+ ],
24
+ "dependencies": {}
25
+ }