Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Commit d1156ec

Browse files
committed
misc: many misc changes (see below)
- update DEVELOPER.md - CSS bug fixes in demo app on mobile screens - remove spec file for lib - update .gitignore, .npmignore - update project deps
1 parent f356926 commit d1156ec

File tree

11 files changed

+126
-98
lines changed

11 files changed

+126
-98
lines changed

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ _test-output
1313
_temp
1414
.vscode
1515

16-
!karma*.js
17-
!protractor*.js
18-
!systemjs.config.js
1916
!demo/src/**/*.js
20-
!rollup.conf.js
21-
!rollup-uglify.conf.js
2217

2318
# angular-datatables specific
2419
*.js.map

.npmignore

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ node_modules
3030
/.eslintignore
3131
/.eslintrc
3232

33-
# Build System files
34-
/tslint.json
35-
/rollup-uglify.conf.js
36-
/rollup.conf.js
37-
/protractor.config.js
38-
/systemjs.config.js
39-
4033
# Typescript source files
4134
*.ts
4235
!*.d.ts

DEVELOPER.md

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Node.js and npm are essential to Angular development.
66

77
[Get it now](https://docs.npmjs.com/getting-started/installing-node) if it's not already installed on your machine.
88

9-
**Verify that you are running at least node `v10.x.x` and npm `6.x.x`**
9+
**Verify that you are running at least node `v18.19.x` and npm `10.2.x`**
1010
by running `node -v` and `npm -v` in a terminal/console window.
1111
Older versions produce errors.
1212

@@ -27,7 +27,7 @@ cd angular-datatables
2727
2828
Install the npm packages described in the `package.json` and verify that it works:
2929

30-
**Attention Windows Developers: You must run all of these commands in administrator mode**.
30+
**Attention Windows Developers: You must run all of these commands in administrator mode**.
3131

3232
```bash
3333
npm install
@@ -40,11 +40,9 @@ The `npm run build` command compiles the library,
4040

4141
We've captured many of the most useful commands in npm scripts defined in the `package.json`:
4242

43-
- `npm run tsc` - runs the TypeScript compiler once.
44-
- `npm run tsc:w` - runs the TypeScript compiler in watch mode; the process keeps running, awaiting changes to TypeScript files and re-compiling when it sees them.
45-
with excellent support for Angular apps that use routing.
46-
- `npm test` - compiles, runs and watches the karma unit tests
47-
- `npm build` - compiles and generate the JS files
43+
- `npm start` - Run the demo/docs app locally.
44+
- `npm demo:test` - compiles, runs and watches the karma unit tests (`*.spec.ts` files)
45+
- `npm run build:lib` - compiles and generates prod builds for this library
4846

4947
### Updating dependencies version
5048

@@ -56,47 +54,55 @@ ncu -u
5654
rm -rf node_modules && npm install
5755
```
5856

59-
If you want to update angular, use the cli:
57+
If you want to update Angular to latest version:
6058

6159
```bash
6260
ng update @angular/cli @angular/core
6361
```
6462

63+
You can also install a specific Angular version using the below code:
64+
65+
```bash
66+
# Downgrade to Angular 15
67+
ng update @angular/cli@15 @angular/core@15
68+
```
69+
6570
## Testing
6671

6772
These tools are configured for specific conventions described below.
6873

69-
*It is unwise and rarely possible to run the application, the unit tests, and the e2e tests at the same time.
70-
We recommend that you shut down one before starting another.*
74+
> It is unwise and rarely possible to run the application and the unit tests at the same time.
75+
>
76+
> We recommend that you shut down one before starting another.
7177
7278
### Unit Tests
7379

74-
TypeScript unit-tests are usually in the `src` folder. Their filenames must end in `.spec`.
80+
Unit tests are essential for ensuring that the library remains compatible with the constantly evolving Angular framework. The more tests, the better :)
7581

76-
Look for the example `src/angular-datatables.directive.spec.ts`.
77-
Add more `.spec.ts` files as you wish; we configured karma to find them.
82+
You can find these tests in the `demo/src` folder, easily recognizable by their filenames ending with `xxx.spec.ts`.
7883

79-
Run it with `npm test`
84+
For instance: `demo/src/app/app.component.spec.ts`
8085

81-
That command first compiles the application, then simultaneously re-compiles and runs the karma test-runner.
82-
Both the compiler and the karma watch for (different) file changes.
86+
Feel free to add more `.spec.ts` files as needed; karma is set up to locate them.
8387

