Add .bin/install.js Updated README.md

This commit is contained in:
Lorenzo Iovino 2024-01-20 10:12:26 +01:00
parent ae301e44f4
commit 0ddea7c1c6
5 changed files with 77 additions and 23 deletions

36
.bin/install.js Normal file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env node
import { execSync } from 'child_process';
const runCommand = command => {
try {
execSync(`${command}`, { stdio: 'inherit' });
} catch (err) {
console.error(`Failed to execute ${command}`, err);
return false;
}
return true;
};
const repoName = process.argv[2];
const gitCheckoutCommand = `git clone --depth 1 https://github.com/thisloke/node-base ${repoName}`;
const installDepsCommand = `cd ${repoName} && npm install`;
console.log(`Cloning the repository ${repoName}`);
const checkedOut = runCommand(gitCheckoutCommand);
if (!checkedOut) {
process.exit(-1);
}
console.log(`Installing dependencies for ${repoName}`);
const installedDeps = runCommand(installDepsCommand);
if (!installedDeps) {
process.exit(-1);
}
console.log("Ready to start!");

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
node_modules
build
build
.idea

33
README.md Normal file
View file

@ -0,0 +1,33 @@
<h1 align="center">
node-base
</h1>
<p style="font-size: 20px" align="center">Very Simple nodejs boilerplate (with <img width=30" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Typescript_logo_2020.svg/1200px-Typescript_logo_2020.svg.png">)</p>
![Angular](https://img.shields.io/badge/Node-21-green.svg)
![Contributions welcome](https://img.shields.io/badge/contributions-welcome-green.svg)
[![License](https://img.shields.io/badge/license-ISC-blue.svg)](https://opensource.org/licenses/MIT)
## Quick usage
### 1) Get your copy
```
npx github:thisloke/node-base my-project
```
### 2) Start development
```
npm run build:watch
npm run test:watch
```
### 3) Build
```
npm run build
```
### 4) Run
```
npm run start
```

View file

@ -1,19 +0,0 @@
# Very Simple node boilerplate
## Quick usage
### To start development
```
npm run build:watch
npm run test:watch
```
### To build
```
npm run build
```
### To start
```
npm run start
```

View file

@ -1,7 +1,7 @@
{
"name": "base",
"name": "node-base",
"version": "1.0.0",
"description": "",
"description": "Very Simple nodejs boilerplate (with TS)",
"main": "index.js",
"scripts": {
"start": "node build/main.js",
@ -11,7 +11,10 @@
"test:watch": "node --import tsx --test --watch **/*.spec.ts",
"test": "node --import tsx --test **/*.spec.ts"
},
"author": "",
"bin": {
"node-base": ".bin/install.js"
},
"author": "Lorenzo Iovino",
"license": "ISC",
"devDependencies": {
"@types/node": "^20.11.5",