@codigodoleo/wp-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cspell.json +104 -0
- package/.editorconfig +13 -0
- package/.eslintignore +3 -0
- package/.eslintrc.json +24 -0
- package/.github/workflows/publish-npm.yml +32 -0
- package/.github/workflows/release-please.yml +25 -0
- package/.gitkeep +0 -0
- package/.husky/_/post-merge +0 -0
- package/.prettierignore +4 -0
- package/.prettierrc +8 -0
- package/.vscode/settings.json +19 -0
- package/CHANGELOG.md +47 -0
- package/README.md +115 -0
- package/VSCODE_EXTENSIONS.md +11 -0
- package/bin/index.js +4 -0
- package/docs/HOOKS-SYSTEM.md +172 -0
- package/git-deploy.sh +74 -0
- package/index.php +17 -0
- package/lib/cli.js +15 -0
- package/lib/commands/init.js +132 -0
- package/lib/core/generator.js +261 -0
- package/lib/core/hook-manager.js +172 -0
- package/lib/core/infer-ci-capabilities.js +119 -0
- package/lib/prompts/index.js +105 -0
- package/lib/prompts/loadModulePrompts.js +27 -0
- package/lib/utils/generate-from-template.js +17 -0
- package/lib/utils/git.js +17 -0
- package/lib/utils/logger.js +28 -0
- package/modules/deploy/index.js +39 -0
- package/modules/deploy/prompts.js +27 -0
- package/modules/deploy/templates/.github/workflows/ci.yml.hbs +103 -0
- package/modules/deploy/templates/.gitlab/gitlab-ci.yml.hbs +154 -0
- package/modules/deploy/templates/bitbucket-pipelines.yml.hbs +97 -0
- package/modules/docs/index.js +3 -0
- package/modules/docs/prompts.js +8 -0
- package/modules/docs/templates/README.md.hbs +160 -0
- package/modules/docs/templates/docs/Arquitetura.md +399 -0
- package/modules/docs/templates/docs/Deploy-Pipeline.md +113 -0
- package/modules/docs/templates/docs/Desenvolvimento.md +1116 -0
- package/modules/docs/templates/docs/Getting-Started.md +493 -0
- package/modules/docs/templates/docs/Infraestrutura.md +211 -0
- package/modules/docs/templates/docs/Monitoramento.md +302 -0
- package/modules/docs/templates/docs/Sync-the-Production-DB-with-the-Staging-DB.md +8 -0
- package/modules/docs/templates/docs/Troubleshooting.md +3 -0
- package/modules/git/.commitlintrc.json +136 -0
- package/modules/git/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- package/modules/git/.gitlab/merge_request_templates/default.md +42 -0
- package/modules/git/.gitmessage +29 -0
- package/modules/git/.husky/commit-msg +4 -0
- package/modules/git/.husky/pre-commit +27 -0
- package/modules/git/.lintstagedrc.json +7 -0
- package/modules/git/.vscode/commit-instructions.md +59 -0
- package/modules/git/.vscode/conventional-commits.code-snippets +62 -0
- package/modules/git/.vscode/copilot.json +39 -0
- package/modules/git/docs/CONVENTIONAL-COMMITS.md +131 -0
- package/modules/git/index.js +137 -0
- package/modules/git/prompts.js +23 -0
- package/modules/git/templates/.lando.yml.hbs +13 -0
- package/modules/git/templates/package.json.hbs +15 -0
- package/modules/git/templates/workspace.json.hbs +114 -0
- package/modules/lint/.eslintignore +36 -0
- package/modules/lint/.eslintrc.json +8 -0
- package/modules/lint/.prettierignore +36 -0
- package/modules/lint/.prettierrc.json +29 -0
- package/modules/lint/.stylelintignore +19 -0
- package/modules/lint/.stylelintrc.json +9 -0
- package/modules/lint/index.js +15 -0
- package/modules/lint/pint.json +26 -0
- package/modules/lint/prompts.js +16 -0
- package/modules/lint/templates/.lando.yml.hbs +10 -0
- package/modules/lint/templates/package.json.hbs +16 -0
- package/modules/lint/templates/workspace.json.hbs +56 -0
- package/modules/php/index.js +3 -0
- package/modules/php/prompts.js +8 -0
- package/modules/php/scripts/php-wrapper.sh +38 -0
- package/modules/php/scripts/pint-wrapper.sh +44 -0
- package/modules/php/templates/.lando.yml.hbs +11 -0
- package/modules/php/templates/composer.json.hbs +6 -0
- package/modules/php/templates/workspace.json.hbs +74 -0
- package/modules/redis/prompts.js +8 -0
- package/modules/redis/templates/.lando.yml.hbs +8 -0
- package/modules/sage/index.js +20 -0
- package/modules/sage/prompts.js +16 -0
- package/modules/sage/templates/.lando.yml.hbs +64 -0
- package/modules/sage/templates/theme/composer.json.hbs +18 -0
- package/modules/sage/templates/theme/package.json.hbs +11 -0
- package/modules/sage/templates/theme/style.css.hbs +13 -0
- package/modules/sage/templates/theme/vite.config.js.hbs +53 -0
- package/modules/sage/templates/workspace.json.hbs +67 -0
- package/modules/test-directory/assets/module-file.txt +1 -0
- package/modules/test-directory/index.js +19 -0
- package/modules/test-directory/prompts.js +8 -0
- package/modules/test-directory/test-assets/file1.txt +1 -0
- package/modules/test-directory/test-assets/file2.txt +1 -0
- package/modules/test-directory/test-assets/subfolder/config.json +4 -0
- package/package.json +54 -0
- package/release-please-config.json +17 -0
- package/server/php/php.ini +48 -0
- package/server/www/rocket.conf +283 -0
- package/templates/.editorconfig.hbs +39 -0
- package/templates/.env.hbs +48 -0
- package/templates/.gitignore.hbs +86 -0
- package/templates/.lando.yml.hbs +44 -0
- package/templates/README.md.hbs +12 -0
- package/templates/composer.json.hbs +60 -0
- package/templates/package.json.hbs +47 -0
- package/templates/server/cmd/install-wp.sh.hbs +58 -0
- package/templates/server/www/vhosts.conf.hbs +71 -0
- package/templates/workspace.json.hbs +177 -0
- package/test-copy-directory.js +43 -0
- package/test-overwrite.js +45 -0
- package/wp-config.php +190 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}/wordpress",
|
|
3
|
+
"type": "project",
|
|
4
|
+
"description": "{{projectDescription}}",
|
|
5
|
+
"authors": [
|
|
6
|
+
{
|
|
7
|
+
"name": "{{author}}",
|
|
8
|
+
"email": "{{authorEmail}}"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"repositories": {
|
|
12
|
+
"wpackagist": {
|
|
13
|
+
"type": "composer",
|
|
14
|
+
"url": "https://wpackagist.org"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"require": {
|
|
19
|
+
"php": ">={{phpVersion}}",
|
|
20
|
+
"roots/wordpress": "{{wpCoreVersion}}",
|
|
21
|
+
"inpsyde/wp-translation-downloader": "^2.5",
|
|
22
|
+
"vlucas/phpdotenv": "^5.5"
|
|
23
|
+
},
|
|
24
|
+
"config": {
|
|
25
|
+
"allow-plugins": {
|
|
26
|
+
"roots/wordpress-core-installer": true,
|
|
27
|
+
"inpsyde/wp-translation-downloader": true,
|
|
28
|
+
"composer/installers": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"extra": {
|
|
32
|
+
"wordpress-install-dir": "wp",
|
|
33
|
+
"installer-paths": {
|
|
34
|
+
"content/plugins/{$name}/": [
|
|
35
|
+
"type:wordpress-plugin"
|
|
36
|
+
],
|
|
37
|
+
"content/themes/{$name}/": [
|
|
38
|
+
"type:wordpress-theme"
|
|
39
|
+
],
|
|
40
|
+
"content/mu-plugins/{$name}/": [
|
|
41
|
+
"type:wordpress-muplugin"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"wp-translation-downloader": {
|
|
45
|
+
"languages": [
|
|
46
|
+
"pt_BR",
|
|
47
|
+
"en_US",
|
|
48
|
+
"es_ES"
|
|
49
|
+
],
|
|
50
|
+
"languageRootDir": "content/languages",
|
|
51
|
+
"virtual-packages": [
|
|
52
|
+
{
|
|
53
|
+
"name": "wordpress/wordpress",
|
|
54
|
+
"type": "wordpress-core",
|
|
55
|
+
"version": "{{wpCoreVersion}}"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "{{projectDescription}}",
|
|
5
|
+
"private": true,
|
|
6
|
+
"author": "{{author}} <{{authorEmail}}>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "{{gitRepository}}"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "{{gitRepository}}/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "{{gitRepository}}#readme",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "echo \"No tests specified\" && exit 0",
|
|
18
|
+
"composer:install": "lando composer install",
|
|
19
|
+
"composer:update": "lando composer update",
|
|
20
|
+
"wp:info": "lando wp --info",
|
|
21
|
+
"wp:help": "lando wp help"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@cspell/dict-php": "^4.0.14",
|
|
25
|
+
"@cspell/dict-pt-br": "^2.4.0",
|
|
26
|
+
"standard-version": "^9.5.0",
|
|
27
|
+
"eslint": "^9.30.1",
|
|
28
|
+
"eslint-config-prettier": "^10.1.5",
|
|
29
|
+
"eslint-plugin-import": "^2.32.0",
|
|
30
|
+
"prettier": "^3.6.2",
|
|
31
|
+
"stylelint": "^16.21.1",
|
|
32
|
+
"stylelint-config-standard-scss": "^15.0.1"
|
|
33
|
+
},
|
|
34
|
+
"config": {
|
|
35
|
+
"commitizen": {
|
|
36
|
+
"path": "@commitlint/prompt"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"wordpress",
|
|
41
|
+
"lando",
|
|
42
|
+
"devops",
|
|
43
|
+
"ci-cd",
|
|
44
|
+
"gitflow",
|
|
45
|
+
"{{projectName}}"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Colors for output
|
|
4
|
+
RED='\033[0;31m'
|
|
5
|
+
GREEN='\033[0;32m'
|
|
6
|
+
YELLOW='\033[1;33m'
|
|
7
|
+
BLUE='\033[0;34m'
|
|
8
|
+
NC='\033[0m' # No Color
|
|
9
|
+
|
|
10
|
+
echo -e "${BLUE}🔍 Checking WordPress installation status...${NC}"
|
|
11
|
+
|
|
12
|
+
# Wait for database to be ready
|
|
13
|
+
echo -e "${YELLOW}⏳ Waiting for database connection...${NC}"
|
|
14
|
+
while ! wp db check --quiet 2>/dev/null; do
|
|
15
|
+
echo -e "${YELLOW}⌛ Database not ready yet, waiting...${NC}"
|
|
16
|
+
sleep 2
|
|
17
|
+
done
|
|
18
|
+
|
|
19
|
+
echo -e "${GREEN}✅ Database connection established${NC}"
|
|
20
|
+
|
|
21
|
+
# Check if WordPress is already installed
|
|
22
|
+
if wp core is-installed 2>/dev/null; then
|
|
23
|
+
echo -e "${GREEN}✅ WordPress is already installed${NC}"
|
|
24
|
+
echo -e "${BLUE}📊 Current site info:${NC}"
|
|
25
|
+
wp option get siteurl
|
|
26
|
+
wp option get admin_email
|
|
27
|
+
exit 0
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
echo -e "${YELLOW}🚀 WordPress not installed. Starting installation...${NC}"
|
|
31
|
+
|
|
32
|
+
# Download WordPress core if not present
|
|
33
|
+
if [ ! -d wp-admin ]; then
|
|
34
|
+
echo -e "${BLUE}📥 Downloading WordPress core...${NC}"
|
|
35
|
+
wp core download --force --path=/wp --skip-content
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Install WordPress
|
|
39
|
+
echo -e "${BLUE}🏗️ Installing WordPress...${NC}"
|
|
40
|
+
wp core install \
|
|
41
|
+
--url="${PROJECT_DOMAIN}" \
|
|
42
|
+
--title="${PROJECT_NAME:-WordPress Development}" \
|
|
43
|
+
--admin_user="${WORDPRESS_ADMIN_USER:-admin}" \
|
|
44
|
+
--admin_password="${WORDPRESS_ADMIN_PASSWORD:-admin}" \
|
|
45
|
+
--admin_email="${WORDPRESS_ADMIN_EMAIL:-admin@example.com}" \
|
|
46
|
+
--skip-email
|
|
47
|
+
|
|
48
|
+
echo -e "${GREEN}✅ WordPress installed successfully!${NC}"
|
|
49
|
+
|
|
50
|
+
# Update permalinks
|
|
51
|
+
wp rewrite structure '/%postname%/' --hard
|
|
52
|
+
|
|
53
|
+
echo -e "${GREEN}🎉 WordPress setup completed successfully!${NC}"
|
|
54
|
+
echo -e "${BLUE}📋 Access Details:${NC}"
|
|
55
|
+
echo -e "${YELLOW}URL:${NC} ${APP_URL}"
|
|
56
|
+
echo -e "${YELLOW}Admin User:${NC} ${WORDPRESS_ADMIN_USER:-admin}"
|
|
57
|
+
echo -e "${YELLOW}Admin Password:${NC} ${WORDPRESS_ADMIN_PASSWORD:-admin}"
|
|
58
|
+
echo -e "${YELLOW}Admin Email:${NC} ${WORDPRESS_ADMIN_EMAIL:-admin@example.com}"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
upstream php {
|
|
2
|
+
server fpm:9000;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
server {
|
|
6
|
+
|
|
7
|
+
listen 80 default_server;
|
|
8
|
+
listen 443 ssl;
|
|
9
|
+
|
|
10
|
+
server_name localhost;
|
|
11
|
+
|
|
12
|
+
ssl_certificate /certs/cert.crt;
|
|
13
|
+
ssl_certificate_key /certs/cert.key;
|
|
14
|
+
ssl_verify_client off;
|
|
15
|
+
|
|
16
|
+
ssl_session_cache shared:SSL:1m;
|
|
17
|
+
ssl_session_timeout 5m;
|
|
18
|
+
|
|
19
|
+
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
20
|
+
ssl_prefer_server_ciphers on;
|
|
21
|
+
|
|
22
|
+
port_in_redirect off;
|
|
23
|
+
client_max_body_size 100M;
|
|
24
|
+
|
|
25
|
+
## Your only path reference.
|
|
26
|
+
root "/app";
|
|
27
|
+
|
|
28
|
+
## This should be in your http block and if it is, it's not needed here.
|
|
29
|
+
index index.php;
|
|
30
|
+
|
|
31
|
+
location = /favicon.ico {
|
|
32
|
+
log_not_found off;
|
|
33
|
+
access_log off;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
location = /robots.txt {
|
|
37
|
+
allow all;
|
|
38
|
+
log_not_found off;
|
|
39
|
+
access_log off;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Add Server-Timing header to track request time and database response time
|
|
43
|
+
add_header Server-Timing 'php=$request_time; db=$upstream_response_time';
|
|
44
|
+
|
|
45
|
+
{{#if useRocket}}
|
|
46
|
+
# Include Rocket Nginx configuration
|
|
47
|
+
include /app/server/www/rocket.conf;
|
|
48
|
+
{{/if}}
|
|
49
|
+
|
|
50
|
+
location / {
|
|
51
|
+
# This is cool because no php is touched for static content.
|
|
52
|
+
# include the "?$args" part so non-default permalinks doesn't break when using query string
|
|
53
|
+
try_files $uri $uri/ /index.php?$args;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
location ~ \.php$ {
|
|
57
|
+
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
|
58
|
+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
59
|
+
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
|
|
60
|
+
include fastcgi_params;
|
|
61
|
+
fastcgi_intercept_errors on;
|
|
62
|
+
fastcgi_pass php;
|
|
63
|
+
fastcgi_buffers 16 16k;
|
|
64
|
+
fastcgi_buffer_size 32k;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
|
|
68
|
+
expires max;
|
|
69
|
+
log_not_found off;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
{
|
|
2
|
+
"folders": [
|
|
3
|
+
{
|
|
4
|
+
"name": "🌿 {{projectName}}",
|
|
5
|
+
"path": "."
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"settings": {
|
|
9
|
+
"git.inputValidation": "always",
|
|
10
|
+
"git.inputValidationLength": 100,
|
|
11
|
+
"git.inputValidationSubjectLength": 100,
|
|
12
|
+
"git.confirmSync": false,
|
|
13
|
+
"git.autofetch": true,
|
|
14
|
+
"git.enableSmartCommit": true,
|
|
15
|
+
"git.suggestSmartCommit": true,
|
|
16
|
+
"git.autoStash": true,
|
|
17
|
+
"git.allowNoVerifyCommit": false,
|
|
18
|
+
"editor.formatOnSave": false,
|
|
19
|
+
"editor.codeActionsOnSave": {
|
|
20
|
+
"source.fixAll.eslint": "explicit",
|
|
21
|
+
"source.organizeImports": "explicit"
|
|
22
|
+
},
|
|
23
|
+
"editor.tabSize": 4,
|
|
24
|
+
"editor.insertSpaces": true,
|
|
25
|
+
"search.exclude": {
|
|
26
|
+
"**/node_modules": true,
|
|
27
|
+
"**/vendor": true,
|
|
28
|
+
"**/.lando": true,
|
|
29
|
+
"**/public/build": true,
|
|
30
|
+
"**/dist": true,
|
|
31
|
+
"**/.git": true,
|
|
32
|
+
"**/wp": true
|
|
33
|
+
},
|
|
34
|
+
"files.exclude": {
|
|
35
|
+
"**/node_modules": true,
|
|
36
|
+
"**/vendor": true,
|
|
37
|
+
"**/.git": true,
|
|
38
|
+
"**/.DS_Store": true,
|
|
39
|
+
"**/Thumbs.db": true
|
|
40
|
+
},
|
|
41
|
+
"extensions.ignoreRecommendations": false,
|
|
42
|
+
"emmet.includeLanguages": {
|
|
43
|
+
"blade": "html",
|
|
44
|
+
"php": "html"
|
|
45
|
+
},
|
|
46
|
+
"files.autoSave": "onFocusChange",
|
|
47
|
+
"files.trimTrailingWhitespace": true,
|
|
48
|
+
"files.insertFinalNewline": true
|
|
49
|
+
},
|
|
50
|
+
"extensions": {
|
|
51
|
+
"recommendations": [
|
|
52
|
+
"eamodio.gitlens",
|
|
53
|
+
"ms-vscode.vscode-json",
|
|
54
|
+
"streetsidesoftware.code-spell-checker",
|
|
55
|
+
"vivaxy.vscode-conventional-commits",
|
|
56
|
+
"bmewburn.vscode-intelephense-client",
|
|
57
|
+
"wordpresstoolbox.wordpress-toolbox",
|
|
58
|
+
"tungvn.wordpress-snippet",
|
|
59
|
+
"junstyle.php-cs-fixer",
|
|
60
|
+
"felixfbecker.php-debug",
|
|
61
|
+
"esbenp.prettier-vscode",
|
|
62
|
+
"dbaeumer.vscode-eslint",
|
|
63
|
+
"bradlc.vscode-tailwindcss",
|
|
64
|
+
"ms-azuretools.vscode-docker",
|
|
65
|
+
"ms-vscode-remote.remote-containers",
|
|
66
|
+
"ms-vscode.vscode-typescript-next",
|
|
67
|
+
"formulahendry.auto-rename-tag",
|
|
68
|
+
"christian-kohler.path-intellisense",
|
|
69
|
+
"ms-vscode.vscode-todo-highlight",
|
|
70
|
+
"mhutchie.git-graph",
|
|
71
|
+
"pkief.material-icon-theme",
|
|
72
|
+
"zhuangtongfa.material-theme",
|
|
73
|
+
"xdebug.php-debug",
|
|
74
|
+
"yzhang.markdown-all-in-one",
|
|
75
|
+
"davidanson.vscode-markdownlint",
|
|
76
|
+
"editorconfig.editorconfig",
|
|
77
|
+
"ms-vscode.js-debug",
|
|
78
|
+
"johnbillion.vscode-wordpress-hooks",
|
|
79
|
+
"valeryanm.vscode-phpsab",
|
|
80
|
+
"GitHub.copilot",
|
|
81
|
+
"GitHub.copilot-chat",
|
|
82
|
+
"ms-vscode-remote.remote-wsl",
|
|
83
|
+
"Catppuccin.catppuccin-vsc",
|
|
84
|
+
"sainnhe.everforest"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"tasks": {
|
|
88
|
+
"version": "2.0.0",
|
|
89
|
+
"tasks": [
|
|
90
|
+
{
|
|
91
|
+
"label": "🚀 Lando: Start",
|
|
92
|
+
"type": "shell",
|
|
93
|
+
"command": "lando",
|
|
94
|
+
"args": ["start"],
|
|
95
|
+
"group": "build",
|
|
96
|
+
"presentation": {
|
|
97
|
+
"echo": true,
|
|
98
|
+
"reveal": "always",
|
|
99
|
+
"focus": false,
|
|
100
|
+
"panel": "shared"
|
|
101
|
+
},
|
|
102
|
+
"isBackground": true,
|
|
103
|
+
"problemMatcher": []
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"label": "🛑 Lando: Stop",
|
|
107
|
+
"type": "shell",
|
|
108
|
+
"command": "lando",
|
|
109
|
+
"args": ["stop"],
|
|
110
|
+
"group": "build",
|
|
111
|
+
"presentation": {
|
|
112
|
+
"echo": true,
|
|
113
|
+
"reveal": "always",
|
|
114
|
+
"focus": false,
|
|
115
|
+
"panel": "shared"
|
|
116
|
+
},
|
|
117
|
+
"problemMatcher": []
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"label": "ℹ️ Lando: Info",
|
|
121
|
+
"type": "shell",
|
|
122
|
+
"command": "lando",
|
|
123
|
+
"args": ["info"],
|
|
124
|
+
"group": "build",
|
|
125
|
+
"presentation": {
|
|
126
|
+
"echo": true,
|
|
127
|
+
"reveal": "always",
|
|
128
|
+
"focus": false,
|
|
129
|
+
"panel": "shared"
|
|
130
|
+
},
|
|
131
|
+
"problemMatcher": []
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"label": "🌐 Yarn: Install (Node)",
|
|
135
|
+
"type": "shell",
|
|
136
|
+
"command": "lando",
|
|
137
|
+
"args": ["yarn", "install"],
|
|
138
|
+
"group": "build",
|
|
139
|
+
"presentation": {
|
|
140
|
+
"echo": true,
|
|
141
|
+
"reveal": "always",
|
|
142
|
+
"focus": false,
|
|
143
|
+
"panel": "shared"
|
|
144
|
+
},
|
|
145
|
+
"problemMatcher": []
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"label": "📦 Composer: Install Dependencies",
|
|
149
|
+
"type": "shell",
|
|
150
|
+
"command": "lando",
|
|
151
|
+
"args": ["composer", "install"],
|
|
152
|
+
"group": "build",
|
|
153
|
+
"presentation": {
|
|
154
|
+
"echo": true,
|
|
155
|
+
"reveal": "always",
|
|
156
|
+
"focus": false,
|
|
157
|
+
"panel": "shared"
|
|
158
|
+
},
|
|
159
|
+
"problemMatcher": []
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"label": "🗄️ Redis CLI",
|
|
163
|
+
"type": "shell",
|
|
164
|
+
"command": "lando",
|
|
165
|
+
"args": ["redis-cli"],
|
|
166
|
+
"group": "build",
|
|
167
|
+
"presentation": {
|
|
168
|
+
"echo": true,
|
|
169
|
+
"reveal": "always",
|
|
170
|
+
"focus": false,
|
|
171
|
+
"panel": "shared"
|
|
172
|
+
},
|
|
173
|
+
"problemMatcher": []
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Generator } from './lib/core/generator.js';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
|
|
5
|
+
async function testCopyDirectory() {
|
|
6
|
+
const testDir = path.resolve('__test-sandbox__/copy-directory-test');
|
|
7
|
+
const generator = new Generator(testDir);
|
|
8
|
+
|
|
9
|
+
// Limpa e cria diretório de teste
|
|
10
|
+
await fs.remove(testDir);
|
|
11
|
+
await fs.ensureDir(testDir);
|
|
12
|
+
|
|
13
|
+
console.log('🧪 Testing copyDirectory functionality...');
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
// Teste 1: Copiar pasta simples
|
|
17
|
+
await generator.copyDirectory('test-assets', 'test-directory');
|
|
18
|
+
console.log('✅ Test 1 passed: Simple directory copy');
|
|
19
|
+
|
|
20
|
+
// Teste 2: Copiar pasta com nome personalizado
|
|
21
|
+
await generator.copyDirectory('test-assets', 'test-directory', 'custom-assets');
|
|
22
|
+
console.log('✅ Test 2 passed: Custom name directory copy');
|
|
23
|
+
|
|
24
|
+
// Teste 3: Copiar pasta sem sobrescrever
|
|
25
|
+
await generator.copyDirectory('test-assets', 'test-directory', 'protected-assets', false);
|
|
26
|
+
console.log('✅ Test 3 passed: Non-overwrite directory copy');
|
|
27
|
+
|
|
28
|
+
// Teste 4: Copiar pasta de um módulo específico
|
|
29
|
+
await generator.copyDirectory('assets', 'test-directory', 'module-assets');
|
|
30
|
+
console.log('✅ Test 4 passed: Module-specific directory copy');
|
|
31
|
+
|
|
32
|
+
console.log('🎉 All tests passed!');
|
|
33
|
+
|
|
34
|
+
// Lista os arquivos criados
|
|
35
|
+
const files = await fs.readdir(testDir, { recursive: true });
|
|
36
|
+
console.log('📁 Created files:', files);
|
|
37
|
+
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('❌ Test failed:', error.message);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
testCopyDirectory();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Generator } from './lib/core/generator.js';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
|
|
5
|
+
async function testOverwrite() {
|
|
6
|
+
const testDir = path.resolve('__test-sandbox__/overwrite-test');
|
|
7
|
+
const generator = new Generator(testDir);
|
|
8
|
+
|
|
9
|
+
// Limpa e cria diretório de teste
|
|
10
|
+
await fs.remove(testDir);
|
|
11
|
+
await fs.ensureDir(testDir);
|
|
12
|
+
|
|
13
|
+
console.log('🧪 Testing copyDirectory overwrite behavior...');
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
// Cria um arquivo existente primeiro
|
|
17
|
+
await fs.ensureDir(path.join(testDir, 'test-assets'));
|
|
18
|
+
await fs.writeFile(path.join(testDir, 'test-assets', 'file1.txt'), 'Arquivo original');
|
|
19
|
+
|
|
20
|
+
console.log('📝 Created existing file');
|
|
21
|
+
|
|
22
|
+
// Teste 1: Sobrescrever (padrão)
|
|
23
|
+
await generator.copyDirectory('test-assets', 'test-directory');
|
|
24
|
+
console.log('✅ Test 1 passed: Overwrite (default)');
|
|
25
|
+
|
|
26
|
+
// Verifica se o arquivo foi sobrescrito
|
|
27
|
+
const content1 = await fs.readFile(path.join(testDir, 'test-assets', 'file1.txt'), 'utf8');
|
|
28
|
+
console.log('📄 File content after overwrite:', content1);
|
|
29
|
+
|
|
30
|
+
// Teste 2: Não sobrescrever
|
|
31
|
+
await generator.copyDirectory('test-assets', 'test-directory', 'protected-assets', false);
|
|
32
|
+
console.log('✅ Test 2 passed: No overwrite');
|
|
33
|
+
|
|
34
|
+
// Teste 3: Sobrescrever explicitamente
|
|
35
|
+
await generator.copyDirectory('test-assets', 'test-directory', 'explicit-overwrite', true);
|
|
36
|
+
console.log('✅ Test 3 passed: Explicit overwrite');
|
|
37
|
+
|
|
38
|
+
console.log('🎉 All overwrite tests passed!');
|
|
39
|
+
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error('❌ Test failed:', error.message);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
testOverwrite();
|