84-
Shut it down manually with Ctrl-C.
88+
To run the tests, simply use `npm run demo:test`
8589

86-
Test-runner output appears in the terminal window.
87-
We can update our app and our tests in real-time, keeping a weather eye on the console for broken tests.
88-
Karma is occasionally confused and it is often necessary to shut down its browser or even shut the command down (Ctrl-C) and
89-
restart it. No worries; it's pretty quick.
90+
This command will compile the application first, then proceed to re-compile and run the karma test-runner simultaneously.
91+
Both the compiler and karma will be on the lookout for any file changes.
9092

91-
The `HTML-Reporter` is also wired in. That produces a prettier output; look for it in `~_test-output/tests.html`.
93+
The test-runner output will be displayed in the terminal window.
94+
95+
By updating our app and tests in real-time, we can keep an eye on the console for any failing tests.
96+
97+
Karma (test runner) is occasionally confused and it is often necessary to shut down its browser or even shut the command down (Ctrl-C) and restart it. No worries; it's pretty quick.
9298

9399
## Deploying the documentation to Github Pages
94100

95101
Run `deploy-doc.sh` to deploy the documentation to the Github Pages
96102

97103
You may need to have the following:
98104

99-
- git
105+
- `git`
100106
- have the basic commands in your OS
101107

102108
```bash
@@ -128,13 +134,15 @@ publishes automatically to NPM repository.
128134

129135
# Angular Schematics
130136

137+
We use Angular Schematics for `ng add` functionality.
138+
131139
To build the schematics, issue the following command:
132140

133-
`npm run schematics:build`
141+
`npm run lib:schematics:build`
134142

135143
## Testing
136144

137-
To test schematics, you will need to setup `verdaccio`, deploy the lib locally in your machine, then install it via `ng add` in an Angular project.
145+
To test schematics, you will need to setup `verdaccio`, publish the library locally in your machine, then install it via `ng add` in another Angular project, preferably a newly created one in another terminal window.
138146

139147
### Steps
140148

@@ -144,33 +152,32 @@ To test schematics, you will need to setup `verdaccio`, deploy the lib locally i
144152

145153
2. Start `verdaccio` server on a terminal or (command prompt if on Windows) by running:
146154

147-
`verdaccio`
155+
`verdaccio`
148156

149157
3. Setup an account in `verdaccio` so you can publish the library on your machine:
150158

151-
- Run `npm adduser --registry=http://localhost:4873`
152-
- Give a username, password and an email address to create an account in `verdaccio`.
159+
- Run `npm adduser --registry=http://localhost:4873`
160+
- Give a username, password and an email address to create an account in `verdaccio`.
153161

154162
4. Now, publish the library to `verdaccio` by running the command:
155163

156-
`npm publish angular-datatables --registry http://localhost:4873`
164+
`npm publish angular-datatables --registry http://localhost:4873`
157165

158166
5. Create an empty Angular project like:
159167

160-
`ng new my-demo-project`
168+
`ng new my-demo-project`
161169

162170
6. Install `angular-datatables` to this demo project by running:
163171

164-
`ng add --registry=http://localhost:4873 angular-datatables`
172+
`ng add --registry=http://localhost:4873 angular-datatables`
165173

166174
### Notes
167175

168176
1. The `--registry` flag informs `npm` to use `verdaccio` instead of NPM's registry server.
169177
2. If you're facing issues with `ng add` not grabbing code from `verdaccio`, try setting npm registry endpoint to `verdaccio` like:
170178

171-
`npm set registry http://localhost:4873`
172-
173-
3. Do remember to reset step 2 or else `npm` will stop working whenever `verdaccio` is offline!
179+
`npm config set registry http://localhost:4873`
174180

175-
`npm set registry https://registry.npmjs.org`
181+
3. Remember to reset changes made in step 2 or else `npm` will stop working when `verdaccio` is killed.
176182

183+
`npm config set registry https://registry.npmjs.org`

demo/src/app/advanced/router-link.component.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
<app-demo-ng-template-ref [data]="data" actionText="View" (emitter)="emitter($event)"></app-demo-ng-template-ref>
77
</ng-template>
88

