Skip to content

Commit

Permalink
#123 Добавлена поддержка TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
gbagretsov committed May 2, 2022
1 parent b65fd32 commit 2800205
Show file tree
Hide file tree
Showing 70 changed files with 1,334 additions and 122 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

30 changes: 0 additions & 30 deletions .eslintrc.js

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ npm-debug.log
*.dev
.DS_Store

public/dist
compiled/public/dist
compiled/app
compiled/front
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: node index.js
web: node compiled/app/index.js
release: npm run migrate up
33 changes: 33 additions & 0 deletions app/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"env": {
"es2021": true,
"node": true
},
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"windows"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-console": "off"
},
"plugins": ["@typescript-eslint"]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions app/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import express from 'express';
import bodyParser from 'body-parser';
import path from 'path';

import receiver from './receiver';
import {router as apiRouter} from './api/api';

const app = express();
const PORT = process.env.PORT || 5000;

app.use(express.static(path.join(__dirname, '../public')));
app.use(bodyParser.json());

receiver(app);

app.use('/api', apiRouter);

app.listen(PORT, () => console.log(`Listening on ${ PORT }`));
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ES2021",
"module": "CommonJS",
"esModuleInterop": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"outDir": "../compiled/app",
"sourceMap": true,
"incremental": true,
"allowJs": true
},
"include": [
"src/**/*.ts",
"src/**/*.js"
]
}
File renamed without changes.
5 changes: 4 additions & 1 deletion friends-vk-bot.iml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/compiled/app" />
<excludeFolder url="file://$MODULE_DIR$/compiled/front" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
Expand Down
File renamed without changes.
36 changes: 36 additions & 0 deletions front/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"env": {
"es2021": true,
"browser": true
},
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"windows"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-console": "off"
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": [
"webpack.config.js"
]
}
39 changes: 0 additions & 39 deletions front/.eslintrc.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions front/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ES2021",
"module": "ES2022",
"esModuleInterop": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"outDir": "../compiled/front",
"sourceMap": true,
"incremental": true,
"allowJs": true
},
"include": [
"src/**/*.ts",
"src/**/*.js",
"src/**/*.jsx"
]
}
6 changes: 3 additions & 3 deletions webpack.config.js → front/webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
entry: './front/index.js',
entry: './front/src/index.js',
mode: 'development',
module: {
rules: [
Expand All @@ -20,12 +20,12 @@ module.exports = {
},
resolve: { extensions: ['*', '.js', '.jsx'] },
output: {
path: path.resolve(__dirname, 'public/dist/'),
path: path.resolve(__dirname, '../compiled/public/dist/'),
filename: 'bundle.js'
},
plugins: [
new MiniCssExtractPlugin({
filename: 'style.css',
})
],
};
};
14 changes: 0 additions & 14 deletions index.js

This file was deleted.

Loading

0 comments on commit 2800205

Please sign in to comment.