Skip to content

Commit

Permalink
Merge branch 'trunk' into update/unbundle-publicize-from-jetpack
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk committed Aug 7, 2024
2 parents 97b7635 + e0ff257 commit d5a0870
Show file tree
Hide file tree
Showing 128 changed files with 1,682 additions and 208 deletions.
104 changes: 104 additions & 0 deletions pnpm-lock.yaml

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

7 changes: 7 additions & 0 deletions projects/js-packages/script-data/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Files not needed to be distributed in the package.
.gitattributes export-ignore
node_modules export-ignore

# Files to exclude from the mirror repo
/changelog/** production-exclude
/.eslintrc.cjs production-exclude
2 changes: 2 additions & 0 deletions projects/js-packages/script-data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor/
node_modules/
6 changes: 6 additions & 0 deletions projects/js-packages/script-data/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 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).
15 changes: 15 additions & 0 deletions projects/js-packages/script-data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Scrip Helpers

A library to provide data for script handles and the corresponding utility functions for Jetpack.

## Contribute

## Get Help

## 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

publicize is licensed under [GNU General Public License v2 (or later)](./LICENSE.txt)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added jetpack-script-data package to consolidate the logic for Jetpack Initial state
34 changes: 34 additions & 0 deletions projects/js-packages/script-data/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "automattic/jetpack-script-data",
"description": "A library to provide data for script handles and the corresponding utility functions for Jetpack.",
"type": "library",
"license": "GPL-2.0-or-later",
"require": {},
"require-dev": {
"automattic/jetpack-changelogger": "@dev"
},
"autoload": {
"classmap": [
"src/"
]
},
"scripts": {},
"repositories": [
{
"type": "path",
"url": "../../packages/*",
"options": {
"monorepo": true
}
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"mirror-repo": "Automattic/jetpack-script-data",
"changelogger": {
"link-template": "https://github.com/Automattic/jetpack-script-data/compare/v${old}...v${new}"
},
"autotagger": true
}
}
24 changes: 24 additions & 0 deletions projects/js-packages/script-data/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"private": true,
"name": "@automattic/jetpack-script-data",
"version": "0.1.0-alpha",
"description": "A library to provide data for script handles and the corresponding utility functions for Jetpack.",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/script-data/#readme",
"bugs": {
"url": "https://github.com/Automattic/jetpack/labels/[JS Package] Script Data"
},
"repository": {
"type": "git",
"url": "https://github.com/Automattic/jetpack.git",
"directory": "projects/js-packages/script-data"
},
"license": "GPL-2.0-or-later",
"author": "Automattic",
"type": "module",
"scripts": {},
"dependencies": {},
"devDependencies": {},
"exports": {
".": "./src/index.ts"
}
}
2 changes: 2 additions & 0 deletions projects/js-packages/script-data/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './types';
export * from './utils';
49 changes: 49 additions & 0 deletions projects/js-packages/script-data/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
export interface SitePlan {
product_slug: string;
features?: {
active: Array< string >;
available?: Record< string, Array< string > >;
};
}

export interface WPCOMSiteData {
blog_id: number;
}

export interface PublicSiteData {
icon: string;
title: string;
}

export interface AdminSiteData {
admin_url: string;
date_format: string;
is_multisite: boolean;
plan: SitePlan;
rest_nonce: string;
rest_root: string;
wp_version: string;
wpcom: WPCOMSiteData;
}

export interface SiteData extends PublicSiteData, Partial< AdminSiteData > {}

export interface CurrentUserData {
id: number;
display_name: string;
}

export interface UserData {
current_user: CurrentUserData;
}

export interface JetpackScriptData {
site: SiteData;
user: UserData;
}

declare global {
interface Window {
JetpackScriptData: JetpackScriptData;
}
}
Loading

0 comments on commit d5a0870

Please sign in to comment.