9-
<app-base-demo [pageTitle]="pageTitle" [mdIntro]="mdIntro" [mdHTML]="mdHTML"
10-
[mdTS]="mdTS" [mdTSHeading]="mdTSHeading" [mdTSHigh]="mdTSHigh" [mdTSHighHeading]="mdTSHighHeading"
11-
[template]="preview">
9+
<app-base-demo [pageTitle]="pageTitle" [mdIntro]="mdIntro" [mdHTML]="mdHTML" [mdTS]="mdTS" [template]="preview">
1210
</app-base-demo>

demo/src/app/advanced/router-link.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ export class RouterLinkComponent implements AfterViewInit, OnInit, OnDestroy {
1515
mdIntro = 'assets/docs/advanced/router-link/intro.md';
1616
mdHTML = 'assets/docs/advanced/router-link/source-html.md';
1717
mdTS = 'assets/docs/advanced/router-link/source-ts.md';
18-
mdTSHigh = 'assets/docs/advanced/router-link/source-tsHigh.md';
19-
mdTSHeading = 'TypeScript (Angular v9 and below)';
20-
mdTSHighHeading = 'TypeScript (Angular v10 and above)';
18+
mdTSHeading = 'TypeScript';
2119

2220
dtOptions: ADTSettings = {};
2321
dtTrigger = new Subject<ADTSettings>();

demo/src/app/app.component.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ header .container a {
99
}
1010

1111
.plus {
12-
font-size: 65px;
13-
text-shadow: 4px 4px rgba(0, 0, 0, 0.21);
12+
font-size: 35px;
13+
position: relative;
14+
top: 3vh;
1415
}
1516

1617
ul.side-nav.fixed ul.collapsible-accordion a.collapsible-header {
@@ -34,7 +35,7 @@ ul.side-nav.fixed ul.collapsible-accordion .collapsible-body li a {
3435
}
3536

3637
.side-nav .logo a {
37-
height: 120px !important;
38+
min-height: 120px !important;
3839
background-color: #2196f3;
3940
color: #fff;
4041
}

demo/src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ <h3>
112112
</li>
113113
<li>
114114
<a class="waves-effect waves-blue" routerLink="/extensions/fixed-columns">Fixed Columns extension</a>
115-
</li>
115+
</li>
116116
</ul>
117117
</div>
118118
</li>

demo/src/app/base-demo/base-demo.component.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="top-banner section banner">
22
<div class="container">
33
<div class="row">
4-
<div class="col s12 m9">
4+
<div class="col">
55
<h2 class="header center-on-small-only">{{pageTitle}}</h2>
66
</div>
77
</div>
@@ -10,7 +10,8 @@ <h2 class="header center-on-small-only">{{pageTitle}}</h2>
1010
<div class="section" *ngIf="deprecated">
1111
<div class="section red white-text">
1212
<div class="container">
13-
This section has been marked as deprecated. It is listed here for documentation purposes only. <a routerLink="/faq">Read More</a>
13+
This section has been marked as deprecated. It is listed here for documentation purposes only. <a
14+
routerLink="/faq">Read More</a>
1415
</div>
1516
</div>
1617
</div>
@@ -57,12 +58,7 @@ <h5 class="header">Description</h5>
5758
</div>
5859

5960
<div id="typescriptTab" class="col s12">
60-
<h5 class="header" *ngIf="mdTSHigh.length>0">{{mdTSHeading}}</h5>
6161
<markdown [src]="mdTS"></markdown>
62-
<ng-container *ngIf="mdTSHigh.length > 0">
63-
<h5 class="header">{{mdTSHighHeading}}</h5>
64-
<markdown [src]="mdTSHigh"></markdown>
65-
</ng-container>
6662
</div>
6763
</div>
6864
</div>

demo/src/app/base-demo/base-demo.component.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Component, Input, OnInit, TemplateRef } from '@angular/core';
2-
import { Router } from '@angular/router';
32

43
// needed to re-init tabs on route change
54
declare var $: any;
@@ -11,10 +10,6 @@ declare var $: any;
1110
})
1211
export class BaseDemoComponent implements OnInit {
1312

14-
constructor(
15-
private router: Router
16-
) { }
17-
1813
@Input()
1914
pageTitle = '';
2015

@@ -30,15 +25,6 @@ export class BaseDemoComponent implements OnInit {
3025
@Input()
3126
mdTS = '';
3227

33-
@Input()
34-
mdTSHeading = 'TypeScript';
35-
36-
@Input()
37-
mdTSHigh = '';
38-
39-
@Input()
40-
mdTSHighHeading = '';
41-
4228
@Input()
4329
template: TemplateRef<any> = null;
4430

lib/src/angular-datatables.directive.spec.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)