@jskit-ai/create-app 0.1.25 → 0.1.26
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# Link all local @jskit-ai packages from a jskit-ai monorepo checkout into node_modules.
|
|
3
3
|
# Run this AFTER `npm install` when you want live local development without publishing packages.
|
|
4
4
|
#
|
|
5
5
|
# Usage:
|
|
@@ -63,39 +63,76 @@ if ! is_valid_jskit_repo_root "$JSKIT_REPO_ROOT"; then
|
|
|
63
63
|
exit 1
|
|
64
64
|
fi
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
discover_local_package_map() {
|
|
67
|
+
node - "$JSKIT_REPO_ROOT" <<'NODE'
|
|
68
|
+
const fs = require("node:fs");
|
|
69
|
+
const path = require("node:path");
|
|
70
|
+
|
|
71
|
+
const repoRoot = process.argv[2];
|
|
72
|
+
const parentDirectories = [
|
|
73
|
+
path.join(repoRoot, "packages"),
|
|
74
|
+
path.join(repoRoot, "tooling")
|
|
75
|
+
];
|
|
76
|
+
const packageMap = new Map();
|
|
77
|
+
|
|
78
|
+
for (const parentDirectory of parentDirectories) {
|
|
79
|
+
if (!fs.existsSync(parentDirectory) || !fs.statSync(parentDirectory).isDirectory()) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
for (const entry of fs.readdirSync(parentDirectory, { withFileTypes: true })) {
|
|
84
|
+
if (!entry.isDirectory() || entry.name.startsWith(".")) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const packageRoot = path.join(parentDirectory, entry.name);
|
|
89
|
+
const packageJsonPath = path.join(packageRoot, "package.json");
|
|
90
|
+
const descriptorPath = path.join(packageRoot, "package.descriptor.mjs");
|
|
91
|
+
if (!fs.existsSync(packageJsonPath) || !fs.existsSync(descriptorPath)) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let packageJson = {};
|
|
96
|
+
try {
|
|
97
|
+
packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
98
|
+
} catch {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const packageId = String(packageJson?.name || "").trim();
|
|
103
|
+
if (!packageId.startsWith("@jskit-ai/")) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const packageDirName = packageId.slice("@jskit-ai/".length);
|
|
107
|
+
if (!packageDirName || packageDirName.includes("/")) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!packageMap.has(packageDirName)) {
|
|
112
|
+
packageMap.set(packageDirName, packageRoot);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
76
115
|
}
|
|
77
116
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
continue
|
|
84
|
-
fi
|
|
117
|
+
for (const [packageDirName, packageRoot] of packageMap.entries()) {
|
|
118
|
+
process.stdout.write(`${packageDirName}\t${packageRoot}\n`);
|
|
119
|
+
}
|
|
120
|
+
NODE
|
|
121
|
+
}
|
|
85
122
|
|
|
86
|
-
|
|
87
|
-
source_dir="$(resolve_source_dir "$package_dir_name")"
|
|
123
|
+
linked_count=0
|
|
88
124
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
125
|
+
mkdir -p "$SCOPE_DIR"
|
|
126
|
+
while IFS=$'\t' read -r package_dir_name source_dir; do
|
|
127
|
+
if [[ -z "$package_dir_name" || -z "$source_dir" ]]; then
|
|
92
128
|
continue
|
|
93
129
|
fi
|
|
94
130
|
|
|
95
|
-
|
|
96
|
-
|
|
131
|
+
target_path="$SCOPE_DIR/$package_dir_name"
|
|
132
|
+
rm -rf "$target_path"
|
|
133
|
+
ln -s "$source_dir" "$target_path"
|
|
97
134
|
echo "[link-local] linked @jskit-ai/$package_dir_name -> $source_dir"
|
|
98
135
|
linked_count=$((linked_count + 1))
|
|
99
|
-
done
|
|
136
|
+
done < <(discover_local_package_map)
|
|
100
137
|
|
|
101
|
-
echo "[link-local] done. linked=$linked_count
|
|
138
|
+
echo "[link-local] done. linked=$linked_count"
|