-
Notifications
You must be signed in to change notification settings - Fork 133
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
markbind deploy error after migrating Site/index.js to TypeScript #2333
Comments
const options: DeployOptions = {
branch: this.siteConfig.deploy.branch || defaultDeployConfig.branch,
message: this.siteConfig.deploy.message || defaultDeployConfig.message,
repo: this.siteConfig.deploy.repo || defaultDeployConfig.repo,
remote: '',
}; from here It seems that the issue is due to the Proposed fix:- remote: '',
+ remote: defaultDeployConfig.remote, if we want users to be able to define their remote, then some extra lines are needed in Deployed website as proof of fix: https://willcwx.github.io/ghpages-test I can't find any other causes as I'm not getting anymore errors after this fix. Side note:
|
Thanks @WillCWX, it does look like the culprit here. I was suspecting that line but did not pursue it further as I was thinking the remote attribute might be passed in from somewhere else, but it seems like it is not being exposed to the public at all. Also because I was wondering why this existing test case did not fail: Re your points:
We don't need it now if not affecting anything and not being requested by any user
It's ok if we can't add another test but we should investigate why the existing test case is passing (false positive?)
Would you like to go ahead and raise a PR? 👀, take note of typescript migration steps in https://markbind-master.netlify.app/devguide/development/migratingtotypescript |
Can I confirm that I will be making brand new migration commits instead of reverting the revert?
TLDR: The code is broken up a lot so its difficult to follow but here is what it looks like together: // begin
deploy(ciTokenVar: string | boolean) {
const defaultDeployConfig: DeployOptions = {
branch: 'gh-pages',
message: 'Site Update.',
repo: '',
remote: 'origin', // default is correct
};
process.env.NODE_DEBUG = 'gh-pages';
return this.generateDepUrl(ciTokenVar, defaultDeployConfig);
}
// next
async generateDepUrl(ciTokenVar: boolean | string, defaultDeployConfig: DeployOptions) {
const publish = Bluebird.promisify(ghpages.publish);
await this.readSiteConfig();
const depOptions = await this.getDepOptions(ciTokenVar, defaultDeployConfig, publish); // causes error
return Site.getDepUrl(depOptions, defaultDeployConfig); // causes options.remote to be 'origin'
}
// function that causes wrong options.remote
async getDepOptions(ciTokenVar: boolean | string, defaultDeployConfig: DeployOptions,
publish: (basePath: string, options: DeployOptions) => Bluebird<unknown>) {
const options: DeployOptions = {
branch: this.siteConfig.deploy.branch || defaultDeployConfig.branch,
message: this.siteConfig.deploy.message || defaultDeployConfig.message,
repo: this.siteConfig.deploy.repo || defaultDeployConfig.repo,
remote: '', // error here
};
// ......... code that doesn't edit options.remote
// sets ghpages.options
await publish(basePath, options); // should throw an error but can't since it is mocked
return options;
}
// then this is ran and fixes options.remote
static getDepUrl(options: DeployOptions, defaultDeployConfig: DeployOptions) {
const git = simpleGit({ baseDir: process.cwd() });
// fixes options.remote to be correct
options.remote = defaultDeployConfig.remote;
return Site.getDeploymentUrl(git, options);
}
// as options is passed by reference throughout
ghpages.options.remote == 'origin' |
Yes, basically re-migrate this file, taking reference from the original migration + retaining the few lines of changes that I updated in my revert (which were due to other PRs),
So is it fixable? |
Ok I'll work on it
Yes just do this at here: - options.remote = defaultDeployConfig.remote; I'll do the fix in the same PR |
Just wondering... if this is the case, why isn't options.remote updated correctly to 'origin', since even as we incorrectly assigned it to '', it is still being overridden here back to 'origin'? |
The error occurs at this function at
|
Please confirm that you have searched existing issues in the repo
Yes, I have searched the existing issues
Any related issues?
No response
Tell us about your environment
Windows 10
MarkBind version
Master branch
Describe the bug and the steps to reproduce it
Issue discovered after V5.0.0 is released. See detailed info and what has been done about it in this follow-up PR: #2331
TLDR:
Expected behavior
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: