Redundant files after docpad generate --env static - docpad

I'm using the Clean URLs Plugin and I end up having redundant files in my /out/ directory after docpad generate --env static: one content.html and the same in /content/index.html
I suppose that's a wrong behaviour? Does it result because docpad run creates the files for the non static behavious, and docpad generate --env static the other ones afterwards?

To answer my own question:
I was looking at a file where something went wrong. Now there are still the redundant html files at first sight, but the ones in the root redirect to the others. So all good. When I looked before for some reasons I caught a strange glitch.

Related

No spec files found when running Cypress using scripts in package.json

I am trying to use script aliases in the package.json file.
In order for something like this to open the test runner,
"cy:open:prod": "cypress open --env ENV=production",
I run the command npm run cy:open:prod in the command line in the same folder that package.json is located.
The script runs and opens the test runner, however no spec files are found.
In all the examples I have found it describes this approach. Is there something I am missing in configuation to point it to where my spec files are?
Thanks in advance.
There is nothing basically wrong with the scripts in package.json, they look normal and would not cause the problem you mention.
I suggest you check the specPattern setting in configuration, it should match the naming convention you have chosen to use for your specs.
See e2e settings for more details.
Of you still have trouble with it, start a new project and let Cypress set the configuration for you, it will automatically match up the specPattern to the default value.

How to delete reports folder before every run in cypress?

I am storing my cucumber html report under cucumber-html-reports folder and json files are storing under cucumber-json folder. Now I want delete/empty these two folders. I need a plug in to achieve this.
The correct way to do this is to add an npm script to clean up the report folder and execute it before the test run. Cypress has an example npm script on their website for this. https://docs.cypress.io/guides/tooling/reporters#Command-line-3
Usually, the CI/CD pipeline would run the clean up script before the test run kicks off. Alternatively, you could add a little bit of code to your plugins file to exec the npm script before the test run as well.
One sort of hacky option, there is a trashAssetsBeforeRuns option in the Cypress config (set to true by default). It's used to clean up the downloads, videos, and screenshots folders before a test run. If you map your reporter results to one of these directories that might work, although I can't guarantee success with it since I haven't done that.

Prevent Docpad from scanning vendor files (but still copy them)

I've got a project which holds third party files (installed with Bower) under src/public/vendor. It seems ever since I added those docpad has gotten considerably slower in generating ./out, no doubt cause it's going over all the vendor files.
I'd like to exclude the vendor files from being interpreted by DocPad, but they should still be copied to ./out.
Is there a built-in way to do this through DocPad or should I simply put the vendor files outside the src directory and have Grunt copy it manually to ./out?
Your issue is legit and I raised the same a while ago :
https://github.com/bevry/docpad/issues/276
In the end, hypercubed developed the "raw" plugin available through npm :
https://npmjs.org/package/docpad-plugin-raw
Depending on what you provide as options, it can either do a cp or a rsync command.
So it basically what you intend to do with a Grunt task.

What is the recommended directory structure for Grunt projects

I am setting up a Grunt project for the first time. Is there a recommended directory structure? For example, keep sources under /src, intermediate build artifacts in /stage and final concatenated, minified artifacts in /dist.
I am also using compass/sass. I assume my scss files should go under /src, but what's the correct way to set up the build workflow so that I am building and testing quickly while not cluttering my source directory with build artifacts.
I just have /src and /build (which is your /dist), and no /stage. I haven't found a real need for stage, probably because I don't have much integration testing to do. Let me know what you're using /stage for -- I'm curious. :)
/myproject
/build
/src
/css
/sass
I do have both a /sass and a /css. /css holds the single main.css compiled w/ SASS. In my Gruntfile.js, I have 2 SASS targets, sass:dev & sass:build. sass:dev compiles into /src/css and sass:build into /build/css. /src/css/main.css is git-/svn-ignored.
At the end of the day, Grunt doesn't care how you organize your sources. It just assumes Gruntfile.js and /node_modules are at project root, and that's it. It's actually NPM that assumes package.json's at root.
So, try different structures and settle on one that you like, which always depends on what tools you use.
Hope this helps! :)
Running grunt init:jquery or grunt init:node should give you a pretty good start on answering this question.
Here is the result of running grunt init:jquery inside a directory called init_test and selecting the default answer for grunt-init's prompts.
Writing CONTRIBUTING.md...OK
Writing grunt.js...OK
Writing libs/jquery/jquery.js...OK
Writing libs/jquery-loader.js...OK
Writing libs/qunit/qunit.css...OK
Writing libs/qunit/qunit.js...OK
Writing README.md...OK
Writing src/init_test.js...OK
Writing test/init_test.html...OK
Writing test/init_test_test.js...OK
Writing LICENSE-MIT...OK
See https://github.com/gruntjs/grunt-init

Using Buildr within Docpad

I'm using DocPad to build my website, and in the docs it's saying that we can use an helper called buildr to bundle, compress files.
Is it possible to integrate buildr execution within the command docpad generate or docpad run?
Also does it needs it own config file buildr.coffee or it's possible to write the configs inside the docpad.config plugin section?
I imagine it would be more or less the same as this gist for grunt except with the grunt stuff changed to buildr.

Resources