Wireit Added: `@woocommerce/block-library`

This commit is contained in:
Christopher Allford 2023-12-09 22:35:11 -08:00
parent 84ead6de63
commit dc5aa18f35
4 changed files with 84 additions and 72 deletions

View File

@ -84,7 +84,7 @@ const getCoreConfig = ( options = {} ) => {
filename: ( chunkData ) => {
return `${ paramCase( chunkData.chunk.name ) }.js`;
},
path: path.resolve( __dirname, '../../woocommerce/assets/client/blocks/' ),
path: path.resolve( __dirname, '../build/' ),
library: [ 'wc', '[name]' ],
libraryTarget: 'this',
uniqueName: 'webpackWcBlocksJsonp',
@ -117,7 +117,7 @@ const getCoreConfig = ( options = {} ) => {
...getSharedPlugins( { bundleAnalyzerReportTitle: 'Core' } ),
new ProgressBarPlugin( getProgressBarPluginConfig( 'Core' ) ),
new CreateFileWebpack( {
path: '../woocommerce',
path: './',
// file name
fileName: 'blocks.ini',
// content of the file
@ -183,7 +183,7 @@ const getMainConfig = ( options = {} ) => {
entry: getEntryConfig( 'main', options.exclude || [] ),
output: {
devtoolNamespace: 'wc',
path: path.resolve( __dirname, '../../woocommerce/assets/client/blocks/' ),
path: path.resolve( __dirname, '../build/' ),
// This is a cache busting mechanism which ensures that the script is loaded via the browser with a ?ver=hash
// string. The hash is based on the built file contents.
// @see https://github.com/webpack/webpack/issues/2329
@ -317,7 +317,7 @@ const getFrontConfig = ( options = {} ) => {
entry: getEntryConfig( 'frontend', options.exclude || [] ),
output: {
devtoolNamespace: 'wc',
path: path.resolve( __dirname, '../../woocommerce/assets/client/blocks/' ),
path: path.resolve( __dirname, '../build/' ),
// This is a cache busting mechanism which ensures that the script is loaded via the browser with a ?ver=hash
// string. The hash is based on the built file contents.
// @see https://github.com/webpack/webpack/issues/2329
@ -442,7 +442,7 @@ const getPaymentsConfig = ( options = {} ) => {
entry: getEntryConfig( 'payments', options.exclude || [] ),
output: {
devtoolNamespace: 'wc',
path: path.resolve( __dirname, '../../woocommerce/assets/client/blocks/' ),
path: path.resolve( __dirname, '../build/' ),
filename: `[name].js`,
uniqueName: 'webpackWcBlocksPaymentMethodExtensionJsonp',
},
@ -549,7 +549,7 @@ const getExtensionsConfig = ( options = {} ) => {
entry: getEntryConfig( 'extensions', options.exclude || [] ),
output: {
devtoolNamespace: 'wc',
path: path.resolve( __dirname, '../../woocommerce/assets/client/blocks/' ),
path: path.resolve( __dirname, '../build/' ),
filename: `[name].js`,
uniqueName: 'webpackWcBlocksExtensionsMethodExtensionJsonp',
},
@ -656,7 +656,7 @@ const getSiteEditorConfig = ( options = {} ) => {
entry: getEntryConfig( 'editor', options.exclude || [] ),
output: {
devtoolNamespace: 'wc',
path: path.resolve( __dirname, '../../woocommerce/assets/client/blocks/' ),
path: path.resolve( __dirname, '../build/' ),
filename: `[name].js`,
chunkLoadingGlobal: 'webpackWcBlocksExtensionsMethodExtensionJsonp',
},
@ -763,7 +763,7 @@ const getStylingConfig = ( options = {} ) => {
entry: getEntryConfig( 'styling', options.exclude || [] ),
output: {
devtoolNamespace: 'wc',
path: path.resolve( __dirname, '../../woocommerce/assets/client/blocks/' ),
path: path.resolve( __dirname, '../build/' ),
filename: `[name]-style${ fileSuffix }.js`,
library: [ 'wc', 'blocks', '[name]' ],
libraryTarget: 'this',
@ -914,7 +914,7 @@ const getInteractivityAPIConfig = ( options = {} ) => {
},
output: {
filename: '[name].js',
path: path.resolve( __dirname, '../../woocommerce/assets/client/blocks/' ),
path: path.resolve( __dirname, '../build/' ),
library: [ 'wc', '__experimentalInteractivity' ],
libraryTarget: 'this',
chunkLoadingGlobal: 'webpackWcBlocksJsonp',

View File

@ -43,21 +43,29 @@
"license": "GPL-3.0+",
"scripts": {
"analyze-bundles": "cross-env WP_BUNDLE_ANALYZER=1 npm run build",
"build": "rimraf build/* && cross-env BABEL_ENV=default NODE_ENV=production webpack",
"changelog": "composer install && composer exec -- changelogger",
"build": "pnpm --if-present --filter=\"$npm_package_name...\" build:project",
"build:project": "pnpm --if-present /^build:project:.*$/",
"build:project:bundle": "wireit",
"build:check-assets": "rimraf build/* && cross-env ASSET_CHECK=true BABEL_ENV=default NODE_ENV=production webpack",
"build:deploy": "rimraf vendor/* && cross-env WOOCOMMERCE_BLOCKS_PHASE=2 composer install --no-dev && cross-env WOOCOMMERCE_BLOCKS_PHASE=2 npm run build --loglevel error",
"prebuild:docs": "rimraf docs/extensibility/actions.md & rimraf docs/extensibility/filters.md",
"build:docs": "./vendor/bin/wp-hooks-generator --input=src --output=bin/hook-docs/data && node ./bin/hook-docs",
"postbuild:docs": "./bin/add-doc-footer.sh",
"changelog": "node ./bin/changelog",
"changelog:zenhub": "node ./bin/changelog --changelogSrcType='ZENHUB_RELEASE'",
"change-versions": "source ./bin/change-versions.sh",
"deploy": "npm run build:deploy && sh ./bin/github-deploy.sh",
"dev": "rimraf build/* && cross-env BABEL_ENV=default webpack",
"labels:dry": "github-label-sync --labels ./.github/label-sync-config.json --allow-added-labels --dry-run woocommerce/woocommerce-gutenberg-products-block",
"labels:sync": "github-label-sync --labels ./.github/label-sync-config.json --allow-added-labels woocommerce/woocommerce-gutenberg-products-block",
"fix-package-lock": "./bin/fix-package-lock.sh",
"lint": "npm run lint:php && npm run lint:css && npm run lint:js",
"lint": "pnpm --if-present '/^lint:lang:.*$/'",
"lint:fix": "pnpm --if-present '/^lint:fix:lang:.*$/'",
"lint:fix:lang:css": "pnpm lint:css-fix",
"lint:fix:lang:js": "pnpm lint:js-fix",
"lint:fix:lang:php": "pnpm lint:php-fix",
"lint:lang:css": "pnpm lint:css",
"lint:lang:js": "pnpm lint:js",
"lint:lang:php": "pnpm lint:php",
"lint:ci": "npm run lint:js && npm run lint:css",
"lint:css": "stylelint '**/*.scss'",
"lint:css-fix": "stylelint '**/*.scss' --fix",
@ -67,6 +75,7 @@
"lint:md:docs": "wp-scripts lint-md-docs",
"lint:php": "composer run-script phpcs ./src && composer run-script phpcs ./tests/mocks/woo-test-helper",
"lint:php-fix": "composer run-script phpcbf ./src && composer run-script phpcbf ./tests/mocks/woo-test-helper",
"fix-package-lock": "./bin/fix-package-lock.sh",
"package-plugin": "rimraf woocommerce-gutenberg-products-block.zip && ./bin/build-plugin-zip.sh",
"package-plugin:dev": "rimraf woocommerce-gutenberg-products-block.zip && ./bin/build-plugin-zip.sh -d",
"package-plugin:zip-only": "rimraf woocommerce-gutenberg-products-block.zip && ./bin/build-plugin-zip.sh -z",
@ -79,7 +88,7 @@
"storybook": "storybook dev -c ./storybook -p 6006 --ci",
"storybook:build": "BABEL_ENV=development storybook build -c ./storybook -o ./storybook/dist",
"storybook:deploy": "rimraf ./storybook/dist/* && npm run storybook:build && gh-pages -d ./storybook/dist",
"test": "wp-scripts test-unit-js --config tests/js/jest.config.json",
"test:js": "wireit",
"test:debug": "ndb .",
"test:e2e": "sh ./bin/check-env.sh && npx playwright test --config=tests/e2e/playwright.config.ts",
"test:e2e:report": "sh ./bin/check-env.sh && npx playwright test --config=tests/e2e/playwright.config.ts --reporter=html",
@ -102,7 +111,8 @@
"ts:check": "tsc --build",
"ts:log-errors": "npm --silent run ts:check | npx -y @bartekbp/typescript-checkstyle > checkstyle.xml",
"wp-env": "wp-env",
"wp-env:config": "./bin/wp-env-pre-config.sh"
"wp-env:config": "./bin/wp-env-pre-config.sh",
"watch:build": "pnpm build:project --watch"
},
"devDependencies": {
"@actions/core": "1.10.0",
@ -341,5 +351,58 @@
"languages/**/*.json",
"license.txt",
"woocommerce-gutenberg-products-block.php"
]
],
"wireit": {
"build:project:bundle": {
"command": "webpack",
"env": {
"NODE_ENV": "production",
"BABEL_ENV": "default"
},
"files": [
"webpack.config.js",
"bin/webpack-*.js",
"tsconfig.json",
"tsconfig.base.json",
"babel.config.js",
"assets"
],
"output": [
"build"
],
"dependencies": [
"dependencyOutputs"
]
},
"test:js": {
"command": "wp-scripts test-unit-js --config tests/js/jest.config.json",
"dependencies": [
"build:project"
]
},
"dependencyOutputs": {
"allowUsuallyExcludedPaths": true,
"files": [
"node_modules/@woocommerce/eslint-plugin/configs",
"node_modules/@woocommerce/eslint-plugin/rules",
"node_modules/@woocommerce/eslint-plugin/index.js",
"node_modules/@woocommerce/e2e-utils/",
"node_modules/@woocommerce/data/",
"node_modules/@woocommerce/tracks/",
"package.json",
"!node_modules/@woocommerce/tracks/node_modules",
"!node_modules/@woocommerce/tracks/.git",
"!node_modules/@woocommerce/tracks/.svn",
"!node_modules/@woocommerce/tracks/src",
"!node_modules/@woocommerce/data/node_modules",
"!node_modules/@woocommerce/data/.git",
"!node_modules/@woocommerce/data/.svn",
"!node_modules/@woocommerce/data/src",
"!node_modules/@woocommerce/e2e-utils/node_modules",
"!node_modules/@woocommerce/e2e-utils/.git",
"!node_modules/@woocommerce/e2e-utils/.svn",
"!node_modules/@woocommerce/e2e-utils/src"
]
}
}
}

View File

@ -180,10 +180,12 @@
},
"wireit": {
"build:project": {
"command": "rm -rf assets/client/admin assets/js assets/css && cp -r ../woocommerce-admin/build assets/client/admin && cp -r client/legacy/build/js assets/js && cp -r client/legacy/build/css assets/css",
"command": "rm -rf assets/client/admin assets/js assets/css && cp -r ../woocommerce-admin/build assets/client/admin && cp -r client/legacy/build/js assets/js && cp -r client/legacy/build/css assets/css && cp -r ../woocommerce-blocks/build assets/client/blocks && cp -r ../woocommerce-blocks/blocks.ini blocks.ini",
"files": [],
"output": [
"assets/client/admin",
"assets/client/blocks",
"blocks.ini",
"assets/js",
"assets/css"
],

View File

@ -1042,7 +1042,7 @@ importers:
version: link:../experimental
'@wordpress/components':
specifier: wp-6.0
version: 19.8.5(react-dom@17.0.2)(react-with-direction@1.4.0)(react@17.0.2)
version: 19.8.5(@types/react@17.0.71)(react-dom@17.0.2)(react-with-direction@1.4.0)(react@17.0.2)
'@wordpress/compose':
specifier: wp-6.0
version: 5.4.1(react@17.0.2)
@ -20309,7 +20309,7 @@ packages:
'@wordpress/escape-html': 2.47.0
'@wordpress/hooks': 3.6.1
'@wordpress/i18n': 4.6.1
'@wordpress/icons': 8.2.3
'@wordpress/icons': 8.4.0
'@wordpress/is-shallow-equal': 4.24.0
'@wordpress/keycodes': 3.47.0
'@wordpress/primitives': 3.4.1
@ -20391,59 +20391,6 @@ packages:
- react-with-direction
dev: false
/@wordpress/components@19.8.5(react-dom@17.0.2)(react-with-direction@1.4.0)(react@17.0.2):
resolution: {integrity: sha512-36d8fSk/nWfNv2nEZrC2gLx1rN9rGWFt425yXoH6JiakDvdXacN/04xcxZGBRkS+JDz6v22uyPMEol9TzwXOLg==}
engines: {node: '>=12'}
peerDependencies:
react: ^17.0.2
react-dom: ^17.0.0
dependencies:
'@babel/runtime': 7.23.5
'@emotion/cache': 11.11.0
'@emotion/css': 11.11.2
'@emotion/react': 11.11.1(@types/react@17.0.71)(react@17.0.2)
'@emotion/serialize': 1.1.2
'@emotion/styled': 11.11.0(@emotion/react@11.11.1)(@types/react@17.0.71)(react@17.0.2)
'@emotion/utils': 1.0.0
'@use-gesture/react': 10.3.0(react@17.0.2)
'@wordpress/a11y': 3.6.1
'@wordpress/compose': 5.4.1(react@17.0.2)
'@wordpress/date': 4.6.1
'@wordpress/deprecated': 3.41.0
'@wordpress/dom': 3.27.0
'@wordpress/element': 4.4.1
'@wordpress/escape-html': 2.47.0
'@wordpress/hooks': 3.6.1
'@wordpress/i18n': 4.6.1
'@wordpress/icons': 8.2.3
'@wordpress/is-shallow-equal': 4.24.0
'@wordpress/keycodes': 3.47.0
'@wordpress/primitives': 3.4.1
'@wordpress/rich-text': 5.4.2(react@17.0.2)
'@wordpress/warning': 2.6.1
classnames: 2.3.2
colord: 2.9.3
dom-scroll-into-view: 1.2.1
downshift: 6.1.12(react@17.0.2)
framer-motion: 6.5.1(react-dom@17.0.2)(react@17.0.2)
gradient-parser: 0.1.5
highlight-words-core: 1.2.2
lodash: 4.17.21
memize: 1.1.0
moment: 2.29.4
re-resizable: 6.9.11(react-dom@17.0.2)(react@17.0.2)
react: 17.0.2
react-colorful: 5.6.1(react-dom@17.0.2)(react@17.0.2)
react-dates: 17.2.0(moment@2.29.4)(react-dom@17.0.2)(react-with-direction@1.4.0)(react@17.0.2)
react-dom: 17.0.2(react@17.0.2)
react-resize-aware: 3.1.1(react@17.0.2)
reakit: 1.3.11(react-dom@17.0.2)(react@17.0.2)
uuid: 8.3.2
transitivePeerDependencies:
- '@types/react'
- react-with-direction
dev: false
/@wordpress/components@20.0.0(@types/react@17.0.71)(react-dom@17.0.2)(react@17.0.2):
resolution: {integrity: sha512-RBPjtGLSoiV5YKhrBYh+/X8LbzbA99BJaB4Q+P0e1rVOwGzeBF3M7YEjmg1PrrzWaItqJZTvDoyZo+ql7c0KfA==}
engines: {node: '>=12'}