Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: #116 #117 update ts-definition pipeline, scripts #226

Merged
merged 5 commits into from
Feb 13, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
45 changes: 45 additions & 0 deletions .github/workflows/foundation-ts-definition-cronjob.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Check for Typescript definition update

on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 1-31 * *'

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: checks out repository to $GITHUB_WORKSPACE
uses: actions/checkout@v1

- name: Setup Node Environement
uses: actions/setup-node@v1
with:
node-version: 12

- name: Cache node modules
id: cache
uses: actions/cache@v1
with:
path: node_modules
key: build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
build-${{ hashFiles('**/yarn.lock') }}

- name: Integrate Git credential
uses: webfactory/ssh-agent@v0.1.1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Install dependencies
run: yarn install

- name: Fetch latest definition
run: yarn workspace @reapit/foundations-ts-definitions fetch-definition

- name: If definition is changed then bump minor npm package, publish and push commit to master
run: yarn workspace @reapit/foundations-ts-definitions handle-cron-job

env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 1 addition & 1 deletion .github/workflows/release-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release production
on:
push:
tags:
- '*'
- '*'

env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ elements/public
out*
package-lock.json
.env
invite-developers.js
invite-developers.js
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
1 change: 1 addition & 0 deletions packages/aml-checklist/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
5 changes: 3 additions & 2 deletions packages/aml-checklist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"release:prod": "node ../../scripts/release/release-prod.js aml-checklist reapit-aml-checklist-prod",
"test:update-badges": "yarn test:ci && jest-coverage-badges --input src/tests/coverage/coverage-summary.json --output src/tests/badges"
},
"dependencies": {},
"devDependencies": {}
"devDependencies": {
"@reapit/foundations-ts-definitions": "2020-02-13"
}
}
1 change: 0 additions & 1 deletion packages/aml-checklist/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"@/*": ["src/*"],
"@reapit/cognito-auth": ["../cognito-auth/src"],
"@reapit/elements": ["../elements/src"],
"@reapit/foundations-ts-definitions": ["./src/types/api-2020-01-31"],
"logger": ["../../scripts/logger/sentry-logger.ts"]
}
},
Expand Down
1 change: 1 addition & 0 deletions packages/foundations-ts-definitions/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this is necessary as the npmrc is at the package root

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npmrc is required because even using yarn workspace command to execute the release script, the cwd still resides in the packages/foundation. Yarn/NPM only read npmrc to its closest workspace directory (the nearest folder containing package.json). Having tested this against release:npm script, this could lead to possible bugs of other NPM packages release production flow (elements, cognito... etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also informed our team about this. Testing release production flow of NPM package is currently being conducted.

21 changes: 9 additions & 12 deletions packages/foundations-ts-definitions/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
{
"name": "@reapit/foundations-ts-definitions",
"version": "0.0.18",
"version": "0.0.38",
"license": "MIT",
"files": [
"types/*"
],
"main": "./types/index.ts",
"peerDependencies": {
},
"license": "MIT",
"scripts": {
"fetch:platform": "node './scripts/fetch-platform-definition.js'",
"fetch:marketPlace": "node './scripts/fetch-marketplace-definition.js'",
"fetch:definition": "rimraf types && mkdir types && yarn fetch:platform && yarn fetch:marketPlace && yarn create-index-file",
"create-index-file": "node './scripts/create-index-file.js'",
"handle-cronjob": "node ./scripts/handle-cronjob.js"
},
"dependencies": {
"release:prod": "node ../../scripts/foundations-ts-definitions/release-npm.js foundations-ts-definitions",
"fetch-definition": "node '../../scripts/foundations-ts-definitions/fetch-definition.js'",
"handle-cron-job": "node '../../scripts/foundations-ts-definitions/handle-cronjob.js'",
"test:update-badges": "echo 'not implmented'"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write",
"git add"
]
}
},
"dependencies": {},
"peerDependencies": {}
}
15 changes: 0 additions & 15 deletions packages/foundations-ts-definitions/scripts/check-version.js

This file was deleted.

18 changes: 0 additions & 18 deletions packages/foundations-ts-definitions/scripts/create-index-file.js

This file was deleted.

40 changes: 0 additions & 40 deletions packages/foundations-ts-definitions/scripts/release-master.js

This file was deleted.

4 changes: 0 additions & 4 deletions packages/foundations-ts-definitions/types/index.ts

This file was deleted.

Loading