Skip to content

Commit

Permalink
ecommerce: add setup.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuj committed Jan 27, 2025
1 parent 5b9b79b commit 497c1ff
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions PAC4_Ex_Prac/ecommerce/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
PROJECT_NAME=ecommerce

# create the projecte
npx @angular/cli@latest new ${PROJECT_NAME} --no-strict --standalone=false --style=css --ssr=no --skip-tests --package-manager="npm"

# install the packages
cd ${PROJECT_NAME}
ng add @angular-eslint/schematics --defaults --skip-confirmation
npm install --save-dev prettier prettier-eslint eslint-config-prettier eslint-plugin-prettier

# overwrite / create config files
cat << EOF > eslint.config.js
// @ts-check
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
module.exports = tseslint.config(
{
files: ["**/*.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
...angular.configs.tsRecommended,
eslintPluginPrettierRecommended,
],
processor: angular.processInlineTemplates,
rules: {
"@angular-eslint/directive-selector": [
"error",
{
type: "attribute",
prefix: "app",
style: "camelCase",
},
],
"@angular-eslint/component-selector": [
"error",
{
type: "element",
prefix: "app",
style: "kebab-case",
},
],
},
},
{
files: ["**/*.html"],
extends: [
...angular.configs.templateRecommended,
...angular.configs.templateAccessibility,
],
rules: {},
}
);
EOF
cat << EOF > .prettierrc.json
{
"trailingComma": "none",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
}
]
}
EOF

# generate components
ng g c articles/article-list --inline-style --inline-template
ng g c articles/article-item

0 comments on commit 497c1ff

Please sign in to comment.