@azure/create-playwright 1.0.0-alpha.20250721.1 → 1.0.0-alpha.20250825.1
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 +10 -11
- package/dist/commonjs/initialize.js +3 -3
- package/dist/commonjs/initialize.js.map +1 -1
- package/dist/esm/initialize.js +3 -3
- package/dist/esm/initialize.js.map +1 -1
- package/package.json +26 -27
package/README.md
CHANGED
|
@@ -15,21 +15,20 @@ pnpm create @azure/playwright
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Useful Links
|
|
18
|
-
- [Quickstart: Run end-to-end tests at scale](https://aka.ms/
|
|
19
|
-
- [Quickstart: Set up continuous end-to-end testing across different browsers and operating systems](https://aka.ms/
|
|
20
|
-
- [Explore features and benefits](https://aka.ms/
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [Share feedback](https://aka.ms/mpt/feedback)
|
|
18
|
+
- [Quickstart: Run end-to-end tests at scale](https://aka.ms/pww/docs/quickstart)
|
|
19
|
+
- [Quickstart: Set up continuous end-to-end testing across different browsers and operating systems](https://aka.ms/pww/docs/ci)
|
|
20
|
+
- [Explore features and benefits](https://aka.ms/pww/docs/about)
|
|
21
|
+
- [Documentation](https://aka.ms/pww/docs)
|
|
22
|
+
- [Pricing](https://aka.ms/pww/docs/pricing)
|
|
23
|
+
- [Share feedback](https://aka.ms/pww/docs/feedback)
|
|
25
24
|
|
|
26
25
|
## Next steps
|
|
27
26
|
|
|
28
|
-
- Run tests in a [CI/CD pipeline.](https://aka.ms/
|
|
27
|
+
- Run tests in a [CI/CD pipeline.](https://aka.ms/pww/docs/configure-pipeline)
|
|
29
28
|
|
|
30
|
-
- Learn how to [manage access](https://aka.ms/
|
|
29
|
+
- Learn how to [manage access](https://aka.ms/pww/docs/manage-access) to the created workspace.
|
|
31
30
|
|
|
32
|
-
- Experiment with different number of workers to [determine the optimal configuration of your test suite](https://aka.ms/
|
|
31
|
+
- Experiment with different number of workers to [determine the optimal configuration of your test suite](https://aka.ms/pww/docs/parallelism).
|
|
33
32
|
|
|
34
33
|
## Contributing
|
|
35
34
|
|
|
@@ -51,4 +50,4 @@ This project may contain trademarks or logos for projects, products, or services
|
|
|
51
50
|
trademarks or logos is subject to and must follow
|
|
52
51
|
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks/usage/general).
|
|
53
52
|
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
54
|
-
Any use of third-party trademarks or logos is subject to those third-party's policies.
|
|
53
|
+
Any use of third-party trademarks or logos is subject to those third-party's policies.
|
|
@@ -61,8 +61,8 @@ class PlaywrightServiceInitialize {
|
|
|
61
61
|
const runCommandParallelWorkers = this._packageManager.runCommand("playwright", `test -c ${this.getServiceConfigFileName()} --workers=20`);
|
|
62
62
|
console.log(`\n\nTo run playwrights tests using Playwright Service\n`);
|
|
63
63
|
console.log(`\t${runCommandParallelWorkers}\n`);
|
|
64
|
-
console.log("Getting Started - https://aka.ms/
|
|
65
|
-
console.log("If you're already using the Azure Playwright service, please review the quickstart guide [https://aka.ms/
|
|
64
|
+
console.log("Getting Started - https://aka.ms/pww/docs/quickstart\n");
|
|
65
|
+
console.log("If you're already using the Azure Playwright service, please review the quickstart guide [https://aka.ms/pww/docs/quickstart] to ensure your tests continue running smoothly.");
|
|
66
66
|
};
|
|
67
67
|
installServicePackage = async () => {
|
|
68
68
|
const command = this._packageManager.installDevDependencyCommand("@azure/playwright @azure/identity");
|
|
@@ -92,7 +92,7 @@ const config = require('${customerConfigFileName}');
|
|
|
92
92
|
: importCommandJavaScript;
|
|
93
93
|
const content = importCommand +
|
|
94
94
|
`
|
|
95
|
-
/* Learn more about service configuration at https://aka.ms/
|
|
95
|
+
/* Learn more about service configuration at https://aka.ms/pww/docs/config */
|
|
96
96
|
export default defineConfig(
|
|
97
97
|
config,
|
|
98
98
|
getServiceCon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AiB,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC;IAEM,uBAAuB,GAAG,GAAW,EAAE;QAC7C,MAAM,sBAAsB,GAAG,IAAA,oCAAyB,EACtD,IAAI,CAAC,YAAY,CAAC,oBAAoB,CACvC,CAAC;QAEF,MAAM,uBAAuB,GAAG;;;sBAGd,sBAAsB;CAC3C,CAAC;QAEE,MAAM,uBAAuB,GAAG;;;0BAGV,sBAAsB;CAC/C,CAAC;QAEE,MAAM,aAAa,GACjB,IAAI,CAAC,YAAY,CAAC,eAAe,KAAK,wBAAS,CAAC,UAAU;YACxD,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,uBAAuB,CAAC;QAE9B,MAAM,OAAO,GACX,aAAa;YACb;;;;;;;;;;;CAWL,CAAC;QACE,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEM,wBAAwB,GAAG,GAAW,EAAE;QAC9C,OAAO,2BAA2B,GAAG,yBAAU,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACrF,CAAC,CAAC;CACH;AA9GD,kEA8GC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PromptObject } from \"prompts\";\nimport prompts from \"prompts\";\nimport fs from \"node:fs\";\nimport { Extensions, Languages, Messages } from \"./constants.js\";\nimport type {\n OverridePromptResponse,\n PackageManager,\n PlaywrightServiceInitConfig,\n} from \"./types.js\";\nimport { executeCommand, getFileReferenceForImport } from \"./utils.js\";\nimport { getPackageManager } from \"./packageManager.js\";\n\nconst questions: PromptObject[] = [\n {\n type: \"confirm\",\n name: \"canOverride\",\n message: Messages.CAN_OVERRIDE_MESSAGE,\n initial: true,\n },\n {\n type: (prev: boolean) => (prev ? null : \"confirm\"),\n name: \"confirmationForExit\",\n message: Messages.CONFIRMATION_FOR_EXIT_MESSAGE,\n initial: true,\n },\n];\n\nexport class PlaywrightServiceInitialize {\n private _setupConfig: PlaywrightServiceInitConfig;\n private _packageManager: PackageManager;\n\n constructor(setupConfig: PlaywrightServiceInitConfig) {\n this._setupConfig = setupConfig;\n this._packageManager = getPackageManager();\n }\n\n public addServiceSupportToTestSuite = async (): Promise<void> => {\n const canProceedWithServiceInitialization = await this.checkIfServiceConfigCanBeAdded(); // if service config already present, ask user for overwrite permission\n if (!canProceedWithServiceInitialization) return;\n await this.installServicePackage(); // install service packages\n await this.createServiceConfig(); // create service config file\n this.displayAdditionalInformation(); // display additional information\n };\n\n private checkIfServiceConfigCanBeAdded = async (): Promise<boolean> => {\n if (!this.isServiceConfigFileAlreadyPresent()) return true;\n const response = (await prompts.prompt(questions, {\n onCancel: this.promptOnCancel,\n })) as OverridePromptResponse;\n if (response.canOverride) return true;\n if (!response.confirmationForExit) return this.checkIfServiceConfigCanBeAdded();\n\n console.log(`\\n${Messages.SETUP_PROCESS_EXIT_MESSAGE}`);\n return false;\n };\n\n private promptOnCancel = (): never => {\n process.exit(0);\n };\n\n private isServiceConfigFileAlreadyPresent = (): boolean => {\n return fs.existsSync(this.getServiceConfigFileName());\n };\n\n private displayAdditionalInformation = (): void => {\n const runCommandParallelWorkers = this._packageManager.runCommand(\n \"playwright\",\n `test -c ${this.getServiceConfigFileName()} --workers=20`,\n );\n\n console.log(`\\n\\nTo run playwrights tests using Playwright Service\\n`);\n console.log(`\\t${runCommandParallelWorkers}\\n`);\n\n console.log(\"Getting Started - https://aka.ms/pww/docs/quickstart\\n\");\n\n console.log(\n \"If you're already using the Azure Playwright service, please review the quickstart guide [https://aka.ms/pww/docs/quickstart] to ensure your tests continue running smoothly.\",\n );\n };\n\n private installServicePackage = async (): Promise<void> => {\n const command = this._packageManager.installDevDependencyCommand(\n \"@azure/playwright @azure/identity\",\n );\n console.log(`Installing Service package (${command})`);\n await executeCommand(command);\n };\n\n private createServiceConfig = async (): Promise<void> => {\n const serviceConfigFile = this.getServiceConfigFileName();\n const serviceConfigFileContent = this.getServiceConfigContent();\n await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);\n console.log(`Success! Created service configuration file - ${serviceConfigFile}`);\n };\n\n private getServiceConfigContent = (): string => {\n const customerConfigFileName = getFileReferenceForImport(\n this._setupConfig.playwrightConfigFile,\n );\n\n const importCommandTypeScript = `import { defineConfig } from '@playwright/test';\nimport { getServiceConfig, ServiceOS } from '@azure/playwright';\nimport { DefaultAzureCredential } from '@azure/identity';\nimport config from '${customerConfigFileName}';\n`;\n\n const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');\nconst { getServiceConfig, ServiceOS } = require('@azure/playwright');\nconst { DefaultAzureCredential } = require('@azure/identity');\nconst config = require('${customerConfigFileName}');\n`;\n\n const importCommand =\n this._setupConfig.projectLanguage === Languages.TypeScript\n ? importCommandTypeScript\n : importCommandJavaScript;\n\n const content =\n importCommand +\n `\n/* Learn more about service configuration at https://aka.ms/pww/docs/config */\nexport default defineConfig(\n config,\n getServiceConfig(config, {\n exposeNetwork: '<loopback>',\n timeout: 3 * 60 * 1000, // 3 minutes\n os: ServiceOS.LINUX,\n credential: new DefaultAzureCredential(),\n })\n);\n`;\n return content;\n };\n\n private getServiceConfigFileName = (): string => {\n return \"playwright.service.config\" + Extensions[this._setupConfig.projectLanguage];\n };\n}\n"]}
|
package/dist/esm/initialize.js
CHANGED
|
@@ -57,8 +57,8 @@ export class PlaywrightServiceInitialize {
|
|
|
57
57
|
const runCommandParallelWorkers = this._packageManager.runCommand("playwright", `test -c ${this.getServiceConfigFileName()} --workers=20`);
|
|
58
58
|
console.log(`\n\nTo run playwrights tests using Playwright Service\n`);
|
|
59
59
|
console.log(`\t${runCommandParallelWorkers}\n`);
|
|
60
|
-
console.log("Getting Started - https://aka.ms/
|
|
61
|
-
console.log("If you're already using the Azure Playwright service, please review the quickstart guide [https://aka.ms/
|
|
60
|
+
console.log("Getting Started - https://aka.ms/pww/docs/quickstart\n");
|
|
61
|
+
console.log("If you're already using the Azure Playwright service, please review the quickstart guide [https://aka.ms/pww/docs/quickstart] to ensure your tests continue running smoothly.");
|
|
62
62
|
};
|
|
63
63
|
installServicePackage = async () => {
|
|
64
64
|
const command = this._packageManager.installDevDependencyCommand("@azure/playwright @azure/identity");
|
|
@@ -88,7 +88,7 @@ const config = require('${customerConfigFileName}');
|
|
|
88
88
|
: importCommandJavaScript;
|
|
89
89
|
const content = importCommand +
|
|
90
90
|
`
|
|
91
|
-
/* Learn more about service configuration at https://aka.ms/
|
|
91
|
+
/* Learn more about service configuration at https://aka.ms/pww/docs/config */
|
|
92
92
|
export default defineConfig(
|
|
93
93
|
config,
|
|
94
94
|
getServiceConfig(config, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAMjE,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,SAAS,GAAmB;IAChC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,QAAQ,CAAC,oBAAoB;QACtC,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAClD,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,QAAQ,CAAC,6BAA6B;QAC/C,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF,MAAM,OAAO,2BAA2B;IAC9B,YAAY,CAA8B;IAC1C,eAAe,CAAiB;IAExC,YAAY,WAAwC;QAClD,IAAI,CAAC,YAAY,GAAG,WAAW,CAA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;QAC9C,OAAO,2BAA2B,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACrF,CAAC,CAAC;CACH","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PromptObject } from \"prompts\";\nimport prompts from \"prompts\";\nimport fs from \"node:fs\";\nimport { Extensions, Languages, Messages } from \"./constants.js\";\nimport type {\n OverridePromptResponse,\n PackageManager,\n PlaywrightServiceInitConfig,\n} from \"./types.js\";\nimport { executeCommand, getFileReferenceForImport } from \"./utils.js\";\nimport { getPackageManager } from \"./packageManager.js\";\n\nconst questions: PromptObject[] = [\n {\n type: \"confirm\",\n name: \"canOverride\",\n message: Messages.CAN_OVERRIDE_MESSAGE,\n initial: true,\n },\n {\n type: (prev: boolean) => (prev ? null : \"confirm\"),\n name: \"confirmationForExit\",\n message: Messages.CONFIRMATION_FOR_EXIT_MESSAGE,\n initial: true,\n },\n];\n\nexport class PlaywrightServiceInitialize {\n private _setupConfig: PlaywrightServiceInitConfig;\n private _packageManager: PackageManager;\n\n constructor(setupConfig: PlaywrightServiceInitConfig) {\n this._setupConfig = setupConfig;\n this._packageManager = getPackageManager();\n }\n\n public addServiceSupportToTestSuite = async (): Promise<void> => {\n const canProceedWithServiceInitialization = await this.checkIfServiceConfigCanBeAdded(); // if service config already present, ask user for overwrite permission\n if (!canProceedWithServiceInitialization) return;\n await this.installServicePackage(); // install service packages\n await this.createServiceConfig(); // create service config file\n this.displayAdditionalInformation(); // display additional information\n };\n\n private checkIfServiceConfigCanBeAdded = async (): Promise<boolean> => {\n if (!this.isServiceConfigFileAlreadyPresent()) return true;\n const response = (await prompts.prompt(questions, {\n onCancel: this.promptOnCancel,\n })) as OverridePromptResponse;\n if (response.canOverride) return true;\n if (!response.confirmationForExit) return this.checkIfServiceConfigCanBeAdded();\n\n console.log(`\\n${Messages.SETUP_PROCESS_EXIT_MESSAGE}`);\n return false;\n };\n\n private promptOnCancel = (): never => {\n process.exit(0);\n };\n\n private isServiceConfigFileAlreadyPresent = (): boolean => {\n return fs.existsSync(this.getServiceConfigFileName());\n };\n\n private displayAdditionalInformation = (): void => {\n const runCommandParallelWorkers = this._packageManager.runCommand(\n \"playwright\",\n `test -c ${this.getServiceConfigFileName()} --workers=20`,\n );\n\n console.log(`\\n\\nTo run playwrights tests using Playwright Service\\n`);\n console.log(`\\t${runCommandParallelWorkers}\\n`);\n\n console.log(\"Getting Started - https://aka.ms/pww/docs/quickstart\\n\");\n\n console.log(\n \"If you're already using the Azure Playwright service, please review the quickstart guide [https://aka.ms/pww/docs/quickstart] to ensure your tests continue running smoothly.\",\n );\n };\n\n private installServicePackage = async (): Promise<void> => {\n const command = this._packageManager.installDevDependencyCommand(\n \"@azure/playwright @azure/identity\",\n );\n console.log(`Installing Service package (${command})`);\n await executeCommand(command);\n };\n\n private createServiceConfig = async (): Promise<void> => {\n const serviceConfigFile = this.getServiceConfigFileName();\n const serviceConfigFileContent = this.getServiceConfigContent();\n await fs.promises.writeFile(serviceConfigFile, serviceConfigFileContent);\n console.log(`Success! Created service configuration file - ${serviceConfigFile}`);\n };\n\n private getServiceConfigContent = (): string => {\n const customerConfigFileName = getFileReferenceForImport(\n this._setupConfig.playwrightConfigFile,\n );\n\n const importCommandTypeScript = `import { defineConfig } from '@playwright/test';\nimport { getServiceConfig, ServiceOS } from '@azure/playwright';\nimport { DefaultAzureCredential } from '@azure/identity';\nimport config from '${customerConfigFileName}';\n`;\n\n const importCommandJavaScript = `const { defineConfig } = require('@playwright/test');\nconst { getServiceConfig, ServiceOS } = require('@azure/playwright');\nconst { DefaultAzureCredential } = require('@azure/identity');\nconst config = require('${customerConfigFileName}');\n`;\n\n const importCommand =\n this._setupConfig.projectLanguage === Languages.TypeScript\n ? importCommandTypeScript\n : importCommandJavaScript;\n\n const content =\n importCommand +\n `\n/* Learn more about service configuration at https://aka.ms/pww/docs/config */\nexport default defineConfig(\n config,\n getServiceConfig(config, {\n exposeNetwork: '<loopback>',\n timeout: 3 * 60 * 1000, // 3 minutes\n os: ServiceOS.LINUX,\n credential: new DefaultAzureCredential(),\n })\n);\n`;\n return content;\n };\n\n private getServiceConfigFileName = (): string => {\n return \"playwright.service.config\" + Extensions[this._setupConfig.projectLanguage];\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/create-playwright",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.20250825.1",
|
|
4
4
|
"description": "Package to setup @azure/playwright",
|
|
5
5
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtesting/create-playwright/README.md",
|
|
6
6
|
"sdk-type": "client",
|
|
@@ -33,38 +33,21 @@
|
|
|
33
33
|
"README.md",
|
|
34
34
|
"LICENSE"
|
|
35
35
|
],
|
|
36
|
-
"scripts": {
|
|
37
|
-
"build": "npm run clean && dev-tool run build-package",
|
|
38
|
-
"build:samples": "echo Obsolete",
|
|
39
|
-
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
|
40
|
-
"clean": "dev-tool run vendored rimraf --glob dist *.log dist-test temp types *.tgz *.xml samples/**/test-results/",
|
|
41
|
-
"execute:samples": "echo skipped",
|
|
42
|
-
"extract-api": "echo skipped",
|
|
43
|
-
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
|
44
|
-
"lint": "eslint package.json CHANGELOG.md README.md src",
|
|
45
|
-
"lint:fix": "eslint package.json CHANGELOG.md README.md src --fix --fix-type [problem,suggestion]",
|
|
46
|
-
"pack": "npm pack 2>&1",
|
|
47
|
-
"test": "npm run test:node && npm run test:browser",
|
|
48
|
-
"test:browser": "echo skipped",
|
|
49
|
-
"test:node": "dev-tool run test:vitest --no-test-proxy",
|
|
50
|
-
"test:node:esm": "dev-tool run test:vitest --esm --no-test-proxy",
|
|
51
|
-
"update-snippets": "dev-tool run update-snippets"
|
|
52
|
-
},
|
|
53
36
|
"dependencies": {
|
|
54
37
|
"prompts": "^2.4.2",
|
|
55
38
|
"tslib": "^2.8.1"
|
|
56
39
|
},
|
|
57
40
|
"devDependencies": {
|
|
58
|
-
"@azure-tools/test-utils-vitest": ">=1.0.0-alpha <1.0.0-alphb",
|
|
59
|
-
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
|
60
|
-
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
61
41
|
"@azure/logger": "^1.1.4",
|
|
62
|
-
"@types/node": "^20.
|
|
42
|
+
"@types/node": "^20.19.0",
|
|
63
43
|
"@types/prompts": "^2.4.9",
|
|
64
|
-
"@vitest/coverage-istanbul": "^3.
|
|
65
|
-
"eslint": "^9.
|
|
66
|
-
"typescript": "~5.8.
|
|
67
|
-
"vitest": "^3.
|
|
44
|
+
"@vitest/coverage-istanbul": "^3.2.3",
|
|
45
|
+
"eslint": "^9.33.0",
|
|
46
|
+
"typescript": "~5.8.3",
|
|
47
|
+
"vitest": "^3.2.3",
|
|
48
|
+
"@azure/dev-tool": "^1.0.0",
|
|
49
|
+
"@azure-tools/test-utils-vitest": "^2.0.0",
|
|
50
|
+
"@azure/eslint-plugin-azure-sdk": "^3.0.0"
|
|
68
51
|
},
|
|
69
52
|
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
|
|
70
53
|
"//sampleConfiguration": {
|
|
@@ -101,5 +84,21 @@
|
|
|
101
84
|
"default": "./dist/commonjs/index.js"
|
|
102
85
|
}
|
|
103
86
|
}
|
|
87
|
+
},
|
|
88
|
+
"scripts": {
|
|
89
|
+
"build": "npm run clean && dev-tool run build-package",
|
|
90
|
+
"build:samples": "echo Skipped.",
|
|
91
|
+
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
|
92
|
+
"clean": "dev-tool run vendored rimraf --glob dist *.log dist-test temp types *.tgz *.xml samples/**/test-results/",
|
|
93
|
+
"execute:samples": "echo skipped",
|
|
94
|
+
"extract-api": "echo skipped",
|
|
95
|
+
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
|
96
|
+
"lint": "eslint package.json CHANGELOG.md README.md src",
|
|
97
|
+
"lint:fix": "eslint package.json CHANGELOG.md README.md src --fix --fix-type [problem,suggestion]",
|
|
98
|
+
"pack": "pnpm pack 2>&1",
|
|
99
|
+
"test": "npm run test:node && npm run test:browser",
|
|
100
|
+
"test:browser": "echo skipped",
|
|
101
|
+
"test:node": "dev-tool run build-test --no-browser-test && dev-tool run test:vitest --no-test-proxy",
|
|
102
|
+
"update-snippets": "dev-tool run update-snippets"
|
|
104
103
|
}
|
|
105
|
-
}
|
|
104
|
+
}
|