Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan Package: Fix Build #40299

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions projects/js-packages/scan/changelog/fix-scan-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix package build.
6 changes: 0 additions & 6 deletions projects/js-packages/scan/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@ const baseConfig = require( 'jetpack-js-tools/jest/config.base.js' );

module.exports = {
...baseConfig,
transform: {
...baseConfig.transform,
'\\.[jt]sx?$': require( 'jetpack-js-tools/jest/babel-jest-config-factory.js' )(
require.resolve
),
},
};
5 changes: 0 additions & 5 deletions projects/js-packages/scan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
},
"type": "module",
"devDependencies": {
"@automattic/jetpack-webpack-config": "workspace:*",
"@babel/core": "7.26.0",
"@babel/plugin-transform-react-jsx": "7.25.9",
"@jest/globals": "29.7.0",
"@storybook/addon-actions": "8.3.5",
"@storybook/blocks": "8.3.5",
Expand All @@ -34,8 +31,6 @@
"@testing-library/react": "16.0.1",
"@types/jest": "29.5.12",
"@types/react": "18.3.12",
"@wordpress/babel-plugin-import-jsx-pragma": "5.12.0",
"babel-jest": "29.7.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "29.7.0",
"storybook": "8.3.5",
Expand Down
6 changes: 3 additions & 3 deletions projects/js-packages/scan/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './types';
export * from './constants';
export * from './utils';
export * from './types/index.js';
export * from './constants/index.js';
export * from './utils/index.js';
4 changes: 2 additions & 2 deletions projects/js-packages/scan/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './fixers';
export * from './threats';
export * from './fixers.js';
export * from './threats.js';
2 changes: 1 addition & 1 deletion projects/js-packages/scan/src/types/threats.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ThreatFixStatus } from '..';
import { ThreatFixStatus } from './fixers.js';

export type ThreatStatus = 'fixed' | 'ignored' | 'current';

Expand Down
4 changes: 3 additions & 1 deletion projects/js-packages/scan/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { __, sprintf } from '@wordpress/i18n';
import { Threat, ThreatFixStatus, FIXER_IS_STALE_THRESHOLD } from '..';
import { FIXER_IS_STALE_THRESHOLD } from '../constants/index.js';
import { type ThreatFixStatus } from '../types/fixers.js';
import { type Threat } from '../types/threats.js';

export const getThreatType = ( threat: Threat ) => {
if ( threat.signature === 'Vulnerable.WP.Core' ) {
Expand Down
9 changes: 7 additions & 2 deletions projects/js-packages/scan/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"extends": "jetpack-js-tools/tsconfig.base.json",
"include": [ "./src/**/*" ]
"extends": "jetpack-js-tools/tsconfig.tsc.json",
"include": [ "./src/**/*" ],
"compilerOptions": {
"typeRoots": [ "./node_modules/@types/", "src/*" ],
"sourceMap": false,
"outDir": "./build/"
}
}
4 changes: 3 additions & 1 deletion tools/js-tools/jest/jest-resolver.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const tsJestResolver = require( 'ts-jest-resolver' );

// Some packages assume that a "browser" environment is esm or otherwise break in node.
// List them here and the resolver will adjust the conditions to resolve them as "node" instead.
// cf. https://github.com/microsoft/accessibility-insights-web/pull/5421#issuecomment-1109168149
Expand All @@ -20,7 +22,7 @@ module.exports = ( path, options ) => {
conditions.add( 'node' );
}

return options.defaultResolver( path, {
return tsJestResolver( path, {
...options,
basedir,
conditions,
Expand Down
1 change: 1 addition & 0 deletions tools/js-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"sort-package-json": "1.50.0",
"svelte": "4.2.19",
"svelte-eslint-parser": "0.39.2",
"ts-jest-resolver": "2.0.1",
"typescript": "5.0.4",
"yaml": "2.2.2"
}
Expand Down
Loading