@patternfly/create-element
Advanced tools
Comparing version 0.0.2-next.2 to 0.0.2-next.3
# @patternfly/create-element | ||
## 0.0.2-next.3 | ||
### Patch Changes | ||
- 317115f8: Update generator config file templates | ||
## 0.0.2-next.2 | ||
@@ -4,0 +10,0 @@ |
@@ -114,3 +114,3 @@ import type { GenerateElementOptions } from '../main'; | ||
const normalizeScope = (scope: string): string => | ||
scope ? `@${scope.replace(/^@(.*)\/$/, '$1')}/` : ''; | ||
scope ? `@${scope.replace(/^(@+)([-.\w]+)\/?$/, '$2')}/` : ''; | ||
@@ -223,9 +223,11 @@ /** Get template interpolation data from options */ | ||
const config = await readJson<Tsconfig>(configPath); | ||
if (!config?.compilerOptions?.paths) { | ||
return; | ||
if (config?.compilerOptions?.paths) { | ||
config.compilerOptions.paths[packageName] = [join(`./elements/${tagName}/${tagName}.ts`)]; | ||
} | ||
config.compilerOptions.paths[packageName] = [join(`./elements/${tagName}/${tagName}.ts`)]; | ||
if (!config.references.some(x => x.path === `./elements/${tagName}`)) { | ||
if (!config.references?.some(x => x.path === `./elements/${tagName}`)) { | ||
config.references.push({ 'path': `./elements/${tagName}` }); | ||
} | ||
await writeFile(configPath, JSON.stringify(config, null, 2), 'utf8'); | ||
@@ -235,2 +237,10 @@ await execaCommand(`npx eslint --fix ${configPath}`); | ||
async function updateDocsBundle(options: GenerateElementOptions): Promise<void> { | ||
const pathname = join(process.cwd(), 'docs', 'demo', 'bundle.ts'); | ||
const content = await readFile(pathname, 'utf8'); | ||
await writeFile(pathname, `${content}\nimport '@patternfly/${options.tagName}';`, 'utf8'); | ||
await execaCommand(`npx eslint --fix ${pathname}`); | ||
} | ||
/** | ||
@@ -252,3 +262,5 @@ * Generate an Element | ||
await updateTsconfig(options); | ||
await updateDocsBundle(options); | ||
await execaCommand('npm install'); | ||
} | ||
} |
{ | ||
"name": "@patternfly/create-element", | ||
"version": "0.0.2-next.2", | ||
"version": "0.0.2-next.3", | ||
"description": "Scaffold web components monorepos based on PatternFly Elements", | ||
@@ -5,0 +5,0 @@ "author": "Benny Powers <bennyp@redhat.com>", |
@@ -1,20 +0,12 @@ | ||
import type { LitElement } from 'lit'; | ||
import { test } from '@playwright/test'; | ||
import { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js'; | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@patternfly/pfe-tools/test/playwright/fixtures.js'; | ||
const tagName = '<%= tagName %>'; | ||
test.describe(tagName, () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto(`http://localhost:8080/demo/${tagName}/`); | ||
await page.waitForLoadState('networkidle'); | ||
await page.waitForTimeout(100); | ||
await page.evaluate(async x => customElements.whenDefined(x), tagName); | ||
await page.$eval(tagName, async (el: LitElement) => el.updateComplete); | ||
}); | ||
test('snapshot', async ({ page }) => { | ||
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(`${tagName}.png`); | ||
const componentPage = new PfeDemoPage(page, tagName); | ||
await componentPage.navigate(); | ||
await componentPage.snapshot(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54666
580