Reorganize file structure by language/platform

Moved all files that are specifically for the website into web (except for index.htm)
Moved all files that are javascript (for node or web) into js
Organized js folder to generally follow node structures

This change also changes .npmignore to include unpackers in the package.
First step on #224.
This commit is contained in:
Liam Newman 2013-04-04 15:51:19 -07:00
parent 1768f57411
commit 9de057f94c
204 changed files with 54 additions and 56 deletions

View File

@ -1,9 +1,5 @@
Makefile
attic/
favicon.png
index.html
jquery/
php/
python/
third-party/
unpackers/
web/

View File

@ -34,15 +34,15 @@ testj:
edit:
vim \
beautify.js python/jsbeautifier/__init__.py \
tests/beautify-tests.js python/jsbeautifier/tests/testjsbeautifier.py
js/lib/beautify.js python/jsbeautifier/__init__.py \
js/test/beautify-tests.js python/jsbeautifier/tests/testjsbeautifier.py
gedit:
gvim \
beautify.js \
tests/beautify-tests.js \
python/jsbeautifier/__init__.py \
python/jsbeautifier/tests/testjsbeautifier.py &
js/lib/beautify.js \
js/test/beautify-tests.js \
js/python/jsbeautifier/__init__.py \
js/python/jsbeautifier/tests/testjsbeautifier.py &
tests: testj testp

View File

@ -1,4 +0,0 @@
#!/usr/bin/env node
var cli = require('../cli'); cli.interpret();

View File

@ -1,4 +0,0 @@
#!/usr/bin/env node
var cli = require('../cli'); cli.interpret();

View File

@ -1,4 +0,0 @@
#!/usr/bin/env node
var cli = require('../cli'); cli.interpret();

View File

@ -32,10 +32,10 @@
<head>
<meta charset="utf-8">
<title>Online JavaScript beautifier</title>
<link rel="icon" href="favicon.png" type="image/png">
<script src="third-party/codemirror2/lib/codemirror.js"></script>
<script src="third-party/codemirror2/mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="third-party/codemirror2/lib/codemirror.css">
<link rel="icon" href="web/favicon.png" type="image/png">
<script src="web/third-party/codemirror/lib/codemirror.js"></script>
<script src="web/third-party/codemirror/mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="web/third-party/codemirror/lib/codemirror.css">
<style>
@ -137,19 +137,19 @@ a {
}
</style>
<script src="third-party/jquery/jquery.js"></script>
<script src="third-party/jquery/jquery.cookie.js"></script>
<script src="web/third-party/jquery/jquery.js"></script>
<script src="web/third-party/jquery/jquery.cookie.js"></script>
<script src="beautify.js"></script>
<script src="beautify-css.js"></script>
<script src="beautify-html.js"></script>
<script src="tests/sanitytest.js"></script>
<script src="tests/beautify-tests.js"></script>
<script src="unpackers/javascriptobfuscator_unpacker.js"></script>
<script src="unpackers/urlencode_unpacker.js"></script>
<script src="unpackers/p_a_c_k_e_r_unpacker.js"></script>
<script src="unpackers/myobfuscate_unpacker.js"></script>
<script src="js/lib/beautify.js"></script>
<script src="js/lib/beautify-css.js"></script>
<script src="js/lib/beautify-html.js"></script>
<script src="js/test/sanitytest.js"></script>
<script src="js/test/beautify-tests.js"></script>
<script src="js/lib/unpackers/javascriptobfuscator_unpacker.js"></script>
<script src="js/lib/unpackers/urlencode_unpacker.js"></script>
<script src="js/lib/unpackers/p_a_c_k_e_r_unpacker.js"></script>
<script src="js/lib/unpackers/myobfuscate_unpacker.js"></script>
<script>

4
js/bin/css-beautify.js Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env node
var cli = require('../lib/cli'); cli.interpret();

4
js/bin/html-beautify.js Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env node
var cli = require('../lib/cli'); cli.interpret();

4
js/bin/js-beautify.js Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env node
var cli = require('../lib/cli'); cli.interpret();

View File

@ -38,7 +38,7 @@ var debug = process.env.DEBUG_JSBEAUTIFY || process.env.JSBEAUTIFY_DEBUG
var fs = require('fs'),
cc = require('config-chain'),
beautify = require('./index'),
beautify = require('../index'),
nopt = require('nopt'),
path = require('path'),
knownOpts = {
@ -113,7 +113,7 @@ var interpret = exports.interpret = function (argv, slice) {
var parsed = nopt(knownOpts, shortHands, argv, slice);
if (parsed.version) {
console.log(require('./package.json').version);
console.log(require(__dirname + '/../../package.json').version);
process.exit(0);
}
else if (parsed.help) {
@ -126,7 +126,7 @@ var interpret = exports.interpret = function (argv, slice) {
cleanOptions(cc.env('jsbeautify_'), knownOpts),
parsed.config,
cc.find('.jsbeautifyrc'),
__dirname + '/config/defaults.json'
__dirname + '/../config/defaults.json'
).snapshot;
try {

View File

@ -9,12 +9,12 @@
// if (Urlencoded.detect(some_string)) {
// var unpacked = Urlencoded.unpack(some_string);
// }
//
//
//
var isNode = (typeof module !== 'undefined' && module.exports);
if (isNode) {
var SanityTest = require(__dirname + '/../tests/sanitytest');
var SanityTest = require(__dirname + '/../../test/sanitytest');
}
var Urlencoded = {

View File

@ -2,8 +2,8 @@
/*jshint node:true */
var SanityTest = require('./sanitytest'),
Urlencoded = require('../unpackers/urlencode_unpacker'),
js_beautify = require('../beautify').js_beautify,
Urlencoded = require('../lib/unpackers/urlencode_unpacker'),
js_beautify = require('../lib/beautify').js_beautify,
run_beautifier_tests = require('./beautify-tests').run_beautifier_tests;
function node_beautifier_tests() {

View File

@ -5,13 +5,13 @@
// a little helper for testing from command line
// just run it, it will output the test results
load('beautify.js');
load('tests/sanitytest.js')
load('tests/beautify-tests.js')
load('unpackers/urlencode_unpacker.js')
load('js/lib/beautify.js');
load('js/test/sanitytest.js')
load('js/test/beautify-tests.js')
load('js/lib/unpackers/urlencode_unpacker.js')
print(run_beautifier_tests().results_raw())
// for nodejs use this from the command line from the main directory:
// node tests/beautify-tests.js
// node test/beautify-tests.js

View File

@ -2,18 +2,20 @@
"name": "js-beautify",
"version": "1.2.0",
"description": "jsbeautifier.org for node",
"main": "index.js",
"main": "js/index.js",
"preferGlobal": true,
"bin": {
"css-beautify": "./bin/css-beautify.js",
"html-beautify": "./bin/html-beautify.js",
"js-beautify": "./bin/js-beautify.js"
"css-beautify": "./js/bin/css-beautify.js",
"html-beautify": "./js/bin/html-beautify.js",
"js-beautify": "./js/bin/js-beautify.js"
},
"directories": {
"test": "tests"
"lib": "js/lib",
"test": "js/test"
},
"scripts": {
"test": "node ./tests/node-beautify-tests.js"
"test": "node ./js/test/node-beautify-tests.js"
},
"bugs": "https://github.com/einars/js-beautify/issues",
"homepage": "http://jsbeautifier.org/",

View File

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Some files were not shown because too many files have changed in this diff Show More