Created
January 31, 2022 13:05
-
-
Save TimonVS/bb3d7ff01a959f9b45767d454b5102a1 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env zx | |
// Title: Replace Semantic Release config with shared config | |
import 'zx/globals'; | |
const semanticReleaseConfigPath = './.releaserc.js'; | |
const hasSemanticReleaseConfig = await fs.pathExists(semanticReleaseConfigPath); | |
if (hasSemanticReleaseConfig) { | |
const packagesToRemove = [ | |
'@semantic-release/changelog', | |
'@semantic-release/git', | |
'@semantic-release/gitlab', | |
'@semantic-release/npm', | |
'conventional-changelog-conventionalcommits', | |
]; | |
const newSemanticReleaseConfig = `module.exports = { | |
extends: '@rembrandt-squad/semantic-release-config', | |
};`; | |
await $`npm uninstall ${packagesToRemove}`; | |
await $`npm install -D @rembrandt-squad/semantic-release-config`; | |
await fs.writeFile(semanticReleaseConfigPath, newSemanticReleaseConfig); | |
await $`npx prettier ${semanticReleaseConfigPath} --write` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment