@addev-be/framework-utils 0.18.0 → 0.19.0
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.
- package/bin/commit-release.mjs +5 -5
- package/bin/nuget-publish.mjs +5 -5
- package/bin/update-version.mjs +7 -7
- package/eslint/node.config.mjs +17 -0
- package/eslint/react.config.mjs +30 -0
- package/node/commit-release.mjs +20 -20
- package/node/helpers/versions.mjs +140 -140
- package/node/nuget-publish.mjs +33 -33
- package/node/update-version.mjs +55 -55
- package/package.json +11 -2
package/bin/commit-release.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { commitRelease } from '../node/commit-release.mjs';
|
|
4
|
-
|
|
5
|
-
commitRelease();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { commitRelease } from '../node/commit-release.mjs';
|
|
4
|
+
|
|
5
|
+
commitRelease();
|
package/bin/nuget-publish.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { publishNugetPackageToRemoteServer } from '../node/nuget-publish.mjs';
|
|
4
|
-
|
|
5
|
-
await publishNugetPackageToRemoteServer();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { publishNugetPackageToRemoteServer } from '../node/nuget-publish.mjs';
|
|
4
|
+
|
|
5
|
+
await publishNugetPackageToRemoteServer();
|
package/bin/update-version.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { getUpdateTypeFromArgv } from '../node/helpers/versions.mjs';
|
|
4
|
-
import { updatePackagesVersion } from '../node/update-version.mjs';
|
|
5
|
-
|
|
6
|
-
const updateType = getUpdateTypeFromArgv();
|
|
7
|
-
updatePackagesVersion(updateType);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { getUpdateTypeFromArgv } from '../node/helpers/versions.mjs';
|
|
4
|
+
import { updatePackagesVersion } from '../node/update-version.mjs';
|
|
5
|
+
|
|
6
|
+
const updateType = getUpdateTypeFromArgv();
|
|
7
|
+
updatePackagesVersion(updateType);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import js from '@eslint/js';
|
|
4
|
+
import tseslint from 'typescript-eslint';
|
|
5
|
+
|
|
6
|
+
export const eslintNodeConfig = defineConfig([
|
|
7
|
+
{
|
|
8
|
+
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
|
|
9
|
+
plugins: { js },
|
|
10
|
+
extends: ['js/recommended'],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
|
|
14
|
+
languageOptions: { globals: globals.browser },
|
|
15
|
+
},
|
|
16
|
+
tseslint.configs.recommended,
|
|
17
|
+
]);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as reactHooks from 'eslint-plugin-react-hooks';
|
|
2
|
+
import * as reactRefresh from 'eslint-plugin-react-refresh';
|
|
3
|
+
|
|
4
|
+
import { defineConfig } from 'eslint/config';
|
|
5
|
+
import globals from 'globals';
|
|
6
|
+
import js from '@eslint/js';
|
|
7
|
+
import pluginReact from 'eslint-plugin-react';
|
|
8
|
+
import tseslint from 'typescript-eslint';
|
|
9
|
+
|
|
10
|
+
export const eslintReactConfig = defineConfig([
|
|
11
|
+
{
|
|
12
|
+
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
13
|
+
plugins: { js },
|
|
14
|
+
extends: ['js/recommended'],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
18
|
+
languageOptions: { globals: globals.browser },
|
|
19
|
+
},
|
|
20
|
+
tseslint.configs.recommended,
|
|
21
|
+
pluginReact.configs.flat.recommended,
|
|
22
|
+
reactHooks.configs['recommended-latest'],
|
|
23
|
+
reactRefresh.configs.vite,
|
|
24
|
+
{
|
|
25
|
+
rules: {
|
|
26
|
+
'react/react-in-jsx-scope': 'off',
|
|
27
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
]);
|
package/node/commit-release.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
import { getCurrentVersion } from './helpers/versions.mjs';
|
|
3
|
-
|
|
4
|
-
export const commitRelease = () => {
|
|
5
|
-
const newVersion = getCurrentVersion();
|
|
6
|
-
|
|
7
|
-
execSync('git add .', { stdio: 'inherit' });
|
|
8
|
-
execSync(`git commit -m "chore: release ${newVersion}"`, {
|
|
9
|
-
stdio: 'inherit',
|
|
10
|
-
});
|
|
11
|
-
execSync(`git tag -a ${newVersion} -m "${newVersion}"`, {
|
|
12
|
-
stdio: 'inherit',
|
|
13
|
-
});
|
|
14
|
-
execSync(`git push origin`, {
|
|
15
|
-
stdio: 'inherit',
|
|
16
|
-
});
|
|
17
|
-
execSync(`git push origin --tags`, {
|
|
18
|
-
stdio: 'inherit',
|
|
19
|
-
});
|
|
20
|
-
};
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { getCurrentVersion } from './helpers/versions.mjs';
|
|
3
|
+
|
|
4
|
+
export const commitRelease = () => {
|
|
5
|
+
const newVersion = getCurrentVersion();
|
|
6
|
+
|
|
7
|
+
execSync('git add .', { stdio: 'inherit' });
|
|
8
|
+
execSync(`git commit -m "chore: release ${newVersion}"`, {
|
|
9
|
+
stdio: 'inherit',
|
|
10
|
+
});
|
|
11
|
+
execSync(`git tag -a ${newVersion} -m "${newVersion}"`, {
|
|
12
|
+
stdio: 'inherit',
|
|
13
|
+
});
|
|
14
|
+
execSync(`git push origin`, {
|
|
15
|
+
stdio: 'inherit',
|
|
16
|
+
});
|
|
17
|
+
execSync(`git push origin --tags`, {
|
|
18
|
+
stdio: 'inherit',
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
import * as glob from 'glob';
|
|
2
|
-
|
|
3
|
-
import { readFileSync, writeFileSync } from 'fs';
|
|
4
|
-
|
|
5
|
-
import { cwd } from 'process';
|
|
6
|
-
import { join } from 'path';
|
|
7
|
-
|
|
8
|
-
const __dirname = cwd();
|
|
9
|
-
|
|
10
|
-
export const replaceVersionInCSharpProject = (path, newVersion) => {
|
|
11
|
-
console.log('Replacing version in C# project file', path);
|
|
12
|
-
const fileContents = readFileSync(path, 'utf-8');
|
|
13
|
-
const newFileContents = fileContents
|
|
14
|
-
.replace(/<Version>.*<\/Version>/g, `<Version>${newVersion}</Version>`)
|
|
15
|
-
.replace(
|
|
16
|
-
/<AssemblyVersion>.*<\/AssemblyVersion>/g,
|
|
17
|
-
`<AssemblyVersion>${newVersion}</AssemblyVersion>`
|
|
18
|
-
)
|
|
19
|
-
.replace(
|
|
20
|
-
/<FileVersion>.*<\/FileVersion>/g,
|
|
21
|
-
`<FileVersion>${newVersion}</FileVersion>`
|
|
22
|
-
);
|
|
23
|
-
writeFileSync(path, newFileContents);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const replaceVersionInCSharpProjects = (globPath, newVersion) => {
|
|
27
|
-
const files = glob.sync(globPath.replace(/\\/g, '/'));
|
|
28
|
-
files.forEach((file) => replaceVersionInCSharpProject(file, newVersion));
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const replaceVersionInAssemblyInfoFile = (path, newVersion) => {
|
|
32
|
-
console.log('Replacing version in C# AssemblyInfo file', path);
|
|
33
|
-
const fileContents = readFileSync(path, 'utf-8');
|
|
34
|
-
const newFileContents = fileContents.replace(
|
|
35
|
-
/Version\("\d+\.\d+\.\d+"\)\]/g,
|
|
36
|
-
`Version("${newVersion}")]`
|
|
37
|
-
);
|
|
38
|
-
writeFileSync(path, newFileContents);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const replaceVersionInAssemblyInfoFiles = (globPath, newVersion) => {
|
|
42
|
-
const files = glob.sync(globPath.replace(/\\/g, '/'));
|
|
43
|
-
files.forEach((file) => replaceVersionInAssemblyInfoFile(file, newVersion));
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const replaceVersionInMsiFile = (path, newVersion) => {
|
|
47
|
-
console.log('Replacing version in MSI file', path);
|
|
48
|
-
const fileContents = readFileSync(path, 'utf-8');
|
|
49
|
-
const newFileContents = fileContents
|
|
50
|
-
.replace(
|
|
51
|
-
/<ROW Property="ProductVersion" Value="\d+\.\d+\.\d+"/g,
|
|
52
|
-
`<ROW Property="ProductVersion" Value="${newVersion}"`
|
|
53
|
-
)
|
|
54
|
-
.replace(
|
|
55
|
-
/<ROW Property="ProductCode" Value="1033:\{[0-9A-F-]{36}\}/g,
|
|
56
|
-
`<ROW Property="ProductCode" Value="1033:{${v4().toUpperCase()}}`
|
|
57
|
-
);
|
|
58
|
-
writeFileSync(path, newFileContents);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const replaceVersionInMsiFiles = (globPath, newVersion) => {
|
|
62
|
-
const files = glob.sync(globPath.replace(/\\/g, '/'));
|
|
63
|
-
files.forEach((file) => replaceVersionInMsiFile(file, newVersion));
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const replaceVersionInPackageJsonFile = (path, newVersion) => {
|
|
67
|
-
console.log('Replacing version in package.json', path);
|
|
68
|
-
const fileContents = readFileSync(path, 'utf-8');
|
|
69
|
-
const newFileContents = fileContents.replace(
|
|
70
|
-
/"version": "\d+\.\d+\.\d+"/g,
|
|
71
|
-
`"version": "${newVersion}"`
|
|
72
|
-
);
|
|
73
|
-
writeFileSync(path, newFileContents);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const replaceVersionInPackageJsonFiles = (globPath, newVersion) => {
|
|
77
|
-
const files = glob.sync(globPath.replace(/\\/g, '/'), {
|
|
78
|
-
ignore: ['./node_modules/**', '**/node_modules/**'],
|
|
79
|
-
});
|
|
80
|
-
files.forEach((file) => replaceVersionInPackageJsonFile(file, newVersion));
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const replaceVersionInEnvFile = (path, newVersion) => {
|
|
84
|
-
console.log('Replacing version in env file', path);
|
|
85
|
-
const fileContents = readFileSync(path, 'utf-8');
|
|
86
|
-
const newFileContents = fileContents.replace(
|
|
87
|
-
/APP_VERSION=\d+\.\d+\.\d+/g,
|
|
88
|
-
`APP_VERSION=${newVersion}`
|
|
89
|
-
);
|
|
90
|
-
writeFileSync(path, newFileContents);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const replaceVersionInEnvFiles = (globPath, newVersion) => {
|
|
94
|
-
const files = glob.sync(globPath.replace(/\\/g, '/'));
|
|
95
|
-
files.forEach((file) => replaceVersionInEnvFile(file, newVersion));
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export const replaceVersionInGitLabCi = (path, newVersion) => {
|
|
99
|
-
console.log('Replacing version in GitLab CI file', path);
|
|
100
|
-
const fileContents = readFileSync(path, 'utf-8');
|
|
101
|
-
const newFileContents = fileContents.replace(
|
|
102
|
-
/APP_VERSION: \d+\.\d+\.\d+/g,
|
|
103
|
-
`APP_VERSION: ${newVersion}`
|
|
104
|
-
);
|
|
105
|
-
writeFileSync(path, newFileContents);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export const replaceVersionInDockerCompose = (path, newVersion) => {
|
|
109
|
-
console.log('Replacing version in Docker Compose file', path);
|
|
110
|
-
const fileContents = readFileSync(path, 'utf-8');
|
|
111
|
-
const newFileContents = fileContents.replace(
|
|
112
|
-
/image: ([^\:]+):\d+\.\d+\.\d+/g,
|
|
113
|
-
`image: $1:${newVersion}`
|
|
114
|
-
);
|
|
115
|
-
writeFileSync(path, newFileContents);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export const getCurrentVersion = () => {
|
|
119
|
-
const packageJson = JSON.parse(
|
|
120
|
-
readFileSync(join(__dirname, 'package.json'), 'utf-8')
|
|
121
|
-
);
|
|
122
|
-
return packageJson.version;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export const getUpdateTypeFromArgv = () => {
|
|
126
|
-
const [, , updateType] = process.argv;
|
|
127
|
-
if (!updateType) {
|
|
128
|
-
console.error('No version update type provided');
|
|
129
|
-
process.exit(1);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (!['major', 'minor', 'patch'].includes(updateType)) {
|
|
133
|
-
console.error(
|
|
134
|
-
'Invalid version update type : expected "major", "minor" or "patch"'
|
|
135
|
-
);
|
|
136
|
-
process.exit(1);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return updateType;
|
|
140
|
-
};
|
|
1
|
+
import * as glob from 'glob';
|
|
2
|
+
|
|
3
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
4
|
+
|
|
5
|
+
import { cwd } from 'process';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
|
|
8
|
+
const __dirname = cwd();
|
|
9
|
+
|
|
10
|
+
export const replaceVersionInCSharpProject = (path, newVersion) => {
|
|
11
|
+
console.log('Replacing version in C# project file', path);
|
|
12
|
+
const fileContents = readFileSync(path, 'utf-8');
|
|
13
|
+
const newFileContents = fileContents
|
|
14
|
+
.replace(/<Version>.*<\/Version>/g, `<Version>${newVersion}</Version>`)
|
|
15
|
+
.replace(
|
|
16
|
+
/<AssemblyVersion>.*<\/AssemblyVersion>/g,
|
|
17
|
+
`<AssemblyVersion>${newVersion}</AssemblyVersion>`
|
|
18
|
+
)
|
|
19
|
+
.replace(
|
|
20
|
+
/<FileVersion>.*<\/FileVersion>/g,
|
|
21
|
+
`<FileVersion>${newVersion}</FileVersion>`
|
|
22
|
+
);
|
|
23
|
+
writeFileSync(path, newFileContents);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const replaceVersionInCSharpProjects = (globPath, newVersion) => {
|
|
27
|
+
const files = glob.sync(globPath.replace(/\\/g, '/'));
|
|
28
|
+
files.forEach((file) => replaceVersionInCSharpProject(file, newVersion));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const replaceVersionInAssemblyInfoFile = (path, newVersion) => {
|
|
32
|
+
console.log('Replacing version in C# AssemblyInfo file', path);
|
|
33
|
+
const fileContents = readFileSync(path, 'utf-8');
|
|
34
|
+
const newFileContents = fileContents.replace(
|
|
35
|
+
/Version\("\d+\.\d+\.\d+"\)\]/g,
|
|
36
|
+
`Version("${newVersion}")]`
|
|
37
|
+
);
|
|
38
|
+
writeFileSync(path, newFileContents);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const replaceVersionInAssemblyInfoFiles = (globPath, newVersion) => {
|
|
42
|
+
const files = glob.sync(globPath.replace(/\\/g, '/'));
|
|
43
|
+
files.forEach((file) => replaceVersionInAssemblyInfoFile(file, newVersion));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const replaceVersionInMsiFile = (path, newVersion) => {
|
|
47
|
+
console.log('Replacing version in MSI file', path);
|
|
48
|
+
const fileContents = readFileSync(path, 'utf-8');
|
|
49
|
+
const newFileContents = fileContents
|
|
50
|
+
.replace(
|
|
51
|
+
/<ROW Property="ProductVersion" Value="\d+\.\d+\.\d+"/g,
|
|
52
|
+
`<ROW Property="ProductVersion" Value="${newVersion}"`
|
|
53
|
+
)
|
|
54
|
+
.replace(
|
|
55
|
+
/<ROW Property="ProductCode" Value="1033:\{[0-9A-F-]{36}\}/g,
|
|
56
|
+
`<ROW Property="ProductCode" Value="1033:{${v4().toUpperCase()}}`
|
|
57
|
+
);
|
|
58
|
+
writeFileSync(path, newFileContents);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const replaceVersionInMsiFiles = (globPath, newVersion) => {
|
|
62
|
+
const files = glob.sync(globPath.replace(/\\/g, '/'));
|
|
63
|
+
files.forEach((file) => replaceVersionInMsiFile(file, newVersion));
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const replaceVersionInPackageJsonFile = (path, newVersion) => {
|
|
67
|
+
console.log('Replacing version in package.json', path);
|
|
68
|
+
const fileContents = readFileSync(path, 'utf-8');
|
|
69
|
+
const newFileContents = fileContents.replace(
|
|
70
|
+
/"version": "\d+\.\d+\.\d+"/g,
|
|
71
|
+
`"version": "${newVersion}"`
|
|
72
|
+
);
|
|
73
|
+
writeFileSync(path, newFileContents);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const replaceVersionInPackageJsonFiles = (globPath, newVersion) => {
|
|
77
|
+
const files = glob.sync(globPath.replace(/\\/g, '/'), {
|
|
78
|
+
ignore: ['./node_modules/**', '**/node_modules/**'],
|
|
79
|
+
});
|
|
80
|
+
files.forEach((file) => replaceVersionInPackageJsonFile(file, newVersion));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const replaceVersionInEnvFile = (path, newVersion) => {
|
|
84
|
+
console.log('Replacing version in env file', path);
|
|
85
|
+
const fileContents = readFileSync(path, 'utf-8');
|
|
86
|
+
const newFileContents = fileContents.replace(
|
|
87
|
+
/APP_VERSION=\d+\.\d+\.\d+/g,
|
|
88
|
+
`APP_VERSION=${newVersion}`
|
|
89
|
+
);
|
|
90
|
+
writeFileSync(path, newFileContents);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const replaceVersionInEnvFiles = (globPath, newVersion) => {
|
|
94
|
+
const files = glob.sync(globPath.replace(/\\/g, '/'));
|
|
95
|
+
files.forEach((file) => replaceVersionInEnvFile(file, newVersion));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const replaceVersionInGitLabCi = (path, newVersion) => {
|
|
99
|
+
console.log('Replacing version in GitLab CI file', path);
|
|
100
|
+
const fileContents = readFileSync(path, 'utf-8');
|
|
101
|
+
const newFileContents = fileContents.replace(
|
|
102
|
+
/APP_VERSION: \d+\.\d+\.\d+/g,
|
|
103
|
+
`APP_VERSION: ${newVersion}`
|
|
104
|
+
);
|
|
105
|
+
writeFileSync(path, newFileContents);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const replaceVersionInDockerCompose = (path, newVersion) => {
|
|
109
|
+
console.log('Replacing version in Docker Compose file', path);
|
|
110
|
+
const fileContents = readFileSync(path, 'utf-8');
|
|
111
|
+
const newFileContents = fileContents.replace(
|
|
112
|
+
/image: ([^\:]+):\d+\.\d+\.\d+/g,
|
|
113
|
+
`image: $1:${newVersion}`
|
|
114
|
+
);
|
|
115
|
+
writeFileSync(path, newFileContents);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const getCurrentVersion = () => {
|
|
119
|
+
const packageJson = JSON.parse(
|
|
120
|
+
readFileSync(join(__dirname, 'package.json'), 'utf-8')
|
|
121
|
+
);
|
|
122
|
+
return packageJson.version;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const getUpdateTypeFromArgv = () => {
|
|
126
|
+
const [, , updateType] = process.argv;
|
|
127
|
+
if (!updateType) {
|
|
128
|
+
console.error('No version update type provided');
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (!['major', 'minor', 'patch'].includes(updateType)) {
|
|
133
|
+
console.error(
|
|
134
|
+
'Invalid version update type : expected "major", "minor" or "patch"'
|
|
135
|
+
);
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return updateType;
|
|
140
|
+
};
|
package/node/nuget-publish.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { exec } from 'child_process';
|
|
4
|
-
import { existsSync } from 'fs';
|
|
5
|
-
import { getCurrentVersion } from './helpers/versions.mjs';
|
|
6
|
-
|
|
7
|
-
export const publishNugetPackageToRemoteServer = async () => {
|
|
8
|
-
const nugetFeedUrl = 'https://nuget.ad-dev.be/v3/index.json';
|
|
9
|
-
const nugetApiKey = '4d1745649b06';
|
|
10
|
-
const currentVersion = getCurrentVersion();
|
|
11
|
-
const nugetPackagePath = `./packages/backend/bin/Release/ADDEV.Framework.Backend.${currentVersion}.nupkg`;
|
|
12
|
-
|
|
13
|
-
// Check if the nuget feed directory exists
|
|
14
|
-
if (!existsSync(nugetPackagePath)) {
|
|
15
|
-
console.log('NuGet package', nugetPackagePath, 'not found');
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.log(`Publishing ${nugetPackagePath} file to nuget server...`);
|
|
20
|
-
exec(
|
|
21
|
-
`dotnet nuget push -s "${nugetFeedUrl}" -k ${nugetApiKey} ${nugetPackagePath} --skip-duplicate`,
|
|
22
|
-
(err, stdout, stderr) => {
|
|
23
|
-
if (err) {
|
|
24
|
-
console.error(`Error publishing ${nugetPackagePath}:`, err);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
console.log(stdout);
|
|
28
|
-
console.error(stderr);
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
console.log('Publishing complete.');
|
|
33
|
-
};
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { exec } from 'child_process';
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
|
+
import { getCurrentVersion } from './helpers/versions.mjs';
|
|
6
|
+
|
|
7
|
+
export const publishNugetPackageToRemoteServer = async () => {
|
|
8
|
+
const nugetFeedUrl = 'https://nuget.ad-dev.be/v3/index.json';
|
|
9
|
+
const nugetApiKey = '4d1745649b06';
|
|
10
|
+
const currentVersion = getCurrentVersion();
|
|
11
|
+
const nugetPackagePath = `./packages/backend/bin/Release/ADDEV.Framework.Backend.${currentVersion}.nupkg`;
|
|
12
|
+
|
|
13
|
+
// Check if the nuget feed directory exists
|
|
14
|
+
if (!existsSync(nugetPackagePath)) {
|
|
15
|
+
console.log('NuGet package', nugetPackagePath, 'not found');
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
console.log(`Publishing ${nugetPackagePath} file to nuget server...`);
|
|
20
|
+
exec(
|
|
21
|
+
`dotnet nuget push -s "${nugetFeedUrl}" -k ${nugetApiKey} ${nugetPackagePath} --skip-duplicate`,
|
|
22
|
+
(err, stdout, stderr) => {
|
|
23
|
+
if (err) {
|
|
24
|
+
console.error(`Error publishing ${nugetPackagePath}:`, err);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.log(stdout);
|
|
28
|
+
console.error(stderr);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
console.log('Publishing complete.');
|
|
33
|
+
};
|
package/node/update-version.mjs
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getCurrentVersion,
|
|
3
|
-
replaceVersionInCSharpProjects,
|
|
4
|
-
replaceVersionInPackageJsonFile,
|
|
5
|
-
replaceVersionInPackageJsonFiles,
|
|
6
|
-
} from './helpers/versions.mjs';
|
|
7
|
-
|
|
8
|
-
import { cwd } from 'process';
|
|
9
|
-
import { inc } from 'semver';
|
|
10
|
-
import { join } from 'path';
|
|
11
|
-
|
|
12
|
-
export const defaultUpdateFunc = (newVersion) => {
|
|
13
|
-
replaceVersionInPackageJsonFile(join(cwd(), 'package.json'), newVersion);
|
|
14
|
-
replaceVersionInPackageJsonFiles(
|
|
15
|
-
join(cwd(), 'packages/**/package.json'),
|
|
16
|
-
newVersion
|
|
17
|
-
);
|
|
18
|
-
replaceVersionInCSharpProjects(
|
|
19
|
-
join(cwd(), 'packages/**/*.csproj'),
|
|
20
|
-
newVersion
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const updatePackagesVersion = (
|
|
25
|
-
updateType,
|
|
26
|
-
updateFunc = defaultUpdateFunc
|
|
27
|
-
) => {
|
|
28
|
-
console.log('~~~ Update packages version ~~~');
|
|
29
|
-
|
|
30
|
-
const currentVersion = getCurrentVersion();
|
|
31
|
-
if (!currentVersion) {
|
|
32
|
-
throw new Error('Could not get current version from package.json');
|
|
33
|
-
}
|
|
34
|
-
console.log(`Current version: ${currentVersion}`);
|
|
35
|
-
|
|
36
|
-
switch (updateType) {
|
|
37
|
-
case 'major':
|
|
38
|
-
case 'minor':
|
|
39
|
-
case 'patch': {
|
|
40
|
-
const incrementedVersion = inc(currentVersion, updateType);
|
|
41
|
-
updateFunc(incrementedVersion);
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
default:
|
|
45
|
-
console.log('Invalid version update type');
|
|
46
|
-
throw new Error(
|
|
47
|
-
'Invalid version update type, should be "major", "minor" or "patch"'
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const newVersion = getCurrentVersion();
|
|
52
|
-
console.log(`Updated version to: ${newVersion}`);
|
|
53
|
-
|
|
54
|
-
return newVersion;
|
|
55
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
getCurrentVersion,
|
|
3
|
+
replaceVersionInCSharpProjects,
|
|
4
|
+
replaceVersionInPackageJsonFile,
|
|
5
|
+
replaceVersionInPackageJsonFiles,
|
|
6
|
+
} from './helpers/versions.mjs';
|
|
7
|
+
|
|
8
|
+
import { cwd } from 'process';
|
|
9
|
+
import { inc } from 'semver';
|
|
10
|
+
import { join } from 'path';
|
|
11
|
+
|
|
12
|
+
export const defaultUpdateFunc = (newVersion) => {
|
|
13
|
+
replaceVersionInPackageJsonFile(join(cwd(), 'package.json'), newVersion);
|
|
14
|
+
replaceVersionInPackageJsonFiles(
|
|
15
|
+
join(cwd(), 'packages/**/package.json'),
|
|
16
|
+
newVersion
|
|
17
|
+
);
|
|
18
|
+
replaceVersionInCSharpProjects(
|
|
19
|
+
join(cwd(), 'packages/**/*.csproj'),
|
|
20
|
+
newVersion
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const updatePackagesVersion = (
|
|
25
|
+
updateType,
|
|
26
|
+
updateFunc = defaultUpdateFunc
|
|
27
|
+
) => {
|
|
28
|
+
console.log('~~~ Update packages version ~~~');
|
|
29
|
+
|
|
30
|
+
const currentVersion = getCurrentVersion();
|
|
31
|
+
if (!currentVersion) {
|
|
32
|
+
throw new Error('Could not get current version from package.json');
|
|
33
|
+
}
|
|
34
|
+
console.log(`Current version: ${currentVersion}`);
|
|
35
|
+
|
|
36
|
+
switch (updateType) {
|
|
37
|
+
case 'major':
|
|
38
|
+
case 'minor':
|
|
39
|
+
case 'patch': {
|
|
40
|
+
const incrementedVersion = inc(currentVersion, updateType);
|
|
41
|
+
updateFunc(incrementedVersion);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
default:
|
|
45
|
+
console.log('Invalid version update type');
|
|
46
|
+
throw new Error(
|
|
47
|
+
'Invalid version update type, should be "major", "minor" or "patch"'
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const newVersion = getCurrentVersion();
|
|
52
|
+
console.log(`Updated version to: ${newVersion}`);
|
|
53
|
+
|
|
54
|
+
return newVersion;
|
|
55
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@addev-be/framework-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"export": {
|
|
6
6
|
"node": {
|
|
@@ -17,7 +17,16 @@
|
|
|
17
17
|
"publish": "yarn npm publish"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@eslint/js": "^9.31.0",
|
|
21
|
+
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
22
|
+
"@typescript-eslint/parser": "^8.36.0",
|
|
23
|
+
"eslint": "^9.31.0",
|
|
24
|
+
"eslint-plugin-react": "^7.37.5",
|
|
25
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
26
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
20
27
|
"glob": "^11.0.0",
|
|
21
|
-
"
|
|
28
|
+
"globals": "^16.3.0",
|
|
29
|
+
"semver": "^7.6.3",
|
|
30
|
+
"typescript-eslint": "^8.36.0"
|
|
22
31
|
}
|
|
23
32
|
}
|