Skip to content
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

Make @fortawesome/fontawesome-svg-core a regular dependency #444

Merged
merged 1 commit into from
May 20, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
key: ${{ hashFiles('yarn.lock') }}
- run: corepack enable
- run: yarn
- run: yarn add -D @fortawesome/[email protected] @fortawesome/[email protected] @fortawesome/[email protected]
- run: yarn add -D @fortawesome/[email protected] @fortawesome/[email protected]
- run: yarn format:enforce
- run: yarn lint
- run: yarn test
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ $ ng add @fortawesome/angular-fontawesome@<version>

Using [Yarn](https://yarnpkg.com)
```
$ yarn add @fortawesome/fontawesome-svg-core
$ yarn add @fortawesome/free-solid-svg-icons
# See Compatibility table below to choose a correct version
$ yarn add @fortawesome/angular-fontawesome@<version>
```

Using [NPM](https://www.npmjs.com/)
```
$ npm install @fortawesome/fontawesome-svg-core
$ npm install @fortawesome/free-solid-svg-icons
# See Compatibility table below to choose a correct version
$ npm install @fortawesome/angular-fontawesome@<version>
Expand Down
15 changes: 15 additions & 0 deletions docs/upgrading/0.14.0-0.15.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,18 @@ export class AppComponent {
```

Not doing this should not cause any issues, but it will lead to same styles being added twice to the page.

## @fortawesome/fontawesome-svg-core became a regular dependency

Previously, `@fortawesome/fontawesome-svg-core` was a peer dependency. Now it is a regular dependency. This means that you don't have to add it to your `package.json` file anymore. Unless you use it directly for [advanced cases](https://github.com/FortAwesome/angular-fontawesome/blob/main/docs/guide/advanced-uses.md), you can remove the dependency:

```bash
$ npm uninstall @fortawesome/fontawesome-svg-core
```

If you import any types from `@fortawesome/fontawesome-svg-core`, you should import them from `@fortawesome/angular-fontawesome` instead, e.g:

```diff
-import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
+import { IconDefinition } from '@fortawesome/angular-fontawesome';
```
3 changes: 2 additions & 1 deletion ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"entryFile": "src/lib/public_api.ts",
"flatModuleFile": "angular-fontawesome"
},
"dest": "./dist/angular-fontawesome"
"dest": "./dist/angular-fontawesome",
"allowedNonPeerDependencies": ["@fortawesome/fontawesome-svg-core"]
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"@angular/platform-server": "^17.0.0",
"@angular/router": "^17.0.0",
"@angular/ssr": "^17.0.0",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@types/express": "^4.17.17",
Expand Down Expand Up @@ -79,6 +78,7 @@
"zone.js": "~0.14.2"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.2",
"tslib": "^2.6.2"
},
"keywords": [
Expand All @@ -90,8 +90,7 @@
"svg"
],
"peerDependencies": {
"@angular/core": "^17.0.0",
"@fortawesome/fontawesome-svg-core": "~1.2.27 || ~1.3.0-beta2 || ^6.1.0"
"@angular/core": "^17.0.0"
},
"schematics": "./schematics/collection.json",
"packageManager": "[email protected]"
Expand Down
2 changes: 0 additions & 2 deletions projects/schematics/src/ng-add/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('ng-add', () => {

const dependencies = packageJson.dependencies;

expect(dependencies['@fortawesome/fontawesome-svg-core']).toBe(iconPackVersion);
expect(dependencies['@fortawesome/free-solid-svg-icons']).toBe(iconPackVersion);
expect(dependencies['@fortawesome/angular-fontawesome']).toBe(angularFontawesomeVersion);
});
Expand All @@ -32,7 +31,6 @@ describe('ng-add', () => {

const dependencies = packageJson.dependencies;

expect(dependencies['@fortawesome/fontawesome-svg-core']).toBe(v5.svgCoreVersion);
expect(dependencies['@fortawesome/free-solid-svg-icons']).toBe(v5.iconPackVersion);
expect(dependencies['@fortawesome/angular-fontawesome']).toBe(angularFontawesomeVersion);
});
Expand Down
6 changes: 0 additions & 6 deletions projects/schematics/src/ng-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ import { angularFontawesomeVersion, iconPackVersion, v5 } from './versions';
export default function (options: Schema): Rule {
return chain([
(tree: Tree, context: SchematicContext) => {
addPackageJsonDependency(tree, {
type: NodeDependencyType.Default,
name: '@fortawesome/fontawesome-svg-core',
version: options.version === '6' ? iconPackVersion : v5.svgCoreVersion,
});

addPackageJsonDependency(tree, {
type: NodeDependencyType.Default,
name: '@fortawesome/angular-fontawesome',
Expand Down
1 change: 0 additions & 1 deletion projects/schematics/src/ng-add/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ export const angularFontawesomeVersion = '~0.14.0';
export const iconPackVersion = '^6.4.2';

export const v5 = {
svgCoreVersion: '~1.2.36',
iconPackVersion: '^5.15.4',
};
12 changes: 12 additions & 0 deletions src/lib/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@ export { FaStackComponent } from './stack/stack.component';
export { FaStackItemSizeDirective } from './stack/stack-item-size.directive';
export { FaIconLibrary, FaIconLibraryInterface } from './icon-library';
export { IconPrefix, IconName, IconLookup, IconDefinition, IconPack } from './types';

export {
IconParams,
CounterParams,
TextParams,
FaSymbol,
FlipProp,
PullProp,
RotateProp,
SizeProp,
Transform,
} from '@fortawesome/fontawesome-svg-core';
15 changes: 1 addition & 14 deletions src/lib/shared/models/props.model.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import {
FaSymbol,
FlipProp,
PullProp,
RotateProp,
SizeProp,
Styles,
Transform,
} from '@fortawesome/fontawesome-svg-core';
import { IconProp } from '../../types';
import { FlipProp, PullProp, RotateProp, SizeProp } from '@fortawesome/fontawesome-svg-core';

/**
* Fontawesome props.
*/
export interface FaProps {
mask?: IconProp;
className?: string;
animation?: AnimationProp;
border?: boolean;
Expand All @@ -24,9 +14,6 @@ export interface FaProps {
size?: SizeProp;
pull?: PullProp;
rotate?: RotateProp;
transform?: string | Transform;
symbol?: FaSymbol;
style?: Styles;
stackItemSize?: '1x' | '2x';
}

Expand Down
20 changes: 13 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2779,7 +2779,7 @@ __metadata:
"@angular/platform-server": "npm:^17.0.0"
"@angular/router": "npm:^17.0.0"
"@angular/ssr": "npm:^17.0.0"
"@fortawesome/fontawesome-svg-core": "npm:^6.4.2"
"@fortawesome/fontawesome-svg-core": "npm:^6.5.2"
"@fortawesome/free-regular-svg-icons": "npm:^6.4.2"
"@fortawesome/free-solid-svg-icons": "npm:^6.4.2"
"@types/express": "npm:^4.17.17"
Expand Down Expand Up @@ -2812,7 +2812,6 @@ __metadata:
zone.js: "npm:~0.14.2"
peerDependencies:
"@angular/core": ^17.0.0
"@fortawesome/fontawesome-svg-core": ~1.2.27 || ~1.3.0-beta2 || ^6.1.0
languageName: unknown
linkType: soft

Expand All @@ -2823,12 +2822,19 @@ __metadata:
languageName: node
linkType: hard

"@fortawesome/fontawesome-svg-core@npm:^6.4.2":
version: 6.4.2
resolution: "@fortawesome/fontawesome-svg-core@npm:6.4.2"
"@fortawesome/fontawesome-common-types@npm:6.5.2":
version: 6.5.2
resolution: "@fortawesome/fontawesome-common-types@npm:6.5.2"
checksum: 12104e93a0056ad1077f7350826f52aa26465bb1d6b4ce75dab0307072a3871301ec750c3a34d89d05e7338c9b446fa2793150cf58a5167217021943ef877d77
languageName: node
linkType: hard

"@fortawesome/fontawesome-svg-core@npm:^6.5.2":
version: 6.5.2
resolution: "@fortawesome/fontawesome-svg-core@npm:6.5.2"
dependencies:
"@fortawesome/fontawesome-common-types": "npm:6.4.2"
checksum: 1d53c9f3c47aba71718dc701c97df356407f55d702f104f4fe685688a76d07706df6d0eca6307a33c62705c90051f63faeb483b5e2f89f0588ed441fa9c36d4c
"@fortawesome/fontawesome-common-types": "npm:6.5.2"
checksum: 91695dd375623988d16e6f0dc69d20350ef3fa3296fe40aa08877aae7beaf64378134656a2227419fe648dcd27a81c03fe1fd9a6c87956d863164b0380ba77d0
languageName: node
linkType: hard

Expand Down
Loading