Skip to content

v4 #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 23, 2023
Merged

v4 #141

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .github/workflows/release-cd.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release Package

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node 16
uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Setup PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 7.0.0

- name: Install
run: pnpm install

- name: Build
run: pnpm build

- name: Publish
run: |
pnpm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"
pnpm publish --no-git-checks
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dev/**/output.js
output.js
output.js.map
dist
11 changes: 3 additions & 8 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
"bracketSpacing": true,
"arrowParens": "always",
"semi": true,
"useTabs": false,
"tabWidth": 4,

"svelteSortOrder": "scripts-markup-styles",
"svelteAllowShorthand": true,
"svelteBracketNewLine": false,
"svelteIndentScriptAndStyle": true
}
"useTabs": true,
"tabWidth": 4
}
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"christian-kohler.npm-intellisense",
]
}
69 changes: 47 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,72 @@

[![](https://img.shields.io/npm/v/rollup-obfuscator?label=Latest%20Version&style=for-the-badge&logo=npm&color=informational)](https://www.npmjs.com/package/rollup-obfuscator)

A plugin to obfuscate javascript for rollup & vite based on [javascript-obfuscator](https://www.npmjs.com/javascript-obfuscator)
A rollup/vite plugin to obfuscate your code based on [javascript-obfuscator](https://www.npmjs.com/javascript-obfuscator)

# Install
# Requirements

```
npm install -D rollup-obfuscator
- Rollup: v2 or v3
- Node: v16+
- javascript-obfuscator: v4

# Installing

First install the plugin as a dev dependency:

```bash
npm install rollup-obfuscator -D
```

# Use
Next we should add it to the **end** of the plugins array:

Rollup:
```js
import { obfuscator } from 'rollup-obfuscator';

...
plugins: [
...
obfuscator()
...
]
...
export default {
plugins: [
// ...
obfuscator()
]
}
```

Vite:
```js
import { obfuscator } from 'rollup-obfuscator';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [
// ...
obfuscator()
]
})
```

# Config
## Configuring

All config options can be found [here](https://www.npmjs.com/package/javascript-obfuscator) and are passed into the obfuscator plugin like this:
The plugin should hopefully work out of the box. However, it's likely to break on larger applications - especially those that use complex frameworks. You should play with the options to find what works best for your application.

```js
obfuscator({
// options
})
plugins: [
obfuscator({
// options go here
})
]
```

You can also pass in the following additional options:
### Obfuscator Options

All config options can be found [here](https://www.npmjs.com/package/javascript-obfuscator). The plugin has the same default options, except setting `sourceMap: true` and `stringArray: false`.

- `global` - It's recommended to keep this enabled, since it might cause issues. However if you need access to `include` and `exclude` options you can disable this
### Plugin Specific Options

- `include` - A [FilterPattern](https://github.com/rollup/plugins/blob/master/packages/pluginutils/types/index.d.ts#L23) of files to include. By default only allows js/ts files - only works with global set to false
- `include` - A [FilterPattern](https://github.com/rollup/plugins/blob/master/packages/pluginutils/types/index.d.ts#L23) of files to include. Defaults to `['**/*.js', '**/*.ts']`

- `exclude` - A [FilterPattern](https://github.com/rollup/plugins/blob/master/packages/pluginutils/types/index.d.ts#L23) of files to exclude. By default ignores node_modules - only works with global set to false
- `exclude` - A [FilterPattern](https://github.com/rollup/plugins/blob/master/packages/pluginutils/types/index.d.ts#L23) of files to exclude. Defaults to `['node_modules/**']`

# Support

- Join the [discord](https://discord.gg/2Vd4wAjJnm)
- Create a issue on the [github](https://github.com/ghostdevv/rollup-obfuscator)
- Create a issue on the [GitHub](https://github.com/ghostdevv/rollup-obfuscator)
1 change: 0 additions & 1 deletion dev/.npmrc

This file was deleted.

13 changes: 10 additions & 3 deletions dev/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"workspaces": [
".."
]
"type": "module",
"private": true,
"scripts": {
"dev": "rollup -w -c"
},
"devDependencies": {
"javascript-obfuscator": "^4.0.2",
"rollup": "^3.28.1",
"rollup-obfuscator": "file:.."
}
}
Loading