next-competition-backend 1.0.3 → 1.0.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/setup.js +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-competition-backend",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Setup basic BE for Next JS based competition website",
5
5
  "scripts": {},
6
6
  "author": "Troll321",
package/setup.js CHANGED
@@ -1,8 +1,9 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const { execSync } = require("child_process");
4
4
  const { input, select } = require("@inquirer/prompts");
5
5
  const path = require("path");
6
+ const fs = require("fs");
6
7
  const TEMPLATE_REPO_URL = "https://github.com/Troll321/next-competition-backend-template";
7
8
 
8
9
  const execCommand = (command, options = {}) => {
@@ -15,7 +16,7 @@ const execCommand = (command, options = {}) => {
15
16
  };
16
17
 
17
18
  const setupRepository = async (projectName, packageManager) => {
18
- execCommand(`git clone --depth=1 ${TEMPLATE_REPO_URL} ${projectName}`);
19
+ execCommand(`git clone --depth 1 "${TEMPLATE_REPO_URL}" "${projectName}"`);
19
20
 
20
21
  const projectPath = path.join(process.cwd(), projectName);
21
22
  let installCommand;
@@ -46,7 +47,7 @@ const setupRepository = async (projectName, packageManager) => {
46
47
  };
47
48
 
48
49
  const main = async () => {
49
- const projectName = await input({ message: "Project name: " });
50
+ const projectName = await input({ message: "Project name: ", pattern: /^[^\"]+$/ });
50
51
  const packageManager = await select({
51
52
  message: "Package manager?: ",
52
53
  choices: [
@@ -62,5 +63,5 @@ const main = async () => {
62
63
  };
63
64
 
64
65
  main().catch((err) => {
65
- console.error(err.name ?? err);
66
+ console.error(err);
66
67
  });