Skip to content

Commit eaf78ee

Browse files
committed
initial commit
0 parents  commit eaf78ee

20 files changed

+2815
-0
lines changed

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Check if version has changed
20+
id: check_version
21+
run: |
22+
VERSION=$(grep -oP "Version:\s*\K\d+(\.\d+)*" sumup-terminal-for-woocommerce.php)
23+
echo "VERSION=$VERSION" >> $GITHUB_ENV
24+
git fetch --prune --unshallow
25+
if git tag | grep -q "v$VERSION"; then
26+
echo "Version has not changed. Skipping release..."
27+
echo "::set-output name=release::false"
28+
else
29+
echo "Version has changed. Creating new release..."
30+
echo "::set-output name=release::true"
31+
fi
32+
33+
- name: Install composer dependencies
34+
if: steps.check_version.outputs.release == 'true'
35+
run: composer install --no-dev
36+
37+
- name: Install and Build terminal-ui
38+
if: steps.check_version.outputs.release == 'true'
39+
working-directory: packages/terminal-ui
40+
run: |
41+
npm install
42+
npm run build
43+
44+
- name: Create Release
45+
if: steps.check_version.outputs.release == 'true'
46+
id: create_release
47+
uses: actions/create-release@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
with:
51+
tag_name: v${{ env.VERSION }}
52+
release_name: Release v${{ env.VERSION }}
53+
draft: false
54+
prerelease: false
55+
56+
- name: Build and upload ZIP
57+
if: steps.check_version.outputs.release == 'true'
58+
run: |
59+
rm -rf packages # Remove the packages folder
60+
zip -r sumup-terminal-for-woocommerce.zip . -x "*.git*"
61+
gh release upload v${{ env.VERSION }} sumup-terminal-for-woocommerce.zip --clobber
62+
env:
63+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/update-pot.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Update POT file
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "**.php"
9+
workflow_dispatch:
10+
11+
jobs:
12+
update-pot:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup PHP with tools
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: "7.3"
23+
tools: composer, wp-cli
24+
25+
- name: Install dependencies
26+
run: |
27+
wp package install wp-cli/i18n-command:2.2.8
28+
29+
- name: Update POT file
30+
run: wp i18n make-pot . languages/sumup-terminal-for-woocommerce.pot --domain=sumup-terminal-for-woocommerce --slug=sumup-terminal-for-woocommerce --package-name="WooCommerce POS Email Invoice Gateway" --headers="{\"Report-Msgid-Bugs-To\":\"https://github.com/wcpos/email-invoice-gateway/issues\"}"
31+
32+
- name: Check for changes
33+
id: git-diff
34+
run: |
35+
# Extract the current and previous versions of the .pot file
36+
git show HEAD:languages/sumup-terminal-for-woocommerce.pot > old.pot
37+
tail -n +16 languages/sumup-terminal-for-woocommerce.pot > new-trimmed.pot
38+
tail -n +16 old.pot > old-trimmed.pot
39+
40+
# Compare the trimmed files
41+
if diff old-trimmed.pot new-trimmed.pot; then
42+
echo "No changes detected."
43+
else
44+
echo "::set-output name=changes::true"
45+
fi
46+
47+
# Clean up temporary files
48+
rm old.pot new-trimmed.pot old-trimmed.pot
49+
50+
- name: Commit updated POT file
51+
if: steps.git-diff.outputs.changes == 'true'
52+
uses: stefanzweifel/git-auto-commit-action@v4
53+
with:
54+
commit_message: "chore(i18n): update languages/sumup-terminal-for-woocommerce.pot"
55+
file_pattern: "*.pot"

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.DS_Store
2+
Thumbs.db
3+
wp-cli.local.yml
4+
node_modules/
5+
*.zip
6+
*.tar.gz
7+
.idea
8+
coverage/
9+
build/
10+
vendor/
11+
c3.php
12+
!/tests
13+
/tests/*.suite.yml
14+
/tests/_output
15+
.env
16+
.codeception.yml
17+
composer.lock
18+
.wp-env.override.json
19+
assets/js/*
20+
!assets/js/README.md
21+
!assets/js/indexeddb.worker.js
22+
assets/css/*
23+
!assets/css/README.md
24+
assets/asset-manifest.json
25+
assets/static
26+
assets/report.html
27+
yarn.lock
28+
.yarn/install-state.gz
29+
.yarn/cache
30+
hookdocs
31+
*.cache
32+
phpunit.xml
33+
tests/logs/junit.xml

.php-cs-fixer.php

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
<?php
2+
/**
3+
* Configuration file for https://github.com/FriendsOfPHP/PHP-CS-Fixer
4+
* Install with composer: $ composer global require friendsofphp/php-cs-fixer
5+
* Usage (in this directory) : ~/.composer/vendor/bin/php-cs-fixer fix .
6+
*/
7+
8+
$finder = PhpCsFixer\Finder::create()
9+
->exclude('vendor')
10+
->in(__DIR__)
11+
->name('*.php')
12+
->ignoreDotFiles(true)
13+
->ignoreVCS(true);
14+
15+
$config = new PhpCsFixer\Config();
16+
return $config
17+
->setIndent("\t")
18+
->setLineEnding("\r\n")
19+
->setRules([
20+
// '@PSR2' => true,
21+
22+
// Array.
23+
'array_syntax' => ['syntax' => 'long'],
24+
25+
// Basic.
26+
'braces' => [
27+
'allow_single_line_closure' => true,
28+
'position_after_anonymous_constructs' => 'same',
29+
'position_after_functions_and_oop_constructs' => 'same'
30+
],
31+
32+
// Casing.
33+
// 'class_reference_name_casing' => true,
34+
'constant_case' => ['case' => 'lower'],
35+
36+
// Cast Notation.
37+
'cast_spaces' => true,
38+
'lowercase_cast' => true,
39+
'no_short_bool_cast' => true,
40+
'short_scalar_cast' => true,
41+
42+
// Class Notation.
43+
//'class_attributes_separation' => true,
44+
'class_definition' => true,
45+
'no_blank_lines_after_class_opening' => true,
46+
//'no_null_property_initialization' => true,
47+
'no_php4_constructor' => true,
48+
'ordered_class_elements' => true,
49+
'ordered_traits' => true,
50+
'self_accessor' => true,
51+
'single_class_element_per_statement' => true,
52+
'single_trait_insert_per_statement' => true,
53+
'visibility_required' => true,
54+
55+
// Comment.
56+
//'multiline_comment_opening_closing' => true,
57+
'no_empty_comment' => true,
58+
'no_trailing_whitespace_in_comment' => true,
59+
// 'single_line_comment_spacing' => true,
60+
'single_line_comment_style' => true,
61+
62+
// Control Structure
63+
// 'control_structure_braces' => true,
64+
'control_structure_continuation_position' => true,
65+
'elseif' => true,
66+
'include' => true,
67+
'no_alternative_syntax' => true,
68+
'no_superfluous_elseif' => true,
69+
'no_unneeded_control_parentheses' => true,
70+
'no_useless_else' => true,
71+
'switch_case_semicolon_to_colon' => true,
72+
'switch_case_space' => true,
73+
'switch_continue_to_break' => true,
74+
'trailing_comma_in_multiline' => true,
75+
'yoda_style' => true,
76+
77+
// Function Notation
78+
'combine_nested_dirname' => true,
79+
'function_typehint_space' => true,
80+
'implode_call' => true,
81+
'lambda_not_used_import' => true,
82+
'native_function_invocation' => true,
83+
'no_spaces_after_function_name' => true,
84+
// 'no_trailing_comma_in_singleline_function_call' => true,
85+
'no_unreachable_default_argument_value' => true,
86+
'nullable_type_declaration_for_default_null_value' => true,
87+
'return_type_declaration' => true,
88+
//'single_line_throw' => true,
89+
'void_return' => true,
90+
91+
// Import
92+
'fully_qualified_strict_types' => true,
93+
'global_namespace_import' => true,
94+
'no_leading_import_slash' => true,
95+
'no_unused_imports' => true,
96+
'ordered_imports' => true,
97+
'single_import_per_statement' => true,
98+
'single_line_after_imports' => true,
99+
100+
// Language Construct
101+
//'combine_consecutive_issets' => true,
102+
//'combine_consecutive_unsets' => true,
103+
'function_to_constant' => true,
104+
105+
// Namespace Notation
106+
'blank_line_after_namespace' => true,
107+
'clean_namespace' => true,
108+
'no_leading_namespace_whitespace' => true,
109+
'single_blank_line_before_namespace' => true,
110+
111+
// Operator
112+
'concat_space' => ['spacing' => 'one'],
113+
'increment_style' => ['style' => 'post'],
114+
'logical_operators' => true,
115+
'new_with_braces' => true,
116+
'no_space_around_double_colon' => true,
117+
'not_operator_with_space' => true,
118+
'object_operator_without_whitespace' => true,
119+
'standardize_increment' => true,
120+
'standardize_not_equals' => true,
121+
'ternary_operator_spaces' => true,
122+
'ternary_to_null_coalescing' => true,
123+
'binary_operator_spaces' => ['default' => 'align_single_space'],
124+
125+
// PHP Tag
126+
'echo_tag_syntax' => true,
127+
//'linebreak_after_opening_tag' => true,
128+
'no_closing_tag' => true,
129+
130+
// PHPUnit
131+
'php_unit_fqcn_annotation' => true,
132+
'php_unit_method_casing' => ['case' => 'snake_case'],
133+
'php_unit_test_annotation' => true,
134+
'php_unit_test_class_requires_covers' => true,
135+
'php_unit_internal_class' => true,
136+
'php_unit_construct' => true,
137+
138+
// PHPDoc
139+
'align_multiline_comment' => true,
140+
'general_phpdoc_annotation_remove' => true,
141+
'no_empty_phpdoc' => true,
142+
'phpdoc_add_missing_param_annotation' => true,
143+
'phpdoc_align' => true,
144+
'phpdoc_indent' => true,
145+
'phpdoc_line_span' => true,
146+
'phpdoc_no_access' => true,
147+
'phpdoc_no_alias_tag' => true,
148+
'phpdoc_no_package' => true,
149+
'phpdoc_order_by_value' => true,
150+
'phpdoc_order' => true,
151+
'phpdoc_return_self_reference' => true,
152+
'phpdoc_scalar' => true,
153+
'phpdoc_separation' => true,
154+
'phpdoc_summary' => true,
155+
'phpdoc_tag_casing' => true,
156+
'phpdoc_tag_type' => true,
157+
'phpdoc_to_comment' => true,
158+
'phpdoc_trim_consecutive_blank_line_separation' => true,
159+
'phpdoc_trim' => true,
160+
'phpdoc_types' => true,
161+
'phpdoc_types_order' => true,
162+
'phpdoc_var_annotation_correct_order' => true,
163+
'phpdoc_var_without_name' => true,
164+
165+
// Return Notation.
166+
'no_useless_return' => true,
167+
'return_assignment' => true,
168+
169+
// Semicolon.
170+
'multiline_whitespace_before_semicolons' => true,
171+
'no_singleline_whitespace_before_semicolons' => true,
172+
'semicolon_after_instruction' => true,
173+
'space_after_semicolon' => true,
174+
175+
// Strict.
176+
//'declare_strict_types' => true,
177+
//'strict_comparison' => true,
178+
'strict_param' => true,
179+
180+
// Whitespace.
181+
'array_indentation' => true,
182+
'blank_line_before_statement' => true,
183+
// 'blank_line_between_import_groups' => true,
184+
'compact_nullable_typehint' => true,
185+
'indentation_type' => true,
186+
'line_ending' => true,
187+
'method_chaining_indentation' => true,
188+
//'no_spaces_around_offset' => true, // conflict with wp.
189+
//'no_spaces_inside_parenthesis' => true, // conflict with wp.
190+
'no_trailing_whitespace' => true,
191+
//'no_whitespace_in_blank_line' => true,
192+
'single_blank_line_at_eof' => true,
193+
// 'statement_indentation' => true,
194+
//'types_spaces' => true,
195+
196+
])
197+
->setUsingCache(false)
198+
->setRiskyAllowed(true)
199+
->setFinder($finder);

0 commit comments

Comments
 (0)