create-bridge-app
Advanced tools
Comparing version 1.0.23 to 1.0.24
#!/usr/bin/env node | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -7,8 +16,6 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const utils_1 = require("./utils"); | ||
const fs_1 = __importDefault(require("fs")); | ||
const prettier_1 = __importDefault(require("prettier")); | ||
// import { indexFile, nodemonFile, gitIgnoreFile } from './code'; | ||
// import minimist from 'minimist'; | ||
const { promisify } = require('util'); | ||
const exec = promisify(require('child_process').exec); | ||
// const argv = minimist(process.argv.slice(2)); | ||
@@ -20,50 +27,58 @@ const readline_1 = __importDefault(require("readline")); | ||
}); | ||
readline.question(`What's your project name? `, (name) => { | ||
console.log(`Downloading dependencies...`); | ||
(0, utils_1.runCommand)({ | ||
command: `mkdir ${name} & cd ${name} & npx tsc --init --outDir dist`, | ||
onSuccess: () => { | ||
console.log('wtf'); | ||
fs_1.default.writeFile(`${name}/package.json`, prettier_1.default.format(`{ | ||
"name": "${name | ||
.toLowerCase() | ||
.normalize('NFD') | ||
.replace(/[^a-zA-Z0-9]/g, '')}", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"start": "node ./dist/index.js", | ||
"dev": "nodemon --config nodemon.json ./index.ts", | ||
"build": "tsc" | ||
} | ||
}`, { parser: 'json' }), () => { | ||
(0, utils_1.runCommand)({ | ||
command: `cd ${name} && npm i bridge express zod dotenv && npm i --save-dev @types/express @types/node typescript ts-node nodemon`, | ||
onSuccess: () => { | ||
console.log('success'); | ||
readline.close(); | ||
// Promise.all([ | ||
// writeFileAsync( | ||
// `${name}/index.ts`, | ||
// prettier.format(indexFile, { parser: 'typescript' }), | ||
// ), | ||
// writeFileAsync( | ||
// `${name}/nodemon.json`, | ||
// prettier.format(nodemonFile, { parser: 'json' }), | ||
// ), | ||
// writeFileAsync(`${name}/.gitignore`, gitIgnoreFile), | ||
// writeFileAsync( | ||
// `${name}/.env`, | ||
// `PROJECT_NAME=${name}\nPORT=8080\nSERVER_URL=http://localhost:8080`, | ||
// ), | ||
// writeFileAsync( | ||
// `${name}/README.md`, | ||
// `#${name}\n\nWelcome on ${name}, this is a Bridge project, visit https://bridge.codes to learn how to automatically generate a complete online documentation and a fully typed client code in any language.`, | ||
// ), | ||
// ]); | ||
}, | ||
}); | ||
}); | ||
}, | ||
}); | ||
readline.question(`What's your project name? `, (name) => __awaiter(void 0, void 0, void 0, function* () { | ||
console.log(`Downloading dependencies... OK`); | ||
yield exec(`mkdir ${name} & cd ${name} & npx tsc --init --outDir dist`); | ||
// runCommand({ | ||
// command: `mkdir ${name} & cd ${name} & npx tsc --init --outDir dist`, | ||
// onSuccess: () => { | ||
// console.log('wtf'); | ||
// fs.writeFile( | ||
// `${name}/package.json`, | ||
// prettier.format( | ||
// `{ | ||
// "name": "${name | ||
// .toLowerCase() | ||
// .normalize('NFD') | ||
// .replace(/[^a-zA-Z0-9]/g, '')}", | ||
// "version": "1.0.0", | ||
// "scripts": { | ||
// "start": "node ./dist/index.js", | ||
// "dev": "nodemon --config nodemon.json ./index.ts", | ||
// "build": "tsc" | ||
// } | ||
// }`, | ||
// { parser: 'json' }, | ||
// ), | ||
// () => { | ||
// runCommand({ | ||
// command: `cd ${name} && npm i bridge express zod dotenv && npm i --save-dev @types/express @types/node typescript ts-node nodemon`, | ||
// onSuccess: () => { | ||
// console.log('success'); | ||
// readline.close(); | ||
// // Promise.all([ | ||
// // writeFileAsync( | ||
// // `${name}/index.ts`, | ||
// // prettier.format(indexFile, { parser: 'typescript' }), | ||
// // ), | ||
// // writeFileAsync( | ||
// // `${name}/nodemon.json`, | ||
// // prettier.format(nodemonFile, { parser: 'json' }), | ||
// // ), | ||
// // writeFileAsync(`${name}/.gitignore`, gitIgnoreFile), | ||
// // writeFileAsync( | ||
// // `${name}/.env`, | ||
// // `PROJECT_NAME=${name}\nPORT=8080\nSERVER_URL=http://localhost:8080`, | ||
// // ), | ||
// // writeFileAsync( | ||
// // `${name}/README.md`, | ||
// // `#${name}\n\nWelcome on ${name}, this is a Bridge project, visit https://bridge.codes to learn how to automatically generate a complete online documentation and a fully typed client code in any language.`, | ||
// // ), | ||
// // ]); | ||
// }, | ||
// }); | ||
// }, | ||
// ); | ||
// }, | ||
// }); | ||
readline.close(); | ||
}); | ||
})); |
{ | ||
"name": "create-bridge-app", | ||
"version": "1.0.23", | ||
"version": "1.0.24", | ||
"description": "Create Bridge-powered Express app with one command", | ||
@@ -5,0 +5,0 @@ "author": "Bridge Team <support@bridge.codes>", |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
10202
216
1
2