How can I add IgnorePath for yuidoc - yuidoc

While generating document form yuidoc I want to ignore downloaded javascript libraries inside lib folder of my project. How can I place that into ignore list
I tried
"ignorePaths": [ "./lib" ],
"ignorePaths": [ "./lib/*.js" ],
"ignorePaths": [ "lib" ]
still it's compiles my javascript library files.

Instead, try using the exclude option as discussed here https://github.com/yui/yuidoc/issues/5
"exclude" : ["lib"]

I'm adding an answer with a little more detail since I ran into this problem yesterday and it could be helpful to someone else.
As #slolife mentioned, you should be using "exclude".
The value for "exclude" needs to be a String of comma separated directories (not Array). This can be done via your JSON config file as one of the "options" or as a command-line argument.
Single Directory Examples
JSON Config File
{
"name": "My Project",
"options": {
"exclude": "lib"
}
}
Command-line
yuidoc . -x "lib"
Multiple Directories Examples
NOTE: NO spaces between directories in the list
JSON Config File
{
"name": "My Project",
"options": {
"exclude": "lib,lib2"
}
}
Command-line
yuidoc . -x "lib","lib2"
Reference: http://yui.github.io/yuidoc/args/index.html

Related

How can I create an environment file during a cloud build process

How can I pass environment variables to a Gatsby build task in a Google Cloud Build CI process? Using the substitution variables I can make variables available in the cloudbuild.json file but these then need to be available in the build task.
Gatsby uses a .env.production file to hold the environment variables which are then available using the dotenv package. At the top of my gatsby-config.js file I set the path to the environment file as follows:
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
Further down the file I use these variables to configure the gatsby-plugin-firebase plugin for Firebase. Given that I need an environment file, I have tried to create one in the cloudbuild.json file before running the build step.
{
"steps": [
{
"name": "ubuntu",
"args": ["echo", "FIREBASE_API_KEY=$_FIREBASE_API_KEY\\nFIREBASE_AUTH_DOMAIN=$_FIREBASE_AUTH_DOMAIN\\nFIREBASE_DATABASE_URL=$_FIREBASE_DATABASE_URL\\nFIREBASE_PROJECT_ID=$_FIREBASE_PROJECT_ID\\nFIREBASE_STORAGE_BUCKET=$_FIREBASE_STORAGE_BUCKET\\nFIREBASE_MESSAGING_SENDER_ID=$_FIREBASE_MESSAGING_SENDER_ID\\nFIREBASE_APP_ID=$_FIREBASE_APP_ID\\nFIREBASE_MEASUREMENT_ID=$_FIREBASE_MEASUREMENT_ID", ">", ".env.production"]
},
...More steps here...
{
"name": "node:14.4.0",
"entrypoint": "npm",
"args": ["run", "build"]
},
{
"name": "node:14.4.0",
"entrypoint": "./node_modules/.bin/firebase",
"args": ["deploy", "--project", "$PROJECT_ID", "--token", "$_FIREBASE_TOKEN"]
}
The .env.production file does not exist when I get to the build step, which I think is because it has been created in the ubuntu container. How can I create an environment file that can be read by the build step. Or is there a better way of passing the variables?
Thanks,
Your first step is wrong, you only echo the command, not execute it. Change it like this
{
"steps": [
{
"name": "ubuntu",
"entrypoint": "bash",
"args": ["-c", "echo FIREBASE_API_KEY=$_FIREBASE_API_KEY\\nFIREBASE_AUTH_DOMAIN=$_FIREBASE_AUTH_DOMAIN\\nFIREBASE_DATABASE_URL=$_FIREBASE_DATABASE_URL\\nFIREBASE_PROJECT_ID=$_FIREBASE_PROJECT_ID\\nFIREBASE_STORAGE_BUCKET=$_FIREBASE_STORAGE_BUCKET\\nFIREBASE_MESSAGING_SENDER_ID=$_FIREBASE_MESSAGING_SENDER_ID\\nFIREBASE_APP_ID=$_FIREBASE_APP_ID\\nFIREBASE_MEASUREMENT_ID=$_FIREBASE_MEASUREMENT_ID > .env.production"]
},

How do I change the name of a dotnet new template when creating new projects?

I've created a dotnet template for use with dotnet new. When creating new projects from this template, it works fine however the assembly and namespace name is still "Template", rather than the new project.
I've tried creating a new project and manually setting the name with the --name flag and --output flag, but to no avail.
I suspect there's a variable I can use somewhere, perhaps in the template.json file?
Thanks,
You have to set template then use option params like -n param and give name.
For example,
dotnet new web -n myBestName
you can see more about cli
source click here
You need to set sourceName in your template.json file.
You can refer to this page to find the purpose of each field.
"sourceName": {
"description": "The name in the source tree to replace with the name the user specifies",
"type": "string"
},
http://json.schemastore.org/template
A basic example of template.json file would look like this. Notice the sourceName
{
"$schema": "http://json.schemastore.org/template",
"author": "Me",
"classifications": [ "web api", "asp.net core", "C#" ],
"identity": "WebApi.Template",
"name": "WebApi.Template",
"shortName": "WebApiTemplate",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "WebApi.Template",
"preferNameDirectory" : true
}
If you use template.json similar to above, you can give your component name in cli command either with dotnet new YourTemplateName -n YourComponentName or running just dotnet new YourTemplateName inside the folder named with your component name.

What is a standard (Qt) way to create single ui.qml file?

In Qt app example, they use single *.ui.qml form files. I understand everything but I was used to creating 2 files, for example, Contact.qml and ContactForm.ui.qml, instead of one ContactForm.ui.qml. Now if I want to create such a single form file, I have/see two options:
While creating standard QML file (Qt Quick 2), I give name and whole .ui.qml extension.
I create QtQuick Ui File (which creates 2 files) and delete one (business logic) file.
For me, both options seem to be workarounds, not the Qt way. Could you show me the Qt way?
(Casually, you can open not only .ui.qml but any qml file in design mode if you follow the roles see this post).
The list of wizards seen when adding new in Creator, are the standard wizards that Qt probably thinks are sufficient and suitable with a general perspective.
Qt offers a solution though ... you can add your own custom wizard to the list of standard wizards in Qt Creator, following Qt documentation Adding New Custom Wizards creation procedure, so you can add more to existing wizards.
Specifically for .ui.qml only (without the qml file) creation, the section Adding JSON-Based Wizards in the above documentation works just fine, for example:
Start Creator from command line with verbose option:
Qt_base\Tools\QtCreator\bin>qtcreator.exe -customwizard-verbose
In Tools, Options, Keyboard ... filter by Factory.Reset and fill up a new short cut, if one does not exist, for example Ctrl+Alt+F10
In folder C:\Qt\Tools\QtCreator\share\qtcreator\templates\wizards\classes ... copy the wizard folder used to create .ui.qml qtquickui and rename it to any name.
Now and most important, inside the new folder, edit the wizard json file to customize your new wizard ..
(1) Give new id following roles described in the link
(2) under options remove the option for adding qml file along with the form.
(3) under pages, remove the field that prompts for qml file name.
(4) in section "name": "FormClass", modify "trText": "%{Class}Form" to "trText": "Form"
(5) under generators , remove the qml file generator and keep the .ui.qml file generator.
After editing is completed, you can now activate the new wizard, to do that press the short cut created above (Ctrl+Alt+F10) and that's all! you should now see your new wizard when you go Add new under Qt section ...
Here is modified version of wizard.json
{
"version": 1,
"supportedProjectTypes": [ ],
"id": "S.QtQuickUi",
"category": "R.Qt",
"trDescription": "Creates a Qt Quick Designer UI form along with a matching QML file for implementation purposes. You can add the form and file to an existing Qt Quick Project.",
"trDisplayName": "QtQuick UI File Only",
"trDisplayCategory": "Qt",
"iconText": "ui.qml",
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.UiFiles" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}",
"options" : [
{ "key": "UiFile", "value": "%{FormClass}.%{JS: Util.preferredSuffix('application/x-qt.ui+qml')}" }
],
"pages" :
[
{
"trDisplayName": "Define Class",
"trShortTitle": "Details",
"typeId": "Fields",
"data" :
[
{
"name": "FormClass",
"trDisplayName": "Component form name:",
"mandatory": true,
"type": "LineEdit",
"data": {
"validator": "(?:[A-Z_][a-zA-Z_0-9]*|)",
"fixup": "%{JS: '%{INPUT}'.charAt(0).toUpperCase() + '%{INPUT}'.slice(1) }",
"trText": "Form"
}
},
{
"name": "TargetPath",
"type": "PathChooser",
"trDisplayName": "Path:",
"mandatory": true,
"data":
{
"kind": "existingDirectory",
"basePath": "%{InitialPath}",
"path": "%{InitialPath}"
}
}
]
},
{
"trDisplayName": "Project Management",
"trShortTitle": "Summary",
"typeId": "Summary"
}
],
"generators" :
[
{
"typeId": "File",
"data": [
{
"source": "fileForm.ui.qml.tpl",
"target": "%{TargetPath}/%{UiFile}",
"openInEditor": true
}
]
}
]
}
This just seems like a missing feature in Creator. Go with option #1 since it's less work, and report a suggestion/bug that there should be a way to create standalone .ui.qml files.

Use Composer $COMPOSER_VENDOR_DIR in autoload filepath

I am using Symfony for a Dockerized app. I need to move my composer vendors directory, so I did set the environnement variable $COMPOSER_VENDOR_DIR to /root/app-vendors.
The vendors are correctly located to this directory, but it causes troubles with the Symfony VarDump component. By default in Symfony 2, it is loaded from composer like this:
"autoload-dev": {
"files": [
"vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
]
}
In my case, this path becomes wrong. I'd like to do something like this:
"autoload-dev": {
"files": [
"{$COMPOSER_VENDOR_DIR}/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
]
},
But I don't see anything in the composer documentation about using env variables in a composer.json filepath.
I want to move the vendors in dev mode, but I want them to be in the default location if $COMPOSER_VENDOR_DIR is not set ; so I cannot put absolute filepath in autoload-dev section like this:
"autoload-dev": {
"files": [
"/root/app-vendors/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
]
},
A simple solution after a few days of step back:
Create this file on app/dump.php
<?php
$vendorsDir = getenv('COMPOSER_VENDOR_DIR')
?: __DIR__.'/../vendor';
require "$vendorsDir/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php";
Then autoload this file instead of the Symfony one
"autoload-dev": {
"files": [
"app/dump.php"
]
},
Note:
COMPOSER_VENDOR_DIR default is "vendor", see https://getcomposer.org/doc/03-cli.md#composer-vendor-dir

Grunt specify order of injected files in index.html

I am using a angular-fullstack yeoman generator for one of my projects and if I run grunt build my index.html is overwritten with the injected dependencies that grunt-injector finds. The problem is that I want to specify the loading of some of the modules in a certain order or I just want to ignore a specific folder. How can I do that? Currently some javaScript files are loaded in a wrong order and every time I run grunt build I get an error.
you can use arrays to specify the order, for instance
// Inject application script files into index.html
scriptsVendor: {
options: {
transform: function(filePath) {
filePath = filePath.replace('/app/', '');
return '<script src="' + filePath + '"></script>';
},
starttag: '<!-- injector:js -->',
endtag: '<!-- endinjector -->'
},
files: {
'app/index.html': [
[
'app/lib/js/jquery.js',
'app/lib/js/bootstrap.js',
'app/lib/js/angular.js'
],
[
'app/lib/js/angular-*.js',
'app/lib/js/ui-*.js'
]
}
}
So I load before jquery then bootstrap, angular. In the next block all the angular modules starting with angular- and ui-.
To ignore certain files or folder
!app/lib/js/*.min.js
!app/lib/js/folder_to_ignore/*.js
Even if a bit late I hope it helps :-)
in my case I have several angular modules, with config and run functions, seperated over three files called xyz.module.js, xyz.config.js, xyz.run.js
Gulp searches for all .js files : "**/*.js" and alphabetical order is used when injecting, hence *.module.js is loaded after *.config.js, which delivers errors about lacking xyz module definition.
So the order should be switched. I don't want to use hardcoded arrays, I want to keep using wildcards.
Solution which does it in my case :
https://ww
usage (in gulpfile) :
var angularFilesort = require('gulp-angular-filesort');
gulp.src(['./src/app/**/*.js']).pipe(angularFilesort())
Just to tag on to #felix-at-housecat's answer, I needed to ensure that angular-translate-handler-log.js was rendered after angular-translate.js, but due to alphabetical sorting, it would show up before. To achieve this, I set up the injector as follows:
injector: {
dev: {
files: {
'dist/static/index.html': [
[
'dist/static/js/lib/jquery.js',
'dist/static/js/lib/bootstrap.js',
'dist/static/js/lib/angular.js',
'dist/static/js/lib/angular-*.js',
'dist/static/js/lib/angularjs*.js',
. . .
'!dist/static/js/lib/angular-translate-handler-log.js'
],
[
'dist/static/js/lib/angular-translate-handler-log.js'
]
]
},
. . .
Now, /angular-translate-handler-log.js will be rendered in the file after all of the files in the first array (which includes angular-translate.js).

Resources