Skip to content

Commit 6dd88e6

Browse files
committed
fix: update package references to use @capacitor-plus namespace
1 parent d80000b commit 6dd88e6

File tree

10 files changed

+77
-72
lines changed

10 files changed

+77
-72
lines changed

cli/src/android/update.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ export async function installGradlePlugins(
135135
capacitorPlugins: Plugin[],
136136
cordovaPlugins: Plugin[],
137137
): Promise<void> {
138-
const capacitorAndroidPackagePath = resolveNode(config.app.rootDir, '@capacitor/android', 'package.json');
138+
const capacitorAndroidPackagePath = resolveNode(config.app.rootDir, '@capacitor-plus/android', 'package.json');
139139
if (!capacitorAndroidPackagePath) {
140140
fatal(
141-
`Unable to find ${c.strong('node_modules/@capacitor/android')}.\n` +
142-
`Are you sure ${c.strong('@capacitor/android')} is installed?`,
141+
`Unable to find ${c.strong('node_modules/@capacitor-plus/android')}.\n` +
142+
`Are you sure ${c.strong('@capacitor-plus/android')} is installed?`,
143143
);
144144
}
145145

cli/src/common.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export async function checkCapacitorPlatform(config: Config, platform: string):
7676
if (!pkg) {
7777
return (
7878
`Could not find the ${c.input(platform)} platform.\n` +
79-
`You must install it in your project first, e.g. w/ ${c.input(`npm install @capacitor/${platform}`)}`
79+
`You must install it in your project first, e.g. w/ ${c.input(`npm install @capacitor-plus/${platform}`)}`
8080
);
8181
}
8282

@@ -224,7 +224,7 @@ export async function runTask<T>(title: string, fn: () => Promise<T>): Promise<T
224224
}
225225

226226
export async function getCapacitorPackage(config: Config, name: string): Promise<PackageJson | null> {
227-
const packagePath = resolveNode(config.app.rootDir, `@capacitor/${name}`, 'package.json');
227+
const packagePath = resolveNode(config.app.rootDir, `@capacitor-plus/${name}`, 'package.json');
228228

229229
if (!packagePath) {
230230
return null;
@@ -238,8 +238,8 @@ export async function requireCapacitorPackage(config: Config, name: string): Pro
238238

239239
if (!pkg) {
240240
fatal(
241-
`Unable to find node_modules/@capacitor/${name}.\n` +
242-
`Are you sure ${c.strong(`@capacitor/${name}`)} is installed?`,
241+
`Unable to find node_modules/@capacitor-plus/${name}.\n` +
242+
`Are you sure ${c.strong(`@capacitor-plus/${name}`)} is installed?`,
243243
);
244244
}
245245
return pkg;
@@ -472,17 +472,17 @@ export async function checkPlatformVersions(config: Config, platform: string): P
472472

473473
if (semver.diff(coreVersion, platformVersion) === 'minor' || semver.diff(coreVersion, platformVersion) === 'major') {
474474
logger.warn(
475-
`${c.strong('@capacitor/core')}${c.weak(
475+
`${c.strong('@capacitor-plus/core')}${c.weak(
476476
`@${coreVersion}`,
477-
)} version doesn't match ${c.strong(`@capacitor/${platform}`)}${c.weak(`@${platformVersion}`)} version.\n` +
478-
`Consider updating to a matching version, e.g. w/ ${c.input(`npm install @capacitor/core@${platformVersion}`)}`,
477+
)} version doesn't match ${c.strong(`@capacitor-plus/${platform}`)}${c.weak(`@${platformVersion}`)} version.\n` +
478+
`Consider updating to a matching version, e.g. w/ ${c.input(`npm install @capacitor-plus/core@${platformVersion}`)}`,
479479
);
480480
}
481481
}
482482

