Skip to content

Commit

Permalink
add nodejs project
Browse files Browse the repository at this point in the history
  • Loading branch information
lsqy committed Jan 15, 2019
1 parent 5b2d761 commit 9e3a451
Show file tree
Hide file tree
Showing 381 changed files with 81,202 additions and 0 deletions.
3 changes: 3 additions & 0 deletions FrondEndFramework/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## FrondEndFramework

> 主要记录优秀的前端框架和类库
3 changes: 3 additions & 0 deletions FrondEndNewDirection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## FrondEndNewDirection

> 此目录主要会收录一些前端新的发展方向的一些相关项目
59 changes: 59 additions & 0 deletions FullStackProject/fiora/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"presets": [
"stage-0",
[
"env",
{
"targets": "> 0.5%, last 3 versions, Firefox ESR, not dead",
"useBuiltIns": "entry",
"modules": false
}
],
"react"
],
"plugins": [
"react-hot-loader/babel",
"transform-decorators-legacy",
"transform-class-properties",
[
"react-transform",
{
"transforms": [
{
"transform": "react-transform-style"
}
]
}
],
[
"prismjs", {
"languages": ["clike", "javascript", "typescript", "java", "c", "cpp", "python", "ruby", "markup", "markup-templating", "php", "go", "csharp", "css", "markdown", "sql", "json" ],
"plugins": ["line-numbers"],
"theme": "default",
"css": true
}
]
],
"comments": false,
"env": {
"test": {
"plugins": [
"istanbul"
]
},
"development": {
"plugins": [
[
"react-transform",
{
"transforms": [
{
"transform": "react-transform-log-render"
}
]
}
]
]
}
}
}
9 changes: 9 additions & 0 deletions FullStackProject/fiora/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions FullStackProject/fiora/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
static/
72 changes: 72 additions & 0 deletions FullStackProject/fiora/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"extends": [
"airbnb"
],
"env": {
"browser": true,
"node": true
},
"plugins": [
"react",
"jsx-a11y",
"import"
],
"parser": "babel-eslint",
"globals": {
"importScripts": true,
"workbox": true
},
"rules": {
"indent": [2, 4],
"global-require": 0,
"new-cap": 0,
"func-names": 0,
"consistent-return": 0,
"max-len": 0,
"require-yield": 0,
"guard-for-in": 0,
"object-curly-newline": 0,

"import/no-extraneous-dependencies": 0,
"import/no-unresolved": 0,
"import/no-commonjs": 0,
"import/no-nodejs-modules": 0,
"import/no-mutable-exports": 0,
"import/extensions": [
2,
{
"js": "never",
"jsx": "never"
}
],
"import/no-dynamic-require": 0,

"no-console": 0,
"no-plusplus": 0,
"no-param-reassign": 0,
"no-restricted-syntax": [2, "WithStatement"],
"no-invalid-this": 0,
"no-underscore-dangle": 0,
"no-return-assign": 0,
"no-await-in-loop": 0,
"no-mixed-operators": 0,
"no-use-before-define": 0,

"react/jsx-indent": [2, 4],
"react/jsx-indent-props": [2, 4],
"react/jsx-filename-extension": 0,
"react/prefer-stateless-function": 0,
"react/require-default-props": 0,
"react/no-danger": 0,
"react/no-array-index-key": 0,
"react/no-multi-comp": 0,
"react/forbid-prop-types": 0,
"react/jsx-no-bind": 0,
"react/no-did-update-set-state": 0,
"jsx-a11y/img-has-alt": 0,
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/no-noninteractive-element-interactions": 0,
"jsx-a11y/alt-text": 0,
"jsx-a11y/click-events-have-key-events": 0
}
}
11 changes: 11 additions & 0 deletions FullStackProject/fiora/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.DS_Store
node_modules/
dist/
public/

npm-debug.log
yarn-error.log
.eslintcache
runServer.sh
build.sh
.qiniurc
11 changes: 11 additions & 0 deletions FullStackProject/fiora/.nodemonrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"verbose": true,
"ignore": [
"client/**/*",
"build/**/*",
"test/**/*",
"public/**/*",
"dist/**/*",
"test.js"
]
}
10 changes: 10 additions & 0 deletions FullStackProject/fiora/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: node_js
node_js:
- '8'
cache:
- yarn
before_script:
- npm install -g yarn
- yarn install
script:
- yarn run lint
21 changes: 21 additions & 0 deletions FullStackProject/fiora/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 碎碎酱

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.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
62 changes: 62 additions & 0 deletions FullStackProject/fiora/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Fiora

