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

Commit

Permalink
Tree-shake, fix CircleCI, switch to Koa (disabled), update packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Jul 12, 2017
1 parent 87cca41 commit 2b6fc3b
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 200 deletions.
4 changes: 2 additions & 2 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ [email protected] # JS minifier run for production mode
[email protected] # ECMAScript 5 compatibility for older browsers.
[email protected] # Enable ECMAScript2015+ syntax in app code
[email protected] # Server-side component of the `meteor shell` command
dynamic-import
less
dynamic-import@0.1.0 # Runtime support for Meteor 1.5 dynamic import(...) syntax
less@2.7.9 # Leaner CSS language
36 changes: 18 additions & 18 deletions .meteor/versions
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
[email protected]
[email protected]
babel-compiler@6.19.3
babel-runtime@1.0.1
babel-compiler@6.20.0-beta.6
babel-runtime@1.1.0-beta.6
[email protected]
[email protected]
[email protected]
[email protected]
boilerplate-generator@1.1.1
boilerplate-generator@1.2.0-beta.6
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
ddp-common@1.2.8
ddp-common@1.3.0-beta.6
[email protected]
[email protected]
[email protected]
[email protected]
ecmascript@0.8.1
ecmascript-runtime@0.4.1
ecmascript-runtime-client@0.4.2
ecmascript-runtime-server@0.4.1
ecmascript@0.9.0-beta.6
ecmascript-runtime@0.5.0-beta.6
ecmascript-runtime-client@0.5.0-beta.6
ecmascript-runtime-server@0.5.0-beta.6
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
http@1.2.12
http@1.3.0-beta.6
[email protected]
[email protected]
[email protected]
[email protected].9
[email protected].10-beta.6
[email protected]
[email protected]
meteor@1.6.1
meteor@1.8.0-beta.6
[email protected]
[email protected]
minifier-js@2.1.0
minimongo@1.2.1
minifier-js@2.2.0-beta.6
minimongo@1.3.0-beta.6
[email protected]
[email protected]
modules@0.9.2
modules-runtime@0.8.0
modules@0.10.0-beta.6
modules-runtime@0.9.0-beta.6
[email protected]
[email protected]
[email protected]
Expand All @@ -56,16 +56,16 @@ [email protected]
[email protected]
[email protected]
[email protected]
shell-server@0.2.3
shell-server@0.3.0-beta.6
[email protected]
[email protected]
[email protected]
standard-minifier-js@2.1.0
standard-minifier-js@2.2.0-beta.6
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
webapp@1.3.16
webapp@1.4.0-beta.6
[email protected]
3 changes: 2 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jobs:
working_directory: ~/Area51
docker:
- image: node:latest
parallelism: 4
steps:
- checkout
- run:
Expand All @@ -23,7 +24,7 @@ jobs:
meteor --version --allow-superuser
mkdir -p $CIRCLE_TEST_REPORTS/reports
npx eslint . --fix --format junit --output-file $CIRCLE_TEST_REPORTS/reports/eslint.xml
npx stylelint \"**/*.less\"
npx stylelint **/*.less
- run:
name: Test code and produce coverage
command: |
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"scripts": {
"start": "meteor run",
"build": "next build",
"build": "meteor bundle",
"lint": "flow check && eslint . && stylelint \"**/*.less\" --fix",
"test": "nyc ava",
"report-coverage": "nyc report --reporter=lcov && codecov",
Expand All @@ -16,7 +16,7 @@
},
"dependencies": {
"babel-runtime": "^6.23.0",
"express": "^4.15.3",
"koa": "^2.3.0",
"material-ui": "1.0.0-alpha.21",
"material-ui-icons": "^1.0.0-alpha.19",
"meteor-node-stubs": "^0.2.11",
Expand All @@ -25,6 +25,7 @@
},
"devDependencies": {
"@types/enzyme": "^2.8.1",
"@types/koa": "^2.0.39",
"@types/material-ui": "^0.17.15",
"@types/meteor": "^1.4.2",
"@types/react": "^15.0.35",
Expand Down
38 changes: 21 additions & 17 deletions server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@
// Import Meteor :3 and Mongo :3
import { Meteor } from "meteor/meteor";

// Import fs and path to access the filesystem.
import fs from "fs";
import path from "path";
// Import fs and path to access the filesystem. And mime to get MIMETypes.
import { readdirSync, /* readFileSync, */ lstatSync } from "fs";
import { join, sep /* , parse */ } from "path";

// Import Express. (chill..)
import express from "express";
// Import Koa (chill, we need it for something Meteor can't handle, lol..)
// (At least not without doing a lot of work setting up CollectionFS.)
// import Koa from "koa";

// Create the Meteor methods.
Meteor.methods({
// This method enables the client to get the contents of any folder.
getFolderContents(folder: string): Array<{ name: string, type: string }> {
// Get folder contents and create initial variables the loop will write to.
const folderContents: Array<string> = fs.readdirSync(folder);
const folderContents: Array<string> = readdirSync(folder);
const folderContentsWithTypes = [];
let i;
// Define the function to get the type of a directory item.
const getType = () => {
if (fs.lstatSync(`${folder}/${folderContents[i]}`).isDirectory()) {
if (lstatSync(`${folder}/${folderContents[i]}`).isDirectory()) {
return "folder";
}
return "file";
Expand All @@ -36,29 +37,32 @@ Meteor.methods({

// Pass it some paths and get a combination of those paths.
joinPaths(...paths): string {
return path.join(...paths);
return join(...paths);
},

goUpOneDirectory(pathy: string): string {
const pathyArray: Array<string> = pathy.split(path.sep);
const pathyArray: Array<string> = pathy.split(sep);
if (pathyArray[0] === "") {
pathyArray[0] = "/";
}
const newArray = [];
for (let x = 0; x < pathyArray.length - 1; x += 1) {
newArray.push(pathyArray[x]);
}
return path.join(...newArray);
return join(...newArray);
},
});

// Create our Express app.
const app = express();
// Create our Koa app.
// const app = new Koa();

// Listen on / for any requests for files.
app.get("/", (req, res) => {
res.download(req.query.path);
});
/* app.use((ctx) => {
const response = ctx.response;
const request = ctx.request;
response.attachment(parse(request.query.path).base);
response.body = readFileSync(request.query.path);
}); */

// Listen on 81 (yeh. YEH).
app.listen(81);
// Listen on port 81 (yeh. YEH.)
// app.listen(81);
Loading

0 comments on commit 2b6fc3b

Please sign in to comment.