Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Extension/.eslintignore

This file was deleted.

155 changes: 0 additions & 155 deletions Extension/.eslintrc.js

This file was deleted.

15 changes: 9 additions & 6 deletions Extension/.scripts/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,28 @@ export async function main() {
}

export async function all() {
await rimraf(...(await getModifiedIgnoredFiles()).filter(each => !each.includes('node_modules')));
await rimraf(...(await getModifiedIgnoredFiles()).filter((each): each is string => each !== undefined && !each.includes('node_modules')));
}

export async function reset() {
verbose(`Resetting all .gitignored files in extension`);
await rimraf(...await getModifiedIgnoredFiles());
await rimraf(...(await getModifiedIgnoredFiles()).filter((each): each is string => each !== undefined));
}

async function details(files: string[]) {
let all = await Promise.all(files.filter(each => each).map(async (each) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [filename, stats ] = await filepath.stats(each);
const results = await Promise.all(files.filter(each => each).map(async (each) => {
const [, stats] = await filepath.stats(each);
if (!stats) {
return null;
}
return {
filename: stats.isDirectory() ? cyan(`${each}${sep}**`) : brightGreen(`${each}`),
date: stats.mtime.toLocaleDateString().replace(/\b(\d)\//g, '0$1\/'),
time: stats.mtime.toLocaleTimeString().replace(/^(\d)\:/g, '0$1:'),
modified: stats.mtime
};
}));
let all = results.filter((each): each is NonNullable<typeof each> => each !== null);
all = all.sort((a, b) => a.modified.getTime() - b.modified.getTime());
// print a formatted table so the date and time are aligned
const max = all.reduce((max, each) => Math.max(max, each.filename.length), 0);
Expand All @@ -56,7 +59,7 @@ export async function show(opt?: string) {
case 'ignored':
case 'untracked':
console.log(cyan('\n\nUntracked+Ignored files:'));
return details(await getModifiedIgnoredFiles());
return details((await getModifiedIgnoredFiles()).filter((each): each is string => each !== undefined));

default:
return error(`Unknown option '${opt}'`);
Expand Down
11 changes: 7 additions & 4 deletions Extension/.scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ export async function getModifiedIgnoredFiles() {
}

// return the full path of files that would be removed.
// eslint-disable-next-line @typescript-eslint/no-misused-promises
return Promise.all(stdio.filter("Would remove").map((s) => filepath.exists(s.replace(/^Would remove /, ''), $root)).filter(p => p));
}

export async function rimraf(...paths: string[]) {
const all = [];
const all: Promise<void>[] = [];
for (const each of paths) {
if (!each) {
continue;
Expand All @@ -82,6 +83,9 @@ export async function mkdir(filePath: string) {
}
throw new Error(`Cannot create directory '${filePath}' because there is a file there.`);
}
if (!fullPath) {
throw new Error(`Cannot create directory '${filePath}' because the path is invalid.`);
}

await md(fullPath, { recursive: true });
return fullPath;
Expand Down Expand Up @@ -258,7 +262,7 @@ export function position(text: string) {
return gray(`${text}`);
}

export async function assertAnyFolder(oneOrMoreFolders: string | string[], errorMessage?: string): Promise<string> {
export async function assertAnyFolder(oneOrMoreFolders: string | string[], errorMessage?: string): Promise<string | undefined> {
oneOrMoreFolders = is.array(oneOrMoreFolders) ? oneOrMoreFolders : [oneOrMoreFolders];
for (const each of oneOrMoreFolders) {
const result = await filepath.isFolder(each, $root);
Expand All @@ -275,7 +279,7 @@ export async function assertAnyFolder(oneOrMoreFolders: string | string[], error
}
}

export async function assertAnyFile(oneOrMoreFiles: string | string[], errorMessage?: string): Promise<string> {
export async function assertAnyFile(oneOrMoreFiles: string | string[], errorMessage?: string): Promise<string | undefined> {
oneOrMoreFiles = is.array(oneOrMoreFiles) ? oneOrMoreFiles : [oneOrMoreFiles];
for (const each of oneOrMoreFiles) {
const result = await filepath.isFile(each, $root);
Expand Down Expand Up @@ -325,7 +329,6 @@ export async function checkDTS() {
let failing = false;
failing = !await assertAnyFile('vscode.d.ts') && (quiet || warn(`The VSCode import file '${$root}/dist/src/vscode.d.ts is missing.`)) || failing;
failing = !await assertAnyFile('vscode.proposed.terminalDataWriteEvent.d.ts') && (quiet || warn(`The VSCode import file '${$root}/dist/src/vscode.proposed.terminalDataWriteEvent.d.ts is missing.`)) || failing;
failing = !await assertAnyFile('vscode.proposed.lmTools.d.ts') && (quiet || warn(`The VSCode import file '${$root}/dist/src/vscode.proposed.lmTools.d.ts is missing.`)) || failing;

if (!failing) {
verbose('VSCode d.ts files appear to be in place.');
Expand Down
2 changes: 1 addition & 1 deletion Extension/.scripts/copyWalkthruMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function watch() {
verbose(`Watching ${source} folder for changes.`);
console.log('Press Ctrl+C to exit.');
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for await (const event of watchFiles(source, {recursive: true })) {
for await (const event of watchFiles(source, { recursive: true })) {
await main();
}
}
Expand Down
2 changes: 0 additions & 2 deletions Extension/.scripts/generateOptionsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */

/* eslint-disable no-prototype-builtins */

import { resolve } from 'path';
import { $root, read, write } from './common';

Expand Down
11 changes: 6 additions & 5 deletions Extension/.scripts/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ filterStdio();
async function unitTests() {
await assertAnyFolder('dist/test/unit', `The folder '${$root}/dist/test/unit is missing. You should run ${brightGreen("yarn compile")}\n\n`);
const mocha = await assertAnyFile(["node_modules/.bin/mocha.cmd", "node_modules/.bin/mocha"], `Can't find the mocha testrunner. You might need to run ${brightGreen("yarn install")}\n\n`);
const result = spawnSync(mocha, [`${$root}/dist/test/unit/**/*.test.js`, '--timeout', '30000'], { stdio:'inherit', shell: true });
const result = spawnSync(mocha, [`${$root}/dist/test/unit/**/*.test.js`, '--timeout', '30000'], { stdio: 'inherit', shell: true });
verbose(`\n${green("NOTE:")} If you want to run a scenario test (end-to-end) use ${cmdSwitch('scenario=<NAME>')} \n\n`);
return result.status;
}
Expand Down Expand Up @@ -161,23 +161,24 @@ interface Input {
id: string;
type: string;
description: string;
options: CommentArray<{label: string; value: string}>;
options: CommentArray<{ label: string; value: string }>;
}

export async function getScenarioNames() {
return (await readdir(`${$root}/test/scenarios`).catch(returns.none)).filter(each => each !== 'Debugger');
}

export async function getScenarioFolder(scenarioName: string) {
export async function getScenarioFolder(scenarioName: string | undefined) {
return scenarioName ? resolve(`${$root}/test/scenarios/${(await getScenarioNames()).find(each => each.toLowerCase() === scenarioName.toLowerCase())}`) : undefined;
}

export async function list() {
console.log(`\n${cyan("Scenarios: ")}\n`);
const names = await getScenarioNames();
const max = names.reduce((max, each) => Math.max(max, each), 0);
const max = names.reduce((max, each) => Math.max(max, each.length), 0);
for (const each of names) {
console.log(` ${green(each.padEnd(max))}: ${gray(await getScenarioFolder(each))}`);
const folder = await getScenarioFolder(each);
console.log(` ${green(each.padEnd(max))}: ${gray(folder || '')}`);
}
}

Expand Down
3 changes: 2 additions & 1 deletion Extension/.scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"esModuleInterop": true
"esModuleInterop": true,
"strictNullChecks": true
}
}
3 changes: 1 addition & 2 deletions Extension/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ jobs/**
cgmanifest.json

# ignore development files
.eslintignore
.eslintrc.js
eslint.config.js
.gitattributes
.gitignore
gulpfile.js
Expand Down
Loading
Loading