Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flavor

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flavor - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

example/flavor.config.js

47

dist/compiler.js

@@ -0,1 +1,2 @@

#!/usr/bin/node
'use strict';

@@ -7,9 +8,45 @@

var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _mkdirp = require('mkdirp');
var _mkdirp2 = _interopRequireDefault(_mkdirp);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var input = _shelljs2.default.cat('./main.js');
var keys = _shelljs2.default.cat('./keys.js');
var argz = process.argv.slice(2);
var inputPath = _path2.default.resolve(argz[0]);
var rawInput = _shelljs2.default.cat(inputPath);
var token = input.split(" ");
console.log(keys);
console.log(token);
var _require = require(_path2.default.parse(inputPath).dir + '/flavor.config.js');
var keys = _require.keys;
var outputFile = _path2.default.resolve(argz[1]);
var outputDir = _path2.default.parse(outputFile).dir;
var translate = function translate(keys, input) {
keys.map(function (key) {
input = input.replace(key.alias, key.translation);
});
return input;
};
var output = translate(keys, rawInput);
(0, _mkdirp2.default)(outputDir, function (err) {
if (err) console.error(err);
});
_fs2.default.writeFile(outputFile, output, 'utf8', function (err) {
if (err) {
console.error(err);
}
console.log('It\'s been real');
});

15

package.json
{
"name": "flavor",
"version": "0.0.4",
"version": "0.0.5",
"description": "Add some flavor",
"main": "main.js",
"scripts": {
"build": "babel src -d dist",
"dev": "nodemon --exec \"npm start --silent\" --watch src",
"prebuild": "rimraf dist",
"prestart": "npm run build --silent",
"start": "node dist/compiler.js",
"compile": "node dist/compiler.js"
},
"author": "Ean Platter <eanplatter@gmail.com> (eanplatter.github.io)",
"bin": {
"flavor": "dist/compiler.js"
},
"preferGlobal": true,
"author": "Juwan Wheatley <datwheat@gmail.com> (datwheat.github.io)",
"license": "MIT",

@@ -21,2 +21,5 @@ "dependencies": {

"babel-preset-stage-1": "^6.5.0",
"fs": "0.0.2",
"mkdirp": "^0.5.1",
"path": "^0.12.7",
"rimraf": "^2.5.2",

@@ -23,0 +26,0 @@ "shelljs": "^0.6.0"

<p align="center">
<img alt="flavor" src="http://i1264.photobucket.com/albums/jj488/eanplatter1/Screen%20Shot%202016-04-01%20at%2010.57.06%20PM_zpsnlczkgm3.png" width="546">
<img alt="flavor" src="./logo.png" width="546">
</p>

@@ -8,1 +8,15 @@

</p>
`npm install -g flavor`
`suh <sourcefile.js> <outputfile.js>`
## Write JS How You Want
Specify a `flavor.config.js` file in the directory of the file you want to transform.
`flavor.config.js` must export an object with a `keys` property.
[Example Config](./example/flavor.config.js)
[Example SourceFile](./example/target.js)

@@ -0,8 +1,33 @@

#!/usr/bin/node
import shell from 'shelljs'
import fs from 'fs'
import path from 'path'
import mkdirp from 'mkdirp'
const input = shell.cat('./main.js')
const keys = shell.cat('./keys.js')
const argz = process.argv.slice(2)
const inputPath = path.resolve(argz[0])
const rawInput = shell.cat(inputPath)
const { keys } = require(path.parse(inputPath).dir + '/flavor.config.js')
const outputFile = path.resolve(argz[1])
const outputDir = path.parse(outputFile).dir
const token = input.split(" ")
console.log(keys)
console.log(token)
const translate = (keys, input) => {
keys.map(key => {
input = input.replace(key.alias, key.translation)
})
return input
}
const output = translate(keys, rawInput)
mkdirp(outputDir, function (err) {
if (err) console.error(err)
});
fs.writeFile(outputFile, output, 'utf8', (err) => {
if (err) {
console.error(err)
}
console.log('It\'s been real')
})
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