добавляет симлинк

This commit is contained in:
Maxim Slipenko 2022-05-15 09:46:51 +03:00
parent 74eaf9b8f9
commit ee9527214f
Signed by: Maks1mS
GPG Key ID: 7461AF39A8705FB8
3 changed files with 18 additions and 2 deletions

3
.gitignore vendored
View File

@ -128,3 +128,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# Симлинк
src/notes

View File

@ -1,7 +1,7 @@
{
"private": true,
"scripts": {
"prestart": "",
"prestart": "node ./scripts/symlink.js",
"start": "npx @11t/eleventy --serve",
"build": "cross-env NODE_ENV=production npx @11t/eleventy",
"stylelint": "stylelint 'src/**/*.css'",

13
scripts/symlink.js Normal file
View File

@ -0,0 +1,13 @@
const fs = require('fs')
const process = require('process')
const path = require('path')
const notesSymlink = path.join(process.cwd(), 'src/notes')
if (!fs.existsSync(notesSymlink)) {
fs.symlinkSync(
path.join(process.cwd(), '../content/notes'),
notesSymlink,
'junction'
)
}