@trackunit/iris-app 0.0.1-alpha-ce456b7c2.0
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/CHANGELOG.md +209 -0
- package/README.md +21 -0
- package/executors.json +20 -0
- package/generators.json +17 -0
- package/package.json +31 -0
- package/src/executors/build/executor.d.ts +9 -0
- package/src/executors/build/executor.js +49 -0
- package/src/executors/build/executor.js.map +1 -0
- package/src/executors/build/schema.d.ts +4 -0
- package/src/executors/build/schema.json +19 -0
- package/src/executors/publish/executor.d.ts +4 -0
- package/src/executors/publish/executor.js +126 -0
- package/src/executors/publish/executor.js.map +1 -0
- package/src/executors/publish/schema.d.ts +3 -0
- package/src/executors/publish/schema.json +19 -0
- package/src/executors/serve/executor.d.ts +4 -0
- package/src/executors/serve/executor.js +42 -0
- package/src/executors/serve/executor.js.map +1 -0
- package/src/executors/serve/schema.d.ts +3 -0
- package/src/executors/serve/schema.json +19 -0
- package/src/executors/utils/checkPackageVersion.d.ts +1 -0
- package/src/executors/utils/checkPackageVersion.js +51 -0
- package/src/executors/utils/checkPackageVersion.js.map +1 -0
- package/src/executors/utils/defaultWebpackConfig.d.ts +4 -0
- package/src/executors/utils/defaultWebpackConfig.js +144 -0
- package/src/executors/utils/defaultWebpackConfig.js.map +1 -0
- package/src/executors/utils/src/index.js +1 -0
- package/src/generators/create/files/assets/description.md +3 -0
- package/src/generators/create/files/iris-app-manifest.ts__template__ +27 -0
- package/src/generators/create/files/package.json__template__ +4 -0
- package/src/generators/create/files/src/index.ts__template__ +0 -0
- package/src/generators/create/files/tailwind.config.js__template__ +11 -0
- package/src/generators/create/files/tsconfig.app.json__template__ +21 -0
- package/src/generators/create/files/tsconfig.json__template__ +22 -0
- package/src/generators/create/files/webpack.config.ts__template__ +5 -0
- package/src/generators/create/generator.d.ts +4 -0
- package/src/generators/create/generator.js +120 -0
- package/src/generators/create/generator.js.map +1 -0
- package/src/generators/create/schema.d.ts +4 -0
- package/src/generators/create/schema.json +25 -0
- package/src/generators/extend/files/ADMIN_EXTENSION/extension-manifest.ts__template__ +13 -0
- package/src/generators/extend/files/ASSET_HOME_EXTENSION/extension-manifest.ts__template__ +13 -0
- package/src/generators/extend/files/FLEET_EXTENSION/extension-manifest.ts__template__ +14 -0
- package/src/generators/extend/files/REPORT_EXTENSION/extension-manifest.ts__template__ +10 -0
- package/src/generators/extend/files/react-app/src/app.spec.tsx__template__ +9 -0
- package/src/generators/extend/files/react-app/src/app.tsx__template__ +33 -0
- package/src/generators/extend/files/react-app/src/index.tsx__template__ +27 -0
- package/src/generators/extend/generator.d.ts +4 -0
- package/src/generators/extend/generator.js +143 -0
- package/src/generators/extend/generator.js.map +1 -0
- package/src/generators/extend/schema.d.ts +7 -0
- package/src/generators/extend/schema.json +54 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +8 -0
- package/src/index.js.map +1 -0
- package/src/utils/addDevDependency.d.ts +3 -0
- package/src/utils/addDevDependency.js +39 -0
- package/src/utils/addDevDependency.js.map +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
|
+
|
|
5
|
+
### [0.0.1-alpha-ce456b7c2.0](https://github.com/Trackunit/manager/compare/iris-app/0.0.118...iris-app/0.0.1-alpha-ce456b7c2.0) (2022-10-11)
|
|
6
|
+
|
|
7
|
+
### [0.0.118](https://github.com/Trackunit/manager/compare/iris-app/0.0.117...iris-app/0.0.118) (2022-10-06)
|
|
8
|
+
|
|
9
|
+
### [0.0.117](https://github.com/Trackunit/manager/compare/iris-app/0.0.116...iris-app/0.0.117) (2022-10-06)
|
|
10
|
+
|
|
11
|
+
### Dependency Updates
|
|
12
|
+
|
|
13
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
14
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
15
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
16
|
+
### [0.0.116](https://github.com/Trackunit/manager/compare/iris-app/0.0.115...iris-app/0.0.116) (2022-10-05)
|
|
17
|
+
|
|
18
|
+
### [0.0.115](https://github.com/Trackunit/manager/compare/iris-app/0.0.114...iris-app/0.0.115) (2022-10-03)
|
|
19
|
+
|
|
20
|
+
### Dependency Updates
|
|
21
|
+
|
|
22
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
23
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
24
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
25
|
+
### [0.0.114](https://github.com/Trackunit/manager/compare/iris-app/0.0.113...iris-app/0.0.114) (2022-09-26)
|
|
26
|
+
|
|
27
|
+
### Dependency Updates
|
|
28
|
+
|
|
29
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
30
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
31
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
32
|
+
### [0.0.113](https://github.com/Trackunit/manager/compare/iris-app/0.0.112...iris-app/0.0.113) (2022-09-16)
|
|
33
|
+
|
|
34
|
+
### Dependency Updates
|
|
35
|
+
|
|
36
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
37
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
38
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
39
|
+
### [0.0.112](https://github.com/Trackunit/manager/compare/iris-app/0.0.111...iris-app/0.0.112) (2022-09-15)
|
|
40
|
+
|
|
41
|
+
### Dependency Updates
|
|
42
|
+
|
|
43
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
44
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
45
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
46
|
+
### [0.0.111](https://github.com/Trackunit/manager/compare/iris-app/0.0.110...iris-app/0.0.111) (2022-09-13)
|
|
47
|
+
|
|
48
|
+
### Dependency Updates
|
|
49
|
+
|
|
50
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
51
|
+
### [0.0.110](https://github.com/Trackunit/manager/compare/iris-app/0.0.109...iris-app/0.0.110) (2022-09-12)
|
|
52
|
+
|
|
53
|
+
### Dependency Updates
|
|
54
|
+
|
|
55
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
56
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
57
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
58
|
+
### [0.0.109](https://github.com/Trackunit/manager/compare/iris-app/0.0.108...iris-app/0.0.109) (2022-09-12)
|
|
59
|
+
|
|
60
|
+
### Dependency Updates
|
|
61
|
+
|
|
62
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
63
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
64
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
65
|
+
|
|
66
|
+
### Reverts
|
|
67
|
+
|
|
68
|
+
* Revert "ci: bump iris-app to 0.0.109-alpha-61732b8ce.0 [skip ci]" ([a4cf66d](https://github.com/Trackunit/manager/commit/a4cf66df50677042e4089aacf1d55ffb6b2b2065))
|
|
69
|
+
|
|
70
|
+
### [0.0.108](https://github.com/Trackunit/manager/compare/iris-app/0.0.107...iris-app/0.0.108) (2022-09-08)
|
|
71
|
+
|
|
72
|
+
### Dependency Updates
|
|
73
|
+
|
|
74
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
75
|
+
### [0.0.107](https://github.com/Trackunit/manager/compare/iris-app/0.0.106...iris-app/0.0.107) (2022-09-02)
|
|
76
|
+
|
|
77
|
+
### Dependency Updates
|
|
78
|
+
|
|
79
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
80
|
+
### [0.0.106](https://github.com/Trackunit/manager/compare/iris-app/0.0.105...iris-app/0.0.106) (2022-08-30)
|
|
81
|
+
|
|
82
|
+
### Dependency Updates
|
|
83
|
+
|
|
84
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
85
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
86
|
+
### [0.0.105](https://github.com/Trackunit/manager/compare/iris-app/0.0.104...iris-app/0.0.105) (2022-08-25)
|
|
87
|
+
|
|
88
|
+
### Dependency Updates
|
|
89
|
+
|
|
90
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
91
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
92
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
93
|
+
### [0.0.104](https://github.com/Trackunit/manager/compare/iris-app/0.0.103...iris-app/0.0.104) (2022-08-22)
|
|
94
|
+
|
|
95
|
+
### [0.0.103](https://github.com/Trackunit/manager/compare/iris-app/0.0.102...iris-app/0.0.103) (2022-08-18)
|
|
96
|
+
|
|
97
|
+
### [0.0.102](https://github.com/Trackunit/manager/compare/iris-app/0.0.101...iris-app/0.0.102) (2022-08-17)
|
|
98
|
+
|
|
99
|
+
### Dependency Updates
|
|
100
|
+
|
|
101
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
102
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
103
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
104
|
+
### [0.0.101](https://github.com/Trackunit/manager/compare/iris-app/0.0.100...iris-app/0.0.101) (2022-08-12)
|
|
105
|
+
|
|
106
|
+
### Dependency Updates
|
|
107
|
+
|
|
108
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
109
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
110
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
111
|
+
### [0.0.100](https://github.com/Trackunit/manager/compare/iris-app/0.0.99...iris-app/0.0.100) (2022-08-05)
|
|
112
|
+
|
|
113
|
+
### Dependency Updates
|
|
114
|
+
|
|
115
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
116
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
117
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
118
|
+
### [0.0.99](https://github.com/Trackunit/manager/compare/iris-app/0.0.98...iris-app/0.0.99) (2022-08-04)
|
|
119
|
+
|
|
120
|
+
### Dependency Updates
|
|
121
|
+
|
|
122
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
123
|
+
### [0.0.98](https://github.com/Trackunit/manager/compare/iris-app/0.0.97...iris-app/0.0.98) (2022-07-29)
|
|
124
|
+
|
|
125
|
+
### Dependency Updates
|
|
126
|
+
|
|
127
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
128
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
129
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
130
|
+
### [0.0.97](https://github.com/Trackunit/manager/compare/iris-app/0.0.96...iris-app/0.0.97) (2022-07-29)
|
|
131
|
+
|
|
132
|
+
### Dependency Updates
|
|
133
|
+
|
|
134
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
135
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
136
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
137
|
+
### [0.0.96](https://github.com/Trackunit/manager/compare/iris-app/0.0.95...iris-app/0.0.96) (2022-07-25)
|
|
138
|
+
|
|
139
|
+
### Dependency Updates
|
|
140
|
+
|
|
141
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
142
|
+
### [0.0.95](https://github.com/Trackunit/manager/compare/iris-app/0.0.94...iris-app/0.0.95) (2022-07-25)
|
|
143
|
+
|
|
144
|
+
### [0.0.94](https://github.com/Trackunit/manager/compare/iris-app/0.0.93...iris-app/0.0.94) (2022-07-08)
|
|
145
|
+
|
|
146
|
+
### [0.0.93](https://github.com/Trackunit/manager/compare/iris-app/0.0.92...iris-app/0.0.93) (2022-07-05)
|
|
147
|
+
|
|
148
|
+
### Dependency Updates
|
|
149
|
+
|
|
150
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
151
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
152
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
153
|
+
### [0.0.92](https://github.com/Trackunit/manager/compare/iris-app/0.0.91...iris-app/0.0.92) (2022-06-30)
|
|
154
|
+
|
|
155
|
+
### [0.0.91](https://github.com/Trackunit/manager/compare/iris-app/0.0.90...iris-app/0.0.91) (2022-06-29)
|
|
156
|
+
|
|
157
|
+
### [0.0.90](https://github.com/Trackunit/manager/compare/iris-app/0.0.89...iris-app/0.0.90) (2022-06-28)
|
|
158
|
+
|
|
159
|
+
### [0.0.89](https://github.com/Trackunit/manager/compare/iris-app/0.0.88...iris-app/0.0.89) (2022-06-28)
|
|
160
|
+
|
|
161
|
+
### Dependency Updates
|
|
162
|
+
|
|
163
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
164
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
165
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
166
|
+
### [0.0.88](https://github.com/Trackunit/manager/compare/iris-app/0.0.87...iris-app/0.0.88) (2022-06-27)
|
|
167
|
+
|
|
168
|
+
### Dependency Updates
|
|
169
|
+
|
|
170
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
171
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
172
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
173
|
+
### [0.0.87](https://github.com/Trackunit/manager/compare/iris-app/0.0.86...iris-app/0.0.87) (2022-06-27)
|
|
174
|
+
|
|
175
|
+
### Dependency Updates
|
|
176
|
+
|
|
177
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
178
|
+
### [0.0.86](https://github.com/Trackunit/manager/compare/iris-app/0.0.85...iris-app/0.0.86) (2022-06-26)
|
|
179
|
+
|
|
180
|
+
### Dependency Updates
|
|
181
|
+
|
|
182
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
183
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
184
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
185
|
+
### [0.0.85](https://github.com/Trackunit/manager/compare/iris-app/0.0.84...iris-app/0.0.85) (2022-06-24)
|
|
186
|
+
|
|
187
|
+
### [0.0.84](https://github.com/Trackunit/manager/compare/iris-app/0.0.83...iris-app/0.0.84) (2022-06-24)
|
|
188
|
+
|
|
189
|
+
### [0.0.83](https://github.com/Trackunit/manager/compare/iris-app/0.0.82...iris-app/0.0.83) (2022-06-23)
|
|
190
|
+
|
|
191
|
+
### [0.0.82](https://github.com/Trackunit/manager/compare/iris-app/0.0.81...iris-app/0.0.82) (2022-06-23)
|
|
192
|
+
|
|
193
|
+
### Dependency Updates
|
|
194
|
+
|
|
195
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
196
|
+
### [0.0.81](https://github.com/Trackunit/manager/compare/iris-app/0.0.80...iris-app/0.0.81) (2022-06-23)
|
|
197
|
+
|
|
198
|
+
### Dependency Updates
|
|
199
|
+
|
|
200
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
201
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
202
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
|
203
|
+
### [0.0.80](https://github.com/Trackunit/manager/compare/iris-app/0.0.79...iris-app/0.0.80) (2022-06-20)
|
|
204
|
+
|
|
205
|
+
### Dependency Updates
|
|
206
|
+
|
|
207
|
+
* `iris-app-build-utilities` updated to version `0.0.1`
|
|
208
|
+
* `iris-app-api` updated to version `0.0.1`
|
|
209
|
+
* `iris-app-webpack-plugin` updated to version `0.0.1`
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
> **ā ļø Beta**
|
|
3
|
+
>
|
|
4
|
+
> This is a beta version and subject to change without notice.
|
|
5
|
+
|
|
6
|
+
# Trackunit Iris App SDK
|
|
7
|
+
|
|
8
|
+
The `@trackunit/iris-app` package is a plugin for [NX by @nrwl](https://nx.dev/).
|
|
9
|
+
This plugin adds some helpful generators used to set up a Trackunit Iris App project.
|
|
10
|
+
|
|
11
|
+
Trackunit Iris App SDK are used by developers to integrate custom functionality into [the Trackunit Manager platform](https://www.trackunit.com/services/manager/).
|
|
12
|
+
|
|
13
|
+
For more info and a full guide on Iris App SDK Development, please visit our [Developer Hub](https://developers.trackunit.com/).
|
|
14
|
+
## Getting started
|
|
15
|
+
|
|
16
|
+
Run through the easy getting started guide here: [Getting Started](https://developers.trackunit.com/docs/getting-started)
|
|
17
|
+
## Trackunit
|
|
18
|
+
This package was developed by Trackunit ApS.
|
|
19
|
+
Trackunit is the leading SaaS-based IoT solution for the construction industry, offering an ecosystem of hardware, fleet management software & telematics.
|
|
20
|
+
|
|
21
|
+

|
package/executors.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"executors": {
|
|
4
|
+
"serve": {
|
|
5
|
+
"implementation": "./src/executors/serve/executor",
|
|
6
|
+
"schema": "./src/executors/serve/schema.json",
|
|
7
|
+
"description": "serve executor"
|
|
8
|
+
},
|
|
9
|
+
"build": {
|
|
10
|
+
"implementation": "./src/executors/build/executor",
|
|
11
|
+
"schema": "./src/executors/build/schema.json",
|
|
12
|
+
"description": "build executor"
|
|
13
|
+
},
|
|
14
|
+
"publish": {
|
|
15
|
+
"implementation": "./src/executors/publish/executor",
|
|
16
|
+
"schema": "./src/executors/publish/schema.json",
|
|
17
|
+
"description": "publish executor"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
package/generators.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"name": "app",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"generators": {
|
|
6
|
+
"create": {
|
|
7
|
+
"factory": "./src/generators/create/generator",
|
|
8
|
+
"schema": "./src/generators/create/schema.json",
|
|
9
|
+
"description": "Iris App generator"
|
|
10
|
+
},
|
|
11
|
+
"extend": {
|
|
12
|
+
"factory": "./src/generators/extend/generator",
|
|
13
|
+
"schema": "./src/generators/extend/schema.json",
|
|
14
|
+
"description": "Iris App extension generator"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@trackunit/iris-app",
|
|
3
|
+
"version": "0.0.1-alpha-ce456b7c2.0",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"generators": "./generators.json",
|
|
7
|
+
"executors": "./executors.json",
|
|
8
|
+
"repository": "https://github.com/Trackunit/manager",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"postcss": "^8.4.16",
|
|
11
|
+
"react": "17.0.2",
|
|
12
|
+
"react-dom": "17.0.2",
|
|
13
|
+
"echarts": "^5.4.0",
|
|
14
|
+
"penpal": "^6.2.2",
|
|
15
|
+
"babel-plugin-styled-components": "1.13.3",
|
|
16
|
+
"@trackunit/iris-app-build-utilities": "0.0.57",
|
|
17
|
+
"tsconfig-paths": "^3.14.1",
|
|
18
|
+
"typescript": "4.7.3",
|
|
19
|
+
"@trackunit/iris-app-api": "0.0.52",
|
|
20
|
+
"node-fetch": "^2.6.7",
|
|
21
|
+
"libnpmpublish": "^6.0.5",
|
|
22
|
+
"open": "^8.4.0",
|
|
23
|
+
"pacote": "^13.6.2",
|
|
24
|
+
"semver": "^7.3.7",
|
|
25
|
+
"@trackunit/iris-app-webpack-plugin": "0.0.56",
|
|
26
|
+
"enquirer": "^2.3.6",
|
|
27
|
+
"tslib": "^2.4.0"
|
|
28
|
+
},
|
|
29
|
+
"types": "./src/index.d.ts",
|
|
30
|
+
"peerDependencies": {}
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExecutorContext } from "@nrwl/devkit";
|
|
2
|
+
import "webpack-dev-server";
|
|
3
|
+
import { BuildExecutorSchema } from "./schema";
|
|
4
|
+
export declare type NodeBuildEvent = {
|
|
5
|
+
outfile: string;
|
|
6
|
+
success: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function deleteOutputDir(root: string, outputPath: string): void;
|
|
9
|
+
export default function (options: BuildExecutorSchema, context: ExecutorContext): AsyncGenerator<any, any, undefined>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteOutputDir = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const rxjs_for_await_1 = require("@nrwl/devkit/src/utils/rxjs-for-await");
|
|
6
|
+
const operators_1 = require("@nrwl/webpack/node_modules/rxjs/operators");
|
|
7
|
+
const run_webpack_1 = require("@nrwl/webpack/src/executors/webpack/lib/run-webpack");
|
|
8
|
+
const iris_app_build_utilities_1 = require("@trackunit/iris-app-build-utilities");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
require("webpack-dev-server");
|
|
12
|
+
const checkPackageVersion_1 = tslib_1.__importDefault(require("../utils/checkPackageVersion"));
|
|
13
|
+
const defaultWebpackConfig_1 = require("../utils/defaultWebpackConfig");
|
|
14
|
+
function deleteOutputDir(root, outputPath) {
|
|
15
|
+
const resolvedOutputPath = (0, path_1.resolve)(root, outputPath);
|
|
16
|
+
if (resolvedOutputPath === root) {
|
|
17
|
+
throw new Error("Output path MUST not be project root directory!");
|
|
18
|
+
}
|
|
19
|
+
(0, fs_1.rmSync)(resolvedOutputPath, { recursive: true, force: true });
|
|
20
|
+
}
|
|
21
|
+
exports.deleteOutputDir = deleteOutputDir;
|
|
22
|
+
async function* default_1(options, context) {
|
|
23
|
+
await (0, checkPackageVersion_1.default)();
|
|
24
|
+
const projectRootDir = (0, path_1.join)(context.root, context.workspace.projects[context.projectName].root);
|
|
25
|
+
const tileManifestPath = (0, path_1.join)(context.root, context.workspace.projects[context.projectName].root, "iris-app-manifest.ts");
|
|
26
|
+
(0, iris_app_build_utilities_1.enableTsConfigPath)({
|
|
27
|
+
projectRootDir,
|
|
28
|
+
});
|
|
29
|
+
if (!options.webpackConfig) {
|
|
30
|
+
throw new Error("option.webpackConfig is required");
|
|
31
|
+
}
|
|
32
|
+
const IrisAppManifest = (await Promise.resolve().then(() => tslib_1.__importStar(require(tileManifestPath)))).default;
|
|
33
|
+
const defaultConfig = (0, defaultWebpackConfig_1.getDefaultConfig)("production", context.root, projectRootDir, IrisAppManifest);
|
|
34
|
+
const customConfigFile = await Promise.resolve().then(() => tslib_1.__importStar(require(options.webpackConfig)));
|
|
35
|
+
const config = await customConfigFile.default(defaultConfig);
|
|
36
|
+
deleteOutputDir(context.root, options.outputPath);
|
|
37
|
+
const observable = (0, run_webpack_1.runWebpack)(config).pipe((0, operators_1.tap)(stats => {
|
|
38
|
+
// eslint-disable-next-line no-console
|
|
39
|
+
console.info(stats.toString(config.stats));
|
|
40
|
+
}), (0, operators_1.map)(stats => {
|
|
41
|
+
return {
|
|
42
|
+
success: !stats.hasErrors(),
|
|
43
|
+
outfile: (0, path_1.resolve)(context.root, options.outputPath),
|
|
44
|
+
};
|
|
45
|
+
}));
|
|
46
|
+
return yield* (0, rxjs_for_await_1.eachValueFrom)(observable);
|
|
47
|
+
}
|
|
48
|
+
exports.default = default_1;
|
|
49
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/build/executor.ts"],"names":[],"mappings":";;;;AAEA,0EAAsE;AACtE,yEAAqE;AACrE,qFAAiF;AACjF,kFAAyE;AACzE,2BAA4B;AAC5B,+BAAqC;AAErC,8BAA4B;AAC5B,+FAA+D;AAC/D,wEAAiE;AAQjE,SAAgB,eAAe,CAAC,IAAY,EAAE,UAA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AAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,IAAA,wBAAU,EAAC,MAAM,CAAC,CAAC,IAAI,CACxC,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE;QACV,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,EACF,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE;QACV,OAAO;YACL,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE;YAC3B,OAAO,EAAE,IAAA,cAAO,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;SACjC,CAAC;IACtB,CAAC,CAAC,CACH,CAAC;IACF,OAAO,KAAK,CAAC,CAAC,IAAA,8BAAa,EAAC,UAAwC,CAAC,CAAC;AACxE,CAAC;AAjCD,4BAiCC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExecutorContext } from \"@nrwl/devkit\";\nimport { eachValueFrom } from \"@nrwl/devkit/src/utils/rxjs-for-await\";\nimport { map, tap } from \"@nrwl/webpack/node_modules/rxjs/operators\";\nimport { runWebpack } from \"@nrwl/webpack/src/executors/webpack/lib/run-webpack\";\nimport { enableTsConfigPath } from \"@trackunit/iris-app-build-utilities\";\nimport { rmSync } from \"fs\";\nimport { join, resolve } from \"path\";\nimport { Observable } from \"rxjs\";\nimport \"webpack-dev-server\";\nimport checkPackageVersion from \"../utils/checkPackageVersion\";\nimport { getDefaultConfig } from \"../utils/defaultWebpackConfig\";\nimport { BuildExecutorSchema } from \"./schema\";\n\nexport type NodeBuildEvent = {\n outfile: string;\n success: boolean;\n};\n\nexport function deleteOutputDir(root: string, outputPath: string) {\n const resolvedOutputPath = resolve(root, outputPath);\n if (resolvedOutputPath === root) {\n throw new Error(\"Output path MUST not be project root directory!\");\n }\n rmSync(resolvedOutputPath, { recursive: true, force: true });\n}\n\nexport default async function* (options: BuildExecutorSchema, context: ExecutorContext) {\n await checkPackageVersion();\n const projectRootDir = join(context.root, context.workspace.projects[context.projectName!].root);\n const tileManifestPath = join(\n context.root,\n context.workspace.projects[context.projectName!].root,\n \"iris-app-manifest.ts\"\n );\n enableTsConfigPath({\n projectRootDir,\n });\n if (!options.webpackConfig) {\n throw new Error(\"option.webpackConfig is required\");\n }\n const IrisAppManifest = (await import(tileManifestPath)).default;\n const defaultConfig = getDefaultConfig(\"production\", context.root, projectRootDir, IrisAppManifest);\n const customConfigFile = await import(options.webpackConfig);\n\n const config = await customConfigFile.default(defaultConfig);\n deleteOutputDir(context.root, options.outputPath);\n const observable = runWebpack(config).pipe(\n tap(stats => {\n // eslint-disable-next-line no-console\n console.info(stats.toString(config.stats));\n }),\n map(stats => {\n return {\n success: !stats.hasErrors(),\n outfile: resolve(context.root, options.outputPath),\n } as NodeBuildEvent;\n })\n );\n return yield* eachValueFrom(observable as unknown as Observable<any>);\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"title": "Build executor for apps from the Iris App SDK",
|
|
5
|
+
"description": "",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"webpackConfig": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "argv",
|
|
13
|
+
"index": 0
|
|
14
|
+
},
|
|
15
|
+
"x-prompt": "What is the path for the webpack config for this app?"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": []
|
|
19
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/* eslint-disable no-console */
|
|
5
|
+
const libpub = tslib_1.__importStar(require("libnpmpublish"));
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const open = tslib_1.__importStar(require("open"));
|
|
8
|
+
const pacote = tslib_1.__importStar(require("pacote"));
|
|
9
|
+
const url_1 = require("url");
|
|
10
|
+
const checkPackageVersion_1 = tslib_1.__importDefault(require("../utils/checkPackageVersion"));
|
|
11
|
+
function sleep(time) {
|
|
12
|
+
return new Promise(resolve => setTimeout(resolve, time));
|
|
13
|
+
}
|
|
14
|
+
function getSettings() {
|
|
15
|
+
const env = process.env.TU_ENV ?? "dev";
|
|
16
|
+
switch (env) {
|
|
17
|
+
case "prod":
|
|
18
|
+
return {
|
|
19
|
+
repoUrl: new url_1.URL(process.env.REPO_URL ?? "https://apps.iris.trackunit.com/repo/"),
|
|
20
|
+
authorizationServerId: "aus2u3jix1dWU7fwt356",
|
|
21
|
+
};
|
|
22
|
+
case "stage":
|
|
23
|
+
return {
|
|
24
|
+
repoUrl: new url_1.URL(process.env.REPO_URL ?? "https://apps.stage.iris.trackunit.com/repo/"),
|
|
25
|
+
authorizationServerId: "aus2u2bi02B7IYj00356",
|
|
26
|
+
};
|
|
27
|
+
case "dev":
|
|
28
|
+
return {
|
|
29
|
+
repoUrl: new url_1.URL(process.env.REPO_URL ?? "https://apps.dev.iris.trackunit.com/repo/"),
|
|
30
|
+
authorizationServerId: "aus2u1ctyrhWjlJXa356",
|
|
31
|
+
};
|
|
32
|
+
default:
|
|
33
|
+
throw new Error(`Unknown environment: ${env}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function runExecutor(options) {
|
|
37
|
+
await (0, checkPackageVersion_1.default)();
|
|
38
|
+
const settings = getSettings();
|
|
39
|
+
let tokenData = null;
|
|
40
|
+
if (process.env.TU_TOKEN) {
|
|
41
|
+
tokenData = {
|
|
42
|
+
token_type: "Bearer",
|
|
43
|
+
id_token: process.env.TU_TOKEN,
|
|
44
|
+
access_token: process.env.TU_TOKEN,
|
|
45
|
+
expires_in: 0,
|
|
46
|
+
scope: "unknown",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const authorizeParams = new url_1.URLSearchParams();
|
|
51
|
+
authorizeParams.append("client_id", "0oaf1n9wi9XKRBGTf357");
|
|
52
|
+
authorizeParams.append("scope", "openid profile fms");
|
|
53
|
+
const authorizeResponse = await (0, node_fetch_1.default)(`https://trackunit-portal.okta.com/oauth2/${settings.authorizationServerId}/v1/device/authorize`, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
body: authorizeParams,
|
|
56
|
+
});
|
|
57
|
+
const authorizeData = (await authorizeResponse.json());
|
|
58
|
+
console.log(`š Attempting to automatically open the Trackunit authentication page in your default browser...\n If the browser does not open or you wish to use a different device to authorize this request, open the following URL:\n\n ${authorizeData.verification_uri_complete}`);
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
await (open.default ? open.default : open)(authorizeData.verification_uri_complete);
|
|
61
|
+
console.log("\nā³ Waiting for authentication in the browser...");
|
|
62
|
+
do {
|
|
63
|
+
await sleep(authorizeData.interval * 1000);
|
|
64
|
+
if (tokenData && "error" in tokenData && tokenData.error === "slow_down") {
|
|
65
|
+
await sleep(10000);
|
|
66
|
+
}
|
|
67
|
+
const tokenParams = new url_1.URLSearchParams();
|
|
68
|
+
tokenParams.append("client_id", "0oaf1n9wi9XKRBGTf357");
|
|
69
|
+
tokenParams.append("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
70
|
+
tokenParams.append("device_code", authorizeData.device_code);
|
|
71
|
+
const tokenResponse = await (0, node_fetch_1.default)(`https://trackunit-portal.okta.com/oauth2/${settings.authorizationServerId}/v1/token`, {
|
|
72
|
+
method: "POST",
|
|
73
|
+
body: tokenParams,
|
|
74
|
+
});
|
|
75
|
+
tokenData = (await tokenResponse.json());
|
|
76
|
+
} while (!("id_token" in tokenData) &&
|
|
77
|
+
!("error" in tokenData && tokenData.error !== "authorization_pending" && tokenData.error !== "slow_down"));
|
|
78
|
+
}
|
|
79
|
+
if ("id_token" in tokenData) {
|
|
80
|
+
console.log("š„³ Successfully authenticated.");
|
|
81
|
+
const manifest = (await pacote.manifest(options.inputPath));
|
|
82
|
+
const tarData = await pacote.tarball(options.inputPath);
|
|
83
|
+
const npmFetchOptions = {};
|
|
84
|
+
npmFetchOptions.registry = settings.repoUrl.toString();
|
|
85
|
+
const repoHostAndPort = settings.repoUrl.hostname + (settings.repoUrl.port ? ":" + settings.repoUrl.port : "");
|
|
86
|
+
npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}:_authToken`] = tokenData.id_token;
|
|
87
|
+
npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}/repo/:always-auth`] = true;
|
|
88
|
+
console.log("š¢ Shipping the app package...");
|
|
89
|
+
const publishResult = await libpub.publish(manifest, tarData, npmFetchOptions).catch((err) => {
|
|
90
|
+
return {
|
|
91
|
+
ok: false,
|
|
92
|
+
headers: null,
|
|
93
|
+
statusText: `Error`,
|
|
94
|
+
text: () => Promise.resolve(`${err.name} ${err.message}`),
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
const warningsText = publishResult.headers?.get("TU-TILE-WARNINGS");
|
|
98
|
+
if (warningsText) {
|
|
99
|
+
console.log("ā ļø " + decodeURI(warningsText));
|
|
100
|
+
}
|
|
101
|
+
if (publishResult.ok) {
|
|
102
|
+
console.log("š Uploaded the app package");
|
|
103
|
+
return { success: true };
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
console.error("ā Unable to publish app package. Got error from Iris App SDK repository.", publishResult.statusText, await publishResult.text());
|
|
107
|
+
return { success: false };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if ("error" in tokenData) {
|
|
111
|
+
if (tokenData.error === "expired_token") {
|
|
112
|
+
console.error("āļø Authentication attempt expired");
|
|
113
|
+
return { success: false };
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
console.error(`ā Error occurred: ${tokenData.error} ${tokenData.error_description}`);
|
|
117
|
+
return { success: false };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
console.error("ā Unknown error occurred");
|
|
122
|
+
return { success: false };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.default = runExecutor;
|
|
126
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/publish/executor.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,8DAAwC;AACxC,oEAA+B;AAC/B,mDAA6B;AAC7B,uDAAiC;AACjC,6BAA2C;AAC3C,+FAA+D;AAgD/D,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,WAAW;IAClB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,KAAK,CAAC;IACxC,QAAQ,GAAG,EAAE;QACX,KAAK,MAAM;YACT,OAAO;gBACL,OAAO,EAAE,IAAI,SAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,uCAAuC,CAAC;gBACjF,qBAAqB,EAAE,sBAAsB;aAC9C,CAAC;QACJ,KAAK,OAAO;YACV,OAAO;gBACL,OAAO,EAAE,IAAI,SAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,6CAA6C,CAAC;gBACvF,qBAAqB,EAAE,sBAAsB;aAC9C,CAAC;QACJ,KAAK,KAAK;YACR,OAAO;gBACL,OAAO,EAAE,IAAI,SAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,2CAA2C,CAAC;gBACrF,qBAAqB,EAAE,sBAAsB;aAC9C,CAAC;QACJ;YAC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AAC,IAAI,EAAE,CAC3B,CAAC;YACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;SAC3B;KACF;SAAM,IAAI,OAAO,IAAI,SAAS,EAAE;QAC/B,IAAI,SAAS,CAAC,KAAK,KAAK,eAAe,EAAE;YACvC,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;SAC3B;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,qBAAqB,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC;YACrF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;SAC3B;KACF;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC1C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KAC3B;AACH,CAAC;AAzGD,8BAyGC","sourcesContent":["/* eslint-disable no-console */\nimport * as libpub from \"libnpmpublish\";\nimport fetch from \"node-fetch\";\nimport * as open from \"open\";\nimport * as pacote from \"pacote\";\nimport { URL, URLSearchParams } from \"url\";\nimport checkPackageVersion from \"../utils/checkPackageVersion\";\nimport { PublishExecutorSchema } from \"./schema\";\n\ninterface PackageJson {\n name: string;\n version: string;\n scripts?: Record<string, string>;\n type?: \"module\" | \"commonjs\";\n main?: string;\n types?: string;\n module?: string;\n exports?: Record<\n string,\n {\n types?: string;\n require?: string;\n import?: string;\n }\n >;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\ninterface AuthorizeData {\n device_code: string;\n user_code: string;\n verification_uri: string;\n verification_uri_complete: string;\n expires_in: number;\n interval: number;\n}\n\ninterface TokenDataSuccess {\n token_type: string;\n expires_in: number;\n access_token: string;\n scope: string;\n id_token: string;\n}\n\ninterface TokenDataError {\n error: string;\n error_description: string;\n}\n\ntype TokenData = TokenDataSuccess | TokenDataError;\n\nfunction sleep(time: number) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\n\nfunction getSettings() {\n const env = process.env.TU_ENV ?? \"dev\";\n switch (env) {\n case \"prod\":\n return {\n repoUrl: new URL(process.env.REPO_URL ?? \"https://apps.iris.trackunit.com/repo/\"),\n authorizationServerId: \"aus2u3jix1dWU7fwt356\",\n };\n case \"stage\":\n return {\n repoUrl: new URL(process.env.REPO_URL ?? \"https://apps.stage.iris.trackunit.com/repo/\"),\n authorizationServerId: \"aus2u2bi02B7IYj00356\",\n };\n case \"dev\":\n return {\n repoUrl: new URL(process.env.REPO_URL ?? \"https://apps.dev.iris.trackunit.com/repo/\"),\n authorizationServerId: \"aus2u1ctyrhWjlJXa356\",\n };\n default:\n throw new Error(`Unknown environment: ${env}`);\n }\n}\n\nexport default async function runExecutor(options: PublishExecutorSchema) {\n await checkPackageVersion();\n const settings = getSettings();\n\n let tokenData: TokenData | null = null;\n if (process.env.TU_TOKEN) {\n tokenData = {\n token_type: \"Bearer\",\n id_token: process.env.TU_TOKEN,\n access_token: process.env.TU_TOKEN,\n expires_in: 0,\n scope: \"unknown\",\n };\n } else {\n const authorizeParams = new URLSearchParams();\n authorizeParams.append(\"client_id\", \"0oaf1n9wi9XKRBGTf357\");\n authorizeParams.append(\"scope\", \"openid profile fms\");\n const authorizeResponse = await fetch(\n `https://trackunit-portal.okta.com/oauth2/${settings.authorizationServerId}/v1/device/authorize`,\n {\n method: \"POST\",\n body: authorizeParams,\n }\n );\n const authorizeData = (await authorizeResponse.json()) as AuthorizeData;\n\n console.log(\n `š Attempting to automatically open the Trackunit authentication page in your default browser...\\n If the browser does not open or you wish to use a different device to authorize this request, open the following URL:\\n\\n ${authorizeData.verification_uri_complete}`\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await ((open as any).default ? (open as any).default : open)(authorizeData.verification_uri_complete);\n\n console.log(\"\\nā³ Waiting for authentication in the browser...\");\n do {\n await sleep(authorizeData.interval * 1000);\n if (tokenData && \"error\" in tokenData && tokenData.error === \"slow_down\") {\n await sleep(10000);\n }\n const tokenParams = new URLSearchParams();\n tokenParams.append(\"client_id\", \"0oaf1n9wi9XKRBGTf357\");\n tokenParams.append(\"grant_type\", \"urn:ietf:params:oauth:grant-type:device_code\");\n tokenParams.append(\"device_code\", authorizeData.device_code);\n const tokenResponse = await fetch(\n `https://trackunit-portal.okta.com/oauth2/${settings.authorizationServerId}/v1/token`,\n {\n method: \"POST\",\n body: tokenParams,\n }\n );\n tokenData = (await tokenResponse.json()) as TokenData;\n } while (\n !(\"id_token\" in tokenData) &&\n !(\"error\" in tokenData && tokenData.error !== \"authorization_pending\" && tokenData.error !== \"slow_down\")\n );\n }\n\n if (\"id_token\" in tokenData) {\n console.log(\"š„³ Successfully authenticated.\");\n\n const manifest = (await pacote.manifest(options.inputPath)) as PackageJson;\n const tarData = await pacote.tarball(options.inputPath);\n const npmFetchOptions: { registry?: string } = {};\n npmFetchOptions.registry = settings.repoUrl.toString();\n const repoHostAndPort = settings.repoUrl.hostname + (settings.repoUrl.port ? \":\" + settings.repoUrl.port : \"\");\n npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}:_authToken`] = tokenData.id_token;\n npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}/repo/:always-auth`] = true;\n\n console.log(\"š¢ Shipping the app package...\");\n const publishResult = await libpub.publish(manifest, tarData, npmFetchOptions).catch((err: Error) => {\n return {\n ok: false,\n headers: null,\n statusText: `Error`,\n text: () => Promise.resolve(`${err.name} ${err.message}`),\n };\n });\n\n const warningsText = publishResult.headers?.get(\"TU-TILE-WARNINGS\");\n if (warningsText) {\n console.log(\"ā ļø \" + decodeURI(warningsText));\n }\n\n if (publishResult.ok) {\n console.log(\"š Uploaded the app package\");\n return { success: true };\n } else {\n console.error(\n \"ā Unable to publish app package. Got error from Iris App SDK repository.\",\n publishResult.statusText,\n await publishResult.text()\n );\n return { success: false };\n }\n } else if (\"error\" in tokenData) {\n if (tokenData.error === \"expired_token\") {\n console.error(\"āļø Authentication attempt expired\");\n return { success: false };\n } else {\n console.error(`ā Error occurred: ${tokenData.error} ${tokenData.error_description}`);\n return { success: false };\n }\n } else {\n console.error(\"ā Unknown error occurred\");\n return { success: false };\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"title": "Publish executor",
|
|
5
|
+
"description": "",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"inputPath": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "argv",
|
|
13
|
+
"index": 0
|
|
14
|
+
},
|
|
15
|
+
"x-prompt": "what is build output path for this app?"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"required": ["inputPath"]
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const rxjs_for_await_1 = require("@nrwl/devkit/src/utils/rxjs-for-await");
|
|
5
|
+
const operators_1 = require("@nrwl/webpack/node_modules/rxjs/operators");
|
|
6
|
+
const get_emitted_files_1 = require("@nrwl/webpack/src/executors/webpack/lib/get-emitted-files");
|
|
7
|
+
const run_webpack_1 = require("@nrwl/webpack/src/utils/run-webpack");
|
|
8
|
+
const iris_app_build_utilities_1 = require("@trackunit/iris-app-build-utilities");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
require("webpack-dev-server");
|
|
11
|
+
const checkPackageVersion_1 = tslib_1.__importDefault(require("../utils/checkPackageVersion"));
|
|
12
|
+
const defaultWebpackConfig_1 = require("../utils/defaultWebpackConfig");
|
|
13
|
+
const webpack = require("webpack");
|
|
14
|
+
const WebpackDevServer = require("webpack-dev-server");
|
|
15
|
+
async function* default_1(options, context) {
|
|
16
|
+
await (0, checkPackageVersion_1.default)();
|
|
17
|
+
const projectRootDir = (0, path_1.join)(context.root, context.workspace.projects[context.projectName].root);
|
|
18
|
+
const tileManifestPath = (0, path_1.join)(context.root, context.workspace.projects[context.projectName].root, "iris-app-manifest.ts");
|
|
19
|
+
(0, iris_app_build_utilities_1.enableTsConfigPath)({
|
|
20
|
+
projectRootDir,
|
|
21
|
+
});
|
|
22
|
+
if (!options.webpackConfig) {
|
|
23
|
+
throw new Error("option.webpackConfig is required");
|
|
24
|
+
}
|
|
25
|
+
const IrisAppManifest = (await Promise.resolve().then(() => tslib_1.__importStar(require(tileManifestPath)))).default;
|
|
26
|
+
const defaultConfig = (0, defaultWebpackConfig_1.getDefaultConfig)("development", context.root, projectRootDir, IrisAppManifest);
|
|
27
|
+
const customConfigFile = await Promise.resolve().then(() => tslib_1.__importStar(require(options.webpackConfig)));
|
|
28
|
+
const config = await customConfigFile.default(defaultConfig);
|
|
29
|
+
const observable = (0, run_webpack_1.runWebpackDevServer)(config, webpack, WebpackDevServer).pipe((0, operators_1.tap)(({ stats }) => {
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.info(stats.toString(config.stats));
|
|
32
|
+
}), (0, operators_1.map)(({ baseUrl, stats }) => {
|
|
33
|
+
return {
|
|
34
|
+
baseUrl,
|
|
35
|
+
emittedFiles: (0, get_emitted_files_1.getEmittedFiles)(stats),
|
|
36
|
+
success: !stats.hasErrors(),
|
|
37
|
+
};
|
|
38
|
+
}));
|
|
39
|
+
return yield* (0, rxjs_for_await_1.eachValueFrom)(observable);
|
|
40
|
+
}
|
|
41
|
+
exports.default = default_1;
|
|
42
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/serve/executor.ts"],"names":[],"mappings":";;;AAEA,0EAAsE;AACtE,yEAAqE;AACrE,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AC,QAAQ,CAAE,MAAgC,CAAC,KAAK,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC,EACF,IAAA,eAAG,EAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QACzB,OAAO;YACL,OAAO;YACP,YAAY,EAAE,IAAA,mCAAe,EAAC,KAAK,CAAC;YACpC,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE;SAC5B,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,IAAA,8BAAa,EAAC,UAAwC,CAAC,CAAC;AACxE,CAAC;AAnCD,4BAmCC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExecutorContext } from \"@nrwl/devkit\";\nimport { eachValueFrom } from \"@nrwl/devkit/src/utils/rxjs-for-await\";\nimport { map, tap } from \"@nrwl/webpack/node_modules/rxjs/operators\";\nimport { getEmittedFiles } from \"@nrwl/webpack/src/executors/webpack/lib/get-emitted-files\";\nimport { runWebpackDevServer } from \"@nrwl/webpack/src/utils/run-webpack\";\nimport { enableTsConfigPath } from \"@trackunit/iris-app-build-utilities\";\nimport { join } from \"path\";\nimport { Observable } from \"rxjs\";\nimport \"webpack-dev-server\";\nimport checkPackageVersion from \"../utils/checkPackageVersion\";\nimport { getDefaultConfig } from \"../utils/defaultWebpackConfig\";\nimport { ServeExecutorSchema } from \"./schema\";\n\nimport webpack = require(\"webpack\");\nimport WebpackDevServer = require(\"webpack-dev-server\");\n\nexport default async function* (options: ServeExecutorSchema, context: ExecutorContext) {\n await checkPackageVersion();\n const projectRootDir = join(context.root, context.workspace.projects[context.projectName!].root);\n const tileManifestPath = join(\n context.root,\n context.workspace.projects[context.projectName!].root,\n \"iris-app-manifest.ts\"\n );\n enableTsConfigPath({\n projectRootDir,\n });\n if (!options.webpackConfig) {\n throw new Error(\"option.webpackConfig is required\");\n }\n const IrisAppManifest = (await import(tileManifestPath)).default;\n const defaultConfig = getDefaultConfig(\"development\", context.root, projectRootDir, IrisAppManifest);\n const customConfigFile = await import(options.webpackConfig);\n\n const config = await customConfigFile.default(defaultConfig);\n\n const observable = runWebpackDevServer(config, webpack, WebpackDevServer).pipe(\n tap(({ stats }) => {\n // eslint-disable-next-line no-console\n console.info(stats.toString((config as webpack.Configuration).stats));\n }),\n map(({ baseUrl, stats }) => {\n return {\n baseUrl,\n emittedFiles: getEmittedFiles(stats),\n success: !stats.hasErrors(),\n };\n })\n );\n\n return yield* eachValueFrom(observable as unknown as Observable<any>);\n}\n"]}
|