@backpackjs/transform-redirects
Advanced tools
Comparing version 4.2.0 to 4.2.1-canary.47.2552574952.0
@@ -24,3 +24,3 @@ "use strict"; | ||
if (!from || !to) { | ||
throw new Error('Malformed redirect'); | ||
throw new Error("Malformed redirect"); | ||
} | ||
@@ -30,4 +30,4 @@ const fromUrl = new URL(from, process.env.SITE_URL); | ||
const fromQuery = Array.from(fromUrl.searchParams) | ||
.map(([key, value]) => `${key}=${value.replace(/\s/g, '+')}`) | ||
.join(' '); | ||
.map(([key, value]) => `${key}=${value.replace(/\s/g, "+")}`) | ||
.join(" "); | ||
return `${fromPath} ${fromQuery} ${to} ${status}`; | ||
@@ -46,4 +46,4 @@ }; | ||
const backpackRedirects = await fetchBackpackRedirects(); | ||
const toProductsRedirect = toResourceRedirect('products'); | ||
const toCollectionsRedirect = toResourceRedirect('collections'); | ||
const toProductsRedirect = toResourceRedirect("products"); | ||
const toCollectionsRedirect = toResourceRedirect("collections"); | ||
const redirects = [ | ||
@@ -54,7 +54,7 @@ ...backpackRedirects.map(toBackpackRedirect), | ||
]; | ||
await fs_extra_1.default.outputFile(path_1.default.resolve(input.context.target, `public/_redirects`), redirects.join('\n')); | ||
await fs_extra_1.default.outputFile(path_1.default.resolve(input.context.target, `public/_redirects`), redirects.join("\n")); | ||
return input; | ||
} | ||
catch (error) { | ||
input._task.title = `❌ error in Redirects Transform: ${error.message}`; | ||
input.task.title = `❌ error in Redirects Transform: ${error.message}`; | ||
return input; | ||
@@ -61,0 +61,0 @@ // throw error; |
{ | ||
"name": "@backpackjs/transform-redirects", | ||
"version": "4.2.0", | ||
"version": "4.2.1-canary.47.2552574952.0", | ||
"license": "MIT", | ||
@@ -23,3 +23,3 @@ "author": "BackpackJS <dev@packdigial.com> (http://packdigital.com/)", | ||
}, | ||
"gitHead": "ff414f68854e024e4344a7ff8b16619afd4ce474" | ||
"gitHead": "4ee331912d8ddeca478c2aeaa12f69aaaa8c5d27" | ||
} |
@@ -1,6 +0,6 @@ | ||
import path from 'path'; | ||
import fs from 'fs-extra'; | ||
import path from "path"; | ||
import fs from "fs-extra"; | ||
import query from './query'; | ||
import client from './client'; | ||
import query from "./query"; | ||
import client from "./client"; | ||
@@ -28,3 +28,3 @@ const fetchBackpackRedirects = async () => { | ||
if (!from || !to) { | ||
throw new Error('Malformed redirect'); | ||
throw new Error("Malformed redirect"); | ||
} | ||
@@ -35,4 +35,4 @@ | ||
const fromQuery = Array.from(fromUrl.searchParams) | ||
.map(([key, value]) => `${key}=${value.replace(/\s/g, '+')}`) | ||
.join(' '); | ||
.map(([key, value]) => `${key}=${value.replace(/\s/g, "+")}`) | ||
.join(" "); | ||
@@ -55,4 +55,4 @@ return `${fromPath} ${fromQuery} ${to} ${status}`; | ||
const toProductsRedirect = toResourceRedirect('products'); | ||
const toCollectionsRedirect = toResourceRedirect('collections'); | ||
const toProductsRedirect = toResourceRedirect("products"); | ||
const toCollectionsRedirect = toResourceRedirect("collections"); | ||
@@ -67,3 +67,3 @@ const redirects = [ | ||
path.resolve(input.context.target, `public/_redirects`), | ||
redirects.join('\n') | ||
redirects.join("\n") | ||
); | ||
@@ -73,3 +73,3 @@ | ||
} catch (error) { | ||
input._task.title = `❌ error in Redirects Transform: ${error.message}`; | ||
input.task.title = `❌ error in Redirects Transform: ${error.message}`; | ||
return input; | ||
@@ -76,0 +76,0 @@ // throw error; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
15784
19
2