Skip to content

Commit

Permalink
Update TestSetupIndex.js
Browse files Browse the repository at this point in the history
  • Loading branch information
srmukher authored Nov 23, 2023
1 parent 68c097d commit 41a435e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tools/UnitTestApp/TestSetupIndex.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
const core = require('@actions/core');
const github = require('@actions/github');
require('./script');
const fs = require('fs');
const readFilePath = './node_modules/@fluentui/react-charting/lib-commonjs/components/Sparkline/Sparkline.base.js';
const writeFilePath = './Sparkline/SparklineBase.js';
// Read the file
const updatedFile = () => {
fs.readFile(readFilePath, 'utf8', (err, data) => {
if (err) {
console.error(`Error reading file from disk: ${err}`);
} else {
// Replace the words
let result = data.replace(/require\("d3-scale"\)/g, "import('d3-scale')");
result = result.replace(/require\("d3-shape"\)/g, "import('d3-shape')");
result = result.replace(/require\("d3-array"\)/g, "import('d3-array')");
// Write the file back
fs.writeFile(writeFilePath, result, 'utf8', err => {
if (err) {
console.error(`Error writing file to disk: ${err}`);
}
});
}
});
};

updatedFile();

0 comments on commit 41a435e

Please sign in to comment.