@strapi/generators 4.20.5 → 5.0.0-alpha.1

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.
@@ -9,7 +9,7 @@ const name = pluginPkg.strapi.name;
9
9
  export default {
10
10
  register(app) {
11
11
  app.addMenuLink({
12
- to: `/plugins/${pluginId}`,
12
+ to: `plugins/${pluginId}`,
13
13
  icon: PluginIcon,
14
14
  intlLabel: {
15
15
  id: `${pluginId}.plugin.name`,
@@ -15,8 +15,8 @@ const App = () => {
15
15
  return (
16
16
  <div>
17
17
  <Switch>
18
- <Route path={`/plugins/${pluginId}`} component={HomePage} exact />
19
- <Route component={AnErrorOccurred} />
18
+ <Route index element={<HomePage />} />
19
+ <Route path="*" element={<AnErrorOccurred />} />
20
20
  </Switch>
21
21
  </div>
22
22
  );
@@ -10,7 +10,7 @@ const name = pluginPkg.strapi.name;
10
10
  export default {
11
11
  register(app: any) {
12
12
  app.addMenuLink({
13
- to: `/plugins/${pluginId}`,
13
+ to: `plugins/${pluginId}`,
14
14
  icon: PluginIcon,
15
15
  intlLabel: {
16
16
  id: `${pluginId}.plugin.name`,
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
- import { Switch, Route } from 'react-router-dom';
9
+ import { Routes, Route } from 'react-router-dom';
10
10
  import { AnErrorOccurred } from '@strapi/helper-plugin';
11
11
  import pluginId from '../../pluginId';
12
12
  import HomePage from '../HomePage';
@@ -14,10 +14,10 @@ import HomePage from '../HomePage';
14
14
  const App = () => {
15
15
  return (
16
16
  <div>
17
- <Switch>
18
- <Route path={`/plugins/${pluginId}`} component={HomePage} exact />
19
- <Route component={AnErrorOccurred} />
20
- </Switch>
17
+ <Routes>
18
+ <Route index element={<HomePage />} />
19
+ <Route path="*" element={<AnErrorOccurred />} />
20
+ </Routes>
21
21
  </div>
22
22
  );
23
23
  };
package/dist/plopfile.js CHANGED
@@ -7,29 +7,10 @@ const slugify = require("@sindresorhus/slugify");
7
7
  const utils = require("@strapi/utils");
8
8
  const chalk = require("chalk");
9
9
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
- function _interopNamespace(e) {
11
- if (e && e.__esModule)
12
- return e;
13
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
14
- if (e) {
15
- for (const k in e) {
16
- if (k !== "default") {
17
- const d = Object.getOwnPropertyDescriptor(e, k);
18
- Object.defineProperty(n, k, d.get ? d : {
19
- enumerable: true,
20
- get: () => e[k]
21
- });
22
- }
23
- }
24
- }
25
- n.default = e;
26
- return Object.freeze(n);
27
- }
28
10
  const pluralize__default = /* @__PURE__ */ _interopDefault(pluralize);
29
11
  const fs__default = /* @__PURE__ */ _interopDefault(fs);
30
12
  const tsUtils__default = /* @__PURE__ */ _interopDefault(tsUtils);
31
13
  const slugify__default = /* @__PURE__ */ _interopDefault(slugify);
32
- const utils__namespace = /* @__PURE__ */ _interopNamespace(utils);
33
14
  const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
34
15
  const validateInput = (input) => {
35
16
  const regex = /^[A-Za-z-]+$/g;
@@ -211,7 +192,7 @@ const generateController = (plop) => {
211
192
  }
212
193
  });
213
194
  };
214
- const questions$3 = [
195
+ const questions$2 = [
215
196
  {
216
197
  type: "input",
217
198
  name: "displayName",
@@ -224,7 +205,7 @@ const questions$3 = [
224
205
  message: "Content type singular name",
225
206
  default: (answers) => slugify__default.default(answers.displayName),
226
207
  validate(input) {
227
- if (!utils__namespace.isKebabCase(input)) {
208
+ if (!utils.strings.isKebabCase(input)) {
228
209
  return "Value must be in kebab-case";
229
210
  }
230
211
  return true;
@@ -239,14 +220,14 @@ const questions$3 = [
239
220
  if (answers.singularName === input) {
240
221
  return "Singular and plural names cannot be the same";
241
222
  }
242
- if (!utils__namespace.isKebabCase(input)) {
223
+ if (!utils.strings.isKebabCase(input)) {
243
224
  return "Value must be in kebab-case";
244
225
  }
245
226
  return true;
246
227
  }
247
228
  }
248
229
  ];
249
- const questions$2 = [
230
+ const questions$1 = [
250
231
  {
251
232
  type: "list",
252
233
  name: "kind",
@@ -259,14 +240,6 @@ const questions$2 = [
259
240
  validate: (input) => validateInput(input)
260
241
  }
261
242
  ];
262
- const questions$1 = [
263
- {
264
- type: "confirm",
265
- name: "useDraftAndPublish",
266
- default: false,
267
- message: "Use draft and publish?"
268
- }
269
- ];
270
243
  const validateAttributeInput = (input) => {
271
244
  const regex = /^[A-Za-z-|_]+$/g;
272
245
  if (!input) {
@@ -370,11 +343,7 @@ const generateContentType = (plop) => {
370
343
  plop.setGenerator("content-type", {
371
344
  description: "Generate a content type for an API",
372
345
  async prompts(inquirer) {
373
- const config = await inquirer.prompt([
374
- ...questions$3,
375
- ...questions$2,
376
- ...questions$1
377
- ]);
346
+ const config = await inquirer.prompt([...questions$2, ...questions$1]);
378
347
  const attributes = await getAttributesPrompts(inquirer);
379
348
  const api = await inquirer.prompt([
380
349
  ...getDestinationPrompts("model", plop.getDestBasePath()),
@@ -385,7 +354,7 @@ const generateContentType = (plop) => {
385
354
  default: config.singularName,
386
355
  message: "Name of the new API?",
387
356
  async validate(input) {
388
- if (!utils__namespace.isKebabCase(input)) {
357
+ if (!utils.strings.isKebabCase(input)) {
389
358
  return "Value must be in kebab-case";
390
359
  }
391
360
  const apiPath = path.join(plop.getDestBasePath(), "api");
@@ -532,8 +501,8 @@ const generatePlugin = (plop) => {
532
501
  const isTypescript = answers.language === LANGUAGES.typescript;
533
502
  const language = isTypescript ? "ts" : "js";
534
503
  const projectLanguage = tsUtils__default.default.isUsingTypeScriptSync(process.cwd()) ? "ts" : "js";
535
- if (!utils__namespace.isKebabCase(answers.pluginName)) {
536
- answers.pluginName = utils__namespace.toKebabCase(answers.pluginName);
504
+ if (!utils.strings.isKebabCase(answers.pluginName)) {
505
+ answers.pluginName = utils.strings.toKebabCase(answers.pluginName);
537
506
  console.log(
538
507
  chalk__default.default.yellow(
539
508
  `Strapi only supports kebab-cased names for plugins.
@@ -1 +1 @@
1
- {"version":3,"file":"plopfile.js","sources":["../src/plops/utils/validate-input.ts","../src/plops/api.ts","../src/plops/prompts/get-destination-prompts.ts","../src/plops/utils/get-file-path.ts","../src/plops/controller.ts","../src/plops/prompts/ct-names-prompts.ts","../src/plops/prompts/kind-prompts.ts","../src/plops/prompts/draft-and-publish-prompts.ts","../src/plops/utils/validate-attribute-input.ts","../src/plops/prompts/get-attributes-prompts.ts","../src/plops/prompts/bootstrap-api-prompts.ts","../src/plops/content-type.ts","../src/plops/plugin.ts","../src/plops/policy.ts","../src/plops/middleware.ts","../src/plops/utils/validate-file-name-input.ts","../src/plops/utils/get-formatted-date.ts","../src/plops/migration.ts","../src/plops/service.ts","../src/plopfile.ts"],"sourcesContent":["export default (input: string) => {\n const regex = /^[A-Za-z-]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters, '-' and no spaces\";\n};\n","import { join } from 'path';\nimport { NodePlopAPI } from 'plop';\nimport fs from 'fs-extra';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport validateInput from './utils/validate-input';\n\nexport default (plop: NodePlopAPI) => {\n // API generator\n plop.setGenerator('api', {\n description: 'Generate a basic API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'API name',\n validate: (input) => validateInput(input),\n },\n {\n type: 'confirm',\n name: 'isPluginApi',\n message: 'Is this API for a plugin?',\n },\n {\n when: (answers) => answers.isPluginApi,\n type: 'list',\n name: 'plugin',\n message: 'Plugin name',\n async choices() {\n const pluginsPath = join(plop.getDestBasePath(), 'plugins');\n const exists = await fs.pathExists(pluginsPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find a \"plugins\" directory');\n }\n\n const pluginsDir = await fs.readdir(pluginsPath, { withFileTypes: true });\n const pluginsDirContent = pluginsDir.filter((fd) => fd.isDirectory());\n\n if (pluginsDirContent.length === 0) {\n throw Error('The \"plugins\" directory is empty');\n }\n\n return pluginsDirContent;\n },\n },\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath =\n answers.isPluginApi && answers.plugin ? 'plugins/{{ plugin }}' : 'api/{{ id }}';\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n const baseActions = [\n {\n type: 'add',\n path: `${filePath}/controllers/{{ id }}.${language}`,\n templateFile: `templates/${language}/controller.${language}.hbs`,\n },\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n\n if (answers.isPluginApi) {\n return baseActions;\n }\n\n return [\n {\n type: 'add',\n path: `${filePath}/routes/{{ id }}.${language}`,\n templateFile: `templates/${language}/single-route.${language}.hbs`,\n },\n ...baseActions,\n ];\n },\n });\n};\n","import { join } from 'path';\nimport fs from 'fs-extra';\n\nimport type { PromptQuestion } from 'node-plop';\n\nexport default (\n action: string,\n basePath: string,\n { rootFolder = false } = {}\n): Array<PromptQuestion> => {\n return [\n {\n type: 'list',\n name: 'destination',\n message: `Where do you want to add this ${action}?`,\n choices: [\n ...(rootFolder\n ? [\n {\n name: `Add ${action} to root of project`,\n value: 'root',\n },\n ]\n : [\n {\n name: `Add ${action} to new API`,\n value: 'new',\n },\n ]),\n { name: `Add ${action} to an existing API`, value: 'api' },\n { name: `Add ${action} to an existing plugin`, value: 'plugin' },\n ],\n },\n {\n when: (answers) => answers.destination === 'api',\n type: 'list',\n message: 'Which API is this for?',\n name: 'api',\n async choices() {\n const apiPath = join(basePath, 'api');\n const exists = await fs.pathExists(apiPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find an \"api\" directory');\n }\n\n const apiDir = await fs.readdir(apiPath, { withFileTypes: true });\n const apiDirContent = apiDir.filter((fd) => fd.isDirectory());\n\n if (apiDirContent.length === 0) {\n throw Error('The \"api\" directory is empty');\n }\n\n return apiDirContent;\n },\n },\n {\n when: (answers) => answers.destination === 'plugin',\n type: 'list',\n message: 'Which plugin is this for?',\n name: 'plugin',\n async choices() {\n const pluginsPath = join(basePath, 'plugins');\n const exists = await fs.pathExists(pluginsPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find a \"plugins\" directory');\n }\n\n const pluginsDir = await fs.readdir(pluginsPath);\n const pluginsDirContent = pluginsDir.filter((api) =>\n fs.lstatSync(join(pluginsPath, api)).isDirectory()\n );\n\n if (pluginsDirContent.length === 0) {\n throw Error('The \"plugins\" directory is empty');\n }\n\n return pluginsDirContent;\n },\n },\n ];\n};\n","export default (destination: string) => {\n if (destination === 'api') {\n return `api/{{ api }}`;\n }\n\n if (destination === 'plugin') {\n return `plugins/{{ plugin }}/server`;\n }\n\n if (destination === 'root') {\n return './';\n }\n\n return `api/{{ id }}`;\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport validateInput from './utils/validate-input';\n\nexport default (plop: NodePlopAPI) => {\n // Controller generator\n plop.setGenerator('controller', {\n description: 'Generate a controller for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Controller name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('controller', plop.getDestBasePath()),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/controllers/{{ id }}.${language}`,\n templateFile: `templates/${language}/controller.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport * as utils from '@strapi/utils';\n\nimport type { PromptQuestion } from 'node-plop';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'input',\n name: 'displayName',\n message: 'Content type display name',\n validate: (input: string) => !!input,\n },\n {\n type: 'input',\n name: 'singularName',\n message: 'Content type singular name',\n default: (answers: Answers) => slugify(answers.displayName),\n validate(input) {\n if (!utils.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n {\n type: 'input',\n name: 'pluralName',\n message: 'Content type plural name',\n default: (answers: Answers) => pluralize(answers.singularName),\n validate(input: string, answers: Answers) {\n if (answers.singularName === input) {\n return 'Singular and plural names cannot be the same';\n }\n\n if (!utils.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n];\n\nexport default questions;\n","import type { PromptQuestion } from 'node-plop';\n\nimport validateInput from '../utils/validate-input';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'list',\n name: 'kind',\n message: 'Please choose the model type',\n default: 'collectionType',\n choices: [\n { name: 'Collection Type', value: 'collectionType' },\n { name: 'Single Type', value: 'singleType' },\n ],\n validate: (input: string) => validateInput(input),\n },\n];\n\nexport default questions;\n","import type { PromptQuestion } from 'node-plop';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'confirm',\n name: 'useDraftAndPublish',\n default: false,\n message: 'Use draft and publish?',\n },\n];\n\nexport default questions;\n","export default (input: string) => {\n const regex = /^[A-Za-z-|_]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters, '-', '_', and no spaces\";\n};\n","import type { DynamicPromptsFunction } from 'node-plop';\n\nimport validateAttributeInput from '../utils/validate-attribute-input';\n\ninterface AttributeAnswer {\n attributeName: string;\n attributeType: typeof DEFAULT_TYPES;\n enum?: string;\n multiple?: boolean;\n}\n\nconst DEFAULT_TYPES = [\n // advanced types\n 'media',\n\n // scalar types\n 'string',\n 'text',\n 'richtext',\n 'json',\n 'enumeration',\n 'password',\n 'email',\n 'integer',\n 'biginteger',\n 'float',\n 'decimal',\n 'date',\n 'time',\n 'datetime',\n 'timestamp',\n 'boolean',\n] as const;\n\nconst getAttributesPrompts: DynamicPromptsFunction = async (inquirer) => {\n const { addAttributes } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add attributes?',\n },\n ]);\n\n const attributes: Array<AttributeAnswer> = [];\n\n /**\n * @param {import('inquirer').Inquirer} inquirer\n * @returns {Promise<void>}\n */\n const createNewAttributes = async (inquirer: Parameters<DynamicPromptsFunction>[0]) => {\n const answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'attributeName',\n message: 'Name of attribute',\n validate: (input: string) => validateAttributeInput(input),\n },\n {\n type: 'list',\n name: 'attributeType',\n message: 'What type of attribute',\n pageSize: DEFAULT_TYPES.length,\n choices: DEFAULT_TYPES.map((type) => {\n return { name: type, value: type };\n }),\n },\n {\n when: (answers) => answers.attributeType === 'enumeration',\n type: 'input',\n name: 'enum',\n message: 'Add values separated by a comma',\n },\n {\n when: (answers) => answers.attributeType === 'media',\n type: 'list',\n name: 'multiple',\n message: 'Choose media type',\n choices: [\n { name: 'Multiple', value: true },\n { name: 'Single', value: false },\n ],\n },\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add another attribute?',\n },\n ]);\n\n attributes.push(answers);\n\n if (!answers.addAttributes) {\n return;\n }\n\n await createNewAttributes(inquirer);\n };\n\n if (addAttributes) {\n await createNewAttributes(inquirer);\n } else {\n console.warn(\n `You won't be able to manage entries from the admin, you can still add attributes later from the content type builder.`\n );\n }\n\n return attributes;\n};\n\nexport default getAttributesPrompts;\n","import type { PromptQuestion } from 'node-plop';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n","import { join } from 'path';\nimport { NodePlopAPI, ActionType } from 'plop';\nimport slugify from '@sindresorhus/slugify';\nimport fs from 'fs-extra';\nimport * as utils from '@strapi/utils';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport ctNamesPrompts from './prompts/ct-names-prompts';\nimport kindPrompts from './prompts/kind-prompts';\nimport draftAndPublishPrompts from './prompts/draft-and-publish-prompts';\nimport getAttributesPrompts from './prompts/get-attributes-prompts';\nimport bootstrapApiPrompts from './prompts/bootstrap-api-prompts';\n\nexport default (plop: NodePlopAPI) => {\n // Model generator\n plop.setGenerator('content-type', {\n description: 'Generate a content type for an API',\n async prompts(inquirer) {\n const config = await inquirer.prompt([\n ...ctNamesPrompts,\n ...kindPrompts,\n ...draftAndPublishPrompts,\n ]);\n const attributes = await getAttributesPrompts(inquirer);\n\n const api = await inquirer.prompt([\n ...getDestinationPrompts('model', plop.getDestBasePath()),\n {\n when: (answers) => answers.destination === 'new',\n type: 'input',\n name: 'id',\n default: config.singularName,\n message: 'Name of the new API?',\n async validate(input) {\n if (!utils.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n const apiPath = join(plop.getDestBasePath(), 'api');\n const exists = await fs.pathExists(apiPath);\n\n if (!exists) {\n return true;\n }\n\n const apiDir = await fs.readdir(apiPath, { withFileTypes: true });\n const apiDirContent = apiDir.filter((fd) => fd.isDirectory());\n\n if (apiDirContent.findIndex((dir) => dir.name === input) !== -1) {\n throw new Error('This name is already taken.');\n }\n\n return true;\n },\n },\n ...bootstrapApiPrompts,\n ]);\n\n return {\n ...config,\n ...api,\n attributes,\n };\n },\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const attributes = answers.attributes.reduce((object: any, answer: any) => {\n const val: any = { type: answer.attributeType };\n\n if (answer.attributeType === 'enumeration') {\n val.enum = answer.enum.split(',').map((item: string) => item.trim());\n }\n\n if (answer.attributeType === 'media') {\n val.allowedTypes = ['images', 'files', 'videos', 'audios'];\n val.multiple = answer.multiple;\n }\n\n return Object.assign(object, { [answer.attributeName]: val }, {});\n }, {});\n\n const filePath = getFilePath(answers.destination);\n // TODO: use basePath instead\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/content-types/{{ singularName }}/schema.json`,\n templateFile: `templates/${language}/content-type.schema.json.hbs`,\n data: {\n collectionName: slugify(answers.pluralName, { separator: '_' }),\n },\n },\n ];\n\n if (Object.entries(attributes).length > 0) {\n baseActions.push({\n type: 'modify',\n path: `${filePath}/content-types/{{ singularName }}/schema.json`,\n transform(template: string) {\n const parsedTemplate = JSON.parse(template);\n parsedTemplate.attributes = attributes;\n return JSON.stringify(parsedTemplate, null, 2);\n },\n });\n }\n\n if (answers.bootstrapApi) {\n const { singularName } = answers;\n\n let uid;\n if (answers.destination === 'new') {\n uid = `api::${answers.id}.${singularName}`;\n } else if (answers.api) {\n uid = `api::${answers.api}.${singularName}`;\n } else if (answers.plugin) {\n uid = `plugin::${answers.plugin}.${singularName}`;\n }\n\n baseActions.push(\n {\n type: 'add',\n path: `${filePath}/controllers/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-controller.${language}.hbs`,\n data: { uid },\n },\n {\n type: 'add',\n path: `${filePath}/services/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-service.${language}.hbs`,\n data: { uid },\n },\n {\n type: 'add',\n path: `${filePath}/routes/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-router.${language}.hbs`,\n data: { uid },\n }\n );\n }\n\n return baseActions;\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport chalk from 'chalk';\nimport tsUtils from '@strapi/typescript-utils';\nimport * as utils from '@strapi/utils';\n\nimport validateInput from './utils/validate-input';\n\nconst LANGUAGES = {\n javascript: 'JavaScript',\n typescript: 'TypeScript',\n};\n\nconst logInstructions = (pluginName: string, { language }: { language: string }) => {\n const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;\n const separator = Array(maxLength).fill('─').join('');\n\n const exportInstruction = language === 'js' ? 'module.exports =' : 'export default';\n\n return `\nYou can now enable your plugin by adding the following in ${chalk.yellow(\n `./config/plugins.${language}`\n )}\n${separator}\n${exportInstruction} {\n ${chalk.gray('// ...')}\n ${chalk.green(`'${pluginName}'`)}: {\n enabled: ${chalk.yellow(true)},\n resolve: ${chalk.yellow(`'./src/plugins/${pluginName}'`)}\n },\n ${chalk.gray('// ...')}\n}\n${separator}\n`;\n};\n\nexport default (plop: NodePlopAPI) => {\n // Plugin generator\n plop.setGenerator('plugin', {\n description: 'Generate a basic plugin',\n prompts: [\n {\n type: 'input',\n name: 'pluginName',\n message: 'Plugin name',\n validate: (input) => validateInput(input),\n },\n {\n type: 'list',\n name: 'language',\n message: 'Choose your preferred language',\n choices: Object.values(LANGUAGES),\n default: LANGUAGES.javascript,\n },\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const isTypescript = answers.language === LANGUAGES.typescript;\n const language = isTypescript ? 'ts' : 'js';\n const projectLanguage = tsUtils.isUsingTypeScriptSync(process.cwd()) ? 'ts' : 'js';\n\n if (!utils.isKebabCase(answers.pluginName)) {\n answers.pluginName = utils.toKebabCase(answers.pluginName);\n console.log(\n chalk.yellow(\n `Strapi only supports kebab-cased names for plugins.\\nYour plugin has been automatically renamed to \"${answers.pluginName}\".`\n )\n );\n }\n\n return [\n {\n type: 'addMany',\n destination: 'plugins/{{ pluginName }}',\n base: `files/${language}/plugin`,\n templateFiles: `files/${language}/plugin/**`,\n },\n {\n type: 'add',\n path: 'plugins/{{ pluginName }}/README.md',\n templateFile: `templates/${language}/README.md.hbs`,\n },\n {\n type: 'add',\n path: 'plugins/{{ pluginName }}/package.json',\n templateFile: `templates/${language}/plugin-package.json.hbs`,\n },\n () =>\n plop.renderString(\n logInstructions(answers.pluginName, { language: projectLanguage }),\n null\n ),\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // Policy generator\n plop.setGenerator('policy', {\n description: 'Generate a policy for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Policy name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('policy', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // middleware generator\n plop.setGenerator('middleware', {\n description: 'Generate a middleware for an API',\n prompts: [\n {\n type: 'input',\n name: 'name',\n message: 'Middleware name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('middleware', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/middlewares/{{ name }}.${language}`,\n templateFile: `templates/${language}/middleware.${language}.hbs`,\n },\n ];\n },\n });\n};\n","export default (input: string) => {\n const regex = /^[A-Za-z-_0-9]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters and number, '-' or '_' and no spaces\";\n};\n","export default (date: Date = new Date()) => {\n return new Date(date.getTime() - date.getTimezoneOffset() * 60000)\n .toJSON()\n .replace(/[-:]/g, '.')\n .replace(/\\....Z/, '');\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport validateFileNameInput from './utils/validate-file-name-input';\nimport getFormattedDate from './utils/get-formatted-date';\n\nexport default (plop: NodePlopAPI) => {\n // Migration generator\n plop.setGenerator('migration', {\n description: 'Generate a migration',\n prompts: [\n {\n type: 'input',\n name: 'name',\n message: 'Migration name',\n validate: (input) => validateFileNameInput(input),\n },\n ],\n actions() {\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n const timestamp = getFormattedDate();\n\n return [\n {\n type: 'add',\n path: `${currentDir}/database/migrations/${timestamp}.{{ name }}.${language}`,\n templateFile: `templates/${language}/migration.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // Service generator\n plop.setGenerator('service', {\n description: 'Generate a service for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Service name',\n },\n ...getDestinationPrompts('service', plop.getDestBasePath()),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers?.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import pluralize from 'pluralize';\nimport { NodePlopAPI } from 'plop';\n\nimport generateApi from './plops/api';\nimport generateController from './plops/controller';\nimport generateContentType from './plops/content-type';\nimport generatePlugin from './plops/plugin';\nimport generatePolicy from './plops/policy';\nimport generateMiddleware from './plops/middleware';\nimport generateMigration from './plops/migration';\nimport generateService from './plops/service';\n\nexport default (plop: NodePlopAPI) => {\n // Plop config\n plop.setWelcomeMessage('Strapi Generators');\n plop.addHelper('pluralize', (text: string) => pluralize(text));\n\n // Generators\n generateApi(plop);\n generateController(plop);\n generateContentType(plop);\n generatePlugin(plop);\n generatePolicy(plop);\n generateMiddleware(plop);\n generateMigration(plop);\n generateService(plop);\n};\n"],"names":["join","fs","tsUtils","questions","slugify","utils","pluralize","inquirer","answers","ctNamesPrompts","kindPrompts","draftAndPublishPrompts","bootstrapApiPrompts","chalk"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAe,gBAAA,CAAC,UAAkB;AAChC,QAAM,QAAQ;AAEd,MAAI,CAAC,OAAO;AACH,WAAA;AAAA,EACT;AAEO,SAAA,MAAM,KAAK,KAAK,KAAK;AAC9B;ACDA,MAAe,cAAA,CAAC,SAAsB;AAEpC,OAAK,aAAa,OAAO;AAAA,IACvB,aAAa;AAAA,IACb,SAAS;AAAA,MACP;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,MAC1C;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA;AAAA,QACE,MAAM,CAAC,YAAY,QAAQ;AAAA,QAC3B,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,MAAM,UAAU;AACd,gBAAM,cAAcA,KAAAA,KAAK,KAAK,mBAAmB,SAAS;AAC1D,gBAAM,SAAS,MAAMC,YAAAA,QAAG,WAAW,WAAW;AAE9C,cAAI,CAAC,QAAQ;AACX,kBAAM,MAAM,qCAAsC;AAAA,UACpD;AAEM,gBAAA,aAAa,MAAMA,YAAAA,QAAG,QAAQ,aAAa,EAAE,eAAe,MAAM;AACxE,gBAAM,oBAAoB,WAAW,OAAO,CAAC,OAAO,GAAG,aAAa;AAEhE,cAAA,kBAAkB,WAAW,GAAG;AAClC,kBAAM,MAAM,kCAAkC;AAAA,UAChD;AAEO,iBAAA;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,IACA,QAAQ,SAAS;AACf,UAAI,CAAC,SAAS;AACZ,eAAO;MACT;AAEA,YAAM,WACJ,QAAQ,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,SAAS,WAAW;AAC3C,YAAA,aAAa,QAAQ;AAC3B,YAAM,WAAWA,iBAAAA,QAAQ,sBAAsB,UAAU,IAAI,OAAO;AAE7D,aAAA;AAAA,QACL;AAAA,UACE,MAAM;AAAA,UACN,MAAM,GAAG,QAAQ,sBAAsB,QAAQ;AAAA,UAC/C,cAAc,aAAa,QAAQ,YAAY,QAAQ;AAAA,QACzD;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA,CACD;AACH;ACxBA,MAAe,WAAA,CAAC,SAAsB;AAEpC,OAAK,kBAAkB,mBAAmB;AAC1C,OAAK,UAAU,aAAa,CAAC,SAAiBI,mBAAA,QAAU,IAAI,CAAC;AAG7D,cAAY,IAAI;AAChB,qBAAmB,IAAI;AACvB,sBAAoB,IAAI;AACxB,iBAAe,IAAI;AACnB,iBAAe,IAAI;AACnB,qBAAmB,IAAI;AACvB,oBAAkB,IAAI;AACtB,kBAAgB,IAAI;AACtB;;"}
1
+ {"version":3,"file":"plopfile.js","sources":["../src/plops/utils/validate-input.ts","../src/plops/api.ts","../src/plops/prompts/get-destination-prompts.ts","../src/plops/utils/get-file-path.ts","../src/plops/controller.ts","../src/plops/prompts/ct-names-prompts.ts","../src/plops/prompts/kind-prompts.ts","../src/plops/utils/validate-attribute-input.ts","../src/plops/prompts/get-attributes-prompts.ts","../src/plops/prompts/bootstrap-api-prompts.ts","../src/plops/content-type.ts","../src/plops/plugin.ts","../src/plops/policy.ts","../src/plops/middleware.ts","../src/plops/utils/validate-file-name-input.ts","../src/plops/utils/get-formatted-date.ts","../src/plops/migration.ts","../src/plops/service.ts","../src/plopfile.ts"],"sourcesContent":["export default (input: string) => {\n const regex = /^[A-Za-z-]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters, '-' and no spaces\";\n};\n","import { join } from 'path';\nimport { NodePlopAPI } from 'plop';\nimport fs from 'fs-extra';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport validateInput from './utils/validate-input';\n\nexport default (plop: NodePlopAPI) => {\n // API generator\n plop.setGenerator('api', {\n description: 'Generate a basic API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'API name',\n validate: (input) => validateInput(input),\n },\n {\n type: 'confirm',\n name: 'isPluginApi',\n message: 'Is this API for a plugin?',\n },\n {\n when: (answers) => answers.isPluginApi,\n type: 'list',\n name: 'plugin',\n message: 'Plugin name',\n async choices() {\n const pluginsPath = join(plop.getDestBasePath(), 'plugins');\n const exists = await fs.pathExists(pluginsPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find a \"plugins\" directory');\n }\n\n const pluginsDir = await fs.readdir(pluginsPath, { withFileTypes: true });\n const pluginsDirContent = pluginsDir.filter((fd) => fd.isDirectory());\n\n if (pluginsDirContent.length === 0) {\n throw Error('The \"plugins\" directory is empty');\n }\n\n return pluginsDirContent;\n },\n },\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath =\n answers.isPluginApi && answers.plugin ? 'plugins/{{ plugin }}' : 'api/{{ id }}';\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n const baseActions = [\n {\n type: 'add',\n path: `${filePath}/controllers/{{ id }}.${language}`,\n templateFile: `templates/${language}/controller.${language}.hbs`,\n },\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n\n if (answers.isPluginApi) {\n return baseActions;\n }\n\n return [\n {\n type: 'add',\n path: `${filePath}/routes/{{ id }}.${language}`,\n templateFile: `templates/${language}/single-route.${language}.hbs`,\n },\n ...baseActions,\n ];\n },\n });\n};\n","import { join } from 'path';\nimport fs from 'fs-extra';\n\nimport type { PromptQuestion } from 'node-plop';\n\nexport default (\n action: string,\n basePath: string,\n { rootFolder = false } = {}\n): Array<PromptQuestion> => {\n return [\n {\n type: 'list',\n name: 'destination',\n message: `Where do you want to add this ${action}?`,\n choices: [\n ...(rootFolder\n ? [\n {\n name: `Add ${action} to root of project`,\n value: 'root',\n },\n ]\n : [\n {\n name: `Add ${action} to new API`,\n value: 'new',\n },\n ]),\n { name: `Add ${action} to an existing API`, value: 'api' },\n { name: `Add ${action} to an existing plugin`, value: 'plugin' },\n ],\n },\n {\n when: (answers) => answers.destination === 'api',\n type: 'list',\n message: 'Which API is this for?',\n name: 'api',\n async choices() {\n const apiPath = join(basePath, 'api');\n const exists = await fs.pathExists(apiPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find an \"api\" directory');\n }\n\n const apiDir = await fs.readdir(apiPath, { withFileTypes: true });\n const apiDirContent = apiDir.filter((fd) => fd.isDirectory());\n\n if (apiDirContent.length === 0) {\n throw Error('The \"api\" directory is empty');\n }\n\n return apiDirContent;\n },\n },\n {\n when: (answers) => answers.destination === 'plugin',\n type: 'list',\n message: 'Which plugin is this for?',\n name: 'plugin',\n async choices() {\n const pluginsPath = join(basePath, 'plugins');\n const exists = await fs.pathExists(pluginsPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find a \"plugins\" directory');\n }\n\n const pluginsDir = await fs.readdir(pluginsPath);\n const pluginsDirContent = pluginsDir.filter((api) =>\n fs.lstatSync(join(pluginsPath, api)).isDirectory()\n );\n\n if (pluginsDirContent.length === 0) {\n throw Error('The \"plugins\" directory is empty');\n }\n\n return pluginsDirContent;\n },\n },\n ];\n};\n","export default (destination: string) => {\n if (destination === 'api') {\n return `api/{{ api }}`;\n }\n\n if (destination === 'plugin') {\n return `plugins/{{ plugin }}/server`;\n }\n\n if (destination === 'root') {\n return './';\n }\n\n return `api/{{ id }}`;\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport validateInput from './utils/validate-input';\n\nexport default (plop: NodePlopAPI) => {\n // Controller generator\n plop.setGenerator('controller', {\n description: 'Generate a controller for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Controller name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('controller', plop.getDestBasePath()),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/controllers/{{ id }}.${language}`,\n templateFile: `templates/${language}/controller.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport { strings } from '@strapi/utils';\n\nimport type { PromptQuestion } from 'node-plop';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'input',\n name: 'displayName',\n message: 'Content type display name',\n validate: (input: string) => !!input,\n },\n {\n type: 'input',\n name: 'singularName',\n message: 'Content type singular name',\n default: (answers: Answers) => slugify(answers.displayName),\n validate(input) {\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n {\n type: 'input',\n name: 'pluralName',\n message: 'Content type plural name',\n default: (answers: Answers) => pluralize(answers.singularName),\n validate(input: string, answers: Answers) {\n if (answers.singularName === input) {\n return 'Singular and plural names cannot be the same';\n }\n\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n];\n\nexport default questions;\n","import type { PromptQuestion } from 'node-plop';\n\nimport validateInput from '../utils/validate-input';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'list',\n name: 'kind',\n message: 'Please choose the model type',\n default: 'collectionType',\n choices: [\n { name: 'Collection Type', value: 'collectionType' },\n { name: 'Single Type', value: 'singleType' },\n ],\n validate: (input: string) => validateInput(input),\n },\n];\n\nexport default questions;\n","export default (input: string) => {\n const regex = /^[A-Za-z-|_]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters, '-', '_', and no spaces\";\n};\n","import type { DynamicPromptsFunction } from 'node-plop';\n\nimport validateAttributeInput from '../utils/validate-attribute-input';\n\ninterface AttributeAnswer {\n attributeName: string;\n attributeType: typeof DEFAULT_TYPES;\n enum?: string;\n multiple?: boolean;\n}\n\nconst DEFAULT_TYPES = [\n // advanced types\n 'media',\n\n // scalar types\n 'string',\n 'text',\n 'richtext',\n 'json',\n 'enumeration',\n 'password',\n 'email',\n 'integer',\n 'biginteger',\n 'float',\n 'decimal',\n 'date',\n 'time',\n 'datetime',\n 'timestamp',\n 'boolean',\n] as const;\n\nconst getAttributesPrompts: DynamicPromptsFunction = async (inquirer) => {\n const { addAttributes } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add attributes?',\n },\n ]);\n\n const attributes: Array<AttributeAnswer> = [];\n\n /**\n * @param {import('inquirer').Inquirer} inquirer\n * @returns {Promise<void>}\n */\n const createNewAttributes = async (inquirer: Parameters<DynamicPromptsFunction>[0]) => {\n const answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'attributeName',\n message: 'Name of attribute',\n validate: (input: string) => validateAttributeInput(input),\n },\n {\n type: 'list',\n name: 'attributeType',\n message: 'What type of attribute',\n pageSize: DEFAULT_TYPES.length,\n choices: DEFAULT_TYPES.map((type) => {\n return { name: type, value: type };\n }),\n },\n {\n when: (answers) => answers.attributeType === 'enumeration',\n type: 'input',\n name: 'enum',\n message: 'Add values separated by a comma',\n },\n {\n when: (answers) => answers.attributeType === 'media',\n type: 'list',\n name: 'multiple',\n message: 'Choose media type',\n choices: [\n { name: 'Multiple', value: true },\n { name: 'Single', value: false },\n ],\n },\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add another attribute?',\n },\n ]);\n\n attributes.push(answers);\n\n if (!answers.addAttributes) {\n return;\n }\n\n await createNewAttributes(inquirer);\n };\n\n if (addAttributes) {\n await createNewAttributes(inquirer);\n } else {\n console.warn(\n `You won't be able to manage entries from the admin, you can still add attributes later from the content type builder.`\n );\n }\n\n return attributes;\n};\n\nexport default getAttributesPrompts;\n","import type { PromptQuestion } from 'node-plop';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n","import { join } from 'path';\nimport { NodePlopAPI, ActionType } from 'plop';\nimport slugify from '@sindresorhus/slugify';\nimport fs from 'fs-extra';\nimport { strings } from '@strapi/utils';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport ctNamesPrompts from './prompts/ct-names-prompts';\nimport kindPrompts from './prompts/kind-prompts';\nimport getAttributesPrompts from './prompts/get-attributes-prompts';\nimport bootstrapApiPrompts from './prompts/bootstrap-api-prompts';\n\nexport default (plop: NodePlopAPI) => {\n // Model generator\n plop.setGenerator('content-type', {\n description: 'Generate a content type for an API',\n async prompts(inquirer) {\n const config = await inquirer.prompt([...ctNamesPrompts, ...kindPrompts]);\n const attributes = await getAttributesPrompts(inquirer);\n\n const api = await inquirer.prompt([\n ...getDestinationPrompts('model', plop.getDestBasePath()),\n {\n when: (answers) => answers.destination === 'new',\n type: 'input',\n name: 'id',\n default: config.singularName,\n message: 'Name of the new API?',\n async validate(input) {\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n const apiPath = join(plop.getDestBasePath(), 'api');\n const exists = await fs.pathExists(apiPath);\n\n if (!exists) {\n return true;\n }\n\n const apiDir = await fs.readdir(apiPath, { withFileTypes: true });\n const apiDirContent = apiDir.filter((fd) => fd.isDirectory());\n\n if (apiDirContent.findIndex((dir) => dir.name === input) !== -1) {\n throw new Error('This name is already taken.');\n }\n\n return true;\n },\n },\n ...bootstrapApiPrompts,\n ]);\n\n return {\n ...config,\n ...api,\n attributes,\n };\n },\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const attributes = answers.attributes.reduce((object: any, answer: any) => {\n const val: any = { type: answer.attributeType };\n\n if (answer.attributeType === 'enumeration') {\n val.enum = answer.enum.split(',').map((item: string) => item.trim());\n }\n\n if (answer.attributeType === 'media') {\n val.allowedTypes = ['images', 'files', 'videos', 'audios'];\n val.multiple = answer.multiple;\n }\n\n return Object.assign(object, { [answer.attributeName]: val }, {});\n }, {});\n\n const filePath = getFilePath(answers.destination);\n // TODO: use basePath instead\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/content-types/{{ singularName }}/schema.json`,\n templateFile: `templates/${language}/content-type.schema.json.hbs`,\n data: {\n collectionName: slugify(answers.pluralName, { separator: '_' }),\n },\n },\n ];\n\n if (Object.entries(attributes).length > 0) {\n baseActions.push({\n type: 'modify',\n path: `${filePath}/content-types/{{ singularName }}/schema.json`,\n transform(template: string) {\n const parsedTemplate = JSON.parse(template);\n parsedTemplate.attributes = attributes;\n return JSON.stringify(parsedTemplate, null, 2);\n },\n });\n }\n\n if (answers.bootstrapApi) {\n const { singularName } = answers;\n\n let uid;\n if (answers.destination === 'new') {\n uid = `api::${answers.id}.${singularName}`;\n } else if (answers.api) {\n uid = `api::${answers.api}.${singularName}`;\n } else if (answers.plugin) {\n uid = `plugin::${answers.plugin}.${singularName}`;\n }\n\n baseActions.push(\n {\n type: 'add',\n path: `${filePath}/controllers/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-controller.${language}.hbs`,\n data: { uid },\n },\n {\n type: 'add',\n path: `${filePath}/services/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-service.${language}.hbs`,\n data: { uid },\n },\n {\n type: 'add',\n path: `${filePath}/routes/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-router.${language}.hbs`,\n data: { uid },\n }\n );\n }\n\n return baseActions;\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport chalk from 'chalk';\nimport tsUtils from '@strapi/typescript-utils';\nimport { strings } from '@strapi/utils';\n\nimport validateInput from './utils/validate-input';\n\nconst LANGUAGES = {\n javascript: 'JavaScript',\n typescript: 'TypeScript',\n};\n\nconst logInstructions = (pluginName: string, { language }: { language: string }) => {\n const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;\n const separator = Array(maxLength).fill('─').join('');\n\n const exportInstruction = language === 'js' ? 'module.exports =' : 'export default';\n\n return `\nYou can now enable your plugin by adding the following in ${chalk.yellow(\n `./config/plugins.${language}`\n )}\n${separator}\n${exportInstruction} {\n ${chalk.gray('// ...')}\n ${chalk.green(`'${pluginName}'`)}: {\n enabled: ${chalk.yellow(true)},\n resolve: ${chalk.yellow(`'./src/plugins/${pluginName}'`)}\n },\n ${chalk.gray('// ...')}\n}\n${separator}\n`;\n};\n\nexport default (plop: NodePlopAPI) => {\n // Plugin generator\n plop.setGenerator('plugin', {\n description: 'Generate a basic plugin',\n prompts: [\n {\n type: 'input',\n name: 'pluginName',\n message: 'Plugin name',\n validate: (input) => validateInput(input),\n },\n {\n type: 'list',\n name: 'language',\n message: 'Choose your preferred language',\n choices: Object.values(LANGUAGES),\n default: LANGUAGES.javascript,\n },\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const isTypescript = answers.language === LANGUAGES.typescript;\n const language = isTypescript ? 'ts' : 'js';\n const projectLanguage = tsUtils.isUsingTypeScriptSync(process.cwd()) ? 'ts' : 'js';\n\n if (!strings.isKebabCase(answers.pluginName)) {\n answers.pluginName = strings.toKebabCase(answers.pluginName);\n console.log(\n chalk.yellow(\n `Strapi only supports kebab-cased names for plugins.\\nYour plugin has been automatically renamed to \"${answers.pluginName}\".`\n )\n );\n }\n\n return [\n {\n type: 'addMany',\n destination: 'plugins/{{ pluginName }}',\n base: `files/${language}/plugin`,\n templateFiles: `files/${language}/plugin/**`,\n },\n {\n type: 'add',\n path: 'plugins/{{ pluginName }}/README.md',\n templateFile: `templates/${language}/README.md.hbs`,\n },\n {\n type: 'add',\n path: 'plugins/{{ pluginName }}/package.json',\n templateFile: `templates/${language}/plugin-package.json.hbs`,\n },\n () =>\n plop.renderString(\n logInstructions(answers.pluginName, { language: projectLanguage }),\n null\n ),\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // Policy generator\n plop.setGenerator('policy', {\n description: 'Generate a policy for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Policy name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('policy', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // middleware generator\n plop.setGenerator('middleware', {\n description: 'Generate a middleware for an API',\n prompts: [\n {\n type: 'input',\n name: 'name',\n message: 'Middleware name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('middleware', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/middlewares/{{ name }}.${language}`,\n templateFile: `templates/${language}/middleware.${language}.hbs`,\n },\n ];\n },\n });\n};\n","export default (input: string) => {\n const regex = /^[A-Za-z-_0-9]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters and number, '-' or '_' and no spaces\";\n};\n","export default (date: Date = new Date()) => {\n return new Date(date.getTime() - date.getTimezoneOffset() * 60000)\n .toJSON()\n .replace(/[-:]/g, '.')\n .replace(/\\....Z/, '');\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport validateFileNameInput from './utils/validate-file-name-input';\nimport getFormattedDate from './utils/get-formatted-date';\n\nexport default (plop: NodePlopAPI) => {\n // Migration generator\n plop.setGenerator('migration', {\n description: 'Generate a migration',\n prompts: [\n {\n type: 'input',\n name: 'name',\n message: 'Migration name',\n validate: (input) => validateFileNameInput(input),\n },\n ],\n actions() {\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n const timestamp = getFormattedDate();\n\n return [\n {\n type: 'add',\n path: `${currentDir}/database/migrations/${timestamp}.{{ name }}.${language}`,\n templateFile: `templates/${language}/migration.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // Service generator\n plop.setGenerator('service', {\n description: 'Generate a service for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Service name',\n },\n ...getDestinationPrompts('service', plop.getDestBasePath()),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers?.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import pluralize from 'pluralize';\nimport { NodePlopAPI } from 'plop';\n\nimport generateApi from './plops/api';\nimport generateController from './plops/controller';\nimport generateContentType from './plops/content-type';\nimport generatePlugin from './plops/plugin';\nimport generatePolicy from './plops/policy';\nimport generateMiddleware from './plops/middleware';\nimport generateMigration from './plops/migration';\nimport generateService from './plops/service';\n\nexport default (plop: NodePlopAPI) => {\n // Plop config\n plop.setWelcomeMessage('Strapi Generators');\n plop.addHelper('pluralize', (text: string) => pluralize(text));\n\n // Generators\n generateApi(plop);\n generateController(plop);\n generateContentType(plop);\n generatePlugin(plop);\n generatePolicy(plop);\n generateMiddleware(plop);\n generateMigration(plop);\n generateService(plop);\n};\n"],"names":["join","fs","tsUtils","questions","slugify","strings","pluralize","inquirer","answers","ctNamesPrompts","kindPrompts","bootstrapApiPrompts","chalk"],"mappings":";;;;;;;;;;;;;;AAAA,MAAe,gBAAA,CAAC,UAAkB;AAChC,QAAM,QAAQ;AAEd,MAAI,CAAC,OAAO;AACH,WAAA;AAAA,EACT;AAEO,SAAA,MAAM,KAAK,KAAK,KAAK;AAC9B;ACDA,MAAe,cAAA,CAAC,SAAsB;AAEpC,OAAK,aAAa,OAAO;AAAA,IACvB,aAAa;AAAA,IACb,SAAS;AAAA,MACP;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,MAC1C;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA;AAAA,QACE,MAAM,CAAC,YAAY,QAAQ;AAAA,QAC3B,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,MAAM,UAAU;AACd,gBAAM,cAAcA,KAAAA,KAAK,KAAK,mBAAmB,SAAS;AAC1D,gBAAM,SAAS,MAAMC,YAAAA,QAAG,WAAW,WAAW;AAE9C,cAAI,CAAC,QAAQ;AACX,kBAAM,MAAM,qCAAsC;AAAA,UACpD;AAE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A,MACP;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA,GAAG,sBAAsB,WAAW,KAAK,iBAAiB;AAAA,IAC5D;AAAA,IACA,QAAQ,SAAS;AACf,UAAI,CAAC,SAAS;AACZ,eAAO;MACT;AAEM,YAAA,WAAW,YAAY,SAAS,WAAW;AAC3C,YAAA,aAAa,QAAQ;AAC3B,YAAM,WAAWA,iBAAAA,QAAQ,sBAAsB,UAAU,IAAI,OAAO;AAE7D,aAAA;AAAA,QACL;AAAA,UACE,MAAM;AAAA,UACN,MAAM,GAAG,QAAQ,sBAAsB,QAAQ;AAAA,UAC/C,cAAc,aAAa,QAAQ,YAAY,QAAQ;AAAA,QACzD;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA,CACD;AACH;ACxBA,MAAe,WAAA,CAAC,SAAsB;AAEpC,OAAK,kBAAkB,mBAAmB;AAC1C,OAAK,UAAU,aAAa,CAAC,SAAiBI,mBAAA,QAAU,IAAI,CAAC;AAG7D,cAAY,IAAI;AAChB,qBAAmB,IAAI;AACvB,sBAAoB,IAAI;AACxB,iBAAe,IAAI;AACnB,iBAAe,IAAI;AACnB,qBAAmB,IAAI;AACvB,oBAAkB,IAAI;AACtB,kBAAgB,IAAI;AACtB;;"}
package/dist/plopfile.mjs CHANGED
@@ -3,7 +3,7 @@ import { join } from "path";
3
3
  import fs from "fs-extra";
4
4
  import tsUtils from "@strapi/typescript-utils";
5
5
  import slugify from "@sindresorhus/slugify";
6
- import * as utils from "@strapi/utils";
6
+ import { strings } from "@strapi/utils";
7
7
  import chalk from "chalk";
8
8
  const validateInput = (input) => {
9
9
  const regex = /^[A-Za-z-]+$/g;
@@ -185,7 +185,7 @@ const generateController = (plop) => {
185
185
  }
186
186
  });
187
187
  };
188
- const questions$3 = [
188
+ const questions$2 = [
189
189
  {
190
190
  type: "input",
191
191
  name: "displayName",
@@ -198,7 +198,7 @@ const questions$3 = [
198
198
  message: "Content type singular name",
199
199
  default: (answers) => slugify(answers.displayName),
200
200
  validate(input) {
201
- if (!utils.isKebabCase(input)) {
201
+ if (!strings.isKebabCase(input)) {
202
202
  return "Value must be in kebab-case";
203
203
  }
204
204
  return true;
@@ -213,14 +213,14 @@ const questions$3 = [
213
213
  if (answers.singularName === input) {
214
214
  return "Singular and plural names cannot be the same";
215
215
  }
216
- if (!utils.isKebabCase(input)) {
216
+ if (!strings.isKebabCase(input)) {
217
217
  return "Value must be in kebab-case";
218
218
  }
219
219
  return true;
220
220
  }
221
221
  }
222
222
  ];
223
- const questions$2 = [
223
+ const questions$1 = [
224
224
  {
225
225
  type: "list",
226
226
  name: "kind",
@@ -233,14 +233,6 @@ const questions$2 = [
233
233
  validate: (input) => validateInput(input)
234
234
  }
235
235
  ];
236
- const questions$1 = [
237
- {
238
- type: "confirm",
239
- name: "useDraftAndPublish",
240
- default: false,
241
- message: "Use draft and publish?"
242
- }
243
- ];
244
236
  const validateAttributeInput = (input) => {
245
237
  const regex = /^[A-Za-z-|_]+$/g;
246
238
  if (!input) {
@@ -344,11 +336,7 @@ const generateContentType = (plop) => {
344
336
  plop.setGenerator("content-type", {
345
337
  description: "Generate a content type for an API",
346
338
  async prompts(inquirer) {
347
- const config = await inquirer.prompt([
348
- ...questions$3,
349
- ...questions$2,
350
- ...questions$1
351
- ]);
339
+ const config = await inquirer.prompt([...questions$2, ...questions$1]);
352
340
  const attributes = await getAttributesPrompts(inquirer);
353
341
  const api = await inquirer.prompt([
354
342
  ...getDestinationPrompts("model", plop.getDestBasePath()),
@@ -359,7 +347,7 @@ const generateContentType = (plop) => {
359
347
  default: config.singularName,
360
348
  message: "Name of the new API?",
361
349
  async validate(input) {
362
- if (!utils.isKebabCase(input)) {
350
+ if (!strings.isKebabCase(input)) {
363
351
  return "Value must be in kebab-case";
364
352
  }
365
353
  const apiPath = join(plop.getDestBasePath(), "api");
@@ -506,8 +494,8 @@ const generatePlugin = (plop) => {
506
494
  const isTypescript = answers.language === LANGUAGES.typescript;
507
495
  const language = isTypescript ? "ts" : "js";
508
496
  const projectLanguage = tsUtils.isUsingTypeScriptSync(process.cwd()) ? "ts" : "js";
509
- if (!utils.isKebabCase(answers.pluginName)) {
510
- answers.pluginName = utils.toKebabCase(answers.pluginName);
497
+ if (!strings.isKebabCase(answers.pluginName)) {
498
+ answers.pluginName = strings.toKebabCase(answers.pluginName);
511
499
  console.log(
512
500
  chalk.yellow(
513
501
  `Strapi only supports kebab-cased names for plugins.
@@ -1 +1 @@
1
- {"version":3,"file":"plopfile.mjs","sources":["../src/plops/utils/validate-input.ts","../src/plops/api.ts","../src/plops/prompts/get-destination-prompts.ts","../src/plops/utils/get-file-path.ts","../src/plops/controller.ts","../src/plops/prompts/ct-names-prompts.ts","../src/plops/prompts/kind-prompts.ts","../src/plops/prompts/draft-and-publish-prompts.ts","../src/plops/utils/validate-attribute-input.ts","../src/plops/prompts/get-attributes-prompts.ts","../src/plops/prompts/bootstrap-api-prompts.ts","../src/plops/content-type.ts","../src/plops/plugin.ts","../src/plops/policy.ts","../src/plops/middleware.ts","../src/plops/utils/validate-file-name-input.ts","../src/plops/utils/get-formatted-date.ts","../src/plops/migration.ts","../src/plops/service.ts","../src/plopfile.ts"],"sourcesContent":["export default (input: string) => {\n const regex = /^[A-Za-z-]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters, '-' and no spaces\";\n};\n","import { join } from 'path';\nimport { NodePlopAPI } from 'plop';\nimport fs from 'fs-extra';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport validateInput from './utils/validate-input';\n\nexport default (plop: NodePlopAPI) => {\n // API generator\n plop.setGenerator('api', {\n description: 'Generate a basic API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'API name',\n validate: (input) => validateInput(input),\n },\n {\n type: 'confirm',\n name: 'isPluginApi',\n message: 'Is this API for a plugin?',\n },\n {\n when: (answers) => answers.isPluginApi,\n type: 'list',\n name: 'plugin',\n message: 'Plugin name',\n async choices() {\n const pluginsPath = join(plop.getDestBasePath(), 'plugins');\n const exists = await fs.pathExists(pluginsPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find a \"plugins\" directory');\n }\n\n const pluginsDir = await fs.readdir(pluginsPath, { withFileTypes: true });\n const pluginsDirContent = pluginsDir.filter((fd) => fd.isDirectory());\n\n if (pluginsDirContent.length === 0) {\n throw Error('The \"plugins\" directory is empty');\n }\n\n return pluginsDirContent;\n },\n },\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath =\n answers.isPluginApi && answers.plugin ? 'plugins/{{ plugin }}' : 'api/{{ id }}';\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n const baseActions = [\n {\n type: 'add',\n path: `${filePath}/controllers/{{ id }}.${language}`,\n templateFile: `templates/${language}/controller.${language}.hbs`,\n },\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n\n if (answers.isPluginApi) {\n return baseActions;\n }\n\n return [\n {\n type: 'add',\n path: `${filePath}/routes/{{ id }}.${language}`,\n templateFile: `templates/${language}/single-route.${language}.hbs`,\n },\n ...baseActions,\n ];\n },\n });\n};\n","import { join } from 'path';\nimport fs from 'fs-extra';\n\nimport type { PromptQuestion } from 'node-plop';\n\nexport default (\n action: string,\n basePath: string,\n { rootFolder = false } = {}\n): Array<PromptQuestion> => {\n return [\n {\n type: 'list',\n name: 'destination',\n message: `Where do you want to add this ${action}?`,\n choices: [\n ...(rootFolder\n ? [\n {\n name: `Add ${action} to root of project`,\n value: 'root',\n },\n ]\n : [\n {\n name: `Add ${action} to new API`,\n value: 'new',\n },\n ]),\n { name: `Add ${action} to an existing API`, value: 'api' },\n { name: `Add ${action} to an existing plugin`, value: 'plugin' },\n ],\n },\n {\n when: (answers) => answers.destination === 'api',\n type: 'list',\n message: 'Which API is this for?',\n name: 'api',\n async choices() {\n const apiPath = join(basePath, 'api');\n const exists = await fs.pathExists(apiPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find an \"api\" directory');\n }\n\n const apiDir = await fs.readdir(apiPath, { withFileTypes: true });\n const apiDirContent = apiDir.filter((fd) => fd.isDirectory());\n\n if (apiDirContent.length === 0) {\n throw Error('The \"api\" directory is empty');\n }\n\n return apiDirContent;\n },\n },\n {\n when: (answers) => answers.destination === 'plugin',\n type: 'list',\n message: 'Which plugin is this for?',\n name: 'plugin',\n async choices() {\n const pluginsPath = join(basePath, 'plugins');\n const exists = await fs.pathExists(pluginsPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find a \"plugins\" directory');\n }\n\n const pluginsDir = await fs.readdir(pluginsPath);\n const pluginsDirContent = pluginsDir.filter((api) =>\n fs.lstatSync(join(pluginsPath, api)).isDirectory()\n );\n\n if (pluginsDirContent.length === 0) {\n throw Error('The \"plugins\" directory is empty');\n }\n\n return pluginsDirContent;\n },\n },\n ];\n};\n","export default (destination: string) => {\n if (destination === 'api') {\n return `api/{{ api }}`;\n }\n\n if (destination === 'plugin') {\n return `plugins/{{ plugin }}/server`;\n }\n\n if (destination === 'root') {\n return './';\n }\n\n return `api/{{ id }}`;\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport validateInput from './utils/validate-input';\n\nexport default (plop: NodePlopAPI) => {\n // Controller generator\n plop.setGenerator('controller', {\n description: 'Generate a controller for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Controller name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('controller', plop.getDestBasePath()),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/controllers/{{ id }}.${language}`,\n templateFile: `templates/${language}/controller.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport * as utils from '@strapi/utils';\n\nimport type { PromptQuestion } from 'node-plop';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'input',\n name: 'displayName',\n message: 'Content type display name',\n validate: (input: string) => !!input,\n },\n {\n type: 'input',\n name: 'singularName',\n message: 'Content type singular name',\n default: (answers: Answers) => slugify(answers.displayName),\n validate(input) {\n if (!utils.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n {\n type: 'input',\n name: 'pluralName',\n message: 'Content type plural name',\n default: (answers: Answers) => pluralize(answers.singularName),\n validate(input: string, answers: Answers) {\n if (answers.singularName === input) {\n return 'Singular and plural names cannot be the same';\n }\n\n if (!utils.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n];\n\nexport default questions;\n","import type { PromptQuestion } from 'node-plop';\n\nimport validateInput from '../utils/validate-input';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'list',\n name: 'kind',\n message: 'Please choose the model type',\n default: 'collectionType',\n choices: [\n { name: 'Collection Type', value: 'collectionType' },\n { name: 'Single Type', value: 'singleType' },\n ],\n validate: (input: string) => validateInput(input),\n },\n];\n\nexport default questions;\n","import type { PromptQuestion } from 'node-plop';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'confirm',\n name: 'useDraftAndPublish',\n default: false,\n message: 'Use draft and publish?',\n },\n];\n\nexport default questions;\n","export default (input: string) => {\n const regex = /^[A-Za-z-|_]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters, '-', '_', and no spaces\";\n};\n","import type { DynamicPromptsFunction } from 'node-plop';\n\nimport validateAttributeInput from '../utils/validate-attribute-input';\n\ninterface AttributeAnswer {\n attributeName: string;\n attributeType: typeof DEFAULT_TYPES;\n enum?: string;\n multiple?: boolean;\n}\n\nconst DEFAULT_TYPES = [\n // advanced types\n 'media',\n\n // scalar types\n 'string',\n 'text',\n 'richtext',\n 'json',\n 'enumeration',\n 'password',\n 'email',\n 'integer',\n 'biginteger',\n 'float',\n 'decimal',\n 'date',\n 'time',\n 'datetime',\n 'timestamp',\n 'boolean',\n] as const;\n\nconst getAttributesPrompts: DynamicPromptsFunction = async (inquirer) => {\n const { addAttributes } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add attributes?',\n },\n ]);\n\n const attributes: Array<AttributeAnswer> = [];\n\n /**\n * @param {import('inquirer').Inquirer} inquirer\n * @returns {Promise<void>}\n */\n const createNewAttributes = async (inquirer: Parameters<DynamicPromptsFunction>[0]) => {\n const answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'attributeName',\n message: 'Name of attribute',\n validate: (input: string) => validateAttributeInput(input),\n },\n {\n type: 'list',\n name: 'attributeType',\n message: 'What type of attribute',\n pageSize: DEFAULT_TYPES.length,\n choices: DEFAULT_TYPES.map((type) => {\n return { name: type, value: type };\n }),\n },\n {\n when: (answers) => answers.attributeType === 'enumeration',\n type: 'input',\n name: 'enum',\n message: 'Add values separated by a comma',\n },\n {\n when: (answers) => answers.attributeType === 'media',\n type: 'list',\n name: 'multiple',\n message: 'Choose media type',\n choices: [\n { name: 'Multiple', value: true },\n { name: 'Single', value: false },\n ],\n },\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add another attribute?',\n },\n ]);\n\n attributes.push(answers);\n\n if (!answers.addAttributes) {\n return;\n }\n\n await createNewAttributes(inquirer);\n };\n\n if (addAttributes) {\n await createNewAttributes(inquirer);\n } else {\n console.warn(\n `You won't be able to manage entries from the admin, you can still add attributes later from the content type builder.`\n );\n }\n\n return attributes;\n};\n\nexport default getAttributesPrompts;\n","import type { PromptQuestion } from 'node-plop';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n","import { join } from 'path';\nimport { NodePlopAPI, ActionType } from 'plop';\nimport slugify from '@sindresorhus/slugify';\nimport fs from 'fs-extra';\nimport * as utils from '@strapi/utils';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport ctNamesPrompts from './prompts/ct-names-prompts';\nimport kindPrompts from './prompts/kind-prompts';\nimport draftAndPublishPrompts from './prompts/draft-and-publish-prompts';\nimport getAttributesPrompts from './prompts/get-attributes-prompts';\nimport bootstrapApiPrompts from './prompts/bootstrap-api-prompts';\n\nexport default (plop: NodePlopAPI) => {\n // Model generator\n plop.setGenerator('content-type', {\n description: 'Generate a content type for an API',\n async prompts(inquirer) {\n const config = await inquirer.prompt([\n ...ctNamesPrompts,\n ...kindPrompts,\n ...draftAndPublishPrompts,\n ]);\n const attributes = await getAttributesPrompts(inquirer);\n\n const api = await inquirer.prompt([\n ...getDestinationPrompts('model', plop.getDestBasePath()),\n {\n when: (answers) => answers.destination === 'new',\n type: 'input',\n name: 'id',\n default: config.singularName,\n message: 'Name of the new API?',\n async validate(input) {\n if (!utils.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n const apiPath = join(plop.getDestBasePath(), 'api');\n const exists = await fs.pathExists(apiPath);\n\n if (!exists) {\n return true;\n }\n\n const apiDir = await fs.readdir(apiPath, { withFileTypes: true });\n const apiDirContent = apiDir.filter((fd) => fd.isDirectory());\n\n if (apiDirContent.findIndex((dir) => dir.name === input) !== -1) {\n throw new Error('This name is already taken.');\n }\n\n return true;\n },\n },\n ...bootstrapApiPrompts,\n ]);\n\n return {\n ...config,\n ...api,\n attributes,\n };\n },\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const attributes = answers.attributes.reduce((object: any, answer: any) => {\n const val: any = { type: answer.attributeType };\n\n if (answer.attributeType === 'enumeration') {\n val.enum = answer.enum.split(',').map((item: string) => item.trim());\n }\n\n if (answer.attributeType === 'media') {\n val.allowedTypes = ['images', 'files', 'videos', 'audios'];\n val.multiple = answer.multiple;\n }\n\n return Object.assign(object, { [answer.attributeName]: val }, {});\n }, {});\n\n const filePath = getFilePath(answers.destination);\n // TODO: use basePath instead\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/content-types/{{ singularName }}/schema.json`,\n templateFile: `templates/${language}/content-type.schema.json.hbs`,\n data: {\n collectionName: slugify(answers.pluralName, { separator: '_' }),\n },\n },\n ];\n\n if (Object.entries(attributes).length > 0) {\n baseActions.push({\n type: 'modify',\n path: `${filePath}/content-types/{{ singularName }}/schema.json`,\n transform(template: string) {\n const parsedTemplate = JSON.parse(template);\n parsedTemplate.attributes = attributes;\n return JSON.stringify(parsedTemplate, null, 2);\n },\n });\n }\n\n if (answers.bootstrapApi) {\n const { singularName } = answers;\n\n let uid;\n if (answers.destination === 'new') {\n uid = `api::${answers.id}.${singularName}`;\n } else if (answers.api) {\n uid = `api::${answers.api}.${singularName}`;\n } else if (answers.plugin) {\n uid = `plugin::${answers.plugin}.${singularName}`;\n }\n\n baseActions.push(\n {\n type: 'add',\n path: `${filePath}/controllers/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-controller.${language}.hbs`,\n data: { uid },\n },\n {\n type: 'add',\n path: `${filePath}/services/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-service.${language}.hbs`,\n data: { uid },\n },\n {\n type: 'add',\n path: `${filePath}/routes/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-router.${language}.hbs`,\n data: { uid },\n }\n );\n }\n\n return baseActions;\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport chalk from 'chalk';\nimport tsUtils from '@strapi/typescript-utils';\nimport * as utils from '@strapi/utils';\n\nimport validateInput from './utils/validate-input';\n\nconst LANGUAGES = {\n javascript: 'JavaScript',\n typescript: 'TypeScript',\n};\n\nconst logInstructions = (pluginName: string, { language }: { language: string }) => {\n const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;\n const separator = Array(maxLength).fill('─').join('');\n\n const exportInstruction = language === 'js' ? 'module.exports =' : 'export default';\n\n return `\nYou can now enable your plugin by adding the following in ${chalk.yellow(\n `./config/plugins.${language}`\n )}\n${separator}\n${exportInstruction} {\n ${chalk.gray('// ...')}\n ${chalk.green(`'${pluginName}'`)}: {\n enabled: ${chalk.yellow(true)},\n resolve: ${chalk.yellow(`'./src/plugins/${pluginName}'`)}\n },\n ${chalk.gray('// ...')}\n}\n${separator}\n`;\n};\n\nexport default (plop: NodePlopAPI) => {\n // Plugin generator\n plop.setGenerator('plugin', {\n description: 'Generate a basic plugin',\n prompts: [\n {\n type: 'input',\n name: 'pluginName',\n message: 'Plugin name',\n validate: (input) => validateInput(input),\n },\n {\n type: 'list',\n name: 'language',\n message: 'Choose your preferred language',\n choices: Object.values(LANGUAGES),\n default: LANGUAGES.javascript,\n },\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const isTypescript = answers.language === LANGUAGES.typescript;\n const language = isTypescript ? 'ts' : 'js';\n const projectLanguage = tsUtils.isUsingTypeScriptSync(process.cwd()) ? 'ts' : 'js';\n\n if (!utils.isKebabCase(answers.pluginName)) {\n answers.pluginName = utils.toKebabCase(answers.pluginName);\n console.log(\n chalk.yellow(\n `Strapi only supports kebab-cased names for plugins.\\nYour plugin has been automatically renamed to \"${answers.pluginName}\".`\n )\n );\n }\n\n return [\n {\n type: 'addMany',\n destination: 'plugins/{{ pluginName }}',\n base: `files/${language}/plugin`,\n templateFiles: `files/${language}/plugin/**`,\n },\n {\n type: 'add',\n path: 'plugins/{{ pluginName }}/README.md',\n templateFile: `templates/${language}/README.md.hbs`,\n },\n {\n type: 'add',\n path: 'plugins/{{ pluginName }}/package.json',\n templateFile: `templates/${language}/plugin-package.json.hbs`,\n },\n () =>\n plop.renderString(\n logInstructions(answers.pluginName, { language: projectLanguage }),\n null\n ),\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // Policy generator\n plop.setGenerator('policy', {\n description: 'Generate a policy for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Policy name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('policy', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // middleware generator\n plop.setGenerator('middleware', {\n description: 'Generate a middleware for an API',\n prompts: [\n {\n type: 'input',\n name: 'name',\n message: 'Middleware name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('middleware', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/middlewares/{{ name }}.${language}`,\n templateFile: `templates/${language}/middleware.${language}.hbs`,\n },\n ];\n },\n });\n};\n","export default (input: string) => {\n const regex = /^[A-Za-z-_0-9]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters and number, '-' or '_' and no spaces\";\n};\n","export default (date: Date = new Date()) => {\n return new Date(date.getTime() - date.getTimezoneOffset() * 60000)\n .toJSON()\n .replace(/[-:]/g, '.')\n .replace(/\\....Z/, '');\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport validateFileNameInput from './utils/validate-file-name-input';\nimport getFormattedDate from './utils/get-formatted-date';\n\nexport default (plop: NodePlopAPI) => {\n // Migration generator\n plop.setGenerator('migration', {\n description: 'Generate a migration',\n prompts: [\n {\n type: 'input',\n name: 'name',\n message: 'Migration name',\n validate: (input) => validateFileNameInput(input),\n },\n ],\n actions() {\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n const timestamp = getFormattedDate();\n\n return [\n {\n type: 'add',\n path: `${currentDir}/database/migrations/${timestamp}.{{ name }}.${language}`,\n templateFile: `templates/${language}/migration.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // Service generator\n plop.setGenerator('service', {\n description: 'Generate a service for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Service name',\n },\n ...getDestinationPrompts('service', plop.getDestBasePath()),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers?.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import pluralize from 'pluralize';\nimport { NodePlopAPI } from 'plop';\n\nimport generateApi from './plops/api';\nimport generateController from './plops/controller';\nimport generateContentType from './plops/content-type';\nimport generatePlugin from './plops/plugin';\nimport generatePolicy from './plops/policy';\nimport generateMiddleware from './plops/middleware';\nimport generateMigration from './plops/migration';\nimport generateService from './plops/service';\n\nexport default (plop: NodePlopAPI) => {\n // Plop config\n plop.setWelcomeMessage('Strapi Generators');\n plop.addHelper('pluralize', (text: string) => pluralize(text));\n\n // Generators\n generateApi(plop);\n generateController(plop);\n generateContentType(plop);\n generatePlugin(plop);\n generatePolicy(plop);\n generateMiddleware(plop);\n generateMigration(plop);\n generateService(plop);\n};\n"],"names":["questions","inquirer","answers","ctNamesPrompts","kindPrompts","draftAndPublishPrompts","bootstrapApiPrompts"],"mappings":";;;;;;;AAAA,MAAe,gBAAA,CAAC,UAAkB;AAChC,QAAM,QAAQ;AAEd,MAAI,CAAC,OAAO;AACH,WAAA;AAAA,EACT;AAEO,SAAA,MAAM,KAAK,KAAK,KAAK;AAC9B;ACDA,MAAe,cAAA,CAAC,SAAsB;AAEpC,OAAK,aAAa,OAAO;AAAA,IACvB,aAAa;AAAA,IACb,SAAS;AAAA,MACP;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,MAC1C;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA;AAAA,QACE,MAAM,CAAC,YAAY,QAAQ;AAAA,QAC3B,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,MAAM,UAAU;AACd,gBAAM,cAAc,KAAK,KAAK,mBAAmB,SAAS;AAC1D,gBAAM,SAAS,MAAM,GAAG,WAAW,WAAW;AAE9C,cAAI,CAAC,QAAQ;AACX,kBAAM,MAAM,qCAAsC;AAAA,UACpD;AAEM,gBAAA,aAAa,MAAM,GAAG,QAAQ,aAAa,EAAE,eAAe,MAAM;AACxE,gBAAM,oBAAoB,WAAW,OAAO,C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AAS,WAAW;AAC3C,YAAA,aAAa,QAAQ;AAC3B,YAAM,WAAW,QAAQ,sBAAsB,UAAU,IAAI,OAAO;AAE7D,aAAA;AAAA,QACL;AAAA,UACE,MAAM;AAAA,UACN,MAAM,GAAG,QAAQ,sBAAsB,QAAQ;AAAA,UAC/C,cAAc,aAAa,QAAQ,YAAY,QAAQ;AAAA,QACzD;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA,CACD;AACH;ACxBA,MAAe,WAAA,CAAC,SAAsB;AAEpC,OAAK,kBAAkB,mBAAmB;AAC1C,OAAK,UAAU,aAAa,CAAC,SAAiB,UAAU,IAAI,CAAC;AAG7D,cAAY,IAAI;AAChB,qBAAmB,IAAI;AACvB,sBAAoB,IAAI;AACxB,iBAAe,IAAI;AACnB,iBAAe,IAAI;AACnB,qBAAmB,IAAI;AACvB,oBAAkB,IAAI;AACtB,kBAAgB,IAAI;AACtB;"}
1
+ {"version":3,"file":"plopfile.mjs","sources":["../src/plops/utils/validate-input.ts","../src/plops/api.ts","../src/plops/prompts/get-destination-prompts.ts","../src/plops/utils/get-file-path.ts","../src/plops/controller.ts","../src/plops/prompts/ct-names-prompts.ts","../src/plops/prompts/kind-prompts.ts","../src/plops/utils/validate-attribute-input.ts","../src/plops/prompts/get-attributes-prompts.ts","../src/plops/prompts/bootstrap-api-prompts.ts","../src/plops/content-type.ts","../src/plops/plugin.ts","../src/plops/policy.ts","../src/plops/middleware.ts","../src/plops/utils/validate-file-name-input.ts","../src/plops/utils/get-formatted-date.ts","../src/plops/migration.ts","../src/plops/service.ts","../src/plopfile.ts"],"sourcesContent":["export default (input: string) => {\n const regex = /^[A-Za-z-]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters, '-' and no spaces\";\n};\n","import { join } from 'path';\nimport { NodePlopAPI } from 'plop';\nimport fs from 'fs-extra';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport validateInput from './utils/validate-input';\n\nexport default (plop: NodePlopAPI) => {\n // API generator\n plop.setGenerator('api', {\n description: 'Generate a basic API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'API name',\n validate: (input) => validateInput(input),\n },\n {\n type: 'confirm',\n name: 'isPluginApi',\n message: 'Is this API for a plugin?',\n },\n {\n when: (answers) => answers.isPluginApi,\n type: 'list',\n name: 'plugin',\n message: 'Plugin name',\n async choices() {\n const pluginsPath = join(plop.getDestBasePath(), 'plugins');\n const exists = await fs.pathExists(pluginsPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find a \"plugins\" directory');\n }\n\n const pluginsDir = await fs.readdir(pluginsPath, { withFileTypes: true });\n const pluginsDirContent = pluginsDir.filter((fd) => fd.isDirectory());\n\n if (pluginsDirContent.length === 0) {\n throw Error('The \"plugins\" directory is empty');\n }\n\n return pluginsDirContent;\n },\n },\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath =\n answers.isPluginApi && answers.plugin ? 'plugins/{{ plugin }}' : 'api/{{ id }}';\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n const baseActions = [\n {\n type: 'add',\n path: `${filePath}/controllers/{{ id }}.${language}`,\n templateFile: `templates/${language}/controller.${language}.hbs`,\n },\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n\n if (answers.isPluginApi) {\n return baseActions;\n }\n\n return [\n {\n type: 'add',\n path: `${filePath}/routes/{{ id }}.${language}`,\n templateFile: `templates/${language}/single-route.${language}.hbs`,\n },\n ...baseActions,\n ];\n },\n });\n};\n","import { join } from 'path';\nimport fs from 'fs-extra';\n\nimport type { PromptQuestion } from 'node-plop';\n\nexport default (\n action: string,\n basePath: string,\n { rootFolder = false } = {}\n): Array<PromptQuestion> => {\n return [\n {\n type: 'list',\n name: 'destination',\n message: `Where do you want to add this ${action}?`,\n choices: [\n ...(rootFolder\n ? [\n {\n name: `Add ${action} to root of project`,\n value: 'root',\n },\n ]\n : [\n {\n name: `Add ${action} to new API`,\n value: 'new',\n },\n ]),\n { name: `Add ${action} to an existing API`, value: 'api' },\n { name: `Add ${action} to an existing plugin`, value: 'plugin' },\n ],\n },\n {\n when: (answers) => answers.destination === 'api',\n type: 'list',\n message: 'Which API is this for?',\n name: 'api',\n async choices() {\n const apiPath = join(basePath, 'api');\n const exists = await fs.pathExists(apiPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find an \"api\" directory');\n }\n\n const apiDir = await fs.readdir(apiPath, { withFileTypes: true });\n const apiDirContent = apiDir.filter((fd) => fd.isDirectory());\n\n if (apiDirContent.length === 0) {\n throw Error('The \"api\" directory is empty');\n }\n\n return apiDirContent;\n },\n },\n {\n when: (answers) => answers.destination === 'plugin',\n type: 'list',\n message: 'Which plugin is this for?',\n name: 'plugin',\n async choices() {\n const pluginsPath = join(basePath, 'plugins');\n const exists = await fs.pathExists(pluginsPath);\n\n if (!exists) {\n throw Error('Couldn\\'t find a \"plugins\" directory');\n }\n\n const pluginsDir = await fs.readdir(pluginsPath);\n const pluginsDirContent = pluginsDir.filter((api) =>\n fs.lstatSync(join(pluginsPath, api)).isDirectory()\n );\n\n if (pluginsDirContent.length === 0) {\n throw Error('The \"plugins\" directory is empty');\n }\n\n return pluginsDirContent;\n },\n },\n ];\n};\n","export default (destination: string) => {\n if (destination === 'api') {\n return `api/{{ api }}`;\n }\n\n if (destination === 'plugin') {\n return `plugins/{{ plugin }}/server`;\n }\n\n if (destination === 'root') {\n return './';\n }\n\n return `api/{{ id }}`;\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport validateInput from './utils/validate-input';\n\nexport default (plop: NodePlopAPI) => {\n // Controller generator\n plop.setGenerator('controller', {\n description: 'Generate a controller for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Controller name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('controller', plop.getDestBasePath()),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/controllers/{{ id }}.${language}`,\n templateFile: `templates/${language}/controller.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport { strings } from '@strapi/utils';\n\nimport type { PromptQuestion } from 'node-plop';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'input',\n name: 'displayName',\n message: 'Content type display name',\n validate: (input: string) => !!input,\n },\n {\n type: 'input',\n name: 'singularName',\n message: 'Content type singular name',\n default: (answers: Answers) => slugify(answers.displayName),\n validate(input) {\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n {\n type: 'input',\n name: 'pluralName',\n message: 'Content type plural name',\n default: (answers: Answers) => pluralize(answers.singularName),\n validate(input: string, answers: Answers) {\n if (answers.singularName === input) {\n return 'Singular and plural names cannot be the same';\n }\n\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n return true;\n },\n },\n];\n\nexport default questions;\n","import type { PromptQuestion } from 'node-plop';\n\nimport validateInput from '../utils/validate-input';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'list',\n name: 'kind',\n message: 'Please choose the model type',\n default: 'collectionType',\n choices: [\n { name: 'Collection Type', value: 'collectionType' },\n { name: 'Single Type', value: 'singleType' },\n ],\n validate: (input: string) => validateInput(input),\n },\n];\n\nexport default questions;\n","export default (input: string) => {\n const regex = /^[A-Za-z-|_]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters, '-', '_', and no spaces\";\n};\n","import type { DynamicPromptsFunction } from 'node-plop';\n\nimport validateAttributeInput from '../utils/validate-attribute-input';\n\ninterface AttributeAnswer {\n attributeName: string;\n attributeType: typeof DEFAULT_TYPES;\n enum?: string;\n multiple?: boolean;\n}\n\nconst DEFAULT_TYPES = [\n // advanced types\n 'media',\n\n // scalar types\n 'string',\n 'text',\n 'richtext',\n 'json',\n 'enumeration',\n 'password',\n 'email',\n 'integer',\n 'biginteger',\n 'float',\n 'decimal',\n 'date',\n 'time',\n 'datetime',\n 'timestamp',\n 'boolean',\n] as const;\n\nconst getAttributesPrompts: DynamicPromptsFunction = async (inquirer) => {\n const { addAttributes } = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add attributes?',\n },\n ]);\n\n const attributes: Array<AttributeAnswer> = [];\n\n /**\n * @param {import('inquirer').Inquirer} inquirer\n * @returns {Promise<void>}\n */\n const createNewAttributes = async (inquirer: Parameters<DynamicPromptsFunction>[0]) => {\n const answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'attributeName',\n message: 'Name of attribute',\n validate: (input: string) => validateAttributeInput(input),\n },\n {\n type: 'list',\n name: 'attributeType',\n message: 'What type of attribute',\n pageSize: DEFAULT_TYPES.length,\n choices: DEFAULT_TYPES.map((type) => {\n return { name: type, value: type };\n }),\n },\n {\n when: (answers) => answers.attributeType === 'enumeration',\n type: 'input',\n name: 'enum',\n message: 'Add values separated by a comma',\n },\n {\n when: (answers) => answers.attributeType === 'media',\n type: 'list',\n name: 'multiple',\n message: 'Choose media type',\n choices: [\n { name: 'Multiple', value: true },\n { name: 'Single', value: false },\n ],\n },\n {\n type: 'confirm',\n name: 'addAttributes',\n message: 'Do you want to add another attribute?',\n },\n ]);\n\n attributes.push(answers);\n\n if (!answers.addAttributes) {\n return;\n }\n\n await createNewAttributes(inquirer);\n };\n\n if (addAttributes) {\n await createNewAttributes(inquirer);\n } else {\n console.warn(\n `You won't be able to manage entries from the admin, you can still add attributes later from the content type builder.`\n );\n }\n\n return attributes;\n};\n\nexport default getAttributesPrompts;\n","import type { PromptQuestion } from 'node-plop';\n\nconst questions: Array<PromptQuestion> = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n","import { join } from 'path';\nimport { NodePlopAPI, ActionType } from 'plop';\nimport slugify from '@sindresorhus/slugify';\nimport fs from 'fs-extra';\nimport { strings } from '@strapi/utils';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport ctNamesPrompts from './prompts/ct-names-prompts';\nimport kindPrompts from './prompts/kind-prompts';\nimport getAttributesPrompts from './prompts/get-attributes-prompts';\nimport bootstrapApiPrompts from './prompts/bootstrap-api-prompts';\n\nexport default (plop: NodePlopAPI) => {\n // Model generator\n plop.setGenerator('content-type', {\n description: 'Generate a content type for an API',\n async prompts(inquirer) {\n const config = await inquirer.prompt([...ctNamesPrompts, ...kindPrompts]);\n const attributes = await getAttributesPrompts(inquirer);\n\n const api = await inquirer.prompt([\n ...getDestinationPrompts('model', plop.getDestBasePath()),\n {\n when: (answers) => answers.destination === 'new',\n type: 'input',\n name: 'id',\n default: config.singularName,\n message: 'Name of the new API?',\n async validate(input) {\n if (!strings.isKebabCase(input)) {\n return 'Value must be in kebab-case';\n }\n\n const apiPath = join(plop.getDestBasePath(), 'api');\n const exists = await fs.pathExists(apiPath);\n\n if (!exists) {\n return true;\n }\n\n const apiDir = await fs.readdir(apiPath, { withFileTypes: true });\n const apiDirContent = apiDir.filter((fd) => fd.isDirectory());\n\n if (apiDirContent.findIndex((dir) => dir.name === input) !== -1) {\n throw new Error('This name is already taken.');\n }\n\n return true;\n },\n },\n ...bootstrapApiPrompts,\n ]);\n\n return {\n ...config,\n ...api,\n attributes,\n };\n },\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const attributes = answers.attributes.reduce((object: any, answer: any) => {\n const val: any = { type: answer.attributeType };\n\n if (answer.attributeType === 'enumeration') {\n val.enum = answer.enum.split(',').map((item: string) => item.trim());\n }\n\n if (answer.attributeType === 'media') {\n val.allowedTypes = ['images', 'files', 'videos', 'audios'];\n val.multiple = answer.multiple;\n }\n\n return Object.assign(object, { [answer.attributeName]: val }, {});\n }, {});\n\n const filePath = getFilePath(answers.destination);\n // TODO: use basePath instead\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/content-types/{{ singularName }}/schema.json`,\n templateFile: `templates/${language}/content-type.schema.json.hbs`,\n data: {\n collectionName: slugify(answers.pluralName, { separator: '_' }),\n },\n },\n ];\n\n if (Object.entries(attributes).length > 0) {\n baseActions.push({\n type: 'modify',\n path: `${filePath}/content-types/{{ singularName }}/schema.json`,\n transform(template: string) {\n const parsedTemplate = JSON.parse(template);\n parsedTemplate.attributes = attributes;\n return JSON.stringify(parsedTemplate, null, 2);\n },\n });\n }\n\n if (answers.bootstrapApi) {\n const { singularName } = answers;\n\n let uid;\n if (answers.destination === 'new') {\n uid = `api::${answers.id}.${singularName}`;\n } else if (answers.api) {\n uid = `api::${answers.api}.${singularName}`;\n } else if (answers.plugin) {\n uid = `plugin::${answers.plugin}.${singularName}`;\n }\n\n baseActions.push(\n {\n type: 'add',\n path: `${filePath}/controllers/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-controller.${language}.hbs`,\n data: { uid },\n },\n {\n type: 'add',\n path: `${filePath}/services/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-service.${language}.hbs`,\n data: { uid },\n },\n {\n type: 'add',\n path: `${filePath}/routes/{{ singularName }}.${language}`,\n templateFile: `templates/${language}/core-router.${language}.hbs`,\n data: { uid },\n }\n );\n }\n\n return baseActions;\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport chalk from 'chalk';\nimport tsUtils from '@strapi/typescript-utils';\nimport { strings } from '@strapi/utils';\n\nimport validateInput from './utils/validate-input';\n\nconst LANGUAGES = {\n javascript: 'JavaScript',\n typescript: 'TypeScript',\n};\n\nconst logInstructions = (pluginName: string, { language }: { language: string }) => {\n const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;\n const separator = Array(maxLength).fill('─').join('');\n\n const exportInstruction = language === 'js' ? 'module.exports =' : 'export default';\n\n return `\nYou can now enable your plugin by adding the following in ${chalk.yellow(\n `./config/plugins.${language}`\n )}\n${separator}\n${exportInstruction} {\n ${chalk.gray('// ...')}\n ${chalk.green(`'${pluginName}'`)}: {\n enabled: ${chalk.yellow(true)},\n resolve: ${chalk.yellow(`'./src/plugins/${pluginName}'`)}\n },\n ${chalk.gray('// ...')}\n}\n${separator}\n`;\n};\n\nexport default (plop: NodePlopAPI) => {\n // Plugin generator\n plop.setGenerator('plugin', {\n description: 'Generate a basic plugin',\n prompts: [\n {\n type: 'input',\n name: 'pluginName',\n message: 'Plugin name',\n validate: (input) => validateInput(input),\n },\n {\n type: 'list',\n name: 'language',\n message: 'Choose your preferred language',\n choices: Object.values(LANGUAGES),\n default: LANGUAGES.javascript,\n },\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const isTypescript = answers.language === LANGUAGES.typescript;\n const language = isTypescript ? 'ts' : 'js';\n const projectLanguage = tsUtils.isUsingTypeScriptSync(process.cwd()) ? 'ts' : 'js';\n\n if (!strings.isKebabCase(answers.pluginName)) {\n answers.pluginName = strings.toKebabCase(answers.pluginName);\n console.log(\n chalk.yellow(\n `Strapi only supports kebab-cased names for plugins.\\nYour plugin has been automatically renamed to \"${answers.pluginName}\".`\n )\n );\n }\n\n return [\n {\n type: 'addMany',\n destination: 'plugins/{{ pluginName }}',\n base: `files/${language}/plugin`,\n templateFiles: `files/${language}/plugin/**`,\n },\n {\n type: 'add',\n path: 'plugins/{{ pluginName }}/README.md',\n templateFile: `templates/${language}/README.md.hbs`,\n },\n {\n type: 'add',\n path: 'plugins/{{ pluginName }}/package.json',\n templateFile: `templates/${language}/plugin-package.json.hbs`,\n },\n () =>\n plop.renderString(\n logInstructions(answers.pluginName, { language: projectLanguage }),\n null\n ),\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // Policy generator\n plop.setGenerator('policy', {\n description: 'Generate a policy for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Policy name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('policy', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // middleware generator\n plop.setGenerator('middleware', {\n description: 'Generate a middleware for an API',\n prompts: [\n {\n type: 'input',\n name: 'name',\n message: 'Middleware name',\n validate: (input) => validateInput(input),\n },\n ...getDestinationPrompts('middleware', plop.getDestBasePath(), { rootFolder: true }),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/middlewares/{{ name }}.${language}`,\n templateFile: `templates/${language}/middleware.${language}.hbs`,\n },\n ];\n },\n });\n};\n","export default (input: string) => {\n const regex = /^[A-Za-z-_0-9]+$/g;\n\n if (!input) {\n return 'You must provide an input';\n }\n\n return regex.test(input) || \"Please use only letters and number, '-' or '_' and no spaces\";\n};\n","export default (date: Date = new Date()) => {\n return new Date(date.getTime() - date.getTimezoneOffset() * 60000)\n .toJSON()\n .replace(/[-:]/g, '.')\n .replace(/\\....Z/, '');\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport validateFileNameInput from './utils/validate-file-name-input';\nimport getFormattedDate from './utils/get-formatted-date';\n\nexport default (plop: NodePlopAPI) => {\n // Migration generator\n plop.setGenerator('migration', {\n description: 'Generate a migration',\n prompts: [\n {\n type: 'input',\n name: 'name',\n message: 'Migration name',\n validate: (input) => validateFileNameInput(input),\n },\n ],\n actions() {\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n const timestamp = getFormattedDate();\n\n return [\n {\n type: 'add',\n path: `${currentDir}/database/migrations/${timestamp}.{{ name }}.${language}`,\n templateFile: `templates/${language}/migration.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import { NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\n\nexport default (plop: NodePlopAPI) => {\n // Service generator\n plop.setGenerator('service', {\n description: 'Generate a service for an API',\n prompts: [\n {\n type: 'input',\n name: 'id',\n message: 'Service name',\n },\n ...getDestinationPrompts('service', plop.getDestBasePath()),\n ],\n actions(answers) {\n if (!answers) {\n return [];\n }\n\n const filePath = getFilePath(answers?.destination);\n const currentDir = process.cwd();\n const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n return [\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n },\n });\n};\n","import pluralize from 'pluralize';\nimport { NodePlopAPI } from 'plop';\n\nimport generateApi from './plops/api';\nimport generateController from './plops/controller';\nimport generateContentType from './plops/content-type';\nimport generatePlugin from './plops/plugin';\nimport generatePolicy from './plops/policy';\nimport generateMiddleware from './plops/middleware';\nimport generateMigration from './plops/migration';\nimport generateService from './plops/service';\n\nexport default (plop: NodePlopAPI) => {\n // Plop config\n plop.setWelcomeMessage('Strapi Generators');\n plop.addHelper('pluralize', (text: string) => pluralize(text));\n\n // Generators\n generateApi(plop);\n generateController(plop);\n generateContentType(plop);\n generatePlugin(plop);\n generatePolicy(plop);\n generateMiddleware(plop);\n generateMigration(plop);\n generateService(plop);\n};\n"],"names":["questions","inquirer","answers","ctNamesPrompts","kindPrompts","bootstrapApiPrompts"],"mappings":";;;;;;;AAAA,MAAe,gBAAA,CAAC,UAAkB;AAChC,QAAM,QAAQ;AAEd,MAAI,CAAC,OAAO;AACH,WAAA;AAAA,EACT;AAEO,SAAA,MAAM,KAAK,KAAK,KAAK;AAC9B;ACDA,MAAe,cAAA,CAAC,SAAsB;AAEpC,OAAK,aAAa,OAAO;AAAA,IACvB,aAAa;AAAA,IACb,SAAS;AAAA,MACP;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,MAC1C;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,MACA;AAAA,QACE,MAAM,CAAC,YAAY,QAAQ;AAAA,QAC3B,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,MAAM,UAAU;AACd,gBAAM,cAAc,KAAK,KAAK,mBAAmB,SAAS;AAC1D,gBAAM,SAAS,MAAM,GAAG,WAAW,WAAW;AAE9C,cAAI,CAAC,QAAQ;AACX,kBAAM,MAAM,qCAAsC;AAAA,UACpD;AAEM,gBAAA,aAAa,MAAM,GAAG,QAAQ,aAAa,EAAE,eAAe,MAAM;AACxE,gBAAM,oBAA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AM;AAAA,UACN,MAAM,GAAG,QAAQ,sBAAsB,QAAQ;AAAA,UAC/C,cAAc,aAAa,QAAQ,YAAY,QAAQ;AAAA,QACzD;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA,CACD;AACH;ACxBA,MAAe,WAAA,CAAC,SAAsB;AAEpC,OAAK,kBAAkB,mBAAmB;AAC1C,OAAK,UAAU,aAAa,CAAC,SAAiB,UAAU,IAAI,CAAC;AAG7D,cAAY,IAAI;AAChB,qBAAmB,IAAI;AACvB,sBAAoB,IAAI;AACxB,iBAAe,IAAI;AACnB,iBAAe,IAAI;AACnB,qBAAmB,IAAI;AACvB,oBAAkB,IAAI;AACtB,kBAAgB,IAAI;AACtB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"content-type.d.ts","sourceRoot":"","sources":["../../src/plops/content-type.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAc,MAAM,MAAM,CAAC;+BAczB,WAAW;AAAjC,wBAwIE"}
1
+ {"version":3,"file":"content-type.d.ts","sourceRoot":"","sources":["../../src/plops/content-type.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAc,MAAM,MAAM,CAAC;+BAazB,WAAW;AAAjC,wBAoIE"}
@@ -8,7 +8,6 @@
8
8
  "displayName": "{{ displayName }}"
9
9
  },
10
10
  "options": {
11
- "draftAndPublish": {{ useDraftAndPublish }},
12
11
  "comment": ""
13
12
  },
14
13
  "attributes": {}
@@ -17,13 +17,13 @@
17
17
  "devDependencies": {
18
18
  "react": "^18.2.0",
19
19
  "react-dom": "^18.2.0",
20
- "react-router-dom": "^5.3.4",
20
+ "react-router-dom": "^6.0.0",
21
21
  "styled-components": "^5.3.6"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "^17.0.0 || ^18.0.0",
25
25
  "react-dom": "^17.0.0 || ^18.0.0",
26
- "react-router-dom": "^5.2.0",
26
+ "react-router-dom": "^6.0.0",
27
27
  "styled-components": "^5.2.1"
28
28
  },
29
29
  "author": {
@@ -8,7 +8,6 @@
8
8
  "displayName": "{{ displayName }}"
9
9
  },
10
10
  "options": {
11
- "draftAndPublish": {{ useDraftAndPublish }},
12
11
  "comment": ""
13
12
  },
14
13
  "attributes": {}
@@ -11,24 +11,22 @@
11
11
  "@strapi/design-system": "^1.6.3",
12
12
  "@strapi/helper-plugin": "^4.6.0",
13
13
  "@strapi/icons": "^1.6.3",
14
- "prop-types": "^15.7.2"
15
14
  },
16
15
  "devDependencies": {
17
16
  "@strapi/typescript-utils": "^4.6.0",
18
- "@types/react": "^17.0.53",
19
- "@types/react-dom": "^18.0.28",
20
- "@types/react-router-dom": "^5.3.3",
17
+ "@types/react": "^18.0.0",
18
+ "@types/react-dom": "^18.0.0",
21
19
  "@types/styled-components": "^5.1.26",
22
- "react": "^18.2.0",
23
- "react-dom": "^18.2.0",
24
- "react-router-dom": "^5.3.4",
20
+ "react": "^18.0.0",
21
+ "react-dom": "^18.0.0",
22
+ "react-router-dom": "^6.0.0",
25
23
  "styled-components": "^5.3.6",
26
24
  "typescript": "5.0.4"
27
25
  },
28
26
  "peerDependencies": {
29
27
  "react": "^17.0.0 || ^18.0.0",
30
28
  "react-dom": "^17.0.0 || ^18.0.0",
31
- "react-router-dom": "^5.2.0",
29
+ "react-router-dom": "^6.0.0",
32
30
  "styled-components": "^5.2.1"
33
31
  },
34
32
  "author": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/generators",
3
- "version": "4.20.5",
3
+ "version": "5.0.0-alpha.1",
4
4
  "description": "Interactive API generator.",
5
5
  "keywords": [
6
6
  "strapi",
@@ -32,7 +32,7 @@
32
32
  "source": "./src/index.ts",
33
33
  "types": "./dist/index.d.ts",
34
34
  "files": [
35
- "./dist"
35
+ "dist/"
36
36
  ],
37
37
  "scripts": {
38
38
  "build": "pack-up build && run copy-files",
@@ -46,23 +46,23 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@sindresorhus/slugify": "1.1.0",
49
- "@strapi/typescript-utils": "4.20.5",
50
- "@strapi/utils": "4.20.5",
49
+ "@strapi/typescript-utils": "5.0.0-alpha.1",
50
+ "@strapi/utils": "5.0.0-alpha.1",
51
51
  "chalk": "4.1.2",
52
52
  "copyfiles": "2.4.1",
53
- "fs-extra": "10.0.0",
53
+ "fs-extra": "10.1.0",
54
54
  "node-plop": "0.26.3",
55
55
  "plop": "2.7.6",
56
56
  "pluralize": "8.0.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@strapi/pack-up": "4.20.5",
60
- "eslint-config-custom": "4.20.5",
61
- "tsconfig": "4.20.5"
59
+ "@strapi/pack-up": "5.0.0-alpha.1",
60
+ "eslint-config-custom": "5.0.0-alpha.1",
61
+ "tsconfig": "5.0.0-alpha.1"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=18.0.0 <=20.x.x",
65
65
  "npm": ">=6.0.0"
66
66
  },
67
- "gitHead": "7a2a86e65faa175172945f55afe1b0f299fe98cc"
67
+ "gitHead": "eb70e07ea981311a3ddfbb2fdda0417034b22881"
68
68
  }
@@ -1,4 +0,0 @@
1
- import type { PromptQuestion } from 'node-plop';
2
- declare const questions: Array<PromptQuestion>;
3
- export default questions;
4
- //# sourceMappingURL=draft-and-publish-prompts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"draft-and-publish-prompts.d.ts","sourceRoot":"","sources":["../../../src/plops/prompts/draft-and-publish-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,cAAc,CAOpC,CAAC;AAEF,eAAe,SAAS,CAAC"}