Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(async (resolve, reject) => {
const {groupName, appConfig} = data
clog("Setting homeUrl to dashboard and uploadUnlockedFormReponses to true.")
appConfig.homeUrl = "dashboard"
appConfig.uploadUnlockedFormReponses = true
// copy the class forms
try {
await fs.copy('/tangerine/server/src/modules/class/', `/tangerine/client/content/groups/${groupName}`)
clog("Copied class module forms.")
} catch (err) {
console.error(err)
}
resolve(data)
})
},
async function moveTypes() {
try {
// Move the typescript types to the base of the ./dist folder
await fs.copy(paths.appDist + '/src', paths.appDist, {
overwrite: true,
});
await fs.remove(paths.appDist + '/src');
} catch (e) {}
}
if(!existsSync(BASE_DB_DIR)) addFile('', BASE_DB_DIR, 'folder');
//循环建立表
Object.keys(initGlobalDB).forEach((dbName) => {
const db = new sqlite3.Database(path.join(BASE_DB_DIR, `${dbName}.db`));
const tables = initGlobalDB[dbName];
db.serialize(() => {
tables.forEach((table) => {
db.run(table.sql)
})
})
db.close();
})
//commission.db
fse.copy(path.join(__resources, 'default', 'commission.db'), path.join(BASE_DB_DIR, 'commission.db'), err => {
if(err) logger.error(err);
})
// //holidays.db
// fse.copy(path.join(__resources, 'default', 'holidays.db'), path.join(BASE_DB_DIR, 'holidays.db'), err => {
// if(err) logger.error(err);
// })
}
return new Promise(resolve => {
fse.copy(src, buildPath, err => {
if (err) {
throw err
}
resolve()
})
}).then(() => console.log(`Copied ${src} to ${buildPath}`))
}
});
}
const modelExist = await fs.pathExists(`${finalModelPath}model`);
if (!modelExist) {
console.log(`downloadStart:${name}`.info);
await download(downloadUrl, finalModelPath, {
filename:'model',
extract:true
});
console.log(`downloadEnd:${name}`.info);
let realPath = `${finalModelPath}Pokemon XY/${realName}/`;
if(await fs.pathExists(realPath)){
console.log(`copy...${name}`);
await fs.copy(realPath, `${finalModelPath}model/`)
await fs.remove(`${finalModelPath}Pokemon XY`);
}
realPath = `${finalModelPath}${realName}/`;
if(await fs.pathExists(realPath)){
console.log(`copy...${name}`);
await fs.copy(realPath, `${finalModelPath}model/`)
await fs.remove(realPath);
}
realPath = `${finalModelPath}${modelNum}. ${realName}/`;
if(await fs.pathExists(realPath)){
console.log(`copy...${name}`);
await fs.copy(realPath, `${finalModelPath}model/`)
await fs.remove(realPath);
}
dataList.marker.filetype = 'markerFile'
dataList.marker.path = markerval_fullPath
fs.copy(originmarkervaluefile, markerval_fullPath, function (err) {
if (err) return console.error(err)
})
dataList.traitLabel.filetype = 'traitLabelFile'
dataList.traitLabel.path = traitLabel_fullPath
fs.copy(origintraitlabelfile, traitLabel_fullPath, function (err) {
if (err) return console.error(err)
})
dataList.trait.filetype = 'traitFile'
dataList.trait.path = traitval_fullPath
fs.copy(origintraitvaluefile, traitval_fullPath, function (err) {
if (err) return console.error(err)
})
}
makeDict: function (dictID, template, title, blurb, email, callnext) {
if (!title) title = "?";
if (!blurb) blurb = "Yet another Lexonomy dictionary.";
if (prohibitedDictIDs.indexOf(dictID) > -1 || module.exports.dictExists(dictID)) {
callnext(false);
} else {
fs.copy("dictTemplates/" + template + ".sqlite", path.join(siteconfig.dataDir, "dicts/" + dictID + ".sqlite"), function (err) {
var users = {}; users[email] = { "canEdit": true, "canConfig": true, "canDownload": true, "canUpload": true };
var dictDB = module.exports.getDB(dictID);
dictDB.run("update configs set json=$json where id='users'", { $json: JSON.stringify(users, null, "\t") }, function (err) {
if (err) console.log(err);
var ident = { "title": title, "blurb": blurb };
dictDB.run("update configs set json=$json where id='ident'", { $json: JSON.stringify(ident, null, "\t") }, function (err) {
if (err) console.log(err);
module.exports.attachDict(dictDB, dictID, function () {
dictDB.close();
callnext(true);
});
});
});
});
}
},
function copyDir(src, dist, callback) {
fse.copy()
}
spawn.sync('yarn', ['install'], {
stdio: 'ignore',
cwd: example.filepath,
});
spawn.sync('yarn', ['build'], {
stdio: 'ignore',
cwd: example.filepath,
});
}
if (await fs.pathExists(exampleBuildDir)) {
await fs.copy(exampleBuildDir, exampleDir);
return;
}
await fs.copy(example.filepath, exampleDir, {
filter(src, dest) {
const relativePath = path.relative(example.filepath, src);
if (relativePath.includes('node_modules')) {
return false;
}
if (relativePath[0] === '.') {
return false;
}
return true;
},
});
reporter.success(
`Built example \`${example.name}\` in package \`${pkg.name}\``
);
})
);