Skip to content

Commit

Permalink
refactor: update deps, migrate to pnpm, changesets (#6)
Browse files Browse the repository at this point in the history
* refactor: update deps, svelte-kit, build

* build: add changesets

* refactor: migrate to pnpm

* style: run prettier & lint

* ci: fix add actions folder

* fix(ci): pnpm cache path

* fix(ci): missing shell property

* fix(example): build ssr

* refactor: rename example-app to site, fix build yet again

* fix(ci): cypress action missing package-lock.json

* fix(ci): missing cypress command

* fix(ci): remove cache: 'pnpm' since it's not installed before setup-node

* fix(e2e): wait longer in cypress tests for site to render

* build: add description to package.json

* fix(ci): restore Cypress from cache as well

* ci: see if cache is restored successfully
  • Loading branch information
TeemuKoivisto authored Sep 12, 2022
1 parent c73132a commit b20e9d9
Show file tree
Hide file tree
Showing 84 changed files with 27,474 additions and 18,743 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/green-snakes-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-tree-view': patch
---

refactor: migrate to pnpm
5 changes: 5 additions & 0 deletions .changeset/nervous-actors-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-tree-view': patch
---

style: run prettier & lint
File renamed without changes.
44 changes: 44 additions & 0 deletions .github/actions/build-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build-test
description: Build & run unit and Cypress tests

runs:
using: composite
steps:
- name: Build packages
run: pnpm -r build
shell: bash

- name: Run type check and unit tests
run: |
pnpm --filter svelte-tree-view svelte-check
pnpm --filter svelte-tree-view test:unit
shell: bash

- name: Run tests with Cypress
id: cypress
uses: cypress-io/github-action@v2
with:
install: false # Don't install Cypress again
cache-key: ${{ runner.os }}-node-${{ matrix.node-version }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
command: pnpm --filter svelte-tree-view cy run
start: pnpm --filter site dev
wait-on: 'http://localhost:5185'
project: ./packages/svelte-tree-view
browser: chrome
quiet: true

- name: Export screenshots (on failure only)
uses: actions/upload-artifact@v2.2.3
if: failure()
with:
name: cypress-screenshots
path: ./packages/svelte-tree-view/cypress/screenshots
retention-days: 7

- name: Export screen recordings (on failure only)
uses: actions/upload-artifact@v2.2.3
if: failure()
with:
name: cypress-videos
path: ./packages/svelte-tree-view/cypress/videos
retention-days: 7
26 changes: 26 additions & 0 deletions .github/actions/pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: pnpm
description: Setup pnpm and install dependencies

runs:
using: composite
steps:
- name: Setup caching
uses: actions/cache@v2
with:
path: |
.pnpm-store
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-${{ matrix.node-version }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-node-${{ matrix.node-version }}-pnpm-

- name: Install pnpm
run: npm i pnpm@7 -g
shell: bash

- name: Setup pnpm config
run: pnpm config set store-dir .pnpm-store
shell: bash

- name: Install dependencies
run: pnpm i --frozen-lockfile
shell: bash
32 changes: 13 additions & 19 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,37 @@ name: Deploy to Github Pages
on:
push:
branches:
- main
- master

workflow_dispatch:

jobs:
deployment:
timeout-minutes: 15
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Checkout Repo
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

- name: Install dependencies
run: yarn

- name: Build svelte-tree-view
run: |
cd core
chmod +x build.js
yarn build
- name: Install dependencies with pnpm
uses: ./.github/actions/pnpm

- name: Build example-app
run: |
cd example-app
yarn build:gh-pages
- name: Build
run: pnpm -r build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.GH_ACTIONS_DEPLOY_KEY }}
publish_dir: ./example-app/build
publish_dir: ./packages/site/build
108 changes: 0 additions & 108 deletions .github/workflows/npm-publish.yml

This file was deleted.

65 changes: 11 additions & 54 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,25 @@ on: [pull_request, workflow_dispatch]

jobs:
test:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Checkout Repo
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

- name: Load cached dependencies
uses: actions/cache@v2.1.5
id: cache
with:
path: |
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
id: install-dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install

- name: Run type check and unit tests
run: |
cd core
yarn svelte-check
yarn test:unit
- name: Build
run: |
cd core
chmod +x ./build.js
yarn build
- name: Install dependencies with pnpm
uses: ./.github/actions/pnpm

- name: Run tests with Cypress
id: cypress
uses: cypress-io/github-action@v2
with:
cache-key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
start: yarn --cwd ./example-app dev
wait-on: 'http://localhost:3000'
project: ./core
browser: chrome
quiet: true

- name: Export screenshots (on failure only)
uses: actions/upload-artifact@v2.2.3
if: failure()
with:
name: cypress-screenshots
path: ./core/cypress/screenshots
retention-days: 7

- name: Export screen recordings (on failure only)
uses: actions/upload-artifact@v2.2.3
if: failure()
with:
name: cypress-videos
path: ./core/cypress/videos
retention-days: 7
- name: Build & test
uses: ./.github/actions/build-test
Loading

0 comments on commit b20e9d9

Please sign in to comment.