@steedos/service-package-registry 2.5.15-beta.12 → 2.5.15-beta.14

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.
@@ -23,7 +23,7 @@ const loadPackagesConfig = ()=>{
23
23
  return yaml.load(fs.readFileSync(packagesFilePath, 'utf8')) || {};
24
24
  }
25
25
 
26
- const appendToPackagesConfig = (packageName, options)=>{
26
+ const appendToPackagesConfig = (packageName, options, actionName)=>{
27
27
  let packages = loadPackagesConfig();
28
28
  let changeNamePackage = null;
29
29
  if(options.local && !packages[packageName]){
@@ -46,7 +46,9 @@ const appendToPackagesConfig = (packageName, options)=>{
46
46
  }
47
47
  }else{
48
48
  // 对于已经存在的软件包, 不支持使用传入的enable控制软件包状态.
49
- delete options.enable
49
+ if(actionName === 'addPackage'){
50
+ delete options.enable
51
+ }
50
52
  packages[packageName] = Object.assign(packages[packageName], options)
51
53
  }
52
54
  }else{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-package-registry",
3
- "version": "2.5.15-beta.12",
3
+ "version": "2.5.15-beta.14",
4
4
  "description": "",
5
5
  "main": "package.service.js",
6
6
  "scripts": {
@@ -9,11 +9,11 @@
9
9
  "author": "",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "@steedos/auth": "2.5.15-beta.12",
13
- "@steedos/core": "2.5.15-beta.12",
14
- "@steedos/metadata-core": "2.5.15-beta.12",
15
- "@steedos/objectql": "2.5.15-beta.12",
16
- "@steedos/service-package-loader": "2.5.15-beta.12",
12
+ "@steedos/auth": "2.5.15-beta.14",
13
+ "@steedos/core": "2.5.15-beta.14",
14
+ "@steedos/metadata-core": "2.5.15-beta.14",
15
+ "@steedos/objectql": "2.5.15-beta.14",
16
+ "@steedos/service-package-loader": "2.5.15-beta.14",
17
17
  "fs-extra": "8.1.0",
18
18
  "i18next": "20.3.2",
19
19
  "json-stringify-safe": "5.0.1",
@@ -31,5 +31,5 @@
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "ecaaf3d634f64221c7f4560a8c523341e993c609"
34
+ "gitHead": "7b6dc80eeda6a50f30bbbd3185cfb49c6bdcf32c"
35
35
  }
@@ -92,11 +92,15 @@ module.exports = {
92
92
  async handler(ctx) {
93
93
  const { module } = ctx.params
94
94
  const packages = loader.loadPackagesConfig();
95
- const packageConfig = _.find(packages, (_p, pname) => {
95
+ let packageConfig = _.find(packages, (_p, pname) => {
96
+ _p.name = pname;
96
97
  return pname === module;
97
98
  })
98
99
  if (packageConfig) {
99
100
  if (packageConfig.enable) {
101
+ if(packageConfig.static){
102
+ packageConfig = Object.assign({}, packageConfig, this.getStaticPackageInfo(packageConfig, packageConfig.name))
103
+ }
100
104
  if (packageConfig.local) {
101
105
  let packagePath = packageConfig.path;
102
106
  if(!path.isAbsolute(packagePath)){
@@ -129,7 +133,10 @@ module.exports = {
129
133
  disablePackage:{
130
134
  async handler(ctx) {
131
135
  const { module } = ctx.params
132
- const packageConfig = await loader.disablePackage(module);
136
+ let packageConfig = await loader.disablePackage(module);
137
+ if(packageConfig.static){
138
+ packageConfig = Object.assign({}, packageConfig, this.getStaticPackageInfo(packageConfig, packageConfig.name))
139
+ }
133
140
  if(packageConfig.path){
134
141
  const metadata = await loader.getPackageMetadata(util.getPackageRelativePath(process.cwd(), packageConfig.path));
135
142
  const packageYmlData = loader.getPackageYmlData(packageConfig.path);
@@ -189,6 +196,7 @@ module.exports = {
189
196
  const enable = true;
190
197
  return await this.installPackageFromUrl(module, version, url, auth, enable, registry_url, ctx.broker, {fromClient})
191
198
  } catch (error) {
199
+ this.broker.logger.error(`installPackageFromUrl: `, error);
192
200
  let errorInfo = error.message || '';
193
201
  if (error.stderr) {
194
202
  const errors = error.stderr.split('\n');
@@ -421,7 +429,7 @@ module.exports = {
421
429
  if(!_.has(options, 'static')){
422
430
  options.static = true
423
431
  }
424
- loader.appendToPackagesConfig(name, options)
432
+ loader.appendToPackagesConfig(name, options, 'addPackage')
425
433
  await this.installPackagesSyncToMetaData(name);
426
434
  }
427
435
  }