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

refactor: update deps, migrate to pnpm, changesets #6

Merged
merged 16 commits into from
Sep 12, 2022
Merged
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
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