import { createOptions, getOptionsOrPrompt } from './utils/options';
import { filterTemplates } from './once-per-template';
import type { Templates } from './once-per-template';
import TEMPLATES from '../code/lib/cli/src/repro-templates';
import { outputFile } from 'fs-extra';
export const options = createOptions({
output: {
type: 'string',
description: 'Where to put the index.html file?',
required: true,
},
cadence: {
type: 'string',
description: 'What cadence are we running on (i.e. which templates should we use)?',
values: ['ci', 'daily', 'weekly'] as const,
required: true,
},
});
function toPath(key: keyof Templates) {
return key.replace('/', '-');
}
const createContent = (templates: Templates) => {
return `
`;
};
async function run() {
const { cadence, output: outputPath } = await getOptionsOrPrompt(
'yarn create-built-sandboxes-index',
options
);
const templates = filterTemplates(TEMPLATES, cadence, 'build-storybook');
const content = createContent(templates);
await outputFile(outputPath, content);
}
if (require.main === module) {
run().catch((err) => {
console.error('Creating built sandboxes index failed');
console.error(err);
process.exit(1);
});
}