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

Search: Migrate Classic and Instant Search to package #21515

Closed
wants to merge 14 commits into from
Closed
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
2,092 changes: 1,705 additions & 387 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions projects/packages/search/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.cache/
build/
node_modules/
wordpress
43 changes: 43 additions & 0 deletions projects/packages/search/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* A babel preset wrapper to set @babel/plugin-transform-runtime's absoluteRuntime to true.
*
* @param {string|Function} preset - The preset being wrapped.
* @returns {Function} The wrapped preset-function.
*/
function presetOverrideBabelPluginTransformRuntimeAbsoluteRuntime(preset) {
if ('string' === typeof preset) {
preset = require(preset);
}
return (api, opts) => {
const ret = preset(api, opts);
// Override the configuration for @babel/plugin-transform-runtime to set absoluteRuntime true.
// This prevents it from blowing up when other workspace projects are symlinked.
ret.plugins.forEach(p => {
if (Array.isArray(p) && /[\\/]@babel[\\/]plugin-transform-runtime[\\/]/.test(p[0])) {
p[1].absoluteRuntime = true;
}
});
return ret;
};
}

const config = {
presets: [
presetOverrideBabelPluginTransformRuntimeAbsoluteRuntime(
'@automattic/calypso-build/babel/default'
),
],
plugins: ['@babel/plugin-proposal-nullish-coalescing-operator'],
overrides: [
{
test: './src/instant-search',
presets: [
presetOverrideBabelPluginTransformRuntimeAbsoluteRuntime(
'./src/instant-search/babel.config.js'
),
],
},
],
};

module.exports = config;
57 changes: 57 additions & 0 deletions projects/packages/search/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "jetpack-search",
"version": "1.0.0-alpha",
"description": "Package for Jetpack Search products",
"main": "main.js",
"directories": {
"test": "tests"
},
"scripts": {
"build-instant": "webpack --config ./webpack.instant.config.js",
"clean": "rm -rf build/*",
"test": "echo \"Error: no test specified\" && exit 1"
},
"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/color-studio": "2.5.0",
"@wordpress/i18n": "4.2.2",
"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-redux": "7.2.5",
"redux": "4.1.1",
"refx": "3.1.1",
"strip": "3.0.0",
"tiny-lru": "7.0.6"
},
"devDependencies": {
"@automattic/calypso-build": "9.0.0",
"@babel/core": "7.15.8",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.14.5",
"@babel/preset-env": "7.15.8",
"@babel/preset-react": "7.14.5",
"@babel/preset-typescript": "7.15.0",
"@size-limit/preset-app": "6.0.3",
"@wordpress/dependency-extraction-webpack-plugin": "3.2.1",
"postcss": "8.3.11",
"size-limit": "6.0.3",
"webpack": "5.51.1"
}
}
Loading