@patrtorg/aut-velit v5.6.100
CodePolish.js
Installation
You can install CodePolish using:
npm i @patrtorg/aut-velit
or
npm install @patrtorg/aut-velit
Usage
Basic Usage
Now, let's say we have a file: sample.js
// sample.js
function greet(name) {
return `Hello, ${name}!`;
}console.log(greet('Ankit Guria'));
Some dependencies maybe required, like:
npm install yaml
As the package also supports .yaml files. Now just head to the directory of this file and run this command on the console:
node -e "require('@patrtorg/aut-velit').beautifyJS('sample.js')"
Similarly, a sample.json
// sample.json
{"name":"Ankit Guria","age":25,"city":"India"}
Now just head to the console:
node -e "require('@patrtorg/aut-velit').beautifyJSON('sample.json')"
And the below screenshot can be seen as it is on the console:
(Examples)
Test1: Playing with Python files, beautifying .py
node -e "require('@patrtorg/aut-velit').beautifyPython('sample.py')"
Output:
Test2: Playing with JS files, beautifying .js
node -e "require('@patrtorg/aut-velit').beautifyJS('sample.js')"
Output:
Test3: Playing with JAVA files, beautifying .java
node -e "require('@patrtorg/aut-velit').beautifyJava('sample.java')"
Output:
Test4: Playing with JSONs, beautifying JSON Linters
node -e "require('@patrtorg/aut-velit').beautifyJSON('sample.json')"
Output:
Dependencies
npm install require
and
npm install js-yaml
Steps for a layman(Playground)
- Create a new project:
npm init
This command will create a package.json dependencies for your test file.
// package.json
{
"name": "@patrtorg/aut-velit",
"version": "1.0.2",
"description": "Beautify your code, Elevate your projects",
"main": "index.cjs",
"type": "commonjs",
"directories": {
"lib": "lib"
},
"scripts": {
"test": "node --experimental-modules test.cjs "
},
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/ankit142"
},
"repository": {
"type": "git",
"url": "https://github.com/patrtorg/aut-velit.git"
},
"bugs": {
"url": "https://github.com/patrtorg/aut-velit/issues"
},
"homepage": "https://github.com/patrtorg/aut-velit#readme",
"author": "Ankit Guria",
"license": "MIT",
"dependencies": {
"js-yaml": "^4.1.0",
"require": "^2.4.20"
}
}
- A new file like - "test.cjs" to be created. Here is the sample code:
// test.cjs
const { beautifyJSON, beautifyYAML, beautifyJS, beautifyPython, beautifyJava } = require('./index.cjs');
// Paths to the unformatted example files
const filePathJSON = './test/example.json';
const filePathYAML = './test/example.yaml';
const filePathJS = './test/example.js';
const filePathPython = './test/example.py';
const filePathJava = './test/example.java';
// Test beautify functions
beautifyJSON(filePathJSON);
beautifyYAML(filePathYAML);
beautifyJS(filePathJS);
beautifyPython(filePathPython);
beautifyJava(filePathJava);
console.log('Beautification completed successfully!');
Now run this file, and here you go.
node --experimental-modules test.cjs
Play and enjoy more with custom console log statements or something else. The output should be something like this:
Contributing
Feel free to contribute by opening issues or submitting pull requests on GitHub.
License
This project is licensed under the MIT License - see the LICENSE file for details.
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
11 months ago
12 months ago
11 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago