qcobjects-cli 2.5.148-beta → 2.5.153-beta

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.
@@ -152,7 +152,7 @@ declare module "cli-main" {
152
152
  };
153
153
  program: any;
154
154
  constructor();
155
- shellCommands(_shell_commands: any[]): Promise<unknown>;
155
+ shellCommands(_shell_commands: any[]): Promise<any[]>;
156
156
  fileListRecursive(dir: string): string | string[];
157
157
  register(email: any, phonenumber: any): Promise<unknown>;
158
158
  generateServiceWorker(appName: any, dirPrefix?: string): Promise<unknown>;
@@ -186,7 +186,7 @@ declare module "cli-commands-version" {
186
186
  constructor({ switchCommander }: {
187
187
  switchCommander: SwitchCommander;
188
188
  });
189
- syncGit(versionString: any, commitMsg: any, syncNpm?: boolean): void;
189
+ syncGit(versionString: any, commitMsg: any, syncNpm?: boolean): Promise<void>;
190
190
  parseVersionString(versionString: string): {
191
191
  major: string;
192
192
  minor: string;
@@ -55,7 +55,7 @@ export class CommandHandler extends InheritClass {
55
55
  const commandHandler = this;
56
56
 
57
57
  this.choiceOption = {
58
- v_major(filename: string, options: any) {
58
+ async v_major(filename: string, options: any) {
59
59
  filename = (typeof filename === "undefined") ? ("VERSION") : (filename);
60
60
  const versionString = this.getVersionStringFromFile(filename);
61
61
  const versionSuffix = this.parseVersionSuffix(versionString);
@@ -67,10 +67,10 @@ export class CommandHandler extends InheritClass {
67
67
  this.saveNewVersionFile(filename, newVersion);
68
68
  if (options.syncGit) {
69
69
  var commitMsg = options.commitMsg || `New Version v${newVersion}`;
70
- this.syncGit(newVersion, commitMsg, options.syncNpm);
70
+ await this.syncGit(newVersion, commitMsg, options.syncNpm);
71
71
  }
72
72
  },
73
- v_minor(filename: string, options: any) {
73
+ async v_minor(filename: string, options: any) {
74
74
  filename = (typeof filename === "undefined") ? ("VERSION") : (filename);
75
75
  const versionString = this.getVersionStringFromFile(filename);
76
76
  const versionSuffix = this.parseVersionSuffix(versionString);
@@ -82,10 +82,10 @@ export class CommandHandler extends InheritClass {
82
82
  this.saveNewVersionFile(filename, newVersion);
83
83
  if (options.syncGit) {
84
84
  var commitMsg = options.commitMsg || `New Version v${newVersion}`;
85
- this.syncGit(newVersion, commitMsg, options.syncNpm);
85
+ await this.syncGit(newVersion, commitMsg, options.syncNpm);
86
86
  }
87
87
  },
88
- v_patch(filename: string, options: any) {
88
+ async v_patch(filename: string, options: any) {
89
89
  filename = (typeof filename === "undefined") ? ("VERSION") : (filename);
90
90
  const versionString = this.getVersionStringFromFile(filename);
91
91
  const versionSuffix = this.parseVersionSuffix(versionString);
@@ -97,7 +97,7 @@ export class CommandHandler extends InheritClass {
97
97
  this.saveNewVersionFile(filename, newVersion);
98
98
  if (options.syncGit) {
99
99
  var commitMsg = options.commitMsg || `New Version v${newVersion}`;
100
- this.syncGit(newVersion, commitMsg, options.syncNpm);
100
+ await this.syncGit(newVersion, commitMsg, options.syncNpm);
101
101
  }
102
102
  },
103
103
  v_sync(filename: string, options: any) {
@@ -172,7 +172,7 @@ export class CommandHandler extends InheritClass {
172
172
  .option("-m, --commit-msg [message]", "Commit Message")
173
173
  .description("Semantic Versioning: Upgrade to a new major version")
174
174
  .action(function (args: any, options: any) {
175
- commandHandler.choiceOption.v_major.call(commandHandler, args, options);
175
+ return commandHandler.choiceOption.v_major.call(commandHandler, args, options);
176
176
  });
177
177
  switchCommander.program.command("v-minor [filename]")
178
178
  .option("--git, --sync-git", "Sync with Git")
@@ -180,16 +180,15 @@ export class CommandHandler extends InheritClass {
180
180
  .option("-m, --commit-msg [message]", "Commit Message")
181
181
  .description("Semantic Versioning: Upgrade to a new minor version")
182
182
  .action(function (args: any, options: any) {
183
- commandHandler.choiceOption.v_minor.call(commandHandler, args, options);
183
+ return commandHandler.choiceOption.v_minor.call(commandHandler, args, options);
184
184
  });
185
-
186
185
  switchCommander.program.command("v-patch [filename]")
187
186
  .option("--git, --sync-git", "Sync with Git")
188
187
  .option("--npm, --sync-npm", "Sync with NPM")
189
188
  .option("-m, --commit-msg [message]", "Commit Message")
190
189
  .description("Semantic Versioning: Upgrade to a new patch version")
191
190
  .action(function (args: any, options: any) {
192
- commandHandler.choiceOption.v_patch.call(commandHandler, args, options);
191
+ return commandHandler.choiceOption.v_patch.call(commandHandler, args, options);
193
192
  });
194
193
 
195
194
  switchCommander.program.command("v-sync [filename]")
@@ -232,7 +231,7 @@ export class CommandHandler extends InheritClass {
232
231
 
233
232
  _commands_.push("git push && git push --tags");
234
233
 
235
- this.switchCommander.shellCommands(_commands_).then(function (response: any) {
234
+ return this.switchCommander.shellCommands(_commands_).then(function (response: any) {
236
235
  logger.info("Synced to Git");
237
236
  logger.debug(response);
238
237
  }).catch(function (e: any) {
package/transpile.js CHANGED
@@ -1,5 +1,7 @@
1
1
  const ts = require('typescript');
2
2
  const path = require('path');
3
+ const { readFileSync, writeFileSync } = require('fs');
4
+ const glob = require('glob');
3
5
 
4
6
  // Get the tsconfig file name from command line arguments
5
7
  const configFileName = process.argv[2];
@@ -59,6 +61,36 @@ if (emittedFiles.length > 0) {
59
61
  emittedFiles.forEach(file => console.log(file));
60
62
  }
61
63
 
64
+ // Post-process CJS output: convert await import(var) → require(var) for data file imports
65
+ // Detects variables assigned to paths ending in .json/.jsonp/.md/.mdc/.text/.txt
66
+ const extensionsToConvert = ['json', 'jsonp', 'md', 'mdc', 'text', 'txt'];
67
+ const extPattern = extensionsToConvert.join('|');
68
+ const varDeclRegex = new RegExp(
69
+ `(?:const|let|var)\\s+(\\w+)\\s*=[^;]*?\\.(?:${extPattern})["'\`][^;]*;`,
70
+ 'g'
71
+ );
72
+
73
+ glob.sync('public/cjs/**/*.js').forEach(file => {
74
+ const content = readFileSync(file, 'utf8');
75
+
76
+ const jsonVars = new Set();
77
+ let match;
78
+ while ((match = varDeclRegex.exec(content)) !== null) {
79
+ jsonVars.add(match[1]);
80
+ }
81
+
82
+ if (jsonVars.size > 0) {
83
+ const importRegex = new RegExp(
84
+ `await import\\((${[...jsonVars].join('|')})\\)`,
85
+ 'g'
86
+ );
87
+ const newContent = content.replace(importRegex, 'require($1)');
88
+ if (newContent !== content) {
89
+ writeFileSync(file, newContent, 'utf8');
90
+ }
91
+ }
92
+ });
93
+
62
94
  // Exit with an appropriate code
63
95
  const exitCode = emitResult.emitSkipped ? 1 : 0;
64
96
  console.log(`Process exiting with code '${exitCode}'.`);
@@ -1,43 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
-
4
- name: Node.js Publish Beta version
5
-
6
- on:
7
- push:
8
- tags:
9
- - 'v*.*.*-beta'
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- with:
17
- token: ${{ secrets.GITHUB_TOKEN }}
18
- ref: ${{ github.ref }}
19
- - uses: actions/setup-node@v4
20
- with:
21
- node-version: 22
22
- - run: npm i --legacy-peer-deps
23
- - run: npm test
24
-
25
- publish-npm:
26
- needs: build
27
- runs-on: ubuntu-latest
28
- permissions:
29
- contents: read
30
- id-token: write
31
- steps:
32
- - uses: actions/checkout@v4
33
- with:
34
- token: ${{ secrets.GITHUB_TOKEN }}
35
- ref: ${{ github.ref }}
36
- - uses: actions/setup-node@v4
37
- with:
38
- node-version: 22
39
- - name: Upgrade npm for OIDC support (requires >=11.5.1)
40
- run: npm install -g npm@latest
41
- - run: npm i --legacy-peer-deps
42
- - run: npm test
43
- - run: npm publish --tag beta
@@ -1,44 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
-
4
- name: Node.js Publish Package
5
-
6
- on:
7
- push:
8
- tags:
9
- - 'v*.*.*'
10
-
11
- jobs:
12
- build:
13
- if: ${{ !contains(github.ref, '-') }}
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: actions/checkout@v4
17
- with:
18
- token: ${{ secrets.GITHUB_TOKEN }}
19
- ref: ${{ github.ref }}
20
- - uses: actions/setup-node@v4
21
- with:
22
- node-version: 22
23
- - run: npm i --legacy-peer-deps
24
- - run: npm test
25
-
26
- publish-npm:
27
- needs: build
28
- if: ${{ !contains(github.ref, '-') }}
29
- runs-on: ubuntu-latest
30
- permissions:
31
- contents: read
32
- id-token: write
33
- steps:
34
- - uses: actions/checkout@v4
35
- with:
36
- token: ${{ secrets.GITHUB_TOKEN }}
37
- ref: ${{ github.ref }}
38
- - uses: actions/setup-node@v4
39
- with:
40
- node-version: 22
41
- - name: Upgrade npm for OIDC support (requires >=11.5.1)
42
- run: npm install -g npm@latest
43
- - run: npm i --legacy-peer-deps
44
- - run: npm publish