Fix install.js
This commit is contained in:
parent
0ddea7c1c6
commit
434d53e034
4 changed files with 49 additions and 7 deletions
|
|
@ -1,10 +1,7 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import { execSync } from 'child_process';
|
|
||||||
|
|
||||||
const runCommand = command => {
|
const runCommand = command => {
|
||||||
try {
|
try {
|
||||||
execSync(`${command}`, { stdio: 'inherit' });
|
require('child_process').execSync(`${command}`, { stdio: 'inherit' });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`Failed to execute ${command}`, err);
|
console.error(`Failed to execute ${command}`, err);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -15,7 +12,7 @@ const runCommand = command => {
|
||||||
|
|
||||||
const repoName = process.argv[2];
|
const repoName = process.argv[2];
|
||||||
const gitCheckoutCommand = `git clone --depth 1 https://github.com/thisloke/node-base ${repoName}`;
|
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}`);
|
console.log(`Cloning the repository ${repoName}`);
|
||||||
|
|
||||||
|
|
@ -33,4 +30,7 @@ if (!installedDeps) {
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Ready to start!");
|
console.log(`Ready to start!\n
|
||||||
|
cd ${repoName}
|
||||||
|
npm run build:watch
|
||||||
|
npm run test:watch`);
|
||||||
21
README-blank.md
Normal file
21
README-blank.md
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<h1 align="center">
|
||||||
|
node-base-project
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
## Quick usage
|
||||||
|
|
||||||
|
### 1) Start development
|
||||||
|
```
|
||||||
|
npm run build:watch
|
||||||
|
npm run test:watch
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2) Build
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3) Run
|
||||||
|
```
|
||||||
|
npm run start
|
||||||
|
```
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
### 1) Get your copy
|
### 1) Get your copy
|
||||||
```
|
```
|
||||||
npx github:thisloke/node-base my-project
|
npx github:thisloke/node-base my-node-project
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2) Start development
|
### 2) Start development
|
||||||
|
|
|
||||||
21
package-blank.json
Normal file
21
package-blank.json
Normal file
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue