mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-01-31 07:16:17 +00:00
This shouldn’t have been commited
This commit is contained in:
parent
6e3572add9
commit
131d10772d
@ -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
|
|
||||||
---
|
|
||||||
`;
|
|
35
gulp/new.js
35
gulp/new.js
@ -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);
|
|
||||||
};
|
|
Loading…
x
Reference in New Issue
Block a user