humalis 1.3.0 → 1.3.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/dist/cli.js CHANGED
@@ -20,7 +20,9 @@ import { formaterSource } from './outils/formatage.js';
20
20
  import { developper, trouverPrincipal } from './outils/developpement.js';
21
21
  import { ecrireSiChange } from './outils/ecriture.js';
22
22
  import { testerProjet } from './outils/tests.js';
23
+ import { reponseSimple } from './outils/version.js';
23
24
  const AIDE = `Utilisation :
25
+ humalis --version
24
26
  humalis nouveau <nom>
25
27
  humalis formater <fichier.humalis> [--verifier]
26
28
  humalis developper [<fichier.humalis>] [--port <nombre>]
@@ -555,7 +557,11 @@ function principal(arguments_) {
555
557
  return 0;
556
558
  }
557
559
  const argumentsCli = process.argv.slice(2);
558
- if (argumentsCli[0] === 'tester') {
560
+ const reponse = reponseSimple(argumentsCli, AIDE);
561
+ if (reponse !== undefined) {
562
+ console.log(reponse);
563
+ }
564
+ else if (argumentsCli[0] === 'tester') {
559
565
  const optionsTester = argumentsCli.slice(1);
560
566
  const ciblesTester = optionsTester.filter((argument) => argument !== '--detail');
561
567
  if (ciblesTester.length > 1 || optionsTester.filter((argument) => argument === '--detail').length > 1 || ciblesTester.some((argument) => argument.startsWith('--'))) {
@@ -0,0 +1,15 @@
1
+ import { readFileSync } from 'node:fs';
2
+ /** La version du paquet, lue dans son package.json (deux dossiers au-dessus de src/outils/ comme de dist/outils/). */
3
+ export function versionHumalis() {
4
+ return JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8')).version;
5
+ }
6
+ /** « humalis --version » ou « humalis --aide » : le texte à afficher, ou undefined pour une autre commande. */
7
+ export function reponseSimple(arguments_, aide) {
8
+ if (arguments_.length !== 1)
9
+ return undefined;
10
+ if (['--version', '-v', 'version'].includes(arguments_[0]))
11
+ return `humalis ${versionHumalis()}`;
12
+ if (['--aide', '--help', '-h', 'aide'].includes(arguments_[0]))
13
+ return aide;
14
+ return undefined;
15
+ }
package/docs/guide.en.md CHANGED
@@ -1959,6 +1959,7 @@ texte "…" est absent` (a text is not shown).
1959
1959
  | Command | Role |
1960
1960
  |---|---|
1961
1961
  | `humalis nouveau <name>` | creates a project |
1962
+ | `humalis --version` | shows the installed version (`humalis --help`: the usage) |
1962
1963
  | `humalis developper` | runs the site and recompiles it on every save |
1963
1964
  | `humalis compile <file> --cible <target> --sortie <folder>` | generates a target's project |
1964
1965
  | `humalis compile <file> --cible web --composants <folder>` | generates React components to import elsewhere |
package/docs/guide.md CHANGED
@@ -1871,6 +1871,7 @@ Les autres étapes : `remplir champ "email" avec "…"`, `aller vers "panier"`,
1871
1871
  | Commande | Rôle |
1872
1872
  |---|---|
1873
1873
  | `humalis nouveau <nom>` | crée un projet |
1874
+ | `humalis --version` | affiche la version installée (`humalis --aide` : le mode d'emploi) |
1874
1875
  | `humalis developper` | lance le site et le recompile à chaque enregistrement |
1875
1876
  | `humalis compile <fichier> --cible <cible> --sortie <dossier>` | produit le projet d'une cible |
1876
1877
  | `humalis compile <fichier> --cible web --composants <dossier>` | produit des composants React à importer ailleurs |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "humalis",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Un seul langage, en français, pour créer une application complète : web, mobile, desktop et serveur",
5
5
  "type": "module",
6
6
  "bin": {