diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..688a9b7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,29 @@ +name: Test +on: + workflow_dispatch: + +jobs: + run-action: + name: Run action + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: 20.x + cache: "npm" + cache-dependency-path: package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Run my action + uses: ./ + with: + GITPOD_TOKEN: ${{ secrets.GITPOD_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d64059 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..09584c6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:20 + +WORKDIR /action + +COPY . . + +RUN npm install +RUN npm run build + +ENTRYPOINT ["node", "/action/src/main.js"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..bac5a37 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# Gitpod Workspace Cleanup - GitHub Action + +This GitHub Action is designed to manage Gitpod workspaces. It automatically deletes workspaces that are stopped and do not have any uncommitted or untracked file changes. + +> [!NOTE] +> `GITPOD_TOKEN`: Required. The access token for Gitpod API. [Learn more](https://www.gitpod.io/docs/configure/user-settings/access-tokens). + +## Usage + +[**Demo repository**](https://github.com/Siddhant-K-code/demo-delete-clean-workspaces) + +```yaml +name: Delete clean Gitpod workspaces weekly + +on: + workflow_dispatch: + schedule: + - cron: '0 9 * * MON' # At 9 AM UTC, weekly only on Monday + +jobs: + delete-clean-workspaces: + name: Clean Gitpod workspaces weekly + runs-on: ubuntu-latest + steps: + - name: Delete clean Gitpod workspaces + uses: Siddhant-K-code/delete-clean-workspaces@v1.0 + with: + GITPOD_TOKEN: ${{ secrets.GITPOD_PAT_TOKEN }} +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..b186e8b --- /dev/null +++ b/action.yml @@ -0,0 +1,16 @@ +name: "Delete clean Gitpod workspaces" +author: "Siddhant-K-code" +description: "GitHub action to delete non-running, clean Gitpod workspaces." +inputs: + GITPOD_TOKEN: + description: "Gitpod Personal Access token" + required: true +outputs: + success: + description: "true|false based on if the script worked" +runs: + using: 'docker' + image: 'Dockerfile' +branding: + icon: "archive" + color: "orange" diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e446517 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,201 @@ +{ + "name": "delete-clean-workspaces", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "delete-clean-workspaces", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@actions/core": "^1.10.1" + }, + "devDependencies": { + "@types/node": "^20.10.2", + "axios": "^1.6.2", + "typescript": "^5.3.2" + } + }, + "node_modules/@actions/core": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", + "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", + "dependencies": { + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" + } + }, + "node_modules/@actions/http-client": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz", + "integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==", + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", + "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", + "engines": { + "node": ">=14" + } + }, + "node_modules/@types/node": { + "version": "20.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.2.tgz", + "integrity": "sha512-37MXfxkb0vuIlRKHNxwCkb60PNBpR94u4efQuN4JgIAm66zfCDXGSAFCef9XUWFovX2R1ok6Z7MHhtdVXXkkIw==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, + "node_modules/axios": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, + "node_modules/typescript": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", + "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici": { + "version": "5.28.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz", + "integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..2f409fc --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "delete-clean-workspaces", + "version": "1.0.0", + "description": "GitHub action designed to remove Gitpod workspaces that are not in a running state and do not contain any uncommitted or untracked file changes.", + "main": "dist/main.js", + "scripts": { + "build": "npx tsc ./src/main.ts" + }, + "author": "Siddhant-K-code", + "license": "ISC", + "dependencies": { + "@actions/core": "^1.10.1" + }, + "devDependencies": { + "@types/node": "^20.10.2", + "axios": "^1.6.2", + "typescript": "^5.3.2" + } +} diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..fa266fb --- /dev/null +++ b/src/main.js @@ -0,0 +1,133 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const axios_1 = __importDefault(require("axios")); +const core = __importStar(require("@actions/core")); +/** + * Lists the workspaces from the Gitpod API and identifies those that should be deleted. + * Workspaces are selected for deletion if they are stopped and do not have untracked or uncommitted files. + * + * @param {string} gitpodToken - The access token for Gitpod API. + * @returns {Promise} - A promise that resolves to an array of workspace IDs to be deleted. + */ +function listWorkspaces(gitpodToken) { + return __awaiter(this, void 0, void 0, function* () { + try { + const response = yield axios_1.default.post("https://api.gitpod.io/gitpod.experimental.v1.WorkspacesService/ListWorkspaces", {}, { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${gitpodToken}`, + }, + }); + core.debug("API Response: " + JSON.stringify(response.data)); + const workspaces = response.data.result; + const toDelete = []; + if (!Array.isArray(workspaces)) { + throw new Error("Expected an array of data"); + } + workspaces.forEach((workspace) => { + const phaseStopped = workspace.status.instance.status.phase === "PHASE_STOPPED"; + const hasNoUntrackedFiles = !("totalUntrackedFiles" in workspace.status.instance.status.gitStatus); + const hasNoUncommittedFiles = !("totalUncommittedFiles" in workspace.status.instance.status.gitStatus); + if (phaseStopped && hasNoUntrackedFiles && hasNoUncommittedFiles) { + toDelete.push(workspace.status.instance.workspaceId); + } + }); + return toDelete; + } + catch (error) { + core.error(`Error in listWorkspaces: ${error}`); + throw error; + } + }); +} +/** + * Deletes a specified workspace using the Gitpod API. + * + * @param {string} workspaceIdOfTargetWorkspace - The ID of the workspace to be deleted. + * @param {string} gitpodToken - The access token for the Gitpod API. + */ +function deleteWorkspace(workspaceIdOfTargetWorkspace, gitpodToken) { + return __awaiter(this, void 0, void 0, function* () { + try { + yield axios_1.default.post("https://api.gitpod.io/gitpod.experimental.v1.WorkspacesService/DeleteWorkspace", { workspaceId: workspaceIdOfTargetWorkspace }, { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${gitpodToken}`, + }, + }); + core.debug(`Deleted workspace: ${workspaceIdOfTargetWorkspace}`); + } + catch (error) { + core.error(`Error in deleteWorkspace: ${error}`); + throw error; + } + }); +} +/** + * Main function to run the action. It retrieves the Gitpod access token, + * lists workspaces, deletes the selected workspaces, and outputs the result. + */ +function run() { + return __awaiter(this, void 0, void 0, function* () { + try { + const gitpodToken = core.getInput("GITPOD_TOKEN", { required: true }); + const deletedWorkspaces = []; + if (!gitpodToken) { + throw new Error("Gitpod access token is required"); + } + const workspacesToDelete = yield listWorkspaces(gitpodToken); + for (const workspaceId of workspacesToDelete) { + yield deleteWorkspace(workspaceId, gitpodToken); + deletedWorkspaces.push(workspaceId); + } + if (deletedWorkspaces.length > 0) { + core.summary + .addHeading("Workspace IDs of deleted workspaces") + .addList(deletedWorkspaces) + .write(); + } + core.setOutput("success", "true"); + } + catch (error) { + core.error(error.message); + core.setOutput("success", "false"); + } + }); +} +run(); diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..cf59dec --- /dev/null +++ b/src/main.ts @@ -0,0 +1,121 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import axios from "axios"; +import * as core from "@actions/core"; + +/** + * Lists the workspaces from the Gitpod API and identifies those that should be deleted. + * Workspaces are selected for deletion if they are stopped and do not have untracked or uncommitted files. + * + * @param {string} gitpodToken - The access token for Gitpod API. + * @returns {Promise} - A promise that resolves to an array of workspace IDs to be deleted. + */ + +async function listWorkspaces(gitpodToken: string) { + try { + const response = await axios.post( + "https://api.gitpod.io/gitpod.experimental.v1.WorkspacesService/ListWorkspaces", + {}, + { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${gitpodToken}`, + }, + } + ); + + core.debug("API Response: " + JSON.stringify(response.data)); + + const workspaces = response.data.result; + const toDelete: string[] = []; + + if (!Array.isArray(workspaces)) { + throw new Error("Expected an array of data"); + } + + workspaces.forEach((workspace) => { + const phaseStopped = + workspace.status.instance.status.phase === "PHASE_STOPPED"; + const hasNoUntrackedFiles = !( + "totalUntrackedFiles" in workspace.status.instance.status.gitStatus + ); + const hasNoUncommittedFiles = !( + "totalUncommittedFiles" in workspace.status.instance.status.gitStatus + ); + + if (phaseStopped && hasNoUntrackedFiles && hasNoUncommittedFiles) { + toDelete.push(workspace.status.instance.workspaceId); + } + }); + + return toDelete; + } catch (error) { + core.error(`Error in listWorkspaces: ${error}`); + throw error; + } +} + +/** + * Deletes a specified workspace using the Gitpod API. + * + * @param {string} workspaceIdOfTargetWorkspace - The ID of the workspace to be deleted. + * @param {string} gitpodToken - The access token for the Gitpod API. + */ + +async function deleteWorkspace( + workspaceIdOfTargetWorkspace: string, + gitpodToken: string +) { + try { + await axios.post( + "https://api.gitpod.io/gitpod.experimental.v1.WorkspacesService/DeleteWorkspace", + { workspaceId: workspaceIdOfTargetWorkspace }, + { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${gitpodToken}`, + }, + } + ); + core.debug(`Deleted workspace: ${workspaceIdOfTargetWorkspace}`); + } catch (error) { + core.error(`Error in deleteWorkspace: ${error}`); + throw error; + } +} + +/** + * Main function to run the action. It retrieves the Gitpod access token, + * lists workspaces, deletes the selected workspaces, and outputs the result. + */ + +async function run() { + try { + const gitpodToken = core.getInput("GITPOD_TOKEN", { required: true }); + const deletedWorkspaces: string[] = []; + + if (!gitpodToken) { + throw new Error("Gitpod access token is required"); + } + + const workspacesToDelete = await listWorkspaces(gitpodToken); + for (const workspaceId of workspacesToDelete) { + await deleteWorkspace(workspaceId, gitpodToken); + deletedWorkspaces.push(workspaceId); + } + + if (deletedWorkspaces.length > 0) { + core.summary + .addHeading("Workspace IDs of deleted workspaces") + .addList(deletedWorkspaces) + .write(); + } + + core.setOutput("success", "true"); + } catch (error) { + core.error((error as Error).message); + core.setOutput("success", "false"); + } +} + +run(); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..e075f97 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +}