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

chore!: upgrade stuff #113

Merged
merged 2 commits into from
Oct 29, 2023
Merged
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
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
name: ci

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
setup-dependencies:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16, 18]
node-version: [16, 18, 20]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ $RECYCLE.BIN/
# Synk
.dccache

# Lyra output
lyra/
# Orama output
orama/

# End of https://www.toptal.com/developers/gitignore/api/node,osx,windows,linux,visualstudiocode
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🌠 Asterism

Asterism is a CLI that provides a set of tools to build a [Lyra](https://github.com/lyrasearch/lyra) instance from your favorite database.
Asterism is a CLI that provides a set of tools to build a [Orama](https://github.com/orama/orama) instance from your favorite database.

[![Tests](https://github.com/mateonunez/asterism/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mateonunez/asterism/actions/workflows/ci.yml)

Expand All @@ -9,13 +9,13 @@ Asterism is a CLI that provides a set of tools to build a [Lyra](https://github.
### 📦 Installation

```bash
# You can install Lyra using `npm`, `yarn`, `pnpm`:
# You can install Orama using `npm`, `yarn`, `pnpm`:
npm install -g @mateonunez/asterism
```

### 📝 Usage

> Asterism provides a CLI that can be used to generate a Lyra instance from a database. The CLI can be used as follows:
> Asterism provides a CLI that can be used to generate a Orama instance from a database. The CLI can be used as follows:

```bash
Usage: asterism [options] [command]
Expand All @@ -27,9 +27,9 @@ Options:
-h, --help display help for command

Commands:
migrate [options] [database] Initialize a new Lyra instance from your
migrate [options] [database] Initialize a new Orama instance from your
current database
search [options] [term] Search for a Lyra instance in your instances
search [options] [term] Search for a Orama instance in your instances
help [command] display help for command
```

Expand All @@ -40,7 +40,7 @@ Commands:

Usage: asterism migrate [options] [database]

Initialize a new Lyra instance from your current database
Initialize a new Orama instance from your current database

Arguments:
database The database to migrate
Expand All @@ -57,7 +57,7 @@ Options:
--help display help for command
```

The CLI provides a `migrate` command that can be used to generate a Lyra instance from a database. The command can be used as follows:
The CLI provides a `migrate` command that can be used to generate a Orama instance from a database. The command can be used as follows:

```bash
> asterism migrate
Expand All @@ -70,14 +70,14 @@ The CLI provides a `migrate` command that can be used to generate a Lyra instanc

Usage: asterism search [options] [term]

Search for a Lyra instance in your instances
Search for a Orama instance in your instances

Arguments:
term The term to search for

Options:
-c, --cacheDisabled Disable cache
-i, --inputDir <inputDir> Lyra databases directory (default: "./lyra")
-i, --inputDir <inputDir> Orama databases directory (default: "./orama")
-o, --outputDir <outputDir> Output directory to save results in a JSON
(default: "./out")
-h, --help display help for command
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "@masteonunez/asterism",
"version": "0.0.5",
"description": "Asterism is a CLI that provides a set of tools to build a Lyra instance from your favorite database.",
"description": "Asterism is a CLI that provides a set of tools to build a Orama instance from your favorite database.",
"scripts": {
"asterism": "node ./packages/cli/cli.mjs",
"prepare": "husky install",
"lint": "pnpm -r --workspace-concurrency=1 lint",
"test": "pnpm -r --workspace-concurrency=1 test"
"lint:fix": "pnpm -r --workspace-concurrency=1 lint:fix",
"test": "pnpm -r --workspace-concurrency=1 test",
"services": "docker-compose up -d"
},
"devDependencies": {
"husky": "^8.0.3"
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🌠 Asterism

Asterism is a CLI that provides a set of tools to build a [Lyra](https://github.com/lyrasearch/lyra) instance from your favorite database.
Asterism is a CLI that provides a set of tools to build a [Orama](https://github.com/orama/orama) instance from your favorite database.

[![Tests](https://github.com/mateonunez/asterism/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mateonunez/asterism/actions/workflows/ci.yml)

Expand All @@ -9,13 +9,13 @@ Asterism is a CLI that provides a set of tools to build a [Lyra](https://github.
### 📦 Installation

```bash
# You can install Lyra using `npm`, `yarn`, `pnpm`:
# You can install Orama using `npm`, `yarn`, `pnpm`:
npm install -g @mateonunez/asterism
```

### 📝 Usage

> Asterism provides a CLI that can be used to generate a Lyra instance from a database. The CLI can be used as follows:
> Asterism provides a CLI that can be used to generate a Orama instance from a database. The CLI can be used as follows:

```bash
Usage: asterism [options] [command]
Expand All @@ -27,9 +27,9 @@ Options:
-h, --help display help for command

Commands:
migrate [options] [database] Initialize a new Lyra instance from your
migrate [options] [database] Initialize a new Orama instance from your
current database
search [options] [term] Search for a Lyra instance in your instances
search [options] [term] Search for a Orama instance in your instances
help [command] display help for command
```

Expand All @@ -40,7 +40,7 @@ Commands:

Usage: asterism migrate [options] [database]

Initialize a new Lyra instance from your current database
Initialize a new Orama instance from your current database

Arguments:
database The database to migrate
Expand All @@ -57,7 +57,7 @@ Options:
--help display help for command
```

The CLI provides a `migrate` command that can be used to generate a Lyra instance from a database. The command can be used as follows:
The CLI provides a `migrate` command that can be used to generate a Orama instance from a database. The command can be used as follows:

```bash
> asterism migrate
Expand All @@ -70,14 +70,14 @@ The CLI provides a `migrate` command that can be used to generate a Lyra instanc

Usage: asterism search [options] [term]

Search for a Lyra instance in your instances
Search for a Orama instance in your instances

Arguments:
term The term to search for

Options:
-c, --cacheDisabled Disable cache
-i, --inputDir <inputDir> Lyra databases directory (default: "./lyra")
-i, --inputDir <inputDir> Orama databases directory (default: "./orama")
-o, --outputDir <outputDir> Output directory to save results in a JSON
(default: "./out")
-h, --help display help for command
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ program.name('asterism').description('Asterism CLI').version(version, '-v, --ver

program
.command('migrate')
.description('Initialize a new Lyra instance from your current database')
.description('Initialize a new Orama instance from your current database')
.argument('[database]', 'The database to migrate (mysql or postgres)', (value) => (allowedDatabases.includes(value) ? value : undefined))
.option('-H, --host <host>', 'Database host')
.option('-p, --port <port>', 'Port to run the server on')
.option('-d, --databaseName <databaseName>', 'Database connection string')
.option('-t, --tableName <tableName>', 'Table name')
.option('-u, --user <user>', 'Database user')
.option('-w, --password <password>', 'Database password')
.option('-o, --outputDir <outputDir>', 'Lyra migrated databases directory', './lyra')
.option('-o, --outputDir <outputDir>', 'Orama migrated databases directory', './orama')
.option('-s --strict', 'Strict mode', false)
.action(falconMigrate)

program
.command('search')
.description('Search for a Lyra instance in your instances')
.description('Search for a Orama instance in your instances')
.argument('[term]', 'The term to search for')
.option('-c, --cacheDisabled', 'Disable cache')
.option('-i, --inputDir <inputDir>', 'Lyra databases directory', './lyra')
.option('-i, --inputDir <inputDir>', 'Orama databases directory', './orama')
.option('-o, --outputDir <outputDir>', 'Output directory to save results in a JSON', './out')
.action(falconSearch)

Expand Down
13 changes: 7 additions & 6 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"homepage": "https://github.com/mateonunez/asterism",
"scripts": {
"lint": "standard | snazzy",
"lint:fix": "standard --fix | snazzy",
"test": "npm run lint && c8 --100 tap --no-coverage test/**/*.test.mjs"
},
"repository": {
Expand All @@ -17,22 +18,22 @@
},
"license": "MIT",
"keywords": [
"lyra",
"orama",
"asterism",
"MySQL",
"PostgreSQL"
],
"dependencies": {
"@mateonunez/asterism-drill": "workspace:*",
"@mateonunez/asterism-falcon": "workspace:*",
"commander": "^10.0.0"
"commander": "^10.0.1"
},
"devDependencies": {
"c8": "^7.13.0",
"execa": "^7.0.0",
"c8": "^8.0.1",
"execa": "^8.0.1",
"snazzy": "^9.0.0",
"standard": "^17.0.0",
"tap": "^16.3.4"
"standard": "^17.1.0",
"tap": "^16.3.9"
},
"author": {
"email": "mateonunez95@gmail.com",
Expand Down
2 changes: 1 addition & 1 deletion packages/drill/lib/validate-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function validateOptions (logger, database, options) {

if (!options.host) validatedOptions.host = '127.0.0.1'
if (!options.outputDir) validatedOptions.outputDir = './out'
if (!options.inputDir) validatedOptions.inputDir = './lyra'
if (!options.inputDir) validatedOptions.inputDir = './orama'

return validatedOptions
}
Expand Down
11 changes: 6 additions & 5 deletions packages/drill/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"type": "module",
"scripts": {
"lint": "standard | snazzy",
"lint:fix": "standard --fix | snazzy",
"test": "npm run lint && c8 --100 tap --no-coverage test/**/*.test.js"
},
"repository": {
Expand All @@ -18,15 +19,15 @@
},
"homepage": "https://github.com/mateonunez/asterism#readme",
"dependencies": {
"@databases/mysql": "^5.2.1",
"@databases/pg": "^5.4.1",
"@databases/mysql": "^6.0.0",
"@databases/pg": "^5.5.0",
"@mateonunez/asterism-huston": "workspace:*"
},
"devDependencies": {
"c8": "^7.13.0",
"c8": "^8.0.1",
"snazzy": "^9.0.0",
"standard": "^17.0.0",
"tap": "^16.3.4"
"standard": "^17.1.0",
"tap": "^16.3.9"
},
"author": {
"email": "mateonunez95@gmail.com",
Expand Down
2 changes: 1 addition & 1 deletion packages/falcon/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @mateonunez/asterism-falcon

`asterism-falcon` manages the CLI for **Asterism**. It provides the methods to generate a Lyra instance from a database and to search into the created instances.
`asterism-falcon` manages the CLI for **Asterism**. It provides the methods to generate a Orama instance from a database and to search into the created instances.

## License

Expand Down
13 changes: 7 additions & 6 deletions packages/falcon/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@mateonunez/asterism-falcon",
"version": "0.0.5",
"description": "falcon migrates your database data to a Lyra instance",
"description": "falcon migrates your database data to a Orama instance",
"main": "falcon.js",
"type": "module",
"scripts": {
"lint": "standard | snazzy",
"lint:fix": "standard --fix | snazzy",
"test": "npm run lint && c8 --100 tap --no-coverage test/**/*.test.js"
},
"repository": {
Expand All @@ -21,14 +22,14 @@
"@mateonunez/asterism-drill": "workspace:*",
"@mateonunez/asterism-huston": "workspace:*",
"@mateonunez/asterism-rover": "workspace:*",
"pino": "^8.10.0",
"pino-pretty": "^10.0.0"
"pino": "^8.16.1",
"pino-pretty": "^10.2.3"
},
"devDependencies": {
"c8": "^7.13.0",
"c8": "^8.0.1",
"snazzy": "^9.0.0",
"standard": "^17.0.0",
"tap": "^16.3.4"
"standard": "^17.1.0",
"tap": "^16.3.9"
},
"author": {
"email": "mateonunez95@gmail.com",
Expand Down
Empty file removed packages/falcon/test/helper.js
Empty file.
12 changes: 6 additions & 6 deletions packages/falcon/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ import { database } from '@mateonunez/asterism-huston'
const { mysqlOptions, postgresOptions } = database

t.before(async () => {
await seeder(undefined, 'mysql', { ...mysqlOptions, outputDir: './lyra' })
await seeder(undefined, 'mysql', { ...mysqlOptions, outputDir: './orama' })
})

t.test('no database selected should default to mysql', async ({ ok }) => {
const { db } = await falconMigrate(undefined, { ...mysqlOptions, outputDir: './lyra' })
const { db } = await falconMigrate(undefined, { ...mysqlOptions, outputDir: './orama' })
ok(db.isMysql)
})

t.test('postgres database selected', async ({ ok }) => {
const { db } = await falconMigrate('postgres', { ...postgresOptions, outputDir: './lyra' })
const { db } = await falconMigrate('postgres', { ...postgresOptions, outputDir: './orama' })
ok(db.isPostgres)
})

t.test('falcon search with no term should terminate the process', async ({ same }) => {
await falconMigrate(undefined, mysqlOptions)
const results = await falconSearch(undefined, { inputDir: './lyra' })
const results = await falconSearch(undefined, { inputDir: './orama' })
same(results, undefined)
})

t.test('falcon search should return results', async ({ ok }) => {
await falconMigrate(undefined, mysqlOptions)
const results = await falconSearch('John', { inputDir: './lyra' })
const results = await falconSearch('John', { inputDir: './orama' })
ok(results)
})

t.on('end', async () => {
await dropSeed(undefined, 'mysql', { ...mysqlOptions, outputDir: './lyra' })
await dropSeed(undefined, 'mysql', { ...mysqlOptions, outputDir: './orama' })
})
4 changes: 2 additions & 2 deletions packages/falcon/test/validate-options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('should validate options', async ({ end }) => {
user: 'root',
password: 'toor',
outputDir: './out',
inputDir: './lyra'
inputDir: './orama'
})
})

Expand All @@ -25,7 +25,7 @@ test('should validate options', async ({ end }) => {
user: 'postgres',
password: 'postgres',
outputDir: './out',
inputDir: './lyra'
inputDir: './orama'
})
})

Expand Down
Loading