Skip to content

Commit

Permalink
v1.95 (#206)
Browse files Browse the repository at this point in the history
* feat: detect out folder for adding Capacitor to NextJS projects

* feat: support for serve, build, start scripts and plugin repos
  • Loading branch information
dtarnawsky authored Oct 11, 2024
1 parent 6ce5919 commit 61f3abc
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Changelog

### Version 1.95

- Support for NextJS projects using static exports with an `out` folder
- Support for Non-Ionic projects using `serve`, `build` and `start` scripts
- Support for Capacitor Plugin monorepos

### Version 1.94

- Options for running in the web browser, VS Code editor, Nexus browser added as icons
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ionic",
"displayName": "Ionic",
"description": "Official extension for Ionic and Capacitor development",
"version": "1.94.2",
"version": "1.95.0",
"icon": "media/ionic.png",
"publisher": "Ionic",
"keywords": [
Expand Down
2 changes: 2 additions & 0 deletions src/capacitor-config-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export function getCapacitorConfigDistFolder(folder: string): string {
result = 'dist';
} else if (existsSync(join(folder, 'build'))) {
result = 'build';
} else if (existsSync(join(folder, 'out'))) {
result = 'out';
}
}
if (!result) {
Expand Down
2 changes: 2 additions & 0 deletions src/ionic-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ function guessBuildCommand(project: Project): string | undefined {
const packageFile = JSON.parse(readFileSync(filename, 'utf8'));
if (packageFile.scripts['ionic:build']) {
return npmRun('ionic:build');
} else if (packageFile.scripts['build']) {
return npmRun('build');
}
}
return undefined;
Expand Down
6 changes: 4 additions & 2 deletions src/ionic-serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,15 @@ function guessServeCommand(project: Project): string | undefined {
const packageFile = JSON.parse(readFileSync(filename, 'utf8'));
if (packageFile.scripts['ionic:serve']) {
return npmRun('ionic:serve');
}
if (packageFile.scripts?.serve) {
} else if (packageFile.scripts?.serve) {
return npmRun('serve');
} else if (packageFile.scripts?.start) {
return npmRun('start');
}
}
return undefined;
}

async function findNextPort(port: number, host: string | undefined): Promise<number> {
let availablePort = port;
while (await isPortInUse(availablePort, host)) {
Expand Down
6 changes: 5 additions & 1 deletion src/monorepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,11 @@ function checkFolder(filename: string): FolderType {
pck?.dependencies?.['@capacitor/android'] ||
pck?.dependencies?.['@angular/core']
);
return isIonic ? FolderType.hasIonic : pck.dependencies ? FolderType.hasDependencies : FolderType.unknown;
return isIonic
? FolderType.hasIonic
: pck.dependencies || pck.devDependencies
? FolderType.hasDependencies
: FolderType.unknown;
} catch {
return FolderType.unknown;
}
Expand Down

0 comments on commit 61f3abc

Please sign in to comment.