Skip to content

Commit

Permalink
Load json with import assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Dec 17, 2023
1 parent b5a689e commit 58ed04b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/actions/update-stars/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import core from '@actions/core';
import { readFileSync, writeFileSync } from 'node:fs';
import { writeFileSync } from 'node:fs';
import components from '../src/routes/components/components.json' assert { type: 'json' };
import templates from '../src/routes/templates/templates.json' assert { type: 'json' };
import tools from '../src/routes/tools/tools.json' assert { type: 'json' };
import { fetch } from 'undici';

const ghGraphQlUrl = 'https://api.github.com/graphql';
Expand Down Expand Up @@ -28,10 +31,6 @@ async function doGraphQlQuery(url, query, headers = {}) {
}

function gatherUrls() {
let components = JSON.parse(readFileSync('src/routes/components/components.json'));
let tools = JSON.parse(readFileSync('src/routes/tools/tools.json'));
let templates = JSON.parse(readFileSync('src/routes/templates/templates.json'));

return [
...components.map((component) => component.repository),
...tools.map((tool) => tool.repository),
Expand Down

0 comments on commit 58ed04b

Please sign in to comment.