Skip to content

Commit

Permalink
[Fix] add cjs require to exports (#2)
Browse files Browse the repository at this point in the history
add require so this package can be used with node.js environments.
Necessary for playwright tests to run in the dev portal
  • Loading branch information
BrettCleary authored Apr 25, 2024
2 parents 475d183 + eb1f233 commit 5b5d764
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 79 deletions.
34 changes: 14 additions & 20 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@ on:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://[email protected]/
- name: Authenticate with private NPM package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Install modules.
run: yarn install --frozen-lockfile --immutable
- name: Lint code.
run: yarn lint
- name: Prettier code.
run: yarn prettier
test:
uses: HyperPlay-Gaming/workflows/.github/workflows/nodejs_commands.yml@main
with:
node_version: '18'
pkg_manager: 'npm'
install: 'npm install'
name: 'test'
command_one: 'npm run lint'
command_one_name: 'Lint'
command_two: 'npm run prettier'
command_two_name: 'Prettier code.'
checkout_recursive: false
secrets:
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'
61 changes: 10 additions & 51 deletions .github/workflows/publish-next-auth-steam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,13 @@ on:

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./.npmrc
npm ci
- name: Get previous version
id: get_previous_version
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./.npmrc
npm view @hyperplay/next-auth-steam version --verbose
echo ::set-output name=previous_version::$(npm view @hyperplay/next-auth-steam version | tr -d '[:space:]')
- name: Set current version
id: set_current_version
run: echo ::set-output name=current_version::$(node -p "require('./package.json').version")

- name: Compare versions
id: compare_versions
env:
PREVIOUS_VERSION: ${{ steps.get_previous_version.outputs.previous_version }}
CURRENT_VERSION: ${{ steps.set_current_version.outputs.current_version }}
run: echo ::set-output name=do_release::$(node -p "Number(process.env.INPUT_FORCE_RELEASE) || require('semver/functions/gt')(process.env.CURRENT_VERSION, process.env.PREVIOUS_VERSION)")

- name: Build @hyperplay/next-auth-steam
if: steps.compare_versions.outputs.do_release == 'true'
run: |
npm run build
- name: Release to npm
if: steps.compare_versions.outputs.do_release == 'true'
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./.npmrc
if [[ ${{ steps.set_current_version.outputs.current_version }} == *"-alpha"* ]]; then
npm publish --tag alpha
elif [[ ${{ steps.set_current_version.outputs.current_version }} == *"-beta"* ]]; then
npm publish --tag beta
else
npm publish
fi;
uses: HyperPlay-Gaming/workflows/.github/workflows/npm_publish.yml@main
with:
node_version: '18'
pkg_manager: 'npm'
install: 'npm install'
build: 'npm run build'
publish: 'npm publish'
pkg_manager_add_dev_dep: 'npm install --save-dev'
secrets:
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,3 @@ We highly suggest you to make sure that the package is updated to latest version
## 🕹️ HypePlay Labs .Inc

A web3-friendly game store from the future. The [HyperPlay](https://www.hyperplay.xyz/) Store also aggregates Epic Games, GOG, and Amazon Prime Gaming.


2 changes: 1 addition & 1 deletion examples/basic/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import NextAuth from 'next-auth/next'

import type { NextApiRequest, NextApiResponse } from 'next'

const MY_API_KEY = '';
const MY_API_KEY = ''

export default async function handler(
req: NextApiRequest,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperplay/next-auth-steam",
"version": "0.2.4",
"version": "0.2.5",
"license": "MIT",
"description": "Steam authentication provider for next-auth",
"main": "dist/index.cjs.js",
Expand Down Expand Up @@ -30,7 +30,8 @@
},
"exports": {
".": {
"import": "./dist/index.es.js"
"import": "./dist/index.es.js",
"require": "./dist/index.cjs.js"
}
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function Steam(
id: profile.providerAccountId,
email: `${profile.providerAccountId}@${STEAM_EMAIL_DOMAIN}`,
name: '',
image: '',
image: ''
}
}
}
Expand Down

0 comments on commit 5b5d764

Please sign in to comment.