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

Transform default exports to named exports #28

Merged
merged 2 commits into from
Dec 15, 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
2 changes: 1 addition & 1 deletion src/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { WPMMconfig } from './types'
*
* @class Database
*/
export default class Database {
export class Database {
/** The configuration object. */
protected config: WPMMconfig

Expand Down
2 changes: 1 addition & 1 deletion src/Dump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
*
* @category Model
*/
export default class Dump {
export class Dump {
/** The base folder of the WordPress installation. */
protected baseFolder: string

Expand Down
2 changes: 1 addition & 1 deletion src/Initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getWpVersionCheck } from './utils/axios'
*
* @class Initialize
*/
export default class Initialize {
export class Initialize {
/** The path to the WordPress folder. */
private wpFolder: string

Expand Down
6 changes: 3 additions & 3 deletions src/Installer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cleanup, makeDir } from './utils/fs'
import Package from './Package'
import WpPackage from './WpPackage'
import { Package } from './Package'
import { WpPackage } from './WpPackage'
import { isWPCLIAvailable, runPostInstallCommands } from './utils/commands'
import { WPMMconfig, WPMMpaths } from './types'

Expand All @@ -9,7 +9,7 @@ import { WPMMconfig, WPMMpaths } from './types'
*
* @class Installer
*/
export default class Installer {
export class Installer {
/** The configuration object. */
protected config: WPMMconfig

Expand Down
2 changes: 1 addition & 1 deletion src/Package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { WPMMconfigPkg, WPMMpaths } from './types'
* @class Package
* @template Package
*/
export default class Package {
export class Package {
/** the package info */
public pkgInfo: WPMMconfigPkg

Expand Down
2 changes: 1 addition & 1 deletion src/Updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { UpdateObject, WPMMconfig } from './types'
*
* @class Updater
*/
export default class Updater {
export class Updater {
/** THe configuration object. */
config: WPMMconfig

Expand Down
4 changes: 2 additions & 2 deletions src/WpPackage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import fs from 'fs'
import { renameFolder } from './utils/fs'
import Package from './Package'
import { Package } from './Package'
import {
replaceDbConstant,
replaceDbConstantBool,
Expand All @@ -16,7 +16,7 @@ import type { WordpressPkg, WPMMpaths } from './types'
* @class WpPackage
* @extends Package<WpPackage> pkgConfig - the configuration object
*/
export default class WpPackage extends Package {
export class WpPackage extends Package {
public pkgInfo: WordpressPkg
/**
* Constructs a new instance of the class.
Expand Down
12 changes: 6 additions & 6 deletions src/actions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getInfo } from './utils/data'
import Initialize from './Initialize'
import Installer from './Installer'
import Updater from './Updater'
import Dump from './Dump'
import Database from './Database'
import { Initialize } from './Initialize'
import { Installer } from './Installer'
import { Updater } from './Updater'
import { Dump } from './Dump'
import { Database } from './Database'
import { WPMMconfig, WPMMpaths } from './types'
import { isValidUpdateOptions } from './utils/parsers'
import yargs from 'yargs'
Expand All @@ -17,7 +17,7 @@ import yargs from 'yargs'
*
* @return {Object} The actions object.
*/
export default function actions({
export function actions({
config,
paths,
}: {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getConfig, printTimePassed } from './utils/data'
import { hideBin } from 'yargs/helpers'
import { getWordPressPaths } from './utils/wordpress'
import yargs, { Argv } from 'yargs'
import actions from './actions'
import { actions } from './actions'
import { WPMMconfig, WPMMpaths } from './types'

/** @var {number} startTime - the time at which the script started. */
Expand All @@ -17,7 +17,7 @@ const argv: Argv<object> = yargs(hideBin(process.argv))
* Get the configuration and invoke the actions based on the provided arguments.
* @param argv - The command line arguments.
*/
export default getConfig(argv)
getConfig(argv)
.then(
/** @param {WPMMconfig} config - The configuration object for the script. */
(config: WPMMconfig) => {
Expand Down
4 changes: 1 addition & 3 deletions src/utils/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const reqOptions = {
},
}

const axiosFetch = {
export const axiosFetch = {
get: <T>(url: string) => axios.get<T>(url, reqOptions).then(responseBody),
post: <T>(url: string, body: object) =>
axios.post<T>(url, body, reqOptions).then(responseBody),
Expand All @@ -60,5 +60,3 @@ export const getTemplate = (url: string): Promise<{ data: WPapiTemplateResponse
*/
export const getWpVersionCheck = (): Promise<WPapiCoreVersionResponse> =>
axiosFetch.get<WPapiCoreVersionResponse>('https://api.wordpress.org/core/version-check/1.7/')

export default axiosFetch
2 changes: 1 addition & 1 deletion src/utils/data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs'
import path from 'path'
import Initialize from '../Initialize'
import { Initialize } from '../Initialize'
import { getTemplate } from './axios'
import { isWordpressFolder } from './wordpress'
import { DefaultWpInstallFolder, PkgFileName } from '../constants'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import inquirer from 'inquirer'
import path from 'path'
import { DefaultWpInstallFolder, PkgFileName } from '../constants'
import { getWordPressPaths } from './wordpress'
import Dump from '../Dump'
import { Dump } from '../Dump'
import { WPMMconfig } from '../types'

/**
Expand Down