Socket
Socket
Sign inDemoInstall

@frontmatter/extensibility

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontmatter/extensibility - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

dist/scripts/FieldAction.d.ts

2

dist/scripts/ContentScript.d.ts

@@ -8,3 +8,3 @@ import { ContentArguments } from "../models/ScriptArguments.js";

*/
static getArguments(): ContentArguments | undefined;
static getArguments: () => ContentArguments | undefined;
/**

@@ -11,0 +11,0 @@ * Call this method to update the front matter

@@ -0,1 +1,2 @@

import { getArguments } from "../utils/getArguments.js";
import { CustomScript } from "./CustomScript.js";

@@ -7,39 +8,3 @@ export class ContentScript extends CustomScript {

*/
static getArguments() {
const args = process.argv;
const command = args[0];
const scriptPath = args[1];
const workspacePath = args[2];
const filePath = args[3];
let frontMatter = args[4];
// Parse the frontmatter
if (frontMatter.startsWith(`"`) || frontMatter.startsWith(`'`)) {
frontMatter = frontMatter.slice(1);
}
if (frontMatter.endsWith(`"`) || frontMatter.endsWith(`'`)) {
frontMatter = frontMatter.slice(0, -1);
}
try {
frontMatter =
typeof frontMatter === "string" ? JSON.parse(frontMatter) : frontMatter;
}
catch (e) {
// Failed parsing JSON
}
// Get all arguments after the file path
const answerArgs = args.slice(5);
const answers = answerArgs.reduce((acc, curr) => {
const [key, value] = curr.split("=");
acc[key] = value;
return acc;
}, {});
return {
command,
scriptPath,
workspacePath,
filePath,
frontMatter,
answers: Object.keys(answers).length > 0 ? answers : undefined,
};
}
static getArguments = () => getArguments();
/**

@@ -46,0 +11,0 @@ * Call this method to update the front matter

export * from "./ContentScript.js";
export * from "./CustomScript.js";
export * from "./FieldAction.js";
export * from "./MediaScript.js";
export * from "./PlaceholderScript.js";
export * from "./ContentScript.js";
export * from "./CustomScript.js";
export * from "./FieldAction.js";
export * from "./MediaScript.js";
export * from "./PlaceholderScript.js";
//# sourceMappingURL=index.js.map
{
"name": "@frontmatter/extensibility",
"version": "0.0.16",
"version": "0.0.17",
"description": "Front Matter CMS extensibility library",

@@ -33,3 +33,3 @@ "type": "module",

"@types/node": "^20.8.4",
"typescript": "^4.9.5"
"typescript": "^5.5.2"
},

@@ -36,0 +36,0 @@ "dependencies": {

import { ContentArguments } from "../models/ScriptArguments.js";
import { getArguments } from "../utils/getArguments.js";
import { CustomScript } from "./CustomScript.js";

@@ -9,45 +10,5 @@

*/
public static getArguments(): ContentArguments | undefined {
const args = process.argv;
public static getArguments = (): ContentArguments | undefined =>
getArguments();
const command = args[0];
const scriptPath = args[1];
const workspacePath = args[2];
const filePath = args[3];
let frontMatter = args[4];
// Parse the frontmatter
if (frontMatter.startsWith(`"`) || frontMatter.startsWith(`'`)) {
frontMatter = frontMatter.slice(1);
}
if (frontMatter.endsWith(`"`) || frontMatter.endsWith(`'`)) {
frontMatter = frontMatter.slice(0, -1);
}
try {
frontMatter =
typeof frontMatter === "string" ? JSON.parse(frontMatter) : frontMatter;
} catch (e) {
// Failed parsing JSON
}
// Get all arguments after the file path
const answerArgs = args.slice(5);
const answers = answerArgs.reduce((acc, curr) => {
const [key, value] = curr.split("=");
acc[key] = value;
return acc;
}, {} as { [key: string]: string });
return {
command,
scriptPath,
workspacePath,
filePath,
frontMatter,
answers: Object.keys(answers).length > 0 ? answers : undefined,
};
}
/**

@@ -54,0 +15,0 @@ * Call this method to update the front matter

export * from "./ContentScript.js";
export * from "./CustomScript.js";
export * from "./FieldAction.js";
export * from "./MediaScript.js";
export * from "./PlaceholderScript.js";

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc