thibaud frere commited on
Commit
a41b32c
·
1 Parent(s): ead50ba
.gitignore CHANGED
@@ -29,3 +29,8 @@ app/public/data/**/*
29
 
30
  .astro/
31
 
 
 
 
 
 
 
29
 
30
  .astro/
31
 
32
+ # Template sync temporary directories
33
+ .template-sync/
34
+ .temp-*/
35
+ .backup-*/
36
+
.temp-template-sync ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit ead50ba9028719475151d26696248ef6fe996b70
app/scripts/sync-template.mjs CHANGED
@@ -32,9 +32,12 @@ const PRESERVE_PATHS = [
32
  'app/node_modules',
33
  '.backup-*',
34
  '.temp-*',
 
35
 
36
- // Git
37
- '.git'
 
 
38
  ];
39
 
40
  // Fichiers à traiter avec précaution (demander confirmation)
@@ -82,10 +85,20 @@ async function pathExists(filePath) {
82
  }
83
 
84
  async function isPathPreserved(relativePath) {
 
 
 
 
 
 
 
85
  return PRESERVE_PATHS.some(preserve =>
 
86
  relativePath === preserve ||
87
- relativePath.startsWith(preserve + '/') ||
88
- preserve.startsWith(relativePath + '/')
 
 
89
  );
90
  }
91
 
@@ -167,13 +180,10 @@ async function syncDirectory(sourceDir, targetDir) {
167
  async function cloneOrUpdateTemplate() {
168
  console.log('📥 Récupération du template...');
169
 
170
- // Nettoyer le dossier temporaire s'il existe
171
  if (await pathExists(TEMP_DIR)) {
172
- if (!isDryRun) {
173
- await fs.rm(TEMP_DIR, { recursive: true, force: true });
174
- } else {
175
- console.log(`[DRY-RUN] Suppression: ${TEMP_DIR}`);
176
- }
177
  }
178
 
179
  // Cloner le repo template (même en dry-run pour pouvoir comparer)
 
32
  'app/node_modules',
33
  '.backup-*',
34
  '.temp-*',
35
+ '.template-sync*',
36
 
37
+ // Git - CRITIQUE: Ne jamais toucher au Git principal
38
+ '.git',
39
+ '.gitignore',
40
+ '.gitattributes'
41
  ];
42
 
43
  // Fichiers à traiter avec précaution (demander confirmation)
 
85
  }
86
 
87
  async function isPathPreserved(relativePath) {
88
+ // Protection CRITIQUE: Ne jamais toucher aux fichiers Git
89
+ if (relativePath.startsWith('.git') ||
90
+ relativePath === '.gitignore' ||
91
+ relativePath === '.gitattributes') {
92
+ return true;
93
+ }
94
+
95
  return PRESERVE_PATHS.some(preserve =>
96
+ // Correspondance exacte
97
  relativePath === preserve ||
98
+ // Le chemin est dans un dossier préservé
99
+ relativePath.startsWith(preserve + '/')
100
+ // Suppression de la condition qui préservait les parents
101
+ // preserve.startsWith(relativePath + '/') - PROBLÈME : préservait tout 'app/' si 'app/src/content' était préservé
102
  );
103
  }
104
 
 
180
  async function cloneOrUpdateTemplate() {
181
  console.log('📥 Récupération du template...');
182
 
183
+ // Nettoyer le dossier temporaire s'il existe (toujours le faire pour permettre le clone)
184
  if (await pathExists(TEMP_DIR)) {
185
+ await fs.rm(TEMP_DIR, { recursive: true, force: true });
186
+ console.log(`🗑️ Dossier temporaire nettoyé: ${TEMP_DIR}`);
 
 
 
187
  }
188
 
189
  // Cloner le repo template (même en dry-run pour pouvoir comparer)
app/src/components/Quote.astro CHANGED
@@ -1,10 +1,9 @@
1
  ---
2
  interface Props {
3
- author?: string;
4
  source?: string;
5
  }
6
 
7
- const { author, source } = Astro.props;
8
  ---
9
 
10
  <blockquote class="quote">
@@ -12,10 +11,9 @@ const { author, source } = Astro.props;
12
  <slot />
13
  </div>
14
  {
15
- (author || source) && (
16
  <footer class="quote__footer">
17
- {author && <cite class="quote__author">{author}</cite>}
18
- {source && <span class="quote__source">{source}</span>}
19
  </footer>
20
  )
21
  }
@@ -87,22 +85,11 @@ const { author, source } = Astro.props;
87
  sans-serif;
88
  }
89
 
