Skip to content

Commit 842f6a4

Browse files
committed
Merge branch 'master' of github.com:pluginpal/strapi-webtools into feat/add-documentation
2 parents 1244f7d + acfe8bc commit 842f6a4

File tree

21 files changed

+440
-129
lines changed

21 files changed

+440
-129
lines changed

.changeset/gold-places-yawn.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 🐛 Bug Report
22
description: Create a report to help improve this plugin
3-
title: "[Bug]: "
3+
title: "[Bug] "
44
labels: ["bug"]
55
body:
66
- type: markdown
@@ -14,10 +14,10 @@ body:
1414
label: Addon
1515
description: Please select the addon related to this issue
1616
options:
17-
- No specific addon – This bug report is related to Webtools Core
18-
- Webtools Core: Sitemap Addon
19-
- Webtools Pro: Redirects Addon
20-
- Webtools Pro: Links Addon
17+
- "No specific addon – This bug report is related to Webtools Core"
18+
- "Webtools Core - Sitemap Addon"
19+
- "Webtools Pro - Redirects Addon"
20+
- "Webtools Pro - Links Addon"
2121
validations:
2222
required: true
2323

@@ -76,11 +76,15 @@ body:
7676
validations:
7777
required: true
7878

79-
- type: input
80-
id: npm-version
79+
- type: dropdown
80+
id: package-manager
8181
attributes:
82-
label: NPM version
83-
placeholder: e.g., 9.6.7
82+
label: Package manager
83+
description: Which package manager are you using?
84+
options:
85+
- NPM
86+
- Yarn
87+
- Pnpm
8488
validations:
8589
required: true
8690

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 🚀 Feature Request
22
description: Suggest an idea to help make this plugin even better!
3-
title: "[Feature]: "
3+
title: "[Feature] "
44
labels: ["enhancement"]
55
body:
66
- type: markdown
@@ -14,10 +14,10 @@ body:
1414
label: Addon
1515
description: Please select the addon related to this request
1616
options:
17-
- No specific addon – This feature request is related to Webtools Core
18-
- Webtools Core: Sitemap Addon
19-
- Webtools Pro: Redirects Addon
20-
- Webtools Pro: Links Addon
17+
- "No specific addon – This feature request is related to Webtools Core"
18+
- "Webtools Core - Sitemap Addon"
19+
- "Webtools Pro - Redirects Addon"
20+
- "Webtools Pro - Links Addon"
2121
validations:
2222
required: true
2323

packages/cli/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# webtools-cli
22

3+
## 1.1.0
4+
5+
### Minor Changes
6+
7+
- [#317](https://github.com/pluginpal/strapi-webtools/pull/317) [`e913598`](https://github.com/pluginpal/strapi-webtools/commit/e91359874df631fddd8c8ea3ef958805a511f4c8) Thanks [@boazpoolman](https://github.com/boazpoolman)! - feat: add license key setup to the cli
8+
39
## 1.0.1
410

511
### Patch Changes

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webtools-cli",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "CLI installer for Strapi Webtools",
55
"exports": {
66
".": {
Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import chalk from 'chalk';
2-
import { checkbox } from '@inquirer/prompts';
32
import { checkStrapiProject } from '../utils/strapi';
4-
import { getContentTypes, enableWebtoolsForContentType } from '../utils/content-types';
3+
import { getContentTypes } from '../utils/content-types';
4+
import { enableContentTypes } from './subcommands/enable-content-types';
55

66
export async function enable() {
77
// Check if we're in a Strapi project
@@ -14,40 +14,8 @@ export async function enable() {
1414
// Get available content types
1515
const contentTypes = getContentTypes();
1616

17-
if (contentTypes.length === 0) {
18-
console.log(chalk.yellow('No content types found in your Strapi project.'));
19-
return;
20-
}
21-
22-
// Let user select content types
23-
const selectedContentTypes = await checkbox({
24-
message: 'Select content types to enable Webtools for:',
25-
choices: contentTypes.map((type) => ({
26-
name: type,
27-
value: type,
28-
})),
29-
});
30-
31-
// Enable Webtools for selected content types
32-
if (selectedContentTypes.length > 0) {
33-
console.log(chalk.blue('\nEnabling Webtools for selected content types...'));
34-
35-
const results = selectedContentTypes.map((contentType) => {
36-
const success = enableWebtoolsForContentType(contentType);
37-
if (success) {
38-
console.log(chalk.green(`✓ Enabled Webtools for ${contentType}`));
39-
return true;
40-
}
41-
42-
console.log(chalk.red(`✗ Failed to enable Webtools for ${contentType}`));
43-
return false;
44-
});
45-
46-
const successCount = results.filter(Boolean).length;
47-
console.log(chalk.blue(`\nEnabled Webtools for ${successCount} of ${selectedContentTypes.length} content types.`));
48-
} else {
49-
console.log(chalk.yellow('No content types selected. Nothing to do.'));
50-
}
17+
// Enable Webtools for content types
18+
await enableContentTypes(contentTypes);
5119

5220
console.log(chalk.yellow('\nYou may need to restart your Strapi server for changes to take effect.'));
5321
}

packages/cli/src/commands/install.ts

Lines changed: 21 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import chalk from 'chalk';
2-
import { checkbox, confirm, input } from '@inquirer/prompts';
2+
import { checkbox } from '@inquirer/prompts';
33
import { checkStrapiProject } from '../utils/strapi';
4-
import { getContentTypes, enableWebtoolsForContentType } from '../utils/content-types';
4+
import { getContentTypes } from '../utils/content-types';
55
import { getAvailableAddons, getPremiumAddons } from '../utils/addons';
66
import { installPackage } from '../utils/package-manager';
7-
import { createLicenseFiles } from '../utils/license';
7+
import { logger } from '../utils/logger';
8+
import { enableContentTypes } from './subcommands/enable-content-types';
89

910
export async function install() {
1011
// Check if we're in a Strapi project
@@ -14,67 +15,22 @@ export async function install() {
1415
return;
1516
}
1617

17-
// Ask about license key
18-
const hasLicense = await confirm({
19-
message: 'Do you have a license key for Webtools?',
20-
default: false,
21-
});
18+
logger.title(
19+
'Webtools',
20+
`${chalk.bold('🚀 Let\'s build your new website with Strapi')}\n`,
21+
);
2222

23-
let licenseKey: string | null = null;
24-
if (hasLicense) {
25-
licenseKey = await input({
26-
message: 'Please enter your license key:',
27-
validate: (value) => {
28-
if (!value || value.trim().length === 0) {
29-
return 'License key cannot be empty';
30-
}
31-
return true;
32-
},
33-
});
34-
35-
// Create license files
36-
console.log(chalk.blue('\nSetting up license configuration...'));
37-
const success = await createLicenseFiles(licenseKey);
38-
if (!success) {
39-
console.log(chalk.red('Failed to setup license configuration. Continuing without the license.'));
40-
licenseKey = null;
41-
}
42-
}
23+
// console.log('🚀 Get more out of Webtools with premium add-ons!\n');
24+
25+
// const { licenseKey } = await licenseSetup();
26+
27+
const licenseKey = null;
4328

4429
// Get available content types
4530
const contentTypes = getContentTypes();
4631

47-
if (contentTypes.length === 0) {
48-
console.log(chalk.yellow('No content types found in your Strapi project, skipping Webtools setup step. You can enable Webtools later using the "enable" command.'));
49-
} else {
50-
// Let user select content types
51-
const selectedContentTypes = await checkbox({
52-
message: 'Select content types to enable Webtools for:',
53-
choices: contentTypes.map((type) => ({
54-
name: type,
55-
value: type,
56-
})),
57-
});
58-
59-
// Enable Webtools for selected content types
60-
if (selectedContentTypes.length > 0) {
61-
console.log(chalk.blue('\nEnabling Webtools for selected content types...'));
62-
63-
const results = selectedContentTypes.map((contentType) => {
64-
const success = enableWebtoolsForContentType(contentType);
65-
if (success) {
66-
console.log(chalk.green(`✓ Enabled Webtools for ${contentType}`));
67-
return true;
68-
}
69-
70-
console.log(chalk.red(`✗ Failed to enable Webtools for ${contentType}`));
71-
return false;
72-
});
73-
74-
const successCount = results.filter(Boolean).length;
75-
console.log(chalk.blue(`\nEnabled Webtools for ${successCount} of ${selectedContentTypes.length} content types.`));
76-
}
77-
}
32+
// Enable Webtools for content types
33+
await enableContentTypes(contentTypes);
7834

7935
// Get available addons
8036
const availableAddons = getAvailableAddons();
@@ -86,6 +42,9 @@ export async function install() {
8642
allAddons = [...availableAddons, ...premiumAddons];
8743
}
8844

45+
// New line
46+
console.log('');
47+
8948
// Let user select addons
9049
const selectedAddons = await checkbox({
9150
message: 'Select addons to install:',
@@ -109,13 +68,13 @@ export async function install() {
10968

11069
// Install all packages at once
11170
if (packagesToInstall.length > 0) {
112-
console.log(chalk.blue('\nInstalling packages...'));
71+
console.log(`\n${chalk.cyan('●')} Installing packages...\n`);
11372

11473
const success = installPackage(packagesToInstall.join(' '));
11574
if (success) {
116-
console.log(chalk.green(`✓ Installed ${packagesToInstall.length} packages successfully`));
75+
console.log(chalk.green(`\n✓ Installed ${packagesToInstall.length} packages successfully`));
11776
} else {
118-
console.log(chalk.red('✗ Failed to install packages. Aborting installation.'));
77+
console.log(chalk.red('\n✗ Failed to install packages. Aborting installation.'));
11978
return;
12079
}
12180
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import chalk from 'chalk';
2+
import { checkStrapiProject } from '../utils/strapi';
3+
import { logger } from '../utils/logger';
4+
import { licenseSetup } from './subcommands/license-setup';
5+
6+
export async function setupLicense() {
7+
// Check if we're in a Strapi project
8+
const isStrapiProject = await checkStrapiProject();
9+
if (!isStrapiProject) {
10+
console.log(chalk.red('Error: This command must be run in a Strapi project directory.'));
11+
return;
12+
}
13+
14+
logger.title(
15+
'Webtools',
16+
`${chalk.bold('🚀 Let\'s build your new website with Strapi')}\n`,
17+
);
18+
19+
await licenseSetup();
20+
21+
console.log(chalk.green('\nLicense setup complete!'));
22+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { checkbox } from '@inquirer/prompts';
2+
import chalk from 'chalk';
3+
import { enableWebtoolsForContentType } from '../../utils/content-types';
4+
5+
export const enableContentTypes = async (contentTypes: string[]) => {
6+
if (contentTypes.length === 0) {
7+
console.log(chalk.yellow('No content types found in your Strapi project.'));
8+
return;
9+
}
10+
11+
// Let user select content types
12+
const selectedContentTypes = await checkbox({
13+
message: 'Select content types to enable Webtools for:',
14+
choices: contentTypes.map((type) => ({
15+
name: type,
16+
value: type,
17+
})),
18+
});
19+
20+
// Enable Webtools for selected content types
21+
if (selectedContentTypes.length > 0) {
22+
console.log(`\n${chalk.cyan('●')} Enabling Webtools for selected content types...`);
23+
24+
selectedContentTypes.map((contentType) => {
25+
const success = enableWebtoolsForContentType(contentType);
26+
if (success) {
27+
console.log(chalk.green(`✓ Enabled Webtools for ${contentType}`));
28+
return true;
29+
}
30+
31+
console.log(chalk.red(`✗ Failed to enable Webtools for ${contentType}`));
32+
return false;
33+
});
34+
} else {
35+
console.log(chalk.yellow('No content types selected. Nothing to do.'));
36+
}
37+
};

0 commit comments

Comments
 (0)