Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"@babel/preset-env",
["@babel/preset-react", { "runtime": "automatic" }]
]
}
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false

[*.{php,html}]
indent_style = tab
tab_width = 4
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
node_modules/*
dist/*
vendor/*
vendor_prefixed/*
sync.js
128 changes: 128 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# README
# Make sure:
# - Repository CI/CD variables (repository->settings->CI/CD->Variables) are correct set:
# - $SSH_PRIVATE_KEY_staging
# - $SSH_USER_staging
# - $SSH_ADDRESS_staging
# - Server to which the deployment is performed has a correct public key
# - Ssh user is able to execute "docker compose" or "docker-compose", if not you should contact with the server admin

stages:
- lint
- tests
- deploy

lint:
stage: lint
tags:
- docker-to-docker
image: php:8.2
before_script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt -y install unzip zip git rsync openssh-client libzip-dev
- docker-php-ext-install zip
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_staging" | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
script:
- cd ./

only:
- merge_requests

tests:
stage: lint
tags:
- docker-to-docker
image: php:8.2
before_script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt -y install unzip zip git rsync openssh-client libzip-dev
- docker-php-ext-install zip
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_staging" | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
script:
- composer build --working-dir ./

only:
- merge_requests

deploy_staging:
stage: deploy
tags:
- docker-to-docker
image: php:8.2
when: on_success
environment:
name: staging
before_script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt -y install unzip zip git rsync openssh-client libzip-dev
- docker-php-ext-install zip
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_staging" | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
- "[ -f ~/.nvm/nvm.sh ] && [ -f ~/.nvm/bash_completion ] && . ~/.nvm/nvm.sh && . ~/.nvm/bash_completion"
- nvm install --lts
script:
# Build app
- composer build --working-dir ./
- nvm install
- nvm use
- npm install
- npm run build
- rm -rf node_modules

# Common variables
- |
_WOO_SERVER_BASE_PATH="$( ssh -o StrictHostKeyChecking=no $SSH_USER_WOO_staging@$SSH_ADDRESS_staging realpath httpdocs )"
- |
_WP_SERVER_BASE_PATH="$( ssh -o StrictHostKeyChecking=no $SSH_USER_WP_staging@$SSH_ADDRESS_staging realpath httpdocs )"

# Sync to WOO
- |
if [ -n "$_WOO_SERVER_BASE_PATH" ]; then
echo "Path: $_WOO_SERVER_BASE_PATH/wp-content/plugins/picsart-plugin/"
rsync -R -e "ssh -o StrictHostKeyChecking=no" -atvP \
assets \
dist \
includes \
vendor \
vendor_prefixed \
readme.txt \
languages \
picsart-ai-image-editor.php \
$SSH_USER_WOO_staging@$SSH_ADDRESS_staging:~/httpdocs/wp-content/plugins/picsart-ai-image-editor/
else
echo "ERROR: _WOO_SERVER_BASE_PATH is empty"
exit 1
fi

# Sync to WP
- |
if [ -n "$_WP_SERVER_BASE_PATH" ]; then
echo "Path: $_WP_SERVER_BASE_PATH/wp-content/plugins/picsart-plugin/"
rsync -R -e "ssh -o StrictHostKeyChecking=no" -atvP \
assets \
dist \
includes \
vendor \
vendor_prefixed \
readme.txt \
languages \
picsart-ai-image-editor.php \
$SSH_USER_WP_staging@$SSH_ADDRESS_staging:~/httpdocs/wp-content/plugins/picsart-ai-image-editor/
else
echo "ERROR: _WP_SERVER_BASE_PATH is empty"
exit 1
fi
only:
- staging
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22
24 changes: 24 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const wordpressPrettierConfig = require('@wordpress/prettier-config')

module.exports = {
...wordpressPrettierConfig,
arrowParens: 'always',
bracketSpacing: true,
endOfLine: 'lf',
htmlWhitespaceSensitivity: 'css',
insertPragma: false,
singleAttributePerLine: false,
bracketSameLine: false,
jsxBracketSameLine: false,
jsxSingleQuote: false,
printWidth: 80,
proseWrap: 'preserve',
quoteProps: 'as-needed',
requirePragma: false,
semi: false,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: true,
vueIndentScriptAndStyle: true,
}
Binary file added assets/fonts/Gilroy-Medium.woff
Binary file not shown.
Binary file added assets/fonts/Gilroy-Medium.woff2
Binary file not shown.
Binary file added assets/fonts/Gilroy-Regular.woff
Binary file not shown.
Binary file added assets/fonts/Gilroy-Regular.woff2
Binary file not shown.
3 changes: 3 additions & 0 deletions assets/icons/checkbox-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/icons/checkbox-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/picsart-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions assets/icons/picsart-sygnet-dark.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const SygnetDarkIcon = () => (
<svg width="22" height="22" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M14.4861 28.3976C15.5806 29.0874 16.7655 29.6219 18.0069 29.9858C19.2947 30.3577 20.6264 30.5445 22.0003 30.5445C23.8394 30.5546 25.6627 30.2048 27.3676 29.515C28.9782 28.8324 30.4483 27.8573 31.7036 26.639C32.9597 25.4124 33.9657 23.9535 34.6657 22.3434C35.3854 20.6918 35.7511 18.9077 35.7391 17.1062C35.7513 15.304 35.3856 13.5193 34.6657 11.8671C33.9718 10.267 32.9646 8.82199 31.7036 7.61722C30.4483 6.39897 28.9782 5.42385 27.3676 4.74123C25.6696 4.02374 23.8436 3.65854 22.0003 3.66777C20.157 3.65854 18.331 4.02374 16.633 4.74123C15.0134 5.43041 13.5306 6.4045 12.2549 7.61722C11.0156 8.83139 10.0239 10.2747 9.33498 11.8671C8.61502 13.5193 8.24934 15.304 8.26153 17.1062V39.0882C8.26153 39.4326 8.37693 39.733 8.60591 39.9895C8.86237 40.2185 9.16279 40.3339 9.50718 40.3339H13.2423C13.4011 40.338 13.5591 40.3095 13.7065 40.2503C13.854 40.1911 13.9877 40.1023 14.0996 39.9895C14.3579 39.733 14.4861 39.4326 14.4861 39.0882V28.3976ZM29.5145 17.1062C29.5145 19.1395 28.769 20.8706 27.2797 22.3012C25.8215 23.7319 24.0611 24.4482 22.0003 24.4482C21.0149 24.462 20.0365 24.2793 19.1225 23.9107C18.2085 23.542 17.3771 22.9949 16.677 22.3012C15.217 20.8706 14.4861 19.1395 14.4861 17.1062C14.4861 15.1021 15.217 13.3857 16.677 11.955C17.3771 11.2614 18.2085 10.7142 19.1225 10.3456C20.0365 9.97697 21.0149 9.79424 22.0003 9.8081C24.0611 9.8081 25.8215 10.5225 27.2815 11.955C28.769 13.3839 29.5145 15.1021 29.5145 17.1062Z"
fill="#5A00EE"/>
</svg>
);

export default SygnetDarkIcon;
Binary file added assets/icons/picsart-sygnet-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/picsart-sygnet-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "pic/picsart",
"description": "Picsart",
"authors": [
{
"name": "Jakub Jóźwiak WLC",
"email": "jjozwiak@whitelabelcoders.com"
}
],
"require": {
"php": ">=8.1",
"humbug/php-scoper": "0.17.7",
"guzzlehttp/guzzle": "^7.0"
},
"require-dev": {
"brain/monkey": "2.*",
"phpunit/phpunit": "^9.5",
"wp-coding-standards/wpcs": "3.1.0",
"phpcompatibility/php-compatibility": "9.3",
"phpstan/phpstan": "^1.10",
"szepeviktor/phpstan-wordpress": "v1.3",
"phpcsstandards/phpcsutils": "^1.0",
"php-stubs/woocommerce-stubs": "7.7",
"squizlabs/php_codesniffer": "^3.13.1"
},
"autoload": {
"classmap": [
"vendor_prefixed"
],
"psr-4": {
"PICSART\\": "includes/"
}
},
"scripts": {
"init-env": "composer run pre-install-cmd && composer require humbug/php-scoper:0.17.7",
"build": "composer install --no-dev && composer run prefixer && composer run clear",
"dev": "composer install && composer run prefixer-dev && composer run clear",
"prefixer": "rm -rf vendor_prefixed && vendor/bin/php-scoper add-prefix --output-dir vendor_prefixed && find vendor/* -type d ! -name \"composer\" -exec rm -rf {} + && composer dump-autoload",
"prefixer-dev": "rm -rf vendor_prefixed && vendor/bin/php-scoper add-prefix --output-dir vendor_prefixed",
"clear": "rm -rf vendor_prefixed/jetbrains && rm -rf vendor_prefixed/humbug && rm -rf vendor_prefixed/nikic && rm -rf vendor_prefixed/thecodingmachine",
"tests": "composer install && composer phpcs-fix && composer phpcs && composer phpstan",
"phpcs": "phpcs --standard=phpcs.xml.dist",
"phpcs-fix": "phpcbf",
"phpstan": "php -d memory_limit=2G ./vendor/bin/phpstan analyse",
"pre-install-cmd": "test -d vendor_prefixed || mkdir vendor_prefixed",
"all": "composer run pre-install-cmd && composer run build && composer run tests",
"setup-git-hooks": [
"cp hooks/pre-commit .git/hooks/pre-commit || true",
"chmod +x .git/hooks/pre-commit || true"
]
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"post-install-cmd": [
"@setup-git-hooks",
"npm install"
]
}
Loading