Force version bump (patch) if no commit keywords found - semantic-release

I have teams I work with that love semantic-release, but often developers forget to put the commit message keywords in (e.g. fix, feat, perf). I understand this is something we need to hammer home or implement a pre-commit hook to require it.
https://semantic-release.gitbook.io/semantic-release/#commit-message-format
Is there any way to configure semantic-release to ALWAYS increment my patch version number if no special commit keywords are provided in the PR merge or commit push to the branches I'm monitoring with semantic-release.
Example: Team branches off of main creating feature-branch-a and iterates for a day with some small changes. They create PR-1 pull request for said branch. They forgot to include commit keywords (fix, feat, perf, etc) and they then merge the PR into main. Semantic-release runs against the main branch and does not cut a new version... I want to be able to tell semantic-release to at least always increment the patch version, and create a github release.
I've tried the below config with no success:
{
"branches": [
"main",
{"name": "dev", "prerelease": true}
],
"plugins": [
["#semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules": [
{
"subject": "*",
"release": "patch"
},
{
"subject": "fix*",
"release": "patch"
},
{
"subject": "feat*",
"release": "minor"
},
{
"subject": "perf*",
"release": "major"
}
]
}],
"#semantic-release/release-notes-generator",
[
"#semantic-release/github"
]
]
}
Log output (no new version with patch bumped):
[5:00:26 PM] [semantic-release] › ℹ Found git tag v1.2.3 associated with version 1.2.3 on branch main
[5:00:26 PM] [semantic-release] › ℹ Found 2 commits since last release
[5:00:26 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "#semantic-release/commit-analyzer"
[5:00:26 PM] [semantic-release] [#semantic-release/commit-analyzer] › ℹ Analyzing commit: test
[5:00:26 PM] [semantic-release] [#semantic-release/commit-analyzer] › ℹ The commit should not trigger a release
[5:00:26 PM] [semantic-release] [#semantic-release/commit-analyzer] › ℹ Analyzing commit: test
[5:00:26 PM] [semantic-release] [#semantic-release/commit-analyzer] › ℹ The commit should not trigger a release
[5:00:26 PM] [semantic-release] [#semantic-release/commit-analyzer] › ℹ Analysis of 2 commits complete: no release
[5:00:26 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "#semantic-release/commit-analyzer"
[5:00:26 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "#semantic-release/exec"
[5:00:26 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "#semantic-release/exec"
[5:00:26 PM] [semantic-release] › ℹ There are no relevant changes, so no new version is released.
UPDATE:
figured out how to do it via this issue - https://github.com/semantic-release/semantic-release/discussions/1819
Thanks!

https://github.com/semantic-release/semantic-release/discussions/1819
{"message": "*", "release": "patch"}

Related

My repository is using CI/CD, but I have this error. How can I fix it?

I have a project and have made changes to a remote branch. My repository has CI/CD implemented, but when GitHub Actions are performing the build, this error occurs:
yarn run v1.22.17
> postcss src/assets/css/tailwind.css -o src/assets/css/app.css
Creating an optimized production build...
Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.
Failed to compile.
chunk 1 [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-7-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-7-3!./node_modules/sass-loader/dist/cjs.js??ref--5-oneOf-7-4!./src/components/layout/modules/nav-item.module.scss
despite it was not able to fulfill desired ordering with these modules:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-7-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-7-3!./node_modules/sass-loader/dist/cjs.js??ref--5-oneOf-7-4!./src/components/UI/modules/card.module.scss
- couldn't fulfill desired order of chunk group(s) ,
chunk 1 [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-7-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-7-3!./node_modules/sass-loader/dist/cjs.js??ref--5-oneOf-7-4!./src/components/UI/modules/backdrop.module.scss
despite it was not able to fulfill desired ordering with these modules:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-7-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-7-3!./node_modules/sass-loader/dist/cjs.js??ref--5-oneOf-7-4!./src/components/UI/modules/card.module.scss
- couldn't fulfill desired order of chunk group(s) ,
chunk 1 [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-7-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-7-3!./node_modules/sass-loader/dist/cjs.js??ref--5-oneOf-7-4!./src/components/UI/modules/card.module.scss
despite it was not able to fulfill desired ordering with these modules:
* css ./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-7-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-7-3!./node_modules/sass-loader/dist/cjs.js??ref--5-oneOf-7-4!./src/components/layout/modules/affiliate-card.module.scss
- couldn't fulfill desired order of chunk group(s)
- while fulfilling desired order of chunk group(s) ,
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.
How can I fix it? I appreciate any kind of help :)
You can change your scripts in package.json to:
"scripts": {
"start": "react-scripts start",
"build": "CI=false && react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
If you notice clearly, I have changed the build script to include CI=false. This is because, the build process is treating your warnings as errors and the build fails. Setting CI=false would mean that your build won't fail if warnings are present.

Vague error in Vercel deployment (exit with code 1)

So normally Vercel gives me decent error messages, but this one seems to have no detail. Just
"failed with exit code 1".
For context, I just started this project w the basic NextJS template, made a few modifications, and this is my first deploy.
Failed once and I assumed it was because NextJS has strict type checking on by default, so I modified the next.config.js file as follows (per here):
module.exports = {
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
};
But still failed. Here is the full log:
10:23:27.575 Cloning github.com/lawderp/physical (Branch: main, Commit: 8f97554)
10:23:28.589 Cloning completed: 1.014s
10:23:28.614 Analyzing source code...
10:23:29.739 Installing build runtime...
10:23:31.612 Build runtime installed: 1.873s
10:23:34.043 Looking up build cache...
10:23:34.164 Build cache found. Downloading...
10:23:35.100 Build cache downloaded [21.48 MB]: 936.007ms
10:23:36.250 Installing dependencies...
10:23:36.489 yarn install v1.22.11
10:23:36.547 [1/4] Resolving packages...
10:23:36.734 success Already up-to-date.
10:23:36.743 Done in 0.26s.
10:23:36.754 Detected Next.js version: 11.1.2
10:23:36.755 Running "yarn run build"
10:23:37.021 yarn run v1.22.11
10:23:37.047 $ next build
10:23:37.820 info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
10:23:37.976 info - Skipping validation of types...
10:23:40.439 error Command failed with exit code 1.
10:23:40.439 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:23:40.456 Error: Command "yarn run build" exited with 1
Still not sure what the issue was but eventually figured out how to get past this - ignored ESLint during build by adding the following to next.config.js:
eslint: {
ignoreDuringBuilds: true,
},
(I don't advise doing this but this was quick low-stakes experiment)
I received the same vague message after making eslint alterations. Locally linting and deployment was successful, however deploying to vercel failed like yours.
Although "ignoreDuringBuilds": "true" in my .eslint.json did band-aid fix the issue, I was able to rollback each eslint change and found that my "linebreak-style": ["error", "windows"] was the underlying issue.
It passed linting locally, but failed on vercel deployment. I've fixed my line-breaks and all works great now without having to ignore during builds.

When updating Next.js v10.1.13 to webpack5, getting warnings Can't resolve 'fsevents' in chokidar

npm install next react react-dom And running Node.js v12
Created most simple pages/index.tsx
export default function PageHome(props) {
return <>Hello World!</>
}
(I also had TypeScript configured as per Next.js instructions but not sure if that's making a difference.)
C:\GitHub\reproduce-nextjs-webpack5-error>npm run dev
...
event - compiled successfully
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'fsevents' in 'C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar'
<w> while resolving 'fsevents' in C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar to a directory
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'fsevents' in 'C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar'
<w> while resolving 'fsevents' in C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar to a directory
Self-answered solution below for future readers.
Upgrade Node.js
Delete package-lock.json and node_modules
Run npm install again
It works
Apparently something doesn't install when you run with an older Node.js version.
My package.json looked like
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^10.1.3",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"#types/react": "^17.0.3",
"typescript": "^4.2.4"
}
}
The same package.json will install slightly differently switching from Node.js v12 to Node.js v15 as I just observed. This is why you have to complete not just step 1, but also steps 2 & 3.
Before:
C:\GitHub\reproduce-nextjs-webpack5-error>node --version
v12.4.0
C:\GitHub\reproduce-nextjs-webpack5-error>npm run dev
> # dev C:\GitHub\reproduce-nextjs-webpack5-error
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5
event - compiled successfully
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'fsevents' in 'C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar'
<w> while resolving 'fsevents' in C:\GitHub\reproduce-nextjs-webpack5-error\node_modules\next\node_modules\chokidar to a directory
After:
C:\GitHub\reproduce-nextjs-webpack5-error>node --version
v15.14.0
C:\GitHub\reproduce-nextjs-webpack5-error>npm run dev
> dev
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5
event - compiled successfully
event - build page: /
wait - compiling...
event - compiled successfully
Yay! No warnings!
While there are comments below about future changes in nextjs#canary, the above examples worked for me with versions listed.
Delete the .next folder and re-run npm run dev.
This happens when your system shuts down unexpectedly without saving.
I have resolved this problem by killing all node processes on my production server.

Impossible to install SQLite on React Native project

I'd like to start a new React Native project including SQLite Storagee.
I've already done this before so I know that it should work, but not today...
So I've init a new project in which I installed react-native-sqlite-storage following this step by step tutorial (https://www.npmjs.com/package/react-native-sqlite-storage), the android part.
Everything is fine untill I run my project whith react-native run-android.
Here is my package.json file
{
"name": "pokedex",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-sqlite-storage": "^4.0.0"
},
"devDependencies": {
"#babel/core": "^7.5.5",
"#babel/runtime": "^7.5.5",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.2.2",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
Here is the result in my terminal. I don't understand what's going on.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-sqlite-storage.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-sqlite-storage:
- None of the consumable configurations have attributes.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-sqlite-storage.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-sqlite-storage:
- None of the consumable configurations have attributes.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (/home/axel/leclercq.axel#gmail.com/Pokedex/Developpement - AXEL ONLY/V5/pokedex/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
at buildAndRun (/home/axel/leclercq.axel#gmail.com/Pokedex/Developpement - AXEL ONLY/V5/pokedex/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/home/axel/leclercq.axel#gmail.com/Pokedex/Developpement - AXEL ONLY/V5/pokedex/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
I've tried it with various version of both react-native and sqlite-storage but nothing works.
Need help please
Hey I found the solution!
Just go to your settings.gradle file and change
THIS LINE
project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/src/android')
TO THIS
project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/platforms/android')
Greetings!
Same problem :(
Could not determine the dependencies of task ':app:preDebugBuild'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve project :react-native-sqlite-storage.
Required by:
project :app
Unable to find a matching configuration of project :react-native-sqlite-storage: None of the consumable configurations have attributes.
React Native also requires Java SE Development Kit (JDK). I installed it and then just restarted the program and the error was resolved. Hopefully this works for you as well!!
Greetings.

AWS Lambda Error: Failed to load gRPC binary module because it was not installed for the current system

I have problem with AWS Lambda function deployment with Serverless Framework. I use #google-cloud-firestore npm package which requires grpc package.
Function execution throws error:
{
"errorMessage": "Failed to load gRPC binary module because it was not installed for the current system\nExpected directory: node-v48-linux-x64-glibc\nFound: [node-v59-darwin-x64-unknown]\nThis problem can often be fixed by running \"npm rebuild\" on the current system\nOriginal error: Cannot find module '/var/task/node_modules/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node'",
"errorType": "Error",
"stackTrace": [
"Found: [node-v48-linux-x64-unknown]",
"This problem can often be fixed by running \"npm rebuild\" on the current system",
"Original error: Cannot find module '/var/task/node_modules/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node'",
"Object.<anonymous> (/var/task/node_modules/grpc/src/grpc_extension.js:44:17)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)",
"Object.<anonymous> (/var/task/node_modules/grpc/src/client.js:38:12)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)"
]
}
So, as I understood, lambda requires grps built with target node-v48-linux-x64-glibc
Typing npm i -S grpc --target=6.4.0 --target_arch=x64 --target_platform=linux has only changed node-v59-darwin-x64-unknown to node-v48-linux-x64-unknown.
How can I change unknown to glibc?
Any help would be really appreciated!
Fix
Basically, you need to specify the target of the grcp library.
Copied from that link:
{
"main": "index.js",
"scripts": {
"postinstall": "npm rebuild grpc --target=6.1.0 --target_arch=x64 --target_platform=linux --target_libc=glibc"
}
}
I got something similar to work by including a --target_libc=glibc, found in the documentation for node-pre-gyp.

Resources