@tgrv/void-cli 1.0.8 → 1.0.9
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/void.js +45 -0
- package/package.json +1 -1
package/bin/void.js
CHANGED
|
@@ -100,6 +100,50 @@ function copyFolderRecursive(src, dest, replacements = {}) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
function copyNonSourceFiles(src, dest, buildOutputDir) {
|
|
104
|
+
ensureDir(dest);
|
|
105
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
106
|
+
for (const entry of entries) {
|
|
107
|
+
const srcPath = path.join(src, entry.name);
|
|
108
|
+
const destPath = path.join(dest, entry.name);
|
|
109
|
+
|
|
110
|
+
// Prevent copying the build output directory into itself
|
|
111
|
+
if (srcPath === buildOutputDir || srcPath.startsWith(buildOutputDir + path.sep)) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Skip standard build/dev folders
|
|
116
|
+
if (entry.name === "@void" ||
|
|
117
|
+
entry.name === "@tgrv" ||
|
|
118
|
+
entry.name === "target" ||
|
|
119
|
+
entry.name === ".git" ||
|
|
120
|
+
entry.name === "node_modules") {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (entry.isDirectory()) {
|
|
125
|
+
copyNonSourceFiles(srcPath, destPath, buildOutputDir);
|
|
126
|
+
} else {
|
|
127
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
128
|
+
const filename = entry.name.toLowerCase();
|
|
129
|
+
|
|
130
|
+
// Exclude Go/Rust/Cargo files and build binaries/configs
|
|
131
|
+
if (ext === ".go" ||
|
|
132
|
+
ext === ".rs" ||
|
|
133
|
+
filename === "cargo.toml" ||
|
|
134
|
+
filename === "cargo.lock" ||
|
|
135
|
+
filename === "go.mod" ||
|
|
136
|
+
filename === "go.sum" ||
|
|
137
|
+
filename === "void.json" ||
|
|
138
|
+
filename === "plugin.wasm") {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
fs.copyFileSync(srcPath, destPath);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
103
147
|
const args = process.argv.slice(2);
|
|
104
148
|
const command = args[0];
|
|
105
149
|
|
|
@@ -258,6 +302,7 @@ const plugin = await runtime.load(
|
|
|
258
302
|
export default plugin;
|
|
259
303
|
`;
|
|
260
304
|
fs.writeFileSync(path.join(buildOutputDir, "index.js"), indexJsContent);
|
|
305
|
+
copyNonSourceFiles(absolutePluginDir, buildOutputDir, buildOutputDir);
|
|
261
306
|
console.log(`${tick} ${colors.green}Successfully completed compilation & packaging!${colors.reset}`);
|
|
262
307
|
return buildOutputDir;
|
|
263
308
|
}
|