Remove alpha flags (#913)

* remove alpha flags

* revert isPro flag

* update scripts
This commit is contained in:
Cory LaViska
2025-05-08 13:58:26 -04:00
committed by GitHub
parent fe27710f57
commit 22298781c5
16 changed files with 17 additions and 104 deletions

View File

@@ -31,7 +31,7 @@ jobs:
- name: Lint
run: npm run prettier
- name: Build
run: npm run build:alpha
run: npm run build
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run CSR tests

View File

@@ -31,7 +31,7 @@ jobs:
run: npm run prettier
- name: Build
run: npm run build:alpha
run: npm run build
- name: Install Playwright
run: npx playwright install --with-deps

View File

@@ -5,7 +5,6 @@ import { copyCodePlugin } from './_utils/copy-code.js';
import { currentLink } from './_utils/current-link.js';
import { highlightCodePlugin } from './_utils/highlight-code.js';
import { markdown } from './_utils/markdown.js';
import { removeDataAlphaElements } from './_utils/remove-data-alpha-elements.js';
// import { formatCodePlugin } from './_utils/format-code.js';
// import litPlugin from '@lit-labs/eleventy-plugin-lit';
import { readFile } from 'fs/promises';
@@ -22,12 +21,10 @@ import * as url from 'url';
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const packageData = JSON.parse(await readFile(path.join(__dirname, '..', 'package.json'), 'utf-8'));
const isAlpha = process.argv.includes('--alpha');
const isDev = process.argv.includes('--develop');
const globalData = {
package: packageData,
isAlpha,
layout: 'page.njk',
server: {
head: '',
@@ -51,16 +48,6 @@ export default function (eleventyConfig) {
*/
const serverBuild = process.env.WEBAWESOME_SERVER === 'true';
// NOTE - alpha setting removes certain pages
if (isAlpha) {
eleventyConfig.ignores.add('**/experimental/**');
eleventyConfig.ignores.add('**/layout/**');
eleventyConfig.ignores.add('**/patterns/**');
eleventyConfig.ignores.add('**/style-utilities/**');
eleventyConfig.ignores.add('**/components/code-demo.md');
eleventyConfig.ignores.add('**/components/viewport-demo.md');
}
// Add template data
for (let name in globalData) {
eleventyConfig.addGlobalData(name, globalData[name]);
@@ -115,9 +102,6 @@ export default function (eleventyConfig) {
// Helpers
// Remove elements that have [data-alpha="remove"]
eleventyConfig.addPlugin(removeDataAlphaElements({ isAlpha }));
// Use our own markdown instance
eleventyConfig.setLibrary('md', markdown);

View File

@@ -2,7 +2,7 @@
<wa-select appearance="filled" size="small" value="default" pill class="preset-theme-selector">
<wa-icon slot="prefix" name="paintbrush" variant="regular"></wa-icon>
{% for theme in collections.theme | sort %}
<wa-option value="{{ theme.page.fileSlug }}"{{ ' data-alpha="remove"' if theme.noAlpha }}>
<wa-option value="{{ theme.page.fileSlug }}">
{{ theme.data.title }}
</wa-option>
{% endfor %}

View File

@@ -1,4 +1,4 @@
{% if page | show -%}
{% if page -%}
<li>
<a href="{{ page.url }}">{{ page.data.title }}</a>
{% if page.data.status == 'experimental' %}<wa-icon name="flask"></wa-icon>{% endif %}

View File

@@ -178,10 +178,6 @@ export function sort(arr, by = { 'data.order': 1, 'data.title': '' }) {
});
}
export function show(page) {
return !(page.data.noAlpha && page.data.isAlpha) && !page.data.unlisted;
}
/**
* Group an 11ty collection (or any array of objects with a `data.tags` property) by certain tags.
* @param {object[]} collection
@@ -202,7 +198,7 @@ export function groupPages(collection, options = {}, page) {
options = { tags: options };
}
let { tags, groups, titles = {}, other = 'Other', filter = show } = options;
let { tags, groups, titles = {}, other = 'Other' } = options;
if (groups === undefined && Array.isArray(tags)) {
groups = tags;
@@ -241,10 +237,6 @@ export function groupPages(collection, options = {}, page) {
let byUrl = {};
let byParentUrl = {};
if (filter) {
collection = collection.filter(filter);
}
for (let item of collection) {
let url = item.page.url;
let parentUrl = item.data.parentUrl;

View File

@@ -1,23 +0,0 @@
import { parse } from 'node-html-parser';
/**
* Eleventy plugin to add remove elements with <div data-alpha="remove"> from the alpha build.
*/
export function removeDataAlphaElements(options = {}) {
options = {
isAlpha: false,
...options,
};
return function (eleventyConfig) {
eleventyConfig.addTransform('remove-data-alpha-elements', content => {
const doc = parse(content, { blockTextElements: { code: true } });
if (options.isAlpha) {
doc.querySelectorAll('[data-alpha="remove"]').forEach(el => el.remove());
}
return doc.toString();
});
};
}

View File

@@ -2,7 +2,6 @@
title: Code Demo
description: Code demos can be used to render code examples as inline live demos.
tags: component
noAlpha: true
isPro: true
---

View File

@@ -2,7 +2,6 @@
title: Viewport Demo
description: Viewport demos can be used to display an iframe as a resizable, zoomable preview.
tags: component
noAlpha: true
isPro: true
---

View File

@@ -501,13 +501,13 @@ hasOutline: false
</div>
<wa-select name="theme" label="Pick a theme to start!" value="default">
<wa-option value="default">Default</wa-option>
<wa-option data-alpha="remove" value="awesome">Awesome</wa-option>
<wa-option data-alpha="remove" value="premium">Premium</wa-option>
<wa-option data-alpha="remove" value="playful">Playful</wa-option>
<wa-option data-alpha="remove" value="brutalist">Brutalist</wa-option>
<wa-option data-alpha="remove" value="tailspin">Tailspin</wa-option>
<wa-option data-alpha="remove" value="glossy">Glossy</wa-option>
<wa-option data-alpha="remove" value="active">Active</wa-option>
<wa-option value="awesome">Awesome</wa-option>
<wa-option value="premium">Premium</wa-option>
<wa-option value="playful">Playful</wa-option>
<wa-option value="brutalist">Brutalist</wa-option>
<wa-option value="tailspin">Tailspin</wa-option>
<wa-option value="glossy">Glossy</wa-option>
<wa-option value="active">Active</wa-option>
<wa-option value="classic">Classic</wa-option>
</wa-select>
</div>

View File

@@ -4,7 +4,6 @@ description: Callouts are used to display important messages inline.
component: callout
icon: callout
snippets: '.wa-callout'
noAlpha: true
file: styles/native/callout.css
---

View File

@@ -2,6 +2,5 @@
"layout": "patterns.njk",
"tags": ["patterns"],
"wide": true,
"noAlpha": true,
"isPro": true
}

View File

@@ -45,11 +45,9 @@
},
"scripts": {
"start": "node scripts/build.js --develop",
"start:alpha": "echo 'This command has been deprecated. Use: \"npm start\"\n'",
"build": "node scripts/build.js",
"build:serve": "npm run build && npx http-server _site -p 4000",
"build:alpha": "node scripts/build.js --alpha",
"build:alpha:serve": "npm run build:alpha && npx http-server _site -p 4000",
"start:alpha": "node scripts/build.js --alpha --develop",
"publish-alpha-cdn": "./publish-alpha-cdn.sh",
"create": "plop --plopfile scripts/plop/plopfile.js",
"test": "CSR_ONLY=\"true\" web-test-runner --group default",

View File

@@ -20,7 +20,7 @@ then
echo "🚀 OK, blasting off..."
# build it
npm run build:alpha
npm run build
# copy dist-cdn to the CDN
aws --profile early-webawesome-com --endpoint-url https://c0c64e1b38a89d8ae060d40170ceef46.r2.cloudflarestorage.com s3 cp ./dist-cdn s3://early-webawesome-com/webawesome@$version/dist --recursive

View File

@@ -17,7 +17,6 @@ import { cdnDir, distDir, docsDir, rootDir, runScript, siteDir } from './utils.j
const __dirname = dirname(fileURLToPath(import.meta.url));
const isDeveloping = process.argv.includes('--develop');
const isAlpha = process.argv.includes('--alpha');
const spinner = ora({ text: 'Web Awesome', color: 'cyan' }).start();
const packageData = JSON.parse(await readFile(join(rootDir, 'package.json'), 'utf-8'));
const version = JSON.stringify(packageData.version.toString());
@@ -112,39 +111,7 @@ function generateReactWrappers() {
async function generateStyles() {
spinner.start('Copying stylesheets');
//
// NOTE - alpha setting omits certain stylesheets that are pro-only
//
if (isAlpha) {
// Copy all styles
await copy(join(rootDir, 'src/styles'), join(cdnDir, 'styles'), { overwrite: true });
// Remove pro themes
const allThemes = await globby(join(cdnDir, 'styles/themes/**/*.css'));
const proThemes = allThemes.filter(file => {
if (
file.includes('themes/classic') ||
file.includes('themes/default') ||
file.includes('themes/awesome') ||
file.includes('themes/active') ||
file.includes('themes/glossy') ||
file.includes('themes/matter') ||
file.includes('themes/mellow') ||
file.includes('themes/playful') ||
file.includes('themes/premium') ||
file.includes('themes/tailspin') ||
file.includes('themes/brutalist')
) {
return false;
}
return true;
});
// Delete pro themes that shouldn't be in alpha
await Promise.all(proThemes.map(file => deleteAsync(file)));
} else {
await copy(join(rootDir, 'src/styles'), join(cdnDir, 'styles'), { overwrite: true });
}
await copy(join(rootDir, 'src/styles'), join(cdnDir, 'styles'), { overwrite: true });
spinner.succeed();
@@ -277,7 +244,6 @@ async function generateDocs() {
spinner.start('Writing the docs');
const args = [];
if (isAlpha) args.push('--alpha');
if (isDeveloping) args.push('--develop');
let output;

View File

@@ -1,8 +1,8 @@
#!/bin/bash
# if [[ $VERCEL_GIT_COMMIT_REF == "alpha" ]] ; then
echo "Running the alpha build!"
npm run build:alpha
echo "Running the build!"
npm run build
# else
# npm run build
# fi