How to change file permissions in a Yeoman Generator? - yeoman-generator

I am writing a private yeoman generator package for use in my own organization, and my source code repository is not github, but our TF Source Code Control database. When code is committed in a changeset to the database, the local workspace copy of any file is made read-only, which is part of how TFS can operate through visual studio.
This means that files that are committed to my source code control are sitting in my workspace as readonly files. For the files that are templates in my yeoman generator, if they are readonly, and I use them locally when testing the generator through npm link, the read-only attribute is copied along with the file to the destination file in the scaffolded project I am building. Even, say, the package.json file.
Is there any way to tell yeoman generator to create all scaffolded files without the readonly bit set? Or to unset that bit after the file copy?

Related

c# DocFx. Direct way to create the web page or pdf of documentation?

I have my visual studio 2022 project with c# and I want to create the documentation but I don't want more files and folders to my project.
Docfx create folders and files.
SandCastle you even have to create another project inside your solution.
There is a way to run a command and generate the web page without creating any extra file in the project/solution?
Thanks.
If you are just wanting to generate documentation from your source code xml comments than DocFx does not require that many new files to be be checked into source control. Sure you will need the basic project structure but all the intermediate / generated files in the output can be excluded from your committed source code using .gitignore files (assuming you are using git).
For example, in these tutorials
https://dotnet.github.io/docfx/tutorial/walkthrough/walkthrough_create_a_docfx_project_2.html
https://dotnet.github.io/docfx/tutorial/walkthrough/walkthrough_create_a_docfx_project.html
You would only really need
docfx.json
index.md
toc.yml
api/index.md
api.index.yml
.gitignore
If you add the following lines to the generated .gitignore from tutorial 1 then all the intermediate and generated documentation yml files will never be committed to git.
api/*.yml
api/.manifest
Hopefully this helps, I know it does not get you 0 extra files like you asked but its a fairly light weight solution to generating api documentation.

What should I not upload to GitHub?

I've been working on a public Visual Studio project in GitHub, and have been uploading the entire solution folder into the repository, with all files. Are there specific files or folders that I should refrain from uploading to my repository? I've heard that certain folders can contain cache or user information, but I'm still not sure what to remove.
I always generate my .gitignore file with this website.
If you are working on an ASP .Net project and have connectionstrings for a DB in your appsettings, never push this to github. Best is to generate a appsettings.example.json and only have the structure and propably some default values in there.
Broadly speaking, you should not upload on github following:
any content which does not legally belong to you, and which has no some open source license.
content which could be generated (e.g. object files).
Specifically in your case
You can put source files in the repo but not things generated from the source.
Also, you should not commit class files. You should commit your build scripts, but not files generated by the build.
Lastly keep in mind the size limitations of 100MB per file.
Read also Hello World ยท GitHub Guides (https://guides.github.com/activities/hello-world/#what)
You can use the .gitignore file to ignore the IDE's config and build cache and the .env files. In particular, it is useful to write .env file to .gitignore to avoid some credential leaks caused by hard coding.
GitHub and the community provide common .gitignore rules, see https://github.com/github/gitignore.
Example:
# Generated by Cargo
# will have compiled files and executables
debug/
target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

Add files as read-only to project?

I have the following problem: I need to create a VS project (database project) and I want to make it deployable. To do that I need to add a single SQL function, which belongs to a pool of global functions, to the project. If I now deploy the project, I have all the files that I need.
Problem: I don't want anyone to change the global function inside of my project, so I would like to set it to readonly (not the file itself on the filesystem, it's checked in tfs anyway), so that the file can be deployed, but no one can change it inside the project (at least not by accident).
Is it possible to add a file as read-only to a VS2010 project?

Dynamically add files to user data folder with visual studio setup project

I have a solution under which i have two projects :
-- MyApp -which needs to be deployed
--Documentation
-- file1
-- file2
-- MySetup project
I want to add the contents of the Documentation folder dynamically to User Personal Data folder in the FileSystem Editor of MySetup project i.e not with AddFile from FileSystemEditior. I want this adding to be something like prebuild event for MySetup project.
That is because Documentation folder changes very frequently ( new files added) and I don't want to manually add the files to MySetup project, every time it changes.
Is this possible ?
Thank you for your help
This is not supported by Visual Studio setup projects. However, some commercial setup authoring tools offer direct support for synchronized folders. You can find a list here:
http://en.wikipedia.org/wiki/List_of_installation_software

Store developer-defined build parameters in Visual Studio user files?

We have different dev environments between developers here. When I build, I want my compiled files to be copied to a bin folder located in C:\Web\bin\. Another developer may want those files dropped in C:\Web_2011\bin\.
Using Visual Studio 2010, the way we work this now is to run a BAT file with the directories defined as parameters that need to be changed if pulling from another developer's branch.
Is it possible to store a solution-wide parameter, (in a .user or .suo file maybe,) to define where a developer wants to drop his builds?
You could do it through the project file (.vcxproj for C++ project for example).
The simplest solution would be to add a Custom Build Step that runs some batch file. This batch file could check the current user name and copy the files based on that.
(An even simpler solution would be to run a user specific batch file from his local disk)
If you really want the fully fledged solution that will allow you to save this data to the user file, you can do it by editing the project file and adding a PropertyPageSchema element that extends VS property pages with another parameter (your destination directory). You can define the Persistence attribute of DataSource element as "UserFile" and the data will be saved on your .user file. You will need to add some target that actually uses this data (copies files to the directory specified).
For more information, read about msbuild and PropertyPageSchema.

Resources