You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/cli/update.js

20 lines
588 B

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')
);
});
});