Socket
Socket
Sign inDemoInstall

minichan

Package Overview
Dependencies
113
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4 to 0.0.5

63

bin/minichan.js

@@ -7,31 +7,46 @@ #!/usr/bin/env node

const pkg = require('../package.json');
const Minichan = require('../index.js');
const Minichan = require('../index');
yargs
.scriptName('minichan').usage('$0 <cmd> [args]')
.command('mini [path]', 'Minify', (yarg) => {
yarg.option('path', {
describe: 'Project path',
alias: 'p',
default: process.cwd(),
});
})
.help()
.alias('help', 'h')
.alias('version', 'v');
.scriptName('minichan')
.usage('$0 <cmd> [args]')
.command('mini', '- Minify and build dist', (yarg) => {
yarg.option('path', {
describe: 'Project path',
alias: 'p',
default: process.cwd(),
});
yarg.option('force', {
describe: 'Force minichan',
alias: 'f',
default: false,
boolean: true,
});
})
.help()
.alias('help', 'h')
.alias('version', 'v');
if (yargs.argv._[0] === 'mini') {
const prompt = new Confirm({
initial: true,
name: 'question',
message: `Is the path correct? : [${yargs.argv.path}]`,
});
const { force } = yargs.argv;
if (!force) {
const prompt = new Confirm({
initial: true,
name: 'question',
message: `Is the path correct? : [${yargs.argv.path}]`,
});
prompt.run().then((answer) => {
if (answer) {
new Minichan().init(yargs.argv.path);
} else {
console.log('- Operation canceled -');
}
}).catch((error) => console.log('- Operation failed -', error));
prompt
.run()
.then((answer) => {
if (answer) {
new Minichan().init(yargs.argv.path);
} else {
console.log('- Operation canceled -');
}
})
.catch((error) => console.log('- Operation failed -', error));
} else {
new Minichan().init(yargs.argv.path);
}
} else {

@@ -38,0 +53,0 @@ console.log('Type minichan --help');

{
"name": "minichan",
"version": "0.0.4",
"version": "0.0.5",
"description": "JavaScript optimizer",
"main": "index.js",
"scripts": {},
"scripts": {
"build:npm": "npm pack"
},
"bin": {

@@ -16,6 +18,6 @@ "minichan": "bin/minichan.js"

"dependencies": {
"chalk": "^4.1.0",
"chalk": "^4.1.2",
"enquirer": "^2.3.6",
"filesize": "^6.1.0",
"fs-extra": "^9.0.1",
"filesize": "^8.0.6",
"fs-extra": "^10.0.0",
"glob": "^7.1.6",

@@ -25,3 +27,3 @@ "terser": "^5.5.1",

"update-notifier": "^5.0.1",
"yargs": "^16.2.0"
"yargs": "^17.3.0"
},

@@ -39,6 +41,8 @@ "repository": {

"devDependencies": {
"eslint": "^7.15.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1"
"eslint": "^8.4.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.5.1"
}
}

@@ -35,6 +35,11 @@ <p align="center">

- `-p <path_here>` Pass path
- Example: `minichan mini -p C:\Users\user\Minichan`
- Examples:
- `minichan mini -p C:\Users\user\Minichan`
- `-f` Force path and ignore choose options
- Examples:
- `minichan mini -f`
- `minichan mini -f -p C:\Users\user\Minichan`
Let you be reminded that I am currently under development and issues might come up, and we will do our very best to get 'em fixed in no time! 💜
Special thanks to all technologies and dependencies used to make this project come true 🥰 !!
Special thanks to all technologies and dependencies used to make this project come true 🥰 !!

@@ -18,3 +18,3 @@ const fse = require('fs-extra');

try {
this.newLocal = `./dist/${this.constructor.formatFileName(this.local)}`;
this.directoryCheck();
await this.copyFiles();

@@ -30,2 +30,11 @@

directoryCheck() {
this.newLocal = `./dist/${this.constructor.formatFileName(this.local)}`;
const existsDirectory = fse.existsSync(this.newLocal);
if (existsDirectory) {
fse.removeSync(this.newLocal);
console.log(`${chalk.bold.greenBright('[Folder]')} Folder cleared`);
}
}
async copyFiles() {

@@ -39,2 +48,3 @@ const exclude = globSync(`${this.local}/.git/**/*`);

filter: (pathThis) => {
if (pathThis.indexOf('dist') > -1) return false;
if (pathThis.indexOf('node_modules') > -1) return false;

@@ -136,3 +146,3 @@ if (exclude.find((name) => path.resolve(name) === path.resolve(pathThis))) {

getFileExtension(filename) {
let ext = filename.slice((filename.lastIndexOf('.') - 1 >>> 0) + 2);
let ext = filename.slice(((filename.lastIndexOf('.') - 1) >>> 0) + 2);
if (!ext) {

@@ -139,0 +149,0 @@ ext = this.constructor.IsDirectory(filename) ? 'dir' : 'undefined';

@@ -27,14 +27,16 @@ const fse = require('fs-extra');

Terser.minify(fse.readFileSync(file, 'utf8')).then((result) => {
if (result.code) {
fse.writeFileSync(file, result.code, 'utf8');
}
}).catch((e) => {
if (e.name.toLowerCase() === 'syntaxerror') {
if (e.message === "Unexpected character '#'") {
return;
Terser.minify(fse.readFileSync(file, 'utf8'))
.then((result) => {
if (result.code) {
fse.writeFileSync(file, result.code, 'utf8');
}
}
console.log(`${chalk.red.bold('Error')} ${file}:`, e);
});
})
.catch((e) => {
if (e.name.toLowerCase() === 'syntaxerror') {
if (e.message === "Unexpected character '#'") {
return;
}
}
console.log(`${chalk.red.bold('Error')} ${file}:`, e);
});
}

@@ -41,0 +43,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc