Skip to content

build: component builder packages clean-up unused plugins; move bundle-builder to documentation package #2381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
# -------------------------------------------------------------
vrt:
name: Testing
if: ${{ contains(github.event.pull_request.labels.*.name, 'run_vrt') || ((github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'run_ci')) && github.event.pull_request.mergeable == true) }}
if: github.event.pull_request.base.ref != 'spectrum-two' && (contains(github.event.pull_request.labels.*.name, 'run_vrt') || ((github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'run_ci')) && github.event.pull_request.mergeable == true))
uses: ./.github/workflows/vrt.yml
with:
skip: ${{ contains(github.event.pull_request.labels.*.name, 'skip_vrt') }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ jobs:
- name: Deploy
uses: nwtgck/actions-netlify@v2
with:
# publish-dir: site/dist
publish-dir: dist
publish-dir: site/dist
production-branch: main
production-deploy: false
netlify-config-path: ./netlify.toml
Expand Down
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/node_modules
/tasks
/temp
/gulpfile.js
npm-debug.log
/.github
/dist/docs/
Expand Down
114 changes: 48 additions & 66 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { resolve } = require("path");
const { join, dirname, resolve } = require("path");
const { readdirSync } = require("fs");

const componentsPath = resolve(__dirname, "../components");
Expand All @@ -7,6 +7,7 @@ const componentPkgs = readdirSync(componentsPath, {
})
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);

