Skip to content
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

POC: Newsletter widget #41750

Draft
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 62 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added newsletter widget.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "@automattic/newspack-blocks",
"version": "3.5.0",
"author": "Automattic",
"devDependencies": {
"@rushstack/eslint-patch": "^1.10.3",
"@testing-library/dom": "^10.2.0",
"@testing-library/user-event": "^14.5.2",
"@types/lodash": "^4.17.5",
"@types/lodash.debounce": "^4.0.9",
"eslint": "^7.32.0",
"fetch-mock-jest": "^1.5.1",
"html-entities": "^2.5.2",
"identity-obj-proxy": "^3.0.0",
"lint-staged": "^15.2.7",
"newspack-scripts": "^5.5.1",
"postcss-scss": "^4.0.9",
"prettier": "npm:wp-prettier@^2.6.2-beta-1",
"stylelint": "^15.11.0"
},
"description": "=== Newspack Blocks === Contributors: (this should be a list of wordpress.org userid's) Donate link: https://example.com/ Tags: comments, spam Requires at least: 4.5 Tested up to: 5.1.1 Stable tag: 0.1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html",
"dependencies": {
"classnames": "^2.5.1",
"lodash": "^4.17.21",
"newspack-components": "^2.2.1",
"react": "^17.0.2",
"redux": "^4.2.1",
"redux-saga": "^1.3.0",
"regenerator-runtime": "^0.14.1",
"swiper": "11.1.4"
},
"scripts": {
"cm": "newspack-scripts commit",
"semantic-release": "newspack-scripts release --files=newspack-blocks.php",
"build": "newspack-scripts build",
"start": "npm ci && newspack-scripts watch",
"watch": "newspack-scripts watch",
"test": "newspack-scripts test",
"lint": "npm run lint:scss && npm run lint:js",
"lint:js": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
"lint:js:staged": "eslint --ext .js,.jsx,.ts,.tsx",
"lint:php:staged": "./vendor/bin/phpcs --filter=GitStaged",
"format:js": "prettier 'src/**/*.{js,jsx,ts,tsx}' --write",
"lint:scss": "stylelint '**/*.scss' --customSyntax postcss-scss --config=./node_modules/newspack-scripts/config/stylelint.config.js",
"format:scss": "prettier --write 'src/**/*.scss'",
"lint:scss:staged": "stylelint --customSyntax postcss-scss --config=./node_modules/newspack-scripts/config/stylelint.config.js",
"i18n": "NODE_ENV=production npm run build; bash ./bin/update-translations.sh",
"typescript:check": "newspack-scripts typescript-check",
"release": "npm run build && npm run semantic-release",
"release:archive": "rm -rf release && mkdir -p release && rsync -r . ./release/newspack-blocks --exclude-from='./.distignore' && cd release && zip -r newspack-blocks.zip newspack-blocks",
"postinstall": "rm -rf node_modules/newspack-scripts/node_modules/prettier"
},
"lint-staged": {
"*.scss": "npm run lint:scss:staged",
"*.(js|jsx)": "npm run lint:js:staged",
"*.php": "npm run lint:php:staged"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Automattic/newspack-blocks.git"
},
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/Automattic/newspack-blocks/issues"
}
}
17 changes: 17 additions & 0 deletions projects/packages/newsletter-widget/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Files not needed to be distributed in the package.
.gitattributes export-ignore
.github/ export-ignore
package.json export-ignore

# Files to include in the mirror repo, but excluded via gitignore
# Remember to end all directories with `/**` to properly tag every file.
# /src/js/example.min.js production-include

# Files to exclude from the mirror repo, but included in the monorepo.
# Remember to end all directories with `/**` to properly tag every file.
.gitignore production-exclude
changelog/** production-exclude
phpunit.xml.dist production-exclude
.phpcs.dir.xml production-exclude
tests/** production-exclude
.phpcsignore production-exclude
2 changes: 2 additions & 0 deletions projects/packages/newsletter-widget/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor/
node_modules/
12 changes: 12 additions & 0 deletions projects/packages/newsletter-widget/.phan/baseline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* This is an automatically generated baseline for Phan issues.
*
* Use `jetpack phan --update-baseline` to update this file.
*/
return [
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)
];
13 changes: 13 additions & 0 deletions projects/packages/newsletter-widget/.phan/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* This configuration will be read and overlaid on top of the
* default configuration. Command-line arguments will be applied
* after this file is read.
*
* @package automattic/jetpack-newsletter-widget
*/

