Skip to content

Commit

Permalink
chore: setup hooks and format the workspace (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt authored Aug 1, 2023
1 parent 86248c5 commit 1bb5251
Show file tree
Hide file tree
Showing 35 changed files with 4,697 additions and 5,902 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package.json
package-lock.json
dist
e2e/**
node_modules/*
karma.conf.js
commitlint.config.js
21 changes: 5 additions & 16 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"ignorePatterns": ["projects/**/*"],
"globals": {
"document": "readonly",
"window": "readonly",
Expand All @@ -15,14 +13,9 @@
},
"overrides": [
{
"files": [
"*.ts"
],
"files": ["*.ts"],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"project": ["tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
Expand Down Expand Up @@ -61,12 +54,8 @@
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {}
}
]
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ yarn-error.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install lint-staged
51 changes: 5 additions & 46 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": [],
"vendorChunk": true,
"extractLicenses": false,
Expand All @@ -48,7 +43,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
Expand Down Expand Up @@ -91,49 +85,15 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"styles": ["src/styles.scss"],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
"assets": ["src/favicon.ico", "src/assets"]
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"ngx-drag-scroll-demo-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "ngx-drag-scroll-demo:serve"
},
"configurations": {
"production": {
"devServerTarget": "ngx-drag-scroll-demo:serve:production"
}
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"exclude": [
"**/node_modules/**"
]
"exclude": ["**/node_modules/**"]
}
}
}
Expand Down Expand Up @@ -170,7 +130,6 @@
}
}
},
"defaultProject": "ngx-drag-scroll-demo",
"cli": {
"analytics": false
},
Expand Down
4 changes: 1 addition & 3 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
extends: [
'@commitlint/config-angular'
]
extends: ['@commitlint/config-conventional']
};
18 changes: 9 additions & 9 deletions copy-artifacts.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const fs = require("fs");
const path = require("path");
const fs = require('fs');
const path = require('path');

const artifacts = ["CHANGELOG.md", "LICENSE", "README.md"];
artifacts.forEach(artifact => {
const artifacts = ['CHANGELOG.md', 'LICENSE', 'README.md'];
artifacts.forEach((artifact) => {
const fromPath = path.resolve(__dirname, artifact);
const toPath = path.resolve(__dirname, "dist/ngx-drag-scroll", artifact);
const toPath = path.resolve(__dirname, 'dist/ngx-drag-scroll', artifact);

fs.readFile(fromPath, "utf-8", (err, data) => {
fs.readFile(fromPath, 'utf-8', (err, data) => {
if (err) {
console.log("an error occured while reading file ", fromPath);
console.log('an error occured while reading file ', fromPath);
return;
}
fs.writeFile(toPath, data, err => {
fs.writeFile(toPath, data, (err) => {
if (err) {
console.log("an error occured while writing file ", toPath);
console.log('an error occured while writing file ', toPath);
return;
}
console.log(`${artifact} copied`);
Expand Down
23 changes: 0 additions & 23 deletions e2e/src/app.e2e-spec.ts

This file was deleted.

11 changes: 0 additions & 11 deletions e2e/src/app.po.ts

This file was deleted.

13 changes: 0 additions & 13 deletions e2e/tsconfig.e2e.json

This file was deleted.

3 changes: 3 additions & 0 deletions lint-staged.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
'**/*.{ts,js,json,md,scss,html,yml}': 'prettier --write'
};
Loading

0 comments on commit 1bb5251

Please sign in to comment.