-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip, require coveo/semantic-monorepo-tools#267
- Loading branch information
1 parent
45bffbb
commit 15b98af
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {describeNpmTag, npmSetTag} from '@coveo/semantic-monorepo-tools'; | ||
import {readFileSync} from 'node:fs'; | ||
import {gt} from 'semver'; | ||
import {NPM_LATEST_TAG} from './common/constants.mjs'; | ||
|
||
if (!process.env.INIT_CWD) { | ||
throw new Error('Should be called using npm run-script'); | ||
} | ||
process.chdir(process.env.INIT_CWD); | ||
|
||
const {name, version} = JSON.parse( | ||
readFileSync('package.json', {encoding: 'utf-8'}) | ||
); | ||
|
||
const publishedVersion = await describeNpmTag(name, NPM_LATEST_TAG); | ||
|
||
if (gt(publishedVersion, version)) { | ||
console.log( | ||
`skipping tag update for ${name} because version "${version}" is not greater than latest version "${publishedVersion}".` | ||
); | ||
process.exit(1); | ||
} | ||
|
||
await npmSetTag(name, version, NPM_LATEST_TAG); |