@steedos/service-package-registry 2.1.51 → 2.1.55

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.
@@ -61,7 +61,7 @@ function getYarnrcScopes() {
61
61
  const data = fs.readFileSync(yarnrcConfigPath, 'utf-8');
62
62
  const scopes = {};
63
63
  if (data) {
64
- console.log(`data`, data);
64
+ // console.log(`data`, data);
65
65
  try {
66
66
  const lines = data.split('\n');
67
67
  _.each(lines, (line) => {
@@ -41,9 +41,17 @@ if (!Array.prototype.findIndex) {
41
41
  }
42
42
  // jshint freeze:true
43
43
 
44
+ function removeSuffix(pattern, suffix) {
45
+ if (pattern.endsWith(suffix)) {
46
+ return pattern.slice(0, -suffix.length);
47
+ }
48
+ return pattern;
49
+ }
50
+
44
51
  module.exports = {
45
52
  processArguments: function (npmUser, npmPass, npmEmail, npmRegistry, npmScope, quotes, configPath) {
46
53
  var registry = npmRegistry || 'https://registry.npmjs.org';
54
+ registry = removeSuffix(registry, '/')
47
55
  var homePath = process.env.HOME ? process.env.HOME : process.env.USERPROFILE;
48
56
  var finalPath = configPath ? configPath : path.join(homePath, '.npmrc');
49
57
  var hasQuotes = quotes ? quotes : false;
@@ -8,10 +8,14 @@ const _ = require('lodash');
8
8
  const login = require('./login');
9
9
 
10
10
  function registryUrl(scope) {
11
- const result = login.getYarnrcScopes();
12
- const url = result[`${scope}:registry`];
13
- if (url) {
14
- return url.slice(-1) === '/' ? url : `${url}/`;
11
+ try {
12
+ const result = login.getYarnrcScopes();
13
+ const url = result[`${scope}:registry`];
14
+ if (url) {
15
+ return url.slice(-1) === '/' ? url : `${url}/`;
16
+ }
17
+ } catch (Exception) {
18
+
15
19
  }
16
20
  }
17
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-package-registry",
3
- "version": "2.1.51",
3
+ "version": "2.1.55",
4
4
  "description": "",
5
5
  "main": "package.service.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "author": "",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "@steedos/service-package-loader": "2.1.51",
12
+ "@steedos/service-package-loader": "2.1.55",
13
13
  "fs-extra": "8.1.0",
14
14
  "i18next": "20.3.2",
15
15
  "json-stringify-safe": "5.0.1",
@@ -26,5 +26,5 @@
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
- "gitHead": "7832979d04d09de2e1d522fad30c20dfbfeea046"
29
+ "gitHead": "4cf71f0e696a28b30084bb07471cfbdc6c875f96"
30
30
  }
@@ -508,7 +508,7 @@ module.exports = {
508
508
  // 配置主控地址
509
509
  const consoleUrl = settings.STEEDOS_CLOUD_URL;
510
510
  if (!consoleUrl) {
511
- console.log(chalk.red('请配置主控地址'));
511
+ console.log('请配置主控地址');
512
512
  return;
513
513
  }
514
514
 
@@ -518,7 +518,7 @@ module.exports = {
518
518
  const apiKey = settings.STEEDOS_CLOUD_API_KEY;
519
519
 
520
520
  if (!spaceId || !apiKey) {
521
- console.log(chalk.red('请配置环境变量STEEDOS_CLOUD_SPACE_ID和STEEDOS_CLOUD_API_KEY。'));
521
+ console.log('请配置环境变量STEEDOS_CLOUD_SPACE_ID和STEEDOS_CLOUD_API_KEY。');
522
522
  return;
523
523
  }
524
524
 
@@ -528,7 +528,7 @@ module.exports = {
528
528
  const { info, scopes } = await this.getSafeScopes(spaceId, apiKey, consoleUrl);
529
529
  const { adminPhone } = info;
530
530
  if (!adminPhone) {
531
- console.log(chalk.red('缺少工作区信息 工作区名称、管理员姓名、管理员手机号,请检查'));
531
+ console.log('缺少工作区信息 工作区名称、管理员姓名、管理员手机号,请检查');
532
532
  return;
533
533
  }
534
534
  // let scope = '';