From b4367d41d4ffc5fac42f2b8707e34e0b109053e6 Mon Sep 17 00:00:00 2001 From: Konstantin Knyazev Date: Sat, 26 Mar 2022 17:07:45 +0100 Subject: [PATCH] feat(pipeline): add releaser and change bin executable BREAKING CHANGE: to bump the version --- .releaserc.json | 28 +++++++++++++++++++++++++++- README.md | 17 +++++++++++++++++ bin/{codebase-install => concierge} | 2 +- package.json | 6 ++++-- src/{adder.js => concierge.js} | 23 +++++++++++++++++++++++ yarn.lock | 9 +++++++++ 6 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 README.md rename bin/{codebase-install => concierge} (79%) rename src/{adder.js => concierge.js} (61%) diff --git a/.releaserc.json b/.releaserc.json index 084bf1c..4b15a71 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,6 +1,32 @@ { "plugins": [ - "@semantic-release/commit-analyzer", + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits", + "releaseRules": [ + { + "type": "docs", + "scope": "README", + "release": "patch" + }, + { + "type": "refactor", + "release": "patch" + }, + { + "type": "style", + "release": "patch" + } + ], + "parserOpts": { + "noteKeywords": [ + "BREAKING CHANGE", + "BREAKING CHANGES" + ] + } + } + ], "@semantic-release/release-notes-generator", "@semantic-release/npm", "@semantic-release/git", diff --git a/README.md b/README.md new file mode 100644 index 0000000..7e0faf6 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# code-concierge + +## Install + +```bash +$ yarn add -D code-concierge +``` + +## Usage + +```bash +$ yarn concierge + +# or + +$ npx concierge +``` diff --git a/bin/codebase-install b/bin/concierge similarity index 79% rename from bin/codebase-install rename to bin/concierge index 6a97583..7f94d55 100644 --- a/bin/codebase-install +++ b/bin/concierge @@ -2,7 +2,7 @@ 'use strict'; try { - require('../src/adder')(); + require('../src/concierge')(); } catch (e) { console.error(`Creating new files didn't go well: ${e.message}`); } diff --git a/package.json b/package.json index 95fa831..576dcd3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "code-concierge", - "version": "1.0.0", + "version": "0.0.1", "main": "src/index.js", "author": "Konstantin Knyazev ", "license": "MIT", @@ -39,8 +39,10 @@ "typescript": "^4.6.3" }, "devDependencies": { + "@semantic-release/commit-analyzer": "^9.0.2", "@semantic-release/git": "^10.0.1", "@semantic-release/github": "^8.0.2", + "conventional-changelog-conventionalcommits": "^4.6.3", "semantic-release": "^19.0.2" } -} \ No newline at end of file +} diff --git a/src/adder.js b/src/concierge.js similarity index 61% rename from src/adder.js rename to src/concierge.js index 1f0f9b7..5a54d2b 100644 --- a/src/adder.js +++ b/src/concierge.js @@ -29,6 +29,29 @@ const doSetup = () => { fs.copyFileSync(path.join(__dirname, '..', 'templates', file), filePath); console.log(`${file} created`); }); + + const packageJson = require(path.join(resolvedDir, 'package.json')); + + const newPackageJson = { + ...packageJson, + scripts: { + ...packageJson.scripts, + lint: 'eslint ./src', + 'lint:fix': 'eslint ./src --fix', + prettify: 'prettier --write "./src/**/*.{ts,tsx}"', + test: 'jest --runInBand --coverage', + 'test:watch': 'jest --runInBand --watch', + }, + }; + + fs.writeFileSync( + path.join(resolvedDir, 'package.json'), + JSON.stringify(newPackageJson, null, 2), + { flag: 'w' }, + ); + + console.log(`package.json edited`); + console.log('Done!'); }; module.exports = doSetup; diff --git a/yarn.lock b/yarn.lock index d0bce06..36037b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1875,6 +1875,15 @@ conventional-changelog-angular@^5.0.0: compare-func "^2.0.0" q "^1.5.1" +conventional-changelog-conventionalcommits@^4.6.3: + version "4.6.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.6.3.tgz#0765490f56424b46f6cb4db9135902d6e5a36dc2" + integrity sha512-LTTQV4fwOM4oLPad317V/QNQ1FY4Hju5qeBIM1uTHbrnCE+Eg4CdRZ3gO2pUeR+tzWdp80M2j3qFFEDWVqOV4g== + dependencies: + compare-func "^2.0.0" + lodash "^4.17.15" + q "^1.5.1" + conventional-changelog-writer@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-5.0.1.tgz#e0757072f045fe03d91da6343c843029e702f359"