[![Build Status](https://travis-ci.org/yinxin630/fiora.svg?branch=master)](https://travis-ci.org/yinxin630/fiora)
[![author](https://img.shields.io/badge/author-%E7%A2%8E%E7%A2%8E%E9%85%B1-blue.svg)](http://suisuijiang.com)
[![Node.js Version](https://img.shields.io/badge/node.js-8.9.0-blue.svg)](http://nodejs.org/download)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/yinxin630/fiora/blob/master/LICENSE)

Language: [English](README.md) | [简体中文](./doc/README.ZH.md)

Fiora is a web chat application. It is written by node.js, mongodb, socket.io and react

Online address: [https://fiora.suisuijiang.com/](https://fiora.suisuijiang.com/)
Android / iOS app: [https://github.com/yinxin630/fiora-app](https://github.com/yinxin630/fiora-app)

## Functions

1. Friends, groups, private chat, group chat
2. Text, pictures, code, URL and many other types of messages
3. Tieba expression, huaji expression, search expression image
4. Desktop notification, sound reminder, voice broadcast
5. Custom desktop background, theme color, and text color
6. Display online users, @ function
7. Little black room shut up
8. Service Worker

## Screenshot

![](./doc/screenshots/runtime.png)

## Install

[See how to run Fiora](./doc/INSTALL.md)

## Directory

|-- [build] // Webpack build
|-- [client] // Client code
|-- [config] // Config
|-- [dist] // Packaging output directory
|-- [doc] // Document
|-- [public] // Static resources
|-- [server] // Server code
|-- [utils] // Util method
|-- .babelrc // Babel config
|-- .eslintignore // Eslint ignore config
|-- .eslintrc // Eslint rule config
|-- .gitignore // Git ignore config
|-- .nodemonrc // Nodemon config
|-- package-lock.json // npm
|-- package.json // npm
|-- yarn.lock // yarn
...

## Contribution

If you want to add functionality or fix bugs, please follow the process below:

0. Fork this repository and clone the fork post to the local
0. Installation dependencies `yarn or npm install`
0. Modify the code and confirm it is bug free
0. Submit code, if eslint has reported error, please repair it and submit it again.
0. Create a pull request
32 changes: 32 additions & 0 deletions FullStackProject/fiora/build/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require('./check-versions')();

process.env.NODE_ENV = 'production';

const ora = require('ora');
const rm = require('rimraf');
const path = require('path');
const chalk = require('chalk');
const webpack = require('webpack');
const config = require('../config/webpack');
const webpackConfig = require('./webpack.prod.conf');

const spinner = ora('building for production...');
spinner.start();

rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), (err) => {
if (err) throw err;
webpack(webpackConfig, (wErr, stats) => {
spinner.stop();
if (wErr) throw wErr;
process.stdout.write(`${stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false,
})}\n\n`);

console.log(chalk.cyan(' Build complete.\n'));
console.log(chalk.yellow(' Tip: built files are meant to be served over an HTTP server.\n Opening index.html over file:// won\'t work.\n'));
});
});
42 changes: 42 additions & 0 deletions FullStackProject/fiora/build/check-versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const chalk = require('chalk');
const semver = require('semver');
const packageConfig = require('../package.json');

function exec(cmd) {
return require('child_process').execSync(cmd).toString().trim();
}

const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node,
},
{
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm,
},
];

module.exports = () => {
const warnings = [];
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i];
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(`${mod.name}: ${chalk.red(mod.currentVersion)} should be ${chalk.green(mod.versionRequirement)}`);
}
}

if (warnings.length) {
console.log('');
console.log(chalk.yellow('To use this template, you must update following to modules:'));
console.log();
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i];
console.log(` ${warning}`);
}
console.log();
process.exit(1);
}
};
8 changes: 8 additions & 0 deletions FullStackProject/fiora/build/dev-client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require('eventsource-polyfill');
const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true');

hotClient.subscribe((event) => {
if (event.action === 'reload') {
window.location.reload();
}
});
Loading

0 comments on commit 9e3a451

Please sign in to comment.