I've used Electron and Electron-Builder for a long time and am now learning Svelte and trying to use it in my projects. I've got the simple 'hello world' project up and running using this tutorial but I am confused about how to reference packaged assets– for example images or json files in an included 'assets' folder. An image of my directory structure is below.
If I console.log( __dirname); in my Svelte component I get /Users/UserName/electron_workspace/electron-app-svelte/public – which I understand is the compiled component context - but my 'assets' folder is in the 'src' directory.
Do I put my 'assets' folder in the 'public' directory rather than 'src'? (And I guess 'git-ignore' the 'build' folder?)
It looks like the simple (and obvious, I guess) answer is to store project assets in the 'public' directory of the project, per this 2021 article: Directory and files structure of Svelte projects
public folder
This folder holds the production ready files. So, if
your project has images, videos, other multimedia, svg etc. then they
all will be stored in this folder. When you run npm run build, Svelte
will compile your files, optimize them and store in build folder
within public folder. This build folder can be deployed to server.
I've always stored production assets in the project 'src' directory since that is what gets versioned/stored in git compared to the compiled 'dist' (build) directory which does not. I guess I will need to 'git-ignore' the 'build' directory.
Related
What is the best approach/ plugin to move multiple files and folders to a new release folder? (I'm using the Jenkinsfile pipeline)
Case:
The next files/ folders need to be available in the release package:
Folder1\\SubFolder1\\bin\\Release\\*.dll
Folder1\\SubFolder1\\bin\\Release\\*.exe"
Folder1\\SubFolder1\\bin\\Release\\Resources\\**\\*.xml
Folder1\\SubFolder1\\bin\\Release\\**\\*.dll
I'm using the 'archiveArtifacts artifacts' command to create the artifacts. This seems to work, but I would like to create one folder which contains above defined files and folders.
Final expected result:
ReleaseFolder
-test1.dll (part of Folder1\\SubFolder1\\bin\\Release\\*.dll)
-test2.dll (part of Folder1\\SubFolder1\\bin\\Release\\*.dll)
-SubXmlFolder (part of Folder1\\SubFolder1\\bin\\Release\\Resources\\**\\*.xml - note: the \\**\\ is the SubXmlFolder)
-test3.xml (part of SubXmlFolder)
-test4.xml (part of SubXmlFolder)
-en-GB (part of Folder1\\SubFolder1\\bin\\Release\\**\\*.dll - note: the \\**\\ is the en-GB folder)
-test5.dll (part of the en-GB folder)
File Operations Plug providing many features for files and folders.
link: https://plugins.jenkins.io/file-operations
I have some Yocto recipes running that clean out my source directories before building. The problem is that I also have an Eclipse CDT project defined in the same source directory that gets deleted when I do the clean. I modified my scripts so that the .project and .cproject files would get copied to a safe location and then copied back once the build is complete. Everything appears to get restored satisfactorily except for the environment variables defined in the Project's Build Configurations (right-click Project->Properties->C/C++ Build->Environment). They get lost.
Now, I can see the environment variables defined in the org.eclipse... directory but it appears that they are time stamped somehow and are out of sync with the Project. How can I get the Project's Build Configurations to restore automatically? (it is a pain to have to redefined these variables everytime I do a clean/build).
Found the problem. There is a directory called .settings that appears along side the .project and .cproject files that also needs to be saved and then restored. When this is done the environment variables define under the project are also restored.
I am struggling with a issue for files generated by nodejs needed to be included in build. It works well in local development but when i want to publish it then it won't include files fron dist folder to build and app will not have a dist folder. Can any one help on this?
Note:- files are created each time has different name so i cannot select and include them. I am using visual studio 2017. I hope i could explain the issue or let me know i can try better. Thanks in advance
You need to put your static files under the wwwroot folder to make them accessible on the production server.
To include those files for publishing, a simplest option would be to add them to wwwroot before a publishing starts, otherwise they will be ignored.
Another option would be to tell MSBuild to include the files explicitly.
You can find an example of how to customize the project file at <Target Name="NgBuildAndAddToPublishOutput" AfterTargets="ComputeFilesToPublish">.
You could build for production with Angular CLI with --output-hashing=none like so:
ng build --prod --output-hashing=none
And then include the generated js-files into your project-file (csproj). Then use a Script-bundle in BundleConfig.cs with BundleTable.EnableOptimizations = true; to generate the hashes for you by ASP.NET instead of Angular-cli.
Apologies if this question has been asked before. I have found variants on this theme but nothing that seems to fit our particular configuration.
We have developed a custom GulpJS task which parses a .json file located inside our folder assets/javascript. This json file contains an array of relative paths to javascript files (both our own and library) in a specific order for minification. They are then outputted to the folder assets/javascript/build and concatenated. The javascript source files are in the project but the minified and concatenated versions of the scripts, in fact the entire build folder itself, are not included in the Visual Studio project.
Ideally, I would like to have a step in the MSDeploy configuration which would copy all the files in the javascript build folder to the destination. Otherwise I could potentially include another step in Teamcity to do so.
Has anyone successfully instituted a similar build configuration and could share some insight? I tried using the MSBuild copy task but that didn't seem to copy the files to the output location. One option that I am considering is including the minified scripts in the project file but this might potentially trip up other developers who don't have Gulp running in their development environments (hilarious as that might be)
I am using the Dart Eclipse plugin following this guide:
http://blog.dartwatch.com/2013/01/integrating-dart-into-eclipse-and-your.html
( without the Maven integration )
If I use the pubspec.yaml file, my project gets spammed with these packages symlinks.
( I am using the "Package Explorer" view from Eclipse )
I would like some control over where these files get created.
I would argue the web root directory and maybe a scripts directory should be enough.
Currently, no, there is no way to control which directories get "packages" directories and which don't. Pub will place "packages" directories in "bin", "example", "test", "tool", and "web", and any subdirectory of those.
Those are all of the directories where a package may be expected to have a Dart entrypoint. Since an entrypoint needs a "packages" directory next to it to be able to use "package:" imports, pub will place one there.
It won't place "packages" directories anywhere else.
I would argue the web root directory and maybe a scripts directory should be enough.
"tool" is pub's convention for a "scripts" directory.
I found the code that generates these directories in dart-sdk\util\pub\entrypoint.dart.
There is a method called: _linkSecondaryPackageDir.
If I add: if (path.basename(dir) != 'web') return;
The packages folder only gets created in the root folder and the web folder, just like I want.
I will test if this breaks anything and report back.