update to new naming scheme

This commit is contained in:
2025-05-31 16:45:56 -05:00
parent 6dee29d213
commit a442cf5a4d
11 changed files with 45 additions and 153 deletions

View File

@@ -1,105 +0,0 @@
// Simple TOML parser for shop.toml
// Supports basic TOML features needed for the module system
function parse_toml(text) {
var lines = text.split('\n')
var result = {}
var current_section = result
var current_section_name = ''
for (var i = 0; i < lines.length; i++) {
var line = lines[i].trim()
// Skip empty lines and comments
if (!line || line.startsWith('#')) continue
// Section header
if (line.startsWith('[') && line.endsWith(']')) {
var section_path = line.slice(1, -1).split('.')
current_section = result
current_section_name = section_path.join('.')
for (var j = 0; j < section_path.length; j++) {
var key = section_path[j]
if (!current_section[key]) {
current_section[key] = {}
}
current_section = current_section[key]
}
continue
}
// Key-value pair
var eq_index = line.indexOf('=')
if (eq_index > 0) {
var key = line.substring(0, eq_index).trim()
var value = line.substring(eq_index + 1).trim()
// Parse value
if (value.startsWith('"') && value.endsWith('"')) {
// String
current_section[key] = value.slice(1, -1)
} else if (value.startsWith('[') && value.endsWith(']')) {
// Array
current_section[key] = parse_array(value)
} else if (value === 'true' || value === 'false') {
// Boolean
current_section[key] = value === 'true'
} else if (!isNaN(Number(value))) {
// Number
current_section[key] = Number(value)
} else {
// Unquoted string
current_section[key] = value
}
}
}
return result
}
function parse_array(str) {
// Remove brackets
str = str.slice(1, -1).trim()
if (!str) return []
var items = []
var current = ''
var in_quotes = false
for (var i = 0; i < str.length; i++) {
var char = str[i]
if (char === '"' && (i === 0 || str[i-1] !== '\\')) {
in_quotes = !in_quotes
current += char
} else if (char === ',' && !in_quotes) {
items.push(parse_value(current.trim()))
current = ''
} else {
current += char
}
}
if (current.trim()) {
items.push(parse_value(current.trim()))
}
return items
}
function parse_value(str) {
if (str.startsWith('"') && str.endsWith('"')) {
return str.slice(1, -1)
} else if (str === 'true' || str === 'false') {
return str === 'true'
} else if (!isNaN(Number(str))) {
return Number(str)
} else {
return str
}
}
return {
parse: parse_toml
}

View File

@@ -1,3 +1,47 @@
log.console(`not implemented.sorry.`)
// 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()

View File

@@ -1,47 +0,0 @@
// 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()