Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up the project structure #2

Merged
merged 12 commits into from
Mar 20, 2022
Merged
Prev Previous commit
Next Next commit
setup the code sharing between applications
  • Loading branch information
tericcabrel committed Mar 18, 2022
commit bf60af4cf1f502c208504ad15fdb802509af1aef
7 changes: 4 additions & 3 deletions apps/core/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "core",
"name": "@sharingan/core",
"version": "1.0.0",
"description": "Sharingan core backend",
"main": "index.js",
"main": "dist/index.js",
"license": "MIT",
"scripts": {
"build": "tsc",
"dev": "nodemon --watch \"*.ts\" --exec \"ts-node\" ./src/index.ts"
},
"dependencies": {
"dotenv": "^16.0.0",
"express": "^4.17.3"
"express": "^4.17.3",
"@sharingan/utils": "1.0.0"
},
"devDependencies": {
"@types/express": "^4.17.13",
Expand Down
3 changes: 3 additions & 0 deletions apps/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import express from 'express';
import dotenv from 'dotenv';
import { sortNumbers } from "@sharingan/utils";

dotenv.config();

Expand All @@ -16,5 +17,7 @@ app.get('/', (req, res) => {
});

app.listen(PORT, () => {
console.log(sortNumbers(([67, 80, 4, 11, 90, 54, 22])));

console.log(`Application started on URL ${HOST}:${PORT} 🎉`);
});
27 changes: 16 additions & 11 deletions apps/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
{
"compilerOptions": {
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["dom"], /* Specify library files to be included in the compilation. */
"target": "es5",
"module": "commonjs",
"lib": ["dom"],
"outDir": "./dist",
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
"strictPropertyInitialization": false, /* Enable strict checking of property initialization in classes. */
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
/* Experimental Options */
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
"emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */
"strict": true,
"noImplicitAny": false,
"strictPropertyInitialization": false,
"baseUrl": "./",
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"composite": true
},
"include": [
"./src/**/*",
],
"exclude": [
"node_modules"
],
"references": [
{
"path": "../../packages/utils"
}
]
}
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "web",
"name": "@sharingan/web",
"version": "0.1.0",
"private": true,
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions packages/utils/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
7 changes: 7 additions & 0 deletions packages/utils/common/sort.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { sortBy } from "lodash";

const sortNumbers = (numbers: number[]) => {
return sortBy(numbers);
};

export { sortNumbers };
2 changes: 2 additions & 0 deletions packages/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./common/sort";

18 changes: 18 additions & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@sharingan/utils",
"version": "1.0.0",
"description": "Sharingan utilities functions",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"scripts": {
"build": "tsc"
},
"dependencies": {
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/lodash": "^4.14.180",
"typescript": "^4.6.2"
}
}
22 changes: 22 additions & 0 deletions packages/utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": ["dom"],
"outDir": "./dist",
"strict": true,
"noImplicitAny": true,
"strictPropertyInitialization": true,
"baseUrl": "./",
"esModuleInterop": true,
"moduleResolution": "node",
"declaration": true,
"composite": true
},
"include": [
"./**/*"
],
"exclude": [
"node_modules"
]
}
20 changes: 0 additions & 20 deletions tsconfig.base.json

This file was deleted.

45 changes: 45 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"compileOnSave": false,
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"module": "esnext",
"lib": ["es2017", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {},
"removeComments": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"alwaysStrict": true,

"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"exclude": [
"node_modules",
"tmp",
"packages/**/tests/**",
"packages/**/dist/**"
],
"references": [
{
"path": "./packages/utils"
},
{
"path": "./apps/core"
}
]
}
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@
resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=

"@types/lodash@^4.14.180":
version "4.14.180"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.180.tgz#4ab7c9ddfc92ec4a887886483bc14c79fb380670"
integrity sha512-XOKXa1KIxtNXgASAnwj7cnttJxS4fksBRywK/9LzRV5YxrF80BXZIGeQSuoESQ/VkUj30Ae0+YcuHc15wJCB2g==

"@types/mime@^1":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a"
Expand Down Expand Up @@ -1648,6 +1653,11 @@ lodash.merge@^4.6.2:
resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==

lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

loose-envify@^1.1.0, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz"
Expand Down