Skip to content

Commit

Permalink
downgrade to Angular 13 build system
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Dec 1, 2022
1 parent ddfeeb9 commit 506cb1b
Show file tree
Hide file tree
Showing 21 changed files with 316 additions and 47 deletions.
6 changes: 6 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
Information for people wanting to contribute code to this project.


## Special Monorepo Note

Building this package only works (from a TypeScript perspective) if the outer monorepo is
fully BUILT, not in dev-mode.


## Important Directories

This repo was initially created with Angular CLI, which is why certain directories are where they are:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ This project is built and maintained by [irustm](https://github.com/irustm) in p

## Supported Angular Versions

`@fullcalendar/angular` version 5 supports Angular 9 - 15.
`@fullcalendar/angular` version 5 supports Angular 12 - 15.
32 changes: 19 additions & 13 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "lib/src/test.ts",
"tsConfig": "lib/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
]
"karmaConfig": "lib/karma.conf.js"
}
}
}
},
"app": {
"projectType": "application",
"schematics": {},
"schematics": {
"@schematics/angular:application": {
"strict": true
}
},
"root": "app",
"sourceRoot": "app/src",
"prefix": "app",
Expand All @@ -49,9 +51,7 @@
"outputPath": "dist/app",
"index": "app/src/index.html",
"main": "app/src/main.ts",
"polyfills": [
"zone.js"
],
"polyfills": "app/src/polyfills.ts",
"tsConfig": "app/tsconfig.app.json",
"styles": [
"app/src/styles.css"
Expand All @@ -72,6 +72,12 @@
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "app/src/environments/environment.ts",
"with": "app/src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
Expand Down Expand Up @@ -106,11 +112,10 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"main": "app/src/test.ts",
"polyfills": "app/src/polyfills.ts",
"tsConfig": "app/tsconfig.spec.json",
"karmaConfig": "app/karma.conf.js",
"styles": [
"app/src/styles.css"
],
Expand All @@ -119,5 +124,6 @@
}
}
}
}
},
"defaultProject": "lib"
}
16 changes: 16 additions & 0 deletions app/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
44 changes: 44 additions & 0 deletions app/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../coverage/app'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
3 changes: 3 additions & 0 deletions app/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
production: true
};
16 changes: 16 additions & 0 deletions app/src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.

export const environment = {
production: false
};

/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
7 changes: 7 additions & 0 deletions app/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app.module';
import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
53 changes: 53 additions & 0 deletions app/src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes recent versions of Safari, Chrome (including
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/

/***************************************************************************************************
* BROWSER POLYFILLS
*/

/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/

/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.


/***************************************************************************************************
* APPLICATION IMPORTS
*/
26 changes: 26 additions & 0 deletions app/src/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';

declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
<T>(id: string): T;
keys(): string[];
};
};

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);

// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
3 changes: 2 additions & 1 deletion app/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"types": []
},
"files": [
"src/main.ts"
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
Expand Down
4 changes: 4 additions & 0 deletions app/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"jasmine"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
Expand Down
16 changes: 16 additions & 0 deletions lib/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
44 changes: 44 additions & 0 deletions lib/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../coverage/lib'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
7 changes: 2 additions & 5 deletions lib/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
"dest": "../dist/lib",
"lib": {
"entryFile": "src/public-api.ts"
},
"allowedNonPeerDependencies": [
"fast-deep-equal"
]
}
}
}
4 changes: 2 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": "9 - 15",
"@angular/core": "9 - 15",
"@angular/common": "12 - 15",
"@angular/core": "12 - 15",
"@fullcalendar/core": "6.0.0-beta.2"
}
}
Loading

0 comments on commit 506cb1b

Please sign in to comment.