Socket
Socket
Sign inDemoInstall

qcobjects-cli

Package Overview
Dependencies
Maintainers
1
Versions
197
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qcobjects-cli - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

131

org.quickcorp.qcobjects.cli.js

@@ -36,8 +36,2 @@ /**

const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
logger.debugEnabled=false;

@@ -128,4 +122,8 @@ CONFIG.set('node_modules_path','./node_modules/');

map_files(CONFIG.get('qcobjectsnewapp_path'),(filename)=>{
logger.debug('Creating file: '+relativePath(filename));
copyTemplateFile(filename,relativePath(filename));
if (!['./package.json',
'./package-lock.json',
'./sw.js'].includes(relativePath(filename))){
logger.info('Creating file: '+relativePath(filename));
copyTemplateFile(filename,relativePath(filename));
}
});

@@ -145,2 +143,9 @@

const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('Please tell me your git repository url: \n', (answer) => {

@@ -154,10 +159,12 @@ logger.info(`your git repository url is ${answer}`);

let createAppCommand;
let appTemplateName;
if (options.createAmp){
CONFIG.set('qcobjectsnewapp_path',CONFIG.get('node_modules_path')+'/qcobjects-ecommerce-amp');
appTemplateName = 'qcobjects-ecommerce-amp';
createAppCommand = createAppCommandAMP;
} else {
CONFIG.set('qcobjectsnewapp_path',CONFIG.get('node_modules_path')+'/qcobjectsnewapp');
appTemplateName = 'qcobjectsnewapp';
createAppCommand = createAppCommandPWA;
}
CONFIG.set('qcobjectsnewapp_path',CONFIG.get('node_modules_path')+'/'+appTemplateName);

@@ -171,16 +178,9 @@ logger.debug(createAppCommand);

logger.info('Good! Your application is getting done. You can play with QCObjects now!');
logger.info('In five second your server will start...');
logger.info('In about five seconds your server will start...');
exec("qcobjects-createcert",(err,stdout,stderr)=>{
logger.info("Test certificates generated");
switchCommander.generateServiceWorker(appName);
exec("npm uninstall "+appTemplateName+" --save && npm cache verify",(err,stdout,stderr)=>{
switchCommander.generateServiceWorker(appName);
});
});
setTimeout(()=>{
exec("qcobjects-server",(err,stdout,stderr)=>{
logger.info("Bye.");
});
},5000);
setTimeout(()=>{
execSync("open -a \"google chrome\" https://localhost");
},6000);
});

@@ -199,29 +199,59 @@ });

let switchCommander = this;
this.program
.version(package_config.version);
this.program
.command('create <appname>')
.description('Creates an app with <appname>')
.option('--pwa, --create-pwa', 'Creates the progressive web app assets')
.option('--amp, --create-amp', 'Creates the accelerated mobile pages assets')
.option('--tests, --create-tests', 'Creates the test suite')
.action(function(args, options){
switchCommander.choiceOption.create.call(switchCommander,args,options);
});
this.program.command('publish <appname>')
.description('Publishes an app with <appname>')
.option('--pwa, --create-pwa', 'Publishes the progressive web app assets')
.option('--amp, --create-amp', 'Publishes the accelerated mobile pages assets')
.option('--tests, --create-tests', 'Publishes the test suite')
.action(function(args, options){
switchCommander.choiceOption.publish.call(switchCommander,args,options);
});
if (process.argv.length>1){
this.program.command('generate-sw <appname>')
.description('Generates the service worker <appname>')
.action(function(args, options){
switchCommander.choiceOption.generateSw.call(switchCommander,args,options);
});
this.program
.version(package_config.version);
this.program
.command('create <appname>')
.description('Creates an app with <appname>')
.option('--pwa, --create-pwa', 'Creates the progressive web app assets')
.option('--amp, --create-amp', 'Creates the accelerated mobile pages assets')
.option('--tests, --create-tests', 'Creates the test suite')
.action(function(args, options){
switchCommander.choiceOption.create.call(switchCommander,args,options);
});
this.program.command('publish <appname>')
.description('Publishes an app with <appname>')
.option('--pwa, --create-pwa', 'Publishes the progressive web app assets')
.option('--amp, --create-amp', 'Publishes the accelerated mobile pages assets')
.option('--tests, --create-tests', 'Publishes the test suite')
.action(function(args, options){
switchCommander.choiceOption.publish.call(switchCommander,args,options);
});
this.program.on('--help', function(){
this.program.command('generate-sw <appname>')
.description('Generates the service worker <appname>')
.action(function(args, options){
switchCommander.choiceOption.generateSw.call(switchCommander,args,options);
});
this.program.command('launch <appname>')
.description('Launches the application')
.action(function (args,options){
logger.info("Launching...");
setTimeout(()=>{
logger.info("Go to the browser and open https://localhost ");
logger.info("Press Ctrl-C to stop serving ");
exec("qcobjects-server",(err,stdout,stderr)=>{
});
},5000);
// setTimeout(()=>{
// execSync("open -a \"google chrome\" https://localhost");
// },6000);
});
this.program.on('--help', function(){
console.log('')
console.log('Use:');
console.log(' $ qcobjects-cli [command] --help');
console.log(' For detailed information of a command ');
console.log('')
process.exit(0);
});
this.program.on('command:*', function () {
console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
process.exit(1);
});
this.program.parse(process.argv);
} else {
console.log('')

@@ -232,11 +262,8 @@ console.log('Use:');

console.log('')
});
this.program.on('command:*', function () {
console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
process.exit(1);
});
this.program.parse(process.argv);
process.exit(0);
}
}
})
]);

@@ -146,7 +146,3 @@ /**

response:'',
server:http2.createSecureServer({
key: fs.readFileSync(CONFIG.get('private-key-pem')),
cert: fs.readFileSync(CONFIG.get('private-cert-pem')),
allowHTTP1:CONFIG.get('allowHTTP1')
}),
server:null,
scriptname:'',

@@ -157,5 +153,19 @@ start:function (){

// http2 port is 8443 but normally is used 443 by replacing current https
const http = require('http');
const httpServer = http.createServer((req, res) => {
res.writeHead(301,{Location: `https://${req.headers.host}${req.url}`});
res.end();
});
httpServer.listen(CONFIG.get('serverPortHTTP'));
server.listen(CONFIG.get('serverPortHTTPS'));
},
_new_:function (){
this.server = http2.createSecureServer({
key: fs.readFileSync(CONFIG.get('private-key-pem')),
cert: fs.readFileSync(CONFIG.get('private-cert-pem')),
allowHTTP1:CONFIG.get('allowHTTP1')
});
var server = this.server;

@@ -162,0 +172,0 @@

{
"name": "qcobjects-cli",
"version": "0.1.0",
"version": "0.1.1",
"description": "qcobjects cli command line tool",

@@ -5,0 +5,0 @@ "main": "qcobjects-cli.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc