Skip to content
Snippets Groups Projects
Unverified Commit d0203f9e authored by Michael Kriese's avatar Michael Kriese Committed by GitHub
Browse files

fix: Revert "feat(ci): Use data files from arbitrary path" (#9833)

This reverts commit eb4f8451.
parent eb4f8451
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ export async function getExtractFile(): Promise<string> { ...@@ -16,7 +16,7 @@ export async function getExtractFile(): Promise<string> {
const cacheDir = await ensureCacheDir('./others/pip_setup'); const cacheDir = await ensureCacheDir('./others/pip_setup');
extractPy = join(cacheDir, EXTRACT); extractPy = join(cacheDir, EXTRACT);
await outputFile(extractPy, dataFiles.get('data/extract.py')); await outputFile(extractPy, dataFiles.get('extract.py'));
return extractPy; return extractPy;
} }
......
...@@ -11,7 +11,7 @@ interface NodeJsSchedule { ...@@ -11,7 +11,7 @@ interface NodeJsSchedule {
export type NodeJsData = Record<string, NodeJsSchedule>; export type NodeJsData = Record<string, NodeJsSchedule>;
export const nodeSchedule: NodeJsData = JSON.parse( export const nodeSchedule: NodeJsData = JSON.parse(
dataFiles.get('data/node-js-schedule.json') dataFiles.get('node-js-schedule.json')
); );
export interface NodeJsPolicies { export interface NodeJsPolicies {
......
import path from 'path';
import fs from 'fs-extra'; import fs from 'fs-extra';
import shell from 'shelljs'; import shell from 'shelljs';
...@@ -23,35 +22,12 @@ async function updateFile(file: string, code: string): Promise<void> { ...@@ -23,35 +22,12 @@ async function updateFile(file: string, code: string): Promise<void> {
newFiles.add(file); newFiles.add(file);
} }
const dataPaths = ['data'];
function expandPaths(paths: string[]): string[] {
return paths
.map((pathName) => {
const stat = fs.statSync(pathName);
if (stat.isFile()) {
return [pathName];
}
if (stat.isDirectory()) {
const dirPaths = fs
.readdirSync(pathName, { withFileTypes: true })
.filter(
(dirent) =>
!(dirent.isFile() && ['.DS_Store'].includes(dirent.name))
)
.map((dirent) => path.join(pathName, dirent.name));
return expandPaths(dirPaths);
}
return [];
})
.reduce((x, y) => x.concat(y));
}
async function generateData(): Promise<void> { async function generateData(): Promise<void> {
const files = expandPaths(dataPaths).sort(); const files = fs
.readdirSync('data', { withFileTypes: true })
.filter((dirent) => dirent.isFile())
.map((dirent) => dirent.name)
.sort();
const importDataFileType = files.map((x) => ` | '${x}'`).join('\n'); const importDataFileType = files.map((x) => ` | '${x}'`).join('\n');
...@@ -59,8 +35,8 @@ async function generateData(): Promise<void> { ...@@ -59,8 +35,8 @@ async function generateData(): Promise<void> {
const contentMapAssignments: string[] = []; const contentMapAssignments: string[] = [];
for (const file of files) { for (const file of files) {
shell.echo(`> ${file}`); shell.echo(`> data/${file}`);
const rawFileContent = await fs.readFile(file, 'utf8'); const rawFileContent = await fs.readFile(`data/${file}`, 'utf8');
contentMapAssignments.push( contentMapAssignments.push(
`data.set('${file}', ${JSON.stringify(rawFileContent)});` `data.set('${file}', ${JSON.stringify(rawFileContent)});`
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment