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.
|
# 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
|
# Compiled output
|
||||||
/dist
|
/dist
|
||||||
/tmp
|
/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": [
|
"styles": [
|
||||||
"src/styles.scss"
|
"src/styles.scss"
|
||||||
]
|
],
|
||||||
|
"stylePreprocessorOptions": {
|
||||||
|
"includePaths": []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
|
@ -125,4 +128,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
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",
|
"name": "implem",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"link-sae-lib": "bash ./scripts/link-sae-lib.sh",
|
||||||
|
"postinstall": "npm run link-sae-lib",
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
|
@ -23,6 +25,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/common": "^20.1.0",
|
"@angular/common": "^20.1.0",
|
||||||
|
"sae-lib": "file:../my-workspace/projects/sae-lib",
|
||||||
"@angular/compiler": "^20.1.0",
|
"@angular/compiler": "^20.1.0",
|
||||||
"@angular/core": "^20.1.0",
|
"@angular/core": "^20.1.0",
|
||||||
"@angular/forms": "^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 { Component, signal } from '@angular/core';
|
||||||
import { RouterOutlet } from '@angular/router';
|
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({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
imports: [RouterOutlet, SaeLib],
|
imports: [RouterOutlet],
|
||||||
templateUrl: './app.html',
|
templateUrl: './app.html',
|
||||||
styleUrl: './app.scss'
|
styleUrl: './app.scss'
|
||||||
})
|
})
|
||||||
|
|
|
@ -48,4 +48,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<app-alert-box></app-alert-box>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
// TODO importer les variables de la librairie
|
||||||
|
@use '../../../../styles/variables-barrel' as variables;
|
||||||
.top-navigation{
|
.top-navigation{
|
||||||
background: #ccc;
|
background: variables.$bg-color-nav;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {RouterLink, RouterLinkActive} from '@angular/router';
|
import {RouterLink, RouterLinkActive} from '@angular/router';
|
||||||
|
import {AlertBox} from '../../../../../../my-workspace/projects/sae-lib/alert-box/alert-box';
|
||||||
|
|
||||||
|
// import {SaeLib} from 'sae-lib';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-top-navigation',
|
selector: 'app-top-navigation',
|
||||||
imports: [
|
imports: [
|
||||||
RouterLink,
|
RouterLink,
|
||||||
RouterLinkActive
|
RouterLinkActive,
|
||||||
|
AlertBox
|
||||||
],
|
],
|
||||||
templateUrl: './top-navigation.html',
|
templateUrl: './top-navigation.html',
|
||||||
styleUrl: './top-navigation.scss'
|
styleUrl: './top-navigation.scss'
|
||||||
|
|
|
@ -5,3 +5,19 @@
|
||||||
// lib SAE Aero styles
|
// lib SAE Aero styles
|
||||||
//@use 'sae-lib/src/styles/index.scss';
|
//@use 'sae-lib/src/styles/index.scss';
|
||||||
@use '../../my-workspace/projects/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,
|
"experimentalDecorators": true,
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"target": "ES2022",
|
"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": {
|
"angularCompilerOptions": {
|
||||||
"enableI18nLegacyMessageIdFormat": false,
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue