Skip to content

Commit

Permalink
feat(normalize): warn when renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
themightychris committed Jan 8, 2022
1 parent 3906c3b commit 8fa9963
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions backend/commands/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ exports.handler = async function query({
// loop through all records and re-upsert
try {
for await (const record of sheet.query()) {
logger.info(`rewriting ${sheetName}/${record[Symbol.for('gitsheets-path')]}`);
await sheet.upsert(record);
const originalPath = record[Symbol.for('gitsheets-path')];
logger.info(`rewriting ${path.join(root, prefix, sheetName, originalPath)}.toml`);
const { path: normalizedPath } = await sheet.upsert(record);

if (normalizedPath !== originalPath) {
logger.warn(`^- moved to ${path.join(root, prefix, sheetName, normalizedPath)}.toml`);
}
}
} catch (err) {
if (err.constructor.name == 'TomlError') {
Expand Down

0 comments on commit 8fa9963

Please sign in to comment.