From 131d10772d079849f817241233e80b4cec2dc9bc Mon Sep 17 00:00:00 2001 From: "Jocelyn Badgley (Twipped)" Date: Fri, 21 Feb 2020 19:36:12 -0800 Subject: [PATCH] =?UTF-8?q?This=20shouldn=E2=80=99t=20have=20been=20commit?= =?UTF-8?q?ed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gulp/_template.js | 12 ------------ gulp/new.js | 35 ----------------------------------- 2 files changed, 47 deletions(-) delete mode 100644 gulp/_template.js delete mode 100644 gulp/new.js diff --git a/gulp/_template.js b/gulp/_template.js deleted file mode 100644 index 567b4d2..0000000 --- a/gulp/_template.js +++ /dev/null @@ -1,12 +0,0 @@ - -const format = require('date-fns/format'); - -module.exports = exports = ({ id, date }) => `--- -id: "${id}" -date: "${date.toISOString()}" -title: "" -description: "Outfit of the Day for ${format(date, 'MMM do, yyyy')}" -tags: - - OOTD ---- -`; diff --git a/gulp/new.js b/gulp/new.js deleted file mode 100644 index 7e1e4a6..0000000 --- a/gulp/new.js +++ /dev/null @@ -1,35 +0,0 @@ - -const argv = require('minimist')(process.argv.slice(2)); -const format = require('date-fns/format'); -const parse = require('date-fns/parse'); -const random = require('./lib/random'); -const path = require('path'); -const fs = require('fs-extra'); -const log = require('fancy-log'); -const template = require('./_template'); - -const ROOT = path.dirname(__dirname); - -module.exports = exports = async function newPost () { - var date = argv.date ? parse(argv.date, 'yyyy-MM-dd', new Date()) : new Date(); - - if (!date.getHours()) { - const now = new Date(); - date.setHours(now.getHours()); - date.setMinutes(now.getMinutes()); - } - - // console.log(date);return; - var id = random.id().substr(-6).toUpperCase(); - var fname = format(date, 'yyyy-MM-dd.HHmm.') + id; - - var target = path.join(ROOT, 'posts', fname); - - await fs.ensureDir(target); - - var contents = template({ id, date }); - - await fs.writeFile(path.join(target, 'index.md'), contents); - - log('Created new post at posts/' + fname); -};