@michijs/dev-server 0.7.22 → 0.7.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/bin/actions/generateAssets.d.ts +1 -0
- package/bin/actions/generateAssets.js +5 -3
- package/bin/cli.js +2 -4
- package/bin/types.d.ts +0 -1
- package/bin/utils/packageJson.d.ts +1 -0
- package/bin/utils/packageJson.js +5 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,6 @@ Development server built on top of esbuild.
|
|
|
3
3
|
<!-- TODO: To generate feature-image require to install roboto -->
|
|
4
4
|
|
|
5
5
|
![npm][version] [![license][github-license]][github-license-url] ![npm][npm-downloads] ![npm][repo-size]
|
|
6
|
-
[](https://github.com/michijs/dev-server/actions/workflows/codeql-analysis.yml)
|
|
7
6
|
[](https://github.com/michijs/dev-server/actions/workflows/tests.yml)
|
|
8
7
|
|
|
9
8
|
## Main features
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function installPlaywright(): Promise<void>;
|
|
1
2
|
export declare function generateFeatureImage(src: string): Promise<void>;
|
|
2
3
|
export declare function generateScreenshots(): Promise<Buffer[][]>;
|
|
3
4
|
export declare function generateAssets(callback: () => void, src: string): Promise<void>;
|
|
@@ -9,12 +9,14 @@ import { assetsSizes } from "../constants.js";
|
|
|
9
9
|
import { chromium } from "playwright-core";
|
|
10
10
|
import { exec } from "child_process";
|
|
11
11
|
import { getColor } from "colorthief";
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import { packageJson } from "../utils/packageJson.js";
|
|
13
|
+
export async function installPlaywright() {
|
|
14
|
+
const playwrightVersion = `playwright@${packageJson.dependencies["playwright-core"]}`;
|
|
15
|
+
console.log(`Installing ${playwrightVersion}...`);
|
|
14
16
|
return new Promise((resolve, reject) => {
|
|
15
17
|
const runners = ["bunx", "npx"];
|
|
16
18
|
exec(runners
|
|
17
|
-
.map((x) => `${x}
|
|
19
|
+
.map((x) => `${x} ${playwrightVersion} install chromium --with-deps`)
|
|
18
20
|
.join(" || "), (error, stdout, stderr) => {
|
|
19
21
|
if (error) {
|
|
20
22
|
console.error(`Error during Playwright installation: ${error.message}`);
|
package/bin/cli.js
CHANGED
|
@@ -2,10 +2,8 @@ import coloredString from "./utils/coloredString.js";
|
|
|
2
2
|
import yargs from "yargs";
|
|
3
3
|
import { Timer } from "./classes/Timer.js";
|
|
4
4
|
import { hideBin } from "yargs/helpers";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { fileURLToPath } from "url";
|
|
8
|
-
const version = JSON.parse(readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), "..", "package.json"), { encoding: "utf-8" })).version;
|
|
5
|
+
import { packageJson } from "./utils/packageJson.js";
|
|
6
|
+
const version = packageJson.version;
|
|
9
7
|
export async function cli() {
|
|
10
8
|
console.log(` ${coloredString(`Running dev server version ${version}.`)}`);
|
|
11
9
|
const timer = new Timer();
|
package/bin/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const packageJson: any;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
import { dirname, resolve } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
// Intentionally not using import because typescript generates a src folder inside bin
|
|
5
|
+
export const packageJson = JSON.parse(readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), "../..", "package.json"), { encoding: "utf-8" }));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michijs/dev-server",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.24",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/michijs/dev-server.git"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@michijs/tsconfig": "0.0.4",
|
|
33
|
-
"@types/node": "22.
|
|
33
|
+
"@types/node": "22.9.0",
|
|
34
34
|
"@types/yargs": "17.0.33",
|
|
35
35
|
"typescript": "5.6.3"
|
|
36
36
|
},
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"esbuild": "0.24.0",
|
|
59
59
|
"node-watch": "0.7.4",
|
|
60
60
|
"open": "10.1.0",
|
|
61
|
-
"playwright-core": "1.
|
|
61
|
+
"playwright-core": "1.49.0",
|
|
62
62
|
"sharp": "0.33.5",
|
|
63
63
|
"yargs": "17.7.2"
|
|
64
64
|
}
|