Skip to content

Commit ac85cd7

Browse files
committed
Get myself out of config hell.
1 parent fd130bb commit ac85cd7

13 files changed

+277
-1
lines changed

Diff for: README.md

+33-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1-
# code_assessment
1+
# Meshify IOT Assessment
2+
3+
4+
Project Design Goals
5+
-------------------
6+
- User shows up on splash page that explains that they will see a summary of the hottest words in IOT
7+
- When the user hits the splash page, the serverless api gets a request such that the user gets an experience that feels instantaneous
8+
- When you decided to see the list of hot words, you can hover over each item in the list, and then you get taken to a specific route to show pertinent data for that list
9+
- The pertinent data shows a carousel of interesting automatable facts
10+
- buzz factor (likelihood that given the occurence of this word another hot word occurs in the tweet that had that word in it)
11+
- tweets that had that word
12+
- a let me google that for you link
13+
- definition of the word if its not a proper noun
14+
- synonyms if its not a proper noun
15+
- etymology if its not a proper noun
16+
- frequency of occurence in tweets
17+
- if it is a proper noun, provide a link to searching that word on twitter
18+
19+
20+
Project Tool Choices
21+
--------------------
22+
- Near Perfect Lighthouse scores (willing to ignore SEO)
23+
- Components Built with Test Driven Development with Jest (going to try out react-testing-library for the first time)
24+
- SSR and Routing with next.js
25+
- CSS-in-JS with Styled Components
26+
- Static typing with TypeScript
27+
- Any data vizualization will be done with Semiotic
28+
- Serverless backend with Zeit's `now` (going to try this out for the first time)
29+
30+
Design Inspiration
31+
------------------
32+
- Spotify's Year in Review
33+

Diff for: babel.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = api => {
2+
api.cache(true);
3+
return {
4+
presets: ["next/babel", "@zeit/next-typescript/babel"],
5+
plugins: [
6+
"@babel/proposal-class-properties",
7+
"@babel/proposal-object-rest-spread",
8+
[
9+
"transform-define",
10+
{
11+
"process.env.NODE_ENV": process.env.NODE_ENV
12+
}
13+
]
14+
]
15+
};
16+
};

Diff for: components/word_list.tsx

Whitespace-only changes.

Diff for: jest.tsconfig.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "esnext",
5+
"jsx": "react",
6+
"sourceMap": false,
7+
"experimentalDecorators": true,
8+
"noImplicitUseStrict": true,
9+
"removeComments": true,
10+
"moduleResolution": "node",
11+
"lib": ["es2017", "dom"],
12+
"typeRoots": ["node_modules/@types"]
13+
},
14+
"exclude": ["node_modules", "out", ".next"]
15+
}

Diff for: next.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const withTs = require("@zeit/next-typescript");
2+
const withBundleAnalyzer = require("@zeit/next-bundle-analyzer");
3+
const { ANALYZE } = process.env;
4+
5+
module.exports = withTs(
6+
withBundleAnalyzer({
7+
analyzeServer: ["server", "all"].includes(ANALYZE),
8+
analyzeBrowser: ["browser", "all"].includes(ANALYZE)
9+
})
10+
);

Diff for: package.json

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"name": "meshify",
3+
"version": "0.0.1",
4+
"description": "Code assesment for meshify",
5+
"main": "index.ts",
6+
"scripts": {
7+
"clean": "rimraf .next",
8+
"analyze": "cross-env ANALYZE=all npm run build",
9+
"dev": "npm run build:next && cross-env NODE_ENV=development nodemon server.ts -p $PORT",
10+
"debug": "npm run build:next && cross-env NODE_ENV=development nodemon --inspect server.ts -p $PORT",
11+
"build": "npm run clean && npm run build:next && npm run build:server",
12+
"build:next": "next build",
13+
"build:server": "cp ./server.ts .next/server.ts && cp ./routes.ts .next/routes.ts && cp -r static .next/static",
14+
"start": "cross-env NODE_ENV=production node server.ts -p $PORT",
15+
"tslint": "./node_modules/.bin/tslint -c tslint.json -p tsconfig.json",
16+
"precommit": "lint-staged"
17+
},
18+
"lint-staged": {
19+
"*.{js,jsx,ts,tsx}": [
20+
"prettier --write",
21+
"git add"
22+
]
23+
},
24+
"repository": {
25+
"type": "git",
26+
"url": "git+https://github.com/jdetle/code_assessment.git"
27+
},
28+
"author": "John Joseph Patrick Detlefs",
29+
"license": "MIT",
30+
"bugs": {
31+
"url": "https://github.com/jdetle/code_assessment/issues"
32+
},
33+
"homepage": "https://github.com/jdetle/code_assessment#readme",
34+
"devDependencies": {
35+
"@types/next": "^7.0.5",
36+
"@types/react": "^16.7.18",
37+
"@types/react-dom": "^16.0.11",
38+
"@zeit/next-bundle-analyzer": "^0.1.2",
39+
"@zeit/next-typescript": "^1.1.1",
40+
"cross-env": "^5.2.0",
41+
"express": "^4.16.4",
42+
"husky": "^1.2.1",
43+
"lint-staged": "^8.1.0",
44+
"next": "^7.0.2",
45+
"prettier": "^1.15.3",
46+
"rimraf": "^2.6.2",
47+
"tslint": "^5.12.0",
48+
"tslint-config-prettier": "^1.17.0",
49+
"tslint-plugin-prettier": "^2.0.1",
50+
"tslint-react": "^3.6.0",
51+
"typescript": "^3.2.2",
52+
"webpack-bundle-analyzer": "^3.0.3"
53+
},
54+
"dependencies": {
55+
"nextjs-dynamic-routes": "^2.2.1",
56+
"react": "^16.7.0-alpha2",
57+
"react-dom": "^16.7.0-alpha2",
58+
"isomorphic-fetch": "^2.2.1",
59+
"moment": "^2.22.2"
60+
},
61+
"jest": {
62+
"moduleFileExtensions": [
63+
"ts",
64+
"tsx",
65+
"js"
66+
],
67+
"transform": {
68+
"^.+\\.tsx?$": "ts-jest"
69+
},
70+
"testMatch": [
71+
"**/*.(test|spec).(ts|tsx)"
72+
],
73+
"globals": {
74+
"ts-jest": {
75+
"babelConfig": true,
76+
"tsConfig": "jest.tsconfig.json"
77+
}
78+
},
79+
"coveragePathIgnorePatterns": [
80+
"/node_modules/",
81+
"enzyme.js"
82+
],
83+
"setupTestFrameworkScriptFile": "<rootDir>/enzyme.js",
84+
"coverageReporters": [
85+
"json",
86+
"lcov",
87+
"text",
88+
"text-summary"
89+
],
90+
"moduleNameMapper": {
91+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/mocks.js",
92+
"\\.(css|less)$": "<rootDir>/__mocks__/mocks.js"
93+
}
94+
}
95+
}

