-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Output faust version in dev|build|start commands. (#1874)
* Feat: Output faust version in dev|build|start commands. * Lint: Fix eslint issue * Acceptance Tests: update preview button selectos for WP 6.5 * Acceptance Tests: Attempt to fix preview tests * Acceptance Test: Use correct variables * Acceptance Test: Fix cpt_name var * Acceptance Test: Remove click event * Acceptance Test: Attempt to close welcome modals. * Acceptance Test: Revert last commit * Acceptance Test: Update DEVELOPMENT.md * Acceptance Test: Click Welcome modal if present * Acceptance Test: Pin e2e tests to WP 6.4
- Loading branch information
Showing
7 changed files
with
80 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
'@faustwp/cli': patch | ||
--- | ||
|
||
Faust CLI now outputs version number when running dev|build|start commands. | ||
|
||
When running those commands it will print the current Faust core and cli versions in the console: | ||
|
||
```bash | ||
% npm run dev -w examples/next/faustwp-getting-started | ||
info - Faust.js v3.0.1 | ||
info - Faust.js CLI v3.0.1 | ||
ready - started server on 0.0.0.0:3000, url: http://localhost:3000 | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import fs from 'fs'; | ||
import { infoLog } from '../stdout/index.js'; | ||
|
||
/** | ||
* Sanitizes the version from a dependency in package.json. | ||
* | ||
* @param version The dependency version. | ||
* @returns A sanitized version or undefined if the version is a path. | ||
*/ | ||
export function sanitizePackageJsonVersion(_version: string | undefined) { | ||
let version = _version; | ||
|
||
if (!version) { | ||
return undefined; | ||
} | ||
|
||
if (version.charAt(0) === '^' || version.charAt(0) === '~') { | ||
version = version.substring(1); | ||
} | ||
|
||
/** | ||
* If a dependency is a file path set the value to undefined as we | ||
* don't want to collect file paths in telemetry | ||
*/ | ||
if (version.startsWith('file:')) { | ||
version = undefined; | ||
} | ||
|
||
return version; | ||
} | ||
|
||
export function printFaustVersion(): void { | ||
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); | ||
const coreVersion = sanitizePackageJsonVersion( | ||
packageJson?.dependencies?.['@faustwp/core'] as string | undefined, | ||
); | ||
const cliVersion = sanitizePackageJsonVersion( | ||
packageJson?.dependencies?.['@faustwp/cli'] as string | undefined, | ||
); | ||
// eslint-disable-next-line | ||
infoLog(`Faust.js v${coreVersion || 'unknown'}`); | ||
infoLog(`Faust.js CLI v${cliVersion || 'unknown'}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ARG WP_VERSION=latest | ||
ARG WP_VERSION=6.4 | ||
|
||
FROM wordpress:${WP_VERSION} | ||
|
||
|