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

feat: CSS-235 Change to tsup #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
44 changes: 0 additions & 44 deletions .babelrc

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: publish-npm
on:
workflow_dispatch:

push:
paths:
- '**'
- .github/workflows/publish-npm.yml
branches:
- 'master'
pull_request:
paths:
- '**'
- .github/workflows/publish-npm.yml
branches:
- 'master'

defaults:
run:
working-directory: .

jobs:
validate-npm:
if: github.event_name == 'pull_request'

runs-on: ubuntu-latest

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # organization secret

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Mark git checkout as safe
run: git config --global --add safe.directory $GITHUB_WORKSPACE

- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: yarn
cache-dependency-path: yarn.lock

- name: install dependencies
run: |
echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > .npmrc
yarn config set unsafe-perm true
yarn install --frozen-lockfilec

- name: Validate NPM
run: yarn validate
publish-npm:
if: github.event.ref == 'refs/heads/master'

runs-on: ubuntu-latest

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # organization secret

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: master

- name: Mark git checkout as safe
run: git config --global --add safe.directory $GITHUB_WORKSPACE

- name: install dependencies
run: |
echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > .npmrc
yarn config set unsafe-perm true
yarn install --frozen-lockfilec

- name: Publish to NPM
run: npm publish
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
/node_modules
/.pnp
.pnp.js
/lib
/es

# build
/dist

# testing
/coverage

# production
/build

# misc
.DS_Store
.env
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.16.0
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.4.0] - 2023-10-17

### Added
- Added CHANGELOG.md

### Changed
- Replaced react-scripts with tsup

### Removed
- Removed babel and its plugins
- Removed unnecessary assets
46 changes: 9 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,28 @@
{
"name": "react-algolia",
"version": "1.3.1",
"name": "@a-cloud-guru/react-algolia",
"version": "1.4.0",
"license": "MIT",
"main": "lib/index.js",
"module": "es/index.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"description": "React algolia library",
"repository": "https://github.com/kyle-ruan/react-algolia.git",
"author": "Kyle Ruan",
"dependencies": {
"algoliasearch": "^3.33.0",
"lodash": "^4.17.15",
"use-deep-compare-effect": "^1.3.0"
},
"scripts": {
"start": "react-scripts start",
"test": "react-scripts test",
"eject": "react-scripts eject",
"clean": "rm -rf ./lib ./es ./node_modules",
"clean": "rm -rf ./dist ./node_modules",
"prebuild": "yarn run clean && yarn",
"build": "yarn build:commonjs && yarn build:es",
"build:commonjs": "BABEL_ENV=commonjs babel src/lib --out-dir lib",
"build:es": "BABEL_ENV=es babel src/lib --out-dir es",
"prepublishOnly": "rm -rf es lib && yarn build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
"build": "tsup",
"prepublishOnly": "rm -rf ./dist && yarn build",
"validate": "echo 'Please add validate step'"
},
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.2",
"bluebird": "^3.5.5",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-json-view": "^1.19.1",
"react-scripts": "^3.1.1"
"tsup": "^7.2.0"
},
"peerDependencies": {
"react": "^16.8.1"
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
43 changes: 0 additions & 43 deletions public/index.html

This file was deleted.

Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

2 changes: 0 additions & 2 deletions public/robots.txt

This file was deleted.

7 changes: 0 additions & 7 deletions src/logo.svg

This file was deleted.

13 changes: 13 additions & 0 deletions tsup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["src/index.js"],
target: ["es2020"],
format: ["esm", "cjs"],
splitting: false,
sourcemap: true,
clean: true,
loader: {
".js": "jsx",
},
});
Loading