Repository navigation
Search: Add essential scaffolding for package #21814
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
Merged
Merged
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
c28fbe8
[not verified] Add eslint config
048b8a8
[not verified] Add babel config
ce6476c
[not verified] Add postcss config
a364f44
[not verified] Add jest config
da947f7
[not verified] Add package.json
4588c4a
[not verified] Bump composer version
4172b5f
[not verified] pnpm lockfile
e76bf6f
[not verified] Changelog
eb353cc
[not verified] Tweak test commands
11c66f8
[not verified] Update lockfile
719afea
[not verified] Add empty build command
88fb9da
[not verified] copied config from jetpack
kangzj 1192b2c
[not verified] update internal dep versions
kangzj e75fc0c
[not verified] hidden files should be removed too
kangzj 45ebb25
[not verified] add --passWithNoTests to jest run
kangzj 1366462
[not verified] added internal dependencies
kangzj b899035
[not verified] we could possible not use @wordpress/element
kangzj 06d2768
[not verified] Update projects/packages/search/package.json
kangzj c6d3abf
[not verified] Update projects/packages/search/package.json
kangzj 5da7b3e
[not verified] Update projects/packages/search/package.json
kangzj 5802974
[not verified] Update projects/packages/search/package.json
kangzj a5df156
[not verified] added build command called by the monorepo
kangzj da04eac
[not verified] updated lock file
kangzj 78cf2d4
manually review lock file
kangzj 1953aa6
update composer hash
kangzj 585d8f2
Merge branch 'master' into add/search-package-skeleton
kangzj ab13e97
change file list to be included/excluded for production
kangzj 9a24050
fix build env issue
kangzj b6e2be8
merge from master
kangzj 86b1f48
update jetpack content-hash
kangzj e7ef4a6
added browserslist
kangzj 1f9c292
update jetpack api version
kangzj 80b71cd
update dependency versions
kangzj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| module.exports = { | ||
| // Use root level ESlint configuration. | ||
| // JavaScript files inside this folder are meant to be transpiled by Webpack. | ||
| root: true, | ||
| extends: [ '../../../.eslintrc.react.js' ], | ||
| parserOptions: { | ||
| babelOptions: { | ||
| configFile: require.resolve( './babel.config.js' ), | ||
| }, | ||
| }, | ||
| rules: { | ||
| 'jsdoc/check-tag-names': [ 1, { definedTags: [ 'jsx' ] } ], | ||
| 'react/jsx-no-bind': 0, | ||
| }, | ||
| overrides: [ | ||
| { | ||
| files: './src/customberg/**/*', | ||
| rules: { | ||
| // Customberg uses @wordpress/babel-preset-default, which auto-imports React as necessary. | ||
| 'react/react-in-jsx-scope': 0, | ||
| }, | ||
| }, | ||
| ], | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| module.exports = require( './tools/babel.config' ); |
4 changes: 4 additions & 0 deletions
4
projects/packages/search/changelog/add-search-package-skeleton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: minor | ||
| Type: added | ||
|
|
||
| Added essential scaffolding for package. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * External dependencies | ||
| */ | ||
| const path = require( 'path' ); | ||
|
|
||
| module.exports = { | ||
| testMatch: [ '<rootDir>/**/test/*.[jt]s?(x)', '!**/.eslintrc.*' ], | ||
| roots: [ '<rootDir>/src' ], | ||
| transform: { | ||
| '\\.[jt]sx?$': path.join( __dirname, 'tests/jest-extensions-babel-transform' ), | ||
| '\\.(gif|jpg|jpeg|png|svg|scss|sass|css|ttf|woff|woff2)$': path.join( | ||
| __dirname, | ||
| 'tests/jest-extensions-asset-stub' | ||
| ), | ||
| }, | ||
| moduleNameMapper: { | ||
| 'tiny-lru/lib/tiny-lru.esm$': '<rootDir>/src/instant-search/lib/test-helpers/tiny-lru.mock.js', | ||
| }, | ||
| moduleDirectories: [ 'node_modules' ], | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| { | ||
| "name": "jetpack-search", | ||
| "version": "0.2.0-alpha", | ||
| "description": "Package for Jetpack Search products", | ||
| "main": "main.js", | ||
| "directories": { | ||
| "test": "tests" | ||
| }, | ||
| "scripts": { | ||
| "build": "pnpm run build-development", | ||
| "build-production": "NODE_ENV=production BABEL_ENV=production pnpm run clean-all && pnpm run build-production-instant && pnpm run build-production-customberg && pnpm run build-production-dashboard && pnpm run build-production-php", | ||
| "build-production-instant": "echo 'Not yet implemented.'", | ||
| "build-production-customberg": "echo 'Not yet implemented.'", | ||
| "build-production-dashboard": "echo 'Not yet implemented.'", | ||
| "build-production-php": "COMPOSER_MIRROR_PATH_REPOS=1 COMPOSER_ROOT_VERSION=dev-master composer install -o --no-dev --classmap-authoritative --prefer-dist", | ||
| "build-development": "NODE_ENV=development BABEL_ENV=development pnpm run clean-all && pnpm run build-instant && pnpm run build-customberg && pnpm run build-dashboard && pnpm run build-php", | ||
| "build-instant": "echo 'Not yet implemented.'", | ||
| "build-customberg": "echo 'Not yet implemented.'", | ||
| "build-dashboard": "echo 'Not yet implemented.'", | ||
| "build-php": "composer install --ignore-platform-reqs", | ||
|
kangzj marked this conversation as resolved.
Resolved
|
||
| "clean-all": "rm -rf build/ .cache/ node_modules/ vendor/", | ||
| "test": "pnpx concurrently 'pnpm:test-scripts' 'pnpm:test-size'", | ||
| "test-scripts": "jest --passWithNoTests", | ||
| "test-size": "echo 'Not yet implemented.'" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/Automattic/jetpack-search.git" | ||
| }, | ||
| "author": "Automattic", | ||
| "license": "GPL-2.0-or-later", | ||
| "bugs": { | ||
| "url": "https://github.com/Automattic/jetpack-search/issues" | ||
| }, | ||
| "homepage": "https://github.com/Automattic/jetpack-search#readme", | ||
| "engines": { | ||
| "node": "^14.17.6 || ^16.7.0", | ||
| "pnpm": "^6.5.0", | ||
| "yarn": "use pnpm instead - see docs/yarn-upgrade.md" | ||
| }, | ||
| "dependencies": { | ||
| "@automattic/calypso-color-schemes": "2.1.1", | ||
| "@automattic/color-studio": "2.5.0", | ||
| "@automattic/jetpack-analytics": "workspace:^0.1.3-alpha", | ||
| "@automattic/jetpack-api": "workspace:^0.7.0-alpha", | ||
| "@automattic/jetpack-components": "workspace:^0.6.3-alpha", | ||
| "@wordpress/base-styles": "4.0.3", | ||
| "@wordpress/block-editor": "8.0.3", | ||
| "@wordpress/data": "6.1.4", | ||
| "@wordpress/i18n": "4.2.4", | ||
| "@wordpress/icons": "6.1.1", | ||
| "classnames": "2.3.1", | ||
| "fast-json-stable-stringify": "2.1.0", | ||
| "lodash": "4.17.21", | ||
| "photon": "4.0.0", | ||
| "preact": "10.5.15", | ||
| "q-flat": "1.0.7", | ||
| "qss": "2.0.3", | ||
| "react": "17.0.2", | ||
| "redux": "4.1.1", | ||
| "refx": "3.1.1", | ||
| "strip": "3.0.0", | ||
| "tiny-lru": "7.0.6" | ||
| }, | ||
| "devDependencies": { | ||
| "@automattic/jetpack-webpack-config": "workspace:^0.3.0-alpha", | ||
| "@babel/core": "7.16.0", | ||
| "@babel/plugin-proposal-nullish-coalescing-operator": "7.16.0", | ||
| "@babel/preset-env": "7.16.4", | ||
| "@babel/preset-react": "7.16.0", | ||
| "@babel/preset-typescript": "7.16.0", | ||
| "@size-limit/preset-app": "6.0.3", | ||
| "@testing-library/jest-dom": "5.14.1", | ||
| "@testing-library/preact": "2.0.1", | ||
| "@wordpress/dependency-extraction-webpack-plugin": "3.2.1", | ||
| "concurrently": "6.4.0", | ||
| "jest": "27.3.1", | ||
| "jest-environment-jsdom": "27.3.1", | ||
| "postcss": "8.3.11", | ||
| "postcss-loader": "6.2.0", | ||
| "prettier": "npm:wp-prettier@2.0.5", | ||
| "sass-loader": "12.3.0", | ||
| "size-limit": "6.0.3", | ||
| "webpack": "5.64.1" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Uses Jetpack plugin's postcss config. | ||
| module.exports = () => ( { | ||
| plugins: { | ||
| 'postcss-custom-properties': { | ||
| importFrom: [ require.resolve( '@automattic/calypso-color-schemes' ) ], | ||
| // @TODO: Drop `preserve: false` workaround if possible | ||
| // See https://github.com/Automattic/jetpack/pull/13854#issuecomment-550898168 | ||
| preserve: false, | ||
| }, | ||
| autoprefixer: {}, | ||
| }, | ||
| } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| const path = require( 'path' ); | ||
|
|
||
| module.exports = { | ||
| process( src, filename ) { | ||
| return 'module.exports = ' + JSON.stringify( path.basename( filename ) ) + ';'; | ||
| }, | ||
| }; |
33 changes: 33 additions & 0 deletions
33
projects/packages/search/tests/jest-extensions-babel-transform.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * External dependencies | ||
| */ | ||
| const babelJest = require( 'babel-jest' ); | ||
|
|
||
| module.exports = babelJest.default.createTransformer( { | ||
| presets: [ | ||
| [ | ||
| require.resolve( '@automattic/jetpack-webpack-config/babel/preset' ), | ||
| { modules: 'commonjs' }, | ||
| ], | ||
| ], | ||
| plugins: [ | ||
| [ | ||
| require.resolve( '@wordpress/babel-plugin-import-jsx-pragma' ), | ||
| { | ||
| scopeVariable: 'createElement', | ||
| scopeVariableFrag: 'Fragment', | ||
| source: '@wordpress/element', | ||
| isDefault: false, | ||
| }, | ||
| ], | ||
| [ | ||
| require.resolve( '@babel/plugin-transform-react-jsx' ), | ||
| { | ||
| pragma: 'createElement', | ||
| pragmaFrag: 'Fragment', | ||
| }, | ||
| ], | ||
| ], | ||
| babelrc: false, | ||
| configFile: false, | ||
| } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| module.exports = api => { | ||
| api.cache( true ); | ||
| return { | ||
| presets: [ | ||
| [ | ||
| '@automattic/jetpack-webpack-config/babel/preset', | ||
| { | ||
| presetEnv: { | ||
| corejs: '3.8.3', | ||
| modules: false, | ||
| useBuiltIns: 'usage', | ||
| }, | ||
| }, | ||
| ], | ||
| ], | ||
| plugins: [ '@babel/plugin-proposal-nullish-coalescing-operator' ], | ||
| }; | ||
| }; |
4 changes: 4 additions & 0 deletions
4
projects/plugins/jetpack/changelog/add-search-package-skeleton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: patch | ||
| Type: other | ||
|
|
||
| Updated package dependencies. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.