BigCommerce stencil bundle theme validating issues in schema.json file - json

Hello developers out here!
I struggle with stencil bundle and stencil push issues.
I get error at "Validating theme..."
Error: Your theme's schema.json has errors:
schema[1].settings[28].options[0].value should be string,number
schema[1].settings[28].options[1].value should be string,number
...
It seems that I get this issue after try to test latest cornerstone (5.4.5) theme version, and update stencil-cli and now I can't use oldest version (1.10.0) schema.json file -> https://github.com/bigcommerce/cornerstone/blob/1.10.0/schema.json
Now it only works with these two files:
schema.json -> https://github.com/bigcommerce/cornerstone/blob/4.5.4/schema.json
schemaTranslations.json -> https://github.com/bigcommerce/cornerstone/blob/4.5.4/schemaTranslations.json
But I am not sure how it would impact live site work if I use different schema files.
It is possible to work again with old schema.json file?
Previously all worked...
I tried to:
delete all node_modules
reinstall #bigcommerce/stencil-cli
and node modules (npm install)

These look similar to errors when the schema.json or schemaTranslations.json file have been removed or modified, could you add any relevant schema code in your post? Since Stencil CLI 2.0, part of the bundle process now validates a schemaTranlsations.json file which has been included since Cornerstone 4.5.4. This change can be found on the GitHub repo here as well as on our DevCenter Changelog.

Hello #dakterits and #kyle-obrien
The error which you mentioned means that option number 0 and 1 in setting number 28 in the schema file has either empty value or different value. So, to fix this issue, you don't have downgrade the node or reinstall stencil or delete any file.
The Solution:
Download the original copy of the theme.
Edit the original theme schema file.
If you have any file compare software then compare edited theme schema with original theme schema.
Once you compare, you will definitely see any change in value in defined settings.

Related

Docstrings are not generated on Read the Docs with Sphinx autodoc and napoleon extensions

I am using the Sphinx autodoc and napoleon extensions to generate the documentation for my project (Qtools). This works well on my local machines. I am using Sphinx 3.1.2 (or higher). However, when I build the documentation on Read the Docs (RTD), only text added directly to the reStructuredText files that form the source of the documentation is processed. The docstrings that are supposed to be pulled in by autodoc do not appear in the HTML documentation generated by RTD. So for example in docs\source\section2_rsdoc.rst I have:
Response spectra
================
The response spectrum class
---------------------------
.. autoclass:: qtools.ResponseSpectrum
:members:
Response spectrum creation
--------------------------
.. autofunction:: qtools.calcrs
.. autofunction:: qtools.calcrs_cmp
.. autofunction:: qtools.loadrs
See also :func:`qtools.convert2rs` (converts a power spectrum into a response spectrum).
This results in:
Response spectra
The response spectrum class
Response spectrum creation
See also qtools.convert2rs (converts a power spectrum into a response spectrum).
In other words, all directives are apparently ignored, and hyperlinks to other functions are not added. I have examined several basic guidance documents such as this one, but I cannot figure out what I am doing wrong. RTD builds the documentation without any errors or warnings. In RTD advanced settings I have:
Documentation type: Sphinx HTML
Requirements file: requirements.txt
Python interpreter: CPython 3.x
Install Project: no
Use system packages: no
Python configuration file: blank
Enable PDF build: no
Enable EPUB build: no
I haven't touched any other settings.
In conf.py I have tried the following variations of line 15: sys.path.insert(0, os.path.abspath('.')), sys.path.insert(0, os.path.abspath('../..')) and the current sys.path.insert(0, os.path.abspath('../../..')). None of those made any difference.
I would be grateful for any help!
RTD builds the documentation without any errors or warnings
This is slightly incorrect. As you can see in the build logs, autodoc is emitting numerous warnings like this one:
WARNING: autodoc: failed to import class 'ResponseSpectrum' from module 'qtools'; the following exception was raised:
No module named 'qtools'
This has happened for all your variations of sys.path.insert, as you can see in some past builds.
Trying to make it work this way is tricky, since Read the Docs does some magic to guess the directory where your documentation is located, and also the working directory changes between commands.
Instead, there are two options:
Locate where the conf.py is located (see How do you properly determine the current script directory?) and work out a relative package from there.
Invest some time into making your code installable using up-to-date Python packaging standards, for example putting all your sources inside a qtools directory, and creating an appropriate pyproject.toml file using flit.

