Skip to content

Commit d4a9006

Browse files
authored
Merge branch 'master' into copilot/add-mcp-server-implementation
2 parents 79b2667 + adb4ba2 commit d4a9006

File tree

5 files changed

+30
-16
lines changed

5 files changed

+30
-16
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ on:
2323
jobs:
2424
analyze:
2525
name: Analyze
26+
permissions:
27+
contents: read
28+
security-events: write
2629
runs-on: ubuntu-latest
2730

2831
strategy:

.github/workflows/nodejs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: Node.js CI
2+
permissions:
3+
contents: read
4+
checks: write
25

36
on:
47
push:
@@ -35,6 +38,7 @@ jobs:
3538
run: yarn coverage
3639
- name: Publish to coveralls.io
3740
if: matrix.node-version == '20.x'
38-
uses: coverallsapp/[email protected]
41+
# coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 corresponds to v2.3.4
42+
uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8
3943
with:
4044
github-token: ${{ github.token }}

.github/workflows/npm-publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
release:
44
types: [created]
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
build:
811
runs-on: ubuntu-latest

packages/cli/lib/templates/ReactTemplate.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ 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-
let igniteuiResFile = fs.readFileSync(igResPath, "utf8");
112+
try {
113+
const fd = fs.openSync(igResPath, fs.constants.O_RDWR | fs.constants.O_CREAT);
114+
let igniteuiResFile = fs.readFileSync(fd, "utf8");
114115
const freeVersionPath = "ignite-ui/";
115116
const fullVersionPath = "@infragistics/ignite-ui-full/en/";
116117
const dvPath = "@infragistics/ignite-ui-full/en/js/infragistics.dv.js";
@@ -123,16 +124,19 @@ export class ReactTemplate implements Template {
123124
igniteuiResFile = igniteuiResFile.replace(freeVersionPath, fullVersionPath);
124125
igniteuiResFile = igniteuiResFile.replace("-lite", "");
125126
}
126-
fs.writeFileSync(igResPath, igniteuiResFile);
127+
fs.ftruncateSync(fd, 0);
128+
fs.writeSync(fd, igniteuiResFile, 0);
127129
}
128130

129131
if (dvDep && !igniteuiResFile.includes(dvPath)) {
130-
fs.appendFileSync(igResPath, `${'\r\n// Ignite UI Charts Required JavaScript File\r\nimport "'
131-
+ dvPath + '";\r\n'}`);
132+
const endPos = fs.fstatSync(fd).size;
133+
fs.writeSync(fd, `\r\n// Ignite UI Charts Required JavaScript File\r\nimport "${dvPath}";\r\n`, endPos);
132134
}
133135

134-
} else {
135-
Util.log(`igniteuiResources.js file NOT found!`);
136+
fs.closeSync(fd);
137+
} catch (err) {
138+
Util.error(`Error while updating igniteuiResources.js: ${err.message}`);
139+
throw err;
136140
}
137141
}
138142

packages/core/util/GoogleAnalytics.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ class GoogleAnalytics {
6969
protected static getUUID(): string {
7070
const absolutePath = path.join(this.userDataFolder, this.appFolder, this.userSettings);
7171
let UUID = "";
72-
if (fs.existsSync(absolutePath)) {
73-
UUID = require(absolutePath).UUID;
74-
} else {
75-
const dirName = path.dirname(absolutePath);
76-
if (!fs.existsSync(dirName)) {
77-
fs.mkdirSync(dirName);
78-
}
72+
const dirName = path.dirname(absolutePath);
73+
fs.mkdirSync(dirName, { recursive: true });
7974

75+
try {
76+
const fd = fs.openSync(absolutePath, fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_RDWR, 0o600);
8077
UUID = this.getUserID();
81-
fs.writeFileSync(absolutePath, JSON.stringify({ UUID }));
78+
fs.writeFileSync(fd, JSON.stringify({ UUID }));
79+
fs.closeSync(fd);
80+
} catch {
81+
UUID = JSON.parse(fs.readFileSync(absolutePath, "utf8")).UUID;
8282
}
8383

8484
return UUID;

0 commit comments

Comments
 (0)