90
- .quote__author {
91
  font-weight: 500;
92
- font-style: normal;
93
- color: var(--text-color);
94
  opacity: 0.85;
95
- }
96
-
97
- .quote__author::before {
98
- content: "— ";
99
- opacity: 0.6;
100
- }
101
-
102
- .quote__source {
103
- font-weight: 400;
104
- opacity: 0.6;
105
  font-style: italic;
 
106
  }
107
 
108
  .quote__source::before {
 
1
  ---
2
  interface Props {
 
3
  source?: string;
4
  }
5
 
6
+ const { source } = Astro.props;
7
  ---
8
 
9
  <blockquote class="quote">
 
11
  <slot />
12
  </div>
13
  {
14
+ source && (
15
  <footer class="quote__footer">
16
+ <span class="quote__source" set:html={source} />
 
17
  </footer>
18
  )
19
  }
 
85
  sans-serif;
86
  }
87
 
88
+ .quote__source {
89
  font-weight: 500;
 
 
90
  opacity: 0.85;
 
 
 
 
 
 
 
 
 
 
91
  font-style: italic;
92
+ color: var(--text-color);
93
  }
94
 
95
  .quote__source::before {
app/src/content/chapters/demo/components.mdx CHANGED
@@ -205,12 +205,8 @@ import FullWidth from '../../../components/FullWidth.astro'
205
 
206
  Can be used like this `<Accordion>some content</Accordion>`. You can pass any children content.
207
 
208
- <Accordion title="What can this accordion hold?" open>
209
- <p>Text, lists, images, code blocks, etc.</p>
210
- <ul>
211
- <li>Item one</li>
212
- <li>Item two</li>
213
- </ul>
214
  </Accordion>
215
 
216
  <Accordion title="A table inside an accordion">
@@ -306,23 +302,22 @@ import Note from '../../../components/Note.astro'
306
 
307
  ### Quote
308
 
309
- Elegant quotes with optional author attribution.
310
 
311
- <Quote author="Geoffrey Hinton">
312
- The brain has about 10^14 synapses and we only live for about 10^9 seconds. So we have a lot more parameters than data. This motivates the idea that we must do a lot of unsupervised learning since labeled examples are so limited.
313
  </Quote>
314
 
315
  | Prop | Required | Type | Description |
316
  |----------|----------|--------|--------------------------------|
317
- | `author` | No | string | Author of the quote |
318
- | `source` | No | string | Source publication or context |
319
 
320
  <Accordion title="Code example">
321
  ```mdx
322
  import Quote from '../../../components/Quote.astro'
323
 
324
- <Quote author="Geoffrey Hinton">
325
- The brain has about 10^14 synapses and we only live for about 10^9 seconds. So we have a lot more parameters than data. This motivates the idea that we must do a lot of unsupervised learning since labeled examples are so limited.
326
  </Quote>
327
  ```
328
  </Accordion>
 
205
 
206
  Can be used like this `<Accordion>some content</Accordion>`. You can pass any children content.
207
 
208
+ <Accordion title="What is an accordion?" open>
209
+ The accordion component provides a collapsible content area that helps organize information efficiently. It's perfect for creating expandable sections, FAQ entries, or any content that benefits from progressive disclosure. Users can click the title to toggle the visibility of the content inside.
 
 
 
 
210
  </Accordion>
211
 
212
  <Accordion title="A table inside an accordion">
 
302
 
303
  ### Quote
304
 
305
+ Elegant quotes with optional source attribution.
306
 
307
+ <Quote source="Geoffrey Hinton, <a href='https://list-quotes.com/quotes/geoffrey-hinton-300077/'>Interview on Brain Complexity</a>">
308
+ In the brain, you have connections between the neurons called synapses, and they can change. All your knowledge is stored in those synapses. You have about 1,000-trillion synapses - 10 to the 15, it's a very big number.
309
  </Quote>
310
 
311
  | Prop | Required | Type | Description |
312
  |----------|----------|--------|--------------------------------|
313
+ | `source` | No | HTML | Quote source/author (supports HTML links) |
 
314
 
315
  <Accordion title="Code example">
316
  ```mdx
317
  import Quote from '../../../components/Quote.astro'
318
 
319
+ <Quote source="Geoffrey Hinton, <a href='https://list-quotes.com/quotes/geoffrey-hinton-300077/'>Interview on Brain Complexity</a>">
320
+ In the brain, you have connections between the neurons called synapses, and they can change. All your knowledge is stored in those synapses. You have about 1,000-trillion synapses - 10 to the 15, it's a very big number.
321
  </Quote>
322
  ```
323
  </Accordion>