Skip to content

Commit

Permalink
Plugin init
Browse files Browse the repository at this point in the history
  • Loading branch information
franmastromarino committed Jul 6, 2023
1 parent d4b2770 commit cee5cbd
Show file tree
Hide file tree
Showing 41 changed files with 850 additions and 809 deletions.
4 changes: 1 addition & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
/assets
/tests
/jetpack_vendor
/phpunit
/build
/artifacts
/test-results
/playwright-report
/playwright
/.plugin
**/test/**
/bin
playwright.config.js
playwright.config.js
26 changes: 26 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"browser": true,
"es2021": true
},
"settings": {
"react": {
"version": "17.0.2"
}
},
"extends": ["plugin:@wordpress/eslint-plugin/recommended"],
"rules": {
"react/prop-types": "off",
"jsdoc/check-tag-names": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off",
"jsx-a11y/no-noninteractive-element-to-interactive-role": "off",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/anchor-has-content": "off",
"jsx-a11y/anchor-is-valid": "off",
"import/no-unresolved": "off",
"@wordpress/i18n-translator-comments": "off",
"no-nested-ternary": "off"
}
}
23 changes: 0 additions & 23 deletions .eslintrc.json

This file was deleted.

30 changes: 30 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,33 @@

# Convert to LF line endings on checkout.
*.php text eol=lf

# Exclude files from the package.
.husky export-ignore
.design export-ignore
.ideas export-ignore
.vscode export-ignore
node_modules export-ignore
packages export-ignore
tests export-ignore
.editorconfig export-ignore
.eslintignore export-ignore
.eslintrc.json export-ignore
.gitignore export-ignore
.gitattributes export-ignore
.lintstagedrc export-ignore
.prettierignore export-ignore
.prettierrc.js export-ignore
.stylelintrc.json export-ignore
.wp-env.json export-ignore
composer.json export-ignore
composer.lock export-ignore
jest.config.js export-ignore
package-lock.json export-ignore
package.json export-ignore
phpcs_error.txt export-ignore
phpcs_error.csv export-ignore
phpcs_error.xml export-ignore
phpcs.xml export-ignore
playwright.config.js export-ignore
webpack.config.js export-ignore
44 changes: 20 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
# Mac OS files
.DS_Store
*.zip

# Lock
package-lock.json
composer.lock
pnpm-lock.yaml
# Dependencies
node_modules
vendor
jetpack_vendor
package-lock.json
composer.lock
pnpm-lock.yaml

# Build
*.zip
build
# PhpCs
/phpcs_error.txt
/phpcs_error.csv
/phpcs_error.xml

# Tests
/artifacts
phpcs_error.txt
phpcs_error.csv
phpcs_error.xml
#Test
artifacts
/test-results
/playwright-report
/playwright

# Build
/build
/.tools/vendor
/.tools/composer.lock
/.plugin

# IDE settings
playwright-report
playwright
.tools/vendor
.tools/composer.lock
.plugin
.prettierrc
README.md
.DS_Store
.vscode/settings.json
14 changes: 11 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# #!/usr/bin/env sh
# . "$(dirname -- "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# git add -A
# npm run format

case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
npx.cmd lint-staged # bug on Windows/Github Desktop: add `.cmd` extension fixes it
;;
*)
npx lint-staged
;;
esac
14 changes: 7 additions & 7 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# #!/usr/bin/env sh
# . "$(dirname -- "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# # Install browsers for PlayWright tests
# #npx playwright install
# # Execute tests
# #npm run test
# #./vendor/bin/phpunit phpunit
# Install browsers for PlayWright tests
#npx playwright install
# Execute tests
#npm run test
#./vendor/bin/phpunit phpunit

# # Check if the push includes a tag
# while read local_ref local_sha remote_ref remote_sha; do
Expand Down
1 change: 0 additions & 1 deletion .ideas/todo.txt

This file was deleted.

3 changes: 0 additions & 3 deletions .lintstagedrc

This file was deleted.

4 changes: 1 addition & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
/assets
/tests
/jetpack_vendor
/phpunit
/build
/artifacts
/test-results
/playwright-report
/playwright
/.plugin
**/test/**
/bin
playwright.config.js
playwright.config.js
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Import the default config file and expose it in the project root.
// Useful for editor integrations.
module.exports = require('@wordpress/prettier-config');
module.exports = require( '@wordpress/prettier-config' );
17 changes: 17 additions & 0 deletions .tools/bin/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const fs = require( 'fs' );
const {
copyFileFromTo,
consoleSuccess,
consoleError,
} = require( './helpers/functions' );

//Get arguments
const myArgs = process.argv.slice( 2 );

//Foreach arguments/folders
try {
copyFileFromTo( myArgs[ 0 ], myArgs[ 1 ] );
consoleSuccess( 'File copied successfully' );
} catch ( e ) {
consoleError( 'Can not copy the file, internationalization not found.' );
}
13 changes: 13 additions & 0 deletions .tools/bin/delete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const fs = require( 'fs' );
const { consoleSuccess } = require( './helpers/console' );

//Get arguments
const myArgs = process.argv.slice( 2 );

//Foreach arguments/folders
myArgs.forEach( ( element ) => {
//Delete folder/file
fs.rm( element, { recursive: true }, ( err ) => {
err ?? consoleSuccess( `${ element } deleted` );
} );
} );
24 changes: 24 additions & 0 deletions .tools/bin/deleteZip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// deleteZip.js
const fs = require( 'fs' );
const path = require( 'path' );

const { pluginName } = require( './helpers/functions' );

// Get the base directory of the project
const baseDir = process.cwd();

// Define the zip file
const zipFile = path.join( baseDir, `${ pluginName }.zip` );

// Check if the zip file exists

if ( fs.existsSync( zipFile ) ) {
// Delete the zip file
fs.unlink( zipFile, ( error ) => {
if ( error ) {
console.error( `Failed to delete ${ zipFile }:`, error );
} else {
console.log( `${ zipFile } has been deleted.` );
}
} );
}
15 changes: 15 additions & 0 deletions .tools/bin/helpers/console.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const consoleSuccess = ( message ) => {
console.log( '\x1b[32m%s\x1b[0m', message );
};

const consoleError = ( message ) => {
console.log( '\x1B[31m', message );
};

const consoleInfo = ( message ) => {
console.log( '\x1b[36m%s\x1b[0m', message );
};

module.exports.consoleSuccess = consoleSuccess;
module.exports.consoleError = consoleError;
module.exports.consoleInfo = consoleInfo;
Loading

0 comments on commit cee5cbd

Please sign in to comment.