Skip to content

Commit 93bc266

Browse files
Hristo HristovHristo Hristov
authored andcommitted
fix: update function
1 parent 39ec0a5 commit 93bc266

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/cli/lib/templates/ReactTemplate.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ export class ReactTemplate implements Template {
109109
const components = require("@igniteui/cli-core/packages/components");
110110
const igResPath = path.join(projectPath, this.igniteResources);
111111

112-
if (fs.existsSync(igResPath)) {
113-
const fd = fs.openSync(igResPath, fs.constants.O_RDWR);
112+
try {
113+
const fd = fs.openSync(igResPath, fs.constants.O_RDWR | fs.constants.O_CREAT);
114114
let igniteuiResFile = fs.readFileSync(fd, "utf8");
115115
const freeVersionPath = "ignite-ui/";
116116
const fullVersionPath = "@infragistics/ignite-ui-full/en/";
@@ -124,7 +124,6 @@ export class ReactTemplate implements Template {
124124
igniteuiResFile = igniteuiResFile.replace(freeVersionPath, fullVersionPath);
125125
igniteuiResFile = igniteuiResFile.replace("-lite", "");
126126
}
127-
128127
fs.ftruncateSync(fd, 0);
129128
fs.writeSync(fd, igniteuiResFile);
130129
}
@@ -134,8 +133,9 @@ export class ReactTemplate implements Template {
134133
}
135134

136135
fs.closeSync(fd);
137-
} else {
138-
Util.log(`igniteuiResources.js file NOT found!`);
136+
} catch (err) {
137+
Util.error(`Error while updating igniteuiResources.js: ${err.message}`);
138+
throw err;
139139
}
140140
}
141141

0 commit comments

Comments
 (0)