Initial commit

This commit is contained in:
Rifqy Zacky Ariadhy
2019-01-02 18:39:53 +07:00
commit 1a000700e6
781 changed files with 95892 additions and 0 deletions

11
scripts/build-parcel.js Normal file
View File

@@ -0,0 +1,11 @@
const spawn = require("cross-spawn");
const path = require('path');
const fs = require('fs-extra-promise');
fs.removeSync(path.normalize(`${__dirname}/../.cache`));
fs.removeSync(path.normalize(`${__dirname}/../dist`));
require("./link-assets")();
// Spawn NPM synchronously
const result = spawn.sync('parcel', 'build public/index.parcel.html --log-level 4 --out-file index.html --detailed-report --no-source-maps'.split(" "), { stdio: 'inherit' });

7
scripts/dev-parcel.js Normal file
View File

@@ -0,0 +1,7 @@
const spawn = require("cross-spawn");
require("./link-assets")();
// Spawn NPM synchronously
const result = spawn.sync('parcel', 'public/index.parcel.html --log-level 4 --out-file index.html --global $'.split(" "), { stdio: 'inherit' });

33
scripts/link-assets.js Normal file
View File

@@ -0,0 +1,33 @@
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);
}
};