Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
HEAD
  • Loading branch information
trs committed Mar 6, 2017
1 parent d188aee commit f58b581
Show file tree
Hide file tree
Showing 75 changed files with 2,692 additions and 131 deletions.
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@ bower_components/*
# Config folder (optional - you might want to lint this...)
config/*


# Sample project
src/demo/*
# END_CONFIT_GENERATED_CONTENT
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules/

dist/
reports/
.env
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: node_js
node_js:
- "6"

install: npm install

script:
- npm run verify:js
- npm run test:coverage

after_success:
- if [ $TRAVIS_BRANCH = 'master' ]; then npm run semantic-release; fi
7 changes: 2 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--[CN_HEADING]-->
# Contributing

Welcome! This document explains how you can contribute to making **ftp-js** even better.
Welcome! This document explains how you can contribute to making **ftp-svr** even better.


<!--[]-->
Expand All @@ -26,7 +26,7 @@ npm install

Code is organised into modules which contain one-or-more components. This a great way to ensure maintainable code by encapsulation of behavior logic. A component is basically a self contained app usually in a single file or a folder with each concern as a file: style, template, specs, e2e, and component class. Here's how it looks:
```
ftp-js/
ftp-svr/
├──config/ * configuration files live here (e.g. eslint, verify, testUnit)
├──src/ * source code files should be here
Expand Down Expand Up @@ -136,9 +136,6 @@ Command | Description
Command | Description
:------ | :----------
<pre>npm run verify</pre> | Verify code style and syntax<ul><li>Verifies source *and test code* aginst customisable rules (unlike Webpack loaders)</li></ul>
<pre>npm run verify:js</pre> | Verify Javascript code style and syntax
<pre>npm run verify:js:fix</pre> | Verify Javascript code style and syntax and fix any errors that can be fixed automatically
<pre>npm run verify:js:watch</pre> | Verify Javascript code style and syntax and watch files for changes
<pre>npm run verify:watch</pre> | Runs verify task whenever JS or CSS code is changed


Expand Down
4 changes: 1 addition & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
ftp-js Copyright (c) 2017 Tyler Stewart
ftp-svr Copyright (c) 2017 Tyler Stewart

MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Expand Down
63 changes: 12 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,34 @@
<!--[RM_HEADING]-->
# ftp-js
# ftp-svr [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)


<!--[]-->
<!--[RM_DESCRIPTION]-->
> A description of my awesome package
> Modern, extensible FTP Server
<!--[]-->

<!--[RM_BADGES]-->
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

- [Features](#features)
- [Install](#install)
- [Usage](#usage)
- [Contributing](#contributing)
- [Licence](#licence)

<!--[]-->
## Features

<!--[RM_INSTALL]-->
## Install

npm install ftp-js

`npm install ftp-svr --save`

<!--[]-->
`yarn add ftp-svr`

## Usage


<!--[RM_CONTRIBUTING]-->
## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).


<!--[]-->

<!--[RM_NEXT_STEPS]-->
## *Next Steps to Setup your Project*

Remove this section once you are comfortable updating your project.

- [ ] Update [package.json](package.json) with a nice description, then run `yo confit --skip-install --skip-run` and see the README.md file is updated
- [ ] Add a new **dependency** to your project:
- For a **source-code** dependency:
1. `npm i {nodeModule} --save`
- For a **development** dependency:
1. `npm i {nodeModule} --save-dev`
- For a **test** dependency:
1. `npm i {nodeModule} --save`
- [ ] Complete the installation of the **semantic release** tool:
1. Make sure you have:
- a GitHub login
- an NPM login
- a TravisCI login (though you can still proceed if you use a different CI tool)
1. Run `semantic-release-cli setup` to complete the installation
- [ ] Install code coverage:
1. Make sure you have:
- a TravisCI login (though you can still proceed if you use a different CI tool)
- a [Coveralls](https://coveralls.io) account
1. Push your code to GitHub.
1. Login to [Coveralls](https://coveralls.io/).
1. Press Add Repo. You may need to Sync your GitHub repos to see your new repo in the list.
1. Select the repo and you will see a "Set Up Coveralls" page. Note the `repo_token` value.
1. Login to [Travis CI](https://travis-ci.org/).
1. Edit the settings for this repo (More Settings > Settings).
1. In the Environment Variables section, create a new envrionment variable called `COVERALLS_REPO_TOKEN` and set its value to the *repo_token* value shown on the "Set Up Coveralls" page, and press "Add".
1. Push another commit to GitHub and you should get a coverage report now!
- [ ] Run `npm test` to execute the tests and see the test coverage
- [ ] Run `git cz` to commit changes with a conventional commit message


<!--[]-->

<!--[RM_LICENSE]-->
Expand All @@ -75,4 +37,3 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
This software is licensed under the MIT Licence. See [LICENSE](LICENSE).

<!--[]-->

14 changes: 7 additions & 7 deletions config/testUnit/thresholds.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"global": {
"statements": 80,
"branches": 80,
"functions": 60,
"statements": 70,
"branches": 60,
"functions": 80,
"lines": 80
},
"each": {
"statements": 40,
"branches": 50,
"functions": 20,
"lines": 40
"statements": 0,
"branches": 0,
"functions": 0,
"lines": 0
}
}
19 changes: 13 additions & 6 deletions config/verify/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# START_CONFIT_GENERATED_CONTENT
confit:
extends: &confit-extends
- google
extends: &confit-extends
- plugin:node/recommended
plugins: &confit-plugins

plugins: &confit-plugins
- node

env: &confit-env
commonjs: true # For Webpack, CommonJS
node: true
mocha: true
es6: true

globals: &confit-globals {}
parser: &confit-parser espree

Expand Down Expand Up @@ -51,3 +50,11 @@ rules:
max-len:
- warn
- 200 # Line Length
node/no-unpublished-require:
- 2
- allowModules:
- chai
- dotenv
- ftp
- sinon
- sinon-as-promised
8 changes: 4 additions & 4 deletions confit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ generator-confit:
copyrightOwner: Tyler Stewart
license: MIT
projectType: node
publicRepository: false
publicRepository: true
repositoryType: GitHub
paths:
_version: 7f33e41600b34cd6867478d8f2b3d6b2bbd42508
Expand All @@ -27,13 +27,13 @@ generator-confit:
_version: de20402bf85c703080ef6daf21e35325a3b9d604
entryPoints:
main:
- src/demo/index.js
- src/index.js
testUnit:
_version: 4472a6d59b434226f463992d3c1914c77a6a115d
testDependencies: []
verify:
_version: 30ae86c5022840a01fc08833e238a82c683fa1c7
jsCodingStandard: Google
jsCodingStandard: eslint
documentation:
_version: b1658da3278b16d1982212f5e8bc05348af20e0b
generateDocs: false
Expand All @@ -44,5 +44,5 @@ generator-confit:
useSemantic: true
sampleApp:
_version: 00c0a2c6fc0ed17fcccce2d548d35896121e58ba
createSampleApp: true
createSampleApp: false
zzfinish: {}
29 changes: 22 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{
"name": "ftp-js",
"name": "ftp-svr",
"version": "0.0.0",
"description": "A description of my awesome package",
"description": "Modern, extensible FTP Server",
"keywords": [
"ftp",
"ftp-server",
"ftp-svr",
"ftpd",
"server"
],
"license": "MIT",
"main": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/stewarttylerr/ftp.js"
"url": "https://github.com/stewarttylerr/ftp-svr"
},
"scripts": {
"pre-release": "npm-run-all verify test:coverage build ",
Expand All @@ -15,6 +22,7 @@
"commitmsg": "cz-customizable-ghooks",
"dev": "cross-env NODE_ENV=development npm run verify:watch",
"prepush": "npm-run-all verify test:coverage --silent",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"start": "npm run dev",
"test": "npm run test:unit",
"test:check-coverage": "cross-env NODE_ENV=test istanbul check-coverage reports/coverage/coverage.json --config config/testUnit/istanbul.js",
Expand All @@ -38,28 +46,35 @@
},
"dependencies": {
"bunyan": "^1.8.5",
"date-fns": "^1.28.0",
"lodash": "^4.17.4",
"minimist-string": "^1.0.2",
"uuid": "^3.0.1",
"when": "^3.7.8"
},
"devDependencies": {
"chai": "^3.5.0",
"chokidar-cli": "1.2.0",
"coveralls": "2.11.15",
"cross-env": "3.1.4",
"cz-customizable": "4.0.0",
"cz-customizable-ghooks": "1.5.0",
"dotenv": "^4.0.0",
"eslint": "3.14.1",
"eslint-config-google": "0.7.1",
"eslint-plugin-node": "3.0.5",
"ftp": "^0.3.10",
"husky": "0.13.1",
"istanbul": "0.4.5",
"mocha": "3.2.0",
"npm-run-all": "4.0.1",
"rimraf": "2.5.4"
"rimraf": "2.5.4",
"semantic-release": "^6.3.2",
"sinon": "^1.17.7",
"sinon-as-promised": "^4.0.2"
},
"engines": {
"node": ">=4.x",
"node": ">=6.x",
"npm": ">=3.9.5"
},
"private": true
}
}
3 changes: 3 additions & 0 deletions src/commands/allo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function () {
return this.reply(202);
}
19 changes: 19 additions & 0 deletions src/commands/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const _ = require('lodash');

module.exports = function ({command} = {}) {
const method = _.upperCase(command._[1]);

switch (method) {
case 'TLS': return handleTLS.call(this);
case 'SSL': return handleSSL.call(this);
default: return this.reply(504);
}
}

function handleTLS() {
return this.reply(504);
}

function handleSSL() {
return this.reply(504);
}
6 changes: 6 additions & 0 deletions src/commands/cdup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const cwd = require('./cwd');

module.exports = function(args) {
args.command._ = [args.command._[0], '..'];
return cwd.call(this, args);
}
17 changes: 17 additions & 0 deletions src/commands/cwd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const when = require('when');
const escapePath = require('../helpers/escape-path');

module.exports = function ({log, command} = {}) {
if (!this.fs) return this.reply(550, 'File system not instantiated');
if (!this.fs.chdir) return this.reply(402, 'Not supported by file system');

return when(this.fs.chdir(command._[1]))
.then(cwd => {
const path = cwd ? `"${escapePath(cwd)}"` : undefined;
return this.reply(250, path);
})
.catch(err => {
log.error(err);
return this.reply(550, err.message);
});
}
15 changes: 15 additions & 0 deletions src/commands/dele.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const when = require('when');

module.exports = function ({log, command} = {}) {
if (!this.fs) return this.reply(550, 'File system not instantiated');
if (!this.fs.delete) return this.reply(402, 'Not supported by file system');

return when(this.fs.delete(command._[1]))
.then(() => {
return this.reply(250);
})
.catch(err => {
log.error(err);
return this.reply(550);
});
}
10 changes: 10 additions & 0 deletions src/commands/feat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const _ = require('lodash');

module.exports = function () {
const registry = require('./registry');
const features = Object.keys(registry)
.filter(cmd => registry[cmd].hasOwnProperty('feat'))
.reduce((feats, cmd) => _.concat(feats, registry[cmd].feat), [])
.map(feat => ` ${feat}`);
return this.reply(211, 'Extensions supported', ...features, 'END');
}
Loading

0 comments on commit f58b581

Please sign in to comment.