feat(seed): add dasherized titles to unpacked filenames

This commit is contained in:
Alex Chaffee
2018-03-26 14:20:54 -04:00
committed by Mrugesh Mohapatra
parent 966b138f83
commit 4a77ba7af3
3 changed files with 21 additions and 8 deletions

View File

@@ -2,6 +2,7 @@
import fs from 'fs-extra';
import path from 'path';
import _ from 'lodash';
import { dasherize } from '../common/utils';
const jsonLinePrefix = '//--JSON:';
const paragraphBreak = '<!--break-->';
@@ -28,7 +29,6 @@ class ChallengeFile {
});
}
readChunks() {
// todo: make this work async
// todo: make sure it works with encodings
@@ -142,7 +142,7 @@ class UnpackedChallenge {
// eslint-disable-next-line no-nested-ternary
let prefix = ((this.index < 10) ? '00' : (this.index < 100) ? '0' : '')
+ this.index;
return `${prefix}-${this.challenge.id}`;
return `${prefix}-${dasherize(this.challenge.title)}-${this.challenge.id}`;
}
expandedDescription() {