How to use docson widget with Sphinx on ReadTheDocs

I'm working on the documentation (https://global-coffee-data-standard.readthedocs.io) of my JSON schema (https://raw.githubusercontent.com/andrejellema/GlobalCoffeeDataStandard/master/schema/global-coffee-data-standard.schema.json)
The basics I have working (thanks to a lot of help from this forum) but now I would like to include the docson widget to show my code more beautiful (https://global-coffee-data-standard.readthedocs.io/en/latest/explanation.html#id13)
I've read this page https://threesixtygiving-standard.readthedocs.io/en/latest/_static/docson/README/ and I'm wondering how to install docson locally but more important on ReadTheDocs.
Do I need to run npm i docson localy? If so which files do I commit to my _static folder so ReadTheDocs can work with it as well?
Or can I put some magic in conf.py to let Sphinx handle it?
EDIT
I tried adding the docson files to my _static folder and it seems to work when I add this code to my ReST file:
<script src="_static/docson/js/widget.js" data-schema="https://raw.githubusercontent.com/andrejellema/GlobalCoffeeDataStandard/master/schema/global-unique-id.json"></script>
But only when I add just one docson widget. When I add more I get this error in the console:
only one instance of babel-polyfill is allowed.
So I'm assuming this is not the correct workflow.
What is the correct workflow to add multiple docson widgets to my page.

Can't build debug version Azure Function in Visual Studio

I'm trying Azure Functions for the first time and have been able to build and publish "Release" versions without any issue.
I want to step through the code and so need to create and publish a "Debug" version but when I try and build I get the following errors with the same code:
CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyProductAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute
From researching this error the main suggestion has been to remove them from the AssemblyInfo.cs file but rebuilds just put them back in again and the "Release" version is happy with these settings being there.
What am I missing so I can create a "Debug" version of the code?
Thanks
According to your description about CS0579 Duplicate error ,I suppose some temporary *.cs files generated during compilation got accidentally added to the project. The files were from the obj\Debug directory, you could try to delete these files to solve problem. For more details, you could refer to this SO thread.
In my case, some temporary *.cs files generated during compilation got accidentally added to the project.
The files were from the obj\Debug directory, so they definitely shouldn't have been added to the solution. A *.cs wildcard went a little crazy and added them incorrectly.
If it doesn't work, there are also other solutions you could have a try. Such as right click project name>choose Edit FunctionName.csproj. Edit the csproj and turn the generation of the attributes causing the issues off. More solutions you could refer to this article.
Resolution
I found this issue on GitHub where there were a couple of options to resolve this issue which I am going to cover here plus a third option I tried not mention in the issue.
I have managed to now get the Debug to build by following one of Janley's link and adding 4 extra lines into the .csproj file:
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>

VS Code, format HTML code with Twig or Swig tags

Is there a way to format correctly HTML in VSCode when we use Twig or Swig tags, like
{% if ... %} {%else%} {%endif%} {% for %} {%endfor%} {% include %}, etc...
For now code formatters remove all line breaks before and after those tags.
Was not able to find an suitable extension for that.. Neither a way to configure the internal code formatter.
I had the same problem and solved installing this extension:
Twig Language
Install it, restart the editor and ff you are on windows you can format with standard ALT + SHIFT + F.
Hope it helps.
I've been struggling SO MUCH with this, and finally found a fully working solution; so wanted to share it here. Follow the steps below and you should be good to go:
Download the Vs Code Extension Prettier Code Formatter. Pay close attention to grab this Prettier Package, as Visual Studio proposes several different Prettier Extension Packages.
In the Visual Studio Editor, go to Settings --> type "format" until the formatting settings pop up, and then select Prettier Code Formatter - esbenp.prettier-vscode as your default formatter. Do this for both the User as well as the Workspace tab, if not automatically done.
Next, you'll need to add the melody plugin used for the proper formatting of twig files using Prettier in Vs Code. This is actually a nodejs package, so you first need to install Node JS. It can occur that you will run into permission issues when installing node packages later on. To try to avoid this at max, install node using a nvm.
Now you can install the melody plugin. To do so, follow the instructions of the linked repository. Note that you previously need to install yarn if you don't have it already installed, via npm install --global yarn.
To hold project-specific formattings within your github repo / project, you can add a .vscode/settings.json file which holds the general prettier configs you're currently using in your project. That's pretty useful to share the prettier formatting settings across developers / repos.
Also add the .prettierrc file to your projects root, with the following content:
{
"printWidth": 80,
"tabWidth": 4,
"plugins": ["./node_modules/prettier-plugin-twig-melody"]
}
This defines the additional use of the above-mentioned plugin. You may adapt the configs according to your needs. You can either put your node_modules folder holding the package within it into your local project, or adapt the path as needed to wherever your melody plugin is located on your local machine.
FYI: The node_modules folder is normally not uploaded to project repos due to its size. Once you install node, you will automatically get that node_modules folder on your local machine. And when you then install the above-mentioned package, it should get installed into that node_modules folder.
Now add the Twig Syntax highlighting package from whatwedo. Now, VS Code should recognize Twig files when you open them. Verify this by opening a .twig file within VS Code and checking in the bottom right corner that the file is recognized as HTML (Twig). This will additionally highlight your swig tags.
To verify that everything's working properly, you can open the prettier terminal by clicking on Prettier at the bottom right in your VS Code. Now write some twig content into a .twig file and trigger the formatter. If no errors were reported in the console, and the console informs that the melody plugin is used for formatting; and of course the code has been properly formatted; you're good to go.
There is a built-in way nowadays; when you try to format a document you get forwarded to the extension page and a search for a formatter for a given file format. For Twig:
category:formatters twig
Twig Language 2 seems to be the go-to VS Code Twig extension with the best formatter as of now.
Something related to this, i did it by installing twig in vs code.
Open VS Code and
Ctrl+Shift+X
And get the twig extension and install it. Thanks.

Magento Layoutviewer (Alan Storm) not working after installation

Magento version: 1.9.2.4
I am currently working through this tutorial, and am trying to install the Layoutviewer module.
I following the link on the page to where I could get the layout viewer, and then used the manual install guide on this page to install it.
The module is being detected by magento, and is listed on the Disable Modules Output section (it is enabled).
The directory tree for the module is as follows:
magento1
app
code
local
Magentotutorial
Layoutviewer
I have also made sure that the config file's name and contents are 100% correct.
When I try to use the module (http://127.0.0.1/magento1/helloworld/index/index/?showLayout=page) it doesn't work, and just shows me the screen as it was before.
Is there anything I could be missing, or did I perhaps install the module incorrectly?
edit
I have already found this previous question that is basically identical to mine, but it's very old so I don't want to comment on in - it did not help me solve the problem.
Problem resolved:
I placed the Layoutviewer in the Magentotutorial directory, but it was supposed to be in it's own (Alanstormdotcom) directory.
Both of these solutions worked:
Move the module to the correct directory or
Replace all references to Alanstormdotcom/alanstormdotcom to Magentotutorial/magentotutorial
Found this Googling for the same problem. My problem was that I put Storm's module in /community/Alanstormdotcom/. It won't work from there, it must be in local (/local/Alanstormdotcom/).