Skip to content

Commit 0561cd5

Browse files
Use Chosen Package Manager (Catalog) (#1044)
* fix: use chosen package manager * chore: use catalog deps * changeset * fix: default to npm * fix: types comment * chore: add search-insights to catalog * fix: audit dep vulnerabilities * chore: we'll hold off on using the catalog and workspace deps for now. * fix: deps * fix: types --------- Co-authored-by: Kawika Bader <ekbader@gmail.com>
1 parent 24fa417 commit 0561cd5

File tree

20 files changed

+1818
-1067
lines changed

20 files changed

+1818
-1067
lines changed

.changeset/wise-queens-care.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
"@gasket/plugin-dynamic-plugins": patch
3+
"@gasket/plugin-service-worker": patch
4+
"@gasket/plugin-docs-graphs": patch
5+
"@gasket/plugin-elastic-apm": patch
6+
"@gasket/plugin-https-proxy": patch
7+
"@gasket/plugin-docusaurus": patch
8+
"@gasket/plugin-middleware": patch
9+
"@gasket/plugin-typescript": patch
10+
"@gasket/plugin-happyfeet": patch
11+
"@gasket/typescript-tests": patch
12+
"@gasket/plugin-manifest": patch
13+
"@gasket/plugin-metadata": patch
14+
"@gasket/plugin-analyze": patch
15+
"@gasket/plugin-command": patch
16+
"@gasket/plugin-cypress": patch
17+
"@gasket/plugin-express": patch
18+
"@gasket/plugin-fastify": patch
19+
"@gasket/plugin-swagger": patch
20+
"@gasket/plugin-webpack": patch
21+
"@gasket/plugin-winston": patch
22+
"@gasket/plugin-workbox": patch
23+
"@gasket/plugin-logger": patch
24+
"@gasket/plugin-morgan": patch
25+
"@gasket/plugin-nextjs": patch
26+
"@gasket/preset-nextjs": patch
27+
"@gasket/plugin-https": patch
28+
"@gasket/plugin-mocha": patch
29+
"@gasket/plugin-redux": patch
30+
"@gasket/plugin-data": patch
31+
"@gasket/plugin-docs": patch
32+
"@gasket/plugin-intl": patch
33+
"@gasket/plugin-jest": patch
34+
"@gasket/plugin-lint": patch
35+
"generate-docs-index": patch
36+
"create-gasket-app": patch
37+
"@gasket/plugin-git": patch
38+
"@gasket/preset-api": patch
39+
"@gasket/react-intl": patch
40+
"@gasket/request": patch
41+
"@gasket/assets": patch
42+
"@gasket/nextjs": patch
43+
"@gasket/fetch": patch
44+
"@gasket/redux": patch
45+
"@gasket/utils": patch
46+
"@gasket/core": patch
47+
"@gasket/data": patch
48+
"@gasket/intl": patch
49+
---
50+
51+
Updates to use user-selected package manager. Update all packages to use catalog dep versions.

.npmrc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
registry=https://registry.npmjs.org/
22
package-manager=pnpm@latest
3-
link-workspace-packages=true
43
strict-peer-dependencies=true
5-
strict-dependencies=true
6-
auto-install-peers=true
4+
link-workspace-packages=true
5+
prefer-workspace-packages=true

nx.json

-15
This file was deleted.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"glob": "^8.1.0",
6565
"js-yaml": "^4.1.0",
6666
"jsdom": "^20.0.3",
67-
"nx": "^20.4.6",
6867
"react": "^18.3.1",
6968
"react-dom": "^18.3.1",
7069
"rimraf": "^3.0.2",

packages/create-gasket-app/lib/scaffold/actions/global-prompts.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ async function choosePackageManager(context, prompt) {
3737
{ name: 'npm' },
3838
{ name: 'pnpm' },
3939
{ name: 'yarn' }
40-
]
40+
],
41+
default: 'npm'
4142
}
4243
])
4344
).packageManager;

packages/create-gasket-app/lib/scaffold/actions/post-create-hooks.js

