Skip to content

Commit

Permalink
Remove webpack and unused packages; improve docs; work on github acti…
Browse files Browse the repository at this point in the history
…ons (#51)

* Merge remote-tracking branch 'nas/main' into old-head

- Remove webpack and substituted vite for remaining actions.
- Remove all unused devDependencies packages
- Update main.yml to deploy dev/ demo to GitHub Pages.
- Update main.yml to use GitHub official actions.
- Add MacOS bootstrap script to fetch and
  build all tools and crosswords-js package, run dev/ demo, then cleanup on vanilla MacBook.

modified:   .eslintrc.yml
    Remove webpack ref
modified:   .github/workflows/main.yml
    Deploy demo site from dev/
    Switch to github official actions for
    uploading artifacts and deploying to Pages
modified:   .gitignore
    Ignore rebase artifacts
new file:   bin/demo-macos.sh
    Bootstrap MacOS tools and packages, run dev/demo, then cleanup.
modified:   cspell.json
    more words
modified:   README.md
    Quickstart reference changed to package pulled from hub (npmjs.com)
modified:   dist/crosswords.css
modified:   dist/crosswords.js
new file:   dist/crosswords.umd.cjs
    Rebuilt via 'npm build'
modified:   package-lock.json
    Rebult via 'npm ci'
modified:   package.json
    Switch from yaml -> js-yaml
    Removed webpack
    Removed unused packages (determined by 'npx depcheck')
modified:   src/cell-map.mjs
modified:   src/crossword-controller.mjs
    Update location of newCellElement() in comments
modified:   src/crossword-model.mjs
    Change from yaml -> js-yaml
renamed:    dev/crosswords.js -> src/crosswords.js
    Add ../style/crosswords.less import to get
    vite to transpile src/crosswords.less -> dist/crosswords.css
deleted:    src/index.mjs
    src/crosswords.js contains package exports
modified:   test/crossword-model.specs.mjs
    Add bletchley to tested crosswords
    Refactor test on return value from newCrosswordModel()
    - null on failure, and model object otherwise
deleted:    test/index.specs.mjs
    TODO: replace with tests on  src/crosswords.js
new file:   vite.config.js
    Setup config for package 'build' action
    Add 'rollupOptions' hack to rename css file generated
    in src/crosswords.js

deleted:    webpack.config.js
deleted:    jsconfig.json
deleted:    pull-request.config
    Unused
deleted:    makefile
    Unused now. Using dev/ demo for dwmkerr.github.io
modified:   style/crosswords.less
modified:   dev/index.html
modified:   dev/index.js
    nfc

* chore: correct all contributors config (#46)

* build: deploy demo site on all builds to main

* docs: Update README.md

* refactor: improve styling code

* more css vars

* don't apply variables to :root

* dist

* :root out another

* dist

* fix merge conflicts more properly

* dist

* doc

* disst

* typo + docs + less calc

* update dist again

* Move docs to existing styling doc file

* add + use clue-label-width

* forgot dist again

* point to styling doc from root readme

---------

Co-authored-by: Misha Kaletsky <[email protected]>

* docs: add mmkal as a contributor for code, doc, and review (#49)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

* Extract git hook script from README.md and
add package "qa:install" action - adding production assets
build as suggested by @mmkal
Use github's deploy pages action in main.yml
README work on QA and workflow advice
Add MacOS environment scripts

new file:   .githook-pre-commit
    Extract script from README.md
    Add steps to build and stage distribution assets
modified:   .github/workflows/main.yml
    Add new Node LTS version (20.x)
    Use github's deploy pages action (actions/deploy-pages@v2)
modified:   .github/workflows/pull-request.yml
    Remove hardcoded ubuntu version
    Add new Node LTS version (20.x)
modified:   README.md
    Move documentation section to top of file
    De-nest sections under Quickstart
    Re-do "Setting up your dev environment"
        - add section on triangular workflow
        - specific bootstrap instructions for Linux/MacOS/Windows
    Re-do "Quality assurance"
        - Change pre-commit heredoc to action "qa:install"
        - Reference production assets building under "Manual checks"
renamed:    bin/bootstrap-linux.sh -> bin/bootstrap-posixish.sh
    Combine instructions for Linux/MacOS
modified:   bin/demo-macos.sh
    Repoint repo refs to dwmkerr
new file:   bin/install-githook.sh
    Add script to install QA hooks - used by action "qa:install"
modified:   bin/update-package.sh
    Add "npm ci" step
modified:   cspell.json
    More words
modified:   dev/index.js
    Fxup script location
modified:   dev/index.less
    nfc
modified:   dist/crosswords.css
modified:   dist/crosswords.js
modified:   dist/crosswords.umd.cjs
    Re-built
modified:   docs/crossword-styling.md
    Add script location for usage of --row-count, --column-count
    Add note for vite generation of CSS assets
modified:   package-lock.json
    Updated
modified:   package.json
    Switch yaml -> to js-yaml
    Change build action - vite replaces lessc call
    Change action - dev:prod -> dev:preview
    Add action qa:install to install git hook
    Drop action start:angular - broken; moving to separate repo
modified:   pull-request-config.sh
    Add vars for merge rollback location - process now includes
    fast-forward commits for simpler commit chains
modified:   src/crossword-cluesview.mjs
modified:   src/crossword-gridview.mjs
    Replace multiple addClass() calls with an addClasses() call
modified:   src/crossword-model.mjs
    Switch from yaml -> js-yaml
modified:   style/crosswords.less
    Resolve lint warnings - duplicate rules
    Sort cell sections to match layering order in DOM
    Amalgamate partial sections for same-names
modified:   style/cwdimensions.less
    Add code location for JS usage of --row-count, --column-count

* Fixes for GitHub Pages deployment.

modified:   .github/workflows/main.yml
    More work on GH Pages deploy
modified:   README.md
    Fix quickstart example to use "installed" crosswords-json
    Remove references to Angular sample
    Change 'pipeline' to 'workflow'
renamed:    bin/bootstrap-posixish.sh -> bin/bootstrap-posix-ish.sh
    Add dnf package manager
    Fix package action reference to "qa:install"
new file:   bin/build-dev.sh
    Add script for "dev:build" action
    Setup website folder structure for upload to GH Pages
modified:   cspell.json
    More words
modified:   package.json
    Change "dev:build" action to run new script "bin/build-dev.sh"

* Improve colour contrast for @highlight-color

* Add styles for for grid text colours

modified:   dev/index.less
modified:   dist/crosswords.css
modified:   style/crosswords.less
modified:   style/cwcolors.less

* Accessible colors. CSP.

modified:   cspell.json
modified:   dev/index.html
modified:   dev/index.less
modified:   style/crosswords.less

---------

Co-authored-by: Dave Kerr <[email protected]>
Co-authored-by: Misha Kaletsky <[email protected]>
Co-authored-by: Misha Kaletsky <[email protected]>
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Dec 22, 2023
1 parent 6a81f50 commit ddf8c9c
Show file tree
Hide file tree
Showing 38 changed files with 3,684 additions and 4,512 deletions.
15 changes: 15 additions & 0 deletions .githook-pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /usr/bin/env bash

# Assuming npm managed via nvm
export PATH=$PATH:$NVM_BIN
# Spellchecker
npm run spell &&
# Formatting
npm run prettier:fix &&
# Linting and formatting JS
npm run lint:fix &&
npm run test &&
# Compile production assets
npm run build &&
# Add production assets to git index
git add dist/
95 changes: 34 additions & 61 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ env:
jobs:
validate-main:

runs-on: ubuntu-20.04
# https://github.com/actions/runner-images#available-images
runs-on: ubuntu-latest

strategy:
matrix:
node-version:
- 16.x
- 18.x
- 20.x

steps:
- name: Checkout
Expand Down Expand Up @@ -55,30 +57,21 @@ jobs:
- name: test
run: npm run test:cov

# Upload the artifacts folder.
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
./artifacts/
# Only upload artifacts for the build on the LTS version (we don't
# need artifacts per node version).
if: ${{ matrix.node-version == env.NODE_LTS_VERSION }}

upload-coverage:
# The 'upload coverage' job will only run if successfully complete the
# 'validate-main' job.
needs: validate-main

runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
# Download the build artifacts.
- name: Download Artifacts
uses: actions/download-artifact@v3
# Upload the build artifacts.
- name: Upload coverage artifacts
# https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v3
with:
name: build-artifacts
# Created by npm run test:cov
path: ./artifacts

# Upload coverage.
Expand All @@ -87,47 +80,23 @@ jobs:
with:
directory: ./artifacts/coverage

deploy-demo-site:
# The 'deploy demo site' job will only run if successfully complete the
# 'validate-main' job.
needs: validate-main

runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v3

# Setup the right version of Node.js.
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_LTS_VERSION }}
registry-url: 'https://registry.npmjs.org'

# Fixup Git URLs, see:
# https://stackoverflow.com/questions/70663523/the-unauthenticated-git-protocol-on-port-9418-is-no-longer-supported
- name: Fix up git URLs
run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig

# Build the demo site.
- name: Build Demo Site
run: |
make build-sample-site
# Publish the demo site to GitHub pages.
- name: Publish Demo Site to GitHub Pages
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
folder: artifacts/sample-site

release-please:
# The 'release please' job will only run if successfully complete the
# 'validate-main' job. The deployment steps only occur if this is a release
# merge.
needs: validate-main

runs-on: ubuntu-20.04
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest

steps:
- name: Release Please
Expand Down Expand Up @@ -169,15 +138,19 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }}

