import React from 'react'; import classnames from 'classnames'; import { Tooltip as ReactTippy } from 'react-tippy'; import { ModulePartition } from '../scripts/build-module-partitions'; // The `brfs` transform for browserify calls `fs.readLineSync` and // `path.resolve` at build time and inlines file contents into the source code. // To accomplish this we have to bring in `fs` and `path` using `require` and // not `import`. This is weird in a TypeScript file, and typescript-eslint // (rightly) complains about this, but it's actually okay because the above // `import` lines will actually get turned into `require`s anyway before passing // through the rest of browserify. However, `brfs` should handle this. There is // an active bug for this, but there isn't a known workaround yet: // /* eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires */ const fs = require('fs'); /* eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires */ const path = require('path'); type Summary = { numConvertedFiles: number; numFiles: number; }; function calculatePercentageComplete(summary: Summary) { return ((summary.numConvertedFiles / summary.numFiles) * 100).toFixed(1); } export default function App() { const partitions = JSON.parse( fs.readFileSync( path.resolve(__dirname, '../intermediate/partitions.json'), { encoding: 'utf-8', }, ), ) as ModulePartition[]; const allFiles = partitions.flatMap((partition) => { return partition.children; }); const overallTotal = { numConvertedFiles: allFiles.filter((file) => file.hasBeenConverted).length, numFiles: allFiles.length, }; return ( <>

Extension TypeScript Migration Status

OVERALL: {overallTotal.numConvertedFiles}/{overallTotal.numFiles} ( {calculatePercentageComplete(overallTotal)}%)

What is this?

This is a dashboard that tracks the status of converting the extension codebase from JavaScript to TypeScript. It is updated whenever a new commit is pushed to the codebase, so it always represents the current work.

Each box

 
on this page represents a file that either we want to convert or we've already converted to TypeScript (hover over a box to see the filename). Boxes that are
 
greyed out are test or Storybook files.

These boxes are further partitioned by level. The level of a file is how many files you have to import before you reach that file in the whole codebase. For instance, if we have a file{' '} foo.js, and that file imports bar.js and{' '} baz.js, and baz.js imports{' '} qux.js, then:

  • foo.js would be at level 1
  • bar.js and baz.js would be at{' '} level 2
  • qux.js would be at level 3

This level assignment can be used to determine a priority for converting the remaining JavaScript files. Files which have fewer dependencies should in theory be easier to convert, so files with a higher level should be converted first. In other words,{' '} you should be able to start from the top and go down .

{partitions.map((partition) => { return (
level {partition.level}
{partition.children.map(({ name, hasBeenConverted }) => { const isTest = /\.test\.(?:js|tsx?)/u.test(name); const isStorybookFile = /\.stories\.(?:js|tsx?)/u.test(name); return (
); })}
); })}
); }