Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
Edit Babel, update Meteor and npm packages. Standard code styling!
Browse files Browse the repository at this point in the history
Kill Koa and remove test frameworks because they are bloat.
  • Loading branch information
retrixe committed Sep 3, 2017
1 parent 6c2181e commit 26e0ed1
Show file tree
Hide file tree
Showing 16 changed files with 665 additions and 3,246 deletions.
5 changes: 2 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
"Safari >= 9",
"iOS >= 9",
"Edge >= 14"
],
"node": 8
]
},
"modules": false
}], "stage-2"]
}], "stage-0"]
}
59 changes: 11 additions & 48 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,16 @@
module.exports = {
"env": {
"es6": true,
"meteor": true
env: {
es6: true,
meteor: true
},
"extends": ["plugin:meteor/recommended", "plugin:flowtype/recommended", "eslint-config-airbnb"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react",
"meteor",
"flowtype"
parser: "babel-eslint",
plugins: ["react", "meteor", "flowtype"],
extends: [
"plugin:meteor/recommended",
"plugin:flowtype/recommended",
"standard", "standard-react"
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"windows"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"no-unused-vars": [
"error",
{
"vars": "local",
"args": "after-used"
}],
// For global variable definitions.
"no-var": "off",
// For JSX in .js files.
"react/jsx-filename-extension": "off",
// For import issues with Meteor.
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"import/extensions": "off",
rules: {
"meteor/audit-argument-checks": "off"
}
};
}
3 changes: 2 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# Following packages to be ignored due to type errors. Wait for material-ui to hit stable.
.*/node_modules/eslint-plugin-jsx-a11y/.*
.*/node_modules/material-ui/.*flow
.*/node_modules/jss/lib/plugins/.*flow
.*/node_modules/jss/.*flow
.*/node_modules/stylelint/lib/.*
.*/node_modules/react-scrollbar-size/node_modules/.*

[include]

Expand Down
14 changes: 7 additions & 7 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

[email protected].19 # Packages every Meteor app needs to have
[email protected].24 # Packages every Meteor app needs to have
[email protected] # Packages for a great mobile UX
[email protected].19 # The database Meteor supports right now
[email protected].24 # The database Meteor supports right now
static-html
[email protected] # Reactive variable for tracker
[email protected] # Meteor's client-side reactive programming library

[email protected] # CSS minifier run for production mode
[email protected].19 # JS minifier run for production mode
[email protected].24 # JS minifier run for production mode
[email protected] # ECMAScript 5 compatibility for older browsers.
[email protected].19 # Enable ECMAScript2015+ syntax in app code
[email protected].19 # Server-side component of the `meteor shell` command
[email protected].19 # Runtime support for Meteor 1.5 dynamic import(...) syntax
[email protected].19 # Leaner CSS language
[email protected].24 # Enable ECMAScript2015+ syntax in app code
[email protected].24 # Server-side component of the `meteor shell` command
[email protected].24 # Runtime support for Meteor 1.5 dynamic import(...) syntax
[email protected].24 # Leaner CSS language
2 changes: 1 addition & 1 deletion .meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[email protected].19
[email protected].24
56 changes: 28 additions & 28 deletions .meteor/versions
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
[email protected].19
[email protected].24
[email protected]
[email protected].19
[email protected].19
[email protected].24
[email protected].24
[email protected]
[email protected]
[email protected]
[email protected].19
[email protected].24
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].19
[email protected].19
[email protected].19
[email protected].19
[email protected].24
[email protected].24
[email protected].24
[email protected].24
[email protected]
[email protected]
[email protected].19
[email protected].19
[email protected].19
[email protected].19
[email protected].19
[email protected].19
[email protected].24
[email protected].24
[email protected].24
[email protected].24
[email protected].24
[email protected].24
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].19
[email protected].24
[email protected]
[email protected]
[email protected].19
[email protected].24
[email protected]
[email protected]
[email protected].19
[email protected].19
[email protected].24
[email protected].24
[email protected]
[email protected].19
[email protected].19
[email protected].24
[email protected].24
[email protected]
[email protected]
[email protected].19
[email protected].19
[email protected].19
[email protected].19
[email protected].24
[email protected].24
[email protected].24
[email protected].24
[email protected]
[email protected]
[email protected]
[email protected].19
[email protected].24
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].19
[email protected].24
[email protected]
[email protected]
[email protected].19
[email protected].24
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].19
[email protected].24
[email protected]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#### Is the code in master working? Safe to compile? [![CircleCI](https://img.shields.io/circleci/project/github/retrixe/Area51.svg?style=flat-square)](https://circleci.com/gh/retrixe/Area51)

#### Is the code acclimatized? [![Code Climate](https://img.shields.io/codeclimate/github/retrixe/Area51.svg?style=flat-square)](https://codeclimate.com/github/retrixe/Area51) [![Code Climate](https://img.shields.io/codeclimate/issues/github/retrixe/Area51.svg?style=flat-square)](https://codeclimate.com/github/retrixe/Area51/issues) [![Codecov](https://img.shields.io/codecov/c/github/retrixe/Area51.svg?style=flat-square)](https://codecov.io/gh/retrixe/Area51)
#### Is the code acclimatized? [![Code Climate](https://img.shields.io/codeclimate/github/retrixe/Area51.svg?style=flat-square)](https://codeclimate.com/github/retrixe/Area51) [![Code Climate](https://img.shields.io/codeclimate/issues/github/retrixe/Area51.svg?style=flat-square)](https://codeclimate.com/github/retrixe/Area51/issues)

