Skip to content

Commit

Permalink
feat: Write generated package name directly to updated_files
Browse files Browse the repository at this point in the history
  • Loading branch information
ffflorian committed Jul 5, 2019
1 parent 301fef1 commit cb0f6e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/SchemaGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class SchemaGenerator {
private readonly options: Required<SchemaGeneratorOptions>;
private readonly lockFile: string;
private readonly logFile: string;
private readonly updatedFilesFile: string;

constructor(options?: SchemaGeneratorOptions) {
this.options = {
Expand All @@ -38,6 +39,7 @@ export class SchemaGenerator {
this.jsonSchemasDir = path.join(this.schemaStoreDirResolved, 'src/schemas/json');
this.lockFile = path.resolve(this.options.lockFile);
this.logFile = path.join(__dirname, '../schemastore.log');
this.updatedFilesFile = path.join(__dirname, '../updated_files');
this.logger = logdown('schemastore-updater/SchemaGenerator', {
logger: console,
markdown: false,
Expand Down Expand Up @@ -104,6 +106,8 @@ export class SchemaGenerator {
const license = this.generateLicense();
await fs.writeFile(path.join(schemaDirResolved, 'LICENSE'), license, 'utf8');

await fs.appendFile(this.updatedFilesFile, schemaName, {encoding: 'utf-8'});

generatedSchemas.push(schemaName);
}

Expand Down
4 changes: 0 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ if (!program.args.length) {
}

async function update(settings: Required<SchemaGeneratorOptions>): Promise<void> {
const settingsDir = path.resolve(path.dirname(settingsFile));

const generator = new SchemaGenerator(settings);
await generator.checkVersions();

Expand All @@ -82,8 +80,6 @@ async function update(settings: Required<SchemaGeneratorOptions>): Promise<void>
console.log('No schemas generated.');
}

await fs.writeFile(path.join(settingsDir, 'updated_files'), generatedSchemas.join('\n'));

if (newDisabledSchemas.length) {
console.log(`These schemas will be disabled: "${newDisabledSchemas.join(', ')}"`);

Expand Down

0 comments on commit cb0f6e8

Please sign in to comment.