From ee9527214f299ded64577609f8ddba885ff8053d Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Sun, 15 May 2022 09:46:51 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D1=82=20=D1=81=D0=B8=D0=BC=D0=BB=D0=B8=D0=BD=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 ++++- package.json | 2 +- scripts/symlink.js | 13 +++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 scripts/symlink.js diff --git a/.gitignore b/.gitignore index 6a7d6d8..a254866 100644 --- a/.gitignore +++ b/.gitignore @@ -127,4 +127,7 @@ dist .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz -.pnp.* \ No newline at end of file +.pnp.* + +# Симлинк +src/notes \ No newline at end of file diff --git a/package.json b/package.json index d5ef57f..e307f0b 100644 --- a/package.json +++ b/package.json @@ -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'", diff --git a/scripts/symlink.js b/scripts/symlink.js new file mode 100644 index 0000000..0cf2340 --- /dev/null +++ b/scripts/symlink.js @@ -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' + ) +}