@elderjs/plugin-random
Advanced tools
Comparing version 0.1.40 to 0.1.41
19
index.js
@@ -5,3 +5,19 @@ const notProduction = process.env.NODE_ENV !== 'production'; | ||
description: 'Adds a /random/ page on previewer requests that displays all of the possible routes.', | ||
init: (plugin) => {}, | ||
minimumElderjsVersion: '1.4.13', | ||
init: (plugin) => { | ||
// version check | ||
let enabled = false; | ||
if (plugin.settings.version) { | ||
const [major, minor, patch] = plugin.settings.version.split('.'); | ||
if (major > 1) enabled = true; | ||
if (major === 1 && minor > 4) enabled = true; | ||
if (major === 1 && minor === 4 && patch >= 13) enabled = true; | ||
} | ||
if (!enabled) { | ||
plugin.hooks = []; | ||
plugin.routes = {}; | ||
console.error('@elderjs/plugin-random requires Elder.js v1.4.13 or greater. Plugin disabled.'); | ||
} | ||
return plugin; | ||
}, | ||
routes: { | ||
@@ -11,2 +27,3 @@ pluginRandom: { | ||
template: 'Random.svelte', | ||
layout: 'RandomLayout.svelte', | ||
permalink: ({ request }) => { | ||
@@ -13,0 +30,0 @@ if (request.slug && request.realRoute) return `/random/${request.realRoute}/`; |
{ | ||
"name": "@elderjs/plugin-random", | ||
"version": "0.1.40", | ||
"version": "0.1.41", | ||
"description": "Easily preview a random page of a route by visiting a single url. This plugin should be used exclusively for development.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
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
6425
91