@docupace/pipeline 1.0.0-alpha.34 → 1.0.0-alpha.36
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/package.json +1 -1
- package/src/changeset/cli.js +2 -2
- package/src/changeset/validate.js +4 -6
- package/next/changeset.sh +0 -77
- package/next/validateChangeset.cjs +0 -44
package/package.json
CHANGED
package/src/changeset/cli.js
CHANGED
|
@@ -52,9 +52,9 @@ async function commitTagCommand() {
|
|
|
52
52
|
console.log('📌 Committing and tagging the new version...');
|
|
53
53
|
await setGitInfo();
|
|
54
54
|
await $`git add .`;
|
|
55
|
-
await $`git commit -m "chore: version bump and changelog"`;
|
|
56
|
-
await $`git push origin`;
|
|
57
55
|
const newVersion = (await $`node -p "require('./package.json').version"`).stdout.trim();
|
|
56
|
+
await $`git commit -m "Version bump to ${newVersion} and changelog"`;
|
|
57
|
+
await $`git push origin`;
|
|
58
58
|
await $`git tag v${newVersion}`;
|
|
59
59
|
await $`git push origin --tags`;
|
|
60
60
|
console.log(`✅ Version ${newVersion} tagged and pushed.`);
|
|
@@ -12,8 +12,7 @@ export async function validateChangesets(directoryPath) {
|
|
|
12
12
|
let preJson;
|
|
13
13
|
|
|
14
14
|
if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
|
|
15
|
-
|
|
16
|
-
process.exit(1);
|
|
15
|
+
throw new Error("Error: No pre.json and no md files found.")
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
if (fs.existsSync(preJsonPath)) {
|
|
@@ -29,16 +28,15 @@ export async function validateChangesets(directoryPath) {
|
|
|
29
28
|
const unmatchedFiles = mdFileNamesWithoutExt.filter(fileName => !changesetNames.includes(fileName));
|
|
30
29
|
|
|
31
30
|
if (unmatchedFiles.length == 0) {
|
|
32
|
-
|
|
33
|
-
process.exit(1);
|
|
31
|
+
throw new Error("Error: No new MD files found:");
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
console.log("Validation successful.");
|
|
39
37
|
} catch (error) {
|
|
40
|
-
console.
|
|
41
|
-
|
|
38
|
+
console.log(error.message);
|
|
39
|
+
throw(error);
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
|
package/next/changeset.sh
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
set -e
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
6
|
-
|
|
7
|
-
# Function: Validate changeset presence
|
|
8
|
-
validate_changesets() {
|
|
9
|
-
if [ ! -z "$PR_ID" ]; then
|
|
10
|
-
echo "🔍 Validating changesets..."
|
|
11
|
-
echo "Current Dir $DIR"
|
|
12
|
-
echo "1=$1"
|
|
13
|
-
pnpm node $DIR/validateChangeset.cjs $1 || {
|
|
14
|
-
if [ $? -eq 1 ]; then
|
|
15
|
-
echo "❌ No changeset found. Please add a changeset to this PR. Please see more information at https://docupacellc.atlassian.net/wiki/spaces/PM/pages/1350893571/Creating+changesets+for+Docupace+Next"
|
|
16
|
-
exit 1
|
|
17
|
-
else
|
|
18
|
-
echo "✅ Changeset validation passed."
|
|
19
|
-
fi
|
|
20
|
-
}
|
|
21
|
-
fi
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
setGitInfo() {
|
|
25
|
-
git config --global user.email "gitops@docupace.com"
|
|
26
|
-
git config --global user.name "Gitops"
|
|
27
|
-
git remote set-url origin https://x-token-auth:${BITBUCKET_TOKEN}@bitbucket.org/dp-cloud/docupace-graphql-server.git
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
# Function: Handle versioning and changelog generation
|
|
31
|
-
version_application() {
|
|
32
|
-
setGitInfo
|
|
33
|
-
echo "📦 Running Changeset versioning..."
|
|
34
|
-
pnpm changeset version
|
|
35
|
-
echo "Complete"
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
# Function: Commit and tag the new version
|
|
39
|
-
commit_and_tag() {
|
|
40
|
-
setGitInfo
|
|
41
|
-
echo "📌 Committing and tagging the new version..."
|
|
42
|
-
git add .
|
|
43
|
-
git commit -m "chore: version bump and changelog"
|
|
44
|
-
git push origin
|
|
45
|
-
|
|
46
|
-
# Create and push a new tag
|
|
47
|
-
local new_version
|
|
48
|
-
new_version=$(node -p "require('./package.json').version")
|
|
49
|
-
git tag "v$new_version"
|
|
50
|
-
git push origin --tags
|
|
51
|
-
echo "✅ Version $new_version tagged and pushed."
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
# Parse the provided command
|
|
55
|
-
case "$1" in
|
|
56
|
-
validate)
|
|
57
|
-
validate_changesets $2
|
|
58
|
-
;;
|
|
59
|
-
build)
|
|
60
|
-
build_application
|
|
61
|
-
;;
|
|
62
|
-
version)
|
|
63
|
-
version_application
|
|
64
|
-
;;
|
|
65
|
-
commit-and-tag)
|
|
66
|
-
commit_and_tag
|
|
67
|
-
;;
|
|
68
|
-
all)
|
|
69
|
-
version_application
|
|
70
|
-
commit_and_tag
|
|
71
|
-
;;
|
|
72
|
-
*)
|
|
73
|
-
echo "❓ Unknown command: $1"
|
|
74
|
-
echo "Available commands: validate, build, version, commit-and-tag, all"
|
|
75
|
-
exit 1
|
|
76
|
-
;;
|
|
77
|
-
esac
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const directoryPath = process.argv[2];
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
// Step 1: Read the directory for md files excluding README.md
|
|
9
|
-
const allFiles = fs.readdirSync(directoryPath);
|
|
10
|
-
const mdFiles = allFiles.filter(file => file.endsWith('.md') && file !== 'README.md');
|
|
11
|
-
|
|
12
|
-
// Step 2: Check for pre.json and parse it
|
|
13
|
-
const preJsonPath = path.join(directoryPath, 'pre.json');
|
|
14
|
-
let preJson;
|
|
15
|
-
|
|
16
|
-
if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
|
|
17
|
-
console.error("Error: No pre.json and no md files found.");
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (fs.existsSync(preJsonPath)) {
|
|
22
|
-
preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
|
|
23
|
-
|
|
24
|
-
if(preJson.mode == 'pre') {
|
|
25
|
-
// Step 4a: Get list of changesets from pre.json
|
|
26
|
-
const changesets = preJson.changesets || [];
|
|
27
|
-
const changesetNames = changesets.map(change => change);
|
|
28
|
-
|
|
29
|
-
// Step 4b: Match files with the list of changesets
|
|
30
|
-
const mdFileNamesWithoutExt = mdFiles.map(file => path.basename(file, '.md'));
|
|
31
|
-
const unmatchedFiles = mdFileNamesWithoutExt.filter(fileName => !changesetNames.includes(fileName));
|
|
32
|
-
|
|
33
|
-
if (unmatchedFiles.length == 0) {
|
|
34
|
-
console.error("No new MD files found:", unmatchedFiles);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
console.log("Validation successful.");
|
|
41
|
-
} catch (error) {
|
|
42
|
-
console.error("Error while processing:", error);
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|