Ref changed folder structure and lib

This commit is contained in:
Lorenzo Iovino 2024-01-10 01:18:38 +01:00
parent f2a8edb15f
commit 26b739726f
18 changed files with 160 additions and 107 deletions

View file

@ -13,11 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npm run pack
- run: cp README.md ./src/lib/dist/README.md
- run: cp README.md ./dist/lib/README.md
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: './src/lib/dist/package.json'
package: './dist/lib/package.json'

View file

@ -5,7 +5,15 @@
"projects": {
"dev": {
"projectType": "application",
"schematics": {},
"schematics": {
"@schematics/angular:component": {
"style": "scss",
"prefix": "app"
},
"@schematics/angular:directive": {
"prefix": "app"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
@ -20,7 +28,6 @@
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
@ -38,27 +45,27 @@
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
@ -68,15 +75,12 @@
"configurations": {
"production": {
"buildTarget": "dev:build:production"
},
"development": {
"buildTarget": "dev:build:development"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "dev:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
@ -91,14 +95,45 @@
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
}
}
},
"lib": {
"projectType": "library",
"root": "projects/lib",
"sourceRoot": "projects/lib/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/lib/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/lib/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/lib/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "projects/lib/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
]
}
}
}
}
},
"cli": {
"analytics": false
}
}

View file

@ -8,10 +8,10 @@
"test": "node node_modules/@angular/cli/bin/ng test",
"test:headless": "node node_modules/@angular/cli/bin/ng test --browsers=ChromeHeadless",
"test:headless:singleRun": "node node_modules/@angular/cli/bin/ng test --no-watch --no-progress --browsers=ChromeHeadless",
"release:minor": "cd ./src/lib/ && npm version minor",
"release:major": "cd ./src/lib/ && npm version major",
"release:patch": "cd ./src/lib/ && npm version patch",
"pack": "ng-packagr -p ./src/lib/package.json"
"release:minor": "cd ./projects/lib/ && npm version minor",
"release:major": "cd ./projects/lib/ && npm version major",
"release:patch": "cd ./projects/lib/ && npm version patch",
"pack": "npm run build lib"
},
"private": true,
"dependencies": {
@ -28,8 +28,8 @@
"zone.js": "~0.14.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.0.9",
"@angular/cli": "^17.0.9",
"@angular-devkit/build-angular": "^17.0.8",
"@angular/cli": "^17.0.8",
"@angular/compiler-cli": "^17.0.8",
"@types/jasmine": "~5.1.0",
"@types/jasminewd2": "~2.0.3",
@ -40,7 +40,7 @@
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"ng-packagr": "^17.0.3",
"ng-packagr": "^17.0.0",
"typescript": "5.2.2"
}
}

24
projects/lib/README.md Normal file
View file

@ -0,0 +1,24 @@
# Lib
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.0.0.
## Code scaffolding
Run `ng generate component component-name --project lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project lib`.
> Note: Don't forget to add `--project lib` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build lib` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build lib`, go to the dist folder `cd dist/lib` and run `npm publish`.
## Running unit tests
Run `ng test lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

View file

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/lib",
"lib": {
"entryFile": "src/public-api.ts"
}
}

View file

@ -1,6 +1,6 @@
{
"name": "ng2-fittext",
"version": "1.3.2",
"version": "1.4.0",
"description": "Ng2-fittext: An Angular2+ directive that change the font size until it fit the upper level container dimension.",
"keywords": [
"ng2-fittext",
@ -28,12 +28,15 @@
],
"author": "Lorenzo Iovino",
"license": "MIT",
"ngPackage": {
"lib": {
"entryFile": "./ng2-fittext.module.ts"
}
"peerDependencies": {
"@angular/common": "^17.0.0",
"@angular/core": "^17.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
},
"repository": {
"url": "https://github.com/thisloke/ng2-fittext.git"
}
},
"sideEffects": false
}

View file

@ -1,4 +1,4 @@
import { Ng2FittextDirective } from '../ng2-fittext.directive';
import { Ng2FittextDirective } from '../../ng2-fittext.directive';
import { Renderer2, ElementRef } from '@angular/core';
describe('Class: Ng2FittextDirective', () => {

View file

@ -1,8 +1,8 @@
import { Ng2FittextDirective } from './directives/ng2-fittext.directive';
import { Ng2FittextDirective } from './ng2-fittext.directive';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
export { Ng2FittextDirective } from './directives/ng2-fittext.directive';
export { Ng2FittextDirective } from './ng2-fittext.directive';
@NgModule({
declarations: [Ng2FittextDirective],

View file

@ -0,0 +1,6 @@
/*
* Public API Surface of lib
*/
export * from './ng2-fittext.directive';
export * from './ng2-fittext.module';

View file

@ -0,0 +1,14 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"exclude": [
"**/*.spec.ts"
]
}

View file

@ -0,0 +1,10 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}

View file

@ -0,0 +1,14 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View file

@ -1,7 +1,7 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import {Ng2FittextModule} from '../lib/ng2-fittext.module';
import { Ng2FittextModule } from 'lib';
@NgModule({
declarations: [

6
src/lib/.gitignore vendored
View file

@ -1,6 +0,0 @@
build
coverage
dist
debug.log
node_modules
out-tsc

View file

@ -1,23 +0,0 @@
*.spec.ts
*.tgz
.erector
.gitignore
.npmignore
.vscode
build
coverage
debug.log
DEVELOPMENT.md
dist
karma.conf.js
node_modules
out-tsc
src
tasks
test.ts
tsconfig.*json
tslint.json
typings
typings.json
vendor.ts
webpack

View file

@ -1,35 +0,0 @@
{
"angularCompilerOptions": {
"strictMetadataEmit": true,
"skipTemplateCodegen": true
},
"compilerOptions": {
"baseUrl": "tsconfig",
"declaration": true,
"stripInternal": true,
"strictNullChecks": true,
"noImplicitAny": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom", "es5"],
"inlineSources": true,
"rootDir": "./src",
"mapRoot": "./",
"module": "es2015",
"moduleResolution": "node",
"outDir": "./dist",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"./node_modules/@types"
],
"paths": {
"@angular/core": ["./node_modules/@angular/core"]
}
},
"files": [
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true
}
}

View file

@ -7,6 +7,11 @@
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"paths": {
"lib": [
"./dist/lib"
]
},
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,