/nvtsk-deploy-gh

NPM библиотека для публикации проекта в github-pages из командной строки

Primary LanguageTypeScript

Deploy to github-pages

NPM

Node.js Package NPM Version GitHub repo size NPM Unpacked Size

Lint and Test Endpoint Badge


cli application for deploy to github-pages

Usage

Allows to declare build command to build project and require directory name where built project will be. If build is not need it will just use directory with ready build.

Run with dialog:

npx nvtsk-deploy-gh

alt text

Run with command-line arguments

npx nvtsk-deploy-gh --build "npm run build" --dir dist

npm package settings

package.json

  "name": "nvtsk-deploy-gh",
  "version": "1.0.2",
  "main": "./dist/index.js",
  "bin": {
    "nvtsk-deploy-gh": "dist/index.js"
  },
  "types": "./dist/index.d.ts",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/v-nvtsk/otus-jsbasic-dz50-nodejs.git"
  },

Deploy to npmjs with github-action workflow. Distributive entry-point file with bundle is prepended with a line with shebang which runs js file in node.js

#!/usr/bin/env -S node

/*! For license information please see index.js.LICENSE.txt */
(()=>{var e,t,r,n,i={36776:(e,t,r)=>{"use strict";var n=r(2203).Stream,i=r(88179);function o(e,t,r){var o=i(e||function(e){this.
...

Used algorithm

./dist is used here as an example path

  1. Make sure you are on the branch that contains the "dist/" directory you want to publish, or on the branch that is able to build:

  2. Stash the contents of the "dist/" directory:

git add dist
git stash push --keep-index
  1. If the gh-pages branch does not exist, create it:
git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "Initializing gh-pages branch"
git push -u origin gh-pages
  1. Check out the gh-pages branch
git checkout gh-pages
  1. Apply the stash that contains your "dist/" directory (this will restore the "dist/" directory):
git stash pop
  1. Stage "dist/" directory and move the contents of the "dist/" directory to the root of the repository:
git add dist
git mv -f dist/* .
git reset HEAD -- dist
  1. Add all the new files to the gh-pages branch, commit, and push to GitHub;
git commit -m "deploy"
git push origin gh-pages

GIF made with asciinema

Installation - asciinema docs

asciinema docs

install asciinema

asciinema creates cast files from terminal. agg is instrument to create gifs from cast files.

Visit latest release page, and download a binary appropriate for your system.

For 64-bit x86 system choose a file with x86_64 in the name. For ARMv8 (64-bit, e.g. Apple Silicon) choose a file with aarch64. For ARMv7 (32-bit, e.g. Raspberry Pi) choose a file with arm.

Make it executable and put it somewhere in $PATH:

chmod a+x agg
sudo mv agg /usr/local/bin```

start rec to your_script_name.cast cast-file

asciinema rec ./your_script_name.cast

convert cast-file to gif your_gif_file.gif

agg ./your_script_name.cast ./your_gif_file.gif