module.exports = {
stories: [
"../components/*/stories/*.stories.js",
Expand Down Expand Up @@ -48,15 +49,18 @@ module.exports = {
env: {
MIGRATED_PACKAGES: componentPkgs.filter((dir) => {
const {
devDependencies = {},
} = require(resolve(componentsPath, dir, "package.json"));
if (
devDependencies &&
devDependencies["@spectrum-css/component-builder-simple"]
) {
return true;
}
return false;
peerDependencies = {}
} = require(
`@spectrum-css/${dir}/package.json`
) ?? {};
return Boolean(peerDependencies["@spectrum-css/tokens"]);
}),
VERSIONS: componentPkgs.reduce((currObj, dir) => {
const { version } = require(
`@spectrum-css/${dir}/package.json`
) ?? {};
currObj[dir] = version;
return currObj;
}),
},
webpackFinal: function (config) {
Expand All @@ -66,50 +70,42 @@ module.exports = {

// Parse out any storybook rules for CSS so we can replace them with our own
const storybookRules =
config && config.module && config.module.rules
config?.module?.rules
? config.module.rules.filter(
(rule) => !(rule.test && rule.test.toString().includes("css"))
)
: [];

return {
...config,
stats: {
/* Suppress autoprefixer warnings from storybook build */
warningsFilter: [/autoprefixer: /],
},
/* Add support for root node_modules imports */
ignoreWarnings: [
...config.ignoreWarnings ?? [],
/autoprefixer: /
],
resolve: {
...(config.resolve ? config.resolve : {}),
...(config.resolve ?? {}),
modules: [
...(config.resolve ? config.resolve.modules : []),
...(config.resolve?.modules ?? []),
/* Add support for root node_modules imports */
resolve(__dirname, "../node_modules"),
],
alias: {
...(config.resolve ? config.resolve.alias : {}),
...(config.resolve?.alias ?? {}),
...componentPkgs.reduce((pkgs, dir) => {
const pkg = require(resolve(componentsPath, dir, "package.json"));
pkgs[pkg.name] = resolve(componentsPath, dir);
const { name } = require(`@spectrum-css/${dir}/package.json`);
const pkgPath = resolve(require.resolve(`@spectrum-css/${dir}/package.json`));
pkgs[name] = dirname(pkgPath);
return pkgs;
}, {}),
},
}
},
module: {
...(config.module ?? []),
...(config.module ?? {}),
rules: [
...storybookRules,
{
test: /^\w+\.{ico,jpg,jpeg,png,gif,webp}$/i,
use: [
{
loader: "file-loader",
options: {
outputPath: (url) => `assets/images/${url.replace(/_\//g, "")}`,
},
},
],
},
{
test: /\.css$/i,
// exclude: [/node_modules/, /dist/],
sideEffects: true,
use: [
{
Expand All @@ -119,64 +115,50 @@ module.exports = {
attributes: {
"data-source": "processed",
},
},
}
},
{
loader: "file-loader",
loader: 'file-loader',
options: {
name: "[path][name].[ext][query]",
name: '[path][name].[ext][query]',
outputPath: (url) => {
const cleanURL = url.replace(/_\//g, "");
if (/node_modules\/@spectrum-css/.test(url)) {
return `assets/css/${cleanURL.replace(/node_modules\/@spectrum-css\//g, "")}`;
const cleanUrl = url.replace(/_\//g, '');
if (/node_modules\/@spectrum-css/.test(cleanUrl)) {
return `assets/css/${cleanUrl.replace(/node_modules\/@spectrum-css\//g, "")}`;
}

return `assets/css/${cleanURL}`;
return `assets/css/${cleanUrl}`;
},
esModule: false,
},
},
{
loader: "postcss-loader",
// Gets options from `postcss.config.js`
loader: 'postcss-loader',
options: {
implementation: require("postcss"),
implementation: require('postcss'),
postcssOptions: {
config: resolve(__dirname, "postcss.config.js"),
config: true,
},
},
},
sourceMap: true,
}
}
],
},
{
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"],
} /* Raw SVG loader */,
{
test: /\.svg$/i,
loader: "raw-loader",
},
],
},
]
}
};
},
framework: {
name: "@storybook/web-components-webpack5",
options: {},
},
features: {
/* Code splitting flag; load stories on-demand */
storyStoreV7: true,
/* Builds stories.json to help with on-demand loading */
buildStoriesJson: true,
lazyCompilation: true,
fsCache: true,
},
// refs: {
// 'swc': {
// title: 'Spectrum Web Components',
// url: 'https://opensource.adobe.com/spectrum-web-components/storybook/',
// expanded: false,
// },
// },
docs: {
autodocs: true, // see below for alternatives
defaultName: "Docs", // set to change the name of generated docs entries
Expand Down
52 changes: 23 additions & 29 deletions .storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,41 @@
"@spectrum-css/vars": "^9.0.8"
},
"devDependencies": {
"@babel/core": "^7.22.1",
"@chromaui/addon-visual-tests": "^0.0.124",
"@babel/core": "^7.23.9",
"@chromaui/addon-visual-tests": "^1.0.0",
"@etchteam/storybook-addon-status": "^4.2.4",
"@spectrum-css/component-builder": "^7.0.2",
"@spectrum-css/component-builder-simple": "^5.0.4",
"@storybook/addon-a11y": "^7.6.16",
"@storybook/addon-actions": "^7.6.16",
"@storybook/addon-a11y": "^7.6.17",
"@storybook/addon-actions": "^7.6.17",
"@storybook/addon-console": "^3.0.0",
"@storybook/addon-docs": "^7.6.16",
"@storybook/addon-essentials": "^7.6.14",
"@storybook/addon-interactions": "^7.6.16",
"@storybook/api": "^7.6.16",
"@storybook/blocks": "^7.6.14",
"@storybook/client-api": "^7.6.16",
"@storybook/components": "^7.6.14",
"@storybook/core-events": "^7.6.14",
"@storybook/addon-docs": "^7.6.17",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",
"@storybook/api": "^7.6.17",
"@storybook/blocks": "^7.6.17",
"@storybook/client-api": "^7.6.17",
"@storybook/components": "^7.6.17",
"@storybook/core-events": "^7.6.17",
"@storybook/jest": "^0.2.3",
"@storybook/manager-api": "^7.6.14",
"@storybook/preview-api": "^7.6.14",
"@storybook/manager-api": "^7.6.17",
"@storybook/preview-api": "^7.6.17",
"@storybook/testing-library": "^0.2.2",
"@storybook/theming": "^7.6.14",
"@storybook/web-components-webpack5": "^7.6.16",
"@storybook/theming": "^7.6.17",
"@storybook/web-components-webpack5": "^7.6.17",
"@whitespace/storybook-addon-html": "^5.1.6",
"chromatic": "^10.3.1",
"chromatic": "^11.0.0",
"file-loader": "6.2.0",
"lit": "^3.1.2",
"lodash-es": "^4.17.21",
"postcss": "^8.4.35",
"postcss-class-prefix": "^0.3.0",
"postcss-loader": "^4.0.0",
"postcss-prefix-selector": "^1.16.0",
"postcss-selector-replace": "^1.0.2",
"postcss-warn-cleaner": "^0.1.9",
"postcss-loader": "^8.1.0",
"prettier": "^2.8.8",
"raw-loader": "^4.0.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-syntax-highlighter": "^15.5.0",
"source-map-loader": "^4.0.1",
"storybook": "^7.6.16",
"source-map-loader": "^5.0.0",
"storybook": "^7.6.17",
"style-loader": "3.3.4",
"webpack": "^5.83.1"
"webpack": "^5.90.3"
}
}
99 changes: 0 additions & 99 deletions .storybook/postcss.config.js

This file was deleted.

Loading