Babel doesn't ingore files outside the directory - babeljs

Here is my directory structure:
root/
└── nodejs_project/
├── node_modules/
├── src/
├── babel.config.json
├── package.json
└── package-lock.json
└── another_project/
└── folder1/
└── static/
└── folder2/
└── static/
Here is my babel.config.json
{
"presets": ["#babel/react", "minify"],
"ignore": ["**/*.min.js"]
}
Ignoring works well when .js files are in src/ directory:
...\root\nodejs_project>npx babel src/ --out-dir src/ --out-file-extension .min.js
But ignore rule stops working when .js files are in another_project/ directory:
...\root\nodejs_project>npx babel ../another_project/ --out-dir ../another_project/ --out-file-extension .min.js
How can I set babel.config.json to ignore all of the *.min.js files in another_project/ directory?

This helped me in any directories:
{
"presets": ["#babel/react", "minify"],
"ignore": ["../**/*.min.js"]
}

Related

How to change the default directory structure of dh_make so that dpkg-buildpackage does not throw any errors

I am trying to create a debian package for a postgreSQL extension Apache-age release 1.1.1 and created the directory structure using dh_make command.
The directory structure is as follows:
age-1.1.1 (project root)
├── debian
│   ├── changelog
│   ├── compat
│   ├── control
│   ├── docs
│   ├── examples
│   ├── links
│   ├── manpages
│   ├── menu
│   ├── postinst
│   ├── postrm
│   ├── preinst
│   ├── prerm
│   ├── rules
│   ├── source
│   └── watch
├── src
└── Makefile
The dpkg-buildpackage -b when run from project-root folder it looks for debian folder, then reads the rule file, then reads the Makefile located in the project root to build the package.
I want to change the directory structure to the following:
.project root
├── packaging
│ ├── debian
│ │ ├── control
│ │ ├── control.in
│ │ ├── changelog
│ │ ├── copyright
│ │ ├── pgversions
│ │ ├── rules
│ │ └── ...
│ └──
├── src
├── LICENSE
├── README.md
├── Makefile
└── ...
I want to change the directory structure so that the dpkg-buildpackage -b command can be run from the packaging folder and it should build the package.
Inside your Makefile
Modify the install paths accordingly. It should point to your packaging/debian/* where * is the filename.
This way the Makefile can point to the correct file path target inside the new folder structure.
I'm not sure if this is the best way to do this but it's working for me:
Here are the steps:
First run the dh_make_pgxs command from the project root directory.
Create a packaging directory in the project root and move the debian directory created in step 1 to this directory along with the Makefile, age.control and the age--1.1.1.sql.
Your file structure should look like this:
.project root
├── packaging
│   ├── debian
│   │   ├── control
│   │   ├── control.in
│   │   ├── changelog
│   │   ├── copyright
│   │   ├── pgversions
│   │   ├── rules
│   │   └── ...
│   ├── age--1.1.1.sql
│   ├── age.control
│   ├── Makefile
│   └── ...
├── src
├── LICENSE
├── README.md
└── ...
Change the file paths in the Makefile like:
src/backend/age.o should be ../src/backend/age.o.
./tools/ should be ./../tools/.
and so on.
Now you can simply run the dpkg-buildpackage -b command from the packaging directory to build the debian package.
Note: In step 1 we are running dh_make_pgxs in the project root first, this is to make sure that the project name in the control files and the version in the changelog file are correct. In this case the name/source in control, control.in & changelog files should be apache-age and the version number in changelog file should be 1.1.1-1.
Alternatively, you can run the command from the packaging directory and manually change the name and version in the control and changelog files.

Visual Studio Code and subfolder-specific settings

My workspace root is a git repository containing couple of files and several git submodules. Each submodule have their own .vscode/settings.json. I was expecting VSCode to adjust its settings based on which submodule/subfolder I'm working in but it's not working as expected.
Is it possible?
I think it's possible if you use a multi-root workspace (which is supported since 1.18), but in my case I'd like to keep that single-root workspace.
I also couldn't find a decent answer for this, I did find an "hacky" workaround. I have the following project structure:
.
├── apps
│   ├── api
│   │   ├── Dockerfile
│   │   ├── .gitignore
│   │   ├── hhapi
│   │   ├── manage.py
│   │   ├── .pylintrc
│   │   ├── requirements.txt
│   │   ├── venv
│   │   └── .vscode
│   └── crawler
│   ├── crawler-crontab
│   ├── Dockerfile
│   ├── .gitignore
│   ├── hhcrawler
│   ├── .pylintrc
│   ├── requirements.txt
│   ├── .scrapy
│   ├── scrapy.cfg
│   ├── venv
│   └── .vscode
├── docker-compose.development.yml
├── docker-compose.production.yml
├── .gitignore
├── .gitlab-ci.yml
├── househunter.code-workspace
└── .vscode
└── settings.json
What I ended up doing was ignoring the apps directory on the project root and then add both apps to the workspace.
So the ./.vscode/settings.json looks like this:
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"apps": true
},
}
And the househunter.code-workspace file like so:
{
"folders": [
{
"path": "apps/api"
},
{
"path": "apps/crawler"
},
{
"name": "root",
"path": "."
}
],
"settings": {}
}
This is what I see on the editor:
And it is indeed following the subprojects settings.json. This is far from being a great solution, but for the time being was the only way I found to achieve this - I'd also love to see someone document a proper solution for this. :)
At the time of writing the feature is just not implemented. There's a feature request in the program's issue tracker filed on 17 August 2017: Monolithic structure, multiple project settings #32693.
Meanwhile, if you need it badly you have to abuse multi-root workspaces as described in Diogo's answer.

If I have a local rpm in my ansible-playbook can I do yum install in one step?

I have downloaded a rpm in my ansible-playbook:
(djangoenv)~/P/c/apache-installer ❯❯❯ tree .
.
├── defaults
│   └── main.yml
├── files
│   ├── apache2latest.tar
│   ├── httpd_final.conf
│   ├── httpd_temp.conf
│   └── sshpass-1.05-9.1.i686.rpm
├── handlers
│   └── main.yml
├── hosts
├── meta
│   └── main.yml
├── README.md
├── tasks
│   └── main.yml
├── templates
├── tests
│   ├── inventory
│   └── test.yml
└── vars
└── main.yml
My question is why can't I just install it using:
- yum: name=files/sshpass-1.05-9.1.i686.rpm
? It complains that files/sshpass-1.05-9.1.i686.rpm is not found in the system. Now I am doing it in two steps:
- copy: src=files/sshpass-1.05-9.1.i686.rpm dest=/tmp/sshpass-1.05-9.1.i686.rpm force=no
- yum: name=/tmp/sshpass-1.05-9.1.i686.rpm state=present
No, there is no simple way around coping the package to the remote host before installing. Ansible yum module expects a local file when you define a file in the name parameter.
IMHO it is not a good idea to keep packages inside the Ansible code base. Because they are binary and not exactly part of the actual Ansible code. It would be cleaner to setup a private repository and store those files there. That is the only way around coping a package in this situation I'm aware of.

Including directories for doxygen documentation

I have a collection of .dox documentation files for my project
in a dox directory as illustrated below
In the input section I have included ../ for doxygen to pick up the source code. However when I put ./ it does not pick up my documentation files and have to include each file. Is there a way to include them automatically?
Here is the docs and lib directories. In lib I have the source code, whereas in docs I have the documentation.
../
├── docs
│ ├── dox
│ └── Doxyfile
└── lib
Here is the contents of the dox directory
./dox/
├── gnu_affero_gpl.dox
├── gnu_fdl.dox
├── gnu_gpl.dox
├── larsa
│   └── larsa_core.dox
├── larsa.dox
├── meidum
│   ├── lattices
│   ├── lattices.dox
│   ├── lattices.dox~
│   ├── polyhedra
│   └── polyhedra.dox
├── meidum.dox
├── modules.dox
└── vikingr.dox
I have now fixed the problem. The solution was to remember to add *.dox in FILE_PATTERNS variable in Doxyfile.

How do I create a multi-module distribution?

I want to create my own Perl module, but the problem is that it contain multiple .pm files. The structure is:
lib
├── A_Z.pm
└── T_test
├── A.pm
├── B.pm
├── C.pm
├── D.pm
└── E.pm
I used h2xs -XA -n T_test::A T_test::B T_test::C T_test::D T_test::E. It compiled only A.pm; the other B.pm, C.pm, D.pm, E.pm are not considered. Is there any solution to execute all the .pm file at the same time?
Use Module::Starter::PBP instead.
$ module-starter --builder=Module::Build --module=A_Z,T_test::{A,B,C,D,E}
Added to MANIFEST: Build.PL
Added to MANIFEST: Changes
Added to MANIFEST: lib/A_Z.pm
Added to MANIFEST: lib/T_test/A.pm
Added to MANIFEST: lib/T_test/B.pm
Added to MANIFEST: lib/T_test/C.pm
Added to MANIFEST: lib/T_test/D.pm
Added to MANIFEST: lib/T_test/E.pm
Added to MANIFEST: MANIFEST
Added to MANIFEST: README
Added to MANIFEST: t/00.load.t
Created starter directories and files
$ tree A_Z
A_Z
├── Build.PL
├── Changes
├── lib
│ ├── A_Z.pm
│ └── T_test
│ ├── A.pm
│ ├── B.pm
│ ├── C.pm
│ ├── D.pm
│ └── E.pm
├── MANIFEST
├── README
└── t
└── 00.load.t
3 directories, 11 files
You don't have to do anything special. Just makes sure all the files are listed in MANIFEST as usual. Both ExtUtils::MakeMaker and Module::Build consider all .pm to be modules to install.