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

Export internal functions #3

Merged
merged 1 commit into from
Sep 7, 2024
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hosty",
"version": "0.0.1-alpha.3",
"version": "0.0.1-alpha.4",
"description": "A code based opinionated way to self-host and manage web apps.",
"type": "module",
"main": "dist/index.js",
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { instance } from './instance.js'
import * as blocks from './blocks/index.js'
import * as ansible from './ansible/index.js'

export * from './types.js'
export * from './services/index.js'
export { server } from './server.js'
export { assert } from './blocks/index.js'
export { instance }

export const { deploy, destroy, playbook, write, run } = instance()

export const internals = {ansible, blocks, instance}
7 changes: 0 additions & 7 deletions src/operations.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/services/assertions.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * as app from './app/index.js'
export * from './assertions.js'
export * from './tasks.js'
export * from './command.js'
export * from './container.js'
export * as db from './database/index.js'
6 changes: 6 additions & 0 deletions src/services/tasks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Tasks } from '../ansible/types.js'
import { TasksService } from '../types.js'

export function assertions(...tasks: Tasks): TasksService {
return { type: 'tasks', get_deploy_tasks: () => tasks, get_destroy_tasks: () => [] }
}
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export type CommandConfig = {

export type Command = Service<'command'> & CommandConfig

export type Assertions = Service<'assertions'>
export type TasksService = Service<'tasks'>

export type RunOptions = {
playbook_path: string
Expand Down
4 changes: 3 additions & 1 deletion tests/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as zx from 'zx'
import { ChildProcess } from 'child_process'
import { HostyInstance, Server, Service, assert, assertions, instance, server } from '../../src/index.js'
import { HostyInstance, Server, Service, assertions, server, internals } from '../../src/index.js'

const { instance, blocks: { assert } } = internals

type Assert = {
[K in keyof typeof assert]: (...args: Parameters<(typeof assert)[K]>) => void
Expand Down
Loading