psf-cli 0.2.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "psf-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "main": "cli.js",
5
5
  "bin": {
6
6
  "psf": "src/cli.js"
@@ -0,0 +1,3 @@
1
+ export default async function gitignoreCreator() {
2
+ await fs.writeFile(path.join(pathFolder, ".gitignore"), "node_modules\n");
3
+ }
@@ -1,5 +1,6 @@
1
1
  import fs from "fs/promises";
2
- import { version } from "os";
2
+ import packageJsonCreator from "./packageJsonCreator";
3
+ import gitignoreCreator from "./gitignoreCreator";
3
4
  import path from "path";
4
5
 
5
6
  // Creating a Node Project
@@ -19,30 +20,9 @@ async function folderCreator(dir, projectName) {
19
20
  path.join(pathFolder, "README.md"),
20
21
  "# New Node Project",
21
22
  );
22
- await fs.writeFile(
23
- path.join(pathFolder, "package.json"),
24
- packageJsonCreator(projectName),
25
- );
26
- await fs.writeFile(path.join(pathFolder, ".gitignore"), "node_modules\n");
23
+ packageJsonCreator();
24
+ gitignoreCreator();
27
25
  } catch (err) {
28
26
  console.error("Error creating folder:", err);
29
27
  }
30
28
  }
31
-
32
- function packageJsonCreator(projectName) {
33
- const packageJson = {
34
- name: projectName,
35
- version: "1.0.0",
36
- description: "",
37
- main: "src/index.js",
38
- type: "module",
39
- scripts: {
40
- test: 'echo "Error: no test specified" && exit 1',
41
- },
42
- keywords: [],
43
- author: "",
44
- license: "ISC ",
45
- };
46
-
47
- return JSON.stringify(packageJson, "", 2);
48
- }
@@ -0,0 +1,22 @@
1
+ import fs from "fs/promises";
2
+
3
+ export default async function packageJsonCreator(projectName) {
4
+ const packageJson = {
5
+ name: projectName,
6
+ version: "1.0.0",
7
+ description: "",
8
+ main: "src/index.js",
9
+ type: "module",
10
+ scripts: {
11
+ test: 'echo "Error: no test specified" && exit 1',
12
+ },
13
+ keywords: [],
14
+ author: "",
15
+ license: "ISC ",
16
+ };
17
+
18
+ return await fs.writeFile(
19
+ path.join(pathFolder, "package.json"),
20
+ JSON.stringify(packageJson, "", 2),
21
+ );
22
+ }