Skip to content

Commit

Permalink
Release 4.4.0 (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
jotanarciso authored Jan 21, 2025
2 parents 4d4a498 + 30317fc commit 7ec6aa1
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [4.4.0-stage.1](https://github.com/aziontech/bundler/compare/v4.3.0...v4.4.0-stage.1) (2025-01-13)


### Features

* transform json manifest into js command ([#417](https://github.com/aziontech/bundler/issues/417)) ([391b30d](https://github.com/aziontech/bundler/commit/391b30df01114aa0da55630e23147a6f9cfe797e))

## [4.3.0](https://github.com/aziontech/bundler/compare/v4.2.1...v4.3.0) (2024-12-13)


Expand Down
9 changes: 8 additions & 1 deletion lib/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@ import buildCommand from './build.commands.js';
import devCommand from './dev.commands.js';
import initCommand from './init.commands.js';
import presetsCommand from './presets.commands.js';
import manifestCommand from './manifest.commands.js';

export { buildCommand, devCommand, initCommand, presetsCommand };
export {
buildCommand,
devCommand,
initCommand,
presetsCommand,
manifestCommand,
};
68 changes: 68 additions & 0 deletions lib/commands/manifest.commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { readFileSync, writeFileSync } from 'fs';
import { resolve, extname } from 'path';
import { feedback, debug } from '#utils';
import { Messages } from '#constants';
import { convertJsonConfigToObject } from 'azion';

import { Commands } from '#namespaces';
/**
* @function manifestCommand
* @memberof Commands
* @description
* transforms a JSON manifest file to a JavaScript module.
*
* Usage:
* ```bash
* az manifest transform <input.json> -o <output.js>
* ```
*
* Example:
* ```bash
* az manifest transform .edge/manifest.json -o azion.config.js
* ```
* @param {string} command - The operation to perform (only 'transform' for now)
* @param {string} entry - Path to the input JSON file
* @param {object} options - Command options
* @param {string} options.output - Output file path for JS module
*/
async function manifestCommand(command, entry, options) {
try {
if (command !== 'transform') {
feedback.error('Only transform command is supported');
process.exit(1);
}

if (!entry) {
feedback.error('Input file path is required');
process.exit(1);
}

if (!options.output) {
feedback.error('Output file path is required (--output)');
process.exit(1);
}

const fileExtension = extname(entry).toLowerCase();
if (fileExtension !== '.json') {
feedback.error('Input file must be .json');
process.exit(1);
}

const absolutePath = resolve(process.cwd(), entry);
const jsonString = readFileSync(absolutePath, 'utf8');
const config = convertJsonConfigToObject(jsonString);

const jsContent = `export default ${JSON.stringify(config, null, 2)};`;
writeFileSync(options.output, jsContent);

feedback.success(
`Azion Platform configuration transformed into JavaScript module at ${options.output}`,
);
} catch (error) {
debug.error(error);
feedback.error(Messages.errors.unknown_error);
process.exit(1);
}
}

export default manifestCommand;
14 changes: 13 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,25 @@ function startVulcanProgram() {
program
.command('presets <command>')
.description(
'Create <create> or list <ls> defined project presets for Edge',
'Create <create> or list <ls> defined project presets for Azion',
)
.action(async (command) => {
const { presetsCommand } = await import('#commands');
await presetsCommand(command);
});

program
.command('manifest <command>')
.description(
'Trasnform <transform> or validate <validate> manifest files for Azion',
)
.argument('[entry]', 'Path to the input file')
.option('-o, --output <path>', 'Output file path for convert command')
.action(async (command, entry, options) => {
const { manifestCommand } = await import('#commands');
await manifestCommand(command, entry, convertOptions(options));
});

program.parse(process.argv);
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "edge-functions",
"type": "module",
"version": "4.3.0",
"version": "4.4.0-stage.1",
"description": "Tool to launch and build JavaScript/Frameworks. This tool automates polyfills for Edge Computing and assists in creating Workers, notably for the Azion platform.",
"main": "lib/main.js",
"bin": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"ajv-errors": "^3.0.0",
"ajv-keywords": "^5.1.0",
"assert": "^2.0.0",
"azion": "^1.10.0",
"azion": "^1.12.0",
"babel-loader": "^9.2.1",
"bottleneck": "^2.19.5",
"browserify-zlib": "^0.2.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2493,10 +2493,10 @@ axios@^1.6.1:
form-data "^4.0.0"
proxy-from-env "^1.1.0"

azion@^1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/azion/-/azion-1.10.0.tgz#547e21a2fa9e696176e068d6167a5aea49a54990"
integrity sha512-UE6BCaq6DbAUUUmiIIFZko0QhpX9A9qhMD/HCbyqVQK0b19+JmCLwPVsJ6RkL6OvYvUIWvOFfzFaB4qvEbitpA==
azion@^1.12.0:
version "1.12.0"
resolved "https://registry.yarnpkg.com/azion/-/azion-1.12.0.tgz#74d85b3cd406b6e20b61d984dc98aeaee417eb23"
integrity sha512-J9upHyyqi40xIhEIM15Wi9/G0RH24OEfTiskSQKK42wyazALtPTKQ0VmFI0l+Uy44cR1vNEo0/eS9NOCI6v12A==
dependencies:
chalk "^5.3.0"
progress "^2.0.3"
Expand Down

0 comments on commit 7ec6aa1

Please sign in to comment.