From cae934fa0019f821f58964d00b2da9f5eabd414d Mon Sep 17 00:00:00 2001 From: jotanarciso Date: Tue, 5 Nov 2024 20:35:55 -0300 Subject: [PATCH] refactor: mv presets azion.config.js --- lib/presets/angular/azion.config.js | 56 +++------------------- lib/presets/astro/azion.config.js | 62 ++++-------------------- lib/presets/docusaurus/azion.config.js | 62 ++++-------------------- lib/presets/eleventy/azion.config.js | 62 ++++-------------------- lib/presets/emscripten/azion.config.js | 29 ++++------- lib/presets/gatsby/azion.config.js | 64 ++++--------------------- lib/presets/hexo/azion.config.js | 64 ++++--------------------- lib/presets/html/azion.config.js | 38 ++++----------- lib/presets/hugo/azion.config.js | 64 ++++--------------------- lib/presets/javascript/azion.config.js | 31 ++++-------- lib/presets/jekyll/azion.config.js | 64 ++++--------------------- lib/presets/next/azion.config.js | 61 ++++-------------------- lib/presets/nuxt/azion.config.js | 65 ++++--------------------- lib/presets/react/azion.config.js | 55 ++++----------------- lib/presets/rustwasm/azion.config.js | 31 ++++-------- lib/presets/svelte/azion.config.js | 66 ++++---------------------- lib/presets/typescript/azion.config.js | 31 ++++-------- lib/presets/vitepress/azion.config.js | 64 ++++--------------------- lib/presets/vue/azion.config.js | 56 ++++------------------ 19 files changed, 175 insertions(+), 850 deletions(-) diff --git a/lib/presets/angular/azion.config.js b/lib/presets/angular/azion.config.js index 9ec3eaef..7b56178c 100644 --- a/lib/presets/angular/azion.config.js +++ b/lib/presets/angular/azion.config.js @@ -1,52 +1,10 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -const config = defineConfig({ - build: { - preset: { - name: 'angular', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - - { - name: 'Redirect to index.html', - match: '^\\/', - behavior: { - rewrite: `/index.html`, - }, - }, - ], - }, -}); +import { Angular } from 'azion/presets'; +const { config } = Angular; export default config; diff --git a/lib/presets/astro/azion.config.js b/lib/presets/astro/azion.config.js index 39e65fd3..e2ccc683 100644 --- a/lib/presets/astro/azion.config.js +++ b/lib/presets/astro/azion.config.js @@ -1,57 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -const config = defineConfig({ - build: { - preset: { - name: 'astro', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +import { Astro } from 'azion/presets'; + +const { config } = Astro; export default config; diff --git a/lib/presets/docusaurus/azion.config.js b/lib/presets/docusaurus/azion.config.js index 01c1b235..e5cb0f9c 100644 --- a/lib/presets/docusaurus/azion.config.js +++ b/lib/presets/docusaurus/azion.config.js @@ -1,57 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -const config = defineConfig({ - build: { - preset: { - name: 'docusaurus', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +import { Docusaurus } from 'azion/presets'; + +const { config } = Docusaurus; export default config; diff --git a/lib/presets/eleventy/azion.config.js b/lib/presets/eleventy/azion.config.js index 97d5c05b..eb42dadf 100644 --- a/lib/presets/eleventy/azion.config.js +++ b/lib/presets/eleventy/azion.config.js @@ -1,57 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -const config = defineConfig({ - build: { - preset: { - name: 'eleventy', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +import { Eleventy } from 'azion/presets'; + +const { config } = Eleventy; export default config; diff --git a/lib/presets/emscripten/azion.config.js b/lib/presets/emscripten/azion.config.js index d8dfd289..1602ddc1 100644 --- a/lib/presets/emscripten/azion.config.js +++ b/lib/presets/emscripten/azion.config.js @@ -1,24 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -const config = defineConfig({ - build: { - preset: { - name: 'emscripten', - }, - }, - rules: { - request: [ - { - name: 'Execute Edge Function', - match: '^\\/', - behavior: { - runFunction: { - path: '.edge/worker.js', - }, - }, - }, - ], - }, -}); +import { Emscripten } from 'azion/presets'; + +const { config } = Emscripten; export default config; diff --git a/lib/presets/gatsby/azion.config.js b/lib/presets/gatsby/azion.config.js index 8e7fd10f..f2a45be2 100644 --- a/lib/presets/gatsby/azion.config.js +++ b/lib/presets/gatsby/azion.config.js @@ -1,55 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'gatsby', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +import { Gatsby } from 'azion/presets'; + +const { config } = Gatsby; + +export default config; diff --git a/lib/presets/hexo/azion.config.js b/lib/presets/hexo/azion.config.js index efc30d54..f2a45be2 100644 --- a/lib/presets/hexo/azion.config.js +++ b/lib/presets/hexo/azion.config.js @@ -1,55 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'hexo', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +import { Gatsby } from 'azion/presets'; + +const { config } = Gatsby; + +export default config; diff --git a/lib/presets/html/azion.config.js b/lib/presets/html/azion.config.js index d30e74db..95f618df 100644 --- a/lib/presets/html/azion.config.js +++ b/lib/presets/html/azion.config.js @@ -1,29 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'html', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - ], - }, -}); +import { Html } from 'azion/presets'; + +const { config } = Html; + +export default config; diff --git a/lib/presets/hugo/azion.config.js b/lib/presets/hugo/azion.config.js index b09f340b..d130fcd7 100644 --- a/lib/presets/hugo/azion.config.js +++ b/lib/presets/hugo/azion.config.js @@ -1,55 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'hugo', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +import { Hugo } from 'azion/presets'; + +const { config } = Hugo; + +export default config; diff --git a/lib/presets/javascript/azion.config.js b/lib/presets/javascript/azion.config.js index efa6ac28..660d4701 100644 --- a/lib/presets/javascript/azion.config.js +++ b/lib/presets/javascript/azion.config.js @@ -1,22 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'javascript', - }, - }, - rules: { - request: [ - { - name: 'Execute Edge Function', - match: '^\\/', - behavior: { - runFunction: { - path: '.edge/worker.js', - }, - }, - }, - ], - }, -}); +import { JavaScript } from 'azion/presets'; + +const { config } = JavaScript; + +export default config; diff --git a/lib/presets/jekyll/azion.config.js b/lib/presets/jekyll/azion.config.js index 6127a13f..eb578b23 100644 --- a/lib/presets/jekyll/azion.config.js +++ b/lib/presets/jekyll/azion.config.js @@ -1,55 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'jekyll', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +import { Jekyll } from 'azion/presets'; + +const { config } = Jekyll; + +export default config; diff --git a/lib/presets/next/azion.config.js b/lib/presets/next/azion.config.js index e9882498..2d29d2a0 100644 --- a/lib/presets/next/azion.config.js +++ b/lib/presets/next/azion.config.js @@ -1,52 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'next', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/_next\\/static\\/', // starts with '/_next/static/' - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Execute Edge Function', - match: '^/', - behavior: { - runFunction: { - path: '.edge/worker.js', - }, - forwardCookies: true, - }, - }, - ], - }, -}); +import { Next } from 'azion/presets'; + +const { config } = Next; + +export default config; diff --git a/lib/presets/nuxt/azion.config.js b/lib/presets/nuxt/azion.config.js index f0c14bd8..b28072f2 100644 --- a/lib/presets/nuxt/azion.config.js +++ b/lib/presets/nuxt/azion.config.js @@ -1,57 +1,10 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ +import { Nuxt } from 'azion/presets'; -export default defineConfig({ - build: { - preset: { - name: 'nuxt', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - // eslint-disable-next-line no-template-curly-in-string - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - // eslint-disable-next-line no-template-curly-in-string - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +const { config } = Nuxt; + +export default config; diff --git a/lib/presets/react/azion.config.js b/lib/presets/react/azion.config.js index 38d79792..922e5674 100644 --- a/lib/presets/react/azion.config.js +++ b/lib/presets/react/azion.config.js @@ -1,50 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'react', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, +import { React } from 'azion/presets'; - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, +const { config } = React; - { - name: 'Redirect to index.html', - match: '^\\/', - behavior: { - rewrite: `/index.html`, - }, - }, - ], - }, -}); +export default config; diff --git a/lib/presets/rustwasm/azion.config.js b/lib/presets/rustwasm/azion.config.js index ef3d4250..4aea57f9 100644 --- a/lib/presets/rustwasm/azion.config.js +++ b/lib/presets/rustwasm/azion.config.js @@ -1,22 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'rustwasm', - }, - }, - rules: { - request: [ - { - name: 'Execute Edge Function', - match: '^\\/', - behavior: { - runFunction: { - path: '.edge/worker.js', - }, - }, - }, - ], - }, -}); +import { RustWasm } from 'azion/presets'; + +const { config } = RustWasm; + +export default config; diff --git a/lib/presets/svelte/azion.config.js b/lib/presets/svelte/azion.config.js index ff978b0c..7f6af5b7 100644 --- a/lib/presets/svelte/azion.config.js +++ b/lib/presets/svelte/azion.config.js @@ -1,57 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'svelte', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - // eslint-disable-next-line no-template-curly-in-string - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - // eslint-disable-next-line no-template-curly-in-string - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +import { Svelte } from 'azion/presets'; + +const { config } = Svelte; + +export default config; diff --git a/lib/presets/typescript/azion.config.js b/lib/presets/typescript/azion.config.js index 0211d676..760f7892 100644 --- a/lib/presets/typescript/azion.config.js +++ b/lib/presets/typescript/azion.config.js @@ -1,22 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'typescript', - }, - }, - rules: { - request: [ - { - name: 'Execute Edge Function', - match: '^\\/', - behavior: { - runFunction: { - path: '.edge/worker.js', - }, - }, - }, - ], - }, -}); +import { TypeScript } from 'azion/presets'; + +const { config } = TypeScript; + +export default config; diff --git a/lib/presets/vitepress/azion.config.js b/lib/presets/vitepress/azion.config.js index afb847a9..f6638234 100644 --- a/lib/presets/vitepress/azion.config.js +++ b/lib/presets/vitepress/azion.config.js @@ -1,55 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'vitepress', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, - { - name: 'Redirect to index.html', - match: '.*/$', - behavior: { - rewrite: '${uri}index.html', - }, - }, - { - name: 'Redirect to index.html for Subpaths', - match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*', - behavior: { - rewrite: '${uri}/index.html', - }, - }, - ], - }, -}); +import { VitePress } from 'azion/presets'; + +const { config } = VitePress; + +export default config; diff --git a/lib/presets/vue/azion.config.js b/lib/presets/vue/azion.config.js index 1299e2a9..530315bb 100644 --- a/lib/presets/vue/azion.config.js +++ b/lib/presets/vue/azion.config.js @@ -1,49 +1,11 @@ -import { defineConfig } from 'azion'; +/** + * NOTE: We are gradually migrating all configurations to the Azion library + * through the azion/presets package (@https://github.com/aziontech/lib/tree/main/packages/presets). + * This helps standardize our setup and maintain consistency across projects. + */ -export default defineConfig({ - build: { - preset: { - name: 'vue', - }, - }, - origin: [ - { - name: 'origin-storage-default', - type: 'object_storage', - }, - ], - rules: { - request: [ - { - name: 'Set Storage Origin for All Requests', - match: '^\\/', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - }, - }, - { - name: 'Deliver Static Assets', - match: - '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$', - behavior: { - setOrigin: { - name: 'origin-storage-default', - type: 'object_storage', - }, - deliver: true, - }, - }, +import { Vue } from 'azion/presets'; - { - name: 'Redirect to index.html', - match: '^\\/', - behavior: { - rewrite: `/index.html`, - }, - }, - ], - }, -}); +const { config } = Vue; + +export default config;