# Build the demo site.
- name: Build Demo Site
run: |
make build-sample-site
if: ${{ steps.release.outputs.release_created }}
# Build and upload the demo application.

# Publish the demo site to GitHub pages.
- name: Publish Demo Site to GitHub Pages
uses: JamesIves/github-pages-deploy-action@releases/v4
- name: Build demo application
run: npm run dev:build
- name: Upload demo artifacts
# https://github.com/actions/upload-pages-artifact
uses: actions/upload-pages-artifact@v2
with:
folder: artifacts/sample-site
if: ${{ steps.release.outputs.release_created }}
# Created by npm run dev:prod
path: dev/dist/
# Publish the demo (from "Upload demo artifacts") to GitHub pages.
- name: Deploy to GitHub Pages
id: deployment
# https://github.com/actions/deploy-pages
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action

5 changes: 3 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ on: [pull_request]

jobs:
validate-pull-request:
runs-on: ubuntu-20.04

# https://github.com/actions/runner-images#available-images
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16.x
- 18.x
- 20.x

steps:
- name: Checkout
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ dev/dist/

# Rebase artefacts
git-rebase-todo*
rebase*.log
*.log
*.reflog

# VS Code CLI - enable remote tunnels
code
Loading

0 comments on commit ddf8c9c

Please sign in to comment.