Skip to content

Commit

Permalink
Dependency updates (#174)
Browse files Browse the repository at this point in the history
* save stuff

* more updates

* update actions

* fixed tsconfig

---------

Co-authored-by: Rogin Farrer <[email protected]>
  • Loading branch information
roginfarrer and Rogin Farrer authored May 23, 2024
1 parent cd52db0 commit b006604
Show file tree
Hide file tree
Showing 40 changed files with 12,123 additions and 12,555 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,12 @@ jobs:
fetch-depth: 2

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

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
node-version-file: ".nvmrc"
cache: "pnpm"

- name: Install Dependencies
run: pnpm install
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- uses: pnpm/action-setup@v2

- name: Setup Node.js
uses: actions/setup-node@main
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
node-version-file: ".nvmrc"
cache: "pnpm"

- name: Install dependencies
run: pnpm i
Expand Down
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
registry = https://registry.npmjs.org
public-hoist-pattern[]=*storybook*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
20
1 change: 1 addition & 0 deletions .prettierrc.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019-2023, Rogin Farrer
Copyright (c) 2019-2024, Rogin Farrer

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
24 changes: 12 additions & 12 deletions example/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import * as React from 'react'
import * as ReactDOM from 'react-dom/client'
import { useCollapse } from '@collapsed/react'
import * as React from "react";
import * as ReactDOM from "react-dom/client";
import { useCollapse } from "@collapsed/react";

const collapseStyles = { background: 'blue', color: 'white' }
const collapseStyles = { background: "blue", color: "white" };

export const Uncontrolled = () => {
const { getCollapseProps, getToggleProps, isExpanded } = useCollapse({
defaultExpanded: true,
})
});

return (
<div>
<button {...getToggleProps({ style: { marginRight: 4 } })}>
{isExpanded ? 'Close' : 'Open'}
{isExpanded ? "Close" : "Open"}
</button>
<div
{...getCollapseProps({
Expand All @@ -29,16 +29,16 @@ export const Uncontrolled = () => {
and people going to work.
</div>
</div>
)
}
);
};

const App = () => {
return (
<div>
<Uncontrolled />
</div>
)
}
);
};

const root = ReactDOM.createRoot(document.getElementById('root')!)
root.render(<App />)
const root = ReactDOM.createRoot(document.getElementById("root")!);
root.render(<App />);
59 changes: 30 additions & 29 deletions internal/build/index.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,63 @@
const fs = require('fs')
const path = require('path')
const { defineConfig } = require('tsup')
import * as fs from "node:fs";
import * as path from "node:path";
import { defineConfig } from "tsup";

function getTsupConfig(entry, { packageName, packageVersion, external = [] }) {
entry = Array.isArray(entry) ? entry : [entry]
external = [...new Set(['react', 'react-dom']), ...external]
let banner = createBanner(packageName, packageVersion)
export function getTsupConfig(
entry,
{ packageName, packageVersion, external = [] },
) {
entry = Array.isArray(entry) ? entry : [entry];
external = ["react", "react-dom", ...external];
let banner = createBanner(packageName, packageVersion);
return defineConfig([
// cjs.dev.js
{
entry,
format: 'cjs',
format: "cjs",
sourcemap: true,
outExtension: getOutExtension('dev'),
outExtension: getOutExtension("dev"),
external,
banner: { js: banner },
define: {
'process.env.NODE_ENV': 'true',
"process.env.NODE_ENV": "true",
},
target: 'es2016',
target: "es2016",
},

// cjs.prod.js
{
entry,
format: 'cjs',
format: "cjs",
minify: true,
minifySyntax: true,
outExtension: getOutExtension('prod'),
outExtension: getOutExtension("prod"),
external,
define: {
'process.env.NODE_ENV': 'false',
"process.env.NODE_ENV": "false",
},
target: 'es2016',
target: "es2016",
},

// esm
{
entry,
dts: { banner },
format: 'esm',
format: "esm",
external,
banner: { js: banner },
define: {
'process.env.NODE_ENV': 'true',
"process.env.NODE_ENV": "true",
},
target: 'es2020',
target: "es2020",
},
])
]);
}

/**
* @param {"dev" | "prod"} env
*/
function getOutExtension(env) {
return ({ format }) => ({ js: `.${format}.${env}.js` })
return ({ format }) => ({ js: `.${format}.${env}.js` });
}

