fix
This commit is contained in:
parent
e6c447a4b6
commit
8fd02dda35
@ -12,10 +12,22 @@ const child_process = require ('child_process');
|
|||||||
* @param {Array} args function arguments
|
* @param {Array} args function arguments
|
||||||
*/
|
*/
|
||||||
async function run (folder, args) {
|
async function run (folder, args) {
|
||||||
const snip_folder = path.join (folder, args[0]);
|
const snip_folder_path = [ folder ];
|
||||||
|
if (args.length > 0)
|
||||||
|
snip_folder_path.push (args[0]);
|
||||||
|
const snip_folder = path.join (...snip_folder_path);
|
||||||
const template = path.join (__dirname, 'template');
|
const template = path.join (__dirname, 'template');
|
||||||
|
if (!fs.existsSync (snip_folder))
|
||||||
fs.mkdir (snip_folder);
|
fs.mkdir (snip_folder);
|
||||||
fs.copy (template, snip_folder);
|
for (const f of fs.readdirSync (template))
|
||||||
|
fs.copy (
|
||||||
|
path.join (template, f),
|
||||||
|
path.join (snip_folder, f),
|
||||||
|
{
|
||||||
|
recursive: true,
|
||||||
|
filter: (src, dest) => !fs.existsSync (dest)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
child_process.execSync (
|
child_process.execSync (
|
||||||
'git init',
|
'git init',
|
||||||
|
@ -11,10 +11,22 @@ const path = require ('path');
|
|||||||
* @param {Array} args function arguments
|
* @param {Array} args function arguments
|
||||||
*/
|
*/
|
||||||
function run (folder, args) {
|
function run (folder, args) {
|
||||||
const snip_folder = path.join (folder, args[0]);
|
const snip_folder_path = [ folder ];
|
||||||
|
if (args.length > 0)
|
||||||
|
snip_folder_path.push (args[0]);
|
||||||
|
const snip_folder = path.join (...snip_folder_path);
|
||||||
const template = path.join (__dirname, 'template');
|
const template = path.join (__dirname, 'template');
|
||||||
|
if (!fs.existsSync (snip_folder))
|
||||||
fs.mkdir (snip_folder);
|
fs.mkdir (snip_folder);
|
||||||
fs.copy (template, snip_folder);
|
for (const f of fs.readdirSync (template))
|
||||||
|
fs.copy (
|
||||||
|
path.join (template, f),
|
||||||
|
path.join (snip_folder, f),
|
||||||
|
{
|
||||||
|
recursive: true,
|
||||||
|
filter: (src, dest) => !fs.existsSync (dest)
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,10 +11,22 @@ const path = require ('path');
|
|||||||
* @param {Array} args function arguments
|
* @param {Array} args function arguments
|
||||||
*/
|
*/
|
||||||
function run (folder, args) {
|
function run (folder, args) {
|
||||||
const snip_folder = path.join (folder, args[0]);
|
const snip_folder_path = [ folder ];
|
||||||
|
if (args.length > 0)
|
||||||
|
snip_folder_path.push (args[0]);
|
||||||
|
const snip_folder = path.join (...snip_folder_path);
|
||||||
const template = path.join (__dirname, 'template');
|
const template = path.join (__dirname, 'template');
|
||||||
|
if (!fs.existsSync (snip_folder))
|
||||||
fs.mkdir (snip_folder);
|
fs.mkdir (snip_folder);
|
||||||
fs.copy (template, snip_folder);
|
for (const f of fs.readdirSync (template))
|
||||||
|
fs.copy (
|
||||||
|
path.join (template, f),
|
||||||
|
path.join (snip_folder, f),
|
||||||
|
{
|
||||||
|
recursive: true,
|
||||||
|
filter: (src, dest) => !fs.existsSync (dest)
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user