Skip to content

Commit

Permalink
Merge pull request #4 from Codefend/fix-dofendrc-regex
Browse files Browse the repository at this point in the history
fix(.codefendrc): fix regex not generating on init
  • Loading branch information
Z-n-o-M committed Jan 5, 2023
2 parents a2b6c7c + 39aff09 commit 15461d0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<p align="center">
<img src="./logo.png">
</p>

# Codefend

Codefend short for "Code Defender" encrypts your code regardless of your source code language or framework.
Expand All @@ -6,13 +10,23 @@ Codefend short for "Code Defender" encrypts your code regardless of your source

```bash
npm install codefend

Usage: codefend [options]

Defend Your Code By All Means Necessary.

Options:
-V, --version output the version number
-i, --init Create .codefendrc.json (configuration file)
-c, --check Check .codefendrc.json for potential warnings/errors
-o, --obfuscate Obfuscate your project (based on .codefendrc.json)
-h, --help display help for command
```

# RoadMap

- Codefend core (done)
- Codefend cli (in progress)
- Codefend Bundler (coming soon)
- Codefend webpack plugin (coming soon)

## Contributing
Expand Down
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"main": "./build/cjs/index.js",
"module": "./build/esm/index.js",
"types": "./build/src/index.d.ts",
"author": "mounzz",
"homepage": "https://github.com/Codefend/core.git",
"repository": {
"type": "git",
"url": "https://github.com/Codefend/core.git"
},
"license": "MIT",
"engines": {
"node": "^18.7.0 || >= 16",
Expand Down
8 changes: 7 additions & 1 deletion src/cli/CodefendCLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@ export class CodefendCLI implements ICodefendCLI {
async executeInitCommand() {
console.log("Creating .codefendrc.json...");
await this.delay(500);
const options = { ...codefendDefaultOptions };
if (options.regexList?.length) {
options.regexList.forEach((regex) => {
regex.value = regex.value.toString();
});
}
await fileSystem.fileWriter.writeFile(
"./.codefendrc.json",
JSON.stringify(codefendDefaultOptions, null, 4)
JSON.stringify(options, null, 4)
);
console.log(
"Initialization completed. .codefendrc.json has been generated."
Expand Down
2 changes: 1 addition & 1 deletion src/core/options/ICodefendOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface ICodefendPredefinedWordOption {
}

export interface ICodefendRegexListOption {
value: RegExp;
value: RegExp | string;
name: string;
}

Expand Down

0 comments on commit 15461d0

Please sign in to comment.