/**
Expand All @@ -72,16 +75,14 @@ function createBanner(packageName, version) {
*
* @license MIT
*/
`
`;
}

function getPackageInfo(packageRoot) {
export function getPackageInfo(packageRoot) {
let packageJson = fs.readFileSync(
path.join(packageRoot, 'package.json'),
'utf8'
)
let { version, name } = JSON.parse(packageJson)
return { version, name }
path.join(packageRoot, "package.json"),
"utf8",
);
let { version, name } = JSON.parse(packageJson);
return { version, name };
}

module.exports = { getTsupConfig, getPackageInfo }
5 changes: 3 additions & 2 deletions internal/build/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@collapsed-internal/build",
"type": "module",
"private": true,
"version": "0.0.0",
"devDependencies": {
"tsup": "^6.5.0"
"dependencies": {
"tsup": "^8"
},
"main": "index.js",
"types": "index.d.ts",
Expand Down
12 changes: 12 additions & 0 deletions internal/eslint-config-collapsed/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
extends: ["plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"prefer-const": "off",
},
};
11 changes: 0 additions & 11 deletions internal/eslint-config-collapsed/index.js

This file was deleted.

11 changes: 3 additions & 8 deletions internal/eslint-config-collapsed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"eslint": "^8.38.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-rogin": "1.0.0",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"moduleResolution": "Bundler",
"esModuleInterop": true,
"skipLibCheck": true
}
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,21 @@
"release": "pnpm build && changeset publish"
},
"dependencies": {
"@changesets/cli": "^2.25.2",
"@changesets/cli": "^2.27.3",
"@collapsed-internal/tsconfig": "workspace:*",
"@types/node": "^16.7.13",
"@types/node": "^20",
"buffer": "^5.5.0",
"eslint": "^8.0.0",
"eslint-config-collapsed": "workspace:*",
"np": "^6.4.0",
"prettier": "^2.3.2",
"prettier": "^3",
"process": "^0.11.10",
"turbo": "^1.8.8",
"typescript": "^4.9"
"turbo": "^1.13.3",
"typescript": "^5.4.5"
},
"prettier": "eslint-config-rogin/prettier",
"alias": {
"process": "process/browser.js",
"buffer": "buffer"
},
"packageManager": "pnpm@7.30.3"
"packageManager": "pnpm@9.1.2"
}
4 changes: 2 additions & 2 deletions packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['collapsed'],
}
extends: ["../../internal/eslint-config-collapsed/index.cjs"],
};
10 changes: 5 additions & 5 deletions packages/core/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'],
testMatch: ['<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}'],
}
preset: "ts-jest",
testEnvironment: "jsdom",
setupFilesAfterEnv: ["<rootDir>/jest-setup.ts"],
testMatch: ["<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}"],
};
16 changes: 8 additions & 8 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"description": "A framework-agnostic utility for creating flexible and accessible expand/collapse components.",
"license": "MIT",
"source": "src/index.ts",
"main": "dist/index.cjs.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
"require": "./dist/index.cjs.js",
"import": "./dist/index.mjs"
},
"files": [
"dist"
],
Expand All @@ -20,18 +21,17 @@
"release": "np --no-2fa"
},
"devDependencies": {
"@collapsed-internal/tsconfig": "workspace:*",
"@collapsed-internal/build": "workspace:*",
"eslint-config-collapsed": "workspace:*",
"@collapsed-internal/tsconfig": "workspace:*",
"@testing-library/jest-dom": "^5.16.0",
"@types/testing-library__jest-dom": "^5.14.5",
"@types/jest": "^27.0.2",
"@types/node": "^16.7.13",
"@types/testing-library__jest-dom": "^5.14.5",
"eslint-config-collapsed": "workspace:*",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"ts-jest": "^29.0.3",
"tslib": "^2.4.1",
"tsup": "^6.5.0"
"tsup": "^8"
},
"dependencies": {
"tiny-warning": "^1.0.3"
Expand Down
7 changes: 5 additions & 2 deletions packages/react-collapsed/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
extends: ['collapsed', 'collapsed/react'],
}
extends: [
"../../internal/eslint-config-collapsed/index.cjs",
"../../internal/eslint-config-collapsed/react.cjs",
],
};
Loading

0 comments on commit b006604

Please sign in to comment.