Skip to content

Commit

Permalink
v.2.0.0 (#5)
Browse files Browse the repository at this point in the history
  #### Changes:
  - Support partially obfuscation
  - Support TailwindCSS Dark Mode
  - New configuration file `next-css-obfuscator.config.cjs`
  - More configuration options
  - Now become a independent sulotion (no need to patch `PostCSS-Obfuscator` anymore)
  - More tests
  - Better CSS parsing
  • Loading branch information
soranoo authored Jan 21, 2024
1 parent f276d7b commit 53e99db
Show file tree
Hide file tree
Showing 45 changed files with 11,530 additions and 2,748 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/auto_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# Install dependencie using the runners shell
- name: Install dependencies
run: npm install

# Runs test using the runners shell
- name: Test
run: npm run test

350 changes: 225 additions & 125 deletions README.md

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions bin/cli-part1.mjs

This file was deleted.

5 changes: 0 additions & 5 deletions bin/cli-part2.mjs

This file was deleted.

5 changes: 5 additions & 0 deletions bin/cli.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import { obfuscateCli } from "../dist/index.js";

obfuscateCli();
14 changes: 14 additions & 0 deletions demo/next14-app-router-partially-obfuscated/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Since the ".env" file is gitignored, you can use the ".env.example" file to
# build a new ".env" file when you clone the repo. Keep this file up-to-date
# when you add new variables to `.env`.

# This file will be committed to version control, so make sure not to have any
# secrets in it. If you are cloning this repo, create a copy of this file named
# ".env" and populate it with your secrets.

# When adding additional environment variables, the schema in "/src/env.js"
# should be updated accordingly.

# Example:
# SERVERVAR="foo"
# NEXT_PUBLIC_CLIENTVAR="bar"
37 changes: 37 additions & 0 deletions demo/next14-app-router-partially-obfuscated/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/** @type {import("eslint").Linter.Config} */
const config = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
plugins: ["@typescript-eslint"],
extends: [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
],
rules: {
// These opinionated rules are enabled in stylistic-type-checked above.
// Feel free to reconfigure them to your own preference.
"@typescript-eslint/array-type": "off",
"@typescript-eslint/consistent-type-definitions": "off",

"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: { attributes: false },
},
],
},
};

module.exports = config;
46 changes: 46 additions & 0 deletions demo/next14-app-router-partially-obfuscated/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# database
/prisma/db.sqlite
/prisma/db.sqlite-journal

# next.js
/.next/
/out/
next-env.d.ts

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
.env
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo

# next-css-obfuscator
/css-obfuscator
/out
14 changes: 14 additions & 0 deletions demo/next14-app-router-partially-obfuscated/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Next14 App Router Partially Obfuscated Demo

🛠️ Development Environment

| Environment | Version |
| -------------------- | ---------- |
| OS | Windows 11 |
| Node.js | v.18.17.1 |
| NPM | v.10.2.5 |
| Next.js (App Router) | v.14.0.4 |
| tailwindcss | v.3.3.5 |

Expected result:
![](screenshot.png)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
enable: true,
mode: "random", // random | simplify
refreshClassConversionJson: false, // recommended set to true if not in production
allowExtensions: [".jsx", ".tsx", ".js", ".ts", ".html", ".rsc"],

enableMarkers: true,
};
10 changes: 10 additions & 0 deletions demo/next14-app-router-partially-obfuscated/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
* for Docker builds.
*/
await import("./src/env.js");

/** @type {import("next").NextConfig} */
const config = {};

export default config;
Loading

0 comments on commit 53e99db

Please sign in to comment.