Angular 6 - How to stop generating spec files - json

In Angular 5 and earlier versions, to stop generating the spec files while generationg a component we had to add the following in .angular-cli.json file:
{
...
"defaults": {
"spec": {
"class": false,
"component": false,
"directive": false,
"module": false,
"pipe": false,
"service": false
}
}
}
in Angular 6+, following this link we have to add the next in the new angular.json file, under the schematics section:
....
"schematics": {
"#schematics/angular:component": {
....
"properties": {
....
"spec": {
"type": "boolean",
"description": "Specifies if a spec file is generated.",
"default": false
}
}
}
},
But when generating a new component a new spec file is still created, even after IDE restart, what is missing ?

You can set it in the angular-cli.json as
{
"defaults": {
"component": {
"spec": false
}
}
}
This will disable generating all spec files. If you want to disable on a specific component,
ng g c component-name --spec false

Thanks to the link provided here by G. Ross, the solution despite it doesn't match the official documentation of Angular 6 but it worked for me.
added the next in the "angular.json" file, under the schematics section:
....
"schematics": {
"#schematics/angular:component": {
....
"spec": false,
....
}
},

You can simply use to generate a component without its spec files ng g c NewComponent --spec=false

Related

Can you clip (or trim) an mp3 using AWS Mediaconvert?

I have mediaconvert jobs encoding mp3 uploads into various formats. I'd like to also create a 30 second "preview" of an mp3 file by trimming the file to start at 10 seconds and end at 40 seconds.
I have tried setting "input clippings" by adding timecode references as below, but it seems to get ignored completely and encodes the whole file. Perhaps this is because mp3 files don't strictly have Timecode? These settings are in my Input json (PHP SDK):
"Inputs": [
{
"AudioSelectors": {
"Audio Selector 1": {
"Offset": 0,
"DefaultSelection": "DEFAULT",
"SelectorType": "TRACK",
"ProgramSelection": 1
}
},
"FilterEnable": "AUTO",
"PsiControl": "USE_PSI",
"FilterStrength": 0,
"DeblockFilter": "DISABLED",
"DenoiseFilter": "DISABLED",
"TimecodeSource": "EMBEDDED",
"FileInput": "'$file'",
"InputClippings": [
{
"EndTimecode": "00:00:45:00",
"StartTimecode": "00:00:20:00"
}
]
}
]
I have also tried adding the inputclipping in this format :
"inputs": [
{
"inputClippings": [
{
"endTimecode": "00:00:40:00",
"startTimecode": "00:00:10:00"
}
],
"audioSelectors": {
},
I think this parameter is case sensitive. I do input clipping in MediaConvert occasionally and it works for me. Maybe try this:
"Inputs": [
{
"InputClippings": [
{
"EndTimecode": "00:00:40:00",
"StartTimecode": "00:00:10:00"
}
],
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT",
"ProgramSelection": 1
}
},
"FileInput": "s3://my-bucket/abc.mp4"
}
]
The InputClippings feature is not currently supported for audio-only inputs. MediaConvert silently ignores this parameter rather than returning a warning or error for audio-only inputs.
Resource: https://docs.aws.amazon.com/mediaconvert/latest/ug/feature-limitations-for-audio-only.html

Editing Prettier options in Vscode

I need to enable .tpl files to be formatted like HTML by Prettier.
I've found on GitHub this block of code who should do it :
overrides: [
{
files: '*.html.tpl',
options: { parser: 'html' },
},
],
How should I implement it?
Go to File -> Preferences -> Settings.
In the search for box, search for "Associations" and then click on "Edit on settings.json".
Add the following to the JSON file:
"files.associations": {
"*.html.tpl": "html"
}
You have multiple options as of the syntax you want to use.
Here is an exemple in JSON:
//.prettierrc.json
{
"semi": false,
"overrides": [
{
"files": "*.html.tpl",
"options": { "parser": "html" },
},
],
}
You have more exemples on the documentation.

ESLint rule error for import

I am getting the below error by eslint.
I have added ecmaFeatures: { "modules": true } in the .eslintrc file as well.
Because you're getting that message, it looks like you've upgraded to ESLint 2.0, which is great! I can see two changes that you'll make to your configuration, though if anything else comes up, it's probably covered under the 2.0 migration guide:
In 2.0, "ecmaFeatures": { "modules": true } has become "parserOptions": { "sourceType": "module" }.
We replaced space-after-keywords with a new rule, keyword-spacing, which was introduced in one of the 2.0 betas. If you were using "space-after-keywords: 2, you can change that to "keyword-spacing": 2 now.
Putting that all together, your .eslintrc for ESLint 2.0 should include something like this:
{
"parserOptions": {
"sourceType": "module"
},
"env": {
"es6": true
},
"rules": {
"keyword-spacing": 2
}
}

hide certain hidden folders from my sublime project

How do I hide certain hidden folders that are nested 3 folders deep from my sublime project.
{
"folders":
[
{
"path": "/C/Users/me/Desktop/files/siteFiles/happy site/trunk"
},
{
"folder_exclude_patterns": ["myHiddenFolder",".svn", "._d", ".metadata", ".settings"]
}
]
}
You need to edit your .sublime-project file like so:
{
"folders":
[
{
"path": "/C/Users/me/Desktop/files/siteFiles/happy site/trunk",
"folder_exclude_patterns": ["myHiddenFolder",".svn", "._d", ".metadata", ".settings"]
}
]
}
Save the file, and you should be all set. For more info on project settings, check out the docs.

Chrome WebNavigation Listener not working

I'm creating my own extension for Google Chrome (for my own use, not to be published). At the moment I have two files:
manifest.json:
{
"manifest_version": 2,
"name": "abcdef",
"description": "abcdef",
"version": "0.1",
"permissions": [
"tabs",
"webNavigation",
"http://www.ztm.waw.pl/*"
],
"background": {
"scripts": ["bg.js"],
"persistent": false
}
}
bg.js:
chrome.webNavigation.onCompleted.addListener(function(o) {
chrome.tabs.executeScript(o.tabId, {
code: "alert('ok');"
});
}, {
url: {
hostContains: 'ztm.waw.pl'
}
});
I want the alert box to appear when I navigate to http://www.ztm.waw.pl, but it does not work. Could someone tell me why?
The url property of chrome.webNavigation.onCompleted accepts an array of chrome.events.UrlFilter (source), so you'll need to change your bg.js to this (note the square and curly brackets in the url property):
chrome.webNavigation.onCompleted.addListener(function(o) {
chrome.tabs.executeScript(o.tabId, {
code: "alert('ok');"
});
}, {
url: [
{hostContains: 'ztm.waw.pl'}
]
});