Add initial migration script (#40564)
* Add initial integrate plugin package * Add changelog * Make plugin data parsing less strict, to support bad formatting * Update package dependency * Remove unused code
This commit is contained in:
parent
fd3571e9e2
commit
a28a552bbf
|
@ -0,0 +1,12 @@
|
|||
module.exports = {
|
||||
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
|
||||
root: true,
|
||||
overrides: [
|
||||
{
|
||||
files: [ '**/*.js', '**/*.jsx', '**/*.tsx' ],
|
||||
rules: {
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
package-lock=false
|
|
@ -0,0 +1,4 @@
|
|||
# @woocommerce/integrate-plugin
|
||||
|
||||
Integrate plugin is a tool to help existing WordPress plugins get set up with JavaScript & React in order to extend and create Blocks.
|
||||
The tool can also be used for scaffolding block examples.
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
extends: '../internal-js-tests/babel.config.js',
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
require( '../build' );
|
|
@ -0,0 +1,3 @@
|
|||
# Changelog
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Add initial scripts for integrate plugin to get plugin details.
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Initial version of @woocommerce/block-templates package. Adds registerWooBlockType and useWooBlockProps.
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "woocommerce/block-templates",
|
||||
"description": "WooCommerce Admin block templates component library",
|
||||
"type": "library",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"minimum-stability": "dev",
|
||||
"require-dev": {
|
||||
"automattic/jetpack-changelogger": "3.3.0"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.2"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"changelogger": {
|
||||
"formatter": {
|
||||
"filename": "../../../tools/changelogger/class-package-formatter.php"
|
||||
},
|
||||
"types": {
|
||||
"fix": "Fixes an existing bug",
|
||||
"add": "Adds functionality",
|
||||
"update": "Update existing functionality",
|
||||
"dev": "Development related task",
|
||||
"tweak": "A minor adjustment to the codebase",
|
||||
"performance": "Address performance issues",
|
||||
"enhancement": "Improve existing functionality"
|
||||
},
|
||||
"changelog": "CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,483 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "2d316cec186ab12385e8dda54f6df0f6",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "automattic/jetpack-changelogger",
|
||||
"version": "v3.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Automattic/jetpack-changelogger.git",
|
||||
"reference": "8f63c829b8d1b0d7b1d5de93510d78523ed18959"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Automattic/jetpack-changelogger/zipball/8f63c829b8d1b0d7b1d5de93510d78523ed18959",
|
||||
"reference": "8f63c829b8d1b0d7b1d5de93510d78523ed18959",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"symfony/console": "^3.4 || ^5.2 || ^6.0",
|
||||
"symfony/process": "^3.4 || ^5.2 || ^6.0",
|
||||
"wikimedia/at-ease": "^1.2 || ^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"wikimedia/testing-access-wrapper": "^1.0 || ^2.0",
|
||||
"yoast/phpunit-polyfills": "1.0.4"
|
||||
},
|
||||
"bin": [
|
||||
"bin/changelogger"
|
||||
],
|
||||
"type": "project",
|
||||
"extra": {
|
||||
"autotagger": true,
|
||||
"branch-alias": {
|
||||
"dev-trunk": "3.3.x-dev"
|
||||
},
|
||||
"mirror-repo": "Automattic/jetpack-changelogger",
|
||||
"version-constants": {
|
||||
"::VERSION": "src/Application.php"
|
||||
},
|
||||
"changelogger": {
|
||||
"link-template": "https://github.com/Automattic/jetpack-changelogger/compare/${old}...${new}"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Automattic\\Jetpack\\Changelog\\": "lib",
|
||||
"Automattic\\Jetpack\\Changelogger\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0-or-later"
|
||||
],
|
||||
"description": "Jetpack Changelogger tool. Allows for managing changelogs by dropping change files into a changelog directory with each PR.",
|
||||
"support": {
|
||||
"source": "https://github.com/Automattic/jetpack-changelogger/tree/v3.3.0"
|
||||
},
|
||||
"time": "2022-12-26T13:49:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.1.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
|
||||
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "https://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/php-fig/log/tree/1.1.4"
|
||||
},
|
||||
"time": "2021-05-03T11:20:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "3.4.x-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/a10b1da6fc93080c180bba7219b5ff5b7518fe81",
|
||||
"reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"symfony/debug": "~2.8|~3.0|~4.0",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/dependency-injection": "<3.4",
|
||||
"symfony/process": "<3.3"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~3.3|~4.0",
|
||||
"symfony/dependency-injection": "~3.4|~4.0",
|
||||
"symfony/event-dispatcher": "~2.8|~3.0|~4.0",
|
||||
"symfony/lock": "~3.4|~4.0",
|
||||
"symfony/process": "~3.3|~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "For using the console logger",
|
||||
"symfony/event-dispatcher": "",
|
||||
"symfony/lock": "",
|
||||
"symfony/process": ""
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Console\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/3.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-24T10:57:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "4.4.x-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "1a692492190773c5310bc7877cb590c04c2f05be"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/1a692492190773c5310bc7877cb590c04c2f05be",
|
||||
"reference": "1a692492190773c5310bc7877cb590c04c2f05be",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.3",
|
||||
"psr/log": "^1|^2|^3"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/http-kernel": "<3.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/http-kernel": "^3.4|^4.0|^5.0"
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Debug\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Provides tools to ease debugging PHP code",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/debug/tree/v4.4.44"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"abandoned": "symfony/error-handler",
|
||||
"time": "2022-07-28T16:29:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "1.x-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "42292d99c55abe617799667f454222c54c60e229"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229",
|
||||
"reference": "42292d99c55abe617799667f454222c54c60e229",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"provide": {
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance"
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.28-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for the Mbstring extension",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"mbstring",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-07-28T09:04:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "3.4.x-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/b8648cf1d5af12a44a51d07ef9bf980921f15fca",
|
||||
"reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Process\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/process/tree/3.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-24T10:57:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "wikimedia/at-ease",
|
||||
"version": "v2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/wikimedia/at-ease.git",
|
||||
"reference": "013ac61929797839c80a111a3f1a4710d8248e7a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/wikimedia/at-ease/zipball/013ac61929797839c80a111a3f1a4710d8248e7a",
|
||||
"reference": "013ac61929797839c80a111a3f1a4710d8248e7a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6.99"
|
||||
},
|
||||
"require-dev": {
|
||||
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||
"jakub-onderka/php-parallel-lint": "1.0.0",
|
||||
"mediawiki/mediawiki-codesniffer": "22.0.0",
|
||||
"mediawiki/minus-x": "0.3.1",
|
||||
"ockcyp/covers-validator": "0.5.1 || 0.6.1",
|
||||
"phpunit/phpunit": "4.8.36 || ^6.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/Wikimedia/Functions.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Wikimedia\\AtEase\\": "src/Wikimedia/AtEase/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Tim Starling",
|
||||
"email": "tstarling@wikimedia.org"
|
||||
},
|
||||
{
|
||||
"name": "MediaWiki developers",
|
||||
"email": "wikitech-l@lists.wikimedia.org"
|
||||
}
|
||||
],
|
||||
"description": "Safe replacement to @ for suppressing warnings.",
|
||||
"homepage": "https://www.mediawiki.org/wiki/at-ease",
|
||||
"support": {
|
||||
"source": "https://github.com/wikimedia/at-ease/tree/master"
|
||||
},
|
||||
"time": "2018-10-10T15:39:06+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"platform-overrides": {
|
||||
"php": "7.2"
|
||||
},
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rootDir": "./src",
|
||||
"preset": "../node_modules/@woocommerce/internal-js-tests/jest-preset.js"
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
{
|
||||
"name": "@woocommerce/integrate-plugin",
|
||||
"version": "0.1.0",
|
||||
"description": "WooCommerce plugin integration scripts.",
|
||||
"author": "Automattic",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"keywords": [
|
||||
"wordpress",
|
||||
"woocommerce",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/integrate-plugin/README.md",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/woocommerce/woocommerce.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/woocommerce/woocommerce/issues"
|
||||
},
|
||||
"main": "build/index.js",
|
||||
"bin": {
|
||||
"woo-integrate-plugin": "./build/index.js"
|
||||
},
|
||||
"types": "build-types",
|
||||
"react-native": "src/index",
|
||||
"sideEffects": [],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wordpress/create-block": "wp-6.0",
|
||||
"chalk": "^4.1.2",
|
||||
"change-case": "^4.1.2",
|
||||
"commander": "^9.2.0",
|
||||
"execa": "^4.0.2",
|
||||
"fast-glob": "^3.2.7",
|
||||
"inquirer": "^7.1.0",
|
||||
"npm-package-arg": "^8.1.5",
|
||||
"rimraf": "^3.0.2",
|
||||
"write-pkg": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.21.3",
|
||||
"@babel/runtime": "^7.17.2",
|
||||
"@testing-library/jest-dom": "^5.16.2",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^16.18.18",
|
||||
"@types/testing-library__jest-dom": "^5.14.3",
|
||||
"@woocommerce/eslint-plugin": "workspace:*",
|
||||
"@woocommerce/internal-js-tests": "workspace:*",
|
||||
"@wordpress/browserslist-config": "wp-6.0",
|
||||
"copy-webpack-plugin": "^9.1.0",
|
||||
"css-loader": "^3.6.0",
|
||||
"eslint": "^8.32.0",
|
||||
"jest": "^27.5.1",
|
||||
"jest-cli": "^27.5.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-jest": "^27.1.3",
|
||||
"typescript": "^5.1.6",
|
||||
"webpack": "^5.70.0",
|
||||
"webpack-cli": "^3.3.12"
|
||||
},
|
||||
"scripts": {
|
||||
"turbo:build": "pnpm run build:js",
|
||||
"turbo:test": "jest --config ./jest.config.json",
|
||||
"prepare": "composer install",
|
||||
"changelog": "composer exec -- changelogger",
|
||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { existsSync, readFileSync, promises } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { info } from './log';
|
||||
|
||||
const { writeFile } = promises;
|
||||
function getUniqueItems( arr: string[] ) {
|
||||
const uniqueObject = arr.reduce( ( unique, item ) => {
|
||||
unique[ item ] = true;
|
||||
return unique;
|
||||
}, {} as Record< string, boolean > );
|
||||
|
||||
return Object.keys( uniqueObject );
|
||||
}
|
||||
|
||||
const getPluginConfig = () => {
|
||||
const cwd = join( process.cwd() );
|
||||
|
||||
if ( ! existsSync( join( cwd, '.woo-plugin.json' ) ) ) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return JSON.parse(
|
||||
readFileSync( join( cwd, '.woo-plugin.json' ), 'utf8' )
|
||||
);
|
||||
};
|
||||
|
||||
const updateConfig = async ( { modules }: { modules: string[] } ) => {
|
||||
const cwd = join( process.cwd() );
|
||||
const config = getPluginConfig();
|
||||
|
||||
const uniqueModules = modules.reduce( ( unique, module ) => {
|
||||
unique[ module ] = true;
|
||||
return unique;
|
||||
}, {} as Record< string, boolean > );
|
||||
|
||||
config.modules = Object.keys( uniqueModules );
|
||||
|
||||
info( '' );
|
||||
info( 'Updating plugin config file.' );
|
||||
|
||||
await writeFile(
|
||||
join( cwd, '.woo-plugin.json' ),
|
||||
JSON.stringify( config, null, 4 )
|
||||
);
|
||||
};
|
||||
|
||||
export { getPluginConfig, getUniqueItems, updateConfig };
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { readdirSync, readFileSync } from 'fs';
|
||||
import CLIError from '@wordpress/create-block/lib/cli-error';
|
||||
import path from 'path';
|
||||
|
||||
/**
|
||||
* Get the plugin data.
|
||||
*
|
||||
* @return {Object} - Plugin data as key value pairs.
|
||||
*/
|
||||
export function getPluginData() {
|
||||
const files = readdirSync( process.cwd() );
|
||||
for ( let i = 0; i < files.length; i++ ) {
|
||||
const file = path.join( process.cwd(), files[ i ] );
|
||||
if ( path.extname( file ) !== '.php' ) {
|
||||
continue;
|
||||
}
|
||||
const content = readFileSync( file, 'utf8' );
|
||||
const name = content.match( /^\s+\*\s*Plugin Name:\s*(.*)/m );
|
||||
if ( name && name.length > 1 ) {
|
||||
const description = content.match(
|
||||
/^\s+\*\s+Description:\s*(.*)/m
|
||||
);
|
||||
const textdomain = content.match( /^\s+\*\s*Text Domain:\s*(.*)/m );
|
||||
const version = content.match( /^\s+\*\s*Version:\s*(.*)/m );
|
||||
|
||||
return {
|
||||
description: description && description[ 1 ].trim(),
|
||||
name: name[ 1 ].trim(),
|
||||
textdomain: textdomain && textdomain[ 1 ].trim(),
|
||||
version: version && version[ 1 ].trim(),
|
||||
namespace: textdomain && textdomain[ 1 ].trim(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
throw new CLIError( 'Plugin file not found.' );
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Command } from 'commander';
|
||||
import CLIError from '@wordpress/create-block/lib/cli-error';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import * as log from './log';
|
||||
import { getPluginData } from './get-plugin-data';
|
||||
import { getPluginConfig } from './get-plugin-config';
|
||||
|
||||
//add the following line
|
||||
const program = new Command();
|
||||
|
||||
const commandName = `woo-integrate-plugin`;
|
||||
program
|
||||
.name( commandName )
|
||||
.description(
|
||||
'Integrates a plugin with WooCommerce build scripts and dependencies.\n\n' +
|
||||
'The provided build scripts provide an easy way to build in a modern ' +
|
||||
'JS environment and automatically assist in building block assets. '
|
||||
)
|
||||
.version( '0.1.0' )
|
||||
.option(
|
||||
'--wp-scripts',
|
||||
'enable integration with `@wordpress/scripts` package'
|
||||
)
|
||||
.option(
|
||||
'--no-wp-scripts',
|
||||
'disable integration with `@wordpress/scripts` package'
|
||||
)
|
||||
.option(
|
||||
'-t, --template <name>',
|
||||
'project template type name; allowed values: "standard", "es5", the name of an external npm package, or the path to a local directory',
|
||||
'standard'
|
||||
)
|
||||
.option( '--variant <variant>', 'the variant of the template to use' )
|
||||
.option( '--wp-env', 'enable integration with `@wordpress/env` package' )
|
||||
.option(
|
||||
'--includes-dir <dir>',
|
||||
'the path to the includes directory with backend logic'
|
||||
)
|
||||
.option(
|
||||
'--src-dir <dir>',
|
||||
'the path to the src directory with client-side logic'
|
||||
)
|
||||
.option( '--namespace <value>', 'internal namespace for the plugin' )
|
||||
.action( async () => {
|
||||
try {
|
||||
const pluginData = getPluginData();
|
||||
const pluginConfig = getPluginConfig();
|
||||
log.info( JSON.stringify( pluginData ) );
|
||||
log.info( JSON.stringify( pluginConfig ) );
|
||||
} catch ( error ) {
|
||||
if ( error instanceof CLIError ) {
|
||||
log.error( error.message );
|
||||
process.exit( 1 );
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
} )
|
||||
.on( '--help', () => {
|
||||
log.info( '' );
|
||||
log.info( 'Examples:' );
|
||||
log.info( ` $ ${ commandName }` );
|
||||
log.info( ` $ ${ commandName } todo-list` );
|
||||
log.info(
|
||||
` $ ${ commandName } todo-list --template es5 --title "TODO List"`
|
||||
);
|
||||
} )
|
||||
.parse( process.argv );
|
|
@ -0,0 +1,23 @@
|
|||
/* eslint-disable no-console */
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import chalk from 'chalk';
|
||||
|
||||
const code = ( input: string ) => {
|
||||
console.log( chalk.cyan( input ) );
|
||||
};
|
||||
|
||||
const error = ( input: string ) => {
|
||||
console.log( chalk.bold.red( input ) );
|
||||
};
|
||||
|
||||
const info = ( input: string ) => {
|
||||
console.log( input );
|
||||
};
|
||||
const success = ( input: string ) => {
|
||||
console.log( chalk.bold.green( input ) );
|
||||
};
|
||||
|
||||
export { code, error, info, success };
|
||||
/* eslint-enable no-console */
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"extends": "../tsconfig-cjs",
|
||||
"include": [
|
||||
"**/*.d.ts",
|
||||
"src/**/*",
|
||||
"src/**/*.json"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"outDir": "build",
|
||||
"resolveJsonModule": true,
|
||||
"typeRoots": [
|
||||
"./typings",
|
||||
"./node_modules/@types"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"extends": "../tsconfig",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "build-module",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"declarationDir": "./build-types",
|
||||
"resolveJsonModule": true,
|
||||
"typeRoots": [ "./typings", "./node_modules/@types" ]
|
||||
},
|
||||
"include": [ "**/*.d.ts", "src/**/*", "src/**/*.json" ]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
declare module '@wordpress/create-block/lib/cli-error' {
|
||||
export default Error;
|
||||
}
|
999
pnpm-lock.yaml
999
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue