@next-boilerplate/cli-helpers
Version:
CLI helper for Next Boilerplate
66 lines (62 loc) • 1.84 kB
JavaScript
;
var zod = require('zod');
var index = require('../utils/index.cjs');
require('path');
const pluginsFolder = "plugins";
const pluginConfigFileName = "config.json";
const pluginSchema = zod.z.object({
// The name of the plugin the a config file correspond to its relative path from the store (not it's real name)
name: zod.z.string().max(100),
paths: zod.z.array(
zod.z.object({
from: zod.z.string().refine(
(value) => {
if (!index.isPathInCurrentScope(value)) {
return false;
}
return true;
},
{ message: "The path should be relative and in the current directory" }
),
to: zod.z.string().refine(
(value) => {
if (!index.isPathInCurrentScope(value)) {
return false;
}
return true;
},
{ message: "The path should be relative and in the current directory" }
)
})
)
});
const pluginConfigSchema = zod.z.object({
name: zod.z.string().max(100),
description: zod.z.string().max(300),
paths: zod.z.array(
zod.z.object({
from: zod.z.string().refine(
(value) => {
if (!index.isPathInCurrentScope(value)) {
return false;
}
return true;
},
{ message: "The path should be relative and in the current directory" }
),
to: zod.z.string().refine(
(value) => {
if (!index.isPathInCurrentScope(value)) {
return false;
}
return true;
},
{ message: "The path should be relative and in the current directory" }
)
})
)
});
exports.pluginConfigFileName = pluginConfigFileName;
exports.pluginConfigSchema = pluginConfigSchema;
exports.pluginSchema = pluginSchema;
exports.pluginsFolder = pluginsFolder;