@slvn/neon 1.0.6 → 1.0.7

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.
Files changed (3) hide show
  1. package/bin/neon.js +1 -1
  2. package/index.js +5 -2
  3. package/package.json +1 -1
package/bin/neon.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import fs from "fs";
4
4
  import path from "path";
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import fs from "fs/promises";
2
2
  import chalk from "chalk";
3
+ import path from 'path'
3
4
 
4
5
  const intent = process.argv[2];
5
6
  if(!intent){
@@ -7,6 +8,8 @@ if(!intent){
7
8
  process.exit(1)
8
9
  }
9
10
 
11
+ const intentFile = path.basename(intent)
12
+
10
13
  async function generateCode(int) {
11
14
  try {
12
15
  const file = await fs.readFile(int , "utf-8");
@@ -18,11 +21,11 @@ async function generateCode(int) {
18
21
  console.log(chalk.green("\n Ecriture du fichier ..."))
19
22
  const data = dat.code;
20
23
  if(await fs.stat("dist")){
21
- await fs.writeFile(`dist/${intent.replace(/.txt/g , ".html")}`, data.replace(/```html/g , "").replace(/```/g , ""), "utf-8");
24
+ await fs.writeFile(`dist/${intentFile.replace(/.txt/g , ".html")}`, data.replace(/```html/g , "").replace(/```/g , ""), "utf-8");
22
25
  }
23
26
  else if(!await fs.stat("dist")){
24
27
  await fs.mkdir("dist")
25
- await fs.writeFile(`dist/${intent.replace(/.txt/g , ".html")}`, data.replace(/```html/g , "").replace(/```/g , ""), "utf-8");
28
+ await fs.writeFile(`dist/${intentFile.replace(/.txt/g , ".html")}`, data.replace(/```html/g , "").replace(/```/g , ""), "utf-8");
26
29
  }
27
30
  console.log("Fichier crée avec succès")
28
31
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slvn/neon",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {