@syengup/friday-channel-next 0.0.25 → 0.0.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/install.js +25 -10
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -124,6 +124,19 @@ if (!existsSync(OPENCLAW_CONFIG)) {
|
|
|
124
124
|
|
|
125
125
|
// --------------- acquire source ---------------
|
|
126
126
|
|
|
127
|
+
function copyFromNpmPackage() {
|
|
128
|
+
log(`Copying plugin from npm package to ${PLUGIN_DIR} ...`);
|
|
129
|
+
cpSync(__dirname, PLUGIN_DIR, {
|
|
130
|
+
recursive: true,
|
|
131
|
+
filter: (src) => {
|
|
132
|
+
const rel = relative(__dirname, src);
|
|
133
|
+
if (rel === "") return true; // root dir
|
|
134
|
+
const top = rel.split(sep)[0];
|
|
135
|
+
return ![".git", "node_modules", "dist", "attachments", ".claude"].includes(top);
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
127
140
|
if (existsSync(PLUGIN_DIR)) {
|
|
128
141
|
log(`Plugin directory found: ${PLUGIN_DIR}`);
|
|
129
142
|
if (existsSync(join(PLUGIN_DIR, ".git"))) {
|
|
@@ -134,18 +147,20 @@ if (existsSync(PLUGIN_DIR)) {
|
|
|
134
147
|
} catch {
|
|
135
148
|
warn("Could not update from git — continuing with existing source.");
|
|
136
149
|
}
|
|
150
|
+
} else if (isRunningFromNpmPackage()) {
|
|
151
|
+
copyFromNpmPackage();
|
|
152
|
+
} else {
|
|
153
|
+
// No .git, running locally — re-execute via npx to get the latest
|
|
154
|
+
log("Updating via npx...");
|
|
155
|
+
try {
|
|
156
|
+
execSync("npx -y @syengup/friday-channel-next", { stdio: "inherit" });
|
|
157
|
+
process.exit(0);
|
|
158
|
+
} catch {
|
|
159
|
+
warn("Could not update via npx — continuing with existing source.");
|
|
160
|
+
}
|
|
137
161
|
}
|
|
138
162
|
} else if (isRunningFromNpmPackage()) {
|
|
139
|
-
|
|
140
|
-
cpSync(__dirname, PLUGIN_DIR, {
|
|
141
|
-
recursive: true,
|
|
142
|
-
filter: (src) => {
|
|
143
|
-
const rel = relative(__dirname, src);
|
|
144
|
-
if (rel === "") return true; // root dir
|
|
145
|
-
const top = rel.split(sep)[0];
|
|
146
|
-
return ![".git", "node_modules", "dist", "attachments", ".claude"].includes(top);
|
|
147
|
-
},
|
|
148
|
-
});
|
|
163
|
+
copyFromNpmPackage();
|
|
149
164
|
} else {
|
|
150
165
|
if (!has("git")) {
|
|
151
166
|
err("git is required for installation from GitHub. Install git first or use npx @openclaw/friday-channel-next.");
|