-
-
Notifications
You must be signed in to change notification settings - Fork 24
Creating a Library #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@tsonevn Hello Tsoneven, I was wondering why this issue was closed and if this has been implemented yet? A shared library is very important when working on multiple projects. |
Generating/migrating libraries is really required in the Angular world.
And Step 2 is to be repeated each time we add a module or a component to the existing library. For example:
CREATE projects/my-namespace/my-lib/karma.conf.js (1038 bytes)
CREATE projects/my-namespace/my-lib/ng-package.json (174 bytes)
CREATE projects/my-namespace/my-lib/package.json (152 bytes)
CREATE projects/my-namespace/my-lib/README.md (987 bytes)
CREATE projects/my-namespace/my-lib/tsconfig.lib.json (555 bytes)
CREATE projects/my-namespace/my-lib/tsconfig.spec.json (252 bytes)
CREATE projects/my-namespace/my-lib/tslint.json (250 bytes)
CREATE projects/my-namespace/my-lib/src/test.ts (670 bytes)
CREATE projects/my-namespace/my-lib/src/public-api.ts (155 bytes)
CREATE projects/my-namespace/my-lib/src/lib/my-lib.module.ts (222 bytes)
CREATE projects/my-namespace/my-lib/src/lib/my-lib.component.spec.ts (622 bytes)
CREATE projects/my-namespace/my-lib/src/lib/my-lib.component.ts (255 bytes)
CREATE projects/my-namespace/my-lib/src/lib/my-lib.service.spec.ts (329 bytes)
CREATE projects/my-namespace/my-lib/src/lib/my-lib.service.ts (134 bytes)
UPDATE angular.json (7513 bytes)
UPDATE package.json (2747 bytes)
UPDATE tsconfig.json (1198 bytes)
"@my-namespace/my-lib": [
"projects/my-namespace/my-lib/src/public-api"
],
"@my-namespace/my-lib/*": [
"projects/my-namespace/my-lib/src/lib/*"
] Normally, the Angular CLI only adds paths for the built version of the library in the root tsconfig.json, but we also add the above paths so we can work with the libraries without building them (also, really required while actually developing a lib):
Couldn't trick Yet, the biggest headache I've had was until I've realized that nativescript schematics also adds the Using: |
@MrCroft |
@MrCroft I appreciate you also looking into this. If that works that is great, however seems like a fairly manual process. |
@Lightk3ira sorry to answer so late, I was without hosting for over a month and switched to a temporary email address for a while, so I wasn't notified about the comment here. |
@MrCroft |
@MrCroft No sample yet? |
@juniorschen sorry for the delay, completely forgot about this Made commits for each step of the process (create project, create app, create library, add Nativescript Schematics, the manual steps etc.) In the I had to go find this issue to be able to go around an error: #277 (comment) P. S. Unfortunatelly, live reload doesn't work. So, if you change anything, you have to stop the running app and re-run
|
@MrCroft thank you so much for taking the time, I really appreciate it |
@MrCroft |
@juniorschen hmm... My only reason was to be able to use libs "internally/locally", without publishing them (I guess I'd only build a lib if I wanted to publish it). I do share them across different apps too, of course, but in a monorepo, where all company apps and libs live under the same repository, under a strict naming convention and structure. |
@Lightk3ira commented on Wed Jan 02 2019
Hello I am writing an Angular + Nativescript code sharing project and have realized it would be beneficial to create a Library. I have tried using schematics but I am unable to create a proper library. Any component that get's created within the library only has angular files not typescript.
Steps To reproduce:
ng new <project-name> --create-application false
ng generate library library-name
ng generate module navigation-module --project=Library
ng generate component
ran within the module directoryThe text was updated successfully, but these errors were encountered: