Skip to content

Commit

Permalink
feat: updated all dependencies + improved return typing with overload…
Browse files Browse the repository at this point in the history
…s for the search function
  • Loading branch information
yann510 committed Sep 11, 2023
1 parent d97d107 commit 2aa1b09
Show file tree
Hide file tree
Showing 118 changed files with 27,074 additions and 32,867 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
42 changes: 42 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
35 changes: 18 additions & 17 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.13.1]

steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.5.0
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}

Expand All @@ -25,32 +21,37 @@ jobs:
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2-beta
- name: Setup node.js 18
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: 18

- name: Install NPM packages
run: npm i
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: |
./node_modules
key: modules-${{ hashFiles('package-lock.json') }}

- name: Bootstrap Lerna
run: npx lerna bootstrap
- name: Install NPM packages
run: npm ci

- name: Lint files
run: npx lerna run lint
run: npm run lint:all

- name: Run tests
run: npx lerna run test
run: npm run test:all

- name: Build apps
run: npx lerna run build
run: npm run build:all

- name: Run benchmark
run: npm run benchmark --prefix packages/ss-search
run: npm run benchmark

- name: Release + Deploy
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: npx lerna run semantic-release
run: npm run semantic-release:all
45 changes: 38 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
.idea
node_modules
packages/ss-search/lib
.nyc_output
coverage
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist
packages/api/
.DS_Store
tmp
/out-tsc

# dependencies
node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/extensions.json
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
10 changes: 4 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"tabWidth": 4,
"printWidth": 160,
"semi": false,
"trailingComma": "all"
}
"singleQuote": true,
"semi": false,
"printWidth": 140
}
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"firsttris.vscode-jest-runner"
]
}
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
![](demo.gif)

If you're not convinced yet, take a look at this interactive
[demo](https://ss-search.netlify.app/).
[demo](https://ss-search.netlify.app/).

## Install
ss-search is available on [npm](https://www.npmjs.com/package/ss-search). It can be installed with the following command:

`npm install ss-search`
`npm install ss-search`

## Usage

Expand Down Expand Up @@ -107,7 +107,7 @@ const results = search(data, ["object.nestedProperty"], "property")
#### Array

Providing a key which refers to an array will stringify that array using JSON.stringify

```javascript
const results = search(data, ["array"], "value2")
// results: will return our original dataset
Expand Down Expand Up @@ -137,16 +137,13 @@ How does it compare to other search libraries? Test out for yourself with this i

### Developing

To better manage dependencies across the monorepo I'm using [lerna](https://github.com/lerna/lerna).

The following command will install lerna (and other depedencies) and install the depedencies of all the packages of the repository.

```npm i && npx lerna bootstrap --hoist```
To better manage dependencies across the monorepo I'm using [NX](https://nx.dev/).

#### Commit format
Install dependencies:
```npm i```

To make things easier for all contributors, I'm using [commitizen](https://github.com/commitizen/cz-cli) to enforce compatible commit messages with [semantic-release](https://github.com/semantic-release/semantic-release).
Also, to make sure it is enforced, I'm using [husky](https://github.com/typicode/husky) to easily add validation hooks.
When you run `git commit` you will be prompted with an interactive CLI to help you with the formatting of your commit message.
Start the web-app:
```npm run web-app:serve```

TLDR: making a contribution is easy peasy and you cannot go wrong ;)
Test the library:
```npm run test:all```
18 changes: 18 additions & 0 deletions apps/web-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
11 changes: 11 additions & 0 deletions apps/web-app/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'web-app',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/web-app',
};
65 changes: 65 additions & 0 deletions apps/web-app/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "web-app",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/web-app/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/rspack:rspack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"target": "web",
"outputPath": "dist/apps/web-app",
"main": "apps/web-app/src/main.tsx",
"tsConfig": "apps/web-app/tsconfig.app.json",
"rspackConfig": "apps/web-app/rspack.config.js",
"assets": ["apps/web-app/src/favicon.ico", "apps/web-app/src/assets"]
},
"configurations": {
"development": {
"mode": "development"
},
"production": {
"mode": "production",
"optimization": true,
"sourceMap": false
}
}
},
"serve": {
"executor": "@nx/rspack:dev-server",
"options": {
"buildTarget": "web-app:build:development"
},
"configurations": {
"development": {},
"production": {
"buildTarget": "web-app:build:production"
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/web-app/**/*.{ts,tsx,js,jsx}"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/web-app/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": []
}
5 changes: 5 additions & 0 deletions apps/web-app/rspack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { composePlugins, withNx, withWeb } = require('@nx/rspack')

module.exports = composePlugins(withNx(), withWeb(), (config) => {
return { ...config, devServer: { ...config.devServer, historyApiFallback: true } }
})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="%PUBLIC_URL%/apps/web-app/src/assets/manifest.jsonsrc/assets/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 2aa1b09

Please sign in to comment.