Skip to content

Commit

Permalink
changed bundler to build only scripts and styles in the dist folder
Browse files Browse the repository at this point in the history
  • Loading branch information
nk-o committed Aug 20, 2022
1 parent 917a252 commit 1f1e808
Show file tree
Hide file tree
Showing 286 changed files with 9,314 additions and 7,369 deletions.
12 changes: 1 addition & 11 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
# https://github.com/browserslist/browserslist#readme

>= 0.5%
last 2 major versions
not dead
Chrome >= 60
Firefox >= 60
Firefox ESR
iOS >= 12
Safari >= 12
not Explorer <= 11
extends browserslist-config-nk
17 changes: 0 additions & 17 deletions .eslintrc

This file was deleted.

15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
extends: ['eslint-config-nk'],
globals: {
wp: true,
},
settings: {
react: {
pragma: 'wp',
},
},
rules: {
'react/prefer-stateless-function': 'off',
'react/prop-types': 'off',
},
};
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
tags:
- "v*"
- 'v*'

jobs:
deploy:
Expand All @@ -22,12 +22,12 @@ jobs:
run: npm install

- name: Run Production Task
run: npm run production
run: npm run build:prod

- name: WordPress Plugin Deploy
uses: nk-o/action-wordpress-plugin-deploy@master
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SOURCE_DIR: dist/lazy-blocks/
SOURCE_DIR: dist-zip/lazy-blocks/
SLUG: lazy-blocks
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
.sass-cache
.publish
.idea
/dist
/dist-zip
/vendor
/node_modules
/src/languages/*
npm-debug.log
.phpcs.xml
phpcs.xml
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

### Building

- `npm run dev` to run build and start files watcher
- `npm run build` to run build
- `npm run watch` to run build and start files watcher
- `npm run production` to run build and prepare zip files for production
- `npm run build:prod` to run build and prepare zip files for production

### Linting

Expand Down
4 changes: 2 additions & 2 deletions src/assets/_variables.scss → assets/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* WordPress.
*/
/* stylelint-disable-next-line scss/at-import-partial-extension */
@import "../../node_modules/@wordpress/base-styles/colors.native";
@import "../../node_modules/@wordpress/base-styles/variables";
@import "../node_modules/@wordpress/base-styles/colors.native";
@import "../node_modules/@wordpress/base-styles/variables";

