ether-code 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/compiler.js CHANGED
@@ -212,8 +212,8 @@ class EtherCompiler {
212
212
  inferTargetFromContent(content) {
213
213
  const patterns = {
214
214
  html: [
215
- /\b(page|document|entête|corps|section|div|paragraphe|titre|lien|image|formulaire|bouton)\b/i,
216
- /\b(balise|élément|attribut)\b/i
215
+ /\b(page|document|entête|entete|corps|section|div|paragraphe|titre|lien|image|formulaire|bouton)\b/i,
216
+ /\b(balise|élément|element|attribut)\b/i
217
217
  ],
218
218
  css: [
219
219
  /\b(style|couleur|taille|marge|bordure|fond|police|largeur|hauteur)\s*[:=]/i,
@@ -222,7 +222,7 @@ class EtherCompiler {
222
222
  ],
223
223
  js: [
224
224
  /\b(fonction|variable|constante|si|sinon|pour|tant que|retourner)\b/i,
225
- /\b(classe|méthode|constructeur)\b/i,
225
+ /\b(classe|méthode|methode|constructeur)\b/i,
226
226
  /=>\s*\{/
227
227
  ],
228
228
  php: [
@@ -230,7 +230,7 @@ class EtherCompiler {
230
230
  /\$\w+/
231
231
  ],
232
232
  sql: [
233
- /\b(sélectionner|insérer|mettre à jour|supprimer|créer table|depuis|)\b/i,
233
+ /\b(sélectionner|selectionner|insérer|inserer|mettre à jour|mettre a jour|supprimer|créer table|creer table|depuis|où|ou)\b/i,
234
234
  /\b(SELECT|INSERT|UPDATE|DELETE|CREATE|FROM|WHERE)\b/i
235
235
  ],
236
236
  python: [
@@ -238,7 +238,7 @@ class EtherCompiler {
238
238
  /:\s*$/m
239
239
  ],
240
240
  react: [
241
- /\b(composant|état|effet|props|rendu)\b/i,
241
+ /\b(composant|état|etat|effet|props|rendu)\b/i,
242
242
  /<[\w]+[^>]*\/>/
243
243
  ],
244
244
  graphql: [
@@ -295,4 +295,4 @@ class EtherCompiler {
295
295
  }
296
296
  }
297
297
 
298
- module.exports = { EtherCompiler, GENERATORS, TARGET_EXTENSIONS }
298
+ module.exports = { EtherCompiler, GENERATORS, TARGET_EXTENSIONS }
package/cli/ether.js CHANGED
@@ -146,11 +146,23 @@ async function cmdInit() {
146
146
  fs.mkdirSync(srcDir, { recursive: true })
147
147
  logSuccess('Dossier src/ créé')
148
148
  }
149
-
150
- const distDir = path.join(cwd, 'dist')
151
- if (!fs.existsSync(distDir)) {
152
- fs.mkdirSync(distDir, { recursive: true })
153
- logSuccess('Dossier dist/ créé')
149
+
150
+ const publicDir = path.join(cwd, 'public')
151
+ if (!fs.existsSync(publicDir)) {
152
+ fs.mkdirSync(publicDir, { recursive: true })
153
+ logSuccess('Dossier public/ créé')
154
+ }
155
+
156
+ const imagesDir = path.join(publicDir, 'images')
157
+ if (!fs.existsSync(imagesDir)) {
158
+ fs.mkdirSync(imagesDir, { recursive: true })
159
+ logSuccess('Dossier public/images/ créé')
160
+ }
161
+
162
+ const videosDir = path.join(publicDir, 'videos')
163
+ if (!fs.existsSync(videosDir)) {
164
+ fs.mkdirSync(videosDir, { recursive: true })
165
+ logSuccess('Dossier public/videos/ créé')
154
166
  }
155
167
 
156
168
  const configContent = `module.exports = {
@@ -188,6 +200,28 @@ async function cmdInit() {
188
200
  logWarning('ether.config.js existe déjà')
189
201
  }
190
202
 
203
+ const projectName = path.basename(cwd)
204
+ const packageJson = {
205
+ name: projectName,
206
+ version: "1.0.0",
207
+ description: "Projet Ether",
208
+ scripts: {
209
+ dev: "ether dev",
210
+ build: "ether build",
211
+ check: "ether check"
212
+ },
213
+ keywords: ["ether"],
214
+ license: "MIT"
215
+ }
216
+
217
+ const packagePath = path.join(cwd, 'package.json')
218
+ if (!fs.existsSync(packagePath)) {
219
+ fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2))
220
+ logSuccess('Fichier package.json créé')
221
+ } else {
222
+ logWarning('package.json existe déjà')
223
+ }
224
+
191
225
  const exampleEth = `// Exemple de fichier Ether
192
226
  // Cible: html
193
227
 
@@ -230,6 +264,7 @@ async function cmdBuild(options) {
230
264
  const config = loadConfig(options.config)
231
265
  const srcDir = path.resolve(process.cwd(), config.src)
232
266
  const outDir = path.resolve(process.cwd(), options.output || config.out)
267
+ const publicDir = path.resolve(process.cwd(), config.public || 'public')
233
268
 
234
269
  if (!fs.existsSync(srcDir)) {
235
270
  logError(`Dossier source introuvable: ${srcDir}`)
@@ -240,6 +275,13 @@ async function cmdBuild(options) {
240
275
  fs.mkdirSync(outDir, { recursive: true })
241
276
  }
242
277
 
278
+ if (fs.existsSync(publicDir)) {
279
+ copyDir(publicDir, outDir)
280
+ if (!options.quiet) {
281
+ logSuccess('Dossier public/ copié vers dist/')
282
+ }
283
+ }
284
+
243
285
  const compiler = new EtherCompiler(config)
244
286
 
245
287
  const files = findEthFiles(srcDir)
@@ -450,6 +492,25 @@ function findEthFiles(dir) {
450
492
  return files
451
493
  }
452
494
 
495
+ function copyDir(src, dest) {
496
+ if (!fs.existsSync(dest)) {
497
+ fs.mkdirSync(dest, { recursive: true })
498
+ }
499
+
500
+ const entries = fs.readdirSync(src, { withFileTypes: true })
501
+
502
+ for (const entry of entries) {
503
+ const srcPath = path.join(src, entry.name)
504
+ const destPath = path.join(dest, entry.name)
505
+
506
+ if (entry.isDirectory()) {
507
+ copyDir(srcPath, destPath)
508
+ } else {
509
+ fs.copyFileSync(srcPath, destPath)
510
+ }
511
+ }
512
+ }
513
+
453
514
  function parseArgs(args) {
454
515
  const options = {
455
516
  command: null,
@@ -529,4 +590,4 @@ async function main() {
529
590
  main().catch(err => {
530
591
  logError(err.message)
531
592
  process.exit(1)
532
- })
593
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ether-code",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Ether - Le langage intentionnel",
5
5
  "main": "cli/compiler.js",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "french",
21
21
  "multilingual"
22
22
  ],
23
- "author": "Steve",
23
+ "author": "Stéphane LEGRAND",
24
24
  "license": "MIT",
25
25
  "repository": {
26
26
  "type": "git",