Diff for: pages/index.ts

Whitespace-only changes.

Diff for: pages/word.ts

Whitespace-only changes.

Diff for: pages/words_list.ts

Whitespace-only changes.

Diff for: routes.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const Router = require("nextjs-dynamic-routes");
2+
3+
const router = new Router();
4+
5+
router.add({
6+
name: "index",
7+
pattern: "/"
8+
});
9+
router.add({
10+
name: "words",
11+
pattern: "/words_list"
12+
});
13+
router.add({
14+
name: "word",
15+
pattern: "/words_list/:word"
16+
});
17+
18+
module.exports = router;

Diff for: server.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const express = require("express");
2+
const next = require("next");
3+
const routes = require("./routes.ts");
4+
5+
const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
6+
const dev = process.env.NODE_ENV !== "production";
7+
const app = next({ dir: ".", dev });
8+
const handle = routes.getRequestHandler(app);
9+
10+
app.prepare().then(() => {
11+
const server = express();
12+
server.get("/status", (_, res) => {
13+
return res.json({
14+
status: "active"
15+
});
16+
});
17+
server.get("*", (req, res) => {
18+
return handle(req, res);
19+
});
20+
server.listen(port, err => {
21+
if (err) {
22+
throw err;
23+
}
24+
});
25+
});

Diff for: tsconfig.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"target": "esnext",
5+
"module": "esnext",
6+
"jsx": "preserve",
7+
"allowJs": true,
8+
"sourceMap": true,
9+
"removeComments": true,
10+
"strictNullChecks": true,
11+
"noUnusedLocals": true,
12+
"noUnusedParameters": true,
13+
"noImplicitReturns": true,
14+
"noFallthroughCasesInSwitch": true,
15+
"moduleResolution": "node",
16+
"allowSyntheticDefaultImports": true,
17+
"preserveSymlinks": false,
18+
"preserveConstEnums": false,
19+
"skipLibCheck": true,
20+
"outDir": "./dist",
21+
"baseUrl": ".",
22+
"typeRoots": [
23+
"./node_modules/@types",
24+
"./typings"
25+
],
26+
"lib": [
27+
"dom",
28+
"es2015",
29+
"es2016"
30+
]
31+
},
32+
"exclude": [
33+
"./dist"
34+
]
35+
}

Diff for: tslint.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"rulesDirectory": ["tslint-plugin-prettier"],
3+
"extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
4+
"rules": {
5+
"prettier": [
6+
true,
7+
{
8+
"printWidth": 120,
9+
"singleQuote": true,
10+
"trailingComma": "none",
11+
"semi": false
12+
}
13+
],
14+
"no-console": [false],
15+
"no-var-requires": [false],
16+
"interface-name": [false],
17+
"max-classes-per-file": [false],
18+
"object-literal-sort-keys": [false],
19+
"jsx-boolean-value": [false],
20+
"jsx-no-lambda": [false]
21+
},
22+
"jsRules": {
23+
"max-line-length": [true, 120],
24+
"quotemark": [true, "single", "jsx-double"],
25+
"trailing-comma": [true, "never"],
26+
"semicolon": [true, "never"],
27+
"no-console": [false],
28+
"object-literal-sort-keys": [false]
29+
}
30+
}

0 commit comments

Comments
 (0)