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

Create eslint.yml #115

Merged
merged 17 commits into from
Nov 10, 2024
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Cliff Consulting Dev Container",
"image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:0-14",
"image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:18",
"runArgs": ["--privileged"],
"postCreateCommand": "npm install",
"customizations": {
Expand Down
32 changes: 11 additions & 21 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '23 12 * * 4'
on: [ push ]
# push:
# branches: [ master ]
# pull_request:
# # The branches below must be a subset of the branches above
# branches: [ master ]
# schedule:
# - cron: '23 12 * * 4'

jobs:
analyze:
Expand All @@ -43,7 +43,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,18 +54,8 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
31 changes: 19 additions & 12 deletions .github/workflows/s3-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
#
# ref: https://github.com/mcliff1/cliffconsulting/new/master?filename=.github%2Fworkflows%2Faws.yml&workflow_template=aws
name: AWS Publish
#
# on:
# pull_request:
# branches:
# - master
# - release/dev
# push:
# - feature/*
on: [push]

on:
#pull_request:
# branches:
# - master
# - release/dev
push:
branches:
- master
- release/dev
#on: [push]

jobs:

Expand All @@ -23,7 +25,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -46,7 +48,7 @@ jobs:

# https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions
- name: Configuration for Test
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
if: ${{ github.ref == 'refs/heads/release/dev' }}
with:
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY_ID }}
Expand All @@ -56,7 +58,7 @@ jobs:
role-duration-seconds: 1800

- name: Configuration for Production
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
if: ${{ github.ref == 'refs/heads/master' }}
with:
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
Expand All @@ -68,12 +70,17 @@ jobs:

- name: Build And Deploy
run: |
node -v
aws sts get-caller-identity
ACCOUNT_NAME=$(aws ssm get-parameter --name /foundation/account/name --query 'Parameter.Value' --output text)
echo $ACCOUNT_NAME
BUCKET=$(aws ssm get-parameter --name /app/cdn/${ACCOUNT_NAME}-cliffconsulting/bucket --query 'Parameter.Value' --output text)
echo $BUCKET
npm install
npm run build
aws s3 sync ./build s3://${BUCKET}/ --delete
STACK_NAME=${ACCOUNT_NAME}-cliffconsulting
DISTRIBUTION=$(aws cloudformation --region us-east-1 describe-stacks --stack-name ${STACK_NAME} --query 'Stacks[0].Outputs[?OutputKey==`distributionid`].OutputValue' --output text)
aws cloudfront create-invalidation --distribution-id ${DISTRIBUTION} --paths "/*"

if: ${{ github.ref == 'refs/heads/release/dev' || github.ref == 'refs/heads/master' }}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This repository supports the [cliffconsulting.com](https://cliffconsulting.com/) web site. This is a serverless site to support Matt Cliff's career and freelance work.


Ref: https://github.com/devcontainers/images/tree/main/src/javascript-node

(12/21/19) make a new s3-cfn-dns stack that I can separate from the base; the base will make the pipeline for a given environment.

We will have a pipeline with 1 source (this Git);
Expand Down
35 changes: 35 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const react = require('eslint-plugin-react');
const globals = require('globals');

module.exports = [
{
files: ["**/*.js", "**/*.jsx"],
languageOptions: {
ecmaVersion: 2021,
sourceType: "module",
parser: require("@typescript-eslint/parser"),
parserOptions: {
requireConfigFile: false,
ecmaFeatures: {
jsx: true
}
},
"globals": {
browser: true,
es2021: true
}
},
plugins: {
react: require("eslint-plugin-react"),
"@typescript-eslint": require("@typescript-eslint/eslint-plugin")
},
settings: {
react: {
version: "18.0"
}
},
rules: {
// Your custom rules
}
}
];
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import pluginReact from "eslint-plugin-react";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,jsx}"]},
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended,
];
Loading