Skip to content

Commit

Permalink
Merge pull request #28 from baoduy/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
baoduy authored Jun 3, 2024
2 parents 043652b + 12da3d6 commit c228c1a
Show file tree
Hide file tree
Showing 105 changed files with 22,037 additions and 18,193 deletions.
31 changes: 12 additions & 19 deletions .tasks/fix-issues.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import { readFileSync, writeFileSync } from 'fs';
import { replaceInFile, ReplaceResult } from "replace-in-file";

// Function to replace text in a file
const replaceTextInFile = (filePath: string, searchText: string, replacementText: string) => {
// Read the file content
const fileContent = readFileSync(filePath, 'utf-8');

// Replace the text
const updatedContent = fileContent.replace(new RegExp(searchText, 'g'), replacementText);

// Write the updated content back to the file
writeFileSync(filePath, updatedContent, 'utf-8');

console.log(`Text replaced successfully in ${filePath}`);
const options = {
files: "./node_modules/openpgp/openpgp.d.ts",
from: /NodeStream as GenericNodeStream/g,
to: "NodeWebStream as GenericNodeStream",
};

// Example usage
const filePath = './node_modules/openpgp/openpgp.d.ts'; // Path to your file
const searchText = 'NodeStream as GenericNodeStream'; // Text to be replaced
const replacementText = 'NodeWebStream as GenericNodeStream'; // Text to replace with

replaceTextInFile(filePath, searchText, replacementText);
replaceInFile(options)
.then((rs: ReplaceResult[]) => {
console.log("Replacement results:", rs);
})
.catch((er: Error) => {
console.error("Error occurred:", er);
});
30 changes: 12 additions & 18 deletions .tasks/update-tsconfig.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import * as fs from 'fs';
import * as path from 'path';

const tsconfigPath: string = './tsconfig.json';
const srcFolderPath: string = './'; // Adjust 'src' if your TS files are in a different directory
const excludeFolders: string[] = [
'node_modules',
'.out-bin',
'z_tests',
'.tasks',
'pulumi-test'
]; // List of folder names to exclude
import * as fs from "fs";
import * as path from "path";

const tsconfigPath: string = "./tsconfig.json";
const srcFolderPath: string = "./src"; // Adjust 'src' if your TS files are in a different directory
const excludeFolders: string[] = ["z_tests"]; // List of folder names to exclude

// Function to recursively find .ts files, excluding specified folders
function findTsFiles(dir: string, arrayOfFiles: string[] = []): string[] {
Expand All @@ -22,8 +16,8 @@ function findTsFiles(dir: string, arrayOfFiles: string[] = []): string[] {
// Check if the directory is not in the exclude list
arrayOfFiles = findTsFiles(fullPath, arrayOfFiles);
}
} else if (file.endsWith('.ts')) {
arrayOfFiles.push(path.relative('./', fullPath).replace(/\\/g, '/'));
} else if (file.endsWith(".ts")) {
arrayOfFiles.push(path.relative("./", fullPath).replace(/\\/g, "/"));
}
});

Expand All @@ -33,7 +27,7 @@ function findTsFiles(dir: string, arrayOfFiles: string[] = []): string[] {
const tsFiles: string[] = findTsFiles(srcFolderPath);

// Read tsconfig.json, update it with the found .ts files, excluding those in the excludeFolders, and write it back
fs.readFile(tsconfigPath, 'utf8', (err, data) => {
fs.readFile(tsconfigPath, "utf8", (err, data) => {
if (err) {
console.error(err);
return;
Expand All @@ -45,13 +39,13 @@ fs.readFile(tsconfigPath, 'utf8', (err, data) => {
fs.writeFile(
tsconfigPath,
JSON.stringify(tsconfig, null, 2),
'utf8',
"utf8",
(err) => {
if (err) {
console.error(err);
return;
}
console.log('tsconfig.json has been updated with TypeScript files.');
}
console.log("tsconfig.json has been updated with TypeScript files.");
},
);
});
7 changes: 6 additions & 1 deletion ReadMe.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ $ pulumi config set azure-native:clientSecret <clientSecret> --secret
$ pulumi config set azure-native:tenantId <tenantID>
$ pulumi config set azure-native:subscriptionId <subscriptionId>

# optional default location, otherwise set in code
## optional default location, otherwise set in code

$ pulumi config set azure-native:location SoutheastAsia

# Azure Resources

-List All Azure Firewall FQDN Tags
https://learn.microsoft.com/en-us/rest/api/firewall/azure-firewall-fqdn-tags/list-all?view=rest-firewall-2023-09-01&tabs=HTTP#code-try-0
Loading

0 comments on commit c228c1a

Please sign in to comment.