G
G
Gagatyn2020-12-03 19:59:35
JavaScript
Gagatyn, 2020-12-03 19:59:35

How to deploy a gulp-built project to git?

All according to instructions from the Internet.
The gulp-gh-pages page describes a deployment in a couple of lines.
Parameters that are not specified in the example by default:
options.remoteUrl- by default takes the current link to the repository https://github.com/имя/имя-репозитрия,
options.branch by default gulpfile.jsgh-pages
code with the code for deployment . When running, not on the master(main) command , but , the error is:

npm run deploydeploy = gulp deploy

TypeError: Cannot read property '0' of null
    at Function.module.exports.Commit.actor (С:\...\node_modules\gift\lib\commit.js)
at Function.module.exports.Commit.parse_commits (C:\..\node_modules\gift\lib\commit.js:111:21)
    at C:\...\node_modules\gift\lib\commit.js:55:39
    at ChildProcess.exithandler (child_process.js:294:7)
    at ChildProcess.exithandler (child_process.js:294:7)
    at ChildProcess.EventEmitter.emit (domain.js:506:15)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
    at Process.callbackTrampoline (internal/async_hooks.js:120:14)
...
npm ERR! [email protected] deploy: `gulp deploy`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
...

And that's it. It didn't work out. Amazing.
In boarding schools they wrote that the reason is empty <img src="" />, I checked my html, there are no empty ones.

Tell me, please, how to complete the case and see the gh-pagescompiled project?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dennis, 2020-12-03
@dennis_d

In the repository on Github, you need to create a new branch named 'gh-pages' . Go to the repository's Settings, scroll down to GitHub Pages and specify this branch in the settings.
And in gulpfile.js you need to write the path where the compiled project is located, something like this

const gulp = require('gulp');
const ghPages = require('gulp-gh-pages');

gulp.task('deploy', function() {
    return gulp.src('./dist/**/*')
        .pipe(ghPages());
});

where dist is the folder with the finished compilation of the project
And everything will work.

I
ilonikso, 2020-12-04
@ilonikso

Make a task in package json.
gulp build - a task from galp to build the project, gh-pages -d build will automatically create the gh-pages branch, and throw the assembled project into it and change all the settings, so you just need to open the site using the link.
Before that, create a repository, and connect the remote to the local one.

"scripts": {
    "deploy": "gulp build && gh-pages -d build"
  },

If you know English, it explains in detail how easy it is to set up
https://www.youtube.com/watch?v=SKXkC4SqtRk&ab_cha...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question