Visual Studio Code - Source Control > 10k changes - javascript

Im new to programming as well as Git.
When opening a Git repository in Visual Studio Code that I created myself I've noticed my source control panel telling me that there is above 10k changes made, its in User/Gitfolder (MAC M1). Im the only one in this repository and haven't made any changes to it. What may be the problem?
When opening VSC I get a small warning window with the text "The git repository at '/Users/username' has too many active changes, only a subset of Git features will be enabled"

By some reasons git is tracking the files in your /user/username folder. In your file explorer enter in to '/Users/username' folder. From the view option in window ribon bar check 'hidden item' option. when all hidden items appears delete the .git folder.

[%WSL UBUNTU] Happened to me. I think when you opened your project in VS Code, you were in the root directory instead of a project folder further down your file system tree, so what you are seeing are the installations from your root folder being included in your VS Code workspace.
[If you need to rearrange your file system folders or create a projects folder, type 'explorer.exe .' in your linux terminal]
I would close VS Code instance, open your Linux Terminal and navigate to your projects folder: cd /home/'user name'/projects. Then type 'code .'
A new VS Code workspace will open in the right directory and the git will not include those root repositories

I ran into this issue just recently. It solved itself once I initialized the project folder as a git repository with the git init.
If it was already initialized make sure you are in the correct project folder and if you are then display the hidden files and delete the .git folder.

Related

JavaScript React hiding source files in sources tab

I have recently developed a website, it's NodeJs (on Ubuntu) and running a React app. The problem is, for example, on Chrome; when you right-click on the website and check sources you can see the source codes and all the files. I want to hide all of them.
In this section, I want to hide the source codes (files) in the server.
I tried couple of solutions on the internet but none of them worked.
For example,
I've added "build": "GENERATE_SOURCEMAP=false react-scripts build", in package.json and then I did run pm2 reload (also yarn build etc)
I've created a file called .env and added this line GENERATE_SOURCEMAP=false in it.
None of them has worked. My website is currently active right now and I want to hide source files, how can I hide these source files from sources tab so people can't see the source codes?
After long research, I have found the solution.
Create a file called .env in your project. The name of the file is just .env.
In that .env file put this line GENERATE_SOURCEMAP=false and save.
Then, run npm run build or yarn build.
This will generate a build folder for production. After that, depends on what you are using, run this build file for running the website. For example, I'm using pm2 on my Ubuntu server, so I've used pm2 serve build 3000 --spa (my website is running on port 3000) Also be careful you are in the same path with the build folder.
That's it. Now all the source code files are gone and website works like a charm.

NW.js - nwbuild not opening on windows

I have an application building in Nw.js. Its almost done, but now facing an issue. While on clicking nw.exe on code (development) it is opening very fast, within in 2 seconds. But when I create a build using nwbuild -p win64 . , it is taking a lot time of time, say a minute to open and giving a feeling that app is opening itself.
The code base when built, the .exe is 21 MB size. Appreciate, if some one could help me to understand why this happens and what to make it open faster.
nwbuild is not recommended by official now, maybe try nwjs-builder-phoenix or create you own distribute script. As I remember, nwjs-builder-phoenix also not handle node_modules folder size very good.
Here is how I distribute my package:
copy NW.js binaries client to dist folder
copy my working source project into a folder named package.nw(Windows) or app.nw in nwjs.app/Contents/Resources/(MacOS)
run npm prune --production under the path you just copy your source into. https://docs.npmjs.com/cli/prune.html
using npm package plist(for MacOS) or rcedit(for Windows) to change the binaries client's information about version, nanme, author ..etc
For mac these is alot of things needs to be changed if you want to publish to appstore http://docs.nwjs.io/en/latest/For%20Users/Advanced/Support%20for%20Mac%20App%20Store/

How do you publish a typescript website to GitHub Pages using Visual Studio?

