Skip to content

Commit

Permalink
fix: exported options types for the plugin, added example for angular
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Jul 22, 2024
1 parent b384e71 commit d7bd346
Show file tree
Hide file tree
Showing 20 changed files with 4,379 additions and 425 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ module.exports = defineConfig({
{
files: ["**/*.d.ts"],
rules: {
"perfectionist/sort-intersection-types": "off"
}
}
"perfectionist/sort-intersection-types": "off",
},
},
],
parserOptions: {
ecmaVersion: 2021,
Expand Down
2 changes: 2 additions & 0 deletions examples/angular/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
assets
.angular
60 changes: 60 additions & 0 deletions examples/angular/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": "1e1de97b-a744-405a-8b5a-0397bb3d01ce"
},
"newProjectRoot": "projects",
"projects": {
"demo": {
"architect": {
"build": {
"builder": "@angular-builders/custom-esbuild:application",
"configurations": {
"development": {
"extractLicenses": false,
"namedChunks": true,
"optimization": false,
"sourceMap": true
},
"production": {
"aot": true,
"extractLicenses": true,
"namedChunks": false,
"optimization": true,
"outputHashing": "all",
"sourceMap": false
}
},
"options": {
"assets": [],
"index": "src/index.html",
"browser": "src/main.ts",
"outputPath": "dist/demo",
"plugins": ["./esbuild/unplugin-favicons-plugin.js"],
"scripts": [],
"styles": ["src/global_styles.css"],
"tsConfig": "tsconfig.app.json"
}
},
"serve": {
"builder": "@angular-builders/custom-esbuild:dev-server",
"configurations": {
"development": {
"buildTarget": "demo:build:development"
},
"production": {
"buildTarget": "demo:build:production"
}
},
"defaultConfiguration": "development"
}
},
"prefix": "app",
"projectType": "application",
"root": "",
"schematics": {},
"sourceRoot": "src"
}
},
"version": 1
}
22 changes: 22 additions & 0 deletions examples/angular/esbuild/unplugin-favicons-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import faviconsPlugin from "@anolilab/unplugin-favicons/esbuild";

/** @typedef {import("@anolilab/unplugin-favicons/esbuild").FaviconsLogoPluginOptions} config **/
const config = {
logo: "./src/assets/favicon.png",
outputPath: "assets/lexus/",
cache: false,
inject: false,
favicons: {
background: "#fffefc",
icons: {
android: true,
appleIcon: true,
appleStartup: false,
favicons: true,
windows: true,
yandex: false,
},
},
};

export default faviconsPlugin(config);
31 changes: 31 additions & 0 deletions examples/angular/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "angular-starter",
"private": true,
"type": "module",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build"
},
"dependencies": {
"@angular/animations": "^18.0.0",
"@angular/common": "^18.0.0",
"@angular/compiler": "^18.0.0",
"@angular/core": "^18.0.0",
"@angular/forms": "^18.0.0",
"@angular/platform-browser": "^18.0.0",
"@angular/router": "^18.0.0",
"@anolilab/unplugin-favicons": "workspace:*",
"favicons": "^7.2.0",
"rxjs": "^7.8.1",
"tslib": "^2.5.0",
"zone.js": "~0.14.0"
},
"devDependencies": {
"@angular-builders/custom-esbuild": "^18.0.0",
"@angular-devkit/build-angular": "^18.0.0",
"@angular/cli": "^18.0.1",
"@angular/compiler-cli": "^18.0.0",
"typescript": "~5.4.0"
}
}
Binary file added examples/angular/src/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/angular/src/global_styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Add application styles & imports to this file! */
10 changes: 10 additions & 0 deletions examples/angular/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<html lang="en">
<head>
<title>My app</title>
<meta charset="UTF-8" />
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>
17 changes: 17 additions & 0 deletions examples/angular/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component } from "@angular/core";
import { bootstrapApplication } from "@angular/platform-browser";
import "zone.js";

@Component({
selector: "app-root",
standalone: true,
template: `
<h1>Hello from {{ name }}!</h1>
<a target="_blank" href="https://angular.dev/overview"> Learn more about Angular </a>
`,
})
export class App {
name = "Angular";
}

bootstrapApplication(App);
10 changes: 10 additions & 0 deletions examples/angular/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": ["src/main.ts"],
"include": ["src/**/*.d.ts"]
}
31 changes: 31 additions & 0 deletions examples/angular/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "bundler",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"useDefineForClassFields": false,
"lib": ["ES2022", "dom"]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
38 changes: 14 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,40 +50,28 @@
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
}
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"./vite": {
"import": {
"types": "./dist/vite.d.mts",
"default": "./dist/vite.mjs"
}
"types": "./dist/vite.d.mts",
"default": "./dist/vite.mjs"
},
"./webpack": {
"import": {
"types": "./dist/webpack.d.mts",
"default": "./dist/webpack.mjs"
}
"types": "./dist/webpack.d.mts",
"default": "./dist/webpack.mjs"
},
"./rollup": {
"import": {
"types": "./dist/rollup.d.mts",
"default": "./dist/rollup.mjs"
}
"types": "./dist/rollup.d.mts",
"default": "./dist/rollup.mjs"
},
"./esbuild": {
"import": {
"types": "./dist/esbuild.d.mts",
"default": "./dist/esbuild.mjs"
}
"types": "./dist/esbuild.d.mts",
"default": "./dist/esbuild.mjs"
},
"./nuxt": {
"import": {
"types": "./dist/nuxt.d.mts",
"default": "./dist/nuxt.mjs"
}
"types": "./dist/nuxt.d.mts",
"default": "./dist/nuxt.mjs"
},
"./package.json": "./package.json"
},
Expand All @@ -106,6 +94,7 @@
"lint:staged": "lint-staged --verbose --concurrent false --debug",
"lint:text": "textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --cache --dry-run",
"lint:text:fix": "textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --fix",
"lint:package-json": "publint",
"prepare": "is-ci || (node verify-node-version.cjs && pnpx only-allow pnpm && husky)",
"run:example": "cd example && pnpm exec vite build",
"sort-package-json": "sort-package-json ./package.json examples/**/package.json",
Expand Down Expand Up @@ -140,6 +129,7 @@
"@nuxt/kit": "^3.12.4",
"@nuxt/schema": "^3.12.4",
"@rspack/core": "^0.7.5",
"publint": "^0.2.9",
"@rspack/plugin-html": "^0.5.8",
"@secretlint/secretlint-rule-preset-recommend": "^8.2.4",
"@total-typescript/ts-reset": "^0.5.1",
Expand Down
Loading

0 comments on commit d7bd346

Please sign in to comment.