@jskit-ai/create-app 0.1.2 → 0.1.6
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/bin/jskit-create-app.js +2 -2
- package/package.json +7 -5
- package/src/client/index.js +1 -0
- package/src/index.js +1 -0
- package/src/{shared → server}/index.js +56 -61
- package/templates/base-shell/.jskit/lock.json +31 -0
- package/templates/base-shell/README.md +24 -20
- package/templates/base-shell/app.scripts.config.mjs +1 -1
- package/templates/base-shell/config/public.js +30 -0
- package/templates/base-shell/config/server.js +1 -0
- package/templates/base-shell/config/surfaceAccessPolicies.js +12 -0
- package/templates/base-shell/eslint.config.mjs +1 -1
- package/templates/base-shell/gitignore +2 -0
- package/templates/base-shell/index.html +1 -1
- package/templates/base-shell/jsconfig.json +8 -0
- package/templates/base-shell/package.json +43 -18
- package/templates/base-shell/packages/main/package.descriptor.mjs +55 -0
- package/templates/base-shell/packages/main/package.json +12 -0
- package/templates/base-shell/packages/main/src/client/index.js +13 -0
- package/templates/base-shell/packages/main/src/client/providers/MainClientProvider.js +33 -0
- package/templates/base-shell/packages/main/src/server/controllers/index.js +9 -0
- package/templates/base-shell/packages/main/src/server/index.js +1 -0
- package/templates/base-shell/packages/main/src/server/providers/MainServiceProvider.js +22 -0
- package/templates/base-shell/packages/main/src/server/routes/index.js +9 -0
- package/templates/base-shell/packages/main/src/server/services/index.js +9 -0
- package/templates/base-shell/packages/main/src/server/support/loadAppConfig.js +55 -0
- package/templates/base-shell/packages/main/src/shared/index.js +8 -0
- package/templates/base-shell/packages/main/src/shared/schemas/index.js +20 -0
- package/templates/base-shell/scripts/dev-bootstrap-jskit.sh +110 -0
- package/templates/base-shell/scripts/just_run_verde +37 -0
- package/templates/base-shell/scripts/link-local-jskit-packages.sh +90 -0
- package/templates/base-shell/scripts/update-jskit-packages.sh +73 -0
- package/templates/base-shell/scripts/verdaccio/config.yaml +26 -0
- package/templates/base-shell/scripts/verdaccio-reset-and-publish-packages.sh +314 -0
- package/templates/base-shell/server/lib/runtimeEnv.js +29 -0
- package/templates/base-shell/server/lib/surfaceRuntime.js +10 -0
- package/templates/base-shell/server.js +39 -68
- package/templates/base-shell/src/App.vue +11 -22
- package/templates/base-shell/src/main.js +87 -1
- package/templates/base-shell/src/pages/console/index.vue +12 -0
- package/templates/base-shell/src/pages/console.vue +13 -0
- package/templates/base-shell/src/pages/home/index.vue +12 -0
- package/templates/base-shell/src/pages/home.vue +13 -0
- package/templates/base-shell/src/views/NotFound.vue +13 -0
- package/templates/base-shell/tests/server/{minimalShell.contract.test.js → minimalShell.validator.test.js} +44 -6
- package/templates/base-shell/tests/server/smoke.test.js +3 -6
- package/templates/base-shell/vite.config.mjs +24 -3
- package/templates/base-shell/vite.shared.mjs +51 -1
- package/README.md +0 -24
- package/templates/base-shell/package.json.ACTUAL_CORRECT +0 -38
- /package/src/{shared → server}/cliEntrypoint.js +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const mainClientComponents = [];
|
|
2
|
+
|
|
3
|
+
function registerMainClientComponent(componentToken, resolveComponent) {
|
|
4
|
+
const token = String(componentToken || "").trim();
|
|
5
|
+
if (!token || typeof resolveComponent !== "function") {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
mainClientComponents.push(
|
|
9
|
+
Object.freeze({
|
|
10
|
+
token,
|
|
11
|
+
resolveComponent
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class MainClientProvider {
|
|
17
|
+
static id = "local.main.client";
|
|
18
|
+
|
|
19
|
+
register(app) {
|
|
20
|
+
if (!app || typeof app.singleton !== "function") {
|
|
21
|
+
throw new Error("MainClientProvider requires application singleton().");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (const entry of mainClientComponents) {
|
|
25
|
+
app.singleton(entry.token, entry.resolveComponent);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
MainClientProvider,
|
|
32
|
+
registerMainClientComponent
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MainServiceProvider } from "./providers/MainServiceProvider.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { loadAppConfig } from "../support/loadAppConfig.js";
|
|
2
|
+
|
|
3
|
+
class MainServiceProvider {
|
|
4
|
+
static id = "local.main";
|
|
5
|
+
|
|
6
|
+
// Optional: register container bindings here (services/singletons).
|
|
7
|
+
async register(app) {
|
|
8
|
+
const appConfig = await loadAppConfig({
|
|
9
|
+
moduleUrl: import.meta.url
|
|
10
|
+
});
|
|
11
|
+
app.instance("appConfig", appConfig);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Start backend features here:
|
|
15
|
+
// 1) define shared validators/resources in `src/shared/schemas`
|
|
16
|
+
// 2) resolve router with `app.make(KERNEL_TOKENS.HttpRouter)`
|
|
17
|
+
// 3) register routes and handlers
|
|
18
|
+
// 4) extract to services/controllers/routes as the feature grows
|
|
19
|
+
boot() {}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { MainServiceProvider };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { access, constants as fsConstants } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
|
|
5
|
+
async function fileExists(absolutePath) {
|
|
6
|
+
try {
|
|
7
|
+
await access(absolutePath, fsConstants.F_OK);
|
|
8
|
+
return true;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function resolveAppRootFrom(moduleDirectory) {
|
|
15
|
+
let currentDirectory = path.resolve(moduleDirectory);
|
|
16
|
+
|
|
17
|
+
while (true) {
|
|
18
|
+
const candidateConfigPath = path.join(currentDirectory, "config", "public.js");
|
|
19
|
+
if (await fileExists(candidateConfigPath)) {
|
|
20
|
+
return currentDirectory;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const parentDirectory = path.dirname(currentDirectory);
|
|
24
|
+
if (parentDirectory === currentDirectory) {
|
|
25
|
+
throw new Error("Unable to locate app root (missing config/public.js).");
|
|
26
|
+
}
|
|
27
|
+
currentDirectory = parentDirectory;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function loadConfigModule(absolutePath) {
|
|
32
|
+
if (!(await fileExists(absolutePath))) {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const loadedModule = await import(pathToFileURL(absolutePath).href);
|
|
37
|
+
const loadedConfig = loadedModule?.config;
|
|
38
|
+
return loadedConfig && typeof loadedConfig === "object" && !Array.isArray(loadedConfig) ? loadedConfig : {};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function loadAppConfig({ moduleUrl = import.meta.url } = {}) {
|
|
42
|
+
const moduleDirectory = path.dirname(fileURLToPath(moduleUrl));
|
|
43
|
+
const appRoot = await resolveAppRootFrom(moduleDirectory);
|
|
44
|
+
const [publicConfig, serverConfig] = await Promise.all([
|
|
45
|
+
loadConfigModule(path.join(appRoot, "config", "public.js")),
|
|
46
|
+
loadConfigModule(path.join(appRoot, "config", "server.js"))
|
|
47
|
+
]);
|
|
48
|
+
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
...publicConfig,
|
|
51
|
+
...serverConfig
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { loadAppConfig };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared transport validators/resources live here.
|
|
3
|
+
*
|
|
4
|
+
* Example:
|
|
5
|
+
* import { Type } from "@fastify/type-provider-typebox";
|
|
6
|
+
*
|
|
7
|
+
* export const helloSchema = {
|
|
8
|
+
* query: Type.Object(
|
|
9
|
+
* { name: Type.Optional(Type.String({ minLength: 1, maxLength: 80 })) },
|
|
10
|
+
* { additionalProperties: false }
|
|
11
|
+
* ),
|
|
12
|
+
* response: {
|
|
13
|
+
* 200: Type.Object(
|
|
14
|
+
* { ok: Type.Boolean(), message: Type.String({ minLength: 1 }) },
|
|
15
|
+
* { additionalProperties: false }
|
|
16
|
+
* )
|
|
17
|
+
* }
|
|
18
|
+
* };
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
APP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
BOOTSTRAP_MODE_RAW="${JSKIT_DEV_BOOTSTRAP:-auto}"
|
|
6
|
+
BOOTSTRAP_MODE="$(echo "$BOOTSTRAP_MODE_RAW" | tr '[:upper:]' '[:lower:]')"
|
|
7
|
+
|
|
8
|
+
is_valid_jskit_repo_root() {
|
|
9
|
+
local candidate_root="$1"
|
|
10
|
+
[[ -d "$candidate_root/packages" && -d "$candidate_root/packages/kernel" && -d "$candidate_root/tooling" ]]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
find_jskit_repo_root() {
|
|
14
|
+
local current_dir="$1"
|
|
15
|
+
while true; do
|
|
16
|
+
if is_valid_jskit_repo_root "$current_dir"; then
|
|
17
|
+
echo "$current_dir"
|
|
18
|
+
return 0
|
|
19
|
+
fi
|
|
20
|
+
if [[ "$current_dir" == "/" ]]; then
|
|
21
|
+
return 1
|
|
22
|
+
fi
|
|
23
|
+
current_dir="$(dirname "$current_dir")"
|
|
24
|
+
done
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
resolve_local_repo_root() {
|
|
28
|
+
if [[ -n "${JSKIT_REPO_ROOT:-}" ]]; then
|
|
29
|
+
echo "$JSKIT_REPO_ROOT"
|
|
30
|
+
return 0
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
find_jskit_repo_root "$APP_ROOT" || true
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
is_dokku_environment() {
|
|
37
|
+
[[ -n "${DOKKU_APP_NAME:-}" || -n "${DOKKU_APP_TYPE:-}" ]]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
resolve_bootstrap_mode() {
|
|
41
|
+
local normalized_mode="$1"
|
|
42
|
+
if [[ "$normalized_mode" != "auto" ]]; then
|
|
43
|
+
echo "$normalized_mode"
|
|
44
|
+
return 0
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
if is_dokku_environment; then
|
|
48
|
+
echo "on"
|
|
49
|
+
return 0
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
echo "off"
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
BOOTSTRAP_MODE="$(resolve_bootstrap_mode "$BOOTSTRAP_MODE")"
|
|
56
|
+
LOCAL_REPO_ROOT="$(resolve_local_repo_root)"
|
|
57
|
+
|
|
58
|
+
if [[ "$BOOTSTRAP_MODE" == "0" || "$BOOTSTRAP_MODE" == "false" || "$BOOTSTRAP_MODE" == "off" ]]; then
|
|
59
|
+
echo "[dev-bootstrap] skipped (JSKIT_DEV_BOOTSTRAP disabled)."
|
|
60
|
+
exit 0
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
if is_valid_jskit_repo_root "$LOCAL_REPO_ROOT"; then
|
|
64
|
+
echo "[dev-bootstrap] using local JSKIT repo: $LOCAL_REPO_ROOT"
|
|
65
|
+
JSKIT_REPO_ROOT="$LOCAL_REPO_ROOT" bash "$APP_ROOT/scripts/verdaccio-reset-and-publish-packages.sh"
|
|
66
|
+
exit 0
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
if [[ "$BOOTSTRAP_MODE" != "1" && "$BOOTSTRAP_MODE" != "true" && "$BOOTSTRAP_MODE" != "on" ]]; then
|
|
70
|
+
echo "[dev-bootstrap] skipped (no local JSKIT repo at $LOCAL_REPO_ROOT)."
|
|
71
|
+
echo "[dev-bootstrap] set JSKIT_DEV_BOOTSTRAP=1 and JSKIT_GITHUB_TARBALL_URL to force remote bootstrap."
|
|
72
|
+
exit 0
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
JSKIT_GITHUB_TARBALL_URL="${JSKIT_GITHUB_TARBALL_URL:-}"
|
|
76
|
+
if [[ -z "$JSKIT_GITHUB_TARBALL_URL" ]]; then
|
|
77
|
+
echo "[dev-bootstrap] failed: local JSKIT repo not found at $LOCAL_REPO_ROOT and JSKIT_GITHUB_TARBALL_URL is not set." >&2
|
|
78
|
+
echo "[dev-bootstrap] set JSKIT_REPO_ROOT to a local checkout or set JSKIT_GITHUB_TARBALL_URL to an accessible tarball URL." >&2
|
|
79
|
+
exit 1
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
TMP_DIR="$(mktemp -d)"
|
|
83
|
+
TARBALL_PATH="$TMP_DIR/jskit-ai.tar.gz"
|
|
84
|
+
EXTRACT_DIR="$TMP_DIR/extracted"
|
|
85
|
+
|
|
86
|
+
cleanup() {
|
|
87
|
+
rm -rf "$TMP_DIR"
|
|
88
|
+
}
|
|
89
|
+
trap cleanup EXIT
|
|
90
|
+
|
|
91
|
+
echo "[dev-bootstrap] downloading $JSKIT_GITHUB_TARBALL_URL"
|
|
92
|
+
curl -fsSL "$JSKIT_GITHUB_TARBALL_URL" -o "$TARBALL_PATH"
|
|
93
|
+
|
|
94
|
+
mkdir -p "$EXTRACT_DIR"
|
|
95
|
+
tar -xzf "$TARBALL_PATH" -C "$EXTRACT_DIR"
|
|
96
|
+
|
|
97
|
+
JSKIT_REPO_ROOT="$(find "$EXTRACT_DIR" -mindepth 1 -maxdepth 1 -type d | head -n 1 || true)"
|
|
98
|
+
if [[ -z "${JSKIT_REPO_ROOT:-}" ]]; then
|
|
99
|
+
echo "[dev-bootstrap] failed: extracted archive is empty." >&2
|
|
100
|
+
exit 1
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
if [[ ! -d "$JSKIT_REPO_ROOT/packages" || ! -d "$JSKIT_REPO_ROOT/packages/kernel" || ! -d "$JSKIT_REPO_ROOT/tooling" ]]; then
|
|
104
|
+
echo "[dev-bootstrap] failed: extracted archive does not look like jskit-ai monorepo." >&2
|
|
105
|
+
echo "[dev-bootstrap] extracted root: $JSKIT_REPO_ROOT" >&2
|
|
106
|
+
exit 1
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
echo "[dev-bootstrap] publishing packages from extracted repo: $JSKIT_REPO_ROOT"
|
|
110
|
+
JSKIT_REPO_ROOT="$JSKIT_REPO_ROOT" bash "$APP_ROOT/scripts/verdaccio-reset-and-publish-packages.sh"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Starts a local Verdaccio registry for JSKIT package publish/install testing.
|
|
3
|
+
# - Default: runs in background (nohup) and prints PID/log file locations.
|
|
4
|
+
# - --fg: runs Verdaccio in foreground for interactive debugging.
|
|
5
|
+
#
|
|
6
|
+
# Env overrides:
|
|
7
|
+
# - VERDACCIO_LISTEN (default: 127.0.0.1:4873)
|
|
8
|
+
# - VERDACCIO_CONFIG (default: ./scripts/verdaccio/config.yaml, fallback ~/.config/verdaccio/config.yaml)
|
|
9
|
+
# - VERDACCIO_LOG_FILE (default: /tmp/verdaccio.log)
|
|
10
|
+
# - VERDACCIO_PID_FILE (default: /tmp/verdaccio.pid)
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
|
|
13
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
14
|
+
VERDACCIO_LISTEN="${VERDACCIO_LISTEN:-127.0.0.1:4873}"
|
|
15
|
+
DEFAULT_VERDACCIO_CONFIG="$ROOT_DIR/scripts/verdaccio/config.yaml"
|
|
16
|
+
if [[ -f "$DEFAULT_VERDACCIO_CONFIG" ]]; then
|
|
17
|
+
VERDACCIO_CONFIG="${VERDACCIO_CONFIG:-$DEFAULT_VERDACCIO_CONFIG}"
|
|
18
|
+
else
|
|
19
|
+
VERDACCIO_CONFIG="${VERDACCIO_CONFIG:-$HOME/.config/verdaccio/config.yaml}"
|
|
20
|
+
fi
|
|
21
|
+
VERDACCIO_LOG_FILE="${VERDACCIO_LOG_FILE:-/tmp/verdaccio.log}"
|
|
22
|
+
VERDACCIO_PID_FILE="${VERDACCIO_PID_FILE:-/tmp/verdaccio.pid}"
|
|
23
|
+
CONFIG_DIR="$(cd "$(dirname "$VERDACCIO_CONFIG")" && pwd)"
|
|
24
|
+
|
|
25
|
+
if [[ "${1:-}" == "--fg" ]]; then
|
|
26
|
+
cd "$CONFIG_DIR"
|
|
27
|
+
exec npx verdaccio --listen "$VERDACCIO_LISTEN" --config "$VERDACCIO_CONFIG"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
(
|
|
31
|
+
cd "$CONFIG_DIR"
|
|
32
|
+
nohup npx verdaccio --listen "$VERDACCIO_LISTEN" --config "$VERDACCIO_CONFIG" >"$VERDACCIO_LOG_FILE" 2>&1 &
|
|
33
|
+
echo "$!" >"$VERDACCIO_PID_FILE"
|
|
34
|
+
)
|
|
35
|
+
echo "Verdaccio started in background."
|
|
36
|
+
echo "PID file: $VERDACCIO_PID_FILE"
|
|
37
|
+
echo "Log file: $VERDACCIO_LOG_FILE"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Re-link installed @jskit-ai packages in node_modules to a local jskit-ai monorepo checkout.
|
|
3
|
+
# Run this AFTER `npm install` when you want live local development without publishing packages.
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# npm run link:local:jskit
|
|
7
|
+
# JSKIT_REPO_ROOT=/abs/path/to/jskit-ai npm run link:local:jskit
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
|
|
10
|
+
APP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
11
|
+
SCOPE_DIR="$APP_ROOT/node_modules/@jskit-ai"
|
|
12
|
+
|
|
13
|
+
is_valid_jskit_repo_root() {
|
|
14
|
+
local candidate_root="$1"
|
|
15
|
+
[[ -d "$candidate_root/packages" && -d "$candidate_root/packages/kernel" && -d "$candidate_root/tooling" ]]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
resolve_local_repo_root() {
|
|
19
|
+
if [[ -n "${JSKIT_REPO_ROOT:-}" ]]; then
|
|
20
|
+
echo "$JSKIT_REPO_ROOT"
|
|
21
|
+
return 0
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
local current_dir="$APP_ROOT"
|
|
25
|
+
while true; do
|
|
26
|
+
if is_valid_jskit_repo_root "$current_dir"; then
|
|
27
|
+
echo "$current_dir"
|
|
28
|
+
return 0
|
|
29
|
+
fi
|
|
30
|
+
if [[ "$current_dir" == "/" ]]; then
|
|
31
|
+
return 1
|
|
32
|
+
fi
|
|
33
|
+
current_dir="$(dirname "$current_dir")"
|
|
34
|
+
done
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
JSKIT_REPO_ROOT="$(resolve_local_repo_root || true)"
|
|
38
|
+
|
|
39
|
+
if [[ ! -d "$SCOPE_DIR" ]]; then
|
|
40
|
+
echo "[link-local] @jskit-ai scope not found at $SCOPE_DIR (run npm install first)." >&2
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
if [[ -z "$JSKIT_REPO_ROOT" ]]; then
|
|
45
|
+
echo "[link-local] no JSKIT repository found." >&2
|
|
46
|
+
echo "[link-local] set JSKIT_REPO_ROOT to a local jskit-ai checkout path." >&2
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
if ! is_valid_jskit_repo_root "$JSKIT_REPO_ROOT"; then
|
|
51
|
+
echo "[link-local] JSKIT_REPO_ROOT is not a valid jskit-ai checkout: $JSKIT_REPO_ROOT" >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
resolve_source_dir() {
|
|
56
|
+
local package_dir_name="$1"
|
|
57
|
+
case "$package_dir_name" in
|
|
58
|
+
config-eslint|create-app|jskit-cli|jskit-catalog)
|
|
59
|
+
echo "$JSKIT_REPO_ROOT/tooling/$package_dir_name"
|
|
60
|
+
;;
|
|
61
|
+
*)
|
|
62
|
+
echo "$JSKIT_REPO_ROOT/packages/$package_dir_name"
|
|
63
|
+
;;
|
|
64
|
+
esac
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
linked_count=0
|
|
68
|
+
skipped_count=0
|
|
69
|
+
|
|
70
|
+
for installed_path in "$SCOPE_DIR"/*; do
|
|
71
|
+
if [[ ! -e "$installed_path" && ! -L "$installed_path" ]]; then
|
|
72
|
+
continue
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
package_dir_name="$(basename "$installed_path")"
|
|
76
|
+
source_dir="$(resolve_source_dir "$package_dir_name")"
|
|
77
|
+
|
|
78
|
+
if [[ ! -f "$source_dir/package.json" ]]; then
|
|
79
|
+
echo "[link-local] skip @jskit-ai/$package_dir_name (no local source at $source_dir)"
|
|
80
|
+
skipped_count=$((skipped_count + 1))
|
|
81
|
+
continue
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
rm -rf "$installed_path"
|
|
85
|
+
ln -s "$source_dir" "$installed_path"
|
|
86
|
+
echo "[link-local] linked @jskit-ai/$package_dir_name -> $source_dir"
|
|
87
|
+
linked_count=$((linked_count + 1))
|
|
88
|
+
done
|
|
89
|
+
|
|
90
|
+
echo "[link-local] done. linked=$linked_count skipped=$skipped_count"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
APP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
PACKAGE_JSON_PATH="$APP_ROOT/package.json"
|
|
6
|
+
JSKIT_REGISTRY="${JSKIT_REGISTRY:-}"
|
|
7
|
+
|
|
8
|
+
if [[ ! -f "$PACKAGE_JSON_PATH" ]]; then
|
|
9
|
+
echo "[jskit:update] package.json not found: $PACKAGE_JSON_PATH" >&2
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
readarray -t runtime_packages < <(
|
|
14
|
+
node -e '
|
|
15
|
+
const fs = require("node:fs");
|
|
16
|
+
const packageJson = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
|
17
|
+
const dependencies = packageJson?.dependencies || {};
|
|
18
|
+
const names = Object.keys(dependencies).filter((name) => name.startsWith("@jskit-ai/")).sort();
|
|
19
|
+
for (const name of names) {
|
|
20
|
+
process.stdout.write(`${name}\n`);
|
|
21
|
+
}
|
|
22
|
+
' "$PACKAGE_JSON_PATH"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
readarray -t dev_packages < <(
|
|
26
|
+
node -e '
|
|
27
|
+
const fs = require("node:fs");
|
|
28
|
+
const packageJson = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
|
29
|
+
const dependencies = packageJson?.devDependencies || {};
|
|
30
|
+
const names = Object.keys(dependencies).filter((name) => name.startsWith("@jskit-ai/")).sort();
|
|
31
|
+
for (const name of names) {
|
|
32
|
+
process.stdout.write(`${name}\n`);
|
|
33
|
+
}
|
|
34
|
+
' "$PACKAGE_JSON_PATH"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
runtime_specs=()
|
|
38
|
+
for package_name in "${runtime_packages[@]}"; do
|
|
39
|
+
runtime_specs+=("${package_name}@latest")
|
|
40
|
+
done
|
|
41
|
+
|
|
42
|
+
dev_specs=()
|
|
43
|
+
for package_name in "${dev_packages[@]}"; do
|
|
44
|
+
dev_specs+=("${package_name}@latest")
|
|
45
|
+
done
|
|
46
|
+
|
|
47
|
+
registry_args=()
|
|
48
|
+
if [[ -n "$JSKIT_REGISTRY" ]]; then
|
|
49
|
+
registry_args+=(--registry "$JSKIT_REGISTRY")
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
if (( ${#runtime_specs[@]} == 0 && ${#dev_specs[@]} == 0 )); then
|
|
53
|
+
echo "[jskit:update] no @jskit-ai packages found in dependencies."
|
|
54
|
+
exit 0
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
if (( ${#runtime_specs[@]} > 0 )); then
|
|
58
|
+
echo "[jskit:update] updating runtime packages: ${runtime_specs[*]}"
|
|
59
|
+
(
|
|
60
|
+
cd "$APP_ROOT"
|
|
61
|
+
npm install --save-exact "${registry_args[@]}" "${runtime_specs[@]}"
|
|
62
|
+
)
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
if (( ${#dev_specs[@]} > 0 )); then
|
|
66
|
+
echo "[jskit:update] updating dev packages: ${dev_specs[*]}"
|
|
67
|
+
(
|
|
68
|
+
cd "$APP_ROOT"
|
|
69
|
+
npm install --save-dev --save-exact "${registry_args[@]}" "${dev_specs[@]}"
|
|
70
|
+
)
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
echo "[jskit:update] done."
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
storage: ./storage
|
|
2
|
+
|
|
3
|
+
auth:
|
|
4
|
+
htpasswd:
|
|
5
|
+
file: ./htpasswd
|
|
6
|
+
|
|
7
|
+
uplinks:
|
|
8
|
+
npmjs:
|
|
9
|
+
url: https://registry.npmjs.org/
|
|
10
|
+
|
|
11
|
+
packages:
|
|
12
|
+
"@jskit-ai/*":
|
|
13
|
+
access: $all
|
|
14
|
+
publish: $all
|
|
15
|
+
unpublish: $all
|
|
16
|
+
|
|
17
|
+
"**":
|
|
18
|
+
access: $all
|
|
19
|
+
publish: $all
|
|
20
|
+
unpublish: $all
|
|
21
|
+
proxy: npmjs
|
|
22
|
+
|
|
23
|
+
log:
|
|
24
|
+
- type: stdout
|
|
25
|
+
format: pretty
|
|
26
|
+
level: http
|