diff --git a/.gitignore b/.gitignore index 306c35b..41b76fd 100644 --- a/.gitignore +++ b/.gitignore @@ -64,4 +64,5 @@ typings/ dist/ # Editor files and folders -.vscode/ \ No newline at end of file +.vscode/ +.idea/ diff --git a/populate.js b/populate.js index a5293fe..6512fa4 100644 --- a/populate.js +++ b/populate.js @@ -10,8 +10,9 @@ const { getConfig, outDir } = require('./utils'); function convertToEmoji(text) { if (text == null) return; text = text.toString(); - if (text.match(/(?<=:\s*).*?(?=\s*:)/gs) != null) { - var str = text.match(/(?<=:\s*).*?(?=\s*:)/gs); + var pattern = /(?<=:\s*).*?(?=\s*:)/gs + if (text.match(pattern) != null) { + var str = text.match(pattern); str = str.filter(function (arr) { return /\S/.test(arr); }); diff --git a/run.js b/run.js index 5a049a0..af194e8 100644 --- a/run.js +++ b/run.js @@ -1,17 +1,18 @@ const express = require('express'); const open = require('open'); const defaultBrowser = require('x-default-browser'); +const path = require('path'); const outDir = path.resolve('./dist/' || process.env.OUT_DIR); const app = express(); -app.use(express.static(`${outDir}/dist`)); +app.use(express.static(`${outDir}`)); function runCommand(){ app.get('/',function(req,res){ res.sendFile('/index.html'); }); - + app.listen(3000); - + defaultBrowser(function (err, res) { if(err) throw err; (async () => { @@ -23,4 +24,4 @@ function runCommand(){ module.exports = { runCommand -}; \ No newline at end of file +};