So I made a Typescript project with Visual Studio. It works fine when I launch it with Visual Studio, but if I try to push it to my GitHub Pages site, it will put the index.html in a subfolder and I get a 404 error when I try to load my website. Even if I try to reference the index.html in the website url it doesn't really work.
I was wondering if it's possible to only publish the needed items. I think I would only need the subfolder. Correct me if I am wrong though.
Note: I have the GitHub extension for Visual Studio installed.
UPDATE:
Since some of the links don't seem to work anymore I think I should give some extra information. So basically you need to have a branch named gh-pages. On that branch you need to have an index.html file in your root folder. Then the index.html file should be visible on the github page URL.
You need to push a branch named gh-pages in order to view it as a website.
Create a new branch and then move the file into the root folder of the branch, upload it to the gh-pages and you set to go.
Check this out:
https://github.com/nirgeier/JimVliet.github.io/tree/gh-pages
This is how your file should be inside your root folder.

How do I install Meteor Atmosphere packages locally so I can make modifications to it?

I am trying to get up and running with Meteor and seeing what it can offer, while I like it overall, it seems it's a very very rigid system.
I set up a small testing setup using Velocity, it opens a small overlay window on the side which has a class of "velocityOverlay". The overlay is really small and makes error stack traces wrap. All I wanted to do was to edit the css of the "velocityOverlay" and increase the width.
I somehow (after wasting time) managed to find that Meteor is actually putting all the packages in my user directory by default, once I found that, I found the needed css file...
velocity_html-reporter/.0.5.1.aykpxq++os+web.browser+web.cordova/web.browser/packages/velocity_html-reporter/lib/client-report.less.css
And I did a small edit to the width, next thing you know the meteor app crashes when trying to launch using the "meteor" command throwing a "Error: couldn't read entire resource" error. I can't even edit the bootstrap.css file I installed using "ian_bootstrap-3".
Further more, I can't find any way to install packages locally just for my particular project, what if I wanted to modify a package only for my particular project? this is very easy to do in vanilla Node.js, you simply don't use the "-g" when using "npm install".
To add to that, within my project root, there is another ".meteor/local/build/web.browser" folder with most of the global package files replicated again. When does Meteor use which? This is very confusing.
You can run a package locally very easily.
Download it from Github (for example) and put it in the packages/ directory of your application like this /packages/package_name.
Then add it to your application with the same meteor add package_name command as usual.
Meteor will automatically look in the local folder before anywhere else and compile the package with the rest of your code.
This allows you to do any modification you want on the package and test it locally before publishing it to the registry.
Also, folders located in .meteor/local/* are used for building purpose only and are generated automatically by Meteor. So it is not the best place to edit the files!
This worked for me https://atmospherejs.com/i/publishing. mrt link-package didn't work for me, might just be outdated code.
Steps:
Download (or clone) package from GitHub to local dir
Stop meteor if running
2.1. Make sure you have a packages folder: mkdir packages
Locally link your package:
3.1 If you have mrt installed: Run mrt link-package /path/to/package in a project dir
3.2 If you don't have mrt: ln -s /path/to/package packages/package
Then run meteor add developer:package-name, do not forget to change package name
Run meteor in a project dir
From now any changes in developer:package-name package folder will cause rebuilding of project app
Download the package and place it in new package directory in your project root.
open the package.js inside the downloaded package and remove the author's name in the property "name:"
e.g: - name:'dburles:google-maps' to name:'google-maps'
then run
meteor add google-maps

What HTML files should be edited in cordova?

I have seen a few references to this topic, but it's not 100% clear to me.
Inside the top level of a cordova project you have these folders '.cordova', 'merges', 'platforms', 'plugins', 'www'. I would think you edit the top level 'www' folder and it would update the files inside platforms\<platform>\assets\www because editing files directly in this path get overwrote, from what I have read and I experienced this once before deploying an app.
I can't find documentation on this (searching cordova update project just covers updating cordova itself, at least from what I am seeing maybe I'm being blind here).
How do the files in the root 'www' update the project files? I am sure there is a command for this but is it true I have to run an update command every time I make an edit in say Dreamweaver, because when I make an update it obviously doesnt make changes into the directory because it doesnt have anything telling it to.
So what I am asking.
You should edit the html/css/javascript inside the cordova projects root 'www'?
What are some solutions to updating the platform code from the main files?
Edit the content of www folder in main project directory and run cordova build command to copy these files to your platform specific directories. So the process will be like
Edit the content of www folder in project directory.
Debug the changes with any browser or emulator like Ripple.
Run cordova build command to test it in Android emulator or in a real device.
To use cordova command line tools, you need to install cordova command line interface. It can be found here.

Categories