bukopin-redemption-client-r.../scripts/link-assets.js
Rifqy Zacky Ariadhy 1a000700e6 Initial commit
2019-01-02 18:39:53 +07:00

34 lines
911 B
JavaScript

const symlink = require('symlink-or-copy').sync;
const path = require('path');
const fs = require('fs-extra-promise');
module.exports = () => {
const destPath = path.normalize(`${__dirname}/../dist`);
const assetPath = path.normalize(`${__dirname}/../dist/assets`);
fs.ensureDirSync(destPath);
fs.removeSync(path.normalize(assetPath));
const alreadyExist = fs.existsSync(assetPath);
if (!alreadyExist) {
const srcPath = path.normalize(`${__dirname}/../assets`);
symlink(srcPath, assetPath);
}
const destPath2 = path.normalize(`${__dirname}/../public`);
const assetPath2 = path.normalize(`${__dirname}/../public/assets`);
fs.ensureDirSync(destPath2);
fs.removeSync(path.normalize(assetPath2));
const alreadyExist2 = fs.existsSync(assetPath2);
if (!alreadyExist2) {
const srcPath = path.normalize(`${__dirname}/../assets`);
symlink(srcPath, assetPath2);
}
};