$radius: 3px !default;
$radius_large: 4px !default;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ function UpdateEditor() {

const templateLockOptions = [
{
label: __('None', '@@text_domain'),
label: __('None', 'lazy-blocks'),
value: '',
},
{
label: __('Prevent all operations', '@@text_domain'),
label: __('Prevent all operations', 'lazy-blocks'),
value: 'all',
},
{
label: __('Prevent inserting new blocks, but allows moving existing ones', '@@text_domain'),
label: __('Prevent inserting new blocks, but allows moving existing ones', 'lazy-blocks'),
value: 'insert',
},
];
Expand All @@ -108,9 +108,9 @@ function UpdateEditor() {
.filter(
(post) =>
post.viewable &&
post.slug !== 'lazyblocks' &&
post.slug !== 'lazyblocks_templates' &&
post.slug !== 'attachment'
'lazyblocks' !== post.slug &&
'lazyblocks_templates' !== post.slug &&
'attachment' !== post.slug
)
.forEach((post) => {
let { label } = post;
Expand Down Expand Up @@ -144,12 +144,12 @@ function UpdateEditor() {
return (
<PluginDocumentSettingPanel
name="LZBTemplateSettings"
title={__('Template Settings', '@@text_domain')}
title={__('Template Settings', 'lazy-blocks')}
className="lzb-template-settings-panel"
>
<PanelRow>
<SelectControl
label={__('Post Types', '@@text_domain')}
label={__('Post Types', 'lazy-blocks')}
multiple
options={postTypesOptions}
value={templatePostTypes}
Expand All @@ -160,7 +160,7 @@ function UpdateEditor() {
</PanelRow>
<PanelRow>
<SelectControl
label={__('Template Lock', '@@text_domain')}
label={__('Template Lock', 'lazy-blocks')}
options={templateLockOptions}
value={templateLock}
onChange={(value) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
46 changes: 22 additions & 24 deletions src/assets/admin/tools/tools.js → assets/admin/tools/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ export default function Templates() {

clipboard.writeText(getPHPStringCode(type));

if (typeLabel === 'Blocks') {
if ('Blocks' === typeLabel) {
setCopiedBlocks(true);
} else if (typeLabel === 'Templates') {
} else if ('Templates' === typeLabel) {
setCopiedTemplates(true);
}

clearTimeout(copiedTimeouts.current[typeLabel]);

copiedTimeouts.current[typeLabel] = setTimeout(() => {
if (typeLabel === 'Blocks') {
if ('Blocks' === typeLabel) {
setCopiedBlocks(false);
} else if (typeLabel === 'Templates') {
} else if ('Templates' === typeLabel) {
setCopiedTemplates(false);
}
}, 350);
Expand All @@ -116,21 +116,21 @@ export default function Templates() {
<div className="lzb-export-select-items">
<BaseControl>
<ToggleControl
label={__('Select all', '@@text_domain')}
checked={Object.keys(disabledStates[`disabled${typeLabel}`]).length === 0}
label={__('Select all', 'lazy-blocks')}
checked={0 === Object.keys(disabledStates[`disabled${typeLabel}`]).length}
onChange={() => {
const newDisabled = {};

// disable all
if (Object.keys(disabledStates[`disabled${typeLabel}`]).length === 0) {
if (0 === Object.keys(disabledStates[`disabled${typeLabel}`]).length) {
data[type].forEach((item) => {
newDisabled[item.data.id] = true;
});
}

if (typeLabel === 'Blocks') {
if ('Blocks' === typeLabel) {
setDisabledBlocks(newDisabled);
} else if (typeLabel === 'Templates') {
} else if ('Templates' === typeLabel) {
setDisabledTemplates(newDisabled);
}
}}
Expand All @@ -144,7 +144,7 @@ export default function Templates() {
label={
// eslint-disable-next-line react/jsx-wrap-multilines
<Fragment>
{type === 'blocks' ? (
{'blocks' === type ? (
<Fragment>
{item.data.icon && /^dashicons/.test(item.data.icon) ? (
<span className={item.data.icon} />
Expand Down Expand Up @@ -173,13 +173,13 @@ export default function Templates() {

if (isSelected && !newDisabled[item.data.id]) {
newDisabled[item.data.id] = true;
} else if (!isSelected && typeof newDisabled[item.data.id] !== 'undefined') {
} else if (!isSelected && 'undefined' !== typeof newDisabled[item.data.id]) {
delete newDisabled[item.data.id];
}

if (typeLabel === 'Blocks') {
if ('Blocks' === typeLabel) {
setDisabledBlocks(newDisabled);
} else if (typeLabel === 'Templates') {
} else if ('Templates' === typeLabel) {
setDisabledTemplates(newDisabled);
}
}}
Expand All @@ -206,7 +206,7 @@ export default function Templates() {
copyPHPStringCode(type);
}}
>
{__('Copy to Clipboard', '@@text_domain')}
{__('Copy to Clipboard', 'lazy-blocks')}
{copiedStates[`copied${typeLabel}`] ? <Copied /> : ''}
</button>
</div>
Expand All @@ -218,21 +218,21 @@ export default function Templates() {
disabled={nothingSelected}
href={getDownloadJSONUrl(type)}
>
{__('Export JSON', '@@text_domain')}
{__('Export JSON', 'lazy-blocks')}
</a>
{/* eslint-disable-next-line react/button-has-type */}
<button
className="button"
onClick={() => {
if (typeLabel === 'Blocks') {
if ('Blocks' === typeLabel) {
setShowBlocksPHP(true);
} else if (typeLabel === 'Templates') {
} else if ('Templates' === typeLabel) {
setShowTemplatesPHP(true);
}
}}
disabled={nothingSelected}
>
{__('Generate PHP', '@@text_domain')}
{__('Generate PHP', 'lazy-blocks')}
</button>
</div>
)}
Expand All @@ -247,7 +247,7 @@ export default function Templates() {
<div className="postbox-container">
<div className="postbox">
<h2 className="hndle">
<span>{__('Export Blocks', '@@text_domain')}</span>
<span>{__('Export Blocks', 'lazy-blocks')}</span>
</h2>
{data.blocks && data.blocks.length ? (
<div className="inside">
Expand All @@ -267,7 +267,7 @@ export default function Templates() {
</div>
<div className="postbox">
<h2 className="hndle">
<span>{__('Export Templates', '@@text_domain')}</span>
<span>{__('Export Templates', 'lazy-blocks')}</span>
</h2>
{data.templates && data.templates.length ? (
<div className="inside">
Expand All @@ -289,7 +289,7 @@ export default function Templates() {
<div className="postbox-container">
<div className="postbox">
<h2 className="hndle">
<span>{__('Import', '@@text_domain')}</span>
<span>{__('Import', 'lazy-blocks')}</span>
</h2>
<div className="inside">
<p>
Expand All @@ -307,9 +307,7 @@ export default function Templates() {

<div className="lzb-export-buttons">
{/* eslint-disable-next-line react/button-has-type */}
<button className="button button-primary">
{__('Import', '@@text_domain')}
</button>
<button className="button button-primary">{__('Import', 'lazy-blocks')}</button>
</div>
</form>
</div>
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.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const { __ } = wp.i18n;

export default function Copied({ children }) {
return (
<div className="lazyblocks-component-copied">{children || __('Copied!', '@@text_domain')}</div>
<div className="lazyblocks-component-copied">{children || __('Copied!', 'lazy-blocks')}</div>
);
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function DocumentTabs({ children }) {
function activateTab(name) {
globalActiveTab = name;

if (name === 'block') {
if ('block' === name) {
clearSelectedControl();
} else {
selectControl('NO_CONTROL_ID_JUST_SELECT_TAB');
Expand All @@ -51,11 +51,11 @@ export default function DocumentTabs({ children }) {
activateTab('block');
}}
className={`components-button edit-post-sidebar__panel-tab ${
activeTab === 'block' ? 'is-active' : ''
'block' === activeTab ? 'is-active' : ''
}`}
aria-label={__('Block', '@@text_domain')}
aria-label={__('Block', 'lazy-blocks')}
>
{__('Block', '@@text_domain')}
{__('Block', 'lazy-blocks')}
</button>
</li>
<li>
Expand All @@ -65,11 +65,11 @@ export default function DocumentTabs({ children }) {
activateTab('control');
}}
className={`components-button edit-post-sidebar__panel-tab ${
activeTab === 'control' ? 'is-active' : ''
'control' === activeTab ? 'is-active' : ''
}`}
aria-label={__('Control', '@@text_domain')}
aria-label={__('Control', 'lazy-blocks')}
>
{__('Control', '@@text_domain')}
{__('Control', 'lazy-blocks')}
</button>
</li>
</ul>
Expand Down
File renamed without changes.
Loading

0 comments on commit 1f1e808

Please sign in to comment.