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

Press0 1140 | Explore BH integration with InstaWP site migration solution for self-service WP site migration #1

Merged
merged 14 commits into from
Apr 25, 2024
Merged
50 changes: 50 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "main"
allow:
- dependency-type: direct
schedule:
interval: "daily"
commit-message:
prefix: "GitHub Actions"
include: "scope"
labels:
- "dependencies"

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
target-branch: "main"
allow:
- dependency-type: direct
schedule:
interval: "daily"
versioning-strategy: increase
commit-message:
prefix: "NPM"
prefix-development: "NPM Dev"
include: "scope"
labels:
- "dependencies"
- "javascript"

# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
target-branch: "main"
schedule:
interval: "daily"
allow:
- dependency-type: direct
versioning-strategy: increase
commit-message:
prefix: "Composer"
prefix-development: "Composer Dev"
include: "scope"
labels:
- "dependencies"
- "php"
58 changes: 58 additions & 0 deletions .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Lint PHP
on:
pull_request:
types: [ opened, edited, reopened, ready_for_review, synchronize ]
paths:
- '**.php'

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
phpcs:
name: Run PHP Code Sniffer
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v4

# User PHP 7.4 for compatibility with the WordPress codesniffer rules.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: phpcs

- name: Get changed files
uses: technote-space/get-diff-action@v6
with:
SUFFIX_FILTER: .php

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
if: "!! env.GIT_DIFF"

- name: Cache Composer vendor directory
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
if: "!! env.GIT_DIFF"

- name: Validate composer.json and composer.lock
run: composer validate
if: "!! env.GIT_DIFF"

- name: Install dependencies
run: composer install --no-progress --optimize-autoloader --prefer-dist
if: "!! env.GIT_DIFF"

- name: Detecting PHP Code Standards Violations
run: vendor/bin/phpcs --standard=phpcs.xml -s ${{ env.GIT_DIFF }}
if: "!! env.GIT_DIFF"
23 changes: 23 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish Package
on:
release:
types:
- created
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
scope: '@newfold-labs'
- name: Setup Registry for NPM Install
run: printf "\n//npm.pkg.github.com/:_authToken=${{ secrets.NEWFOLD_ACCESS_TOKEN }}" >> .npmrc
- run: npm ci
- name: Reset Registry for npm publish
run: sed -i '$d' .npmrc
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
35 changes: 35 additions & 0 deletions .github/workflows/satis-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Trigger Satis Build

on:
release:
types:
- created

jobs:
webhook:
name: Send Webhook
runs-on: ubuntu-latest
steps:

- name: Set Package
id: package
env:
REPO: ${{ github.repository }}
run: echo "PACKAGE=${REPO##*/}" >> $GITHUB_OUTPUT

- name: Set Version
id: tag
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT

- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.WEBHOOK_TOKEN }}
repository: newfold-labs/satis
event-type: 'satis-build'
client-payload: >-
{
"vendor": "${{ github.repository_owner }}",
"package": "${{ steps.package.outputs.PACKAGE }}",
"version": "${{ steps.tag.outputs.VERSION }}"
}
61 changes: 19 additions & 42 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,48 +1,25 @@
# Wordpress - ignore core, configuration, examples, uploads and logs.
# https://github.com/github/gitignore/blob/main/WordPress.gitignore
# Composer
/vendor

# Core
#
# Note: if you want to stage/commit WP core files
# you can delete this whole section/until Configuration.
/wp-admin/
/wp-content/index.php
/wp-content/languages
/wp-content/plugins/index.php
/wp-content/themes/index.php
/wp-includes/
/index.php
/license.txt
/readme.html
/wp-*.php
/xmlrpc.php
#node_modules
/node_modules

# Configuration
wp-config.php
# System and IDE files
.DS_Store
.idea

# Example themes
/wp-content/themes/twenty*/
# Cypress
cypress.env.json
/tests/cypress/screenshots
/tests/cypress/videos

# Example plugin
/wp-content/plugins/hello.php
# Built-app files
/.docs
/assets/*
/build/index.js*
/dist/*

# Uploads
/wp-content/uploads/

# Log files
# File Types
*.log

# htaccess
/.htaccess

# All plugins
#
# Note: If you wish to whitelist plugins,
# uncomment the next line
#/wp-content/plugins

# All themes
#
# Note: If you wish to whitelist themes,
# uncomment the next line
#/wp-content/themes
*.sql
*.zip
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
42 changes: 42 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

use NewfoldLabs\WP\Module\Migration\Migration;
use NewfoldLabs\WP\Module\Migration\Services\UtilityService;
use NewfoldLabs\WP\ModuleLoader\Container;

use function NewfoldLabs\WP\ModuleLoader\register;

if ( ! defined( 'ABSPATH' ) ) {
return;
}


if ( function_exists( 'add_action' ) ) {
add_action(
'plugins_loaded',
function () {
register(
array(
'name' => 'migration',
'label' => __( 'Migration', 'wp-module-migration' ),
'callback' => function ( Container $container ) {

if ( ! defined( 'NFD_MIGRATION_MODULE_VERSION' ) ) {
define( 'NFD_MIGRATION_MODULE_VERSION', '1.0.0' );
}

defined( 'NFD_PROXY_ACCESS_WORKER' ) || define( 'NFD_PROXY_ACCESS_WORKER', 'https://hiive.cloud/workers/migration-token-proxy' );
$response = UtilityService::get_insta_api_key();
defined( 'INSTAWP_API_KEY' ) || define( 'INSTAWP_API_KEY', $response );
defined( 'INSTAWP_API_DOMAIN' ) || define( 'INSTAWP_API_DOMAIN', 'https://app.instawp.io' );
defined( 'INSTAWP_MIGRATE_ENDPOINT' ) || define( 'INSTAWP_MIGRATE_ENDPOINT', 'migrate/bluehost' );

new Migration( $container );
},
'isActive' => true,
'isHidden' => true,
)
);
}
);
}
1 change: 1 addition & 0 deletions build/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-element'), 'version' => '336662a21f49ae7ac773');
63 changes: 63 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "newfold-labs/wp-module-migration",
"description": "Initiates the migration process",
"autoload": {
"psr-4": {
"NewfoldLabs\\WP\\Module\\Migration\\": "includes/"
},
"files": [
"bootstrap.php"
]
},
"authors": [
{
"name": "Beyond",
"email": "[email protected]"
}
],
"repositories": [
{
"type": "composer",
"url": "https://newfold-labs.github.io/satis/",
"only": [
"newfold-labs/*"
]
},
{
"type": "vcs",
"url": "[email protected]:InstaWP/connect-helpers.git"
}
],
"require": {
"newfold-labs/wp-module-loader": "^1.0.10",
"instawp/connect-helpers": "dev-main"
},
"require-dev": {
"newfold-labs/wp-php-standards": "^1.2"
},
"scripts": {
"i18n": [
"vendor/bin/wp i18n make-pot . ./languages/wp-module-ecommerce.pot --headers='{\"Report-Msgid-Bugs-To\":\"https://github.com/newfold-labs/wp-module-ecommerce/issues\",\"POT-Creation-Date\":null}' --exclude=node_modules,src,tests"
],
"fix": [
"vendor/bin/phpcbf --standard=phpcs.xml ."
],
"lint": [
"vendor/bin/phpcs --standard=phpcs.xml -s ."
]
},
"config": {
"optimize-autoloader": true,
"sort-packages": true,
"platform": {
"php": "7.3.0"
},
"preferred-install": {
"newfold-labs/*": "source",
"*": "dist"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
Loading
Loading