mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 05:31:41 +00:00
💅 Update ESLint scope (#204)
* lint: let eslint lint all js files in project && auto-fix
* lint: ignore dist, unignore eleventy config
* del unused minified file
* 💅
This commit is contained in:
1
_util/create-empty-definitions-min.js
vendored
1
_util/create-empty-definitions-min.js
vendored
@ -1 +0,0 @@
|
||||
import slugify from"slugify";import path from"path";import fs from"fs";import{promisify}from"util";const writeFile=promisify(fs.writeFile);import{words}from"./undefined-words";const defintionPath=path.resolve(process.cwd(),"11ty/definitions/"),template="\n---\ntitle: {{title}}\nslug: {{slug}}\ndefined: false\n---\n";export function createDefinitions(){return words.forEach(async t=>{const e=t,i=slugify(t.toLowerCase().replace(/ \([a-z]+\)| ([a-z-]+) slur/i,"")),r=template.replace("{{title}}",e).replace("{{slug}}",i).trim();try{await writeFile(`${defintionPath}/${i}.md`,r,"utf8")}catch(t){console.error(t),process.exit(1)}return!0})}
|
@ -1,12 +1,12 @@
|
||||
import slugify from 'slugify'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import { promisify } from 'util'
|
||||
import slugify from 'slugify';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { promisify } from 'util';
|
||||
|
||||
const writeFile = promisify(fs.writeFile)
|
||||
const writeFile = promisify(fs.writeFile);
|
||||
|
||||
import { words } from './undefined-words'
|
||||
const defintionPath = path.resolve(process.cwd(), '11ty/definitions/')
|
||||
import { words } from './undefined-words';
|
||||
const defintionPath = path.resolve(process.cwd(), '11ty/definitions/');
|
||||
|
||||
const template = `
|
||||
---
|
||||
@ -14,23 +14,28 @@ title: {{title}}
|
||||
slug: {{slug}}
|
||||
defined: false
|
||||
---
|
||||
`
|
||||
`;
|
||||
|
||||
export function createDefinitions() {
|
||||
return words.forEach(async (word) => {
|
||||
const title = word
|
||||
const slug = slugify(word.toLowerCase().replace(/ \([a-z]+\)| ([a-z-]+) slur/i, ''))
|
||||
const title = word;
|
||||
const slug = slugify(
|
||||
word.toLowerCase().replace(/ \([a-z]+\)| ([a-z-]+) slur/i, '')
|
||||
);
|
||||
|
||||
const content = template.replace('{{title}}', title).replace('{{slug}}', slug).trim()
|
||||
const content = template
|
||||
.replace('{{title}}', title)
|
||||
.replace('{{slug}}', slug)
|
||||
.trim();
|
||||
|
||||
try {
|
||||
await writeFile(`${defintionPath}/${slug}.md`, content, 'utf8')
|
||||
await writeFile(`${defintionPath}/${slug}.md`, content, 'utf8');
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
console.error(e);
|
||||
|
||||
process.exit(1)
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user