tools icon indicating copy to clipboard operation
tools copied to clipboard

Analyze producing (almost) empty JSON file

Open benhjt opened this issue 7 years ago • 11 comments

Using polymer-cli 1.7.1 with a Polymer 2.0 component

When running polymer analyze > analysis.json, the following output is generated:

{
  "schema_version": "1.0.0"
}

Whereas before, the full json file would be created. When explicitly stating which file to analyze (polymer analyze my-component.html > analysis.json) the output is as expected. Not sure if this is to do with the Polymer 3 release expecting there to be a JS file or not? Not a big problem either as you can explicitly say which file to analyze.

benhjt avatar May 10 '18 16:05 benhjt

The root cause, if specifying source files works for you, is that v1.7 of the CLI's analyze and lint commands will try to infer the source files of your project from fields in polymer.json like sources, entrypoint, shell, fragments, etc.

rictic avatar May 10 '18 19:05 rictic

Then should this documentation https://www.polymer-project.org/3.0/docs/tools/documentation and https://www.polymer-project.org/2.0/docs/tools/documentation be updated?

igomezal avatar May 11 '18 08:05 igomezal

I just tried the polymer-modulizer in a set of elements...

But with the empty analysis.json after run the: polymer analyze > analysis.json I can't see the docs from the iron-component-page.

abdonrd avatar May 12 '18 11:05 abdonrd

I had a similar issue on an upgraded project using polymer-modulizer. Following comand solved my problem: polymer analyze -i ./paper-chip.js ./paper-chip-input.js > analysis.json

Protoss78 avatar Jul 07 '18 21:07 Protoss78

I recently ran into the same or similar issue when I tried to run polymer analyze for files in a directory where any parent directory is named bower_components or any parent directory ends in -test.

I specifically wanted to generate analysis for components inside a one instance of bower_components so I was able to workaround the issue just by configuring bower to use a different directory name via
--config.directory='alternate_dir' parameter (or you could just copy/move one of the installed bower modules out of bower_components and then run the analysis there).

At first my "project directory" was named something like "analysis-test" or similar and that didn't work either so I had to also remove "-test" from that parent directory name.

This was tested with polymer-cli 1.8.0. I did not run into this empty analysis issue outside of this directory name issue though. It is generating a fine analysis for me in a Polymer 2 component repository without having to specify input files.

Haprog avatar Oct 19 '18 11:10 Haprog

I thought I was going crazy ... thanks a lot @Haprog !

I can confirm that polymer analyze will fail (only producing schema-version) if files to analyze are within a bower_component directory. I did not check the -test stuff.

I also have to specify an input file via --input.

Analyzing Polymer 2.0 components with freshly installed polymer-cli (1.8.0).

Running on Linux, node v8.11.4.

christophe-g avatar Oct 19 '18 15:10 christophe-g

The problem still persists in 1.9.4 and the docs dont mention that ne filename need to be passed to analyze. Isse not fixed as 1.9.4

sebs avatar Jan 05 '19 11:01 sebs

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 03 '20 02:03 stale[bot]

If this repo is still maintained, please don't close this issue. The issue is clear. I could take a stab at a PR if someone can help me figure out what part of code is responsible for this filename filtering.

Haprog avatar Mar 03 '20 06:03 Haprog

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 05 '21 16:03 stale[bot]

I encountered a problem with polymer analyze *.html > analysis.json, where the output in analysis.json was just { "schema_version": "1.0.0" }.

The issue seemed to be related to the parent directory name being bower_components. For example, my components were located in a directory like D:/bower_components/iron-icon/*. After renaming this directory to something else, like alternate-dir, the problem was resolved.

D:/bower_components/iron-icon/*. When running bower update -y, it automatically generated subdirectories named bower_components under each component (e.g., D:/bower_components/iron-icon/bower_components/*). This seems to cause complications during the analysis process, possibly due to the naming conflict.

fOrceTea avatar Nov 27 '24 15:11 fOrceTea