Skip to content

Commit

Permalink
Updated package.json, webpack.yml, and husky pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SunDevil311 committed Feb 27, 2025
1 parent 37b02cf commit 038fe1f
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 64 deletions.
108 changes: 54 additions & 54 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,58 +140,58 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# publish-gpr:
# needs: [check-codeql, build]
# runs-on: ubuntu-24.04
publish-gpr:
needs: [check-codeql, build]
runs-on: ubuntu-24.04
# Complete workflow even if this job fails
# continue-on-error: true
# permissions:
# contents: read
# packages: write
# steps:
# - name: Set up .npmrc file for GPR
# run: |
# echo "@neteng-pro:registry=https://npm.pkg.github.com/" > ~/.npmrc
# echo "//npm.pkg.github.com/:_authToken=${{ secrets.GH_PAT }}" >> ~/.npmrc

# - name: Login to GitHub Package Registry
# run: npm login --registry=https://npm.pkg.github.com/ --scope=@neteng-pro --always-auth --username "sundevil311" --authToken ${{ secrets.GH_PAT }}

# - name: Checkout repository
# uses: actions/[email protected]

# - name: Set up Node.js
# uses: actions/[email protected]
# with:
# node-version: 22.x
# registry-url: https://npm.pkg.github.com/

# - name: Cache Node.js modules
# uses: actions/[email protected]
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-22.x-publish-${{ hashFiles('package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-22.x-publish-
# ${{ runner.os }}-node-22.x-
# ${{ runner.os }}-node-

# - name: Install dependencies
# run: npm ci

# - name: Set up Git user
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "SunDevil311"

# - name: Ensure dist directory exists
# run: mkdir -p dist

# - name: Copy package.json to dist directory
# run: cp package.json dist/

# - name: Publish package
# working-directory: ./dist
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GH_PAT }}
continue-on-error: true
permissions:
contents: read
packages: write
steps:
- name: Set up .npmrc file for GPR
run: |
echo "@neteng-pro:registry=https://npm.pkg.github.com/" > ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GH_PAT }}" >> ~/.npmrc
- name: Login to GitHub Package Registry
run: npm login --registry=https://npm.pkg.github.com/ --scope=@neteng-pro --always-auth --username "sundevil311" --authToken ${{ secrets.GH_PAT }}

- name: Checkout repository
uses: actions/[email protected]

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: 22.x
registry-url: https://npm.pkg.github.com/

- name: Cache Node.js modules
uses: actions/[email protected]
with:
path: ~/.npm
key: ${{ runner.os }}-node-22.x-publish-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-22.x-publish-
${{ runner.os }}-node-22.x-
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci

- name: Set up Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "SunDevil311"
- name: Ensure dist directory exists
run: mkdir -p dist

- name: Copy package.json to dist directory
run: cp package.json dist/

- name: Publish package
working-directory: ./dist
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PAT }}
15 changes: 11 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/usr/bin/env bash
# .husky/pre-commit

#!/bin/sh
# Run Mocha test framework
npm run test

# Run markdownlint-cli2 on all Markdown files and allow commit to proceed even if there are linting errors
npx markdownlint-cli2 '**/*.md' || true

# Run stylelint against all CSS and SCSS files and allow commit to proceed even if there are linting errors
npx stylelint '**/*.css' '**/*.scss' || true

# Run prettier against all staged files
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0

Expand All @@ -13,6 +23,3 @@ echo "$FILES" | xargs git add
git update-index --again

exit 0

#prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown

File renamed without changes.
115 changes: 110 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neteng-pro/netwk-pro-web",
"version": "0.2.4",
"version": "0.2.5",
"private": false,
"description": "Locking Down Networks, Unlocking Confidence — Network Pro",
"keywords": [
Expand Down Expand Up @@ -33,6 +33,7 @@
"scripts": {
"test": "mocha",
"lint": "npx eslint && prettier --check .",
"mdlint": "npx markdownlint-cli2 '**/*.md'",
"fix": "npx eslint --fix && prettier --write .",
"clean": "rm -rf dist/* && npm update",
"ci": "rm -rf dist/* node_modules package-lock.json && npm install",
Expand Down Expand Up @@ -67,6 +68,7 @@
"html-webpack-plugin": "^5.6.3",
"husky": "^9.1.7",
"markdownlint": "^0.37.4",
"markdownlint-cli2": "^0.17.2",
"mocha": "^11.0.1",
"postcss": "^8.5.1",
"postcss-loader": "^8.1.1",
Expand Down

0 comments on commit 038fe1f

Please sign in to comment.