Skip to content

Commit

Permalink
feat(ngx-codejar): introducing standalone component
Browse files Browse the repository at this point in the history
BREAKING CHANGE: NgxCodeJarComponent is now a standalone component. Have
a look on the README for more information
  • Loading branch information
julianpoemp committed Jul 7, 2023
1 parent 3a5b29f commit e82f9fd
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 46 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ If you want to use CodeJar with [highlight.js](https://highlightjs.org/) you sho
npm install --save codejar highlight.js ngx-codejar && npm install --save-dev @types/highlight.js
````

2. Import module `NgxCodejarModule` to your app's ngModule:
2. Import NgxCodeJarComponent `NgxCodeJarComponent` to your app's ngModule import property (standalone!):

````typescript
@NgModule({
Expand All @@ -52,7 +52,7 @@ If you want to use CodeJar with [highlight.js](https://highlightjs.org/) you sho
],
imports: [
// ...,
NgxCodejarModule
NgxCodeJarComponent
],
// ...
})
Expand All @@ -72,18 +72,18 @@ If you want to use codejar with [prism.js](https://prismjs.com/) you should do t
npm install --save codejar prismjs ngx-codejar && npm install --save-dev @types/prismjs
````

2. Import module `NgxCodejarModule` to your app's ngModule:
2. Import module `NgxCodejarModuleNgxCodeJarComponent` to your app's ngModule imports property (!standalone):

````typescript
@NgModule({
declarations: [
declarations: [
// ...
],
imports: [
// ...,
NgxCodeJarComponent
],
// ...
],
imports: [
// ...,
NgxCodejarModule
],
// ...
})
````

Expand Down
9 changes: 5 additions & 4 deletions apps/demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';

import {AppComponent} from './app.component';
import {NgxCodejarModule} from 'ngx-codejar';
import {FormsModule} from "@angular/forms";
import {NgxCodeJarComponent} from 'ngx-codejar';
import {FormsModule} from '@angular/forms';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NgxCodejarModule,
NgxCodeJarComponent,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
export class AppModule {
}
4 changes: 2 additions & 2 deletions libs/ngx-codejar/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"error",
{
"type": "attribute",
"prefix": "ngxCodejarNew",
"prefix": "ngxCodejar",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "ngx-codejar-new",
"prefix": "ngx-codejar",
"style": "kebab-case"
}
]
Expand Down
2 changes: 0 additions & 2 deletions libs/ngx-codejar/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
* Public API Surface of ngx-codejar
*/

export * from './lib/ngx-codejar.service';
export * from './lib/ngx-code-jar.component';
export * from './lib/ngx-codejar.module';
export * from './lib/codejar.typings';
3 changes: 3 additions & 0 deletions libs/ngx-codejar/src/lib/ngx-code-jar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ import {
import {CodeJar, Position} from 'codejar';
import {CodeJarContainer, CodeJarOptions} from './codejar.typings';
import {withLineNumbers} from 'codejar/linenumbers.js';
import {CommonModule} from '@angular/common';

@Component({
standalone: true,
imports: [CommonModule],
selector: 'ngx-codejar',
template: `
<div class="ngx-codejar-wrap ngx-codejar-flex" #wrapper>
Expand Down
18 changes: 0 additions & 18 deletions libs/ngx-codejar/src/lib/ngx-codejar.module.ts

This file was deleted.

10 changes: 0 additions & 10 deletions libs/ngx-codejar/src/lib/ngx-codejar.service.ts

This file was deleted.

0 comments on commit e82f9fd

Please sign in to comment.