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

Configuring and Publishing the Repository as a Package to NPM #1

Closed
wants to merge 19 commits into from
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

88 changes: 0 additions & 88 deletions .eslintrc.js

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/PushToBranch.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/npm-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Push To Main Branch

run-name: ${{github.actor}} Pushed To ${{github.ref_name}}

on:
push:
branches: [ "main" ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Audit
run: npm run audit --audit-level=moderate

- name: Lint
run: npm run lint

- name: Run tests
run: npm run test

deploy:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js for deployment
uses: actions/setup-node@v4
with:
node-version: 18

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/npm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Node.js Test

on:
pull_request:
branches: [ "main" ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]

steps:

- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Audit
run: npm run audit --audit-level=moderate

- name: Lint
run: npm run lint

- name: Run tests
run: npm run test

- name: Check for outdated dependencies
run: npm run outdated
26 changes: 26 additions & 0 deletions .github/workflows/weekly-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Weekly Build

on:
schedule:
- cron: '0 7 * * 1'

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: outdated
run: npm run outdated
143 changes: 143 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
const globals = require("globals");
const jest = require("eslint-plugin-jest");
const prettier = require("eslint-plugin-prettier");
const js = require("@eslint/js");

const {
FlatCompat,
} = require("@eslint/eslintrc");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

module.exports = [{
ignores: [
"**/node_modules/",
"**/coverage/",
"**/package.json",
"**/package-lock.json",
],
}, ...compat.extends("plugin:jest/recommended", "prettier"), {
languageOptions: {
globals: {
...globals.jest,
},

ecmaVersion: 2022,
sourceType: "script",
},

settings: {
"import/core-modules": ["aws-sdk"],
},
}, ...compat.extends("plugin:jest/recommended", "prettier").map(config => ({
...config,
files: ["src/**/*.ts"],
})), {
files: ["src/**/*.ts"],

plugins: {
jest,
},

languageOptions: {
ecmaVersion: 2022,
sourceType: "script",

parserOptions: {
project: "./tsconfig.json",
},
},

settings: {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
},

rules: {
"import/extensions": ["error", "ignorePackages", {
js: "never",
ts: "never",
}],

indent: ["error", 4, {
SwitchCase: 1,
}],

"max-len": [1, 120, {
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
ignoreUrls: true,
}],

"no-unused-vars": ["error", {
argsIgnorePattern: "^context$|^event$",
}],

"no-underscore-dangle": ["error", {
allow: ["_version"],
}],

"no-restricted-syntax": "off",
"no-await-in-loop": "off",
"prefer-regex-literals": "off",
"jest/no-conditional-expect": "off",
},
}, ...compat.extends("plugin:jest/recommended", "prettier").map(config => ({
...config,
files: ["**/*.js"],
})), {
files: ["**/*.js"],

plugins: {
jest,
prettier,
},

languageOptions: {
ecmaVersion: 2022,
sourceType: "script",
},

rules: {
indent: ["error", 4, {
SwitchCase: 1,
}],

"max-len": [1, 120, {
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
ignoreUrls: true,
}],

"no-unused-vars": ["error", {
argsIgnorePattern: "^context$|^event$",
}],

"no-underscore-dangle": ["error", {
allow: ["_version"],
}],

"no-restricted-syntax": "off",
"no-await-in-loop": "off",
"prefer-regex-literals": "off",
"jest/no-conditional-expect": "off",



},
}, {
files: ["src/**/*.test.js"],

rules: {
"no-promise-executor-return": "off",
},
}];
Loading
Loading