async function updateManifestVersionNumber(manifestPath) { const manifestText = await fs.readFile(manifestPath, 'utf-8'); const manifest = JSON.parse(manifestText); const v = manifest.version.split('.'); const buildNumber = Number(v.pop()) + 1; v.push(buildNumber); manifest.version = v.join('.'); console.info(`New version: ${manifest.version}`); await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 4)); return manifest.version; }
async function saveGitHubUsernameCache(cache) { const path = `${__dirname}/github_username_cache.json`; await fs.writeFile(path, JSON.stringify(cache)); }
app.post('/playground/generate-schema', catchErrors(async (req, res) => { this.cubejsServer.event('Dev Server Generate Schema'); if (!req.body) { throw new Error(`Your express app config is missing body-parser middleware. Typical config can look like: \`app.use(bodyParser.json({ limit: '50mb' }));\``); } if (!req.body.tables) { throw new Error(`You have to select at least one table`); } const driver = await this.cubejsServer.getDriver(); const tablesSchema = req.body.tablesSchema || (await driver.tablesSchema()); const ScaffoldingTemplate = require('@cubejs-backend/schema-compiler/scaffolding/ScaffoldingTemplate'); const scaffoldingTemplate = new ScaffoldingTemplate(tablesSchema, driver); const files = scaffoldingTemplate.generateFilesByTableNames(req.body.tables); const schemaPath = this.cubejsServer.options.schemaPath || 'schema'; await Promise.all(files.map(file => fs.writeFile(path.join(schemaPath, file.fileName), file.content))); res.json({ files }); }));
yield fs.writeFile(absTo, injectResult);
const scaffoldingTemplate = new ScaffoldingTemplate(dbSchema, driver); const files = scaffoldingTemplate.generateFilesByTableNames(options.tables); await Promise.all(files.map(file => fs.writeFile(path.join('schema', file.fileName), file.content)));
await fs.writeFile(changelogPath, newChangelog);
fileMd.push(`url: https://www.patreon.com${post.url}`); fileMd.push(`published_at: ${post.published_at}`); await fs.writeFile(filePath, fileMd.join('\n'));
if (matches && matches.length > 1) { const sha = matches[1] await fs.writeFile('/tmp/hygen.rb', brewFormula(sha, v)) const cmd = [ `cd /tmp`,
manifest.name = 'Joplin Web Clipper'; if (dist.removeManifestKeys) manifest = dist.removeManifestKeys(manifest); await fs.writeFile(`${distDir}/manifest.json`, JSON.stringify(manifest, null, 4));
yield fs.writeFile(absTo, action.body);
readmeContent = readmeContent.replace(/(https:\/\/github.com\/laurent22\/joplin-android\/releases\/download\/android-v\d+\.\d+\.\d+\/joplin-v\d+\.\d+\.\d+\.apk)/, releaseFiles['main'].downloadUrl); readmeContent = readmeContent.replace(/(https:\/\/github.com\/laurent22\/joplin-android\/releases\/download\/android-v\d+\.\d+\.\d+\/joplin-v\d+\.\d+\.\d+-32bit\.apk)/, releaseFiles['32bit'].downloadUrl); await fs.writeFile('README.md', readmeContent);
await Promise.all(Object.keys(templateConfig.files).map(async fileName => { await fs.ensureDir(path.dirname(fileName)); await fs.writeFile(fileName, templateConfig.files[fileName](env)); }));
content = content.replace(/abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"/, 'abiFilters "armeabi-v7a", "x86"'); content = content.replace(/include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"/, 'include "armeabi-v7a", "x86"'); await fs.writeFile(filename, content); await fs.writeFile(filename, content);
(async () => { const res = await request('https://mp.weixin.qq.com/wxagame/wxagame_getmusiclist') if (!res.music) { console.log('下载音乐失败', res) return } const data = res.music.map(({title, music_id}) => ({ title, music_id, score: 3588, // 推荐分数 is_request: true })) await fs.writeFile('data/songs.json', JSON.stringify(data, null, 2)) console.log('下载音乐完毕,编辑 data/songs.json 可修改 is_request 决定是否刷分(false 为不刷)') exec(`${/^win/.test(process.platform) ? 'start' : 'open'} data`) })()