Skip to content

Commit

Permalink
deps: remove unused deps and dep-check in CI (#2206)
Browse files Browse the repository at this point in the history
* chore: removing a few obvious unused deps

* deps: remove ipfs-core-types

* test: get available port for e2e testing

* deps: remove more unused deps

* chore: temporarily disable findLocations test

This test was failing consistently when running test:unit locally

* test(e2e): increase two explore test timeouts

* deps: remove unused babel plugins

* deps: remove npm dnslink-simple

* deps: remove ipfs-core-utils

* deps: remove jest-watch-typeahead

* chore: run dep-check in CI

* chore: fix depcheck CI name
  • Loading branch information
SgtPooki committed Feb 6, 2024
1 parent 5abc5d0 commit 8459a24
Show file tree
Hide file tree
Showing 13 changed files with 16,425 additions and 6,553 deletions.
89 changes: 89 additions & 0 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

/** @type {import('aegir').PartialOptions} */
export default {
dependencyCheck: {
ignore: [
// actual production deps not getting recognized
'@tableflip/react-dropdown',
'brace',
'chart.js',
'classnames',
'details-polyfill',
'internal-nav-helper',
'is-ipfs',
'istextorbinary',
'react-ace',
'react-chartjs-2',
'react-copy-to-clipboard',
'react-country-flag',
'react-debounce-render',
'react-dnd',
'react-hook-form',
'react-identicons',
'react-joyride',
'react-overlays',
'uint8arrays',

// type-only deps
'ipfs',

// webpack deps
'crypto-browserify',
'os-browserify',
'path-browserify',
'stream-browserify',
'fake-indexeddb',

// test deps
'enzyme',
'enzyme-adapter-react-16',
'jest',
'jest-environment-jsdom', // in npm script via --env=jsdom

// storybook deps
'@storybook/addons', // for types
'@storybook/addon-a11y',
'@storybook/addon-actions',
'@storybook/addon-controls',
'@storybook/addon-coverage',
'@storybook/addon-essentials',
'@storybook/addon-links',
'@storybook/builder-webpack5', // storybookConfig.core.builder
'@storybook/core-common', // types
'@storybook/manager-webpack5', // implicit storybook dep
'@storybook/preset-create-react-app',

// npm scripts
'wait-on',

// github CI
'nyc',
'semantic-release'
],

developmentIgnorePatterns: [
'src/**/*.js',
'!.aegir.js',
'!.eslintrc.cjs',
'!config-overrides.js',
'!custom-release-notes-generator.cjs',
'!postcss.config.js',
'!**/*.test.js',
'!**/*.stories.js',
'!test/**',
'!src/setupTests.js'
],

productionIgnorePatterns: [
'.aegir.js',
'.eslintrc.cjs',
'config-overrides.js',
'custom-release-notes-generator.cjs',
'postcss.config.js',
'**/*.test.js',
'**/*.stories.js',
'test/**',
'src/setupTests.js'
]
}
}
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,20 @@ jobs:
needs: build
uses: ./.github/workflows/eslint.yml

# separate check for dep-check
depcheck:
name: depcheck
needs: build
uses: ./.github/workflows/depcheck.yml

# automatically commit new tag and changelog updates when a push to main happens.
# This will then trigger
# 1. The 'ci.yml' workflow for the newly committed git tag,
# 2. The 'publish-release-build.yml' workflow
release:
name: 'Run semantic release'
runs-on: ubuntu-latest
needs: [build, publishPreview, eslint, typecheck, test-e2e, test-unit, test-storybook]
needs: [build, publishPreview, eslint, typecheck, depcheck, test-e2e, test-unit, test-storybook]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3.6.0
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/depcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
workflow_call:

jobs:
depcheck:
name: dep-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.6.0

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18.14.0
cache: 'npm'

- name: Install dependencies
run: npm ci --prefer-offline --no-audit --progress=false

- name: Dependency check
run: npm run dep-check
1 change: 0 additions & 1 deletion .storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/esm-extensions */
/**
* @file StoryBook configuration file
* @see https://github.com/storybookjs/storybook/blob/master/MIGRATION.md#from-version-52x-to-53x
Expand Down
2 changes: 0 additions & 2 deletions config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const PURE_ESM_MODULES = [
// 'ipld-explorer-components',
'@chainsafe/is-ip',
'@multiformats/multiaddr',
'@libp2p/interface',
'dag-jose',
'uint8arrays'
]
Expand Down Expand Up @@ -140,7 +139,6 @@ const configOverride = {
moduleNameMapper: {
...config.moduleNameMapper,
'multiformats/basics': '<rootDir>/node_modules/multiformats/dist/src/basics.js',
'@libp2p/interface/errors': '<rootDir>/node_modules/@libp2p/interface/dist/src/errors.js',
'multiformats/bases/base32': '<rootDir>/node_modules/multiformats/dist/src/bases/base32.js',
'multiformats/bases/base58': '<rootDir>/node_modules/multiformats/dist/src/bases/base58.js',
'multiformats/cid': '<rootDir>/node_modules/multiformats/dist/src/cid.js',
Expand Down
10 changes: 0 additions & 10 deletions ipfs-core-types/index.d.ts

This file was deleted.

Loading

0 comments on commit 8459a24

Please sign in to comment.