483483
export function resolvePlatform(config: Config, platform: string): string | null {
484484
if (platform[0] !== '@') {
485-
const core = resolveNode(config.app.rootDir, `@capacitor/${platform}`, 'package.json');
485+
const core = resolveNode(config.app.rootDir, `@capacitor-plus/${platform}`, 'package.json');
486486

487487
if (core) {
488488
return dirname(core);

cli/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ async function determineGemfileOrCocoapodPath(
466466

467467
function formatConfigTS(extConfig: ExternalConfig): string {
468468
// TODO: <reference> tags
469-
return `import type { CapacitorConfig } from '@capacitor/cli';
469+
return `import type { CapacitorConfig } from '@capacitor-plus/cli';
470470
471471
const config: CapacitorConfig = ${formatJSObject(extConfig)};
472472

cli/src/cordova.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ export async function copyPluginsJS(config: Config, cordovaPlugins: Plugin[], pl
145145
}
146146

147147
export async function copyCordovaJS(config: Config, platform: string): Promise<void> {
148-
const cordovaPath = resolveNode(config.app.rootDir, '@capacitor/core', 'cordova.js');
148+
const cordovaPath = resolveNode(config.app.rootDir, '@capacitor-plus/core', 'cordova.js');
149149
if (!cordovaPath) {
150150
fatal(
151-
`Unable to find ${c.strong('node_modules/@capacitor/core/cordova.js')}.\n` +
152-
`Are you sure ${c.strong('@capacitor/core')} is installed?`,
151+
`Unable to find ${c.strong('node_modules/@capacitor-plus/core/cordova.js')}.\n` +
152+
`Are you sure ${c.strong('@capacitor-plus/core')} is installed?`,
153153
);
154154
}
155155

cli/src/ios/update.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ async function updatePodfile(config: Config, plugins: Plugin[], deployment: bool
158158
}
159159

160160
async function getRelativeCapacitoriOSPath(config: Config) {
161-
const capacitoriOSPath = resolveNode(config.app.rootDir, '@capacitor/ios', 'package.json');
161+
const capacitoriOSPath = resolveNode(config.app.rootDir, '@capacitor-plus/ios', 'package.json');
162162

163163
if (!capacitoriOSPath) {
164164
fatal(
165-
`Unable to find ${c.strong('node_modules/@capacitor/ios')}.\n` +
166-
`Are you sure ${c.strong('@capacitor/ios')} is installed?`,
165+
`Unable to find ${c.strong('node_modules/@capacitor-plus/ios')}.\n` +
166+
`Are you sure ${c.strong('@capacitor-plus/ios')} is installed?`,
167167
);
168168
}
169169

cli/src/tasks/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import c from '../colors';
22
import { fatal } from '../errors';
33

44
export async function createCommand(): Promise<void> {
5-
fatal(`The create command has been removed.\n` + `Use ${c.input('npm init @capacitor/app')}`);
5+
fatal(`The create command has been removed.\n` + `Use ${c.input('npm init @capacitor-plus/app')}`);
66
}

cli/src/tasks/doctor.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ export async function doctorCommand(config: Config, selectedPlatformName: string
2525

2626
export async function doctorCore(config: Config): Promise<void> {
2727
const [cliVersion, coreVersion, androidVersion, iosVersion] = await Promise.all([
28-
getCommandOutput('npm', ['info', '@capacitor/cli', 'version']),
29-
getCommandOutput('npm', ['info', '@capacitor/core', 'version']),
30-
getCommandOutput('npm', ['info', '@capacitor/android', 'version']),
31-
getCommandOutput('npm', ['info', '@capacitor/ios', 'version']),
28+
getCommandOutput('npm', ['info', '@capacitor-plus/cli', 'version']),
29+
getCommandOutput('npm', ['info', '@capacitor-plus/core', 'version']),
30+
getCommandOutput('npm', ['info', '@capacitor-plus/android', 'version']),
31+
getCommandOutput('npm', ['info', '@capacitor-plus/ios', 'version']),
3232
]);
3333

3434
output.write(
3535
`${c.strong('Latest Dependencies:')}\n\n` +
36-
` @capacitor/cli: ${c.weak(cliVersion ?? 'unknown')}\n` +
37-
` @capacitor/core: ${c.weak(coreVersion ?? 'unknown')}\n` +
38-
` @capacitor/android: ${c.weak(androidVersion ?? 'unknown')}\n` +
39-
` @capacitor/ios: ${c.weak(iosVersion ?? 'unknown')}\n\n` +
36+
` @capacitor-plus/cli: ${c.weak(cliVersion ?? 'unknown')}\n` +
37+
` @capacitor-plus/core: ${c.weak(coreVersion ?? 'unknown')}\n` +
38+
` @capacitor-plus/android: ${c.weak(androidVersion ?? 'unknown')}\n` +
39+
` @capacitor-plus/ios: ${c.weak(iosVersion ?? 'unknown')}\n\n` +
4040
`${c.strong('Installed Dependencies:')}\n\n`,
4141
);
4242

@@ -46,7 +46,12 @@ export async function doctorCore(config: Config): Promise<void> {
4646
}
4747

4848
async function printInstalledPackages(config: Config) {
49-
const packageNames = ['@capacitor/cli', '@capacitor/core', '@capacitor/android', '@capacitor/ios'];
49+
const packageNames = [
50+
'@capacitor-plus/cli',
51+
'@capacitor-plus/core',
52+
'@capacitor-plus/android',
53+
'@capacitor-plus/ios',
54+
];
5055
await Promise.all(
5156
packageNames.map(async (packageName) => {
5257
const packagePath = resolveNode(config.app.rootDir, packageName, 'package.json');

cli/src/tasks/migrate.ts

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@ import { extractTemplate } from '../util/template';
1616

1717
// eslint-disable-next-line prefer-const
1818
let allDependencies: { [key: string]: any } = {};
19-
const libs = ['@capacitor/core', '@capacitor/cli', '@capacitor/ios', '@capacitor/android'];
19+
const libs = ['@capacitor-plus/core', '@capacitor-plus/cli', '@capacitor-plus/ios', '@capacitor-plus/android'];
2020
const plugins = [
21-
'@capacitor/action-sheet',
22-
'@capacitor/app',
23-
'@capacitor/app-launcher',
24-
'@capacitor/browser',
25-
'@capacitor/camera',
26-
'@capacitor/clipboard',
27-
'@capacitor/device',
28-
'@capacitor/dialog',
29-
'@capacitor/filesystem',
30-
'@capacitor/geolocation',
31-
'@capacitor/google-maps',
32-
'@capacitor/haptics',
33-
'@capacitor/keyboard',
34-
'@capacitor/local-notifications',
35-
'@capacitor/motion',
36-
'@capacitor/network',
37-
'@capacitor/preferences',
38-
'@capacitor/push-notifications',
39-
'@capacitor/screen-orientation',
40-
'@capacitor/screen-reader',
41-
'@capacitor/share',
42-
'@capacitor/splash-screen',
43-
'@capacitor/status-bar',
44-
'@capacitor/text-zoom',
45-
'@capacitor/toast',
21+
'@capacitor-plus/action-sheet',
22+
'@capacitor-plus/app',
23+
'@capacitor-plus/app-launcher',
24+
'@capacitor-plus/browser',
25+
'@capacitor-plus/camera',
26+
'@capacitor-plus/clipboard',
27+
'@capacitor-plus/device',
28+
'@capacitor-plus/dialog',
29+
'@capacitor-plus/filesystem',
30+
'@capacitor-plus/geolocation',
31+
'@capacitor-plus/google-maps',
32+
'@capacitor-plus/haptics',
33+
'@capacitor-plus/keyboard',
34+
'@capacitor-plus/local-notifications',
35+
'@capacitor-plus/motion',
36+
'@capacitor-plus/network',
37+
'@capacitor-plus/preferences',
38+
'@capacitor-plus/push-notifications',
39+
'@capacitor-plus/screen-orientation',
40+
'@capacitor-plus/screen-reader',
41+
'@capacitor-plus/share',
42+
'@capacitor-plus/splash-screen',
43+
'@capacitor-plus/status-bar',
44+
'@capacitor-plus/text-zoom',
45+
'@capacitor-plus/toast',
4646
];
4747
const coreVersion = '^8.0.0';
4848
const pluginVersion = '^8.0.0';
@@ -147,7 +147,7 @@ export async function migrateCommand(config: Config, noprompt: boolean, packagem
147147
}
148148

149149
// Update iOS Projects
150-
if (allDependencies['@capacitor/ios'] && existsSync(config.ios.platformDirAbs)) {
150+
if (allDependencies['@capacitor-plus/ios'] && existsSync(config.ios.platformDirAbs)) {
151151
const currentiOSVersion = getMajoriOSVersion(config);
152152
if (parseInt(currentiOSVersion) < parseInt(iOSVersion)) {
153153
// ios template changes
@@ -186,7 +186,7 @@ export async function migrateCommand(config: Config, noprompt: boolean, packagem
186186
logger.warn('Skipped Running cap sync.');
187187
}
188188

189-
if (allDependencies['@capacitor/android'] && existsSync(config.android.platformDirAbs)) {
189+
if (allDependencies['@capacitor-plus/android'] && existsSync(config.android.platformDirAbs)) {
190190
// AndroidManifest.xml add "density"
191191
await runTask(`Migrating AndroidManifest.xml by adding density to Activity configChanges.`, () => {
192192
return updateAndroidManifest(join(config.android.srcMainDirAbs, 'AndroidManifest.xml'));
@@ -354,7 +354,7 @@ async function installLatestLibs(dependencyManager: string, runInstall: boolean,
354354
});
355355

356356
if (runInstall) {
357-
rimraf.sync(join(config.app.rootDir, 'node_modules/@capacitor/!(cli)'));
357+
rimraf.sync(join(config.app.rootDir, 'node_modules/@capacitor-plus/!(cli)'));
358358
await runCommand(dependencyManager, ['install']);
359359
if (dependencyManager == 'yarn') {
360360
await runCommand(dependencyManager, ['upgrade']);
@@ -368,16 +368,16 @@ async function installLatestLibs(dependencyManager: string, runInstall: boolean,
368368

369369
async function writeBreakingChanges() {
370370
const breaking = [
371-
'@capacitor/action-sheet',
372-
'@capacitor/barcode-scanner',
373-
'@capacitor/browser',
374-
'@capacitor/camera',
375-
'@capacitor/geolocation',
376-
'@capacitor/google-maps',
377-
'@capacitor/push-notifications',
378-
'@capacitor/screen-orientation',
379-
'@capacitor/splash-screen',
380-
'@capacitor/status-bar',
371+
'@capacitor-plus/action-sheet',
372+
'@capacitor-plus/barcode-scanner',
373+
'@capacitor-plus/browser',
374+
'@capacitor-plus/camera',
375+
'@capacitor-plus/geolocation',
376+
'@capacitor-plus/google-maps',
377+
'@capacitor-plus/push-notifications',
378+
'@capacitor-plus/screen-orientation',
379+
'@capacitor-plus/splash-screen',
380+
'@capacitor-plus/status-bar',
381381
];
382382
const broken = [];
383383
for (const lib of breaking) {

cli/src/tasks/new-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import c from '../colors';
22
import { fatal } from '../errors';
33

44
export async function newPluginCommand(): Promise<void> {
5-
fatal(`The plugin:generate command has been removed.\n` + `Use ${c.input('npm init @capacitor/plugin')}`);
5+
fatal(`The plugin:generate command has been removed.\n` + `Use ${c.input('npm init @capacitor-plus/plugin')}`);
66
}

cli/src/telemetry.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ export function telemetryAction(config: Config, action: CommanderAction): Comman
6262
...config.app.package.dependencies,
6363
});
6464

65-
// Only collect packages in the capacitor org:
66-
// https://www.npmjs.com/org/capacitor
67-
const capacitorPackages = packages.filter(([k]) => k.startsWith('@capacitor/'));
65+
// Only collect packages in the capacitor-plus org:
66+
// https://www.npmjs.com/org/capacitor-plus
67+
const capacitorPackages = packages.filter(([k]) => k.startsWith('@capacitor-plus/'));
6868

6969
const versions = capacitorPackages.map(([k, v]) => [
70-
`${k.replace(/^@capacitor\//, '').replace(/-/g, '_')}_version`,
70+
`${k.replace(/^@capacitor-plus\//, '').replace(/-/g, '_')}_version`,
7171
v,
7272
]);
7373

0 commit comments

Comments
 (0)