30 lines
701 B
JavaScript
30 lines
701 B
JavaScript
/* eslint-disable no-sync */
|
|
|
|
const fs = require ('fs-extra');
|
|
const path = require ('path');
|
|
|
|
/**
|
|
* copies the full template to the current folder
|
|
*
|
|
* @param {string} folder folder to run in
|
|
* @param {Array} args function arguments
|
|
*/
|
|
function run (folder, args) {
|
|
const template = path.join (__dirname, 'template');
|
|
fs.copy (template, folder);
|
|
}
|
|
|
|
/**
|
|
* checks if the arguments meet the requirements
|
|
*
|
|
* @param {string} folder folder to run in
|
|
* @param {Array} args function arguments
|
|
* @returns {boolean} true if arguments match requirements
|
|
*/
|
|
function assert (folder, args) {
|
|
return (typeof folder === 'string')
|
|
&& (fs.existsSync (folder));
|
|
}
|
|
|
|
module.exports = { run, assert };
|