@pdfme/common 5.3.7-dev.1 → 5.3.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/set-version.js +10 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/common",
3
- "version": "5.3.7-dev.1",
3
+ "version": "5.3.7",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
package/set-version.js CHANGED
@@ -2,30 +2,28 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { execSync } = require('child_process');
4
4
 
5
- const updateVersion = (version) => {
5
+ try {
6
+ const gitTag = execSync('git describe --tags $(git rev-list --tags --max-count=1)', { encoding: 'utf8' }).trim();
7
+
6
8
  const filePath = path.join(__dirname, 'src/version.ts');
7
9
  let content = '';
8
10
 
9
11
  if (!fs.existsSync(filePath)) {
10
- content = `export const PDFME_VERSION = '${version}';\n`;
12
+ content = `export const PDFME_VERSION = '${gitTag}';\n`;
11
13
  } else {
12
14
  content = fs.readFileSync(filePath, 'utf8');
13
15
  const versionRegex = /export const PDFME_VERSION = '.*';/;
16
+
14
17
  if (versionRegex.test(content)) {
15
- content = content.replace(versionRegex, `export const PDFME_VERSION = '${version}';`);
18
+ content = content.replace(versionRegex, `export const PDFME_VERSION = '${gitTag}';`);
16
19
  } else {
17
- content += `\nexport const PDFME_VERSION = '${version}';\n`;
20
+ content += `\nexport const PDFME_VERSION = '${gitTag}';\n`;
18
21
  }
19
22
  }
20
23
 
21
24
  fs.writeFileSync(filePath, content, 'utf8');
22
- console.log(`Replaced PDFME_VERSION with '${version}' in ${filePath}`);
23
- };
24
-
25
- try {
26
- const gitTag = execSync('git describe --tags $(git rev-list --tags --max-count=1)', { encoding: 'utf8' }).trim();
27
- updateVersion(gitTag);
25
+ console.log(`Replaced PDFME_VERSION with '${gitTag}' in ${filePath}`);
28
26
  } catch (error) {
29
27
  console.error('Error replacing PDFME_VERSION:', error);
30
- updateVersion('x.x.x');
31
- }
28
+ process.exit(1);
29
+ }