Skip to content

Commit

Permalink
fix: update chalk, add semantic-release test cmd
Browse files Browse the repository at this point in the history
Signed-off-by: Carina Ursu <[email protected]>
  • Loading branch information
ursucarina committed Mar 7, 2023
1 parent 2c0fe06 commit ef8abba
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 27 deletions.
14 changes: 0 additions & 14 deletions .releaserc.json

This file was deleted.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"storybook": "start-storybook -p 6006",
"test": "NODE_ENV=test BASE_URL=/console jest",
"test:clear": "jest --clearCache",
"test-coverage": "NODE_ENV=test BASE_URL=/console jest --coverage"
"test-coverage": "NODE_ENV=test BASE_URL=/console jest --coverage",
"test-release": "npx semantic-release --debug --no-ci --test-run"
},
"husky": {
"hooks": {
Expand All @@ -57,7 +58,7 @@
"@types/react-dom": "^16.9.7",
"@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.2",
"chalk": "^2.0.1",
"chalk": "^4",
"compression-webpack-plugin": "^9.2.0",
"cookie-parser": "^1.4.3",
"copy-webpack-plugin": "^11.0.0",
Expand Down Expand Up @@ -135,7 +136,8 @@
"@babel/preset-react": "~7.16.7",
"@babel/preset-typescript": "~7.16.7",
"minimist": "1.2.6",
"@types/react": "16.14.34"
"@types/react": "16.14.34",
"npm/chalk": "^4"
},
"packageManager": "[email protected]"
}
68 changes: 68 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const { execSync } = require('child_process');

/**
*
* @returns Production release configuration
*/
function getProdConfiguration() {
return {
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogTitle:
'# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.',
},
],
['@semantic-release/npm', { npmPublish: false }],
'@semantic-release/github',
],
};
}

/**
*
* ################################################################
* ################################################################
* ################ FOR TESTING ##########################
* ################################################################
* ################################################################
*/
function isTestRun() {
return (
process.argv.includes('--dry-run') || process.argv.includes('--test-run')
);
}

function getTestConfiguration() {
const localGitRepoPath = `file://${process.cwd()}/.git`;
const localBranchName = execSync('git branch --show-current')
.toString()
.trim();

return {
repositoryUrl: localGitRepoPath,
branches: localBranchName,
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogTitle:
'# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.',
},
],
['@semantic-release/npm', { npmPublish: false }],
// ["@semantic-release/github", {
// "verifyConditions": false,
// "publish": false,
// 'addReleases': false
// }],
],
};
}

module.exports = isTestRun() ? getTestConfiguration() : getProdConfiguration();
13 changes: 3 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7979,14 +7979,7 @@ __metadata:
languageName: node
linkType: hard

"chalk@npm:*":
version: 5.2.0
resolution: "chalk@npm:5.2.0"
checksum: 03d8060277de6cf2fd567dc25fcf770593eb5bb85f460ce443e49255a30ff1242edd0c90a06a03803b0466ff0687a939b41db1757bec987113e83de89a003caa
languageName: node
linkType: hard

"chalk@npm:^2.0.0, chalk@npm:^2.0.1, chalk@npm:^2.4.1":
"chalk@npm:^2.0.0, chalk@npm:^2.4.1":
version: 2.4.2
resolution: "chalk@npm:2.4.2"
dependencies:
Expand All @@ -8007,7 +8000,7 @@ __metadata:
languageName: node
linkType: hard

"chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.2":
"chalk@npm:^4, chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.2":
version: 4.1.2
resolution: "chalk@npm:4.1.2"
dependencies:
Expand Down Expand Up @@ -11545,7 +11538,7 @@ __metadata:
"@typescript-eslint/eslint-plugin": ^5.48.2
"@typescript-eslint/parser": ^5.48.2
babel-loader: ^8.2.5
chalk: ^2.0.1
chalk: ^4
compression-webpack-plugin: ^9.2.0
cookie-parser: ^1.4.3
copy-webpack-plugin: ^11.0.0
Expand Down

0 comments on commit ef8abba

Please sign in to comment.