index.js
async function updateComponentMap() {
  const response = await fetch(GITHUB_AMPHTML_TREE_URL);
  const data = await response.json();
  const pairs = data.tree.map((item) => item.path.match(REGEX_EXTENSION_DIR))
                  .filter((match) => match && !match[1].endsWith('impl'))
                  .map((match) => [match[1], match[2]]);
  const versionMap = {};
  pairs.forEach((pair) => {
    if (!versionMap[pair[0]] || versionMap[pair[0]] < pair[1]) {
      versionMap[pair[0]] = pair[1];
    }
  });
  writeComponentsMap(COMPONENTS_MAP_PATH, versionMap);
}
async function updateComponentMap() {
  const response = await fetch(GITHUB_AMPHTML_TREE_URL);
  const data = await response.json();
  const pairs = data.tree.map((item) => item.path.match(REGEX_EXTENSION_DIR))
                  .filter((match) => match && !match[1].endsWith('impl'))
                  .map((match) => [match[1], match[2]]);
  const versionMap = {};
  pairs.forEach((pair) => {
    if (!versionMap[pair[0]] || versionMap[pair[0]] < pair[1]) {
      versionMap[pair[0]] = pair[1];
    }
  });
  writeComponentsMap(COMPONENTS_MAP_PATH, versionMap);
}
async function updateComponentMap ( ) { const response = await fetch ( GITHUB_AMPHTML_TREE_URL ) ; const data = await response . json ( ) ; const pairs = data . tree . map ( ( item ) => item . path . match ( REGEX_EXTENSION_DIR ) ) . filter ( ( match ) => match && ! match [ 1 ] . endsWith ( 'impl' ) ) . map ( ( match ) => [ match [ 1 ] , match [ 2 ] ] ) ; const versionMap = { } ; pairs . forEach ( ( pair ) => { if ( ! versionMap [ pair [ 0 ] ] || versionMap [ pair [ 0 ] ] < pair [ 1 ] ) { versionMap [ pair [ 0 ] ] = pair [ 1 ] ; } } ) ; writeComponentsMap ( COMPONENTS_MAP_PATH , versionMap ) ; }
Create a map from component to version number, based on GitHub directory
structure.
Create a map from component to version number based on GitHub directory structure .