how to ignore folders in melos packages - flutter

working in a monorepo with this structure
monorepo/
examples/
# ...
foo/
packages/
# ...
foo/
# ...
example/ -> examples/foo/
where the example in packages/foo
is a deep link to examples/foo/
that contains a demo app called foo_example
I'm encountering a problem during melos bootstrap
Run melos bootstrap
melos.yaml: Multiple packages with the name `foo_example` found in the workspace, which is unsupported.
To fix this problem, consider renaming your packages to have a unique name.
The packages that caused the problem are:
- foo_example at packages/foo/example
- foo_example at examples/foo
Error: Process completed with exit code 1.
I would like to keep the folders for examples and packages separated
while providing an example readily available for https://pub.dev/
is there a way to exclude the packages/**/example/ folders from melos?
this is how I'm pointing at the packages right now
name: <my_mono_repo>
packages:
- examples/**
- packages/**
scripts:
# ...

always read the docs :)
https://melos.invertase.dev/configuration/overview#ignore
this does the job
ignore:
# e.g. ignore example apps
- "packages/**/example"

Related

How to exclude particular Dart files while compilation in flutter

I'm trying to run my flutter-app in web. So I created a web folder and added all the necessary things. Since I'm using the objectBox in multiple dart files, I'm getting error based on ObjectBox.
So what I did to find the issue was, In the main.dart file i'm just trying to display only simple Container widget containing a text. But still I'm getting the same error related to objectBox with its entity.
So my doubt is, Is it compiling all the dart files located in lib? If then, can I exclude them.
I have tried(created a build.yaml file) to exclude all my files which are using ObjectBox.
My build.yaml file:
targets:
  $default:
