From 434d53e034b42769a84edfac60e087deb18983ef Mon Sep 17 00:00:00 2001 From: Lorenzo Iovino Date: Sat, 20 Jan 2024 10:13:43 +0100 Subject: [PATCH] Fix install.js --- .bin/install.js | 12 ++++++------ README-blank.md | 21 +++++++++++++++++++++ README.md | 2 +- package-blank.json | 21 +++++++++++++++++++++ 4 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 README-blank.md create mode 100644 package-blank.json diff --git a/.bin/install.js b/.bin/install.js index 6de3170..07b9a54 100644 --- a/.bin/install.js +++ b/.bin/install.js @@ -1,10 +1,7 @@ #!/usr/bin/env node - -import { execSync } from 'child_process'; - const runCommand = command => { try { - execSync(`${command}`, { stdio: 'inherit' }); + require('child_process').execSync(`${command}`, { stdio: 'inherit' }); } catch (err) { console.error(`Failed to execute ${command}`, err); return false; @@ -15,7 +12,7 @@ const runCommand = command => { const repoName = process.argv[2]; const gitCheckoutCommand = `git clone --depth 1 https://github.com/thisloke/node-base ${repoName}`; -const installDepsCommand = `cd ${repoName} && npm install`; +const installDepsCommand = `cd ${repoName} && npm install && rm -rf .git && rm -rf .bin && rm package.json && mv package-blank.json package.json && rm README.md && mv README-blank.md README.md`; console.log(`Cloning the repository ${repoName}`); @@ -33,4 +30,7 @@ if (!installedDeps) { process.exit(-1); } -console.log("Ready to start!"); \ No newline at end of file +console.log(`Ready to start!\n + cd ${repoName} + npm run build:watch + npm run test:watch`); \ No newline at end of file diff --git a/README-blank.md b/README-blank.md new file mode 100644 index 0000000..09a4651 --- /dev/null +++ b/README-blank.md @@ -0,0 +1,21 @@ +

+ node-base-project +

+ +## Quick usage + +### 1) Start development +``` + npm run build:watch + npm run test:watch +``` + +### 2) Build +``` + npm run build +``` + +### 3) Run +``` + npm run start +``` \ No newline at end of file diff --git a/README.md b/README.md index d73c363..4f546e4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ### 1) Get your copy ``` -npx github:thisloke/node-base my-project +npx github:thisloke/node-base my-node-project ``` ### 2) Start development diff --git a/package-blank.json b/package-blank.json new file mode 100644 index 0000000..f2bffae --- /dev/null +++ b/package-blank.json @@ -0,0 +1,21 @@ +{ + "name": "node-base-project", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "node build/main.js", + "build": "tsc -p tsconfig.json", + "build+start": "npm run build && npm run start", + "build:watch": "tsc -w -p tsconfig.json", + "test:watch": "node --import tsx --test --watch **/*.spec.ts", + "test": "node --import tsx --test **/*.spec.ts" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "@types/node": "^20.11.5", + "tsx": "^4.7.0", + "typescript": "^5.3.3" + } +}