Socket
Socket
Sign inDemoInstall

remake

Package Overview
Dependencies
14
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.0 to 1.7.0

utils/commands.js

137

index.js

@@ -1,114 +0,45 @@

const fs = require("fs");
const path = require('path');
const rimraf = require('rimraf');
const shell = require('shelljs');
const program = require('commander');
const ncp = require('ncp');
const boxen = require('boxen');
const chalk = require('chalk');
const { getSuccessMessage } = require('./utils/get-success-message');
const { getVariablesEnvFileText } = require('./utils/get-variables-env-file-text');
const { version } = require('./package.json');
let boxenOptions = {padding: 3, margin: 1, borderStyle: 'double', borderColor: 'green'};
const Configstore = require('configstore');
program.version("v" + version);
const { clean, build, deploy, serve, updateFramework, create } = require('./utils/commands');
const { version, name } = require('./package.json');
program
.option('create <project-dir>', 'Generate a new Remake project')
.option('update-framework', 'Update the Remake framework in your project');
log = console.log;
remakeCliConfig = new Configstore(name, { user: {} });
remakeServiceHost = 'https://remakeapps.com';
module.exports = () => {
program.parse(process.argv);
program
.version('v' + version, '-v, --version', 'output the current version')
.name('remake')
.usage('command [--help]')
let projectDir = program.create;
if (projectDir) {
let ncpOptions = {clobber: false, dereference: false, stopOnErr: true};
program
.command('create <projectDir>')
.description('Create a new Remake project')
.option('-m, --multitenant', 'create a multi tenant Remake app')
.action((projectDir, options) => create(projectDir, options));
let newProjectDirPath = path.join(process.cwd(), projectDir);
program
.command('update-framework')
.description('Update the Remake framework in your project')
.action(() => updateFramework());
if (fs.existsSync(newProjectDirPath)) {
console.log(chalk.bgRed("Error: Cannot write to a directory that already exists"));
return;
}
program
.command('deploy')
.description('Deploy your Remake app on the Remake server')
.action(() => deploy());
// STEP 1
console.log(chalk.bgGreen("(1/4) Creating new project"));
shell.exec(`git clone --depth 1 https://github.com/panphora/remake-framework.git ${projectDir}`);
program
.command('build')
.description('Build your Remake app')
.action(() => build());
// STEP 2a & 2b
console.log(chalk.bgGreen("(2/4) Tidy up new project directory"));
rimraf(path.join(newProjectDirPath, ".git"), function (rimrafError) {
program
.command('clean')
.description('Wipe the local Remake environment including caches and build assets')
.action(() => clean());
if (rimrafError) {
console.log(chalk.bgRed("Error: Couldn't remove old .git directory from new project"));
return;
}
// put project README in the right place
shell.mv(path.join(newProjectDirPath, "README-FOR-BUNDLE.md"), path.join(newProjectDirPath, "README.md"));
// STEP 3
console.log(chalk.bgGreen("(3/4) Installing npm dependencies"));
shell.cd(newProjectDirPath);
shell.exec("npm install");
// STEP 4
console.log(chalk.bgGreen("(4/4) Setting up variables.env"));
fs.writeFile(path.join(newProjectDirPath, "variables.env"), getVariablesEnvFileText(), function (err) {
if (err) {
console.log(chalk.bgRed("Error: Couldn't create variables.env file"));
return;
}
// SUCCESS!!
console.log(boxen(getSuccessMessage(projectDir), boxenOptions));
});
});
}
if (program.updateFramework) {
let ncpOptions = {clobber: true, dereference: false, stopOnErr: true};
let cwd = process.cwd();
let remakeFrameworkPathInApplicationDirectory = path.join(process.cwd(), "_remake");
// 1. CHECK IF _remake DIRECTORY EXISTS
if (!fs.existsSync(remakeFrameworkPathInApplicationDirectory)) {
console.log(chalk.bgRed("Error: Cannot find a _remake directory in this project"));
return;
}
// 2. REMOVE OLD _remake DIRECTORY
console.log(chalk.bgGreen("(1/2) Removing old _remake directory..."));
rimraf(remakeFrameworkPathInApplicationDirectory, function (rimrafError) {
if (rimrafError) {
console.log(chalk.bgRed("Error: Couldn't remove old _remake directory"));
return;
}
// 3. GIT CLONE THE ENTIRE FULL STACK STARTER PROJECT INTO THE CURRENT DIRECTORY
console.log(chalk.bgGreen("(2/2) Copying framework into _remake directory..."));
shell.exec("git clone --depth 1 https://github.com/panphora/remake-framework.git");
// 4. MOVE THE _remake DIRECTORY TO WHERE THE OLD _remake DIRECTORY WAS
let currentRemakeDir = path.join(cwd, "remake-framework/_remake");
shell.mv(path.join(cwd, "remake-framework/_remake"), remakeFrameworkPathInApplicationDirectory);
rimraf(path.join(cwd, "remake-framework"), function (rimrafError) {
if (rimrafError) {
console.log(chalk.bgRed("Error cleaning up: Couldn't remove the ./remake-framework directory"));
return;
}
console.log(chalk.bgGreen("Successfully updated Remake!"));
});
});
}
}
module.exports = async () => {
program.parse(process.argv)
}
{
"name": "remake",
"version": "1.6.0",
"version": "1.7.0",
"description": "Generate a full-stack Remake web app",

@@ -31,7 +31,14 @@ "license": "MIT",

"dependencies": {
"archiver": "^3.1.1",
"axios": "^0.19.0",
"boxen": "^4.1.0",
"chalk": "^2.4.2",
"commander": "^3.0.0",
"configstore": "^5.0.0",
"es6-promisify": "^6.0.2",
"form-data": "^2.5.1",
"inquirer": "^7.0.0",
"nanoid": "^2.0.3",
"ncp": "^2.0.0",
"ora": "^4.0.2",
"rimraf": "^3.0.0",

@@ -38,0 +45,0 @@ "shelljs": "^0.8.3"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc