diff --git a/scripts/build.js b/scripts/build.ce similarity index 100% rename from scripts/build.js rename to scripts/build.ce diff --git a/scripts/get.js b/scripts/get.ce similarity index 100% rename from scripts/get.js rename to scripts/get.ce diff --git a/scripts/init.js b/scripts/init.ce similarity index 100% rename from scripts/init.js rename to scripts/init.ce diff --git a/scripts/module_resolver.js b/scripts/module_resolver.cm similarity index 100% rename from scripts/module_resolver.js rename to scripts/module_resolver.cm diff --git a/scripts/patch.js b/scripts/patch.ce similarity index 100% rename from scripts/patch.js rename to scripts/patch.ce diff --git a/scripts/shop.js b/scripts/shop.cm similarity index 100% rename from scripts/shop.js rename to scripts/shop.cm diff --git a/scripts/toml.js b/scripts/toml.js deleted file mode 100644 index da3478ba..00000000 --- a/scripts/toml.js +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/scripts/update.js b/scripts/update.ce similarity index 100% rename from scripts/update.js rename to scripts/update.ce diff --git a/scripts/vendor.ce b/scripts/vendor.ce index ef21de1b..28be9772 100644 --- a/scripts/vendor.ce +++ b/scripts/vendor.ce @@ -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() \ No newline at end of file diff --git a/scripts/vendor.js b/scripts/vendor.js deleted file mode 100644 index 28be9772..00000000 --- a/scripts/vendor.js +++ /dev/null @@ -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() \ No newline at end of file diff --git a/scripts/test_modules.js b/tests/modules.ce similarity index 100% rename from scripts/test_modules.js rename to tests/modules.ce