Skip to content
Open
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
5 changes: 5 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@
"engines": {
"node": ">=22.0.0"
},
"type": "module",
"main": "dist/index.js",
"types": "dist/declarations.d.ts",
"exports": {
"types": "dist/declarations.d.ts",
"default": "dist/index.js"
},
"bin": {
"capacitor": "./bin/capacitor",
"cap": "./bin/capacitor"
Expand Down
10 changes: 5 additions & 5 deletions cli/src/android/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { pathExists, writeFile } from 'fs-extra';
import { homedir } from 'os';
import { join } from 'path';

import c from '../colors';
import { runTask } from '../common';
import type { Config } from '../definitions';
import { runCommand } from '../util/subprocess';
import { extractTemplate } from '../util/template';
import c from '../colors.js';
import { runTask } from '../common.js';
import type { Config } from '../definitions.js';
import { runCommand } from '../util/subprocess.js';
import { extractTemplate } from '../util/template.js';

export async function addAndroid(config: Config): Promise<void> {
await runTask(`Adding native android project in ${c.strong(config.android.platformDir)}`, async () => {
Expand Down
12 changes: 6 additions & 6 deletions cli/src/android/build.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { join } from 'path';

import c from '../colors';
import { runTask } from '../common';
import type { Config } from '../definitions';
import { logSuccess } from '../log';
import type { BuildCommandOptions } from '../tasks/build';
import { runCommand } from '../util/subprocess';
import c from '../colors.js';
import { runTask } from '../common.js';
import type { Config } from '../definitions.js';
import { logSuccess } from '../log.js';
import type { BuildCommandOptions } from '../tasks/build.js';
import { runCommand } from '../util/subprocess.js';

export async function buildAndroid(config: Config, buildOptions: BuildCommandOptions): Promise<void> {
const releaseType = buildOptions.androidreleasetype ?? 'AAB';
Expand Down
12 changes: 6 additions & 6 deletions cli/src/android/common.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { copy, remove, mkdirp, readFile, pathExists, writeFile } from 'fs-extra';
import { join, resolve } from 'path';

import { checkCapacitorPlatform } from '../common';
import { getIncompatibleCordovaPlugins } from '../cordova';
import type { Config } from '../definitions';
import { PluginType, getPluginPlatform } from '../plugin';
import type { Plugin } from '../plugin';
import { convertToUnixPath } from '../util/fs';
import { checkCapacitorPlatform } from '../common.js';
import { getIncompatibleCordovaPlugins } from '../cordova.js';
import type { Config } from '../definitions.js';
import { PluginType, getPluginPlatform } from '../plugin.js';
import type { Plugin } from '../plugin.js';
import { convertToUnixPath } from '../util/fs.js';

export async function checkAndroidPackage(config: Config): Promise<string | null> {
return checkCapacitorPlatform(config, 'android');
Expand Down
14 changes: 7 additions & 7 deletions cli/src/android/doctor.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { pathExists, readFile } from 'fs-extra';
import { join, extname, parse } from 'path';

import c from '../colors';
import { check } from '../common';
import type { Config } from '../definitions';
import { fatal, isFatal } from '../errors';
import { logSuccess } from '../log';
import { readdirp } from '../util/fs';
import { readXML } from '../util/xml';
import c from '../colors.js';
import { check } from '../common.js';
import type { Config } from '../definitions.js';
import { fatal, isFatal } from '../errors.js';
import { logSuccess } from '../log.js';
import { readdirp } from '../util/fs.js';
import { readXML } from '../util/xml.js';

export async function doctorAndroid(config: Config): Promise<void> {
try {
Expand Down
6 changes: 3 additions & 3 deletions cli/src/android/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import Debug from 'debug';
import { pathExists } from 'fs-extra';
import open from 'open';

import c from '../colors';
import type { Config } from '../definitions';
import { logger } from '../log';
import c from '../colors.js';
import type { Config } from '../definitions.js';
import { logger } from '../log.js';

const debug = Debug('capacitor:android:open');

Expand Down
12 changes: 6 additions & 6 deletions cli/src/android/run.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Debug from 'debug';
import { resolve } from 'path';

import c from '../colors';
import { parseApkNameFromFlavor, promptForPlatformTarget, runTask } from '../common';
import type { Config } from '../definitions';
import type { RunCommandOptions } from '../tasks/run';
import { runNativeRun, getPlatformTargets } from '../util/native-run';
import { runCommand } from '../util/subprocess';
import c from '../colors.js';
import { parseApkNameFromFlavor, promptForPlatformTarget, runTask } from '../common.js';
import type { Config } from '../definitions.js';
import type { RunCommandOptions } from '../tasks/run.js';
import { runNativeRun, getPlatformTargets } from '../util/native-run.js';
import { runCommand } from '../util/subprocess.js';

const debug = Debug('capacitor:android:run');

Expand Down
26 changes: 13 additions & 13 deletions cli/src/android/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import Debug from 'debug';
import { copy, remove, pathExists, readFile, writeFile, writeJSON } from 'fs-extra';
import { dirname, extname, join, relative, resolve } from 'path';

import c from '../colors';
import { checkPlatformVersions, runTask } from '../common';
import { checkPluginDependencies, handleCordovaPluginsJS, writeCordovaAndroidManifest } from '../cordova';
import type { Config } from '../definitions';
import { fatal } from '../errors';
import c from '../colors.js';
import { checkPlatformVersions, runTask } from '../common.js';
import { checkPluginDependencies, handleCordovaPluginsJS, writeCordovaAndroidManifest } from '../cordova.js';
import type { Config } from '../definitions.js';
import { fatal } from '../errors.js';
import {
PluginType,
getAllElements,
Expand All @@ -16,14 +16,14 @@ import {
getPluginType,
getPlugins,
printPlugins,
} from '../plugin';
import type { Plugin } from '../plugin';
import { copy as copyTask } from '../tasks/copy';
import { readdirp, convertToUnixPath } from '../util/fs';
import { resolveNode } from '../util/node';
import { extractTemplate } from '../util/template';

import { getAndroidPlugins } from './common';
} from '../plugin.js';
import type { Plugin } from '../plugin.js';
import { copy as copyTask } from '../tasks/copy.js';
import { readdirp, convertToUnixPath } from '../util/fs.js';
import { resolveNode } from '../util/node.js';
import { extractTemplate } from '../util/template.js';

import { getAndroidPlugins } from './common.js';

const platform = 'android';
const debug = Debug('capacitor:android:update');
Expand Down
16 changes: 8 additions & 8 deletions cli/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { prettyPath } from '@ionic/utils-terminal';
import { readJSON, pathExists } from 'fs-extra';
import { dirname, join } from 'path';

import c from './colors';
import type { Config, PackageJson } from './definitions';
import { fatal } from './errors';
import { output, logger } from './log';
import { getPlugins } from './plugin';
import { findNXMonorepoRoot, isNXMonorepo } from './util/monorepotools';
import { resolveNode } from './util/node';
import { runCommand } from './util/subprocess';
import c from './colors.js';
import type { Config, PackageJson } from './definitions.js';
import { fatal } from './errors.js';
import { output, logger } from './log.js';
import { getPlugins } from './plugin.js';
import { findNXMonorepoRoot, isNXMonorepo } from './util/monorepotools.js';
import { resolveNode } from './util/node.js';
import { runCommand } from './util/subprocess.js';

export type CheckFunction = () => Promise<string | null>;

Expand Down
26 changes: 13 additions & 13 deletions cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Debug from 'debug';
import { pathExists, readFile, readJSON, writeFile, writeJSON } from 'fs-extra';
import { dirname, extname, join, relative, resolve } from 'path';

import c from './colors';
import { parseApkNameFromFlavor } from './common';
import c from './colors.js';
import { parseApkNameFromFlavor } from './common.js';
import type {
AndroidConfig,
AppConfig,
Expand All @@ -13,16 +13,16 @@ import type {
IOSConfig,
WebConfig,
XcodeExportMethod,
} from './definitions';
import { OS } from './definitions';
import { fatal, isFatal } from './errors';
import { logger } from './log';
import { tryFn } from './util/fn';
import { formatJSObject } from './util/js';
import { findNXMonorepoRoot, isNXMonorepo } from './util/monorepotools';
import { requireTS, resolveNode } from './util/node';
import { lazy } from './util/promise';
import { getCommandOutput } from './util/subprocess';
} from './definitions.js';
import { OS } from './definitions.js';
import { fatal, isFatal } from './errors.js';
import { logger } from './log.js';
import { tryFn } from './util/fn.js';
import { formatJSObject } from './util/js.js';
import { findNXMonorepoRoot, isNXMonorepo } from './util/monorepotools.js';
import { requireTS, resolveNode } from './util/node.js';
import { lazy } from './util/promise.js';
import { getCommandOutput } from './util/subprocess.js';

const debug = Debug('capacitor:config');

Expand Down Expand Up @@ -371,7 +371,7 @@ async function determineAndroidStudioPath(os: OS): Promise<string> {
case OS.Mac:
return '/Applications/Android Studio.app';
case OS.Windows: {
const { runCommand } = await import('./util/subprocess');
const { runCommand } = await import('./util/subprocess.js');

let p = 'C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe';

Expand Down
22 changes: 11 additions & 11 deletions cli/src/cordova.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import plist from 'plist';
import type { PlistObject } from 'plist';
import prompts from 'prompts';

import { getAndroidPlugins } from './android/common';
import c from './colors';
import type { Config } from './definitions';
import { fatal } from './errors';
import { getIOSPlugins } from './ios/common';
import { logger, logPrompt } from './log';
import { getAndroidPlugins } from './android/common.js';
import c from './colors.js';
import type { Config } from './definitions.js';
import { fatal } from './errors.js';
import { getIOSPlugins } from './ios/common.js';
import { logger, logPrompt } from './log.js';
import {
PluginType,
getAllElements,
Expand All @@ -20,11 +20,11 @@ import {
getPluginType,
getPlugins,
printPlugins,
} from './plugin';
import type { Plugin } from './plugin';
import { resolveNode } from './util/node';
import { isInteractive } from './util/term';
import { buildXmlElement, parseXML, readXML, writeXML } from './util/xml';
} from './plugin.js';
import type { Plugin } from './plugin.js';
import { resolveNode } from './util/node.js';
import { isInteractive } from './util/term.js';
import { buildXmlElement, parseXML, readXML, writeXML } from './util/xml.js';

/**
* Build the root cordova_plugins.js file referencing each Plugin JS file.
Expand Down
2 changes: 1 addition & 1 deletion cli/src/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CapacitorConfig, PluginsConfig } from './declarations';
import type { CapacitorConfig, PluginsConfig } from './declarations.js';

type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> };

Expand Down
4 changes: 2 additions & 2 deletions cli/src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export abstract class BaseException<T> extends Error {
constructor(
readonly message: string,
override readonly message: string,
readonly code: T,
) {
super(message);
Expand All @@ -9,7 +9,7 @@ export abstract class BaseException<T> extends Error {

export class FatalException extends BaseException<'FATAL'> {
constructor(
readonly message: string,
override readonly message: string,
readonly exitCode = 1,
) {
super(message, 'FATAL');
Expand Down
2 changes: 1 addition & 1 deletion cli/src/framework-configs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Config, FrameworkConfig } from './definitions';
import type { Config, FrameworkConfig } from './definitions.js';

const FRAMEWORK_CONFIGS: FrameworkConfig[] = [
{
Expand Down
Loading