Files
cell/scripts/vendor.js
John Alanbrook 939269b060
Some checks failed
Build and Deploy / build-macos (push) Failing after 7s
Build and Deploy / build-linux (push) Has been cancelled
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled
initial modules attempt
2025-05-29 18:48:19 -05:00

47 lines
1.2 KiB
JavaScript

// cell vendor - Copy all dependencies into modules/ for hermetic builds
var io = use('io')
var shop = use('shop')
if (!io.exists('.cell/shop.toml')) {
log.error("No shop.toml found. Run 'cell init' first.")
$_.stop()
return
}
var config = shop.load_config()
if (!config || !config.dependencies) {
log.console("No dependencies to vendor")
$_.stop()
return
}
log.console("Vendoring dependencies...")
for (var alias in config.dependencies) {
var locator = config.dependencies[alias]
var parsed = shop.parse_locator(locator)
if (!parsed) {
log.error("Invalid locator: " + locator)
continue
}
var module_dir = '.cell/modules/' + alias + '@' + parsed.version
if (config.replace && config.replace[locator]) {
// Already using local path
log.console(alias + " - using local path: " + config.replace[locator])
} else if (!io.exists(module_dir)) {
log.console(alias + " - not found at " + module_dir)
log.console(" Run 'cell get " + locator + "' to fetch it")
} else {
log.console(alias + " - already vendored at " + module_dir)
}
}
log.console("")
log.console("All dependencies are vendored in .cell/modules/")
log.console("This ensures hermetic, reproducible builds.")
$_.stop()