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

No longer package X-Pack as a node module #32722

Open
wants to merge 8 commits into
base: master
from

Conversation

Projects
None yet
5 participants
@tylersmalley
Copy link
Member

tylersmalley commented Mar 7, 2019

Fixes #31471

  • Only builds X-Pack for non-OSS builds which accounted for ~1m30s in those functional tests.

jscodeshift used for path transformations:

const path = require('path');

export default (fileInfo, api) => {
  const j = api.jscodeshift;
  const root = j(fileInfo.source);

  return root
    .find(j.ImportDeclaration)
    .filter(p => p.value.source.value.startsWith('x-pack'))
    .forEach(p => {
      p.value.source.value = path.relative(path.dirname(fileInfo.path), p.value.source.value);
    })
    .toSource({ quote: 'single' });
}

jscodeshift -t remove-x-pack-refs.js --extensions tsx --parser tsx x-pack

No longer package X-Pack as a node module
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@elasticmachine

This comment has been minimized.

Copy link

elasticmachine commented Mar 7, 2019

Removes packages based on kbn-pm
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>

@elastic elastic deleted a comment from elasticmachine Mar 8, 2019

const pkg = JSON.parse(readFileSync(resolve(buildRoot, 'package.json')));

pkg.dependencies = Object.keys(pkg.dependencies)
.filter((d) => !projects.has(d))

This comment has been minimized.

@tylersmalley

tylersmalley Mar 8, 2019

Author Member

I am thinking we could additionally remove any dependencies with the same version qualifier as the dependency in Kibana. Thoughts? I still need to see how much additional overhead we are looking at currently.

This comment has been minimized.

@jbudz

jbudz Mar 13, 2019

Contributor

can you add any context on what's happening? wouldn't yarn workspace dedupe these to the top level automatically?

This comment has been minimized.

@jbudz

jbudz Mar 13, 2019

Contributor

oh, this is outside the scope of kbn-pm et all as a side effect

@tylersmalley tylersmalley marked this pull request as ready for review Mar 8, 2019

@tylersmalley tylersmalley requested a review from elastic/apm-ui as a code owner Mar 8, 2019

@elasticmachine

This comment was marked as outdated.

Copy link

elasticmachine commented Mar 8, 2019

@elasticmachine

This comment was marked as outdated.

Copy link

elasticmachine commented Mar 8, 2019

Adds tests
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@elasticmachine

This comment was marked as outdated.

Copy link

elasticmachine commented Mar 11, 2019

@jasonrhodes

This comment has been minimized.

Copy link
Member

jasonrhodes commented Mar 14, 2019

@tylersmalley so just for our own clarification's sake in APM ... the imports that used 'x-pack/plugins/etc' paths only worked because x-pack was packaged as a node module? That little "trick" only worked for us in .ts(x) files so I always assumed it was TS compiler magic, even though I could never quite track down how it worked...

@jasonrhodes
Copy link
Member

jasonrhodes left a comment

LGTM fror APM ...

Sidenote: would love to consider some way of aliasing imports from Kibana's root to avoid relative imports that go 3+ levels, much easier to read:
from 'kibana/x-pack/plugins/apm/typings/Transaction'
than
from '../../../../../../../../../../typings/Transaction'

tylersmalley added some commits Mar 14, 2019

Continues using workspaces for install
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>

@tylersmalley tylersmalley force-pushed the tylersmalley:no-xpack-mv branch from 2037cc5 to 70e5be4 Mar 18, 2019

@elasticmachine

This comment was marked as outdated.

Copy link

elasticmachine commented Mar 18, 2019

Remove node_modules/x-pack
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>

@tylersmalley tylersmalley force-pushed the tylersmalley:no-xpack-mv branch from 70e5be4 to 579f493 Mar 18, 2019

@elasticmachine

This comment was marked as outdated.

Copy link

elasticmachine commented Mar 18, 2019

@elasticmachine

This comment has been minimized.

Copy link

elasticmachine commented Mar 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.