Skip to content

Commit

Permalink
Merge pull request #10 from akirk/rename-plugin
Browse files Browse the repository at this point in the history
Rename plugin
  • Loading branch information
psrpinto authored Aug 14, 2024
2 parents a5cbc08 + df3e8b1 commit f3f541a
Show file tree
Hide file tree
Showing 21 changed files with 41 additions and 31 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"watch": "webpack --watch",
"start:firefox": "concurrently \"npm:watch\" \"npm:web-ext:run:firefox\"",
"start:chrome": "concurrently \"npm:watch\" \"npm:web-ext:run:chrome\"",
"web-ext:run:firefox": "web-ext -s build/firefox run --target firefox-desktop --firefox-profile try-wordpress",
"web-ext:run:chrome": "web-ext -s build/chrome run --target chromium --chromium-profile try-wordpress --arg='--disable-search-engine-choice-screen'",
"web-ext:run:firefox": "web-ext -s build/extension/firefox run --target firefox-desktop --firefox-profile try-wordpress",
"web-ext:run:chrome": "web-ext -s build/extension/chrome run --target chromium --chromium-profile try-wordpress --arg='--disable-search-engine-choice-screen'",
"lint": "npm run lint:js && npm run lint:style",
"lint:js": "wp-scripts lint-js",
"lint:style": "wp-scripts lint-style",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/sidebar/index.js → src/extension/sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ window.addEventListener( 'message', function ( event ) {
return;
}
const data = event.data.data;
if ( 'data-liberation-message' !== data.type ) {
if ( 'try-wordpress-message' !== data.type ) {
return;
}
if ( 'start-import' === data.action ) {
Expand Down
15 changes: 10 additions & 5 deletions src/sidebar/playground.js → src/extension/sidebar/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function initPlayground( iframeId ) {
siteSlug: 'try-wordpress',
blueprint: {
login: true,
landingPage: '/wp-admin/admin.php?page=data-liberation',
landingPage: '/wp-admin/admin.php?page=try-wordpress',
steps: steps(),
},
};
Expand Down Expand Up @@ -50,14 +50,19 @@ function steps() {
step: 'unzip',
zipFile: {
resource: 'url',
url: 'https://github-proxy.com/proxy/?repo=akirk/try-wordpress&branch=trunk&directory=plugins/data-liberation',
url: 'https://github-proxy.com/proxy/?repo=akirk/try-wordpress&branch=trunk&directory=src/plugin',
},
extractToPath: '/wordpress/wp-content',
extractToPath: '/wordpress/wp-content/plugins',
},
{
step: 'mv',
fromPath: '/wordpress/wp-content/plugins/src/plugin',
toPath: '/wordpress/wp-content/plugins/try-wordpress',
},
{
step: 'activatePlugin',
pluginName: 'Data Liberation',
pluginPath: '/wordpress/wp-content/plugins/data-liberation',
pluginName: 'Try WordPress',
pluginPath: '/wordpress/wp-content/plugins/try-wordpress',
},
];
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if ( document.getElementById( 'data-liberation-import' ) ) {
if ( document.getElementById( 'try-wordpress-import' ) ) {
document
.getElementById( 'data-liberation-import' )
.getElementById( 'try-wordpress-import' )
.addEventListener( 'click', function () {
const progressContainer =
document.getElementById( 'progress-container' );
Expand All @@ -15,7 +15,7 @@ if ( document.getElementById( 'data-liberation-import' ) ) {
{
type: 'relay',
data: {
type: 'data-liberation-message',
type: 'try-wordpress-message',
action: 'start-import',
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Plugin Name: Data Liberation
* Plugin Name: Try WordPress
* Description: Import sites to WordPress.
* Version: 1.1
* Author: WordPress.org
Expand All @@ -10,23 +10,23 @@
exit;
}

class DataLiberation {
class TryWordPress {
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'admin_menu', array( $this, 'create_wizard_page' ) );
}

public function enqueue_scripts() {
wp_enqueue_script( 'data-liberation', plugin_dir_url( __FILE__ ) . 'js/data-liberation.js', array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . 'js/data-liberation.js' ), true );
wp_enqueue_style( 'data-liberation', plugin_dir_url( __FILE__ ) . 'css/data-liberation.css', array(), filemtime( plugin_dir_path( __FILE__ ) . 'css/data-liberation.css' ) );
wp_enqueue_script( 'try-wordpress', plugin_dir_url( __FILE__ ) . 'index.js', array( 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . 'index.js' ), true );
wp_enqueue_style( 'try-wordpress', plugin_dir_url( __FILE__ ) . 'style.css', array(), filemtime( plugin_dir_path( __FILE__ ) . 'style.css' ) );
}

public function create_wizard_page() {
add_menu_page(
'Data Liberation Wizard',
'Data Liberation',
'Try WordPress Wizard',
'Try WordPress',
'manage_options',
'data-liberation',
'try-wordpress',
array( $this, 'render_wizard_page' ),
'dashicons-admin-tools',
100
Expand All @@ -38,4 +38,4 @@ public function render_wizard_page() {
}
}

new DataLiberation();
new TryWordPress();
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="wrap">
<h1><?php esc_html_e( 'Liberate Your Data', 'data-liberation' ); ?></h1>
<h1><?php esc_html_e( 'Liberate Your Data', 'try-wordpress' ); ?></h1>
Site Title:
<input type="text" id="site-title" value="" disabled /><br/><br/>
<button id="data-liberation-import"><?php esc_html_e( 'Start Extraction', 'data-liberation' ); ?></button>
<button id="try-wordpress-import"><?php esc_html_e( 'Start Extraction', 'try-wordpress' ); ?></button>

<h2><?php esc_html_e( 'Progress', 'data-liberation' ); ?></h2>
<h2><?php esc_html_e( 'Progress', 'try-wordpress' ); ?></h2>

<div id="progress-container" style="display:none;">
<div id="progress-bar-container">
Expand Down
2 changes: 1 addition & 1 deletion tests/content/dom.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getStylesString } from '../../src/content/utils/dom';
import { getStylesString } from '../../src/extension/content/utils/dom';

describe( 'Style formatting', function () {
test( 'Convert styles object to a string', () => {
Expand Down
21 changes: 13 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ module.exports = function () {

let modules = [];
for ( const target of [ 'firefox', 'chrome' ] ) {
const targetPath = path.resolve( __dirname, 'build', target );
const targetPath = path.resolve(
__dirname,
'build',
'extension',
target
);
modules = modules.concat( [
{
mode,
entry: './src/background/index.js',
entry: './src/extension/background/index.js',
output: {
path: targetPath,
filename: path.join( 'background', 'index.js' ),
Expand All @@ -21,11 +26,11 @@ module.exports = function () {
new CopyPlugin( {
patterns: [
{
from: `./src/manifest-${ target }.json`,
from: `./src/extension/manifest-${ target }.json`,
to: path.join( targetPath, 'manifest.json' ),
},
{
from: './src/icons',
from: './src/extension/icons',
to: path.join( targetPath, 'icons' ),
},
],
Expand All @@ -34,15 +39,15 @@ module.exports = function () {
},
{
mode,
entry: './src/content/index.js',
entry: './src/extension/content/index.js',
output: {
path: targetPath,
filename: path.join( 'content', 'index.js' ),
},
},
{
mode,
entry: './src/sidebar/index.js',
entry: './src/extension/sidebar/index.js',
output: {
path: targetPath,
filename: path.join( 'sidebar', 'index.js' ),
Expand All @@ -51,15 +56,15 @@ module.exports = function () {
new CopyPlugin( {
patterns: [
{
from: 'src/sidebar/sidebar.html',
from: './src/extension/sidebar/sidebar.html',
to: path.join(
targetPath,
'sidebar',
'sidebar.html'
),
},
{
from: 'src/sidebar/sidebar.css',
from: './src/extension/sidebar/sidebar.css',
to: path.join(
targetPath,
'sidebar',
Expand Down

0 comments on commit f3f541a

Please sign in to comment.