Project Area51, a tiny project to enable access to stored files. Basically, specify a folder to it on your local filesystem, and you'll be able to access it from anywhere, being able to download your files and entering folders. I developed this to bypass my school's website blocking stuff and get quick access to my files and stuff (like fetching random scripts which wreck the system lol). Yes, there is no authentication or uploading files support right now, but I'll add it later :P

Expand Down
5 changes: 0 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,3 @@ jobs:
mkdir -p $CIRCLE_TEST_REPORTS/reports
npx eslint . --fix --format junit --output-file $CIRCLE_TEST_REPORTS/reports/eslint.xml
npx stylelint **/*.less
- run:
name: Test code and produce coverage
command: |
yarn test
yarn run report-coverage
14 changes: 0 additions & 14 deletions client/.babelrc

This file was deleted.

80 changes: 39 additions & 41 deletions client/components/Folder.js
Original file line number Diff line number Diff line change
@@ -1,89 +1,87 @@
// @flow
/* eslint-env browser */
// Import React.
import React from "react";
import React from 'react'

// Importing material-ui components.
import List from "material-ui/List/List";
import List from 'material-ui/List/List'

// Import Meteor :3 and Minimongo :333 and createContainer :33333
import { Meteor } from "meteor/meteor";
import { Meteor } from 'meteor/meteor'

// Importing the ListCreator.
import ListCreator from "../../imports/ui/ListCreator";
import ListCreator from '../../imports/ui/ListCreator'

// Fetching the config from settings.js to get where to initiate the file manager.
import { folderToShow } from "../../settings.json";
import { folderToShow } from '../../settings.json'

// State types.
type listItemsState = { name: string, type: string };
type state = { listItems: Array<listItemsState>, currentFolder: string };

// Create the class.
export default class Folder extends React.Component<void, {}, state> {
constructor() {
super();
export default class Folder extends React.Component<{}, state> {
constructor () {
super()

this.state = {
listItems: [
{
name: "Please wait, data is being fetched from the server.",
type: "dataFetch",
},
name: 'Please wait, data is being fetched from the server.',
type: 'dataFetch'
}
],
currentFolder: folderToShow,
};
}

state: {
listItems: Array<{ name: string, type: string }>,
currentFolder: string
currentFolder: folderToShow
}
}

componentDidMount() {
componentDidMount () {
// Fetch directory contents in async mode.
Meteor.call("getFolderContents", folderToShow, (err: string, result: Array<listItemsState>) => {
Meteor.call('getFolderContents', folderToShow, (err: string, result: Array<listItemsState>) => {
if (err) console.error('Error while retrieving initial data.')
// set state to the go back item and the items in the directory.
this.setState({ listItems: [{
name: "Go to parent directory",
type: "..",
}, ...result] });
});
name: 'Go to parent directory',
type: '..'
}, ...result] })
})
}

onItemClick(type: string, addition: string) {
onItemClick (type: string, addition: string) {
// Callback function to update folder contents.
const handleNewPath = (err: string, result: string) => {
if (err) console.error('Error during changing folder.')
// In callback, set currentFolder to the joint result.
this.setState({ currentFolder: result });
this.setState({ currentFolder: result })
// Now get the folder contents for the result.
Meteor.call("getFolderContents", this.state.currentFolder, (error: string, files: Array<listItemsState>) => {
// set state to the go back item and the items in the directory.
Meteor.call('getFolderContents', this.state.currentFolder, (error: string, files: Array<listItemsState>) => {
if (error) console.error('Error while retrieving folder contents.')
// set state to the go back item and the items in the directory.
this.setState({ listItems: [{
name: "Go to parent directory",
type: "..",
}, ...files] });
});
};
name: 'Go to parent directory',
type: '..'
}, ...files] })
})
}

if (type === "folder") {
if (type === 'folder') {
// Ask server to join paths.
Meteor.call("joinPaths", this.state.currentFolder, addition, handleNewPath);
} else if (type === "file") {
Meteor.call('joinPaths', this.state.currentFolder, addition, handleNewPath)
} else if (type === 'file') {
// eslint-disable-next-line no-console
console.log("hellooooo! wheeeee! cookies! I'm a fileeee!");
console.log("hellooooo! wheeeee! cookies! I'm a fileeee!")
} else {
// Ask server to remove the last directory to go up one directory.
Meteor.call("goUpOneDirectory", this.state.currentFolder, handleNewPath);
Meteor.call('goUpOneDirectory', this.state.currentFolder, handleNewPath)
}
}

render() {
const reactifunc = (t: string, a: string) => this.onItemClick(t, a);
render () {
const reactifunc = (t: string, a: string) => this.onItemClick(t, a)
return (
<List>
<ListCreator list={this.state.listItems} onItemClick={reactifunc} />
</List>
);
)
}
}
Loading

0 comments on commit 26e0ed1

Please sign in to comment.