sources:
exclude:
- lib/test_driver/runner.dart
- lib/tools/**.dart

ObjectBox generator warning:"Failed to find package root from output directory, generated imports might be incorrect."

Iam using the latest version of objectbox and when i run the "flutter pub run build_runner build" command i get this output: "...Failed to find package root from output directory, generated imports might be incorrect..."
So when i write in main to init ObjectBox:
late ObjectBox objectBox;
ObjectBox is not recognized with import.
Using the import from an tutorial which have the same version does not solve the problem,but the json and g.dart files are generated.
What iam doing wrong?
Let me know if you need more information!
Thanks
You will get the error you are seeing if your ObjectBox files are in the wrong directory. By default, ObjectBox expects objectbox.dart, objectbox.g.dart, and objectbox-model.json to be at the root of your project (i.e. in the lib directory next to the main.dart file. You can move objectbox.dart though. I typically put it in lib/objectbox, but I think that objectbox.dart and the generated files need to exist in the same directory, though I'm not 100% sure about that. Change the directory where objectbox.g.dart and objectbox-model.json are generated by following the instructions below from the ObjectBox README.md. If you wanted to put the files in lib/objectbox you would just change custom to objectbox in the code snippet below:
To customize the directory (relative to the package root) where the
generated files are written, add the following to your pubspec.yaml:
objectbox:
# Writes objectbox-model.json and objectbox.g.dart to lib/custom (and test/custom).
output_dir: custom
# Or optionally specify the lib and test output folder separately.
# output_dir:
# lib: custom
# test: other

Include or Exclude node_modules with esbuild

I am using esbuild to build a vscode extension. The build gives a warning like:
✨ Done in 1.28s.
This extension consists of 7026 files, out of which 5430 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
DONE Packaged: /my-vscode/my-vscode-0.0.2.vsix (7026 files, 8.43MB)
I am not sure I node_modules need to be added to .vscodeignore ? when I tried doing it and installed the plugin, I get an error that my commands are not found ..
Any thoughts ?

How to build Conda env on Mac using Windows yml file?

I'm creating Conda create environment from yml I generated on Windows' Miniconda install. I need to create same environment on OS X. Following the advise found here on SO I used the --no-builds option.
Also, the names of some packages under section ResolvePackageNotFound are clearly (many if not all) specific to Windows:
- m2w64-gmp=6.1.0
- m2w64-gcc-libs-core=5.3.0
- m2w64-gcc-libs=5.3.0
- vc=14.1
- vs2015_runtime=15.5.2
- msys2-conda-epoch=20160418
- menuinst=1.4.14
- icc_rt=2019.0.0
- m2w64-libwinpthread-git=5.0.0.4634.697f757
- pywinpty=0.5.5
- wincertstore=0.2
- m2w64-gcc-libgfortran=5.3.0
- win_inet_pton=1.1.0
- winpty=0.4.3
I removed all of these from the yml file. Even then it's stalled at the following screen:
(base) MacBook-Air:Anaconda.d xtian$ conda env create -f 32b-qb-2019-10-05.yml
Collecting package metadata (repodata.json): done
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abor|
Examining openssl: 10%|█████████▍ | 29/279 [00:00<00:00, 3729.87it- ]
Comparing specs that have this dependency: 16%|██████████▉ | 16/101 [05:53<31:19, 22.11s/it]
Finding shortest conflict path for openssl[version='>=1.0.2p,<1.0.3a']: 38%|███████████████▊ | 6/16 [02:39<06:23, 38.32s/it]
This process is progressing at an astonishingly slow pace, and hasn't got past openssl ... 29/279. Should I wait and trust Conda can figure this all out?
Or,
Do I need another strategy--
I'm wondering if I can't remove the offending packages, each in turn, and create a series of yml files to install in order using, $ conda env update --prefix ./env --file environment.yml --prune, because whatever finally works here I know I'm going to need to use it on another machine so I can share the project env with a colleague.
Any other suggestions?
Short answer: Try deleting the packages that your system is getting stuck on from the .yml file. i.e., remove "openssl" from .yml file.
I have been running into the same issue trying to install a .yml file created in a Windows system to a Mac system. I basically followed the same procedure you did:
-Created yml file using the --no-builds option.
-Attempted to create environment on Mac system and had several windows specific packages left under ResolvePackageNotFound section (listed below)
m2w64-libwinpthread-git=5.0.0.4634.697f757
pyreadline=2.1
pywinpty=0.5.5
m2w64-gcc-libgfortran=5.3.0
vc=14
m2w64-gcc-libs-core=5.3.0
m2w64-gmp=6.1.0
wincertstore=0.2
icc_rt=2019.0.0
m2w64-gcc-libs=5.3.0
vs2015_runtime=14.15.26706
winpty=0.4.3
msys2-conda-epoch=20160418
-Deleted those from the yml file
-Attempted to create environment from updated yml file and received the following conflicts:
- Found conflicts! Looking for incompatible packages.
My system also got stuck trying to solve the "openssl" conflict along with a "_tflow_select". I ended up deleting those and was able to create my environment and run the code without too much trouble.

Setting module name to be different from directory name in SwiftPM

I have a Swift library with a core module plus optional bonus modules. I would like to use the following directory layout, mapping to exported Swift package names as shown:
Taco/
Source/
Core/ → import Taco
Toppings/ → import TacoToppings
SideDishes/ → import TacoSideDishes
To my eyes, that’s a sensible-looking project layout. However, if I’m reading the docs right, this will pollute the global module namespace with unhelpful names like “Core”. It seems that SwiftPM will only export a module whose name is identical to the directory name, and thus I have to do this:
Taco/
Source/
Taco/
TacoToppings/
TacoSideDishes/
Is there a way to configure Package.swift to use the tidier directory layout above and still export the desired module names?
Alternatively, is it possible to make the Core, Toppings, and SideDishes modules internal to the project, and export them all to the world as one big Taco module?
There is not currently a clean way to do this, but it seems like a reasonable request. I recommend filing an enhancement request at http://bugs.swift.org for it.
There is one "hacky" way you can do this:
Create your sources in the desired internal layout:
Sources/Core
Sources/Toppings
Add additional symbolic links for the desired module names:
ln -s Core Sources/Taco
ln -s Toppings Sources/TacoToppings
Add an exclude directive to the manifest to ignore the non-desired module name:
let package = Package(
name: "Taco",
exclude: ["Sources/Core", "Sources/Toppings"]
)
is it possible to make the Core, Toppings, and SideDishes modules internal to the project, and export them all to the world as one big Taco module?
No, unfortunately there is no way to do this currently, and it requires substantial compiler work to be able to support.