edge-functions 3.3.0 → 4.0.0
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
## [4.0.0](https://github.com/aziontech/bundler/compare/v3.3.0...v4.0.0) (2024-09-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ⚠ BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* actually, version 3.3 already has a breaking change. sorry. you can read it in the repository changelog.
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* default value for <init> scope ([77e78ae](https://github.com/aziontech/bundler/commit/77e78aec6b5cc6f82baf5387b7f714e2d6ce4631))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* ls presets ([437b9c5](https://github.com/aziontech/bundler/commit/437b9c5910a7a992a4e468ec53b4ac8d6e19ddd7))
|
|
16
|
+
* presets ls ([#384](https://github.com/aziontech/bundler/issues/384)) ([f8eb06e](https://github.com/aziontech/bundler/commit/f8eb06ec13baad1ed00697de42339785074eb83c))
|
|
17
|
+
|
|
18
|
+
## [4.0.0-stage.1](https://github.com/aziontech/bundler/compare/v3.3.0...v4.0.0-stage.1) (2024-09-25)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### ⚠ BREAKING CHANGES
|
|
22
|
+
|
|
23
|
+
* actually, version 3.3 already has a breaking change. sorry. you can read it in the repository changelog.
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* default value for <init> scope ([77e78ae](https://github.com/aziontech/bundler/commit/77e78aec6b5cc6f82baf5387b7f714e2d6ce4631))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* ls presets ([437b9c5](https://github.com/aziontech/bundler/commit/437b9c5910a7a992a4e468ec53b4ac8d6e19ddd7))
|
|
33
|
+
* presets ls ([#384](https://github.com/aziontech/bundler/issues/384)) ([f8eb06e](https://github.com/aziontech/bundler/commit/f8eb06ec13baad1ed00697de42339785074eb83c))
|
|
34
|
+
|
|
1
35
|
## [3.3.0](https://github.com/aziontech/bundler/compare/v3.2.1...v3.3.0) (2024-09-18)
|
|
2
36
|
|
|
3
37
|
|
|
@@ -27,7 +27,7 @@ async function initCommand({ preset, scope }) {
|
|
|
27
27
|
|
|
28
28
|
await vulcan.createVulcanEnv({ preset }, scope);
|
|
29
29
|
|
|
30
|
-
feedback.info(`
|
|
30
|
+
feedback.info(`Temporary store file created!`);
|
|
31
31
|
} catch (error) {
|
|
32
32
|
feedback.error(`Error creating temporary store file: ${error.message}`);
|
|
33
33
|
process.exit(1);
|
|
@@ -14,7 +14,6 @@ const prompt = createPromptModule();
|
|
|
14
14
|
* The user is guided by a series of prompts to enter a preset name.
|
|
15
15
|
* @param {string} command - The operation to be performed:
|
|
16
16
|
* 'create' to create a preset, 'ls' to list presets.
|
|
17
|
-
* @param {string} [presetName] - The name of the preset for which to list.
|
|
18
17
|
* @returns {Promise<void>} - A promise that resolves when the action is complete.
|
|
19
18
|
* @example
|
|
20
19
|
*
|
|
@@ -24,7 +23,7 @@ const prompt = createPromptModule();
|
|
|
24
23
|
* // To list existing presets
|
|
25
24
|
* presetsCommand('ls');
|
|
26
25
|
*/
|
|
27
|
-
async function presetsCommand(command
|
|
26
|
+
async function presetsCommand(command) {
|
|
28
27
|
const { presets } = await import('#utils');
|
|
29
28
|
|
|
30
29
|
let name;
|
|
@@ -70,17 +69,8 @@ async function presetsCommand(command, presetName) {
|
|
|
70
69
|
break;
|
|
71
70
|
|
|
72
71
|
case 'ls':
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (modes.length > 0) {
|
|
76
|
-
modes.forEach((presetMode) => feedback.option(presetMode));
|
|
77
|
-
} else {
|
|
78
|
-
feedback.error(`No modes found for preset ${presetName}.`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (!presetName) {
|
|
82
|
-
presets.getBeautify().forEach((preset) => feedback.option(preset));
|
|
83
|
-
}
|
|
72
|
+
presets.getBeautify().forEach((preset) => feedback.option(preset));
|
|
73
|
+
|
|
84
74
|
break;
|
|
85
75
|
|
|
86
76
|
default:
|
package/lib/main.js
CHANGED
|
@@ -156,7 +156,7 @@ function startVulcanProgram() {
|
|
|
156
156
|
program
|
|
157
157
|
.command('init')
|
|
158
158
|
.option('--preset <preset_name>', 'Preset name', false)
|
|
159
|
-
.option('--scope <scope>', 'project scope',
|
|
159
|
+
.option('--scope <scope>', 'project scope', 'global')
|
|
160
160
|
.description('Initialize temporary store')
|
|
161
161
|
.action(async (options) => {
|
|
162
162
|
const { initCommand } = await import('#commands');
|
|
@@ -212,9 +212,9 @@ function startVulcanProgram() {
|
|
|
212
212
|
.description(
|
|
213
213
|
'Create <create> or list <ls> defined project presets for Edge',
|
|
214
214
|
)
|
|
215
|
-
.action(async (command
|
|
215
|
+
.action(async (command) => {
|
|
216
216
|
const { presetsCommand } = await import('#commands');
|
|
217
|
-
await presetsCommand(command
|
|
217
|
+
await presetsCommand(command);
|
|
218
218
|
});
|
|
219
219
|
|
|
220
220
|
program.parse(process.argv);
|
|
@@ -24,11 +24,11 @@ if (!isWindows) {
|
|
|
24
24
|
* Unlike `getKeys`, this method returns preset names formatted
|
|
25
25
|
* for display and includes modes like '(Deliver)' or '(Compute)'.
|
|
26
26
|
* Each type corresponds to a folder in the 'presets' directory.
|
|
27
|
-
* @returns {string[]} The list of presets
|
|
27
|
+
* @returns {string[]} The list of presets.
|
|
28
28
|
* @example
|
|
29
29
|
* const presetsList = getBeautify();
|
|
30
30
|
* console.log(presetsList);
|
|
31
|
-
* // Output might be: ['Angular
|
|
31
|
+
* // Output might be: ['Angular', 'React', 'Vue']
|
|
32
32
|
*/
|
|
33
33
|
function getBeautify() {
|
|
34
34
|
const presets = [];
|
|
@@ -37,25 +37,9 @@ function getBeautify() {
|
|
|
37
37
|
const folders = fs
|
|
38
38
|
.readdirSync(presetsDir, { withFileTypes: true })
|
|
39
39
|
.filter((dirent) => dirent.isDirectory())
|
|
40
|
-
.
|
|
40
|
+
.map((dirent) => {
|
|
41
41
|
const presetName = dirent.name;
|
|
42
|
-
|
|
43
|
-
.readdirSync(path.join(presetsDir, presetName), {
|
|
44
|
-
withFileTypes: true,
|
|
45
|
-
})
|
|
46
|
-
.filter((subDirent) => subDirent.isDirectory());
|
|
47
|
-
|
|
48
|
-
if (subDirs.length === 0) {
|
|
49
|
-
return [presetName.charAt(0).toUpperCase() + presetName.slice(1)];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return subDirs.map((subDir) => {
|
|
53
|
-
const subDirName =
|
|
54
|
-
subDir.name.charAt(0).toUpperCase() + subDir.name.slice(1);
|
|
55
|
-
return `${
|
|
56
|
-
presetName.charAt(0).toUpperCase() + presetName.slice(1)
|
|
57
|
-
} (${subDirName})`;
|
|
58
|
-
});
|
|
42
|
+
return presetName.charAt(0).toUpperCase() + presetName.slice(1);
|
|
59
43
|
});
|
|
60
44
|
|
|
61
45
|
presets.push(...folders);
|
|
@@ -111,37 +95,6 @@ function set(name) {
|
|
|
111
95
|
fs.writeFileSync(path.join(presetPath, 'prebuild.js'), '');
|
|
112
96
|
fs.writeFileSync(path.join(presetPath, 'config.js'), '');
|
|
113
97
|
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @function
|
|
117
|
-
* @memberof Utils
|
|
118
|
-
* @description Retrieves an array of available modes for a given preset.
|
|
119
|
-
* Each sub-folder name in these directories is considered as a valid mode for the preset.
|
|
120
|
-
* @param {string} presetName - The name of the preset for which modes are to be retrieved.
|
|
121
|
-
* @returns {string[]} An array of available modes for the given preset.
|
|
122
|
-
* @example
|
|
123
|
-
* const availableModes = getModes('angular');
|
|
124
|
-
* console.log(availableModes);
|
|
125
|
-
* // Output might be: ['Deliver']
|
|
126
|
-
* @throws {Error} Throws an error if unable to read the directory.
|
|
127
|
-
*/
|
|
128
|
-
function getModes(presetName) {
|
|
129
|
-
const modes = [];
|
|
130
|
-
|
|
131
|
-
const presetPath = path.join(baselibPath, 'presets', presetName);
|
|
132
|
-
|
|
133
|
-
if (fs.existsSync(presetPath)) {
|
|
134
|
-
const directories = fs
|
|
135
|
-
.readdirSync(presetPath, { withFileTypes: true })
|
|
136
|
-
.filter((dir) => dir.isDirectory())
|
|
137
|
-
.map((dir) => dir.name.charAt(0).toUpperCase() + dir.name.slice(1));
|
|
138
|
-
|
|
139
|
-
modes.push(...directories);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return modes;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
98
|
/**
|
|
146
99
|
* @function
|
|
147
100
|
* @memberof Utils
|
|
@@ -150,8 +103,6 @@ function getModes(presetName) {
|
|
|
150
103
|
* These keys are raw and do not include any modes or formatting.
|
|
151
104
|
* @property {Function} getBeautify - Function to retrieve a list of presets in a beautified format.
|
|
152
105
|
* Unlike `getKeys`, the names are formatted and include modes like '(Compute)' or '(Deliver)'.
|
|
153
|
-
* @property {Function} getModes - Function to retrieve an array of a
|
|
154
|
-
* vailable modes for a given preset.
|
|
155
106
|
* @property {Function} set - Function to create a new preset along with its required files.
|
|
156
107
|
* @example
|
|
157
108
|
* import { presets } from '#utils';
|
|
@@ -162,8 +113,6 @@ function getModes(presetName) {
|
|
|
162
113
|
* // Get beautified preset names
|
|
163
114
|
* const beautifiedNames = presets.getBeautify();
|
|
164
115
|
*
|
|
165
|
-
* // Get available modes for a preset
|
|
166
|
-
* const availableModes = presets.getModes('angular');
|
|
167
116
|
*
|
|
168
117
|
* // Create a new preset
|
|
169
118
|
* presets.set('MyNewPreset');
|
|
@@ -171,7 +120,6 @@ function getModes(presetName) {
|
|
|
171
120
|
const presets = {
|
|
172
121
|
getKeys,
|
|
173
122
|
getBeautify,
|
|
174
|
-
getModes,
|
|
175
123
|
set,
|
|
176
124
|
};
|
|
177
125
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-functions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"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.",
|
|
6
6
|
"main": "lib/main.js",
|
|
7
7
|
"bin": {
|