Skip to content

Commit

Permalink
Scripts: Remove deprecated format-js command (#40512)
Browse files Browse the repository at this point in the history
* Scripts: Remove deprecated `format-js` command

* Update CHANGELOG

* Update CHANGELOG

* Remove more occurrences of `format-js`
  • Loading branch information
gziolo authored Apr 21, 2022
1 parent 598b4e7 commit ae9e149
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 56 deletions.
42 changes: 23 additions & 19 deletions docs/how-to-guides/data-basics/1-data-basics-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,39 @@ Also, this tutorial will lean heavily on Redux concepts such as state, actions,

We'll do all the development inside of a WordPress plugin. Let's start by creating a `wp-content/plugins/my-first-gutenberg-app` directory in your local WordPress environment. We will need to create four files inside that directory:

* my-first-gutenberg-app.php – to create a new admin page
* src/index.js – for our JavaScript application
* style.css – for the minimal stylesheet
* package.json – for the build process
- my-first-gutenberg-app.php – to create a new admin page
- src/index.js – for our JavaScript application
- style.css – for the minimal stylesheet
- package.json – for the build process

Go ahead and create these files using the following snippets:

**src/index.js:**

```js
import { render } from '@wordpress/element';

function MyFirstApp() {
return <span>Hello from JavaScript!</span>;
}

window.addEventListener( 'load', function() {
render(
<MyFirstApp />,
document.querySelector( '#my-first-gutenberg-app' )
);
}, false );
window.addEventListener(
'load',
function () {
render(
<MyFirstApp />,
document.querySelector( '#my-first-gutenberg-app' )
);
},
false
);
```

**style.css:**

```css
.toplevel_page_my-first-gutenberg-app #wpcontent {
background: #FFF;
background: #fff;
height: 1000px;
}
#my-first-gutenberg-app {
Expand Down Expand Up @@ -68,6 +74,7 @@ window.addEventListener( 'load', function() {
```

**my-first-gutenberg-app.php:**

```php
<?php
/**
Expand Down Expand Up @@ -143,10 +150,7 @@ add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_scripts' );
"description": "Example: Recipe Card (ESNext).",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"keywords": [
"WordPress",
"block"
],
"keywords": [ "WordPress", "block" ],
"homepage": "https://github.com/WordPress/gutenberg-examples/",
"repository": "git+https://github.com/WordPress/gutenberg-examples.git",
"bugs": {
Expand All @@ -158,7 +162,7 @@ add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_scripts' );
},
"scripts": {
"build": "wp-scripts build",
"format:js": "wp-scripts format-js",
"format": "wp-scripts format",
"lint:js": "wp-scripts lint-js",
"packages-update": "wp-scripts packages-update",
"start": "wp-scripts start"
Expand All @@ -184,6 +188,6 @@ Congratulations! You are now ready to start building the app!

## What's next?

* Previous part: [Introduction](/docs/how-to-guides/data-basics/README.md)
* Next part: [Building a basic list of pages](/docs/how-to-guides/data-basics/2-building-a-list-of-pages.md)
* (optional) Review the [finished app](https://github.com/WordPress/gutenberg-examples/tree/trunk/09-code-data-basics-esnext) in the gutenberg-examples repository
- Previous part: [Introduction](/docs/how-to-guides/data-basics/README.md)
- Next part: [Building a basic list of pages](/docs/how-to-guides/data-basics/2-building-a-list-of-pages.md)
- (optional) Review the [finished app](https://github.com/WordPress/gutenberg-examples/tree/trunk/09-code-data-basics-esnext) in the gutenberg-examples repository
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@
"fixtures:generate": "cross-env GENERATE_MISSING_FIXTURES=y npm run test-unit test/integration/full-content/ && npm run format test/integration/fixtures/blocks/*.json",
"fixtures:regenerate": "npm run fixtures:clean && npm run fixtures:generate",
"format": "wp-scripts format",
"format-js": "wp-scripts format-js",
"format-php": "wp-env run composer run-script format",
"lint": "concurrently \"npm run lint-lockfile\" \"npm run lint-js\" \"npm run lint-pkg-json\" \"npm run lint-css\"",
"lint-js": "wp-scripts lint-js",
Expand Down
4 changes: 4 additions & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## Breaking Changes

- Remove the previously deprecated and undocumented `format-js` command ([#40512](https://github.com/WordPress/gutenberg/pull/40512)). You should use the `format` command instead.

## 22.4.0 (2022-04-08)

### New Feature
Expand Down
36 changes: 0 additions & 36 deletions packages/scripts/scripts/format-js.js

This file was deleted.

0 comments on commit ae9e149

Please sign in to comment.