@addev-be/framework-utils 0.21.1 → 0.21.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { runPreReleaseChecks } from '../node/pre-release-checks.mjs';
4
+
5
+ runPreReleaseChecks();
@@ -1,7 +1,14 @@
1
1
  import { execSync } from 'child_process';
2
2
  import { getCurrentVersion } from './helpers/versions.mjs';
3
+ import { runPreReleaseChecks } from './pre-release-checks.mjs';
3
4
 
4
5
  export const commitRelease = () => {
6
+ // Run pre-release checks first (UI build is mandatory)
7
+ runPreReleaseChecks({
8
+ skipBackend: true, // Backend check is optional for releases
9
+ skipLint: false, // Keep linting check
10
+ });
11
+
5
12
  const newVersion = getCurrentVersion();
6
13
 
7
14
  execSync('git add .', { stdio: 'inherit' });
@@ -7,16 +7,17 @@ import { spawn } from 'child_process';
7
7
  * @param {string} tag - Image tag (e.g., 'my-image:latest').
8
8
  * @returns {Promise<void>} Resolves when the build is complete.
9
9
  */
10
- export async function buildDockerImage(directory, tag, registryUrl) {
10
+ export async function buildDockerImage(imageFile, tag, registryUrl) {
11
11
  return new Promise((resolve, reject) => {
12
12
  const args = [
13
13
  'build',
14
- '.',
15
14
  '-t',
16
15
  `${registryUrl ? registryUrl + '/' : ''}${tag}`,
16
+ '-f',
17
+ imageFile,
18
+ '.',
17
19
  ];
18
20
  const buildProcess = spawn('docker', args, {
19
- cwd: path.resolve(directory),
20
21
  stdio: 'inherit',
21
22
  });
22
23
 
@@ -0,0 +1,90 @@
1
+ import { execSync } from 'child_process';
2
+
3
+ const runUIBuildCheck = () => {
4
+ console.log('šŸ“¦ Building UI package...');
5
+ try {
6
+ execSync('yarn workspace @addev-be/ui build', {
7
+ stdio: 'inherit',
8
+ cwd: process.cwd(),
9
+ });
10
+ console.log('āœ… UI build successful!');
11
+ return true;
12
+ } catch (error) {
13
+ console.error('āŒ UI build failed!');
14
+ return false;
15
+ }
16
+ };
17
+
18
+ const runBackendBuildCheck = () => {
19
+ console.log('šŸ”§ Building backend package...');
20
+ try {
21
+ execSync('dotnet build -c Release packages/backend/Backend.csproj', {
22
+ stdio: 'inherit',
23
+ cwd: process.cwd(),
24
+ });
25
+ console.log('āœ… Backend build successful!');
26
+ return true;
27
+ } catch (error) {
28
+ console.error('āŒ Backend build failed!');
29
+ return false;
30
+ }
31
+ };
32
+
33
+ const runLintCheck = () => {
34
+ console.log('šŸ” Running UI linting...');
35
+ try {
36
+ execSync('yarn workspace @addev-be/ui lint', {
37
+ stdio: 'inherit',
38
+ cwd: process.cwd(),
39
+ });
40
+ console.log('āœ… UI linting passed!');
41
+ return true;
42
+ } catch (error) {
43
+ console.error('āŒ UI linting failed!');
44
+ return false;
45
+ }
46
+ };
47
+
48
+ export const runPreReleaseChecks = (options = {}) => {
49
+ const { skipUI = false, skipBackend = false, skipLint = false } = options;
50
+
51
+ console.log('šŸ” Running pre-release checks...');
52
+
53
+ const checks = [];
54
+
55
+ if (!skipLint) {
56
+ checks.push({ name: 'UI Linting', fn: runLintCheck });
57
+ }
58
+
59
+ if (!skipUI) {
60
+ checks.push({ name: 'UI Build', fn: runUIBuildCheck });
61
+ }
62
+
63
+ if (!skipBackend) {
64
+ checks.push({ name: 'Backend Build', fn: runBackendBuildCheck });
65
+ }
66
+
67
+ let allPassed = true;
68
+
69
+ for (const check of checks) {
70
+ console.log(`\n--- ${check.name} ---`);
71
+ if (!check.fn()) {
72
+ allPassed = false;
73
+ break;
74
+ }
75
+ }
76
+
77
+ if (!allPassed) {
78
+ console.error('\nāŒ Pre-release checks failed! Release aborted.');
79
+ console.error('Please fix the issues above before creating a release.');
80
+ process.exit(1);
81
+ }
82
+
83
+ console.log('\nāœ… All pre-release checks passed!');
84
+ return true;
85
+ };
86
+
87
+ // Allow running this script directly
88
+ if (import.meta.url === `file://${process.argv[1]}`) {
89
+ runPreReleaseChecks();
90
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addev-be/framework-utils",
3
- "version": "0.21.1",
3
+ "version": "0.21.4",
4
4
  "type": "module",
5
5
  "export": {
6
6
  "node": {