Skip to content
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

bug(paths): build failed if “.js” in the end of the directory name #259

Open
Kristinita opened this issue Sep 13, 2022 · 2 comments
Open

Comments

@Kristinita
Copy link

1. Summary

If the directory name ends in .js, Grunt version of google-closure-compiler treats a directory as a file.

Files: js/Clipboard.js -> js/Clipboard.min.js
Files: js/Clipboard.js/KiraSimple.js -> js/Clipboard.js/KiraSimple.min.js

Fatal error: EISDIR: illegal operation on a directory, read

2. MCVE

See this configuration on the KiraGoogleClosureCompilerJSInPath branch of my GitHub repository for debugging and demonstrations.

  1. Gruntfile.coffee:

    module.exports = (grunt) ->
    
    	require('google-closure-compiler').grunt grunt
    
    	grunt.initConfig
    
    		'closure-compiler':
    			target:
    				files: [
    					expand: true
    					cwd: "js/"
    					src: ['**/*.js']
    					dest: "js/"
    					ext: '.min.js'
    					]
    
  2. js/Clipboard.js/KiraSimple.js:

    alert('Kira Goddess!');
  3. The part of the package.json:

    {
      "devDependencies": {
        "google-closure-compiler": "^20220905.0.0",
        "grunt": "^1.5.3"
      }
    }
    
  4. The part of the .travis.yml:

    install:
    - npm install -g google-closure-compiler grunt-cli
    - npm install
    
    script:
    - google-closure-compiler --js="js/**.js"
    - grunt closure-compiler --verbose --stack
    

3. Behavior

3.1. Desired

Successful compilation without errors. I get it if:

  1. I use directory name without characters “.js” at the end instead of directory “Clipboard.js”.

  2. For google-closure-compiler CLI I can’t reproduce the bug, see Travis build:

    $ google-closure-compiler --js="js/**.js"
    
    alert("Kira Goddess!");
    
    The command "google-closure-compiler --js="js/**.js"" exited with 0.

3.2. Current

See Travis build:

Initializing

Command-line options: --verbose, --stack, --gruntfile=/home/travis/build/Kristinita/SashaGruntDebugging/Gruntfile.coffee

Reading "Gruntfile.coffee" Gruntfile…OK

Registering Gruntfile tasks.

Initializing config…OK

Loading "Gruntfile.coffee" tasks…OK

+ closure-compiler

Running tasks: closure-compiler

Running "closure-compiler" task

Running "closure-compiler:target" (closure-compiler) task

Verifying property closure-compiler.target exists in config…OK

Files: js/Clipboard.js -> js/Clipboard.min.js

Files: js/Clipboard.js/KiraSimple.js -> js/Clipboard.js/KiraSimple.min.js

Options: args=undefined

Options: args=undefined

Fatal error: EISDIR: illegal operation on a directory, read

Error: EISDIR: illegal operation on a directory, read

The command "grunt closure-compiler --verbose --stack" exited with 3.

4. Environment

  1. Operating system

    1. Local — Microsoft Windows [Version 10.0.19041.1415]
    2. Travis CI — Ubuntu 22.04 LTS Jammy Jellyfish
  2. grunt-cli v1.3.2, grunt v1.5.3

  3. google-closure-compiler v20220905

Thanks.

@blickly
Copy link
Collaborator

blickly commented Sep 14, 2022

I haven't investigated, but it's not hard to imagine this assumption creeping in somewhere.

@ChadKillingsworth, do you have a comment/opinion here?

@ChadKillingsworth
Copy link
Collaborator

It seems likely that this is within the grunt plugin in some way. It will take some research to figure out exactly what is causing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants