Skip to content

Commit

Permalink
chore: build configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
MM25Zamanian committed Dec 3, 2022
1 parent faf7dc4 commit 0a2fb2c
Show file tree
Hide file tree
Showing 9 changed files with 1,192 additions and 160 deletions.
53 changes: 42 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,36 @@
"google",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:wc/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
"plugin:import/typescript",
"plugin:wc/best-practice",
"plugin:lit/recommended"
],
"env": {
"node": true,
"browser": true,
"es2021": true
"shared-node-browser": true,
"es2022": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "import", "wc"],
"plugins": [
"@typescript-eslint",
"import",
"wc"
],
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": "*/tsconfig.json"
"project": "packages/*/*/tsconfig.json"
}
},
"wc": {
"elementBaseClasses": ["LitElement"]
"elementBaseClasses": [
"LitElement"
]
}
},
"rules": {
Expand All @@ -52,13 +58,38 @@
"capIsNewExceptionPattern": "Mixin$"
}
],
"brace-style": ["error", "stroustrup", {"allowSingleLine": true}],
"operator-linebreak": ["error", "after", {"overrides": {"?": "before", ":": "before"}}],
"brace-style": [
"error",
"stroustrup",
{
"allowSingleLine": true
}
],
"operator-linebreak": [
"error",
"after",
{
"overrides": {
"?": "before",
":": "before"
}
}
],
"@typescript-eslint/explicit-function-return-type": "error",
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", ["parent", "sibling", "index"], "type"],
"groups": [
"builtin",
"external",
"internal",
[
"parent",
"sibling",
"index"
],
"type"
],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
Expand Down
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Desktop.ini
# Build
dist
build
**/src/**/*.map
*.map
*.d.ts
*.tsbuildinfo
**/src/**/*.js
**/src/**/*.d.ts
**/src/**/*.tsbuildinfo

