[Nx] Note for learning Nx
Proxy configuration:
When we have already fews applications running in the workspace, and we want to add 'api' layer for one applicatrion only, we can use tag
ng g @nrwl/nest:app api --frontendProject=todos
This will only allow 'todos' app to access 'api'.
You passed --frontendProject=todos when creating the node application. What did that argument do?
It created a proxy configuration that allows the Angular application to talk to the API in development.
To see how it works, open angular.json and find the serve target of the todos app.
{
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "todos:build",
"proxyConfig": "apps/todos/proxy.conf.json"
},
"configurations": {
"production": {
"browserTarget": "todos:build:production"
}
}
}
}
Note the proxyConfig property.
Now open proxy.conf.json:
{
"/api": {
"target": "http://localhost:3333",
"secure": false
}
}
This configuration tells ng serve to forward all requests starting with /api to the process listening on port 3333.
Expose the common compoennts from library:
Sometimes, when we create library, we might forget to expose the component, this might lead to few minutes debuggin. To avoid that we can use --export tag
ng g component todos --project=ui --export
Running the tests:
Run npm run affected:apps, and you should see todos printed out. The affected:apps looks at what you have changed and uses the dependency graph to figure out which apps can be affected by this change.
Run npm run affected:libs, and you should see ui printed out. This command works similarly, but instead of printing the affected apps, it prints the affected libs.
Running the tests which failed previously:
npm run affected:test -- --only-failed
Running tests in parallel to speed up:
Some changes affect many projects in the repository. To speed up the testing of this change, pass --parallel.
npm run affected:test -- --parallel
About create NPM module in workspace:
check the source: https://nx.dev/fundamentals/develop-like-google
By default, libraries are only buildable in the context of an application.
To be able to build a library independently, you can pass
--publishablewhen creating it. You can then runng build mylibto build it, and then publish the results to an NPM registry.
[Nx] Note for learning Nx的更多相关文章
- NX二次开发-NX+VS写代码设断点调试技巧
在做NX二次开发的时候写完代码,编译可以通过,但是执行的时候却没有反应,或者得到的结果不对,说明肯定有地方传值出错了.我在查找代码错误的时候有几种方法:1.uc1601打印函数输入和输出的值看对不对. ...
- NX二次开发-bat脚本文件切换NX的环境变量(NX路径和语言)
路径环境变量切换到NX9.bat @echo off setx /M UGII_BASE_DIR "D:\Program Files\Siemens\NX 9.0" ------- ...
- NX二次开发-NX访问SqlServer数据库(增删改查)C#版
版本:NX9+VS2012+SqlServer2008r2 以前我写过一个NX访问MySQL数据库(增删改查)的文章https://www.cnblogs.com/nxopen2018/p/12297 ...
- NX二次开发-NX访问MySQL数据库(增删改查)
版本:NX11+VS2013+MySQL5.6(x64)+SQLyog 1.新建一个NX项目(多字节) 2.设置VC++目录(调用MySQL的头文件,dll和lib库文件) 3.设置番茄助手 然后重启 ...
- C++ (C#)实现获取NX PART预览图
VS环境下 C++版本: 1 int GetPreviewImage(const TCHAR* prtFile, const TCHAR* imageFile) 2 { 3 IStorage* pSt ...
- NX二次开发-自定义添加右键菜单RegisterConfigureContextMenuCallback
首先声明这个知识我以前不知道,是夏天的时候看到别人在唐工的QQ群里问的,唐工说西门子官方有这个例子.那个时候我因为在忙其他事情,也就没去研究那个右键菜单到底是怎么做的.关于自定义添加右键菜单Regis ...
- 【NX二次开发】图标图像
用户定义位图的目录位置的环境变量 UGII_BITMAP_PATH 在NX日志中查看NX图标需要设置的变量 变量名:PRINT_DIALOG_BITMAP_NAMES 变量值:1 查看系统图标的方法1 ...
- 使用.NET(C#或VB.NET)开发NX外部程序
1.如何不用将exe程序拷贝到UGII目录下运行? 答:在调用NX Open命令函数前,将当前目录移动到NX安装目录\UGII\,NX安装目录必须和环境变量UGII_BASE_DIR的值一致,否则报错 ...
- A brief introduction to weakly supervised learning(简要介绍弱监督学习)
by 南大周志华 摘要 监督学习技术通过学习大量训练数据来构建预测模型,其中每个训练样本都有其对应的真值输出.尽管现有的技术已经取得了巨大的成功,但值得注意的是,由于数据标注过程的高成本,很多任务很难 ...
随机推荐
- Spark Scala当中reduceByKey的用法
[学习笔记] /*reduceByKey(function)reduceByKey就是对元素为KV对的RDD中Key相同的元素的Value进行function的reduce操作(如前所述),因此,Ke ...
- 作为小白该如何抉择python编辑器?
刚开始接触编程,有一个好的编辑器上手,那学习起来肯定是事半功倍的!本篇就给大家介绍适合零基础小白学习Python的四种编辑器,希望大家受用! 1.Sublime Text: 这是一个轻量级的代码编辑器 ...
- 13.lsof恢复删除的文件
[root@temp ~]# lsof -p 5643COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEoracle 5643 ...
- hdu 3500 还是搜索
这道题目由于每走一步的时候毛毛球是可以变换的 换言之 主体不唯一 所以这里搜索的设计有变化 再就是几个回溯的过程要注意.,. 小心使得万年船 #include <iostream> #i ...
- javascript常用内置对象——Array对象
Array对象: 创建 Array 对象的语法: new Array(); new Array(元素个数); new Array(element0, element1, ..., elementn); ...
- Python的global指令的作用
Python的global指令的作用 学过其他常用编程语言的同学一定清楚,Python是一个语法非常宽容的语言.它是个变量的定义可以省略.直接赋值.根据赋值结果自动确定变量类型的弱类型语言. 但是这样 ...
- LeetCode:1179.重新格式化部门表
题目链接:https://leetcode-cn.com/problems/reformat-department-table/ 题目 部门表 Department: +--------------- ...
- 14 Django之Form和Model Form组件
一.什么是Form 我们之前在HTML页面中利用form表单向后端提交数据时,都会写一些获取用户输入的标签并且用form标签把它们包起来. 与此同时我们在好多场景下都需要对用户的输入做校验,比如校验用 ...
- SpringCloud多网卡配置(转)
https://blog.csdn.net/lixiang987654321/article/details/88134324 docker部署过程中遇到如下问题: (1)docker容器创建之后,进 ...
- 利用浏览器做好数字进制和ASCII码及Unicode教与学
浏览器是现在个人计算机的标配,一般来说一个PC至少安装一种以上的浏览器.主流网页浏览器有Google Chrome.Internet Explorer.Microsoft Edge.Mozilla F ...