Comparing version 0.0.4 to 0.0.5
@@ -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'); | ||
}); |
{ | ||
"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') | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54265
10
142
22
9
5
1
+ Addedfs@0.0.2
+ Addedmkdirp@^0.5.1
+ Addedpath@^0.12.7
+ Addedfs@0.0.2(transitive)
+ Addedinherits@2.0.3(transitive)
+ Addedpath@0.12.7(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedutil@0.10.4(transitive)