@strapi/generators 5.37.1 → 5.38.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.
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/plopfile.js.map +1 -1
- package/dist/plopfile.mjs.map +1 -1
- package/dist/plops/api.js.map +1 -1
- package/dist/plops/api.mjs.map +1 -1
- package/dist/plops/content-type.js.map +1 -1
- package/dist/plops/content-type.mjs.map +1 -1
- package/dist/plops/controller.js.map +1 -1
- package/dist/plops/controller.mjs.map +1 -1
- package/dist/plops/middleware.js.map +1 -1
- package/dist/plops/middleware.mjs.map +1 -1
- package/dist/plops/migration.js.map +1 -1
- package/dist/plops/migration.mjs.map +1 -1
- package/dist/plops/policy.js.map +1 -1
- package/dist/plops/policy.mjs.map +1 -1
- package/dist/plops/prompts/bootstrap-api-prompts.js.map +1 -1
- package/dist/plops/prompts/bootstrap-api-prompts.mjs.map +1 -1
- package/dist/plops/prompts/ct-names-prompts.js.map +1 -1
- package/dist/plops/prompts/ct-names-prompts.mjs.map +1 -1
- package/dist/plops/prompts/get-attributes-prompts.js.map +1 -1
- package/dist/plops/prompts/get-attributes-prompts.mjs.map +1 -1
- package/dist/plops/prompts/get-destination-prompts.js.map +1 -1
- package/dist/plops/prompts/get-destination-prompts.mjs.map +1 -1
- package/dist/plops/prompts/kind-prompts.js.map +1 -1
- package/dist/plops/prompts/kind-prompts.mjs.map +1 -1
- package/dist/plops/service.js.map +1 -1
- package/dist/plops/service.mjs.map +1 -1
- package/dist/plops/utils/extend-plugin-index-files.js +6 -6
- package/dist/plops/utils/extend-plugin-index-files.js.map +1 -1
- package/dist/plops/utils/extend-plugin-index-files.mjs +6 -6
- package/dist/plops/utils/extend-plugin-index-files.mjs.map +1 -1
- package/dist/plops/utils/get-file-path.js.map +1 -1
- package/dist/plops/utils/get-file-path.mjs.map +1 -1
- package/dist/plops/utils/get-formatted-date.js.map +1 -1
- package/dist/plops/utils/get-formatted-date.mjs.map +1 -1
- package/dist/plops/utils/validate-attribute-input.js.map +1 -1
- package/dist/plops/utils/validate-attribute-input.mjs.map +1 -1
- package/dist/plops/utils/validate-file-name-input.js.map +1 -1
- package/dist/plops/utils/validate-file-name-input.mjs.map +1 -1
- package/dist/plops/utils/validate-input.js.map +1 -1
- package/dist/plops/utils/validate-input.mjs.map +1 -1
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.mjs","sources":["../../src/plops/middleware.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/middlewares/{{ name }}.${language}`,\n templateFile: `templates/${language}/middleware.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/middlewares/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/middlewares/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new middleware to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/middlewares/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.name });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateInput","getDestinationPrompts","getDestBasePath","rootFolder","actions","answers","filePath","getFilePath","destination","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName"],"mappings":";;;;;;;;AAUA,yBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,
|
|
1
|
+
{"version":3,"file":"middleware.mjs","sources":["../../src/plops/middleware.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/middlewares/{{ name }}.${language}`,\n templateFile: `templates/${language}/middleware.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/middlewares/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/middlewares/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new middleware to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/middlewares/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.name });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateInput","getDestinationPrompts","getDestBasePath","rootFolder","actions","answers","filePath","getFilePath","destination","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName"],"mappings":";;;;;;;;AAUA,yBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,IAAAA,CAAKC,YAAY,CAAC,YAAA,EAAc;QAC9BC,WAAAA,EAAa,kCAAA;QACbC,OAAAA,EAAS;AACP,YAAA;gBACEC,IAAAA,EAAM,OAAA;gBACNC,IAAAA,EAAM,MAAA;gBACNC,OAAAA,EAAS,iBAAA;gBACTC,QAAAA,EAAU,CAACC,QAAUC,aAAAA,CAAcD,KAAAA;AACrC,aAAA;eACGE,qBAAAA,CAAsB,YAAA,EAAcV,IAAAA,CAAKW,eAAe,EAAA,EAAI;gBAAEC,UAAAA,E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CAAYO,IAAI,CAAC;wBACf/B,IAAAA,EAAM,KAAA;AACNyB,wBAAAA,IAAAA,EAAM,CAAA,EAAGd,QAAAA,CAAS,mBAAmB,EAAEM,QAAAA,CAAAA,CAAU;wBACjDS,YAAAA,EAAc,CAAC,UAAU,EAAET,QAAAA,CAAS,qBAAqB,EAAEA,QAAAA,CAAS,IAAI,CAAC;wBACzEe,YAAAA,EAAc;AAChB,qBAAA,CAAA;AACF,gBAAA;;AAGAR,gBAAAA,WAAAA,CAAYO,IAAI,CAAC;oBACf/B,IAAAA,EAAM,QAAA;AACNyB,oBAAAA,IAAAA,EAAM,CAAA,EAAGd,QAAAA,CAAS,mBAAmB,EAAEM,QAAAA,CAAAA,CAAU;AACjDgB,oBAAAA,SAAAA,CAAAA,CAAUC,QAAgB,EAAA;AACxB,wBAAA,OAAOC,aAAaD,QAAAA,EAAU;4BAAElC,IAAAA,EAAM,OAAA;AAASoC,4BAAAA,YAAAA,EAAc1B,QAAQT;AAAK,yBAAA,CAAA;AAC5E,oBAAA;AACF,iBAAA,CAAA;AACF,YAAA;YAEA,OAAOuB,WAAAA;AACT,QAAA;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.js","sources":["../../src/plops/migration.ts"],"sourcesContent":["import type { 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"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateFileNameInput","actions","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","timestamp","getFormattedDate","path","templateFile"],"mappings":";;;;;;AAKA,wBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,
|
|
1
|
+
{"version":3,"file":"migration.js","sources":["../../src/plops/migration.ts"],"sourcesContent":["import type { 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"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateFileNameInput","actions","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","timestamp","getFormattedDate","path","templateFile"],"mappings":";;;;;;AAKA,wBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,IAAAA,CAAKC,YAAY,CAAC,WAAA,EAAa;QAC7BC,WAAAA,EAAa,sBAAA;QACbC,OAAAA,EAAS;AACP,YAAA;gBACEC,IAAAA,EAAM,OAAA;gBACNC,IAAAA,EAAM,MAAA;gBACNC,OAAAA,EAAS,gBAAA;gBACTC,QAAAA,EAAU,CAACC,QAAUC,qBAAAA,CAAsBD,KAAAA;AAC7C;AACD,SAAA;AACDE,QAAAA,OAAAA,CAAAA,GAAAA;YACE,MAAMC,UAAAA,GAAaC,QAAQC,GAAG,EAAA;AAC9B,YAAA,MAAMC,QAAAA,GAAWC,OAAAA,CAAQC,qBAAqB,CAACL,cAAc,IAAA,GAAO,IAAA;AACpE,YAAA,MAAMM,SAAAA,GAAYC,gBAAAA,EAAAA;YAElB,OAAO;AACL,gBAAA;oBACEd,IAAAA,EAAM,KAAA;AACNe,oBAAAA,IAAAA,EAAM,GAAGR,UAAAA,CAAW,qBAAqB,EAAEM,SAAAA,CAAU,YAAY,EAAEH,QAAAA,CAAAA,CAAU;oBAC7EM,YAAAA,EAAc,CAAC,UAAU,EAAEN,QAAAA,CAAS,WAAW,EAAEA,QAAAA,CAAS,IAAI;AAChE;AACD,aAAA;AACH,QAAA;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.mjs","sources":["../../src/plops/migration.ts"],"sourcesContent":["import type { 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"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateFileNameInput","actions","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","timestamp","getFormattedDate","path","templateFile"],"mappings":";;;;AAKA,wBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,
|
|
1
|
+
{"version":3,"file":"migration.mjs","sources":["../../src/plops/migration.ts"],"sourcesContent":["import type { 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"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateFileNameInput","actions","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","timestamp","getFormattedDate","path","templateFile"],"mappings":";;;;AAKA,wBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,IAAAA,CAAKC,YAAY,CAAC,WAAA,EAAa;QAC7BC,WAAAA,EAAa,sBAAA;QACbC,OAAAA,EAAS;AACP,YAAA;gBACEC,IAAAA,EAAM,OAAA;gBACNC,IAAAA,EAAM,MAAA;gBACNC,OAAAA,EAAS,gBAAA;gBACTC,QAAAA,EAAU,CAACC,QAAUC,qBAAAA,CAAsBD,KAAAA;AAC7C;AACD,SAAA;AACDE,QAAAA,OAAAA,CAAAA,GAAAA;YACE,MAAMC,UAAAA,GAAaC,QAAQC,GAAG,EAAA;AAC9B,YAAA,MAAMC,QAAAA,GAAWC,OAAAA,CAAQC,qBAAqB,CAACL,cAAc,IAAA,GAAO,IAAA;AACpE,YAAA,MAAMM,SAAAA,GAAYC,gBAAAA,EAAAA;YAElB,OAAO;AACL,gBAAA;oBACEd,IAAAA,EAAM,KAAA;AACNe,oBAAAA,IAAAA,EAAM,GAAGR,UAAAA,CAAW,qBAAqB,EAAEM,SAAAA,CAAU,YAAY,EAAEH,QAAAA,CAAAA,CAAU;oBAC7EM,YAAAA,EAAc,CAAC,UAAU,EAAEN,QAAAA,CAAS,WAAW,EAAEA,QAAAA,CAAS,IAAI;AAChE;AACD,aAAA;AACH,QAAA;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
|
package/dist/plops/policy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sources":["../../src/plops/policy.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 currentDir = process.cwd();\n const filePath = getFilePath(answers.destination);\n let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/policies/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/policies/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new policy to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/policies/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateInput","getDestinationPrompts","getDestBasePath","rootFolder","actions","answers","currentDir","process","cwd","filePath","getFilePath","destination","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;;;;AAUA,qBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,
|
|
1
|
+
{"version":3,"file":"policy.js","sources":["../../src/plops/policy.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 currentDir = process.cwd();\n const filePath = getFilePath(answers.destination);\n let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/policies/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/policies/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new policy to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/policies/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateInput","getDestinationPrompts","getDestBasePath","rootFolder","actions","answers","currentDir","process","cwd","filePath","getFilePath","destination","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;;;;AAUA,qBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,IAAAA,CAAKC,YAAY,CAAC,QAAA,EAAU;QAC1BC,WAAAA,EAAa,8BAAA;QACbC,OAAAA,EAAS;AACP,YAAA;gBACEC,IAAAA,EAAM,OAAA;gBACNC,IAAAA,EAAM,IAAA;gBACNC,OAAAA,EAAS,aAAA;gBACTC,QAAAA,EAAU,CAACC,QAAUC,aAAAA,CAAcD,KAAAA;AACrC,aAAA;eACGE,qBAAAA,CAAsB,QAAA,EAAUV,IAAAA,CAAKW,eAAe,EAAA,EAAI;gBAAEC,UAAAA,EAAY;A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,IAAI,CAAC;wBACf/B,IAAAA,EAAM,KAAA;AACNyB,wBAAAA,IAAAA,EAAM,CAAA,EAAGX,QAAAA,CAAS,gBAAgB,EAAEG,QAAAA,CAAAA,CAAU;wBAC9CS,YAAAA,EAAc,CAAC,UAAU,EAAET,QAAAA,CAAS,qBAAqB,EAAEA,QAAAA,CAAS,IAAI,CAAC;wBACzEe,YAAAA,EAAc;AAChB,qBAAA,CAAA;AACF,gBAAA;;AAGAR,gBAAAA,WAAAA,CAAYO,IAAI,CAAC;oBACf/B,IAAAA,EAAM,QAAA;AACNyB,oBAAAA,IAAAA,EAAM,CAAA,EAAGX,QAAAA,CAAS,gBAAgB,EAAEG,QAAAA,CAAAA,CAAU;AAC9CgB,oBAAAA,SAAAA,CAAAA,CAAUC,QAAgB,EAAA;AACxB,wBAAA,OAAOC,oCAAaD,QAAAA,EAAU;4BAAElC,IAAAA,EAAM,OAAA;AAASoC,4BAAAA,YAAAA,EAAc1B,QAAQ2B;AAAG,yBAAA,CAAA;AAC1E,oBAAA;AACF,iBAAA,CAAA;AACF,YAAA;YAEA,OAAOb,WAAAA;AACT,QAAA;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.mjs","sources":["../../src/plops/policy.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 currentDir = process.cwd();\n const filePath = getFilePath(answers.destination);\n let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/policies/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/policies/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new policy to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/policies/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateInput","getDestinationPrompts","getDestBasePath","rootFolder","actions","answers","currentDir","process","cwd","filePath","getFilePath","destination","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;;AAUA,qBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,
|
|
1
|
+
{"version":3,"file":"policy.mjs","sources":["../../src/plops/policy.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport validateInput from './utils/validate-input';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 currentDir = process.cwd();\n const filePath = getFilePath(answers.destination);\n let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/policies/{{ id }}.${language}`,\n templateFile: `templates/${language}/policy.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/policies/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/policies/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new policy to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/policies/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","validate","input","validateInput","getDestinationPrompts","getDestBasePath","rootFolder","actions","answers","currentDir","process","cwd","filePath","getFilePath","destination","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;;AAUA,qBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,IAAAA,CAAKC,YAAY,CAAC,QAAA,EAAU;QAC1BC,WAAAA,EAAa,8BAAA;QACbC,OAAAA,EAAS;AACP,YAAA;gBACEC,IAAAA,EAAM,OAAA;gBACNC,IAAAA,EAAM,IAAA;gBACNC,OAAAA,EAAS,aAAA;gBACTC,QAAAA,EAAU,CAACC,QAAUC,aAAAA,CAAcD,KAAAA;AACrC,aAAA;eACGE,qBAAAA,CAAsB,QAAA,EAAUV,IAAAA,CAAKW,eAAe,EAAA,EAAI;gBAAEC,UAAAA,EAAY;AAAK,aAAA;AAC/E,SAAA;AACDC,QAAAA,OAAAA,CAAAA,CAAQC,OAAO,EAAA;AACb,YAAA,IAAI,CAACA,OAAAA,EAAS;AACZ,gBAAA,OAAO,EAAE;AACX,YAAA;YAEA,MAAMC,UAAAA,GAAaC,QAAQC,GAAG,EAAA;YAC9B,MAAMC,QAAAA,GAAWC,WAAAA,CAAYL,OAAAA,CAAQM,WAAW,CAAA;AAChD,YAAA,IAAIC,QAAAA,GAAWC,OAAAA,CAAQC,qBAAqB,CAACR,cAAc,IAAA,GAAO,IAAA;YAElE,IAAID,OAAAA,CAAQU,MAAM,EAAE;;gBAElB,MAAMC,eAAAA,GAAkBC,IAAAA,CACtBX,UAAAA,EACA,KAAA,EACAG,QAAAA,CAASS,OAAO,CAAC,cAAA,EAAgBb,OAAAA,CAAQU,MAAM,CAAA,EAC/C,KAAA,CAAA;AAEFH,gBAAAA,QAAAA,GAAWC,OAAAA,CAAQC,qBAAqB,CAACE,eAAAA,CAAAA,GAAmB,IAAA,GAAO,IAAA;AACrE,YAAA;AAEA,YAAA,MAAMG,WAAAA,GAAiC;AACrC,gBAAA;oBACExB,IAAAA,EAAM,KAAA;AACNyB,oBAAAA,IAAAA,EAAM,CAAA,EAAGX,QAAAA,CAA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":"bootstrap-api-prompts.js","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"sourcesContent":["const questions = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n"],"names":["questions","type","name","default","message"],"mappings":";;AAAA,MAAMA,
|
|
1
|
+
{"version":3,"file":"bootstrap-api-prompts.js","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"sourcesContent":["const questions = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n"],"names":["questions","type","name","default","message"],"mappings":";;AAAA,MAAMA,SAAAA,GAAY;AAChB,IAAA;QACEC,IAAAA,EAAM,SAAA;QACNC,IAAAA,EAAM,cAAA;QACNC,OAAAA,EAAS,IAAA;QACTC,OAAAA,EAAS;AACX;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-api-prompts.mjs","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"sourcesContent":["const questions = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n"],"names":["questions","type","name","default","message"],"mappings":"AAAA,MAAMA,
|
|
1
|
+
{"version":3,"file":"bootstrap-api-prompts.mjs","sources":["../../../src/plops/prompts/bootstrap-api-prompts.ts"],"sourcesContent":["const questions = [\n {\n type: 'confirm',\n name: 'bootstrapApi',\n default: true,\n message: 'Bootstrap API related files?',\n },\n];\n\nexport default questions;\n"],"names":["questions","type","name","default","message"],"mappings":"AAAA,MAAMA,SAAAA,GAAY;AAChB,IAAA;QACEC,IAAAA,EAAM,SAAA;QACNC,IAAAA,EAAM,cAAA;QACNC,OAAAA,EAAS,IAAA;QACTC,OAAAA,EAAS;AACX;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-names-prompts.js","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"sourcesContent":["import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport { strings } from '@strapi/utils';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions = [\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: string) {\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"],"names":["questions","type","name","message","validate","input","default","answers","slugify","displayName","strings","isKebabCase","pluralize","singularName"],"mappings":";;;;;;AAUA,MAAMA,
|
|
1
|
+
{"version":3,"file":"ct-names-prompts.js","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"sourcesContent":["import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport { strings } from '@strapi/utils';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions = [\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: string) {\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"],"names":["questions","type","name","message","validate","input","default","answers","slugify","displayName","strings","isKebabCase","pluralize","singularName"],"mappings":";;;;;;AAUA,MAAMA,SAAAA,GAAY;AAChB,IAAA;QACEC,IAAAA,EAAM,OAAA;QACNC,IAAAA,EAAM,aAAA;QACNC,OAAAA,EAAS,2BAAA;QACTC,QAAAA,EAAU,CAACC,KAAAA,GAAkB,CAAC,CAACA;AACjC,KAAA;AACA,IAAA;QACEJ,IAAAA,EAAM,OAAA;QACNC,IAAAA,EAAM,cAAA;QACNC,OAAAA,EAAS,4BAAA;AACTG,QAAAA,OAAAA,EAAS,CAACC,OAAAA,GAAqBC,OAAAA,CAAQD,OAAAA,CAAQE,WAAW,CAAA;AAC1DL,QAAAA,QAAAA,CAAAA,CAASC,KAAa,EAAA;AACpB,YAAA,IAAI,CAACK,aAAAA,CAAQC,WAAW,CAACN,KAAAA,CAAAA,EAAQ;gBAC/B,OAAO,6BAAA;AACT,YAAA;YAEA,OAAO,IAAA;AACT,QAAA;AACF,KAAA;AACA,IAAA;QACEJ,IAAAA,EAAM,OAAA;QACNC,IAAAA,EAAM,YAAA;QACNC,OAAAA,EAAS,0BAAA;AACTG,QAAAA,OAAAA,EAAS,CAACC,OAAAA,GAAqBK,SAAAA,CAAUL,OAAAA,CAAQM,YAAY,CAAA;QAC7DT,QAAAA,CAAAA,CAASC,KAAa,EAAEE,OAAgB,EAAA;YACtC,IAAIA,OAAAA,CAAQM,YAAY,KAAKR,KAAAA,EAAO;gBAClC,OAAO,8CAAA;AACT,YAAA;AAEA,YAAA,IAAI,CAACK,aAAAA,CAAQC,WAAW,CAACN,KAAAA,CAAAA,EAAQ;gBAC/B,OAAO,6BAAA;AACT,YAAA;YAEA,OAAO,IAAA;AACT,QAAA;AACF;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-names-prompts.mjs","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"sourcesContent":["import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport { strings } from '@strapi/utils';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions = [\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: string) {\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"],"names":["questions","type","name","message","validate","input","default","answers","slugify","displayName","strings","isKebabCase","pluralize","singularName"],"mappings":";;;;AAUA,MAAMA,
|
|
1
|
+
{"version":3,"file":"ct-names-prompts.mjs","sources":["../../../src/plops/prompts/ct-names-prompts.ts"],"sourcesContent":["import pluralize from 'pluralize';\nimport slugify from '@sindresorhus/slugify';\nimport { strings } from '@strapi/utils';\n\ninterface Answers {\n displayName: string;\n singularName: string;\n pluralName: string;\n}\n\nconst questions = [\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: string) {\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"],"names":["questions","type","name","message","validate","input","default","answers","slugify","displayName","strings","isKebabCase","pluralize","singularName"],"mappings":";;;;AAUA,MAAMA,SAAAA,GAAY;AAChB,IAAA;QACEC,IAAAA,EAAM,OAAA;QACNC,IAAAA,EAAM,aAAA;QACNC,OAAAA,EAAS,2BAAA;QACTC,QAAAA,EAAU,CAACC,KAAAA,GAAkB,CAAC,CAACA;AACjC,KAAA;AACA,IAAA;QACEJ,IAAAA,EAAM,OAAA;QACNC,IAAAA,EAAM,cAAA;QACNC,OAAAA,EAAS,4BAAA;AACTG,QAAAA,OAAAA,EAAS,CAACC,OAAAA,GAAqBC,OAAAA,CAAQD,OAAAA,CAAQE,WAAW,CAAA;AAC1DL,QAAAA,QAAAA,CAAAA,CAASC,KAAa,EAAA;AACpB,YAAA,IAAI,CAACK,OAAAA,CAAQC,WAAW,CAACN,KAAAA,CAAAA,EAAQ;gBAC/B,OAAO,6BAAA;AACT,YAAA;YAEA,OAAO,IAAA;AACT,QAAA;AACF,KAAA;AACA,IAAA;QACEJ,IAAAA,EAAM,OAAA;QACNC,IAAAA,EAAM,YAAA;QACNC,OAAAA,EAAS,0BAAA;AACTG,QAAAA,OAAAA,EAAS,CAACC,OAAAA,GAAqBK,SAAAA,CAAUL,OAAAA,CAAQM,YAAY,CAAA;QAC7DT,QAAAA,CAAAA,CAASC,KAAa,EAAEE,OAAgB,EAAA;YACtC,IAAIA,OAAAA,CAAQM,YAAY,KAAKR,KAAAA,EAAO;gBAClC,OAAO,8CAAA;AACT,YAAA;AAEA,YAAA,IAAI,CAACK,OAAAA,CAAQC,WAAW,CAACN,KAAAA,CAAAA,EAAQ;gBAC/B,OAAO,6BAAA;AACT,YAAA;YAEA,OAAO,IAAA;AACT,QAAA;AACF;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-attributes-prompts.js","sources":["../../../src/plops/prompts/get-attributes-prompts.ts"],"sourcesContent":["import validateAttributeInput from '../utils/validate-attribute-input';\n\ninterface AttributeAnswer {\n attributeName: string;\n attributeType: (typeof DEFAULT_TYPES)[number];\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 = async (inquirer: any) => {\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: any) => {\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: AttributeAnswer) => answers.attributeType === 'enumeration',\n type: 'input',\n name: 'enum',\n message: 'Add values separated by a comma',\n },\n {\n when: (answers: AttributeAnswer) => 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"],"names":["DEFAULT_TYPES","getAttributesPrompts","inquirer","addAttributes","prompt","type","name","message","attributes","createNewAttributes","answers","validate","input","validateAttributeInput","pageSize","length","choices","map","value","when","attributeType","push","console","warn"],"mappings":";;;;AASA,MAAMA,
|
|
1
|
+
{"version":3,"file":"get-attributes-prompts.js","sources":["../../../src/plops/prompts/get-attributes-prompts.ts"],"sourcesContent":["import validateAttributeInput from '../utils/validate-attribute-input';\n\ninterface AttributeAnswer {\n attributeName: string;\n attributeType: (typeof DEFAULT_TYPES)[number];\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 = async (inquirer: any) => {\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: any) => {\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: AttributeAnswer) => answers.attributeType === 'enumeration',\n type: 'input',\n name: 'enum',\n message: 'Add values separated by a comma',\n },\n {\n when: (answers: AttributeAnswer) => 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"],"names":["DEFAULT_TYPES","getAttributesPrompts","inquirer","addAttributes","prompt","type","name","message","attributes","createNewAttributes","answers","validate","input","validateAttributeInput","pageSize","length","choices","map","value","when","attributeType","push","console","warn"],"mappings":";;;;AASA,MAAMA,aAAAA,GAAgB;;AAEpB,IAAA,OAAA;;AAGA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,MAAA;AACA,IAAA,aAAA;AACA,IAAA,UAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,YAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,WAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,uBAAuB,OAAOC,QAAAA,GAAAA;AAClC,IAAA,MAAM,EAAEC,aAAa,EAAE,GAAG,MAAMD,QAAAA,CAASE,MAAM,CAAC;AAC9C,QAAA;YACEC,IAAAA,EAAM,SAAA;YACNC,IAAAA,EAAM,eAAA;YACNC,OAAAA,EAAS;AACX;AACD,KAAA,CAAA;AAED,IAAA,MAAMC,aAAqC,EAAE;AAE7C;;;MAIA,MAAMC,sBAAsB,OAAOP,QAAAA,GAAAA;AACjC,QAAA,MAAMQ,OAAAA,GAAU,MAAMR,QAAAA,CAASE,MAAM,CAAC;AACpC,YAAA;gBACEC,IAAAA,EAAM,OAAA;gBACNC,IAAAA,EAAM,eAAA;gBACNC,OAAAA,EAAS,mBAAA;gBACTI,QAAAA,EAAU,CAACC,QAAkBC,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,MAAMM,mBAAAA,CAAoBP,QAAAA,CAAAA;IAC5B,CAAA,MAAO;AACLoB,QAAAA,OAAAA,CAAQC,IAAI,CACV,CAAC,qHAAqH,CAAC,CAAA;AAE3H,IAAA;IAEA,OAAOf,UAAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-attributes-prompts.mjs","sources":["../../../src/plops/prompts/get-attributes-prompts.ts"],"sourcesContent":["import validateAttributeInput from '../utils/validate-attribute-input';\n\ninterface AttributeAnswer {\n attributeName: string;\n attributeType: (typeof DEFAULT_TYPES)[number];\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 = async (inquirer: any) => {\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: any) => {\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: AttributeAnswer) => answers.attributeType === 'enumeration',\n type: 'input',\n name: 'enum',\n message: 'Add values separated by a comma',\n },\n {\n when: (answers: AttributeAnswer) => 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"],"names":["DEFAULT_TYPES","getAttributesPrompts","inquirer","addAttributes","prompt","type","name","message","attributes","createNewAttributes","answers","validate","input","validateAttributeInput","pageSize","length","choices","map","value","when","attributeType","push","console","warn"],"mappings":";;AASA,MAAMA,
|
|
1
|
+
{"version":3,"file":"get-attributes-prompts.mjs","sources":["../../../src/plops/prompts/get-attributes-prompts.ts"],"sourcesContent":["import validateAttributeInput from '../utils/validate-attribute-input';\n\ninterface AttributeAnswer {\n attributeName: string;\n attributeType: (typeof DEFAULT_TYPES)[number];\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 = async (inquirer: any) => {\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: any) => {\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: AttributeAnswer) => answers.attributeType === 'enumeration',\n type: 'input',\n name: 'enum',\n message: 'Add values separated by a comma',\n },\n {\n when: (answers: AttributeAnswer) => 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"],"names":["DEFAULT_TYPES","getAttributesPrompts","inquirer","addAttributes","prompt","type","name","message","attributes","createNewAttributes","answers","validate","input","validateAttributeInput","pageSize","length","choices","map","value","when","attributeType","push","console","warn"],"mappings":";;AASA,MAAMA,aAAAA,GAAgB;;AAEpB,IAAA,OAAA;;AAGA,IAAA,QAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,MAAA;AACA,IAAA,aAAA;AACA,IAAA,UAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,YAAA;AACA,IAAA,OAAA;AACA,IAAA,SAAA;AACA,IAAA,MAAA;AACA,IAAA,MAAA;AACA,IAAA,UAAA;AACA,IAAA,WAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,uBAAuB,OAAOC,QAAAA,GAAAA;AAClC,IAAA,MAAM,EAAEC,aAAa,EAAE,GAAG,MAAMD,QAAAA,CAASE,MAAM,CAAC;AAC9C,QAAA;YACEC,IAAAA,EAAM,SAAA;YACNC,IAAAA,EAAM,eAAA;YACNC,OAAAA,EAAS;AACX;AACD,KAAA,CAAA;AAED,IAAA,MAAMC,aAAqC,EAAE;AAE7C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A;AAEDC,QAAAA,UAAAA,CAAWa,IAAI,CAACX,OAAAA,CAAAA;QAEhB,IAAI,CAACA,OAAAA,CAAQP,aAAa,EAAE;AAC1B,YAAA;AACF,QAAA;AAEA,QAAA,MAAMM,mBAAAA,CAAoBP,QAAAA,CAAAA;AAC5B,IAAA,CAAA;AAEA,IAAA,IAAIC,aAAAA,EAAe;AACjB,QAAA,MAAMM,mBAAAA,CAAoBP,QAAAA,CAAAA;IAC5B,CAAA,MAAO;AACLoB,QAAAA,OAAAA,CAAQC,IAAI,CACV,CAAC,qHAAqH,CAAC,CAAA;AAE3H,IAAA;IAEA,OAAOf,UAAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-destination-prompts.js","sources":["../../../src/plops/prompts/get-destination-prompts.ts"],"sourcesContent":["import { join } from 'path';\nimport fs from 'fs-extra';\n\nexport default (action: string, basePath: string, { rootFolder = false } = {}) => {\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: any) => 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: any) => 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"],"names":["action","basePath","rootFolder","type","name","message","choices","value","when","answers","destination","apiPath","join","exists","fs","pathExists","Error","apiDir","readdir","withFileTypes","apiDirContent","filter","fd","isDirectory","length","pluginsPath","pluginsDir","pluginsDirContent","api","lstatSync"],"mappings":";;;;;AAGA,4BAAe,CAAA,CAACA,MAAAA,EAAgBC,
|
|
1
|
+
{"version":3,"file":"get-destination-prompts.js","sources":["../../../src/plops/prompts/get-destination-prompts.ts"],"sourcesContent":["import { join } from 'path';\nimport fs from 'fs-extra';\n\nexport default (action: string, basePath: string, { rootFolder = false } = {}) => {\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: any) => 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: any) => 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"],"names":["action","basePath","rootFolder","type","name","message","choices","value","when","answers","destination","apiPath","join","exists","fs","pathExists","Error","apiDir","readdir","withFileTypes","apiDirContent","filter","fd","isDirectory","length","pluginsPath","pluginsDir","pluginsDirContent","api","lstatSync"],"mappings":";;;;;AAGA,4BAAe,CAAA,CAACA,MAAAA,EAAgBC,QAAAA,EAAkB,EAAEC,aAAa,KAAK,EAAE,GAAG,EAAE,GAAA;IAC3E,OAAO;AACL,QAAA;YACEC,IAAAA,EAAM,MAAA;YACNC,IAAAA,EAAM,aAAA;AACNC,YAAAA,OAAAA,EAAS,CAAC,8BAA8B,EAAEL,MAAAA,CAAO,CAAC,CAAC;YACnDM,OAAAA,EAAS;mBACHJ,UAAAA,GACA;AACE,oBAAA;AACEE,wBAAAA,IAAAA,EAAM,CAAC,IAAI,EAAEJ,MAAAA,CAAO,mBAAmB,CAAC;wBACxCO,KAAAA,EAAO;AACT;iBACD,GACD;AACE,oBAAA;AACEH,wBAAAA,IAAAA,EAAM,CAAC,IAAI,EAAEJ,MAAAA,CAAO,WAAW,CAAC;wBAChCO,KAAAA,EAAO;AACT;AACD,iBAAA;AACL,gBAAA;AAAEH,oBAAAA,IAAAA,EAAM,CAAC,IAAI,EAAEJ,MAAAA,CAAO,mBAAmB,CAAC;oBAAEO,KAAAA,EAAO;AAAM,iBAAA;AACzD,gBAAA;AAAEH,oBAAAA,IAAAA,EAAM,CAAC,IAAI,EAAEJ,MA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,WAAAA,CAAAA;AAEnC,gBAAA,IAAI,CAACZ,MAAAA,EAAQ;AACX,oBAAA,MAAMG,KAAAA,CAAM,sCAAA,CAAA;AACd,gBAAA;AAEA,gBAAA,MAAMU,UAAAA,GAAa,MAAMZ,EAAAA,CAAGI,OAAO,CAACO,WAAAA,CAAAA;AACpC,gBAAA,MAAME,iBAAAA,GAAoBD,UAAAA,CAAWL,MAAM,CAAC,CAACO,GAAAA,GAC3Cd,EAAAA,CAAGe,SAAS,CAACjB,SAAAA,CAAKa,WAAAA,EAAaG,GAAAA,CAAAA,CAAAA,CAAML,WAAW,EAAA,CAAA;gBAGlD,IAAII,iBAAAA,CAAkBH,MAAM,KAAK,CAAA,EAAG;AAClC,oBAAA,MAAMR,KAAAA,CAAM,kCAAA,CAAA;AACd,gBAAA;gBAEA,OAAOW,iBAAAA;AACT,YAAA;AACF;AACD,KAAA;AACH,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-destination-prompts.mjs","sources":["../../../src/plops/prompts/get-destination-prompts.ts"],"sourcesContent":["import { join } from 'path';\nimport fs from 'fs-extra';\n\nexport default (action: string, basePath: string, { rootFolder = false } = {}) => {\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: any) => 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: any) => 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"],"names":["action","basePath","rootFolder","type","name","message","choices","value","when","answers","destination","apiPath","join","exists","fs","pathExists","Error","apiDir","readdir","withFileTypes","apiDirContent","filter","fd","isDirectory","length","pluginsPath","pluginsDir","pluginsDirContent","api","lstatSync"],"mappings":";;;AAGA,4BAAe,CAAA,CAACA,MAAAA,EAAgBC,
|
|
1
|
+
{"version":3,"file":"get-destination-prompts.mjs","sources":["../../../src/plops/prompts/get-destination-prompts.ts"],"sourcesContent":["import { join } from 'path';\nimport fs from 'fs-extra';\n\nexport default (action: string, basePath: string, { rootFolder = false } = {}) => {\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: any) => 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: any) => 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"],"names":["action","basePath","rootFolder","type","name","message","choices","value","when","answers","destination","apiPath","join","exists","fs","pathExists","Error","apiDir","readdir","withFileTypes","apiDirContent","filter","fd","isDirectory","length","pluginsPath","pluginsDir","pluginsDirContent","api","lstatSync"],"mappings":";;;AAGA,4BAAe,CAAA,CAACA,MAAAA,EAAgBC,QAAAA,EAAkB,EAAEC,aAAa,KAAK,EAAE,GAAG,EAAE,GAAA;IAC3E,OAAO;AACL,QAAA;YACEC,IAAAA,EAAM,MAAA;YACNC,IAAAA,EAAM,aAAA;AACNC,YAAAA,OAAAA,EAAS,CAAC,8BAA8B,EAAEL,MAAAA,CAAO,CAAC,CAAC;YACnDM,OAAAA,EAAS;mBACHJ,UAAAA,GACA;AACE,oBAAA;AACEE,wBAAAA,IAAAA,EAAM,CAAC,IAAI,EAAEJ,MAAAA,CAAO,mBAAmB,CAAC;wBACxCO,KAAAA,EAAO;AACT;iBACD,GACD;AACE,oBAAA;AACEH,wBAAAA,IAAAA,EAAM,CAAC,IAAI,EAAEJ,MAAAA,CAAO,WAAW,CAAC;wBAChCO,KAAAA,EAAO;AACT;AACD,iBAAA;AACL,gBAAA;AAAEH,oBAAAA,IAAA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MAAME,OAAAA,CAAAA,GAAAA;gBACJ,MAAMmB,WAAAA,GAAcb,KAAKX,QAAAA,EAAU,SAAA,CAAA;AACnC,gBAAA,MAAMY,MAAAA,GAAS,MAAMC,EAAAA,CAAGC,UAAU,CAACU,WAAAA,CAAAA;AAEnC,gBAAA,IAAI,CAACZ,MAAAA,EAAQ;AACX,oBAAA,MAAMG,KAAAA,CAAM,sCAAA,CAAA;AACd,gBAAA;AAEA,gBAAA,MAAMU,UAAAA,GAAa,MAAMZ,EAAAA,CAAGI,OAAO,CAACO,WAAAA,CAAAA;AACpC,gBAAA,MAAME,iBAAAA,GAAoBD,UAAAA,CAAWL,MAAM,CAAC,CAACO,GAAAA,GAC3Cd,EAAAA,CAAGe,SAAS,CAACjB,IAAAA,CAAKa,WAAAA,EAAaG,GAAAA,CAAAA,CAAAA,CAAML,WAAW,EAAA,CAAA;gBAGlD,IAAII,iBAAAA,CAAkBH,MAAM,KAAK,CAAA,EAAG;AAClC,oBAAA,MAAMR,KAAAA,CAAM,kCAAA,CAAA;AACd,gBAAA;gBAEA,OAAOW,iBAAAA;AACT,YAAA;AACF;AACD,KAAA;AACH,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kind-prompts.js","sources":["../../../src/plops/prompts/kind-prompts.ts"],"sourcesContent":["import validateInput from '../utils/validate-input';\n\nconst questions = [\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"],"names":["questions","type","name","message","default","choices","value","validate","input","validateInput"],"mappings":";;;;AAEA,MAAMA,
|
|
1
|
+
{"version":3,"file":"kind-prompts.js","sources":["../../../src/plops/prompts/kind-prompts.ts"],"sourcesContent":["import validateInput from '../utils/validate-input';\n\nconst questions = [\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"],"names":["questions","type","name","message","default","choices","value","validate","input","validateInput"],"mappings":";;;;AAEA,MAAMA,SAAAA,GAAY;AAChB,IAAA;QACEC,IAAAA,EAAM,MAAA;QACNC,IAAAA,EAAM,MAAA;QACNC,OAAAA,EAAS,8BAAA;QACTC,OAAAA,EAAS,gBAAA;QACTC,OAAAA,EAAS;AACP,YAAA;gBAAEH,IAAAA,EAAM,iBAAA;gBAAmBI,KAAAA,EAAO;AAAiB,aAAA;AACnD,YAAA;gBAAEJ,IAAAA,EAAM,aAAA;gBAAeI,KAAAA,EAAO;AAAa;AAC5C,SAAA;QACDC,QAAAA,EAAU,CAACC,QAAkBC,aAAAA,CAAcD,KAAAA;AAC7C;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kind-prompts.mjs","sources":["../../../src/plops/prompts/kind-prompts.ts"],"sourcesContent":["import validateInput from '../utils/validate-input';\n\nconst questions = [\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"],"names":["questions","type","name","message","default","choices","value","validate","input","validateInput"],"mappings":";;AAEA,MAAMA,
|
|
1
|
+
{"version":3,"file":"kind-prompts.mjs","sources":["../../../src/plops/prompts/kind-prompts.ts"],"sourcesContent":["import validateInput from '../utils/validate-input';\n\nconst questions = [\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"],"names":["questions","type","name","message","default","choices","value","validate","input","validateInput"],"mappings":";;AAEA,MAAMA,SAAAA,GAAY;AAChB,IAAA;QACEC,IAAAA,EAAM,MAAA;QACNC,IAAAA,EAAM,MAAA;QACNC,OAAAA,EAAS,8BAAA;QACTC,OAAAA,EAAS,gBAAA;QACTC,OAAAA,EAAS;AACP,YAAA;gBAAEH,IAAAA,EAAM,iBAAA;gBAAmBI,KAAAA,EAAO;AAAiB,aAAA;AACnD,YAAA;gBAAEJ,IAAAA,EAAM,aAAA;gBAAeI,KAAAA,EAAO;AAAa;AAC5C,SAAA;QACDC,QAAAA,EAAU,CAACC,QAAkBC,aAAAA,CAAcD,KAAAA;AAC7C;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sources":["../../src/plops/service.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/services/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/services/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new service to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/services/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","getDestinationPrompts","getDestBasePath","actions","answers","filePath","getFilePath","destination","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;;;AASA,sBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,
|
|
1
|
+
{"version":3,"file":"service.js","sources":["../../src/plops/service.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/services/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/services/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new service to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/services/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","getDestinationPrompts","getDestBasePath","actions","answers","filePath","getFilePath","destination","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;;;AASA,sBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,IAAAA,CAAKC,YAAY,CAAC,SAAA,EAAW;QAC3BC,WAAAA,EAAa,+BAAA;QACbC,OAAAA,EAAS;AACP,YAAA;gBACEC,IAAAA,EAAM,OAAA;gBACNC,IAAAA,EAAM,IAAA;gBACNC,OAAAA,EAAS;AACX,aAAA;eACGC,qBAAAA,CAAsB,SAAA,EAAWP,KAAKQ,eAAe,EAAA;AACzD,SAAA;AACDC,QAAAA,OAAAA,CAAAA,CAAQC,OAAO,EAAA;AACb,YAAA,IAAI,CAACA,OAAAA,EAAS;AACZ,gBAAA,OAAO,EAAE;AACX,YAAA;YAEA,MAAMC,QA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UAAU,EAAET,QAAAA,CAAS,qBAAqB,EAAEA,QAAAA,CAAS,IAAI,CAAC;wBACzEe,YAAAA,EAAc;AAChB,qBAAA,CAAA;AACF,gBAAA;;AAGAR,gBAAAA,WAAAA,CAAYO,IAAI,CAAC;oBACf3B,IAAAA,EAAM,QAAA;AACNqB,oBAAAA,IAAAA,EAAM,CAAA,EAAGd,QAAAA,CAAS,gBAAgB,EAAEM,QAAAA,CAAAA,CAAU;AAC9CgB,oBAAAA,SAAAA,CAAAA,CAAUC,QAAgB,EAAA;AACxB,wBAAA,OAAOC,oCAAaD,QAAAA,EAAU;4BAAE9B,IAAAA,EAAM,OAAA;AAASgC,4BAAAA,YAAAA,EAAc1B,QAAQ2B;AAAG,yBAAA,CAAA;AAC1E,oBAAA;AACF,iBAAA,CAAA;AACF,YAAA;YAEA,OAAOb,WAAAA;AACT,QAAA;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.mjs","sources":["../../src/plops/service.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/services/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/services/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new service to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/services/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","getDestinationPrompts","getDestBasePath","actions","answers","filePath","getFilePath","destination","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;AASA,sBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,
|
|
1
|
+
{"version":3,"file":"service.mjs","sources":["../../src/plops/service.ts"],"sourcesContent":["import type { ActionType, NodePlopAPI } from 'plop';\nimport tsUtils from '@strapi/typescript-utils';\nimport { join } from 'path';\nimport fs from 'fs';\n\nimport getDestinationPrompts from './prompts/get-destination-prompts';\nimport getFilePath from './utils/get-file-path';\nimport { appendToFile } from './utils/extend-plugin-index-files';\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 let language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';\n\n if (answers.plugin) {\n // The tsconfig in plugins is located just outside the server src, not in the root of the plugin.\n const pluginServerDir = join(\n currentDir,\n 'src',\n filePath.replace('{{ plugin }}', answers.plugin),\n '../'\n );\n language = tsUtils.isUsingTypeScriptSync(pluginServerDir) ? 'ts' : 'js';\n }\n\n const baseActions: Array<ActionType> = [\n {\n type: 'add',\n path: `${filePath}/services/{{ id }}.${language}`,\n templateFile: `templates/${language}/service.${language}.hbs`,\n },\n ];\n\n if (answers.plugin) {\n const indexPath = join(plop.getDestBasePath(), `${filePath}/services/index.${language}`);\n const exists = fs.existsSync(indexPath);\n\n if (!exists) {\n // Create index file if it doesn't exist\n baseActions.push({\n type: 'add',\n path: `${filePath}/services/index.${language}`,\n templateFile: `templates/${language}/plugin/plugin.index.${language}.hbs`,\n skipIfExists: true,\n });\n }\n\n // Append the new service to the index.ts file\n baseActions.push({\n type: 'modify',\n path: `${filePath}/services/index.${language}`,\n transform(template: string) {\n return appendToFile(template, { type: 'index', singularName: answers.id });\n },\n });\n }\n\n return baseActions;\n },\n });\n};\n"],"names":["plop","setGenerator","description","prompts","type","name","message","getDestinationPrompts","getDestBasePath","actions","answers","filePath","getFilePath","destination","currentDir","process","cwd","language","tsUtils","isUsingTypeScriptSync","plugin","pluginServerDir","join","replace","baseActions","path","templateFile","indexPath","exists","fs","existsSync","push","skipIfExists","transform","template","appendToFile","singularName","id"],"mappings":";;;;;;;AASA,sBAAe,CAAA,CAACA,IAAAA,GAAAA;;IAEdA,IAAAA,CAAKC,YAAY,CAAC,SAAA,EAAW;QAC3BC,WAAAA,EAAa,+BAAA;QACbC,OAAAA,EAAS;AACP,YAAA;gBACEC,IAAAA,EAAM,OAAA;gBACNC,IAAAA,EAAM,IAAA;gBACNC,OAAAA,EAAS;AACX,aAAA;eACGC,qBAAAA,CAAsB,SAAA,EAAWP,K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AAYO,IAAI,CAAC;wBACf3B,IAAAA,EAAM,KAAA;AACNqB,wBAAAA,IAAAA,EAAM,CAAA,EAAGd,QAAAA,CAAS,gBAAgB,EAAEM,QAAAA,CAAAA,CAAU;wBAC9CS,YAAAA,EAAc,CAAC,UAAU,EAAET,QAAAA,CAAS,qBAAqB,EAAEA,QAAAA,CAAS,IAAI,CAAC;wBACzEe,YAAAA,EAAc;AAChB,qBAAA,CAAA;AACF,gBAAA;;AAGAR,gBAAAA,WAAAA,CAAYO,IAAI,CAAC;oBACf3B,IAAAA,EAAM,QAAA;AACNqB,oBAAAA,IAAAA,EAAM,CAAA,EAAGd,QAAAA,CAAS,gBAAgB,EAAEM,QAAAA,CAAAA,CAAU;AAC9CgB,oBAAAA,SAAAA,CAAAA,CAAUC,QAAgB,EAAA;AACxB,wBAAA,OAAOC,aAAaD,QAAAA,EAAU;4BAAE9B,IAAAA,EAAM,OAAA;AAASgC,4BAAAA,YAAAA,EAAc1B,QAAQ2B;AAAG,yBAAA,CAAA;AAC1E,oBAAA;AACF,iBAAA,CAAA;AACF,YAAA;YAEA,OAAOb,WAAAA;AACT,QAAA;AACF,KAAA,CAAA;AACF,CAAA;;;;"}
|
|
@@ -290,14 +290,14 @@ const handleObjectExport = (obj, config, type, setExport)=>{
|
|
|
290
290
|
};
|
|
291
291
|
// Handle ESM export default
|
|
292
292
|
const handleEsmExport = (root, config, type)=>{
|
|
293
|
-
const exports = root.find(j.ExportDefaultDeclaration);
|
|
294
|
-
if (exports.length === 0) {
|
|
293
|
+
const exports$1 = root.find(j.ExportDefaultDeclaration);
|
|
294
|
+
if (exports$1.length === 0) {
|
|
295
295
|
const newExport = type === 'routes' ? createRoutesExport(config) : j.objectExpression([
|
|
296
296
|
createProperty(config)
|
|
297
297
|
]);
|
|
298
298
|
insertStatement(root, j.exportDefaultDeclaration(newExport), root.find(j.Statement));
|
|
299
299
|
} else {
|
|
300
|
-
exports.forEach((path)=>{
|
|
300
|
+
exports$1.forEach((path)=>{
|
|
301
301
|
const decl = path.value.declaration;
|
|
302
302
|
// Find the actual object being exported
|
|
303
303
|
const exportedObject = findExportedObject(root, decl);
|
|
@@ -316,7 +316,7 @@ const handleEsmExport = (root, config, type)=>{
|
|
|
316
316
|
};
|
|
317
317
|
// Handle CJS module.exports
|
|
318
318
|
const handleCjsExport = (root, config, type)=>{
|
|
319
|
-
const exports = root.find(j.AssignmentExpression, {
|
|
319
|
+
const exports$1 = root.find(j.AssignmentExpression, {
|
|
320
320
|
left: {
|
|
321
321
|
type: 'MemberExpression',
|
|
322
322
|
object: {
|
|
@@ -327,14 +327,14 @@ const handleCjsExport = (root, config, type)=>{
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
|
-
if (exports.length === 0) {
|
|
330
|
+
if (exports$1.length === 0) {
|
|
331
331
|
const newExport = type === 'routes' ? createRoutesExport(config) : j.objectExpression([
|
|
332
332
|
createProperty(config)
|
|
333
333
|
]);
|
|
334
334
|
const moduleExportStmt = j.expressionStatement(j.assignmentExpression('=', j.memberExpression(j.identifier('module'), j.identifier('exports')), newExport));
|
|
335
335
|
insertStatement(root, moduleExportStmt, root.find(j.Statement));
|
|
336
336
|
} else {
|
|
337
|
-
exports.forEach((path)=>{
|
|
337
|
+
exports$1.forEach((path)=>{
|
|
338
338
|
const right = path.value.right;
|
|
339
339
|
// Find the actual object being exported
|
|
340
340
|
const exportedObject = findExportedObject(root, right);
|