soranoo / next-css-obfuscator

A package deeply inspired by PostCSS-Obfuscator but for Next.js.
https://next-css-obfuscator.vercel.app
MIT License
71 stars 3 forks source link

Cannot start on mac: env: node\r: No such file or directory #22

Closed necm1 closed 6 months ago

necm1 commented 6 months ago

Type

Checklist

  1. [x] Updated the package to the latest version
  2. [x] Read all documentation
  3. [x] No related issue
  4. [x] Meaningful issue title

Environment

Describe the bug I just followed the tutorial and created a next-css-obfucator.config.ts file in my root directory. After building my application, I just tried to start obfuscate-build and I get following error:

yarn run v1.22.21
$ NODE_ENV=production next-css-obfuscator --config ./next-css-obfuscator.config.ts
env: node\r: No such file or directory
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior To run maybe?

Screenshots If applicable, add screenshots to help explain your problem.

Config

import { Options } from 'next-css-obfuscator';

module.exports = {
  enable: true,
  mode: 'random',
  refreshClassConversionJson: process.env.NODE_ENV !== 'production',
  allowExtensions: ['.jsx', '.tsx', '.js', '.ts', '.html', '.rsc'],
} as Options;

Related files

Demos (if any) N/A

Additional context I did some research and I guess it's something related to my current OS (macOS).

necm1 commented 6 months ago

The file https://github.com/soranoo/next-css-obfuscator/blob/main/bin/cli.mjs seems to be saved with CRLF instead of LF and thats causing issues on unix based systems

necm1 commented 6 months ago

https://github.com/soranoo/next-css-obfuscator/blob/main/src/handlers/js-ast.test.ts seems also saved with CRLF instead of LF

soranoo commented 6 months ago

Have you tried converting these files(node_modules/next-css-obfuscator/...) to LF?

I don't see any issue in my Ubuntu.

necm1 commented 6 months ago

Have you tried converting these files(node_modules/next-css-obfuscator/...) to LF?

I don't see any issue in my Ubuntu.

After converting them, it worked as expected. Anyways, I guess it was important to mention it, so anyone else in the future isn't gonna face this issue. :D

soranoo commented 6 months ago

I formatted the cli to LF https://github.com/soranoo/next-css-obfuscator/commit/f794bbd6f5bc6188435f4a452f97f361b6606793

Everything should work as expected in the latest version.