How to build assets separately from the rest of the app with Parcel - parceljs

I have a project that I am building with parcel. Since it is mostly static, I only have some files that should be updated once a day, I put the project on aws s3 bucket. I am thinking of updating the files that should be updated once a day, with a lambda function. But, in my project that is structured like this:
src/
assets/
components/
main.js
...
In the folder assets, I have two other folders data and icons. Data folder holds json files that should be updated once a day.
assets/data/
/icons/
When I run parcel to build a project, I see that all files inside icons folder are built as individual files.
How can I make files inside the data folder to build separately so that I know which files I need to target in order to update them?

I found this package parcel-plugin-static-files-copy
that does exactly what I need. Only had to add this to my package.json:
"staticFiles": {
"staticPath": "src/assets/data"
}

Related

Why Flutter Web Assets folder inside of another assets folder?

I have an assets folder in my project. When I run flutter build web and look into the resulting build, this assets folder is nested inside another automatically generated assets folder. So, now I have to either:
Prepend every asset reference in my code with assets/.
or
Move all my assets up a directory, so instead of the path being assets/assets/asset.jpg, now it will be assets/asset.jpg.
Is there a way for me to stop flutter from nesting my assets folder in another assets folder?

Assets in Flutter package are not visible in the app

I've created a package, which uses some assets (sf2 file, ttf files, etc). Assets don't seem to load. I can fix this by including these files in the assets folder of my main project (so now, every asset in the package is also in my main project). However, when I build a web app, it still creates an extra folder for my package with the files that it needs.
Is there a way around this? How do I enforce the package to use the assets from itself?
After some digging, I've found a way to include it.
'packages/livescore_sdk/assets/default_team_logo.png' works instead of 'assets/default_team_logo.png'
Include the assets in your lib folder, and import it from local project only.
Assuming the project name ABC:
Steps
Create assets folder in lib, example: lib/assets. Full assets example url: ABC/lib/assets/some_asset.png
Copy the assets in this folder.
Import the assets in your pubspec.yaml like this:
assets:
- packages/ABC/assets/some_asset.png
Hope this help someone. :smiley:

Ignore files when publishing packages for Deno

I have done my first package for Deno, and then I publish it to deno.land/x/.
I would like to know if there is a way to Ignore some files and dires at the time of upload the package, example: [".github",".vim","test_deps.ts"].
Pretty much like .npmignore.
There is not currently a way to ignore files, but if you'd like to only include certain files, you can organize them separately in a subdirectory of your repository, and use that option when publishing your module:
The subdirectory that you choose in this step will become the root of the module's file hierarchy.

How to compile any swift file in a given folder?

I use actual folders for my Xcode projects containing my .swift files. I dragged the folder into Xcode but it appears that my swift classes are not being built. I went to my target, went to Build Phase, went to Compile Source and added the missing folder to the references to be built.
My swift files are still not being built.
Which flag could I add to the folder (in Compile Source) for force it to compile every .swift files within it (including the ones in subfolders) ?
I couldn't find any info about it so far, any ideas ?
TLDR Use Groups, not Folder References.
Folder References in Xcode are made mainly for resources. When you create a folder reference, Xcode won't care about the contents. They are helpful when copying resources that should keep their directory structure.
To organize source code files, you need Groups. Groups are logical project folders and most of the time they are backed up by a file system folder anyway.
See also Difference between folder and group in Xcode?

Custom folder structure for Swift Package

When you generate a new Swift project with swift init, you get a Sources folder similar to this. Wondering if there is a way to change the folder structure so it is like this:
main.swift
lib
lib/something.swift
And just get rid of the Sources directory.
I believe that you can use any folder structure that you want. The only thing in that references specific folders in that particular link you provided was the path in the Package.swift file. Which if you want to use, you can just update the path.
The project file keeps track of what swift files have been added into the project and which should be compiled and included in the resulting binary. As long as the files have been added via xcode you should be fine.