+21-7
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,34 @@ import { runShellCommand } from '@gasket/utils';
66
* @type {import('../../internal').postCreateHooks}
77
*/
88
async function postCreateHooks({ gasket, context }) {
9-
const { dest } = context;
9+
const { dest, packageManager } = context;
1010

1111
/**
12-
* Run an npm script in the context of the created application
13-
* @param {string} script name of script
14-
* @returns {Promise} A promise represents if npm succeeds or fails.
12+
* Determines the correct command for running scripts based on the package manager.
13+
* @param {string} script - The name of the script to run.
14+
* @returns {Promise} A promise that resolves if the script runs successfully.
1515
*/
1616
async function runScript(script) {
17-
return await runShellCommand('pnpm', ['run', script], { cwd: dest });
17+
let cmd;
18+
19+
switch (packageManager) {
20+
case 'yarn':
21+
cmd = 'yarn';
22+
break;
23+
case 'pnpm':
24+
cmd = 'pnpm';
25+
break;
26+
case 'npm':
27+
default:
28+
cmd = 'npm';
29+
break;
30+
}
31+
32+
return await runShellCommand(cmd, ['run', script], { cwd: dest });
1833
}
1934

2035
/**
21-
* An object with one value for now, so adding more utilities
22-
* in future is easy.
36+
* An object with one value for now, so adding more utilities in future is easy.
2337
*/
2438
const utils = { runScript };
2539
await gasket.exec('postCreate', context, utils);

packages/create-gasket-app/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
},
6060
"devDependencies": {
6161
"@gasket/request": "^7.3.0",
62+
"@jest/globals": "^29.7.0",
6263
"@types/inquirer": "^9.0.7",
6364
"@types/jest": "^29.5.14",
6465
"@types/node": "^20.17.19",

packages/gasket-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
},
5757
"devDependencies": {
5858
"@jest/globals": "^29.7.0",
59-
"@swc/cli": "^0.3.14",
59+
"@swc/cli": "^0.6.0",
6060
"@swc/core": "^1.10.18",
6161
"@types/jest": "^29.5.14",
6262
"@types/node": "^20.17.19",

packages/gasket-data/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"devDependencies": {
5454
"@gasket/plugin-data": "^7.3.0",
5555
"@jest/globals": "^29.7.0",
56-
"@swc/cli": "^0.3.14",
56+
"@swc/cli": "^0.6.0",
5757
"@swc/core": "^1.10.18",
5858
"@types/jest": "^29.5.14",
5959
"@types/node": "^20.17.19",

packages/gasket-plugin-cypress/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"jest": "^29.7.0",
5252
"react": "^18.3.1",
5353
"react-dom": "^18.3.1",
54-
"start-server-and-test": "^1.15.4",
54+
"start-server-and-test": "^2.0.10",
5555
"typescript": "^5.7.3"
5656
},
5757
"eslintConfig": {

packages/gasket-plugin-https-proxy/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"eslint-plugin-jest": "^28.11.0",
5555
"eslint-plugin-unicorn": "^55.0.0",
5656
"typescript": "^5.7.3",
57-
"vitest": "^2.1.9"
57+
"vitest": "^3.0.7"
5858
},
5959
"eslintConfig": {
6060
"extends": [

packages/gasket-plugin-lint/lib/utils.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ function makeGatherDevDeps() {
6868
/**
6969
* Creates a function to generate the correct package script execution command.
7070
*
71-
* This function returns a script command formatted for either npm or yarn, depending
71+
* This function returns a script command formatted for npm, yarn, or pnpm, depending
7272
* on the package manager used in the given context.
7373
* @type {import('./internal').makeRunScriptStr}
7474
*/
7575
function makeRunScriptStr(context) {
76-
var runCmd = context.packageManager === 'npm' ? 'npm run' : context.packageManager;
76+
let runCmd = `${context.packageManager} run`;
7777

7878
/**
7979
* Formats the script command for execution.
@@ -85,7 +85,7 @@ function makeRunScriptStr(context) {
8585
throw new TypeError('Script name must be a non-empty string.');
8686
}
8787

88-
return runCmd === 'yarn' ? (runCmd + ' ' + script).replace(' -- ', ' ') : runCmd + ' ' + script;
88+
return runCmd.includes('npm') ? `${runCmd} ${script}` : (`${runCmd} ${script}`).replace(' -- ', ' ');
8989
}
9090

9191
return runScriptStr;

packages/gasket-plugin-lint/test/utils.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ describe('utils', () => {
7070

7171
it('[yarn] returns command', () => {
7272
const results = forYarn('test-script');
73-
expect(results).toEqual('yarn test-script');
73+
expect(results).toEqual('yarn run test-script');
7474
});
7575

7676
it('[yarn] returns command with flags (removes "--")', () => {
7777
const results = forYarn('test-script -- --extra');
78-
expect(results).toEqual('yarn test-script --extra');
78+
expect(results).toEqual('yarn run test-script --extra');
7979
});
8080

8181
it('throws TypeError for an invalid script name', () => {

packages/gasket-plugin-metadata/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"eslint-plugin-jest": "^28.11.0",
5454
"eslint-plugin-unicorn": "^55.0.0",
5555
"typescript": "^5.7.3",
56-
"vitest": "^2.1.9"
56+
"vitest": "^3.0.7"
5757
},
5858
"eslintConfig": {
5959
"extends": [

packages/gasket-plugin-service-worker/lib/index.d.ts

-6
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,6 @@ interface ServiceWorkerLocals {
9292
};
9393
}
9494

95-
declare module 'express-serve-static-core' {
96-
interface Response {
97-
locals?: ServiceWorkerLocals;
98-
}
99-
}
100-
10195
export function configureEndpoint(gasket: Gasket):
10296
RouteHandlerMethod<Http2SecureServer, Http2ServerRequest, Http2ServerResponse> |
10397
Application<Record<string, any>>;

packages/gasket-plugin-swagger/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"eslint-plugin-unicorn": "^55.0.0",
6767
"fastify": "^4.29.0",
6868
"jest": "^29.7.0",
69+
"openapi-types": "^12.1.3",
6970
"typescript": "^5.7.3"
7071
},
7172
"eslintConfig": {

packages/gasket-request/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"devDependencies": {
5959
"@gasket/core": "^7.3.0",
6060
"@jest/globals": "^29.7.0",
61-
"@swc/cli": "^0.3.14",
61+
"@swc/cli": "^0.6.0",
6262
"@swc/core": "^1.10.18",
6363
"@types/jest": "^29.5.14",
6464
"@types/node": "^20.17.19",

0 commit comments

Comments
 (0)