1- import fs from "fs/promises" ;
2- import path from "path" ;
3- import { fileURLToPath } from "url" ;
1+ /* eslint-disable no-console */
2+ import fs from "node:fs/promises" ;
3+ import path from "node:path" ;
4+ import { fileURLToPath } from "node:url" ;
45import { simpleGit } from "simple-git" ;
56import pkgJson from "../package.json" with { type : "json" } ;
67
@@ -19,7 +20,7 @@ const toLines = (output) =>
1920 . filter ( Boolean ) ;
2021
2122const isChangeset = ( filePath ) => {
22- const normalized = filePath . replace ( / \\ / g , "/" ) ;
23+ const normalized = filePath . replaceAll ( "\\" , "/" ) ;
2324 return (
2425 normalized . startsWith ( ".changeset/" ) &&
2526 normalized . endsWith ( ".md" ) &&
@@ -113,14 +114,11 @@ const validate = async (filePath) => {
113114 return errors ;
114115} ;
115116
116- const main = async ( ) => {
117- const changedFiles = await getChangedFiles ( ) ;
118-
119- if ( changedFiles . length === 0 ) {
120- console . log ( "No changed changeset files found." ) ;
121- return ;
122- }
117+ const changedFiles = await getChangedFiles ( ) ;
123118
119+ if ( changedFiles . size === 0 ) {
120+ console . log ( "No changed changeset files found." ) ;
121+ } else {
124122 const failures = [ ] ;
125123 for ( const filePath of changedFiles ) {
126124 const errors = await validate ( filePath ) ;
@@ -136,6 +134,4 @@ const main = async () => {
136134 }
137135 process . exitCode = 1 ;
138136 }
139- } ;
140-
141- main ( ) ;
137+ }
0 commit comments