Skip to content

Commit

Permalink
Merge pull request #1 from savanesoff/initial-release
Browse files Browse the repository at this point in the history
Initial release
  • Loading branch information
savanesoff committed Jul 9, 2023
2 parents 70db8f6 + 4f7b04c commit 8016db9
Show file tree
Hide file tree
Showing 17 changed files with 492 additions and 212 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.3.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/stale-walls-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"devtools-chopper": minor
---

Initial NPM release
51 changes: 51 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish NPM Package
on:
push:
branches:
- "main"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "publish"
cancel-in-progress: false

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "pnpm"
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

- run: pnpm install --frozen-lockfile

- name: NPM Release
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Deploy Github Page
run: pnpm run deploy:demo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_dir: public
44 changes: 44 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Unit Tests
run-name: ${{ github.actor }} is running unit tests... 🚀
on:
pull_request:
types: [opened, synchronize, reopened, updated]

jobs:
cache-and-install:
runs-on: ubuntu-latest

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

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: run tests
run: pnpm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ typings/
# Nuxt.js build / generate output
.nuxt
dist
dist-demo

# Gatsby files
.cache/
Expand Down
55 changes: 55 additions & 0 deletions demo-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# replaces tsconfig.json with custom tsconfig.json specified by the user
# to build demo app with custom tsconfig.json using vite
# Usage: demo-build.sh --path <path-to-custom-ts-config>
# Example: demo-build.sh --path ./tsconfig.demo.json
# Note: tsconfig.json is renamed to tsconfig.json.bak
# Note: tsconfig.json.bak is renamed to tsconfig.json after the build
# Don't forget to ensure "build.outDir" is set to "dist-demo" in vite.config.ts
# "build": {
# "outDir": "dist-demo",
# }
# Also, ensure it matches custom ts config "outDir" value

if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit 1
fi

if [ $1 != "--path" ]
then
echo "--path argument is required"
echo "Usage: demo-build.sh --path <path-to-custom-ts-config>"
echo $1
exit 1
fi

if [ -z $2 ]
then
echo "--path value is required"
echo "Usage: demo-build.sh --path <path-to-custom-ts-config>"
exit 1
fi
# extract the path to the custom ts config
CUSTOM_TS_CONFIG=$2
echo "path to custom ts config: $CUSTOM_TS_CONFIG"

# rename the tsconfig.json to tsconfig.json.bak
mv ./tsconfig.json ./tsconfig.json.bak

# copy the custom ts config to tsconfig.json
cp $CUSTOM_TS_CONFIG ./tsconfig.json

# searchString="/dist/"
# replaceString="/dist-demo/"
# filename="package.json"
# sed -i s:$searchString:$replaceString:gi $filename
# "types": "./dist/types/index.d.ts",
# "main": "./dist/index.js",
# build the library
echo "building library"
pnpm tsc && pnpm vite build --base=./


# rename the tsconfig.json.bak to tsconfig.json
mv ./tsconfig.json.bak ./tsconfig.json
14 changes: 0 additions & 14 deletions demo/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { useState } from "react";
import "./App.css";
import "./chopper";

function App() {
const [count, setCount] = useState(0);

return (
<>
<h1>devtools-chopper</h1>
Expand All @@ -14,17 +11,6 @@ function App() {
capabilities.
</p>
<div></div>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
);
}
Expand Down
61 changes: 55 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,51 @@
"name": "devtools-chopper",
"private": true,
"version": "0.0.0",
"license": "MIT",
"description": "Chopper is a Javascript log display devtool which allows you to monitor application logs in DOM",
"bugs": {
"url": "https://github.com/savanesoff/devtools-chopper/issues"
},
"homepage": "https://savanesoff.github.io/devtools-chopper",
"keywords": [
"logger",
"dom logger",
"control points",
"overdrag",
"log monitor"
],
"type": "module",
"author": {
"name": "Samvel Avanesov",
"email": "sam.avanesoff@gmail.com"
},
"packageManager": "^pnpm@8.6.6",
"release": {
"branches": [
"main"
]
},
"publishConfig": {
"access": "public"
},
"types": "./dist/types/index.d.ts",
"main": "./dist/index.js",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
"clean:demo": "rm -rf ./dist-demo",
"build:demo": "bash ./demo-build.sh --path tsconfig.build.demo.json",
"deploy:demo": "pnpm run build:demo && gh-pages -d dist-demo",
"preview": "vite preview",
"clean": "rm -rf ./dist",
"build": "pnpm run clean && pnpm run build:esm",
"build:esm": "tsc -p ./tsconfig.build.json && mv ./dist/index.js ./dist/index.mjs",
"prepack": "pnpm run build",
"test": "vitest --run",
"release": "pnpm build && pnpm test && pnpm changeset publish"
},
"devDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@changesets/cli": "^2.26.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/dom": "^9.3.1",
"@testing-library/react": "^14.0.0",
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
Expand All @@ -22,13 +56,28 @@
"eslint": "^8.38.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"gh-pages": "^5.0.0",
"jsdom": "^22.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.0.2",
"vite": "^4.3.9",
"vitest": "^0.32.4",
"vitest-dom": "^0.1.0"
},
"dependencies": {
"overdrag": "^1.0.1"
}
},
"exports": {
".": {
"import": {
"types": "./dist/types/index.d.ts",
"default": "./dist/index.mjs"
}
},
"./package.json": "./package.json"
},
"files": [
"dist/**/*"
]
}

0 comments on commit 8016db9

Please sign in to comment.