add npm link script for SAE lib to be used in other projects
This commit is contained in:
parent
bb0e44eb55
commit
e4031a9768
16 changed files with 1108 additions and 2168 deletions
3
sae-csc/.gitignore
vendored
3
sae-csc/.gitignore
vendored
|
@ -1,5 +1,6 @@
|
|||
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
|
||||
|
||||
# Ignorer le lien symbolique dans node_modules
|
||||
node_modules/sae-lib
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
|
|
2
sae-csc/.npmrc
Normal file
2
sae-csc/.npmrc
Normal file
|
@ -0,0 +1,2 @@
|
|||
preserve-symlinks=true
|
||||
prefix=/home/tykayn/.npm-global
|
2
sae-csc/_prepend.scss
Normal file
2
sae-csc/_prepend.scss
Normal file
|
@ -0,0 +1,2 @@
|
|||
/* Ce fichier est prépendé automatiquement à tous les fichiers SCSS */
|
||||
@forward 'sae-csc/src/styles.scss';
|
|
@ -31,7 +31,10 @@
|
|||
],
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
]
|
||||
],
|
||||
"stylePreprocessorOptions": {
|
||||
"includePaths": []
|
||||
}
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
|
|
3122
sae-csc/package-lock.json
generated
3122
sae-csc/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,8 @@
|
|||
"name": "implem",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"link-sae-lib": "bash ./scripts/link-sae-lib.sh",
|
||||
"postinstall": "npm run link-sae-lib",
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
|
@ -23,6 +25,7 @@
|
|||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/common": "^20.1.0",
|
||||
"sae-lib": "file:../my-workspace/projects/sae-lib",
|
||||
"@angular/compiler": "^20.1.0",
|
||||
"@angular/core": "^20.1.0",
|
||||
"@angular/forms": "^20.1.0",
|
||||
|
|
38
sae-csc/scripts/link-sae-lib.sh
Executable file
38
sae-csc/scripts/link-sae-lib.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
# Script pour lier sae-lib comme un module npm local
|
||||
|
||||
# Vérifier si npm est installé
|
||||
if ! [ -x "$(command -v npm)" ]; then
|
||||
echo 'Erreur: npm n est pas installé.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Configurer npm pour utiliser un répertoire dans l'espace utilisateur
|
||||
NPM_PREFIX="$HOME/.npm-global"
|
||||
mkdir -p "$NPM_PREFIX"
|
||||
npm config set prefix "$NPM_PREFIX"
|
||||
|
||||
# Ajouter temporairement au PATH
|
||||
export PATH="$NPM_PREFIX/bin:$PATH"
|
||||
|
||||
# Aller dans le dossier de la bibliothèque
|
||||
cd ../my-workspace/projects/sae-lib
|
||||
|
||||
# Vérifier si package.json existe
|
||||
if [ ! -f "package.json" ]; then
|
||||
echo "Erreur: package.json n\'existe pas dans le dossier sae-lib." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Créer un lien npm
|
||||
echo "Création d'un lien npm pour sae-lib..."
|
||||
npm link
|
||||
|
||||
# Revenir au dossier de l'application
|
||||
cd ../../../sae-csc
|
||||
|
||||
# Utiliser le lien dans l'application
|
||||
echo "Utilisation du lien dans l'application sae-csc..."
|
||||
npm link sae-lib
|
||||
|
||||
echo "Lien créé avec succès. sae-lib est maintenant disponible comme un module npm."
|
|
@ -1,10 +1,10 @@
|
|||
import { Component, signal } from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import {SaeLib} from '../../../my-workspace/projects/sae-lib/src/public-api';
|
||||
// import {SaeLib} from '@sae-lib/src/public-api';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [RouterOutlet, SaeLib],
|
||||
imports: [RouterOutlet],
|
||||
templateUrl: './app.html',
|
||||
styleUrl: './app.scss'
|
||||
})
|
||||
|
|
|
@ -48,4 +48,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<app-alert-box></app-alert-box>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
// TODO importer les variables de la librairie
|
||||
@use '../../../../styles/variables-barrel' as variables;
|
||||
.top-navigation{
|
||||
background: #ccc;
|
||||
background: variables.$bg-color-nav;
|
||||
color: white;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {RouterLink, RouterLinkActive} from '@angular/router';
|
||||
import {AlertBox} from '../../../../../../my-workspace/projects/sae-lib/alert-box/alert-box';
|
||||
|
||||
// import {SaeLib} from 'sae-lib';
|
||||
|
||||
@Component({
|
||||
selector: 'app-top-navigation',
|
||||
imports: [
|
||||
RouterLink,
|
||||
RouterLinkActive
|
||||
RouterLinkActive,
|
||||
AlertBox
|
||||
],
|
||||
templateUrl: './top-navigation.html',
|
||||
styleUrl: './top-navigation.scss'
|
||||
|
|
|
@ -5,3 +5,19 @@
|
|||
// lib SAE Aero styles
|
||||
//@use 'sae-lib/src/styles/index.scss';
|
||||
@use '../../my-workspace/projects/sae-lib/src/styles/index.scss';
|
||||
/* Fichier de styles global pour l'application */
|
||||
|
||||
// Importer les styles principaux
|
||||
@import 'styles/main.scss';
|
||||
|
||||
// Styles globaux supplémentaires
|
||||
html, body {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
|
9
sae-csc/src/styles/_sae-lib-imports.scss
Normal file
9
sae-csc/src/styles/_sae-lib-imports.scss
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Fichier centralisé pour importer les styles de sae-lib
|
||||
* À utiliser dans les composants avec: @use '@sae-lib/src/styles/_variables' as variables;
|
||||
*/
|
||||
|
||||
@forward '@sae-lib/src/styles/_variables.scss';
|
||||
@forward '@sae-lib/src/styles/_forms.scss';
|
||||
@forward '@sae-lib/src/styles/_global.scss';
|
||||
@forward '@sae-lib/src/styles/_shadows.scss';
|
5
sae-csc/src/styles/_variables-barrel.scss
Normal file
5
sae-csc/src/styles/_variables-barrel.scss
Normal file
|
@ -0,0 +1,5 @@
|
|||
// Ce fichier regroupe toutes les variables de sae-lib pour faciliter l'importation
|
||||
@forward 'sae-lib/src/styles/_variables.scss';
|
||||
//@forward '../../my-workspace/projects/sae-lib/src/styles/_forms';
|
||||
//@forward '../../my-workspace/projects/sae-lib/src/styles/_global';
|
||||
//@forward '../../my-workspace/projects/sae-lib/src/styles/_shadows';
|
45
sae-csc/src/styles/main.scss
Normal file
45
sae-csc/src/styles/main.scss
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Fichier principal pour les styles globaux
|
||||
* Il contient les variables et styles réutilisables dans toute l'application
|
||||
*/
|
||||
|
||||
// Définir les couleurs de base de l'application
|
||||
$primary-color: #3f51b5;
|
||||
$secondary-color: #ff4081;
|
||||
$bg-color-nav: #333333;
|
||||
$text-color: #ffffff;
|
||||
|
||||
// Autres variables globales
|
||||
$spacing-unit: 8px;
|
||||
$border-radius: 4px;
|
||||
|
||||
// Mixins utiles
|
||||
@mixin flex-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@mixin shadow-light {
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
|
||||
}
|
||||
|
||||
// Styles globaux
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
// Classes d'utilité
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mt-1 {
|
||||
margin-top: $spacing-unit;
|
||||
}
|
||||
|
||||
.mb-1 {
|
||||
margin-bottom: $spacing-unit;
|
||||
}
|
|
@ -13,7 +13,13 @@
|
|||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
"target": "ES2022",
|
||||
"module": "preserve"
|
||||
"module": "preserve",
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@sae-lib/*": ["../my-workspace/projects/sae-lib/*"],
|
||||
"sae-lib": ["../my-workspace/projects/sae-lib"],
|
||||
"sae-lib/*": ["../my-workspace/projects/sae-lib/*"]
|
||||
}
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue