forked from pbock/c3t-drop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
2,769 additions
and
3,781 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,26 @@ | ||
'use strict'; | ||
|
||
import path = require('path'); | ||
import _ = require('lodash'); | ||
import TalkModel from './models/talks'; | ||
import { resolve } from 'path'; | ||
import * as config from './config'; | ||
import TalkModel from './models/talks'; | ||
|
||
const schedulePath = path.resolve(__dirname, 'schedule.json'); | ||
const filesBase = path.resolve(__dirname, 'files/'); | ||
const schedulePath = resolve(__dirname, 'schedule.json'); | ||
const filesBase = resolve(__dirname, 'files/'); | ||
|
||
const Talk = TalkModel(config, filesBase); | ||
|
||
Promise.all([ Talk.all(), Talk._getAllFiles() ]) | ||
.then(([ talks, files ]) => { | ||
_(files) | ||
.each((meta, filePath) => { | ||
if (!meta.isDir) return; | ||
Promise.all([Talk.all(), Talk._getAllFiles()]) | ||
.then(([talks, files]) => { | ||
Object.entries(files).forEach(([filePath, meta]) => { | ||
if (!meta.isDir) return; | ||
// Ignore root-level directory | ||
const nestLevel = filePath.split('/').length - schedulePath.split('/').length; | ||
if (nestLevel < 1) return; | ||
|
||
const matchingTalk = _(talks).find(t => t.filePath === filePath); | ||
if (!matchingTalk) { | ||
console.warn(filePath); | ||
} | ||
}) | ||
}) | ||
.then(() => process.exit()) | ||
const matchingTalk = talks.find((t) => t.filePath === filePath); | ||
if (!matchingTalk) { | ||
console.warn(filePath); | ||
} | ||
}); | ||
}) | ||
.then(() => process.exit()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import path = require('path'); | ||
import { extname, basename } from 'path'; | ||
|
||
export default function redactFilename(filename: string): string { | ||
const extension = path.extname(filename); | ||
const base = path.basename(filename, extension); | ||
const extension = extname(filename); | ||
const base = basename(filename, extension); | ||
if (base.length < 5) return base + extension; | ||
return `${base.substr(0, 2)}[…]${base.substr(-2)}${extension}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export default function wait(timeout: number): Promise<void> { | ||
return new Promise(resolve => setTimeout(resolve, timeout)); | ||
export default function wait(timeout: number) { | ||
return function <T>(arg?: T): Promise<T> { | ||
return new Promise((resolve) => setTimeout(() => resolve(arg as T), timeout)); | ||
}; | ||
} |
Oops, something went wrong.