Socket
Socket
Sign inDemoInstall

@patternfly/create-element

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@patternfly/create-element - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

4

bin/main.js

@@ -8,4 +8,6 @@ #!/usr/bin/env node

} catch (e) {
if (e) console.error(e);
if (e) {
console.error(e);
}
}
})();

@@ -6,3 +6,4 @@ import type { GenerateElementOptions } from '../main';

* Generate an Element
* @param options element generator options
*/
export declare function generateElement(options: GenerateElementOptions): Promise<void>;

@@ -14,9 +14,9 @@ import Case from 'case';

/**
* Available filenames.
*
* To add a new file to the element template,
* 1. Add a key to this enum
* 2. Add the template file's path to `TEMPLATE_FILE_PATHS`
* 3. Add the output path to `getFilePathsRelativeToPackageDir`, interpolating as needed.
*/
* Available filenames.
*
* To add a new file to the element template,
* 1. Add a key to this enum
* 2. Add the template file's path to `TEMPLATE_FILE_PATHS`
* 3. Add the output path to `getFilePathsRelativeToPackageDir`, interpolating as needed.
*/
var FileKey;

@@ -26,4 +26,2 @@ (function (FileKey) {

FileKey["demo"] = "demo";
FileKey["demoCss"] = "demoCss";
FileKey["demoScript"] = "demoScript";
FileKey["docs"] = "docs";

@@ -56,4 +54,2 @@ FileKey["readme"] = "readme";

demo: `demo/${options.tagName}.html`,
demoCss: `demo/demo.css`,
demoScript: `demo/${options.tagName}.js`,
docs: `docs/${options.tagName}.md`,

@@ -87,3 +83,7 @@ readme: 'README.md',

});
/** e.g. /Users/alj/Developer/jazz-elements/elements/pf-jazz-hands/pf-jazz-hands.ts */
/**
* e.g. /home/alj/Developer/jazz-elements/elements/pf-jazz-hands/pf-jazz-hands.ts
* @param key file key e.g. component
* @param options element generator options
*/
const getOutputFilePath = (key, options) => join(getComponentAbsPath(options), getFilePathsRelativeToPackageDir(options)[key]);

@@ -144,2 +144,3 @@ async function shouldWriteToDir(options) {

* Generate an Element
* @param options element generator options
*/

@@ -146,0 +147,0 @@ export async function generateElement(options) {

import { readFile, writeFile } from 'fs/promises';
export { readFile, writeFile };
/**
* @param [string] prop name
*/
export declare function getInterpolationRegExp(string?: string): RegExp;
/**
* @param template ejs-like template
* @param interpolations record of keywords to replace.
*/
export declare function processTemplate(template: string, interpolations: Record<string, string>): string;
/** Check if a file exists at a given absolute path */
/**
* Check if a file exists at a given absolute path
* @param path path to file to check
*/
export declare function exists(path: string): Promise<boolean>;
/** $ mkdir -p path */
/**
* $ mkdir -p path
* @param path dir to mk, p
*/
export declare function mkdirp(path: string): Promise<void>;
/**
* @param path json file path
*/
export declare function readJson<T = unknown>(path: string): Promise<T>;
import { mkdir, readFile, stat, writeFile } from 'fs/promises';
export { readFile, writeFile };
/**
* @param [string] prop name
*/
export function getInterpolationRegExp(string) {

@@ -11,2 +14,6 @@ if (typeof string === 'string') {

}
/**
* @param template ejs-like template
* @param interpolations record of keywords to replace.
*/
export function processTemplate(template, interpolations) {

@@ -20,3 +27,6 @@ let partial = template;

}
/** Check if a file exists at a given absolute path */
/**
* Check if a file exists at a given absolute path
* @param path path to file to check
*/
export async function exists(path) {

@@ -30,6 +40,12 @@ try {

}
/** $ mkdir -p path */
/**
* $ mkdir -p path
* @param path dir to mk, p
*/
export async function mkdirp(path) {
await mkdir(path, { recursive: true });
}
/**
* @param path json file path
*/
export async function readJson(path) {

@@ -36,0 +52,0 @@ return readFile(path, 'utf8').then(x => JSON.parse(x));

@@ -1,2 +0,5 @@

/** Memoize an oft-called nary function */
/**
* Memoize an oft-called nary function
* @param fn pure function to memoize
*/
export declare function memoize<T extends (...args: any[]) => unknown>(fn: T): T;

@@ -1,2 +0,5 @@

/** Memoize an oft-called nary function */
/**
* Memoize an oft-called nary function
* @param fn pure function to memoize
*/
export function memoize(fn) {

@@ -3,0 +6,0 @@ if (!fn) {

@@ -17,3 +17,9 @@ export interface BaseOptions {

export type PromptOptions<T> = Partial<T> & BaseOptions;
/**
* @param options the tag and package names, among others
*/
export declare function promptForElementGeneratorOptions(options?: PromptOptions<GenerateElementOptions>): Promise<GenerateElementOptions>;
/**
* Prompt to generate an element definition
*/
export declare function main(): Promise<void>;

@@ -39,2 +39,5 @@ import { generateElement, PackageJSONError } from './generator/element.js';

}
/**
* @param options the tag and package names, among others
*/
export async function promptForElementGeneratorOptions(options) {

@@ -55,5 +58,8 @@ banner();

async function getDefaultPackageName() {
return (await readJsonOrVoid(join(process.cwd(), 'elements', 'package.json')))?.name ??
(await readJsonOrVoid(join(process.cwd(), 'package.json')))?.name ?? '';
return (await readJsonOrVoid(join(process.cwd(), 'elements', 'package.json')))?.name
?? (await readJsonOrVoid(join(process.cwd(), 'package.json')))?.name ?? '';
}
/**
* Prompt to generate an element definition
*/
export async function main() {

@@ -60,0 +66,0 @@ return Promise.resolve(Yargs(process.argv)

{
"name": "@patternfly/create-element",
"version": "1.0.2",
"version": "1.0.3",
"description": "Scaffold web components monorepos based on PatternFly Elements",

@@ -46,9 +46,9 @@ "author": "Benny Powers <bennyp@redhat.com>",

"dependencies": {
"case": "1.6.3",
"chalk": "5.0.1",
"execa": "^7.1.0",
"ncp": "2.0.0",
"prompts": "2.4.2",
"tslib": "2.5.0",
"yargs": "17.7.1"
"case": "^1.6.3",
"chalk": "^5.3.0",
"execa": "^9.3.1",
"ncp": "^2.0.0",
"prompts": "^2.4.2",
"tslib": "^2.6.3",
"yargs": "^17.7.2"
},

@@ -55,0 +55,0 @@ "directories": {

import { test } from '@playwright/test';
import { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';
import { SSRPage } from '@patternfly/pfe-tools/test/playwright/SSRPage.js';

@@ -12,2 +13,14 @@ const tagName = '<%= tagName %>';

});
test('ssr', async ({ browser }) => {
const fixture = new SSRPage({
tagName,
browser,
demoDir: new URL('../demo/', import.meta.url),
importSpecifiers: [
`@patternfly/elements/${tagName}/${tagName}.js`,
],
});
await fixture.snapshots();
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc