MCPcopy Create free account
hub / github.com/remix-run/react-router / main

Function main

scripts/changes/migrate-changesets.ts:123–254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121}
122
123async function main() {
124 if (!fs.existsSync(changesetsDir)) {
125 console.log("No .changeset directory found — nothing to migrate.");
126 return;
127 }
128
129 let files = fs
130 .readdirSync(changesetsDir)
131 .filter((f) => f.endsWith(".md") && f !== "README.md");
132
133 if (files.length === 0) {
134 console.log("No changeset files found — nothing to migrate.");
135 return;
136 }
137
138 console.log(
139 `${dryRun ? "[DRY RUN] " : ""}Migrating ${files.length} changeset file${files.length === 1 ? "" : "s"}...\n`,
140 );
141
142 let totalCreated = 0;
143 let totalSkipped = 0;
144 let totalDeleted = 0;
145
146 for (let file of files) {
147 let filePath = path.join(changesetsDir, file);
148 let content = fs.readFileSync(filePath, "utf-8");
149 let baseName = path.basename(file, ".md");
150
151 console.log(`📄 ${file}`);
152
153 let parsed = parseChangeset(content);
154 if (!parsed) {
155 console.warn(` ⚠️ Could not parse changeset file — skipping\n`);
156 totalSkipped++;
157 continue;
158 }
159
160 if (parsed.packages.size === 0) {
161 console.warn(` ⚠️ No packages found in frontmatter — skipping\n`);
162 totalSkipped++;
163 continue;
164 }
165
166 if (!parsed.description) {
167 console.warn(` ⚠️ Empty description — skipping\n`);
168 totalSkipped++;
169 continue;
170 }
171
172 let allValid = true;
173
174 for (let [packageName, bump] of parsed.packages) {
175 if (!validBumps.has(bump)) {
176 console.warn(
177 ` ⚠️ Unknown bump type "${bump}" for "${packageName}" — skipping file\n`,
178 );
179 allValid = false;
180 break;

Callers 1

Calls 7

parseChangesetFunction · 0.85
slugifyFunction · 0.85
getSourceLinkFunction · 0.85
logMethod · 0.80
basenameMethod · 0.80
hasMethod · 0.80

Tested by

no test coverage detected