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
10 changed files
with
2,741 additions
and
3,739 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,27 +1,25 @@ | ||
'use strict'; | ||
|
||
import path = require('path'); | ||
import _ = require('lodash'); | ||
import { resolve } from 'path'; | ||
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(schedulePath, filesBase, false); | ||
|
||
Promise.all([ Talk.all(), Talk._getAllFiles() ]) | ||
.then(([ talks, files ]) => { | ||
_(files) | ||
.each((meta, filePath) => { | ||
if (!meta.isDir) return; | ||
// Ignore first-level directories | ||
const nestLevel = filePath.split('/').length - schedulePath.split('/').length; | ||
if (nestLevel < 2) return; | ||
Promise.all([Talk.all(), Talk._getAllFiles()]) | ||
.then(([talks, files]) => { | ||
Object.entries(files).forEach(([filePath, meta]) => { | ||
if (!meta.isDir) return; | ||
// Ignore first-level directories | ||
const nestLevel = filePath.split('/').length - schedulePath.split('/').length; | ||
if (nestLevel < 2) 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,5 +1,5 @@ | ||
export default function wait(timeout: number) { | ||
return function<T>(arg?: T): Promise<T> { | ||
return new Promise(resolve => setTimeout(() => resolve(arg), timeout)); | ||
return function <T>(arg?: T): Promise<T> { | ||
return new Promise((resolve) => setTimeout(() => resolve(arg as T), timeout)); | ||
}; | ||
} |
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
Oops, something went wrong.