Skip to content

Commit

Permalink
🚀 Deploy new version [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
pabio-escobar committed Nov 24, 2022
1 parent 52d24e3 commit 52babac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
14 changes: 11 additions & 3 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ interface Item {
attributes?: Record<string, unknown>;
caption?: string;
}
type AsyncFunctionArguments = Item & {
/**
* Execute a function with the given arguments using eval
* Largely based on actions/github-script
* @param args - Arguments for the async function
* @param source - The source code of the async function as a string
* @returns The result of the async function
* @link https://github.com/actions/github-script/blob/v6.3.3/src/async-function.ts#L21
* @license MIT
*/
export declare function callAsyncFunction<T = string>(args: Item & {
require: NodeRequire;
__original_require__: NodeRequire;
};
export declare function callAsyncFunction<T = string>(args: AsyncFunctionArguments, source: string): Promise<T>;
}, source: string): Promise<T>;
export declare const wrapRequire: any;
export declare const run: () => Promise<void>;
export {};
13 changes: 11 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@ const markdown_to_txt_1 = __importDefault(__nccwpck_require__(5611));
const path_1 = __nccwpck_require__(1017);
const prettier_1 = __nccwpck_require__(4588);
const truncate_sentences_1 = __importDefault(__nccwpck_require__(1457));
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor;
/**
* Execute a function with the given arguments using eval
* Largely based on actions/github-script
* @param args - Arguments for the async function
* @param source - The source code of the async function as a string
* @returns The result of the async function
* @link https://github.com/actions/github-script/blob/v6.3.3/src/async-function.ts#L21
* @license MIT
*/
function callAsyncFunction(args, source) {
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor;
const fn = new AsyncFunction(...Object.keys(args), source);
return fn(...Object.values(args));
}
Expand Down Expand Up @@ -133,7 +142,7 @@ const run = async () => {
let addedYears = [];
allItems[year].forEach((item) => {
const isPast = new Date(item.date).getTime() < new Date().getTime();
const text = `${addedYears.includes(year) ? "" : `### ${year}\n\n`}- [${item.caption ? "**" : ""}${item.title || `\`${item.slug}\``}${item.caption ? "**" : ""}](./${directory}/${year}/${item.slug})\n${item.caption ? ` ${item.caption}\n\n` : ""}`;
const text = `${addedYears.includes(year) ? "" : `### ${year}\n\n`}- [${item.caption ? "**" : ""}${item.title || `\`${item.slug}\``}${item.caption ? "**" : ""}](./${directory}/${year}/${item.slug})${item.caption ? ` \n ${item.caption}\n\n` : "\n"}`;
if (isPast)
pastItems += text;
else
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

0 comments on commit 52babac

Please sign in to comment.