@common-stack/generate-plugin 6.0.2-alpha.6 → 6.0.2-alpha.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.0.2-alpha.7](https://github.com/cdmbase/common-stack/compare/v6.0.2-alpha.6...v6.0.2-alpha.7) (2024-08-23)
7
+
8
+ **Note:** Version bump only for package @common-stack/generate-plugin
9
+
6
10
  ## [6.0.2-alpha.6](https://github.com/cdmbase/common-stack/compare/v6.0.2-alpha.5...v6.0.2-alpha.6) (2024-08-23)
7
11
 
8
12
  **Note:** Version bump only for package @common-stack/generate-plugin
@@ -0,0 +1,27 @@
1
+ const merge = require('merge')
2
+ const baseConfig = require('./jest.config.base');
3
+ const mongodbConfig = require('./jest.config.mongodb')
4
+ module.exports = merge.recursive(
5
+ baseConfig,
6
+ mongodbConfig,
7
+ {
8
+ globals: {
9
+
10
+ }
11
+ }, {
12
+ moduleDirectories: [
13
+ "node_modules",
14
+ "packages/adminide-core",
15
+ ],
16
+ }
17
+ // https://baltuta.eu/posts/typescript-lerna-monorepo-more-tools
18
+ // {
19
+ // roots: ['<rootDir>'],
20
+ // projects: [
21
+ // '<rootDir>/packages/ui',
22
+ // '<rootDir>/packages/api',
23
+ // '<rootDir>/packages/diceroll'
24
+ // ],
25
+ // }
26
+
27
+ );
@@ -3,6 +3,9 @@ const fs = require('fs');
3
3
 
4
4
  // Function to update the configuration file
5
5
  function updateConfiguration(filePath, newVersion) {
6
+ // Convert the version from vMajor.Minor to vMajor-Minor for URL
7
+ const versionForUrl = newVersion.replace('.', '-');
8
+
6
9
  // Read the configuration file
7
10
  fs.readFile(filePath, 'utf8', (err, data) => {
8
11
  if (err) {
@@ -10,24 +13,20 @@ function updateConfiguration(filePath, newVersion) {
10
13
  return;
11
14
  }
12
15
 
13
- // Replace VERSION and CONNECTION_ID with newVersion
16
+ // Replace only the specific VERSION and CONNECTION_ID fields, preserving leading whitespace
14
17
  let updatedData = data
15
- .replace(/VERSION: v\d+(\.\d+)?/g, `VERSION: ${newVersion}`)
16
- .replace(/CONNECTION_ID: v\d+(\.\d+)?/g, `CONNECTION_ID: ${newVersion}`);
18
+ .replace(/^(\s*)VERSION:\s*v\d+(\.\d+)?/gm, `$1VERSION: ${newVersion}`)
19
+ .replace(/^(\s*)CONNECTION_ID:\s*v\d+(\.\d+)?/gm, `$1CONNECTION_ID: ${newVersion}`);
17
20
 
18
- // Update CLIENT_URL
21
+ // Update CLIENT_URL, preserving leading whitespace, and replacing the version with the hyphenated version
19
22
  updatedData = updatedData.replace(
20
- /CLIENT_URL: "https:\/\/[\w-]+-v\d+(\.\d+)?\.[\w-]+(\.\w+)?\/?"/g,
21
- (match) => {
22
- const domainParts = match.match(/https:\/\/[\w-]+-v\d+(\.\d+)?(\.[\w-]+)+/g);
23
- if (domainParts && domainParts.length > 0) {
24
- const domain = domainParts[0];
25
- const newDomain = domain.replace(/-v\d+(\.\d+)?/, `-${newVersion}`);
26
- return match.replace(domain, newDomain);
27
- }
28
- return match;
23
+ /^(\s*)CLIENT_URL:\s*"https:\/\/([\w-]+)-v\d+(-\d+)?(\.[\w-]+(\.\w+)?)\/?"/gm,
24
+ (match, p1, p2, p3, p4) => {
25
+ const newDomain = `${p2}-${versionForUrl}${p4}`;
26
+ return `${p1}CLIENT_URL: "https://${newDomain}"`;
29
27
  },
30
28
  );
29
+
31
30
  // Write the updated configuration back to the file
32
31
  fs.writeFile(filePath, updatedData, 'utf8', (err) => {
33
32
  if (err) {
@@ -35,7 +34,7 @@ function updateConfiguration(filePath, newVersion) {
35
34
  return;
36
35
  }
37
36
  console.log(`Configuration file updated successfully.`);
38
- console.log(`Manually update CLIENT_URL in values-dev.yaml and values-prod.yaml`)
37
+ console.log(`Manually update CLIENT_URL in values-dev.yaml and values-prod.yaml`);
39
38
  });
40
39
  });
41
40
  }
@@ -45,7 +44,7 @@ const filePath = process.argv[2];
45
44
  const versionArg = process.argv[3];
46
45
 
47
46
  if (!filePath || !versionArg || !versionArg.match(/^v\d+(\.\d+)?$/)) {
48
- console.error('Usage: node updateConfiguration.js v[Major].[Minor]');
47
+ console.error('Usage: node updateConfiguration.js <path-to-config> v[Major].[Minor]');
49
48
  process.exit(1);
50
49
  }
51
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-stack/generate-plugin",
3
- "version": "6.0.2-alpha.6",
3
+ "version": "6.0.2-alpha.7",
4
4
  "type": "module",
5
5
  "main": "./lib/index.mjs",
6
6
  "typings": "./lib/index.d.ts",
@@ -26,5 +26,5 @@
26
26
  },
27
27
  "executors": "./executors.json",
28
28
  "generators": "./generators.json",
29
- "gitHead": "835ce01a9673173684b1e890c4256c1118054433"
29
+ "gitHead": "38f2f3a7c7ea7574e36d31ce9e4cb71920cfb520"
30
30
  }
@@ -3,6 +3,9 @@ const fs = require('fs');
3
3
 
4
4
  // Function to update the configuration file
5
5
  function updateConfiguration(filePath, newVersion) {
6
+ // Convert the version from vMajor.Minor to vMajor-Minor for URL
7
+ const versionForUrl = newVersion.replace('.', '-');
8
+
6
9
  // Read the configuration file
7
10
  fs.readFile(filePath, 'utf8', (err, data) => {
8
11
  if (err) {
@@ -10,24 +13,20 @@ function updateConfiguration(filePath, newVersion) {
10
13
  return;
11
14
  }
12
15
 
13
- // Replace VERSION and CONNECTION_ID with newVersion
16
+ // Replace only the specific VERSION and CONNECTION_ID fields, preserving leading whitespace
14
17
  let updatedData = data
15
- .replace(/VERSION: v\d+(\.\d+)?/g, `VERSION: ${newVersion}`)
16
- .replace(/CONNECTION_ID: v\d+(\.\d+)?/g, `CONNECTION_ID: ${newVersion}`);
18
+ .replace(/^(\s*)VERSION:\s*v\d+(\.\d+)?/gm, `$1VERSION: ${newVersion}`)
19
+ .replace(/^(\s*)CONNECTION_ID:\s*v\d+(\.\d+)?/gm, `$1CONNECTION_ID: ${newVersion}`);
17
20
 
18
- // Update CLIENT_URL
21
+ // Update CLIENT_URL, preserving leading whitespace, and replacing the version with the hyphenated version
19
22
  updatedData = updatedData.replace(
20
- /CLIENT_URL: "https:\/\/[\w-]+-v\d+(\.\d+)?\.[\w-]+(\.\w+)?\/?"/g,
21
- (match) => {
22
- const domainParts = match.match(/https:\/\/[\w-]+-v\d+(\.\d+)?(\.[\w-]+)+/g);
23
- if (domainParts && domainParts.length > 0) {
24
- const domain = domainParts[0];
25
- const newDomain = domain.replace(/-v\d+(\.\d+)?/, `-${newVersion}`);
26
- return match.replace(domain, newDomain);
27
- }
28
- return match;
23
+ /^(\s*)CLIENT_URL:\s*"https:\/\/([\w-]+)-v\d+(-\d+)?(\.[\w-]+(\.\w+)?)\/?"/gm,
24
+ (match, p1, p2, p3, p4) => {
25
+ const newDomain = `${p2}-${versionForUrl}${p4}`;
26
+ return `${p1}CLIENT_URL: "https://${newDomain}"`;
29
27
  },
30
28
  );
29
+
31
30
  // Write the updated configuration back to the file
32
31
  fs.writeFile(filePath, updatedData, 'utf8', (err) => {
33
32
  if (err) {
@@ -35,7 +34,7 @@ function updateConfiguration(filePath, newVersion) {
35
34
  return;
36
35
  }
37
36
  console.log(`Configuration file updated successfully.`);
38
- console.log(`Manually update CLIENT_URL in values-dev.yaml and values-prod.yaml`)
37
+ console.log(`Manually update CLIENT_URL in values-dev.yaml and values-prod.yaml`);
39
38
  });
40
39
  });
41
40
  }
@@ -45,7 +44,7 @@ const filePath = process.argv[2];
45
44
  const versionArg = process.argv[3];
46
45
 
47
46
  if (!filePath || !versionArg || !versionArg.match(/^v\d+(\.\d+)?$/)) {
48
- console.error('Usage: node updateConfiguration.js v[Major].[Minor]');
47
+ console.error('Usage: node updateConfiguration.js <path-to-config> v[Major].[Minor]');
49
48
  process.exit(1);
50
49
  }
51
50