@nu-art/build-and-install 0.204.83 → 0.204.84
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/package.json
CHANGED
|
@@ -20,6 +20,7 @@ export declare class Unit_TypescriptLib<C extends Unit_TypescriptLib_Config = Un
|
|
|
20
20
|
Phase_Purge,
|
|
21
21
|
Phase_Lint
|
|
22
22
|
]>, OnWatchEvent {
|
|
23
|
+
private compilationError;
|
|
23
24
|
constructor(config: Unit_TypescriptLib<C, RTC>['config']);
|
|
24
25
|
__onWatchEvent(type: WatchEventType, path?: string): Promise<void>;
|
|
25
26
|
protected init(setInitialized?: boolean): Promise<void>;
|
|
@@ -50,6 +50,7 @@ const assetExtensions = [
|
|
|
50
50
|
class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
51
51
|
constructor(config) {
|
|
52
52
|
super(config);
|
|
53
|
+
this.compilationError = false;
|
|
53
54
|
this.addToClassStack(Unit_TypescriptLib);
|
|
54
55
|
runner_dispatchers_1.dispatcher_WatchEvent.addListener(this);
|
|
55
56
|
}
|
|
@@ -98,12 +99,25 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
|
98
99
|
async compileImpl() {
|
|
99
100
|
const pathToCompile = `${this.runtime.pathTo.pkg}/src/main`;
|
|
100
101
|
const pathToTSConfig = `${pathToCompile}/tsconfig.json`;
|
|
101
|
-
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
try {
|
|
103
|
+
await nvm_1.NVM
|
|
104
|
+
.createCommando(basic_1.Cli_Basic)
|
|
105
|
+
.setUID(this.config.key)
|
|
106
|
+
.cd(this.runtime.pathTo.pkg)
|
|
107
|
+
.append(`tsc -p "${pathToTSConfig}" --rootDir "${pathToCompile}" --outDir "${this.runtime.pathTo.output}"`)
|
|
108
|
+
.execute();
|
|
109
|
+
// set compilation error status on success
|
|
110
|
+
this.compilationError = false;
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
//In order to finish compile when running watch we just log the error instead of throwing it
|
|
114
|
+
if (params_1.RuntimeParams.watch) {
|
|
115
|
+
// set compilation error status on error
|
|
116
|
+
this.compilationError = true;
|
|
117
|
+
return this.logError(e);
|
|
118
|
+
}
|
|
119
|
+
throw e;
|
|
120
|
+
}
|
|
107
121
|
}
|
|
108
122
|
async copyAssetsToOutput() {
|
|
109
123
|
const command = `find . \\( -name ${assetExtensions.map(suffix => `'*.${suffix}'`).join(' -o -name ')} \\) | cpio -pdmuv "${this.runtime.pathTo.output}" > /dev/null 2>&1`;
|
|
@@ -132,7 +146,7 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
|
132
146
|
// perform all watch actions
|
|
133
147
|
await this.compileImpl();
|
|
134
148
|
await this.copyAssetsToOutput();
|
|
135
|
-
this.setStatus(
|
|
149
|
+
this.setStatus(`Watching${this.compilationError ? ' with error' : ''}`);
|
|
136
150
|
// dispatch unit post compile
|
|
137
151
|
runner_dispatchers_1.dispatcher_UnitWatchCompile.dispatch(this);
|
|
138
152
|
}
|
|
@@ -175,7 +189,7 @@ class Unit_TypescriptLib extends Unit_Typescript_1.Unit_Typescript {
|
|
|
175
189
|
await this.compileImpl();
|
|
176
190
|
await this.copyAssetsToOutput();
|
|
177
191
|
await this.copyPackageJSONToOutput();
|
|
178
|
-
this.setStatus(
|
|
192
|
+
this.setStatus(`Compiled${this.compilationError ? ' with error' : ''}`);
|
|
179
193
|
}
|
|
180
194
|
async purge() {
|
|
181
195
|
await fs_1.promises.rm(this.runtime.pathTo.output, { recursive: true, force: true });
|