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

npm publishing and deploying to cjquines.com #204

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
29 changes: 29 additions & 0 deletions .github/workflows/cjquines-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# From https://github.com/pihart/ts/blob/572ce179d629f2426ed4f9d7f262fb2e70d9fed6/.github/workflows/npm-publish.yml

# This workflow will run tests using node and then publish a package to NPM when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish to cjquines.com

on:
release:
types: [ created ]

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm test --if-present
- name: Create SSH key
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
- name: Publish
run: rsync -a dist/ ssh.phx.nearlyfreespeech.net:/home/public/qboard/
Copy link
Owner

Choose a reason for hiding this comment

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

i don't think this directly works—post-build, the hrefs in index.html are relative to /, which is incorrect, i think? we might need to add a homepage to package.json or do something else to get the right hrefs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The hrefs/srcs should(?) all be flat; see https://github.com/pihart/qboard/blob/gh-pages/index.html

Copy link
Owner

Choose a reason for hiding this comment

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

ok. i think the rsync might want a --delete. but i'll test it. also, i think this actually needs a username as part of the secrets xp

26 changes: 26 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# From https://github.com/pihart/ts/blob/572ce179d629f2426ed4f9d7f262fb2e70d9fed6/.github/workflows/npm-publish.yml

# This workflow will run tests using node and then publish a package to NPM when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish to NPM

on:
release:
types: [ created ]

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm test --if-present
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/semver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# From https://github.com/pihart/ts/blob/572ce179d629f2426ed4f9d7f262fb2e70d9fed6/.github/workflows/semver.yml

name: NPM SemVer

on:
pull_request:
types: [ closed ]
branches: [ main ]

jobs:
semver:
runs-on: ubuntu-latest
if: "github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'semver: no-semver')"

steps:
- uses: actions/[email protected]
- run: |
git config --global user.name 'Avi Mehra'
git config --global user.email '[email protected]'
- uses: pihart/[email protected]
with:
label-prefix: "Semver:"
run-prefix: npm version
items: |
[
{
"label": "Major",
"run": "major"
},
{
"label": "Minor",
"run": "minor"
},
{
"label": "Patch",
"run": "patch"
},
{
"label": "Premajor",
"run": "premajor"
},
{
"label": "Preminor",
"run": "preminor"
},
{
"label": "Prepatch",
"run": "prepatch"
}
]
- run: |
git push --follow-tags origin HEAD:main
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/coverage
/dist
/tscdist
/node_modules
npm-debug.log*
deploy.sh
Expand Down
8 changes: 3 additions & 5 deletions package-lock.json

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

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "qboard",
"version": "0.1.1",
"description": "The efficient digital whiteboard.",
"main": "tscdist/lib/qboard.js",
"types": "tscdist/lib/qboard.d.ts",
"scripts": {
"build": "nwb build-react-app",
"clean": "nwb clean-app",
Expand All @@ -13,10 +15,15 @@
"stylelint:fix": "npm run stylelint -- --fix",
"predeploy": "npm run build",
"deploy": "node deploy.js",
"start": "nwb serve-react-app"
"start": "nwb serve-react-app",
"build:module": "tsc --outDir tscdist",
"prepublish": "npm run build:module"
},
"dependencies": {
"@mehra/ts": "^5.2.0",
"@types/fabric": "^3.6.8",
"@types/react": "^16.9.52",
"@types/react-modal": "^3.10.6",
"fabric": "^4.2.0",
"keyboardjs": "^2.6.4",
"pdfmake": "^0.1.70",
Expand All @@ -27,11 +34,8 @@
"tex-to-svg": "^0.2.0"
},
"devDependencies": {
"@types/fabric": "^3.6.8",
"@types/keyboardjs": "^2.5.0",
"@types/pdfmake": "^0.1.17",
"@types/react": "^16.9.52",
"@types/react-modal": "^3.10.6",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"awesome-typescript-loader": "^5.2.1",
Expand All @@ -51,7 +55,7 @@
"typescript": "^4.2.3"
},
"files": [
"./src/**/*"
"tscdist"
],
"bugs": {
"url": "https://github.com/cjquines/qboard/issues"
Expand Down
7 changes: 4 additions & 3 deletions src/lib/qboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class QBoard {
strokeUniform: true,
};

resizeCooldown: NodeJS.Timeout | undefined;
resizeCooldown: number | undefined;
currentObject: fabric.Object | undefined;
dragActive = false;
isDown = false;
Expand Down Expand Up @@ -229,8 +229,9 @@ export default class QBoard {
};

windowResize = (): void => {
if (this.resizeCooldown !== undefined) clearTimeout(this.resizeCooldown);
this.resizeCooldown = setTimeout(() => {
if (this.resizeCooldown !== undefined)
window.clearTimeout(this.resizeCooldown);
this.resizeCooldown = window.setTimeout(() => {
this.canvas.fitToWindow(this.canvasWidth, this.canvasHeight);
this.baseCanvas.fitToWindow(this.canvasWidth, this.canvasHeight);
}, 100);
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"jsx": "react",
"target": "ES2019",
Expand Down