# Dependencies
node_modules
Expand All @@ -28,10 +28,6 @@ package-lock.json
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# storage
_data
**/db
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"typescript.tsdk": "node_modules\\typescript\\lib",
"files.exclude": {
"*/src/**/*.map": true,
"*/src/**/*.js": true,
"*/src/**/*.d.ts": true
"*/src/**/*.d.ts": true,
"*/src/**/*.tsbuildinfo": true,
},
"cSpell.language": "en,fa",
"cSpell.words": [
Expand Down
5 changes: 3 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com> (https://ali.mihandoost.com)",
"private": true,
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
"node": ">=19.0.0",
"npm": ">=8.0.0",
"yarn": ">=1.22.0"
},
"repository": {
"type": "git",
Expand Down
32 changes: 0 additions & 32 deletions pwa/dev-server.mjs

This file was deleted.

14 changes: 10 additions & 4 deletions pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com> (https://ali.mihandoost.com)",
"private": true,
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"browserslist": "> 0.1%, not dead",
Expand All @@ -20,11 +21,11 @@
"s": "run-s clean build serve",
"w": "yarn watch",
"start": "yarn serve",
"clean": "rimraf build/",
"build": "run-s build:*",
"clean": "yarn build:ts --clean && rimraf build/",
"build": "run-s build:ts build:es",
"build:ts": "tsc --build --pretty",
"build:es": "yarn clean && rollup -c",
"serve": "web-dev-server --config dev-server.mjs",
"build:es": "rollup -c",
"serve": "wds",
"watch": "run-s clean build:ts && run-p watch:ts serve",
"watch:ts": "yarn build:ts --watch --preserveWatchOutput"
},
Expand All @@ -42,9 +43,14 @@
},
"devDependencies": {
"@babel/preset-env": "~7.20.2",
"@open-wc/building-rollup": "~2.2.1",
"@rollup/plugin-babel": "~6.0.3",
"@rollup/plugin-node-resolve": "~15.0.1",
"@web/dev-server": "~0.1.35",
"@web/dev-server-esbuild": "^0.3.3",
"deepmerge": "~4.2.2",
"eslint-plugin-lit": "^1.6.1",
"lit-analyzer": "^1.2.1",
"npm-run-all": "~4.1.5",
"rollup": "~3.5.1",
"rollup-plugin-minify-html-literals": "~1.2.6",
Expand Down
133 changes: 61 additions & 72 deletions pwa/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,90 +1,79 @@
{
"compilerOptions": {
/* Basic Options */
"target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"incremental": true,
"target": "ES2019",
"module": "ES2022",
"lib": [
/* Specify library files to be included in the compilation. https://github.com/microsoft/TypeScript/tree/master/lib */
"ESNext",
"ES2022",
"DOM",
"DOM.Iterable"
],
"declaration": true /* Generates corresponding '.d.ts' file. */,
"sourceMap": true /* Generates corresponding '.map' file. */,
"declarationMap": false /* Generates a sourcemap for each corresponding '.d.ts' file. */,
// "outDir": "./", /* Redirect output structure to the directory. */
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
// "composite": true, /* Enable project compilation */
// "incremental": true, /* Enable incremental compilation */
// "tsBuildInfoFile": ".tsbuildinfo", /* Specify file to store incremental compilation information */
"removeComments": true /* Do not emit comments to output. */,
"importHelpers": true /* Import emit helpers from 'tslib'. */,
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */

// "allowJs": true,
// "checkJs": true,
// "jsx": "preserve",
"declaration": true,
"declarationMap": true,
// "outFile": "./",
"outDir": "./src",
"rootDir": "./src",
"composite": true,
"tsBuildInfoFile": ".tsbuildinfo",
"removeComments": false,
// "noEmit": true,
"importHelpers": true,
// "downlevelIteration": true,
// "isolatedModules": true,
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,

"strict": true,
"noImplicitAny": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */,
"noUnusedParameters": true /* Report errors on unused parameters. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
"noImplicitOverride": true /* Force to use override keyword when override super class methods. */,

"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
// "noUncheckedIndexedAccess": true,
// "noPropertyAccessFromIndexSignature": true,
/* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
// "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "baseUrl": "./package", /* Base directory to resolve non-absolute module names. */

"moduleResolution": "node",
"baseUrl": "./package",
// "paths": {},
// "rootDirs": [],
// "typeRoots": [],
// "types": [],
"allowSyntheticDefaultImports": true,
// "esModuleInterop": true,
// "preserveSymlinks": true,
// "allowUmdGlobalAccess": true,
/* Source Map Options */
"sourceMap": true,
// "sourceRoot": "",
// "mapRoot": "",
// "inlineSourceMap": true,
"inlineSources": true,
/* Experimental Options */
"skipLibCheck": true /* Skip type checking of declaration files. Requires TypeScript version 2.0 or later. */,
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
// "emitDecoratorMetadata": false, /* Enables experimental support for emitting type metadata for decorators. */
"forceConsistentCasingInFileNames": true /* Follows the case sensitivity rules of the file system it’s running on. */,
"useDefineForClassFields": false /* Must be disabled for lit, https://lit.dev/docs/components/properties/#avoiding-issues-with-class-fields */,

"experimentalDecorators": true,
"emitDecoratorMetadata": true,
/* Advanced Options */
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": false,
"plugins": [
{
"name": "ts-lit-plugin",
"rules": {
// error
"no-unknown-tag-name": "error",
"no-unclosed-tag": "error",
"no-unknown-property": "error",
"no-unintended-mixed-binding": "error",
"no-invalid-boolean-binding": "error",
"no-expressionless-property-binding": "error",
"no-noncallable-event-binding": "error",
"no-boolean-in-attribute-binding": "error",
"no-complex-attribute-binding": "error",
"no-nullable-attribute-binding": "error",
"no-incompatible-type-binding": "error",
"no-invalid-directive-binding": "error",
"no-incompatible-property-type": "error",
"no-unknown-property-converter": "error",
"no-invalid-attribute-name": "error",
"no-invalid-tag-name": "error",
"no-property-visibility-mismatch": "error",
// off
"no-unknown-attribute": "off",
"no-unknown-event": "off",
"no-unknown-slot": "off",
"no-invalid-css": "off"
}
"strict": true
}
]
},

"include": ["src/**/*.ts"] /* Specifies a list of glob patterns that match files to be included in compilation. */,
"exclude": [] /* Specifies a list of files to be excluded from compilation. */
"include": [
"src/**/*.ts"
],
"exclude": [],
}
17 changes: 17 additions & 0 deletions pwa/web-dev-server.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// https://modern-web.dev/docs/dev-server/cli-and-configuration/#configuration-file
export default {
port: 8080,
open: true,
watch: true,
// appIndex: 'index.html',
nodeResolve: {
exportConditions: ['development']
},
esbuildTarget: 'auto',
// in a monorepo you need to set set the root dir to resolve modules
rootDir: '.',
// debug: false,
preserveSymlinks: true,
plugins: [],
middleware: [],
};
Loading

0 comments on commit 0a2fb2c

Please sign in to comment.