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

Cannot run in no-git env #163

Closed
moonrailgun opened this issue Oct 21, 2022 · 5 comments
Closed

Cannot run in no-git env #163

moonrailgun opened this issue Oct 21, 2022 · 5 comments
Labels
good first issue Good for newcomers

Comments

@moonrailgun
Copy link
Contributor

Because of this code:

export const BUILD_ENV: BuildEnv = {
  isCi: envs.isCi,
  pwd: 'root' in envs && envs.root ? envs.root : process.cwd(),
  platform: process.env.PERFSEE_PLATFORM_HOST ?? 'https://perfsee.com',
  upload: !process.env.PERFSEE_NO_UPLOAD && envs.isCi,
  git: gitEnvPromise.then((gitEnv) => (gitEnv ? Promise.resolve(gitEnv) : getGitEnv())),
}

in init, will call getGitEnv and fetch git context, but its not good in some no-git environment for example: vercel deploy.

Maybe we should get this variable when we use it?

moonrailgun added a commit to msgbyte/tailchat that referenced this issue Oct 21, 2022
@moonrailgun
Copy link
Contributor Author

or add a catch block if not get git environment..

@EYHN
Copy link
Member

EYHN commented Oct 24, 2022

Because we need to read information such as commits, branches, tags, etc. from git, this information is necessary for uploading artifacts.

The vercel build environment provides a series of system environment variables, perhaps we can use the information. https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables

@moonrailgun
Copy link
Contributor Author

Because we need to read information such as commits, branches, tags, etc. from git, this information is necessary for uploading artifacts.

The vercel build environment provides a series of system environment variables, perhaps we can use the information. https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables

My scene is deploy with cli command vercel deploy, not github app.

And in some case we not need it in init.

I resolve it with require:

if (PREF_REPORT) {
  const PerfseePlugin = require('@perfsee/webpack').PerfseePlugin;
  plugins.push(
    new PerfseePlugin({
      project: 'xxxxxxx',
    })
  );
}

but will lose type.

image


I claim this issue because in esm, standard import is import xxx from 'xxx' or import('xxx').then(...), no way to sync import module(i know i am in node runtime, just hate use require in typescript)

@forehalo forehalo added the good first issue Good for newcomers label Oct 24, 2022
@forehalo
Copy link
Contributor

Thanks for you remind, and we definitely should avoid reading required information & computing during lib importing. We will work on it and solve this issue asap.

@Brooooooklyn
Copy link
Contributor

This works on Vercel 81d012f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: 📋 Backlog
Development

No branches or pull requests

4 participants