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

Upgrade ng-add deps #1622

Merged
merged 3 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions schematics/src/ng-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ function addPackageJsonDependencies(options: IADTSchematicsOptions) {
const styleDeps = ADT_SUPPORTED_STYLES.find(e => e.style == options.style);

const dependencies = [
{ version: '^3.4.1', name: 'jquery', isDev: false },
{ version: '^1.10.20', name: 'datatables.net', isDev: false },
{ version: '^3.3.33', name: '@types/jquery', isDev: true },
{ version: '^1.10.18', name: '@types/datatables.net', isDev: true }
{ version: '^3.6.0', name: 'jquery', isDev: false },
{ version: '^1.11.3', name: 'datatables.net', isDev: false },
{ version: '^3.5.9', name: '@types/jquery', isDev: true },
{ version: '^1.10.21', name: '@types/datatables.net', isDev: true }
];

if (styleDeps) {
Expand Down Expand Up @@ -58,8 +58,8 @@ function updateAngularJsonFile(options: IADTSchematicsOptions) {
const styleDeps = ADT_SUPPORTED_STYLES.find(e => e.style == options.style);

const assets = [
{ path: 'node_modules/jquery/dist/jquery.js', target: 'scripts', fancyName: 'jQuery Core' },
{ path: 'node_modules/datatables.net/js/jquery.dataTables.js', target: 'scripts', fancyName: 'DataTables.net Core JS' },
{ path: 'node_modules/jquery/dist/jquery.min.js', target: 'scripts', fancyName: 'jQuery Core' },
{ path: 'node_modules/datatables.net/js/jquery.dataTables.min.js', target: 'scripts', fancyName: 'DataTables.net Core JS' },
];

if (styleDeps) {
Expand Down
19 changes: 15 additions & 4 deletions schematics/src/ng-add/models/style-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ export enum ADTStyleOptions {
DT="dt",
BS3="bs3",
BS4="bs4",
BS5="bs5",
}

export const ADT_SUPPORTED_STYLES = [
{
style: ADTStyleOptions.DT,
packageJson: [
{ version: '^1.10.20', name: 'datatables.net-dt', isDev: false },
{ version: '^1.11.3', name: 'datatables.net-dt', isDev: false },
],
angularJson: [
{ path: 'node_modules/datatables.net-dt/css/jquery.dataTables.css', target: 'styles', fancyName: 'DataTables.net Core CSS' },
{ path: 'node_modules/datatables.net-dt/css/jquery.dataTables.min.css', target: 'styles', fancyName: 'DataTables.net Core CSS' },
]
},
{
style: ADTStyleOptions.BS3,
packageJson: [
{ version: '^1.10.20', name: 'datatables.net-bs', isDev: false },
{ version: '^1.11.3', name: 'datatables.net-bs', isDev: false },
],
angularJson: [
{ path: 'node_modules/datatables.net-bs/css/dataTables.bootstrap.min.css', target: 'styles', fancyName: 'DataTables.net Bootstrap 3 CSS' },
Expand All @@ -27,11 +28,21 @@ export const ADT_SUPPORTED_STYLES = [
{
style: ADTStyleOptions.BS4,
packageJson: [
{ version: '^1.10.20', name: 'datatables.net-bs4', isDev: false },
{ version: '^1.11.3', name: 'datatables.net-bs4', isDev: false },
],
angularJson: [
{ path: 'node_modules/datatables.net-bs4/css/dataTables.bootstrap4.min.css', target: 'styles', fancyName: 'DataTables.net Bootstrap 4 CSS' },
{ path: 'node_modules/datatables.net-bs4/js/dataTables.bootstrap4.min.js', target: 'scripts', fancyName: 'DataTables.net Bootstrap 4 JS' },
]
},
{
style: ADTStyleOptions.BS5,
packageJson: [
{ version: '^1.11.3', name: 'datatables.net-bs5', isDev: false },
],
angularJson: [
{ path: 'node_modules/datatables.net-bs5/css/dataTables.bootstrap5.min.css', target: 'styles', fancyName: 'DataTables.net Bootstrap 5 CSS' },
{ path: 'node_modules/datatables.net-bs5/js/dataTables.bootstrap5.min.js', target: 'scripts', fancyName: 'DataTables.net Bootstrap 5 JS' },
]
},
]
6 changes: 5 additions & 1 deletion schematics/src/ng-add/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"description": "The styling library to use for Datatables.",
"type": "string",
"default": "dt",
"enum": ["dt", "bs3", "bs4"],
"enum": ["dt", "bs3", "bs4", "bs5"],
"x-prompt": {
"message": "Which styling library would you like to use for DataTables?",
"type": "list",
Expand All @@ -29,6 +29,10 @@
{
"value": "bs4",
"label": "Bootstrap 4"
},
{
"value": "bs5",
"label": "Bootstrap 5"
}
]
}
Expand Down