“trap” in json-schema

https://json-schema.org/understanding-json-schema/reference/conditionals.html

Note:

In this example, “country” is not a required property. Because the “if” schema also doesn’t require the “country” property, it will pass and the “then” schema will apply. Therefore, if the “country” property is not defined, the default behavior is to validate “postal_code” as a USA postal code.

The “required” keyword is necessary in the “if” schemas or they would all apply if the “country” is not defined.

所以json schmea默认一个属性如果不存在,居然算是if该属性的条件通过的,然后会进入then环节执行。如果要存在且等于某一个常量,要写成

"if": {
        "properties": { "country": { "const": "Netherlands" } },
        "required": ["country"]
      }

Debugging Angular module

https://www.willtaylor.blog/complete-guide-to-angular-libraries/

https://docs.npmjs.com/cli/v7/commands/npm-link

中文的npm link的使用:https://www.jianshu.com/p/aaa7db89a5b2

https://github.com/angular/angular/issues/37941  别忘了 preserveSymlinks

需要注意的是module的npm link命令要在dist/package-name/ 目录下运行,这样就能把全局的npm/node_modules\@scope(if use scope)\package-name -> c:\workspace\…\dist\package-name 目录映射起来了,windows下会看到快捷方式的图标。然后回到module项目目录下ng build –watch

而应用项目这边,npm link @scope(if use scope)/package-name

该命令将app\node_modules\@scope(if use scope)\package-name和上面的全局目录对应起来,接着再连接到module项目的dist/package-name目录下。于是npm start就可以直接调试和修改了,虽然调试的断点还是js,但是改动会自动编译生效(自动生效有时有问题,可能和回退了ivy有关,尽量用新的版本吧)。

module项目比较老,不会基于ivy引擎的angular 10,这时这要修改tsconfig.lib.json里

angularCompilerOptions{“enableIvy”: true} (假设主app已经是enable Ivy的)

并且,要确保package.json的name要和发布的package name一致,这样Dist下的目录才能和全局npm的模块目录映射起来。

还有,public-api.ts目录中需要export * from ‘./lib/….come component’, 否则主app找不到component.

发布的时候也要到dist/package name目录下执行npm publish —tag beta 如果发布的是prerelease 版本的话。

 

Intel® Wireless-AC 9560 网卡不支持hosted network