kriasoft / kriasoft/react-firebase-starter
Path is not defined when trying to publish to Github Pages
- Dominant language
- JavaScript
- Stars
- 4.5k
- Forks
- 752
- PR merge metrics
- No merged PRs in 30d
Description
Cannot publish to Github pages. Documentation has an error. https://github.com/kriasoft/react-static-boilerplate/blob/master/docs/recipes/deploy-to-github-pages.md
Code:
```node
tasks.set('publish', () => {
const remote = {
url: 'https://github.com//.git', // TODO: Update deployment URL
branch: 'gh-pages',
};
global.DEBUG = process.argv.includes('--debug') || false;
const spawn = require('child_process').spawn;
const opts = { cwd: path.resolve(__dirname, './public'), stdio: ['ignore', 'inherit', 'inherit'] };
const git = (...args) => new Promise((resolve, reject) => {
spawn('git', args, opts).on('close', code => {
if (code === 0) {
resolve();
} else {
reject(new Error(`git ${args.join(' ')} => ${code} (error)`));
}
});
});
return Promise.resolve()
.then(() => run('clean'))
.then(() => git('init', '--quiet'))
.then(() => git('config', '--get', 'remote.origin.url')
.then(() => git('remote', 'set-url', 'origin', remote.url))
.catch(() => git('remote', 'add', 'origin', remote.url))
)
.then(() => git('ls-remote', '--exit-code', remote.url, 'master')
.then(() => Promise.resolve()
.then(() => git('fetch', 'origin'))
.then(() => git('reset', `origin/${remote.branch}`, '--hard'))
.then(() => git('clean', '--force'))
)
.catch(() => Promise.resolve())
)
.then(() => run('build'))
.then(() => git('add', '.', '--all'))
.then(() => git('commit', '--message', new Date().toUTCString())
.catch(() => Promise.resolve()))
.then(() => git('push', 'origin', `HEAD:${remote.branch}`, '--force', '--set-upstream'));
});
```
Error:
```bash
$ node run publish
Starting 'publish'...
ReferenceError: path is not defined
at tasks.set (/Users/eneff/Desktop/react static/run.js:105:23)
at Promise.resolve.then (/Users/eneff/Desktop/react static/run.js:31:54)
at process._tickCallback (internal/process/next_tick.js:103:7)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
```
Contributor guide
No contributing guide indexed for this repository
Research direction
The deployment instructions are in docs/recipes/deploy-to-github-pages.md; start by comparing the publish snippet with the reported ReferenceError from node run publish and inspect how path is used. Correct the documented example so path is available, then rerun node run publish and confirm it proceeds past that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, github, javascript
- Domain
- documentation, release
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100