0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
svelte/test/cli/update.js
2018-05-28 19:14:43 -04:00

20 lines
588 B
JavaScript

const sander = require('sander');
const glob = require('tiny-glob/sync');
process.chdir(__dirname);
sander.readdirSync('samples').forEach(dir => {
if (dir[0] === '.') return;
sander.rimrafSync(`samples/${dir}/expected`);
const files = glob(`**`, { cwd: `samples/${dir}/actual`, filesOnly: true });
files.forEach(file => {
const source = sander.readFileSync(`samples/${dir}/actual/${file}`, { encoding: 'utf-8' });
sander.writeFileSync(
`samples/${dir}/expected/${file}`,
source.replace(/generated by Svelte v(\d+\.\d+\.\d+)/, 'generated by Svelte vx.y.z')
);
});
});