// Require base config.
require __DIR__ . '/../../../../.phan/config.base.php';

return make_phan_config( dirname( __DIR__ ) );
24 changes: 24 additions & 0 deletions projects/packages/newsletter-widget/.phpcs.dir.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<ruleset>

<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="jetpack-newsletter-widget" />
</property>
</properties>
</rule>
<rule ref="Jetpack.Functions.I18n">
<properties>
<property name="text_domain" value="jetpack-newsletter-widget" />
</properties>
</rule>

<rule ref="WordPress.Utils.I18nTextDomainFixer">
<properties>
<property name="old_text_domain" type="array" />
<property name="new_text_domain" value="jetpack-newsletter-widget" />
</properties>
</rule>

</ruleset>
7 changes: 7 additions & 0 deletions projects/packages/newsletter-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

24 changes: 24 additions & 0 deletions projects/packages/newsletter-widget/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# newsletter-widget

This package consumes the Calypso standalone app newsletter to render the Newsletter Widget in the wp-admin Dashboard.

## How to install newsletter-widget

### Installation From Git Repo

## Contribute

## Get Help

## Using this package in your WordPress plugin

If you plan on using this package in your WordPress plugin, we would recommend that you use [Jetpack Autoloader](https://packagist.org/packages/automattic/jetpack-autoloader) as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well.

## Security

Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic).

## License

newsletter-widget is licensed under [GNU General Public License v2 (or later)](./LICENSE.txt)

Empty file.
4 changes: 4 additions & 0 deletions projects/packages/newsletter-widget/changelog/initial-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Initial version.
54 changes: 54 additions & 0 deletions projects/packages/newsletter-widget/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "automattic/jetpack-newsletter-widget",
"description": "This package consumes the Calypso standalone app newsletter to render the Newsletter Widget in the wp-admin Dashboard. ",
"type": "jetpack-library",
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.2"
},
"require-dev": {
"yoast/phpunit-polyfills": "^1.1.1",
"automattic/jetpack-changelogger": "@dev"
},
"autoload": {
"classmap": [
"src/"
]
},
"scripts": {
"build-development": "echo 'Add your build step to composer.json, please!'",
"build-production": "echo 'Add your build step to composer.json, please!'",
"phpunit": [
"./vendor/phpunit/phpunit/phpunit --colors=always"
],
"test-coverage": [
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/php.cov\""
],
"test-php": [
"@composer phpunit"
]
},
"repositories": [
{
"type": "path",
"url": "../../packages/*",
"options": {
"monorepo": true
}
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-trunk": "0.1.x-dev"
},
"textdomain": "jetpack-newsletter-widget",
"version-constants": {
"::PACKAGE_VERSION": "src/class-newsletter-widget.php"
}
},
"suggest": {
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package."
}
}
25 changes: 25 additions & 0 deletions projects/packages/newsletter-widget/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"private": true,
"name": "@automattic/jetpack-newsletter-widget",
"version": "0.1.0-alpha",
"description": "This package consumes the Calypso standalone app newsletter to render the Newsletter Widget in the wp-admin Dashboard. ",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/newsletter-widget/#readme",
"bugs": {
"url": "https://github.com/Automattic/jetpack/labels/[Package] Newsletter Widget"
},
"repository": {
"type": "git",
"url": "https://github.com/Automattic/jetpack.git",
"directory": "projects/packages/newsletter-widget"
},
"license": "GPL-2.0-or-later",
"author": "Automattic",
"scripts": {
"build": "echo 'Not implemented.'",
"build-js": "echo 'Not implemented.'",
"build-production": "echo 'Not implemented.'",
"build-production-js": "echo 'Not implemented.'",
"clean": "true"
},
"devDependencies": {}
}
14 changes: 14 additions & 0 deletions projects/packages/newsletter-widget/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<phpunit bootstrap="tests/php/bootstrap.php" backupGlobals="false" colors="true" convertDeprecationsToExceptions="true">
<testsuites>
<testsuite name="main">
<directory prefix="test" suffix=".php">tests/php</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<!-- Better to only include "src" than to add "." and then exclude "tests", "vendor", and so on, as PHPUnit still scans the excluded directories. -->
<!-- Add additional lines for any files or directories outside of src/ that need coverage. -->
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
Loading
Loading