diff --git a/package-lock.json b/package-lock.json index 08f79e64f..3600433c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9152,8 +9152,7 @@ "optional": true, "os": [ "android" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-android-arm64": { "version": "4.30.1", @@ -9167,8 +9166,7 @@ "optional": true, "os": [ "android" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-darwin-arm64": { "version": "4.30.1", @@ -9182,8 +9180,7 @@ "optional": true, "os": [ "darwin" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-darwin-x64": { "version": "4.30.1", @@ -9197,8 +9194,7 @@ "optional": true, "os": [ "darwin" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-freebsd-arm64": { "version": "4.30.1", @@ -9212,8 +9208,7 @@ "optional": true, "os": [ "freebsd" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-freebsd-x64": { "version": "4.30.1", @@ -9227,8 +9222,7 @@ "optional": true, "os": [ "freebsd" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { "version": "4.30.1", @@ -9242,8 +9236,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { "version": "4.30.1", @@ -9257,8 +9250,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { "version": "4.30.1", @@ -9272,8 +9264,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { "version": "4.30.1", @@ -9287,8 +9278,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { "version": "4.30.1", @@ -9302,8 +9292,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { "version": "4.30.1", @@ -9317,8 +9306,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { "version": "4.30.1", @@ -9332,8 +9320,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { "version": "4.30.1", @@ -9347,8 +9334,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { "version": "4.30.1", @@ -9362,8 +9348,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-x64-musl": { "version": "4.30.1", @@ -9377,8 +9362,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { "version": "4.30.1", @@ -9392,8 +9376,7 @@ "optional": true, "os": [ "win32" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { "version": "4.30.1", @@ -9407,8 +9390,7 @@ "optional": true, "os": [ "win32" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { "version": "4.30.1", @@ -9422,8 +9404,7 @@ "optional": true, "os": [ "win32" - ], - "peer": true + ] }, "node_modules/@rtsao/scc": { "version": "1.1.0", @@ -10046,7 +10027,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=10" } @@ -10064,7 +10044,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=10" } @@ -10082,7 +10061,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=10" } @@ -10100,7 +10078,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=10" } @@ -10118,7 +10095,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=10" } @@ -10136,7 +10112,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=10" } @@ -10154,7 +10129,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=10" } @@ -10172,7 +10146,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=10" } @@ -10190,7 +10163,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=10" } @@ -10208,7 +10180,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=10" } @@ -18481,6 +18452,7 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -18491,6 +18463,7 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, "license": "MIT", "optional": true, "dependencies": { @@ -36647,6 +36620,7 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dev": true, "license": "MIT", "dependencies": { "@babel/runtime": "^7.9.2" @@ -45799,12 +45773,19 @@ "version": "7.1.7", "license": "MIT", "dependencies": { + "@gasket/plugin-command": "^7.1.4", "@gasket/plugin-cypress": "^7.1.4", + "@gasket/plugin-docs": "^7.1.2", + "@gasket/plugin-docusaurus": "^7.1.4", + "@gasket/plugin-dynamic-plugins": "^7.1.2", "@gasket/plugin-express": "^7.1.4", "@gasket/plugin-fastify": "^7.1.4", + "@gasket/plugin-git": "^7.1.4", "@gasket/plugin-https": "^7.1.4", "@gasket/plugin-jest": "^7.1.0", "@gasket/plugin-lint": "^7.1.7", + "@gasket/plugin-logger": "^7.1.4", + "@gasket/plugin-metadata": "^7.1.4", "@gasket/plugin-mocha": "^7.1.0", "@gasket/plugin-swagger": "^7.1.4", "@gasket/plugin-typescript": "^7.1.4", @@ -45825,13 +45806,20 @@ "version": "7.1.7", "license": "MIT", "dependencies": { + "@gasket/plugin-command": "^7.1.4", "@gasket/plugin-cypress": "^7.1.4", + "@gasket/plugin-docs": "^7.1.4", + "@gasket/plugin-docusaurus": "^7.1.4", + "@gasket/plugin-dynamic-plugins": "^7.1.5", "@gasket/plugin-express": "^7.1.4", + "@gasket/plugin-git": "^7.1.4", "@gasket/plugin-https": "^7.1.4", "@gasket/plugin-https-proxy": "^7.1.4", "@gasket/plugin-intl": "^7.1.4", "@gasket/plugin-jest": "^7.1.0", "@gasket/plugin-lint": "^7.1.7", + "@gasket/plugin-logger": "^7.1.4", + "@gasket/plugin-metadata": "^7.1.4", "@gasket/plugin-mocha": "^7.1.0", "@gasket/plugin-nextjs": "^7.1.6", "@gasket/plugin-typescript": "^7.1.4", diff --git a/packages/create-gasket-app/lib/commands/create.js b/packages/create-gasket-app/lib/commands/create.js index f43e2108a..ddefd74a4 100644 --- a/packages/create-gasket-app/lib/commands/create.js +++ b/packages/create-gasket-app/lib/commands/create.js @@ -4,7 +4,6 @@ import { makeCreateContext } from '../scaffold/create-context.js'; import { dumpErrorContext } from '../scaffold/dump-error-context.js'; import { rm } from 'fs/promises'; import { makeGasket } from '@gasket/core'; -import { defaultPlugins } from '../config/default-plugins.js'; import { createHooks, generateFiles, @@ -119,7 +118,7 @@ createCommand.action = async function run(appname, options, command) { const pluginGasket = makeGasket({ ...context.presetConfig, - plugins: context.presets.concat(context.presetConfig.plugins, defaultPlugins) + plugins: context.presets.concat(context.presetConfig.plugins) }); await promptHooks({ gasket: pluginGasket, context }); diff --git a/packages/create-gasket-app/lib/config/default-plugins.js b/packages/create-gasket-app/lib/config/default-plugins.js deleted file mode 100644 index c9b7801eb..000000000 --- a/packages/create-gasket-app/lib/config/default-plugins.js +++ /dev/null @@ -1,17 +0,0 @@ -import pluginGit from '@gasket/plugin-git'; -import pluginLogger from '@gasket/plugin-logger'; -import pluginMetadata from '@gasket/plugin-metadata'; -import pluginCommand from '@gasket/plugin-command'; -import pluginDocs from '@gasket/plugin-docs'; -import pluginDocusaurus from '@gasket/plugin-docusaurus'; -import pluginDynamicPlugins from '@gasket/plugin-dynamic-plugins'; - -export const defaultPlugins = [ - pluginLogger, - pluginGit, - pluginMetadata, - pluginCommand, - pluginDocs, - pluginDocusaurus, - pluginDynamicPlugins -]; diff --git a/packages/create-gasket-app/lib/index.d.ts b/packages/create-gasket-app/lib/index.d.ts index 7f3edd4dc..1c88f51b3 100644 --- a/packages/create-gasket-app/lib/index.d.ts +++ b/packages/create-gasket-app/lib/index.d.ts @@ -464,6 +464,7 @@ declare module 'create-gasket-app' { constructor(initContext?: Partial); runWith(plugin: Plugin): Proxy; + typescript?: boolean; } } diff --git a/packages/create-gasket-app/test/unit/config/default-plugins.test.js b/packages/create-gasket-app/test/unit/config/default-plugins.test.js deleted file mode 100644 index f66e425d2..000000000 --- a/packages/create-gasket-app/test/unit/config/default-plugins.test.js +++ /dev/null @@ -1,22 +0,0 @@ -import pluginGit from '@gasket/plugin-git'; -import pluginLogger from '@gasket/plugin-logger'; -import pluginMetadata from '@gasket/plugin-metadata'; -import pluginCommand from '@gasket/plugin-command'; -import pluginDocs from '@gasket/plugin-docs'; -import pluginDocusaurus from '@gasket/plugin-docusaurus'; -import pluginDynamicPlugins from '@gasket/plugin-dynamic-plugins'; -import { defaultPlugins } from '../../../lib/config/default-plugins.js'; - -describe('defaultPlugins', () => { - it('should include the correct plugins', () => { - expect(defaultPlugins).toEqual([ - pluginLogger, - pluginGit, - pluginMetadata, - pluginCommand, - pluginDocs, - pluginDocusaurus, - pluginDynamicPlugins - ]); - }); -}); diff --git a/packages/gasket-preset-api/lib/preset-config.js b/packages/gasket-preset-api/lib/preset-config.js index 33a21e64b..9f02e095b 100644 --- a/packages/gasket-preset-api/lib/preset-config.js +++ b/packages/gasket-preset-api/lib/preset-config.js @@ -1,3 +1,13 @@ +// Default Plugins - included by default for all presets +import pluginCommand from '@gasket/plugin-command'; +import pluginDocs from '@gasket/plugin-docs'; +import pluginDocusaurus from '@gasket/plugin-docusaurus'; +import pluginDynamicPlugins from '@gasket/plugin-dynamic-plugins'; +import pluginGit from '@gasket/plugin-git'; +import pluginLogger from '@gasket/plugin-logger'; +import pluginMetadata from '@gasket/plugin-metadata'; + +// Preset-specific Plugins import pluginHttps from '@gasket/plugin-https'; import pluginWinston from '@gasket/plugin-winston'; import pluginLint from '@gasket/plugin-lint'; @@ -9,36 +19,43 @@ import pluginLint from '@gasket/plugin-lint'; * @returns {Promise} config */ export default async function presetConfig(gasket, context) { - const plugins = [ + const plugins = new Set([ + pluginCommand, + pluginDocs, + pluginDocusaurus, + pluginDynamicPlugins, + pluginGit, pluginHttps, - pluginWinston, - pluginLint - ]; + pluginLint, + pluginLogger, + pluginMetadata, + pluginWinston + ]); const frameworkPlugin = context.server === 'express' ? await import('@gasket/plugin-express') : await import('@gasket/plugin-fastify'); - plugins.push(frameworkPlugin.default || frameworkPlugin); + plugins.add(frameworkPlugin.default || frameworkPlugin); if ('testPlugins' in context && context.testPlugins.length > 0) { await Promise.all(context.testPlugins.map(async (testPlugin) => { const plugin = await import(testPlugin); - plugins.push(plugin ? plugin.default || plugin : null); + plugins.add(plugin ? plugin.default || plugin : null); })); } if (context.typescript) { const typescriptPlugin = await import('@gasket/plugin-typescript'); - plugins.push(typescriptPlugin.default || typescriptPlugin); + plugins.add(typescriptPlugin.default || typescriptPlugin); } if (context.useSwagger) { const swaggerPlugin = await import('@gasket/plugin-swagger'); - plugins.push(swaggerPlugin.default || swaggerPlugin); + plugins.add(swaggerPlugin.default || swaggerPlugin); } return { - plugins: plugins.filter(Boolean) + plugins: Array.from(plugins) }; } diff --git a/packages/gasket-preset-api/package.json b/packages/gasket-preset-api/package.json index 3c1b36953..7ec30470e 100644 --- a/packages/gasket-preset-api/package.json +++ b/packages/gasket-preset-api/package.json @@ -31,12 +31,19 @@ }, "homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-preset-api", "dependencies": { + "@gasket/plugin-command": "^7.1.4", "@gasket/plugin-cypress": "^7.1.4", + "@gasket/plugin-docs": "^7.1.2", + "@gasket/plugin-docusaurus": "^7.1.4", + "@gasket/plugin-dynamic-plugins": "^7.1.2", "@gasket/plugin-express": "^7.1.4", "@gasket/plugin-fastify": "^7.1.4", + "@gasket/plugin-git": "^7.1.4", "@gasket/plugin-https": "^7.1.4", "@gasket/plugin-jest": "^7.1.0", "@gasket/plugin-lint": "^7.1.7", + "@gasket/plugin-logger": "^7.1.4", + "@gasket/plugin-metadata": "^7.1.4", "@gasket/plugin-mocha": "^7.1.0", "@gasket/plugin-swagger": "^7.1.4", "@gasket/plugin-typescript": "^7.1.4", diff --git a/packages/gasket-preset-nextjs/lib/preset-config.js b/packages/gasket-preset-nextjs/lib/preset-config.js index c58f03dda..e4c9846a4 100644 --- a/packages/gasket-preset-nextjs/lib/preset-config.js +++ b/packages/gasket-preset-nextjs/lib/preset-config.js @@ -1,3 +1,13 @@ +// Default Plugins - included by default for all presets +import pluginCommand from '@gasket/plugin-command'; +import pluginDocs from '@gasket/plugin-docs'; +import pluginDocusaurus from '@gasket/plugin-docusaurus'; +import pluginDynamicPlugins from '@gasket/plugin-dynamic-plugins'; +import pluginGit from '@gasket/plugin-git'; +import pluginLogger from '@gasket/plugin-logger'; +import pluginMetadata from '@gasket/plugin-metadata'; + +// Preset-specific Plugins import pluginHttps from '@gasket/plugin-https'; import pluginHttpsProxy from '@gasket/plugin-https-proxy'; import pluginNext from '@gasket/plugin-nextjs'; @@ -15,41 +25,48 @@ import pluginLint from '@gasket/plugin-lint'; export default async function presetConfig(gasket, context) { let typescriptPlugin; - const plugins = [ + const plugins = new Set([ + pluginCommand, + pluginDocs, + pluginDocusaurus, + pluginDynamicPlugins, + pluginGit, + pluginLogger, + pluginMetadata, pluginNext, pluginIntl, pluginWebpack, pluginWinston, pluginLint - ]; + ]); if (context.nextServerType === 'customServer') { const frameworkPlugin = await import('@gasket/plugin-express'); - plugins.push(pluginHttps); - plugins.push(frameworkPlugin.default || frameworkPlugin); + plugins.add(pluginHttps); + plugins.add(frameworkPlugin.default || frameworkPlugin); } else if (context.nextDevProxy) { - plugins.push(pluginHttpsProxy); + plugins.add(pluginHttpsProxy); } if (context.nextDevProxy) { - plugins.push(pluginHttpsProxy); + plugins.add(pluginHttpsProxy); } if ('testPlugins' in context && context.testPlugins.length > 0) { await Promise.all(context.testPlugins.map(async (testPlugin) => { const plugin = await import(testPlugin); - plugins.push(plugin ? plugin.default || plugin : null); + plugins.add(plugin ? plugin.default || plugin : null); })); } if (context.typescript) { typescriptPlugin = await import('@gasket/plugin-typescript'); - plugins.push(typescriptPlugin.default || typescriptPlugin); + plugins.add(typescriptPlugin.default || typescriptPlugin); } return { - plugins: plugins.filter(Boolean) + plugins: Array.from(plugins) }; } diff --git a/packages/gasket-preset-nextjs/package.json b/packages/gasket-preset-nextjs/package.json index f5acef0c6..98c63272e 100644 --- a/packages/gasket-preset-nextjs/package.json +++ b/packages/gasket-preset-nextjs/package.json @@ -14,7 +14,7 @@ "lint:fix": "npm run lint -- --fix", "test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest", "test:watch": "npm run test -- --watch", - "test:coverage": "jest --coverage", + "test:coverage": "npm run test -- --coverage", "posttest": "npm run lint" }, "repository": { @@ -31,13 +31,20 @@ }, "homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-preset-nextjs", "dependencies": { + "@gasket/plugin-command": "^7.1.4", "@gasket/plugin-cypress": "^7.1.4", + "@gasket/plugin-docs": "^7.1.4", + "@gasket/plugin-docusaurus": "^7.1.4", + "@gasket/plugin-dynamic-plugins": "^7.1.5", "@gasket/plugin-express": "^7.1.4", + "@gasket/plugin-git": "^7.1.4", "@gasket/plugin-https": "^7.1.4", "@gasket/plugin-https-proxy": "^7.1.4", "@gasket/plugin-intl": "^7.1.4", "@gasket/plugin-jest": "^7.1.0", "@gasket/plugin-lint": "^7.1.7", + "@gasket/plugin-logger": "^7.1.4", + "@gasket/plugin-metadata": "^7.1.4", "@gasket/plugin-mocha": "^7.1.0", "@gasket/plugin-nextjs": "^7.1.6", "@gasket/plugin-typescript": "^7.1.4",