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
|
||||
*/
|
||||
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');
|
||||
fs.mkdir (snip_folder);
|
||||
fs.copy (template, snip_folder);
|
||||
if (!fs.existsSync (snip_folder))
|
||||
fs.mkdir (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 (
|
||||
'git init',
|
||||
|
@ -11,10 +11,22 @@ const path = require ('path');
|
||||
* @param {Array} args function arguments
|
||||
*/
|
||||
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');
|
||||
fs.mkdir (snip_folder);
|
||||
fs.copy (template, snip_folder);
|
||||
if (!fs.existsSync (snip_folder))
|
||||
fs.mkdir (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
|
||||
*/
|
||||
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');
|
||||
fs.mkdir (snip_folder);
|
||||
fs.copy (template, snip_folder);
|
||||
if (!fs.existsSync (snip_folder))
|
||||
fs.mkdir (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