Skip to content

Commit

Permalink
Publish garbo lib (#1639)
Browse files Browse the repository at this point in the history
* Publish garbo-lib to npm

* Include repo link for garbo-lib

* garbo-lib doesn't need to be run directly in mafia

* Build garbo-lib before checking garbo

* Add prettierignore
  • Loading branch information
gausie authored Oct 13, 2023
1 parent 3c12cda commit 98a31df
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 9 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/garbo-lib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish package to NPM
on:
push:
paths:
- "packages/garbo-lib/package.json"
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"

- name: Check publish status
id: check
uses: tehpsalmist/npm-publish-status-action@v1

- name: Publish if necessary
if: ${{ steps.check.outputs.exists == '0' }}
run: |
yarn
yarn workspace garbo-lib run publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 3 additions & 0 deletions .github/workflows/garbo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
node-version: ${{ env.node-version }}
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn workspace garbo-lib build
- run: yarn workspace garbo run check
#- run: yarn run test TODO: Readd once we have tests

Expand All @@ -39,6 +40,7 @@ jobs:
node-version: ${{ env.node-version }}
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn workspace garbo-lib build
- run: yarn run lint

circular-dependencies-script:
Expand All @@ -52,6 +54,7 @@ jobs:
node-version: ${{ env.node-version }}
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn workspace garbo-lib build
- run: yarn workspace garbo run madge

deploy:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "yarn workspaces foreach -ptv run build && yarn run combineFiles",
"combineFiles": "copyfiles --up 2 \"packages/garbo/dist/**\" .; copyfiles --up 2 \"packages/garbo-relay/dist/**\" .",
"format": "yarn workspaces foreach -pv run format",
"format": "yarn run prettier --write .github && yarn workspaces foreach -pv run format",
"lint": " yarn workspaces foreach -pv run lint",
"pre-commit": "yarn workspaces foreach -v run pre-commit",
"prepare": "husky install"
Expand Down
1 change: 1 addition & 0 deletions packages/garbo-lib/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
15 changes: 10 additions & 5 deletions packages/garbo-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,34 @@
"name": "garbo-lib",
"version": "0.0.1",
"license": "MIT",
"repository": "https://github.com/loathers/garbage-collector.git",
"description": "A library for sequencing turns resource-optimally",
"main": "src/index.ts",
"main": "dist/index.js",
"scripts": {
"build": "echo \"Nothing to do\"",
"build": "tsc",
"format": "eslint src --fix && prettier --write .",
"lint": "eslint src && prettier --check .",
"pre-commit": "lint-staged"
"pre-commit": "lint-staged",
"prepublishOnly": "yarn run build"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown",
"eslint --quiet --fix"
]
},
"dependencies": {
"peerDependencies": {
"kolmafia": "^5.27628.0",
"libram": "^0.8.13"
},
"devDependencies": {
"eslint": "^8.50.0",
"eslint-config-garbo": "^0.0.1",
"kolmafia": "^5.27628.0",
"libram": "^0.8.13",
"lint-staged": "^14.0.1",
"prettier": "^3.0.3"
"prettier": "^3.0.3",
"typescript": "^5.2.2"
},
"eslintConfig": {
"extends": "eslint-config-garbo"
Expand Down
6 changes: 3 additions & 3 deletions packages/garbo-lib/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"noEmit": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": false,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"lib": ["ES2019"],
"lib": ["ES2020"],
"module": "commonjs",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"pretty": true,
"outDir": "dist",
"strict": true,
"target": "esnext",
"skipLibCheck": true
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4258,6 +4258,10 @@ __metadata:
libram: ^0.8.13
lint-staged: ^14.0.1
prettier: ^3.0.3
typescript: ^5.2.2
peerDependencies:
kolmafia: ^5.27628.0
libram: ^0.8.13
languageName: unknown
linkType: soft

Expand Down

0 comments on commit 98a31df

Please sign in to comment.