@addev-be/framework-utils 0.10.10 → 0.10.12
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/node/commit-release.mjs +20 -20
- package/node/nuget-publish.mjs +33 -33
- package/node/update-version.mjs +55 -55
- package/package.json +1 -1
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);
|
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
|
+
};
|
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
|
+
};
|