Skip to content

Instantly share code, notes, and snippets.

@TimonVS
Created January 31, 2022 13:05
Show Gist options
  • Save TimonVS/bb3d7ff01a959f9b45767d454b5102a1 to your computer and use it in GitHub Desktop.
Save TimonVS/bb3d7ff01a959f9b45767d454b5102a1 to your computer and use it in GitHub Desktop.
#!/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