Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

15 changes: 0 additions & 15 deletions .eslintrc

This file was deleted.

49 changes: 27 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,70 @@ jobs:
os: [ubuntu-latest]

steps:
- id: setup-node
name: Setup Node
uses: actions/setup-node@v3
- name: Check out code repository source code
uses: actions/checkout@v4

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

- name: Check out code repository source code
uses: actions/checkout@v2
cache: 'npm'

- name: Install dependencies
run: yarn
run: npm ci

- name: Run build
run: yarn build
run: npm run build

- name: Run lint
run: yarn lint
run: npm run lint

# Publishing is done in a separate job to allow
# for all matrix builds to complete.
release:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
strategy:
fail-fast: false
matrix:
node: [18]

steps:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Check out repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'

- name: Check if publish needed
id: publish
run: |
name="$(jq -r .name package.json)"
npmver="$(npm show $name version || echo v0.0.0)"
pkgver="$(jq -r .version package.json)"
if [ "$npmver" = "$pkgver" ]
then
echo "Package version ($pkgver) is the same as last published NPM version ($npmver), skipping publish."
echo "publish=false" >> $GITHUB_ENV
echo "publish=false" >> $GITHUB_OUTPUT
else
echo "Package version ($pkgver) is different from latest NPM version ($npmver), publishing!"
echo "publish=true" >> $GITHUB_ENV
echo "publish=true" >> $GITHUB_OUTPUT
fi

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Publish
if: env.publish == 'true'
if: steps.publish.outputs.publish == 'true'
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
yarn
yarn build
npm publish
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ dist/
coverage/
node_modules/
work/
package-lock.json
.DS_Store
.idea/
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
42 changes: 42 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import { fileURLToPath } from 'url';
import path from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

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

export default [
// Global ignores (replaces .eslintignore and ignorePatterns)
{
ignores: [
'*.js',
'!eslint.config.js',
'index.js',
'config/**',
'test/fixtures/**/*',
'dist/**',
'node_modules/**',
],
},

// Use FlatCompat to bridge the legacy @jupiterone/eslint-config
...compat.extends('@jupiterone/eslint-config/node18'),

// TypeScript-specific configuration
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
},
},
];
Loading
Loading