Skip to content

Commit

Permalink
Switch to TypeScript and adjust sync script
Browse files Browse the repository at this point in the history
  • Loading branch information
arcangelini committed May 18, 2024
1 parent b360808 commit d5c378d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 41 deletions.
32 changes: 32 additions & 0 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "GPL-2.0-or-later",
"scripts": {
"build": "wp-scripts build --webpack-src-dir=src/scale-section --output-path=build/scale-section && wp-scripts build --webpack-src-dir=src/weather --output-path=build/weather",
"sync": "rsync -avz ./build $RSYNC_DESTINATION",
"sync": "rsync -avz --exclude={'.github','node_modules','src','.*','package*','webpack*'} ./ $RSYNC_DESTINATION",
"start": "wp-scripts start --webpack-src-dir=src/scale-section --output-path=build/scale-section && wp-scripts start --webpack-src-dir=src/weather --output-path=build/weather",
"lint:js": "wp-scripts lint-js",
"lint:css": "wp-scripts lint-style",
Expand All @@ -17,6 +17,7 @@
"npm": "^10.8.0"
},
"dependencies": {
"@types/wordpress__block-editor": "^11.5.14",
"@wordpress/block-editor": "^12.26.0",
"@wordpress/components": "^27.6.0",
"chalk": "^4.1.2",
Expand Down
File renamed without changes.
39 changes: 0 additions & 39 deletions src/scale-section/index.js

This file was deleted.

21 changes: 21 additions & 0 deletions src/scale-section/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

import { registerBlockType } from '@wordpress/blocks';

import './style.scss';

import Edit from './edit';
import save from './save';
import metadata from './block.json';

// @ts-expect-error - TS doesn't know about the block.json
registerBlockType( metadata.name, {
/**
* @see ./edit.js
*/
edit: Edit,

/**
* @see ./save.js
*/
save,
} );
4 changes: 3 additions & 1 deletion src/scale-section/save.js → src/scale-section/save.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useBlockProps, RichText } from '@wordpress/block-editor';

export default function save( { attributes } ) {
import React from 'react';

export default function Save( { attributes } ) {
const { content, height } = attributes;
const blockProps = useBlockProps.save( {
style: { height: `${ height }px` },
Expand Down

0 comments on commit d5c378d

Please sign in to comment.