@o3r/schematics 8.2.0-alpha.2 → 8.2.0-alpha.22
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/README.md +8 -203
- package/package.json +9 -9
- package/src/rule-factories/ng-add/index.js +2 -2
- package/src/rule-factories/ng-add/index.js.map +1 -1
- package/src/utility/index.d.ts +1 -0
- package/src/utility/index.d.ts.map +1 -1
- package/src/utility/index.js +1 -0
- package/src/utility/index.js.map +1 -1
- package/src/utility/monorepo.d.ts +17 -0
- package/src/utility/monorepo.d.ts.map +1 -0
- package/src/utility/monorepo.js +30 -0
- package/src/utility/monorepo.js.map +1 -0
package/README.md
CHANGED
|
@@ -1,212 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
<p align="center">
|
|
3
|
-
<img src="./.attachments/logo.png" alt="Super cute Otter!"/>
|
|
4
|
-
</p>
|
|
1
|
+
# Otter schematics
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
<br />
|
|
3
|
+
This package is an [Otter Framework Module](https://github.com/AmadeusITGroup/otter/tree/main/docs/core/MODULE.md).
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
The **Otter** project is a highly modular framework whose goal is to provide a common platform to accelerate and facilitate the development on Angular web applications.
|
|
11
|
-
It is split into several units to cover different aspects of these applications (localization, testing, customization, etc.).
|
|
12
|
-
Also, to customize an application, metadata can be extracted from the application source code and injected into a CMS to manage dynamic configuration.
|
|
13
|
-
|
|
14
|
-
> **Note**: The full documentation is available [here](./docs/README.md).
|
|
15
|
-
|
|
16
|
-
## Built With
|
|
17
|
-
|
|
18
|
-
* [Angular](https://angular.io/)
|
|
19
|
-
* [Typescript](https://www.typescriptlang.org/)
|
|
20
|
-
* [RxJs](http://reactivex.io/rxjs/)
|
|
21
|
-
* [Redux](http://redux.js.org/)
|
|
22
|
-
* [Sass](http://sass-lang.com/)
|
|
23
|
-
* [Nx](https://nx.dev/)
|
|
24
|
-
|
|
25
|
-
## Get Started
|
|
26
|
-
|
|
27
|
-
A new application can be set up with these simple commands:
|
|
28
|
-
|
|
29
|
-
```shell
|
|
30
|
-
# Starting a new angular application
|
|
31
|
-
npm install -g @angular/cli
|
|
32
|
-
ng new my-app
|
|
33
|
-
|
|
34
|
-
# Add Otter framework
|
|
35
|
-
ng add @o3r/core
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
> **Note**: Please refer to [Otter Get Started](./docs/core/START_NEW_APPLICATION.md) and [Angular Get Started](https://angular.io/guide/setup-local#install-the-angular-cli) for complete documentation.
|
|
39
|
-
|
|
40
|
-
## Contributing
|
|
41
|
-
|
|
42
|
-
Please read the [Contributing](./CONTRIBUTING.md) file for details on our code of conduct and the process to submit pull requests.
|
|
43
|
-
|
|
44
|
-
## Versioning
|
|
45
|
-
|
|
46
|
-
Please refer to [Security file](./SECURITY.md).
|
|
47
|
-
|
|
48
|
-
## License
|
|
49
|
-
|
|
50
|
-
Please refer to the [License file](./LICENSE).
|
|
51
|
-
|
|
52
|
-
## Acknowledgments
|
|
53
|
-
|
|
54
|
-
The Otter Team, @AmadeusITGroup/otter_admins, is responsible for the review of the code of this repository.
|
|
55
|
-
Any bug of feature request can be addressed via [issue](https://github.com/AmadeusITGroup/otter/issues/new) report.
|
|
56
|
-
|
|
57
|
-
## Developer
|
|
58
|
-
|
|
59
|
-
### Building and Testing library
|
|
60
|
-
|
|
61
|
-
These documents describe how to set up your development environment to build and test the framework.
|
|
62
|
-
It also explains the basic mechanics of using `git`, `node`, and `npm`.
|
|
63
|
-
|
|
64
|
-
- [Description](#description)
|
|
65
|
-
- [Built With](#built-with)
|
|
66
|
-
- [Get Started](#get-started)
|
|
67
|
-
- [Contributing](#contributing)
|
|
68
|
-
- [Versioning](#versioning)
|
|
69
|
-
- [License](#license)
|
|
70
|
-
- [Acknowledgments](#acknowledgments)
|
|
71
|
-
- [Developer](#developer)
|
|
72
|
-
- [Building and Testing library](#building-and-testing-library)
|
|
73
|
-
- [Prerequisite Software](#prerequisite-software)
|
|
74
|
-
- [Getting the Sources](#getting-the-sources)
|
|
75
|
-
- [Installing NPM Modules](#installing-npm-modules)
|
|
76
|
-
- [Build command](#build-command)
|
|
77
|
-
- [Running tests locally](#running-tests-locally)
|
|
78
|
-
- [Manage task cache](#manage-task-cache)
|
|
79
|
-
- [Debugging with Visual Studio Code](#debugging-with-visual-studio-code)
|
|
80
|
-
- [Link local packages](#link-local-packages)
|
|
81
|
-
|
|
82
|
-
Refer to the [contribution guidelines](./CONTRIBUTING.md)
|
|
83
|
-
if you'd like to contribute to the framework.
|
|
84
|
-
|
|
85
|
-
#### Prerequisite Software
|
|
86
|
-
|
|
87
|
-
Before you can build and test Otter modules, you must install and configure the
|
|
88
|
-
following products on your development machine:
|
|
89
|
-
|
|
90
|
-
* [Git](http://git-scm.com) and/or the **GitHub app** (for [Mac](http://mac.github.com) or
|
|
91
|
-
[Windows](http://windows.github.com))
|
|
92
|
-
* [GitHub's Guide to Installing
|
|
93
|
-
Git](https://help.github.com/articles/set-up-git) is a good source of information.
|
|
94
|
-
|
|
95
|
-
* [Node.js](http://nodejs.org), (version `>=10.0.0`)
|
|
96
|
-
* This is used to run tests and generate distributable files. We also use Node's Package Manager, `npm`
|
|
97
|
-
(version `>3.8.x`), which comes with Node. Depending on your system, you can install Node either from
|
|
98
|
-
source or as a pre-packaged bundle.
|
|
99
|
-
|
|
100
|
-
* [Yarn](https://yarnpkg.com/lang/en/docs/install/), a Node's Package Manager
|
|
101
|
-
* You can install yarn using NPM manager (coming with Node.js).
|
|
102
|
-
The version of Yarn currently used is embedded in the repository. In case you need to link this library with your project, you can check the section "Link local packages".
|
|
103
|
-
|
|
104
|
-
* [Chrome](https://www.google.com/chrome/browser/desktop/index.html)
|
|
105
|
-
* We use Chrome to run our tests.
|
|
106
|
-
|
|
107
|
-
#### Getting the sources
|
|
108
|
-
|
|
109
|
-
Clone the Otter repository using the button `Code` or using the following git command:
|
|
110
|
-
|
|
111
|
-
```shell
|
|
112
|
-
git clone https://github.com/AmadeusITGroup/otter.git
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
#### Installing NPM modules
|
|
116
|
-
|
|
117
|
-
Next, install the JavaScript modules needed to build:
|
|
118
|
-
|
|
119
|
-
```shell
|
|
120
|
-
# Install library project dependencies (package.json)
|
|
121
|
-
yarn install
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
#### Build command
|
|
125
|
-
|
|
126
|
-
To build the modules, run:
|
|
127
|
-
|
|
128
|
-
```shell
|
|
129
|
-
yarn run build
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Each module can be built independently thanks to [Nx](https://nx.dev/packages/nx/documents/run) commands:
|
|
133
|
-
|
|
134
|
-
```shell
|
|
135
|
-
# ex: Build Core package only
|
|
136
|
-
yarn nx build core
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
> **Note**: Results are put in the `dist` of each module (`packages/@<scope>/<module>/dist`).
|
|
140
|
-
|
|
141
|
-
#### Running tests locally
|
|
142
|
-
|
|
143
|
-
Check the formatting:
|
|
144
|
-
|
|
145
|
-
```shell
|
|
146
|
-
yarn run lint
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Check Unit Tests:
|
|
150
|
-
|
|
151
|
-
```shell
|
|
152
|
-
yarn run test
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Each module can be test independently thanks to [Nx](https://nx.dev/packages/nx/documents/run) commands:
|
|
156
|
-
|
|
157
|
-
```shell
|
|
158
|
-
# ex: Test Core package only
|
|
159
|
-
yarn nx test core
|
|
160
|
-
|
|
161
|
-
# ex: Lint Core package only
|
|
162
|
-
yarn nx lint core
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
#### Manage task cache
|
|
5
|
+
This module provides basic utilities and generic rules (install, lint) reused in other package schematics.
|
|
166
6
|
|
|
167
|
-
|
|
168
|
-
In some cases, it may be useful to clear the cache to investigate an issue. This can be done with the following command:
|
|
7
|
+
## How to install
|
|
169
8
|
|
|
170
9
|
```shell
|
|
171
|
-
|
|
10
|
+
ng add @o3r/schematics
|
|
172
11
|
```
|
|
173
12
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
The repository contains the mandatory configuration and the recommended VSCode plugins to ensure optimal comfort and productivity while developing on the Otter Framework.
|
|
177
|
-
|
|
178
|
-
The default configuration of the repository provides a way to run Unit Tests one by one and to define, within VSCode, break points using the `vscode-jest-tests` debugger task.
|
|
179
|
-
|
|
180
|
-
#### Link local packages
|
|
13
|
+
> **Warning**: this module requires [@o3r/core](https://www.npmjs.com/package/@o3r/core) to be installed.
|
|
181
14
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
NOTE: It will not import the transitive dependencies of the linked packages.
|
|
185
|
-
|
|
186
|
-
Example:
|
|
187
|
-
|
|
188
|
-
```json
|
|
189
|
-
{
|
|
190
|
-
"resolutions": {
|
|
191
|
-
"@o3r/localization": "./relative/path/to/otter/packages/@o3r/localization/dist",
|
|
192
|
-
"@o3r/core": "link:./relative/path/to/otter/packages/@o3r/core/dist",
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
For Yarn v2+, the protocol `portal:` can also be used.
|
|
198
|
-
|
|
199
|
-
NOTE: The portal protocol will also import all the transitive dependencies of the linked packages.
|
|
200
|
-
Please keep in mind that mismatched versions of these dependencies may cause some issues.
|
|
201
|
-
|
|
202
|
-
Example:
|
|
15
|
+
## Description
|
|
203
16
|
|
|
204
|
-
|
|
205
|
-
{
|
|
206
|
-
"resolutions": {
|
|
207
|
-
"@o3r/localization": "./relative/path/to/otter/library/@o3r/localization/dist",
|
|
208
|
-
"@o3r/core": "link:./relative/path/to/otter/library/@o3r/core/dist",
|
|
209
|
-
"@o3r/rules-engine": "portal:./relative/path/to/otter/library/@o3r/rules-engine/dist",
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
```
|
|
17
|
+
This is a technical package to be used as dependency by [Otter modules](https://github.com/AmadeusITGroup/otter/tree/main/docs/core/MODULE.md) providing helpers to used in [Schematics](https://angular.io/guide/schematics) development.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/schematics",
|
|
3
|
-
"version": "8.2.0-alpha.
|
|
3
|
+
"version": "8.2.0-alpha.22",
|
|
4
4
|
"description": "Schematics module of the Otter framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@o3r/dev-tools": "^8.2.0-alpha.
|
|
31
|
+
"@o3r/dev-tools": "^8.2.0-alpha.22",
|
|
32
32
|
"comment-json": "^4.1.0",
|
|
33
33
|
"globby": "^11.1.0",
|
|
34
34
|
"minimatch": "^6.1.6",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@angular/core": "~15.2.0",
|
|
48
48
|
"@angular/platform-browser": "~15.2.0",
|
|
49
49
|
"@angular/platform-browser-dynamic": "~15.2.0",
|
|
50
|
-
"@nrwl/cli": "~15.
|
|
51
|
-
"@nrwl/jest": "~15.
|
|
52
|
-
"@nrwl/js": "~15.
|
|
53
|
-
"@nrwl/linter": "~15.
|
|
54
|
-
"@o3r/build-helpers": "^8.2.0-alpha.
|
|
55
|
-
"@o3r/eslint-plugin": "^8.2.0-alpha.
|
|
50
|
+
"@nrwl/cli": "~15.9.0",
|
|
51
|
+
"@nrwl/jest": "~15.9.0",
|
|
52
|
+
"@nrwl/js": "~15.9.0",
|
|
53
|
+
"@nrwl/linter": "~15.9.0",
|
|
54
|
+
"@o3r/build-helpers": "^8.2.0-alpha.22",
|
|
55
|
+
"@o3r/eslint-plugin": "^8.2.0-alpha.22",
|
|
56
56
|
"@schematics/angular": "~15.2.0",
|
|
57
57
|
"@types/jest": "~28.1.2",
|
|
58
58
|
"@types/node": "^17.0.45",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"jest": "~28.1.1",
|
|
70
70
|
"jest-junit": "^14.0.0",
|
|
71
71
|
"jsonschema": "~1.4.1",
|
|
72
|
-
"nx": "~15.
|
|
72
|
+
"nx": "~15.9.0",
|
|
73
73
|
"rxjs": "^7.4.0",
|
|
74
74
|
"ts-jest": "^28.0.5",
|
|
75
75
|
"type-fest": "^3.6.1",
|
|
@@ -18,7 +18,7 @@ function ngAddPackages(packages, options) {
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
return async (
|
|
21
|
+
return async (tree, context) => {
|
|
22
22
|
if (packages.length > 0) {
|
|
23
23
|
context.logger.info(`'${options?.parentPackageInfo || ''}' - 'ng add' has been launched for the following packages:`);
|
|
24
24
|
for (const packageName of packages) {
|
|
@@ -29,7 +29,7 @@ function ngAddPackages(packages, options) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
return;
|
|
32
|
+
return () => tree;
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
exports.ngAddPackages = ngAddPackages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AACA,6CAA8E;AAE9E;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,QAAkB,EAAE,OAA6B;IAC7E,MAAM,mBAAmB,GAAG,KAAK,EAAE,WAAmB,EAAE,EAAE;;QACxD,IAAI;YACF,OAAO,CAAC,YAAa,GAAG,WAAW,eAAe,4CAAC,CAAC,CAAC,OAAO,CAAC;SAC9D;QAAC,OAAO,CAAC,EAAE;YACV,OAAO;SACR;IACH,CAAC,CAAC;IACF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AACA,6CAA8E;AAE9E;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,QAAkB,EAAE,OAA6B;IAC7E,MAAM,mBAAmB,GAAG,KAAK,EAAE,WAAmB,EAAE,EAAE;;QACxD,IAAI;YACF,OAAO,CAAC,YAAa,GAAG,WAAW,eAAe,4CAAC,CAAC,CAAC,OAAO,CAAC;SAC9D;QAAC,OAAO,CAAC,EAAE;YACV,OAAO;SACR;IACH,CAAC,CAAC;IACF,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,OAAO,EAAE,iBAAiB,IAAI,EAAE,4DAA4D,CAAC,CAAC;YACtH,KAAK,MAAM,WAAW,IAAI,QAAQ,EAAE;gBAClC,MAAM,gBAAgB,GAAG,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC;gBAChE,IAAI,CAAC,gBAAgB,IAAI,OAAO,EAAE,OAAO,KAAK,gBAAgB,EAAE;oBAC9D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,WAAW,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBACxH,OAAO,CAAC,OAAO,CAAC,IAAI,4BAAoB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;iBACjE;aACF;SACF;QACD,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AArBD,sCAqBC"}
|
package/src/utility/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
|
package/src/utility/index.js
CHANGED
|
@@ -13,4 +13,5 @@ tslib_1.__exportStar(require("./sub-entry"), exports);
|
|
|
13
13
|
tslib_1.__exportStar(require("./template-property.helper"), exports);
|
|
14
14
|
tslib_1.__exportStar(require("./matching-peers"), exports);
|
|
15
15
|
tslib_1.__exportStar(require("./package-version"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./monorepo"), exports);
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
package/src/utility/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,yDAA+B;AAC/B,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,oDAA0B;AAC1B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,4DAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,yDAA+B;AAC/B,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,oDAA0B;AAC1B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,4DAAkC;AAClC,qDAA2B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* Find the relative path to a configuration file at the monorepo root
|
|
4
|
+
*
|
|
5
|
+
* @param tree
|
|
6
|
+
* @param files List of files to look for, the first of the list will used
|
|
7
|
+
* @param originPath Path from where to calculate the relative path
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function findConfigFileRelativePath(tree: Tree, files: string[], originPath: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Determine if we are in an Nx Monorepo context
|
|
13
|
+
*
|
|
14
|
+
* @param tree
|
|
15
|
+
*/
|
|
16
|
+
export declare function isNxContext(tree: Tree): boolean;
|
|
17
|
+
//# sourceMappingURL=monorepo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monorepo.d.ts","sourceRoot":"","sources":["../../../src/utility/monorepo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGvD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,UAOzF;AACD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,WAErC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNxContext = exports.findConfigFileRelativePath = void 0;
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
/**
|
|
6
|
+
* Find the relative path to a configuration file at the monorepo root
|
|
7
|
+
*
|
|
8
|
+
* @param tree
|
|
9
|
+
* @param files List of files to look for, the first of the list will used
|
|
10
|
+
* @param originPath Path from where to calculate the relative path
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
function findConfigFileRelativePath(tree, files, originPath) {
|
|
14
|
+
const foundFile = files.find((file) => tree.exists(`/${file}`));
|
|
15
|
+
if (foundFile === undefined) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
return path.posix.relative(originPath, `/${foundFile}`);
|
|
19
|
+
}
|
|
20
|
+
exports.findConfigFileRelativePath = findConfigFileRelativePath;
|
|
21
|
+
/**
|
|
22
|
+
* Determine if we are in an Nx Monorepo context
|
|
23
|
+
*
|
|
24
|
+
* @param tree
|
|
25
|
+
*/
|
|
26
|
+
function isNxContext(tree) {
|
|
27
|
+
return tree.exists('/nx.json');
|
|
28
|
+
}
|
|
29
|
+
exports.isNxContext = isNxContext;
|
|
30
|
+
//# sourceMappingURL=monorepo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monorepo.js","sourceRoot":"","sources":["../../../src/utility/monorepo.ts"],"names":[],"mappings":";;;AACA,kCAAkC;AAElC;;;;;;;GAOG;AACH,SAAgB,0BAA0B,CAAC,IAAU,EAAE,KAAe,EAAE,UAAkB;IACxF,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IAChE,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO,EAAE,CAAC;KACX;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,SAAS,EAAE,CAAC,CAAC;AAC1D,CAAC;AAPD,gEAOC;AACD;;;;GAIG;AACH,SAAgB,WAAW,CAAC,IAAU;IACpC,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC;AAFD,kCAEC"}
|