Skip to content

Commit

Permalink
chore: add in rudimentary typings (#271)
Browse files Browse the repository at this point in the history
This module is used externally to fetch the manifests, and TS types are
always nice to have

Result: (for this its fineee if its masquerading as ESM, as we use
esm-compatible syntax)
![Google Chrome Beta - 2024-02-08 at 18 39
57@2x](https://github.com/apify/actor-templates/assets/17960496/cf8a534d-fcca-42e5-9cd6-9dc2dc855c13)
  • Loading branch information
vladfrangu authored Feb 14, 2024
1 parent 998b257 commit 54951ec
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
templates
src/*.d.[cm]ts
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@
"version": "0.1.4",
"description": "A manifest of Apify actor templates.",
"main": "src/index.js",
"types": "src/index.d.cts",
"exports": {
"import": {
"types": "./src/index.d.mts",
"default": "./src/index.js"
},
"require": {
"types": "./src/index.d.cts",
"default": "./src/index.js"
}
},
"files": [
"src/index.js"
"src/index.js",
"src/index.d.*"
],
"scripts": {
"lint": "eslint . --ext .js,.ts",
Expand Down
31 changes: 31 additions & 0 deletions src/index.d.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export interface Template {
id: string;
name: string;
label: string;
category: string;
technologies: string[];
description: string;
messages?: {
postCreate?: string;
};
archiveUrl: string;
defaultRunOptions?: {

build?: string;
memoryMbytes?: number;
timeoutSecs?: number;
};
showcaseFiles?: string[];
useCases?: string[];
aliases?: string[];
}

export interface Manifest {
consoleReadmeSuffixUrl?: string;
localReadmeSuffixUrl?: string;
templates: Template[];
}

export function fetchManifest(manifestUrl?: string): Promise<Manifest>;
export const manifestUrl: string;
export const wrapperManifestUrl: string;
31 changes: 31 additions & 0 deletions src/index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export interface Template {
id: string;
name: string;
label: string;
category: string;
technologies: string[];
description: string;
messages?: {
postCreate?: string;
};
archiveUrl: string;
defaultRunOptions?: {

build?: string;
memoryMbytes?: number;
timeoutSecs?: number;
};
showcaseFiles?: string[];
useCases?: string[];
aliases?: string[];
}

export interface Manifest {
consoleReadmeSuffixUrl?: string;
localReadmeSuffixUrl?: string;
templates: Template[];
}

export function fetchManifest(manifestUrl?: string): Promise<Manifest>;
export const manifestUrl: string;
export const wrapperManifestUrl: string;

0 comments on commit 54951ec

Please sign in to comment.