Skip to content

Commit

Permalink
Restructure yarn commands
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownskl committed Sep 18, 2024
1 parent c529478 commit dac640f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: yarn

- name: Lint code
run: yarn workspace @greenlight/app lint
run: yarn app lint


tests:
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
run: yarn

- name: Run tests
run: yarn workspace @greenlight/app test
run: yarn app test
env:
XBOX_USERNAME: ${{ secrets.XBOX_USERNAME }}
XBOX_PASSWORD: ${{ secrets.XBOX_PASSWORD }}
Expand Down
16 changes: 6 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@
"url": "git+https://github.com/unknownskl/greenlight.git"
},
"scripts": {
"app:start": "yarn workspace @greenlight/app dev",
"app:test": "yarn workspace @greenlight/app test",
"cli:start": "yarn workspace @greenlight/cli start",
"cli:test": "yarn workspace @greenlight/cli test",
"logger:test": "yarn workspace @greenlight/logger test",
"logger:start": "yarn workspace @greenlight/logger start",
"authentication:test": "yarn workspace @greenlight/authentication test",
"storeapi:test": "yarn workspace @greenlight/storeapi test",
"storeapi:start": "yarn workspace @greenlight/storeapi start",
"test": "yarn logger:test && yarn authentication:test && yarn app:test"
"app": "yarn workspace @greenlight/app",
"cli": "yarn workspace @greenlight/cli",
"logger": "yarn workspace @greenlight/logger",
"authentication": "yarn workspace @greenlight/authentication",
"storeapi": "yarn workspace @greenlight/storeapi",
"test": "yarn logger test && yarn authentication test && yarn app test"
},
"workspaces": [
"app",
Expand Down
5 changes: 3 additions & 2 deletions packages/authentication/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"license": "MIT",
"main": "dist/index",
"scripts": {
"start": "yarn build && node dist/index.js",
"build": "tsc --build",
"start": "yarn build && DEBUG='*' node dist/bin/example.js",
"build": "yarn build:deps && tsc --build",
"build:deps": "yarn workspace @greenlight/logger build",
"clean": "rm -rf dist/ && rm -rf *.tsbuildinfo",
"test": "yarn build && mocha -r ../../node_modules/ts-node/register tests/**.ts tests/**/*.ts"
},
Expand Down
31 changes: 31 additions & 0 deletions packages/authentication/src/bin/example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

import Authentication from '../index'
import Logger from '@greenlight/logger'

class Cli {
private _auth = new Authentication()
public logger = new Logger('StoreApi:Cli')

constructor(){
this.logger.log('Greenlight StoreAPI Cli')
this.logger.log('User:', this._auth.user.getGamertag())

if(! this._auth.hasValidAuthentication()){
this._auth.refreshTokens().then(() => {
this.logger.log('Tokens refreshed')
})
}

this._auth.user.getxCloudToken().then((token) => {
this.logger.log('xCloudToken:', token)
console.log('Region:', token.getDefaultRegion().baseUri)
console.log('Market:', token.getMarket())
console.log('Token:', token.data.gsToken)

}).catch((error) => {
this.logger.error('Error:', error)
})
}
}

new Cli()
2 changes: 1 addition & 1 deletion packages/logger/tests/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Logger', () => {
expect(logger._sink).to.be.an.instanceOf(Sink)
// @ts-ignore - _sink.data is private. Value is ['test123']
expect(logger._sink.data[0]).includes({
data: JSON.stringify('test123')
data: 'test123'
})
})
})
Expand Down

0 comments on commit dac640f

Please sign in to comment.