Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package tooling reorganization and README.md cleanup #42

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
42 changes: 5 additions & 37 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,12 @@
module.exports = {
extends: 'airbnb-base',
env: {
browser: true,
commonjs: true,
es6: true,
node: true
},
extends: 'airbnb-base',
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true
}
jest: true,
},
rules: {
'no-console': 0,
'class-methods-use-this': 0,
'import/prefer-default-export': 0,
'import/no-named-as-default': 0,
'import/no-extraneous-dependencies': 0,
'func-names': 0,
'prefer-arrow-callback': 0,
'consistent-return': 0,
"object-curly-newline": [
"error",
{
"minProperties": 3,
"multiline": true,
}
],
"spaced-comment": 0,
"comma-dangle": 0,
"semi": 2,
"no-prototype-builtins": 0,
"object-curly-newline": 0,
"no-restricted-syntax": 0,
"max-len": 0,
"no-plusplus": 0,
"no-undef": 0,
"arrow-body-style": 0,
"no-use-before-define": 0,
"radix": 0
}
};
'import/no-extraneous-dependencies': ['error', { 'devDependencies': true }],
},
};
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ typings/
docs

# Misc
.DS_Store
.DS_Store

dist
333 changes: 182 additions & 151 deletions README.md

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions debugging.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
const http = require('http')
const url = require('url')
const fs = require('fs')
const path = require('path')
const port = process.argv[2] || 9000
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');

http.createServer(function (req, res) {
console.log(`${req.method} ${req.url}`);
const port = process.argv[2] || 9000;

http.createServer((req, res) => {
console.log(`${req.method} ${req.url}`); // eslint-disable-line no-console

const parsedUrl = url.parse(req.url);
let pathname = `.${parsedUrl.pathname}`;
const ext = path.parse(pathname).ext;
const { ext } = path.parse(pathname);
const map = {
'.ico': 'image/x-icon',
'.html': 'text/html',
Expand All @@ -22,14 +23,14 @@ http.createServer(function (req, res) {
'.mp3': 'audio/mpeg',
'.svg': 'image/svg+xml',
'.pdf': 'application/pdf',
'.doc': 'application/msword'
'.doc': 'application/msword',
};

fs.exists(pathname, (exist) => {
if(!exist) {
if (!exist) {
res.statusCode = 404;
res.end(`File ${pathname} not found!`);
return
return;
}

if (fs.statSync(pathname).isDirectory()) pathname += `/index${ext}`;
Expand All @@ -42,9 +43,8 @@ http.createServer(function (req, res) {
res.setHeader('Content-type', map[ext] || 'text/plain');
res.end(data);
}
})
})
}).listen(parseInt(port));

console.log(`Server listening on port ${port}`);
});
});
}).listen(parseInt(port, 10));

console.log(`Server listening on port ${port}`); // eslint-disable-line no-console
1 change: 0 additions & 1 deletion dist/arcads.js

This file was deleted.

5 changes: 3 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
transform: { '^.+\\.js$': '<rootDir>/jestPreprocess.js' }
}
transform: { '^.+\\.js$': '<rootDir>/jestPreprocess.js' },
testURL: 'http://localhost/',
};
5 changes: 2 additions & 3 deletions jestPreprocess.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const babelOptions = {
presets: ['env', 'stage-2'],
plugins: ['transform-decorators-legacy', 'babel-plugin-root-import'],
presets: ['@babel/preset-env'],
};

module.exports = require('babel-jest').createTransformer(babelOptions)
module.exports = require('babel-jest').createTransformer(babelOptions);
Loading