Publish Angular library dist folder on a separate git - javascript

I have an Angular library that i use in another project. I build my library with the following command:
ng build
Which creates a dist/my-library directory at the library root. I want to publish the dist content on a separate git repository so that it can be consumed directly by other projects.
I have created a git submodule but when i do a build and enter the dist directory, git doesn't see any changes. If i do:
git submodule update
it will detect changes but it will be detached from head, so i can't publish changes on the master branch.
The weird thing is that i managed to get it to work a few times by pure luck, so it must be a viable solution.
How can i get git to publish the content of the dist folder on the dedicated repository?

I found this which works:
ng build
echo "gitdir: ../../.git/modules/dist/ngx-mylib" > dist/ngx-mylib/.git
Now when i go in my dist folder i can do a git add, commit and push. But i don't know what it does exactly so feel free to elaborate.

Related

How to merge git files in one directory and add the files to the staging area

How to initialize a git repository on a directory that contains a subdirectory that has git already initialized?
I am working on a MERN application and I have created a root folder "chatapp".
Inside the root directory, there are two sub-directories:
client
server
I am using React for the frontend and react comes with git already initialized.
I want to initialize git inside my root directory which contains the client subdirectory with git already initialized.
And when I run git init, it initialized well but when I run git add to stage the files for commit, it brings an error: screenshot of my code editor
I need to add both the client and server files to my git repository.
Do I need to first initialize git in the server file separately then merge or how do I add both files to the staging area?
How can I add do this without seeing the error to avoid conflicts in the repository?
Thank you,
You need to use Git Submodules and add the repo separately.
For example: git submodule add https://<GIT_HOST>/server.git server and git submodule add https://<GIT_HOST>/client.git client
Or, you could just not have those be Git repos.

yarn publish <folder>.gitignore overriding .npmignore

I'm trying to publish a module I have created.
The module has multiple entries in it and I want to publish from within my build folder.
Every time I try to publish with yarn. I get:
Output:
The following paths are ignored by one of your .gitignore files:
build/package.json
Use -f if you really want to add them.
I tried yarn publish build
And also cd build && yarn publish where I copy the package.json and npmignore and all the relevant files.
It's always the same result.
I have a .gitignore in my root and an .npmignore in my root.
If I publish the build folder from the root it works but I dont want the path to include the build/lib folder.
If I do yarn build && cd build && npm publish && cd ../ that will also work.
But I'd rather use yarn.
Does anyone have a solution for it?
All I want is to publish my already created build folder content. I have all the needed files there.
EDIT
After much research and looking into other packages,
I ended up just creating a small copy script that copies my essential files to a build folder and clears up my package.json from all unwanted items.
Then my ci publishes from the build folder.
That was our solution that we've implemented

Angular build for production

I am fairly new to Angular, I am currently trying to work out how to serve only the necessary files to my deployment server.
Ideally, I wouldn't want to include the angular library in my project repo. Instead, I would like to install in the build process.
Like I said this is fairly new to me so am not entirely sure whether this is achievable or not?
Angular 2 will be a dependancy of your project. Concretely you will have some javascript files added at installation (npm install) in your ROOT/node_module directory.
They will not be include in your NPM repo if you add a root file in your project named .npmignore with at least this content :
node_modules
You can do the same for your GIT repository and a file named .gitignore with at least this content :
node_modules/

Using stellar-lib api with Meteor

this is probably a silly question but am new to Meteor and struggling a bit. I want to build a stellar app that tweets when you get stellar. There is a nice Javascript API stellar-lib that works on node, but im unsure how to access the modules in Meteor...
I'm also building an app with Meteor and stellar-lib and have found two options:
1) You can manually copy over the built stellar-lib.js or stellar-lib-min.js from the build/ directory from either the github repo or the node_modules folder you installed it to when you ran the npm install command.
If you do this, you will have to copy the .js file to client/compatibility, otherwise stellar-lib will not work (note: this means you can only use Stellar on the client).
2) If you need it on the server, you can also have browserify wrap stellar-lib for you, then copy the output to lib/ in your Meteor app's root directory. I did this in my repo here with gulp.
Here's a short explanation to how 2) works:
.gulp is where I'll install my NPM modules where they will be ignored by the Meteor build environment (because the folder is hidden).
In deps.js, I require the modules I would want to use in my Meteor app as I would if I was using them in a traditional node.js app. package.json defines the modules I'll install with NPM and the gulpfile.js describes a build task that will resolve my require statements and output a single deps.js file that includes my dependencies to my Meteor app's lib/ folder.

How to install meteor router package on Windows 7?

There is a Meteor router package that I need installed, but apparently I can't use meteorite, because meteorite doesn't work on windows.
Is there a way to install it in my meteor?
Create a directory called packages in your project folder
Example "/yourproject/packages"
Meteor router needs these three repositories in order to work properly.
Inside the packages folder git clone these repositories
git clone --recursive https://github.com/tmeasday/meteor-router.git
git clone --recursive https://github.com/tmeasday/meteor-page-js-ie-support.git
git clone --recursive https://github.com/tmeasday/meteor-HTML5-History-API.git
remove meteor and the folder strutures should look like this inside your packages folder
router
page-js-ie-support
HTML5-History-API
then meteor add router from your "/yourproject" directory
You need create package folder and download the package you want to
use by using git clone.
Some of the packages have dependencies so you need clone those
packages as well from the git.
Make sure you remove meteor from the downloaded directory.
Some times, git clone will not download the files completely so you have to go to the package directory where you did not get all the files and run 'git submodule update –init' and then reclone the package.
Now that you have all the required packages and changes directory to proper name and all files are available, go back to project root directory and run
meteor add packagename
Here are some of the references for this
http://csharprambling.wordpress.com/2014/04/24/adding-meteor-package-in-windows/
https://www.discovermeteor.com/blog/using-meteor-and-atmopshere-on-windows/
You can just simply download it to /yourproject/packages/ folder

Categories

Resources