Skip to content

Commit

Permalink
Refactored to align with common development repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
KDean-Dolphin committed Jan 27, 2025
1 parent 8802b34 commit 5c7b92d
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 187 deletions.
65 changes: 15 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,23 @@ jobs:
release:
runs-on: ubuntu-latest

if: github.event_name == 'release'

steps:
- name: Setup node
uses: actions/setup-node@v4
- name: Build, test, and publish (release)
uses: legreq/tsdev/.github/actions/build-test-publish@main
with:
node-version: ${{ vars.NODE_VERSION }}
registry-url: https://registry.npmjs.org/

- name: Checkout
uses: actions/checkout@v4

- name: Start terminal session (pre build)
if: vars.TERMINAL_PRE_BUILD == 'true'
uses: mxschmitt/action-tmate@v3

- name: Build
shell: bash
run: |
npm install
# Project must have build-dist script.
npm run build-dist
- name: Start terminal session (post build)
if: vars.TERMINAL_POST_BUILD == 'true'
uses: mxschmitt/action-tmate@v3
secrets: ${{ toJSON(secrets) }}
vars: ${{ toJSON(vars) }}

- name: Test
shell: bash
run: |
# Run test script if present.
npm run test --if-present
- name: Publish
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
run: |
# Get the tag on the version property if any.
tag=`grep "^ \"version\": " package.json | cut -d "\"" -f4 -s | cut -d "-" -f2 -s`
# If release is not official, tag it with the release phase.
if [ "$tag" != "" ]
then
tag_args="--tag $tag"
fi
if [ "${{ github.event_name }}" != "release" ]
then
dry_run_arg="--dry-run"
fi
test:
runs-on: ubuntu-latest

# Create .npmignore to exclude hidden directories.
echo /.\*/ > .npmignore
if: github.event_name != 'release'

npm publish --access public $tag_args $dry_run_arg
steps:
- name: Build, test, and publish (test)
uses: legreq/tsdev/.github/actions/build-test-publish@test-release
with:
secrets: ${{ toJSON(secrets) }}
vars: ${{ toJSON(vars) }}
7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

12 changes: 12 additions & 0 deletions .idea/runConfigurations/build_dist.xml

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

12 changes: 12 additions & 0 deletions .idea/runConfigurations/lint.xml

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

115 changes: 2 additions & 113 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,114 +1,3 @@
import js from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
import esLintConfigLove from "eslint-config-love";
import jsdoc from "eslint-plugin-jsdoc";
import tseslint from "typescript-eslint";
import { esLintConfigLegReq } from "@legreq/tsdev";

export default tseslint.config(
{
ignores: ["eslint.config.js", "dist"]
},
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
stylistic.configs["recommended-flat"],
jsdoc.configs["flat/recommended-typescript"],
esLintConfigLove,
{
languageOptions: {
parserOptions: {
projectService: true
}
},

linterOptions: {
reportUnusedDisableDirectives: "error"
},

rules: {
"complexity": "off",
"max-depth": "off",
"max-lines": "off",
"no-console": "off",
"no-dupe-class-members": "off",
"no-redeclare": "off",
"no-unused-vars": "off",

"@typescript-eslint/class-literal-property-style": "off",
"@typescript-eslint/class-methods-use-this": "off",
"@typescript-eslint/init-declarations": "off",
"@typescript-eslint/max-params": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-unnecessary-type-parameters": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
],
"@typescript-eslint/prefer-destructuring": "off",
"@typescript-eslint/unbound-method": ["error", {
ignoreStatic: true
}],

"@stylistic/array-bracket-newline": ["error", "consistent"],
"@stylistic/brace-style": ["error", "1tbs", {
allowSingleLine: false
}],
"@stylistic/comma-dangle": ["error", "never"],
"@stylistic/indent": ["error", 4],
"@stylistic/member-delimiter-style": ["error", {
multiline: {
delimiter: "semi",
requireLast: true
},
singleline: {
delimiter: "semi"
}
}],
"@stylistic/no-trailing-spaces": ["off"],
"@stylistic/operator-linebreak": ["error", "after"],
"@stylistic/quotes": ["error", "double"],
"@stylistic/semi": ["error", "always"],
"@stylistic/object-curly-newline": ["error", {
ObjectExpression: {
multiline: true,
minProperties: 1
},
ObjectPattern: {
multiline: true,
minProperties: 1
}
}],
"@stylistic/object-property-newline": "error",

"jsdoc/require-description": ["warn", {
contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
}],
"jsdoc/require-jsdoc": ["warn", {
contexts: ["ClassDeclaration", "ClassProperty", "FunctionDeclaration", "MethodDefinition", "TSEnumDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSTypeAliasDeclaration"]
}],
"jsdoc/require-returns": ["warn", {
checkGetters: false
}],
"jsdoc/tag-lines": ["warn", "any", {
count: 1,
startLines: 1
}]
}
},
{
files: [
"test/**/*"
],
rules: {
"max-nested-callbacks": "off",
"jsdoc/require-jsdoc": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/no-unsafe-type-assertion": "off"
}
}
);
export default esLintConfigLegReq;
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable no-console -- Console application. */

import { spawnSync } from "child_process";
import fs from "fs";

Expand Down
25 changes: 1 addition & 24 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
// https://aka.ms/tsconfig
{
"compilerOptions": {
// Type checking.
"strict": true,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,

// Modules.
"module": "nodenext",
"resolveJsonModule": true,

// Interop constraints.
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,

// Language and environment.
"target": "esnext",
"useDefineForClassFields": true,

// Completeness.
"skipLibCheck": true
}
"extends": "@legreq/tsdev/tsconfig.json"
}

0 comments on commit 5c7b92d

Please sign in to comment.