u2a 3.4.18 → 3.4.20

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u2a",
3
- "version": "3.4.18",
3
+ "version": "3.4.20",
4
4
  "description": "URL to App - Turn any URL into a desktop application",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -16,6 +16,8 @@ const { setupConfig } = require('./utils/config');
16
16
  const { checkNotRoot } = require('./utils/noroot');
17
17
  const { checkVersion } = require('./utils/versionCheck');
18
18
 
19
+ setupConfig();
20
+
19
21
  (async () => {
20
22
 
21
23
  program
@@ -63,7 +65,4 @@ const { checkVersion } = require('./utils/versionCheck');
63
65
 
64
66
  await checkNotRoot(options.allowroot).catch(() => {});
65
67
  await checkVersion().catch(() => {});
66
-
67
- setupConfig();
68
-
69
68
  })();
@@ -254,7 +254,7 @@ app.on('activate', () => {
254
254
  }
255
255
  });
256
256
  `;
257
- }
257
+ } // note for one day: put this in a different file
258
258
 
259
259
  async function createPackageJson(appName, iconPath, isExecutable = false, createSetup = false) {
260
260
  const u2aPackagePath = path.resolve(__dirname, '../../package.json');
@@ -114,7 +114,8 @@ async function buildSetup(appDir, platform, arch) {
114
114
  return null;
115
115
  }
116
116
  } catch (error) {
117
- logger.error(`Error while building setup:`, error);
117
+ logger.error(`Error while building setup.`, error);
118
+ logger.warn('Try to run u2a with administrator privileges to avoid this error.');
118
119
  return null;
119
120
  }
120
121
  }
@@ -24,7 +24,7 @@ class Logger {
24
24
 
25
25
  info(message) {
26
26
  const formattedMessage = this._format('INFO', message);
27
- console.log(chalk.blue(formattedMessage));
27
+ console.log(chalk.blueBright(formattedMessage));
28
28
  this._writeToFile(formattedMessage);
29
29
  }
30
30
 
@@ -6,7 +6,7 @@ const logger = new Logger('noroot');
6
6
 
7
7
  async function checkNotRoot(allowRoot = false) {
8
8
  if (allowRoot) {
9
- logger.warn('Running with elevated privileges. This is not recommended.', '');
9
+ logger.warn('Running with elevated privileges. This is not recommended.');
10
10
  return;
11
11
  }
12
12
 
@@ -15,7 +15,9 @@ async function checkNotRoot(allowRoot = false) {
15
15
  switch (platform) {
16
16
  case 'win32':
17
17
  if (await isAdmin()) {
18
- logger.error('This application should not be run as an administrator.', '');
18
+ logger.error('This application should not be run as an administrator.');
19
+ logger.warn('Run with --allowroot to avoid this message.');
20
+ logger.warn('Running u2a as administrator can be dangerous.');
19
21
  process.exit(1);
20
22
  }
21
23
  break;
@@ -23,7 +25,9 @@ async function checkNotRoot(allowRoot = false) {
23
25
  case 'darwin':
24
26
  case 'linux':
25
27
  if (process.getuid() === 0) {
26
- logger.error('This application should not be run as root.', '');
28
+ logger.error('This application should not be run as root.');
29
+ logger.warn('Run with --allowroot to avoid this message.');
30
+ logger.warn('Running u2a as root can be dangerous.');
27
31
  process.exit(1);
28
32
  }
29
33
  break;