I understand that Prettier uses https://github.com/mrmlnc/fast-glob#pattern-syntax for the file/dir/glob element of its CLI.
For my package.json I need a prettier 'one-liner' to examine files which are NOT in the top level apps or modules folders (these folders have other formatting mechanisms).
According to fast-glob I expected to be able to run a command like this to run prettier over files NOT in those folders.
npx prettier '!{apps,modules}/**'
However, this never matches any files. What do I need to change about my syntax?
Related
I'm a newbie in Angular. I used angular-cli to learn about angular and I found the files tsconfig.json and tsconfig.app.json. Both of these are typescript related and I found this link useful.
But why two such files has been used? Why can't the configurations in these two files be combined in one file? Please help me figure this out.
there is nothing that prevents you from getting rid of the tsconfig.app.json. it's just an additional config file that allows you to adjust your configuration on an app basis. this is e.g. useful when you have multiple apps in the same angular-cli workspace.
you could have the root folder with the tsconfig.json and then a sub folder app-a with a tsconfig.app.json file and another app in the sub-folder app-b with it's own tsconfig.app.json, which contains a variation of the global configuration.
the difference in configuration could e.g. be the output directory outDir or the includes or excludes used.
The difference is that tsconfig.app.json is a file that is related to the Angular App in particular, while tsconfig.json is a more general file that contains general typescript configuration. It's especially useful when you have a micro frontends system, where there are multiple Angular subprojects, each of them with its own tsconfig.app.json configuration. But if you want you could perfectly merge these two files into one, actually you surely noticed that tsconfig.app.json contains the line:
"extends": "./tsconfig.json"
which means that the whole App uses the configuration stated in tsconfig.app.json plus the configuration in tsconfig.json
Just want to add one more point.
It seems the tsconfig.app.json(App specific one) will override the tsconfig.json(global one).
My issue was with the types declaration from node not in scope of my Angular project and I was getting compile errors saying Buffer is not found.
I first added the types declaration in tsconfig.json thinking it will take effect in every app.
But I had to add it to my app-specific tsconfig.app.json file for it to take effect on my app.
Trying to compile my project with a header and footer script that will be at the top and bottom of the output file respectively. Between them I want to include every other script in the project, including going recursively into subfolders.
I tried "..\script\header.js" "..\script\**.js" "..\script\footer.js" And the header is showing up at the top just fine but the footer ends up somewhere in the middle. Is there some way to exclude the footer file from the middle glob so that it only gets appended to the end?
Edit: Running the compiler from cmd in windows with the following command:
java -jar closure.jar --compilation_level "WHITESPACE_ONLY"
--create_source_map "source-map" --output_manifest "manifest"
--output_wrapper_file "output" --js_output_file="..\script.js"
"..\script\header.js" "..\script\**.js" "..\script\footer.js"`
The compiler does process exclusion globs natively. There are a few options to force the order:
Use dependency management. By utilizing either CommonJS or ES6 modules or by using Closure-library's goog.require and goog.provide calls, the compiler can auto sort your input files for you.
Split your files up such that you can construct a glob that does not include your footer.js file.
Use a pre-build tool that understands negation globs to handle your source file set.
All my projects contains alot of files with the same name 'file1.php file1.less file1.css file1.min.js file1.js file1.json'
Is there a plugin or a way to group all those files with same basename under eg. file1.php, just like the filewatchers does it.
The grouping relations can only be established when running watchers, so using watchers is the right way to go. It can indeed be a batch script that does nothing - this is the 'Output paths to refresh' option that matters: it should provide a pattern for files that has to be nested. For example, let you have same-named files with .php, .css and .js extensions in some folder, and like to nest the latter 2 in .php file (doesn't make much sense, but it's just an example).
create a .bat/sh file that does nothing (echos some string, etc.)
create a new custom file watcher, set 'php' as file type, your .bat - as a program
specify $FileName$ and $FileDir$ as 'Arguments' and 'Working directory' respectively
set $FileNameWithoutExtension$.css:$FileNameWithoutExtension$.js as 'Output paths to refresh'
Now when you modify your phpfile watcher will be run and nest .js and .css in .php
Currently it is not possible to perform such nesting/grouping manually (excluding File Watchers).. and I personally know no plugin that can do this.
Watch these tickets (star/vote/comment) to get notified on progress:
https://youtrack.jetbrains.com/issue/IDEA-113347
https://youtrack.jetbrains.com/issue/WEB-7635
I'm using the last version of PHPStorm, which is 7 I think and want to have file support for files using a pattern such as *.extension but those don't have an extension. I tried pattern *, which works, but puts all of my files in bash highlighting.
Does anyone have a solution for that without using the .sh extension?
Edit:
Bash file are recognize with extension .sh and .bash. It's working nicely, but what I want is to set default file type on files with no extension. If I add .* or * in the list of bash file, all my files are recognize like bash file.
Hope it's more clear, sorry for the probable mistake in my English.
It may seem weird - but you can try to actually list the files you're using explicitly reading their names.
Not sure of your use-case, but I needed it for git hooks, and there's not so much names for existing git hooks, so it's not that hard to list those :)
For the reference:
Preferences > Editor > File Types > Bourne Again Shell:
I looked at this question: ignoring folders in mercurial that mentions how to ignore a folder, but that's not what I need.
I'm using TortoiseHG and after I "add" all my folders, they show still as "?" instead of "+". The files within them show "+", but the folders themselves just show "?". Is this a problem with Mercurial on Windows XP? Or, is it a problem between my keyboard and my chair?
Mercurial adds only files in, and infers the folders from the actual file names. If you drop down to a command line and do hg status, you will see that folders are not listed at all. The files within the folder you added will be listed with the A tag, but the actual folders don't list in a hg status command.
You don't need to add the folders separately (in fact, Mercurial doesn't handle plain folders/directories at all). As long as your files are there, you're fine.