@nocobase/cli 2.1.4-test.1 → 2.1.4-test.2

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/run.js CHANGED
@@ -27,6 +27,56 @@ if (!isSupportedNodeVersion()) {
27
27
  normalizeSessionEnv();
28
28
  normalizeNodeOptions();
29
29
 
30
+ const windowsAdministratorCheckScript = [
31
+ '$identity = [Security.Principal.WindowsIdentity]::GetCurrent();',
32
+ '$principal = New-Object Security.Principal.WindowsPrincipal($identity);',
33
+ 'if ($principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { exit 0 }',
34
+ 'exit 1',
35
+ ].join(' ');
36
+
37
+ function isWindowsAdministrator() {
38
+ for (const command of ['pwsh.exe', 'powershell.exe']) {
39
+ const result = spawnSync(
40
+ command,
41
+ ['-NoLogo', '-NoProfile', '-NonInteractive', '-Command', windowsAdministratorCheckScript],
42
+ {
43
+ stdio: 'ignore',
44
+ windowsHide: true,
45
+ },
46
+ );
47
+
48
+ if (result.error?.code === 'ENOENT') {
49
+ continue;
50
+ }
51
+
52
+ return result.status === 0;
53
+ }
54
+
55
+ return false;
56
+ }
57
+
58
+ function ensureWindowsAdministrator() {
59
+ if (process.platform !== 'win32' || process.env.NB_CLI_WINDOWS_ADMIN_CHECKED === '1') {
60
+ return;
61
+ }
62
+
63
+ if (!isWindowsAdministrator()) {
64
+ console.error(
65
+ pc.red(
66
+ [
67
+ 'NocoBase CLI must be run as Administrator on Windows.',
68
+ 'Open PowerShell 5 or PowerShell 7 with "Run as administrator", then run the command again.',
69
+ ].join('\n'),
70
+ ),
71
+ );
72
+ process.exit(1);
73
+ }
74
+
75
+ process.env.NB_CLI_WINDOWS_ADMIN_CHECKED = '1';
76
+ }
77
+
78
+ ensureWindowsAdministrator();
79
+
30
80
  /**
31
81
  * In the monorepo, plain `node` cannot load `.ts`. Re-exec once with `--import <tsx>`
32
82
  * (same effect as a dedicated dev entry with `#!/usr/bin/env -S node --import tsx`).
@@ -20,7 +20,7 @@ export default class SelfCheck extends Command {
20
20
  static flags = {
21
21
  channel: Flags.string({
22
22
  description: 'Release channel to compare against. Defaults to the current CLI channel.',
23
- options: ['auto', 'latest', 'beta', 'alpha'],
23
+ options: ['auto', 'latest', 'test', 'beta', 'alpha'],
24
24
  default: 'auto',
25
25
  }),
26
26
  json: Flags.boolean({
@@ -31,12 +31,12 @@ export default class SelfUpdate extends Command {
31
31
  '<%= config.bin %> <%= command.id %>',
32
32
  '<%= config.bin %> <%= command.id %> --yes',
33
33
  '<%= config.bin %> <%= command.id %> --skills',
34
- '<%= config.bin %> <%= command.id %> --channel alpha --json',
34
+ '<%= config.bin %> <%= command.id %> --channel test --json',
35
35
  ];
36
36
  static flags = {
37
37
  channel: Flags.string({
38
38
  description: 'Release channel to update to. Defaults to the current CLI channel.',
39
- options: ['auto', 'latest', 'beta', 'alpha'],
39
+ options: ['auto', 'latest', 'test', 'beta', 'alpha'],
40
40
  default: 'auto',
41
41
  }),
42
42
  yes: Flags.boolean({
@@ -97,6 +97,9 @@ function detectChannel(currentVersion) {
97
97
  if (/-beta(?:[.-]|$)/i.test(currentVersion)) {
98
98
  return 'beta';
99
99
  }
100
+ if (/-test(?:[.-]|$)/i.test(currentVersion)) {
101
+ return 'test';
102
+ }
100
103
  return 'latest';
101
104
  }
102
105
  function readCurrentVersion(packageRoot) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "2.1.4-test.1",
3
+ "version": "2.1.4-test.2",
4
4
  "description": "NocoBase Command Line Tool",
5
5
  "type": "module",
6
6
  "main": "dist/generated/command-registry.js",