How to use the gulp.step function in gulp

To help you get started, we’ve selected a few gulp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DevExpress / testcafe / Gulpfile.js View on Github external
}));

    return mergeStreams(scripts, bundledScripts)
        .pipe(gulp.dest('lib'));
});

gulp.step('client-scripts', gulp.series('client-scripts-bundle', 'client-scripts-templates-render'));

gulp.step('server-scripts-compile', () => {
    return childProcess
        .spawn('tsc -p src/tsconfig.json', { shell: true, stdio: 'inherit' });
});


// TODO: get rid of this step when we migrate to proper ES6 default imports
gulp.step('server-scripts-add-exports', () => {
    const transform = new Transform({
        objectMode: true,

        transform (file, enc, cb) {
            const fileSource = file.contents.toString();

            if (fileSource.indexOf('exports.default =') >= 0) {
                const sourceMapIndex = fileSource.indexOf('//# sourceMappingURL');
                const modifiedSource = fileSource.slice(0, sourceMapIndex) + 'module.exports = exports.default;\n' + fileSource.slice(sourceMapIndex);

                file.contents = Buffer.from(modifiedSource);
            }

            cb(null, file);
        }
    });
github DevExpress / testcafe / Gulpfile.js View on Github external
}));

    const bundledScripts = scripts
        .pipe(clone())
        .pipe(uglify())
        .pipe(rename(file => {
            file.extname = '.min.js';
        }));

    return mergeStreams(scripts, bundledScripts)
        .pipe(gulp.dest('lib'));
});

gulp.step('client-scripts', gulp.series('client-scripts-bundle', 'client-scripts-templates-render'));

gulp.step('server-scripts-compile', () => {
    return childProcess
        .spawn('tsc -p src/tsconfig.json', { shell: true, stdio: 'inherit' });
});


// TODO: get rid of this step when we migrate to proper ES6 default imports
gulp.step('server-scripts-add-exports', () => {
    const transform = new Transform({
        objectMode: true,

        transform (file, enc, cb) {
            const fileSource = file.contents.toString();

            if (fileSource.indexOf('exports.default =') >= 0) {
                const sourceMapIndex = fileSource.indexOf('//# sourceMappingURL');
                const modifiedSource = fileSource.slice(0, sourceMapIndex) + 'module.exports = exports.default;\n' + fileSource.slice(sourceMapIndex);
github DevExpress / testcafe / Gulpfile.js View on Github external
if (BROWSER_ALIAS)
        process.env.BROWSER_ALIAS = BROWSER_ALIAS;

    return testFunctional(TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.remote, functionalTestConfig.browserProviderNames.remote);
});

gulp.task('test-functional-remote', gulp.series('prepare-tests', 'test-functional-remote-run'));

gulp.step('test-functional-local-legacy-run', () => {
    return testFunctional(LEGACY_TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.legacy);
});

gulp.task('test-functional-local-legacy', gulp.series('prepare-tests', 'test-functional-local-legacy-run'));

gulp.step('test-functional-local-multiple-windows-run', () => {
    return testFunctional(MULTIPLE_WINDOWS_TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.localChrome, null, true);
});

gulp.task('test-functional-local-multiple-windows', gulp.series('prepare-tests', 'test-functional-local-multiple-windows-run'));

function getDockerEnv (machineName) {
    return childProcess
        .execSync('docker-machine env --shell bash ' + machineName)
        .toString()
        .split('\n')
        .map(line => {
            return line.match(/export\s*(.*)="(.*)"$/);
        })
        .filter(match => {
            return !!match;
        })
github DevExpress / testcafe-react-selectors / Gulpfile.js View on Github external
getRootElsReact15: loadModule('./src/react-15/get-root-els.js'),
            getRootElsReact16: loadModule('./src/react-16/get-root-els.js'),

            selectorReact15: loadModule('./src/react-15/index.js'),
            selectorReact16: loadModule('./src/react-16/index.js'),

            react15Utils: loadModule('./src/react-15/react-utils.js'),
            react16Utils: loadModule('./src/react-16/react-utils.js'),

            waitForReact: loadModule('./src/wait-for-react.js')
        }))
        .pipe(rename('index.js'))
        .pipe(gulp.dest('lib/tmp'));
});

gulp.step('transpile', gulp.series('build-selectors-script', () => {
    return gulp
        .src('lib/tmp/**/*.js')
        .pipe(babel({ extends: pathJoin(__dirname, './src/.babelrc') }))
        .pipe(gulp.dest('lib'));
}));

gulp.step('clean-build-tmp-resources', cb => {
    del(['lib/tmp'], cb);
});

gulp.step('build-nextjs-app', gulp.series('build-test-app', () => {
    const appPath = pathJoin(__dirname, './test/data/lib/server-render');

    return nextBuild(appPath, require('./next.config.js'));
}));
github DevExpress / testcafe / Gulpfile.js View on Github external
gulp.task('test-functional-travis-mobile', gulp.series('prepare-tests', 'test-functional-travis-mobile-run'));

gulp.step('test-functional-local-run', () => {
    return testFunctional(TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.localBrowsers);
});

gulp.task('test-functional-local', gulp.series('prepare-tests', 'test-functional-local-run'));

gulp.step('test-functional-local-ie-run', () => {
    return testFunctional(TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.localBrowsersIE);
});

gulp.task('test-functional-local-ie', gulp.series('prepare-tests', 'test-functional-local-ie-run'));

gulp.step('test-functional-local-chrome-firefox-run', () => {
    return testFunctional(TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.localBrowsersChromeFirefox);
});

gulp.task('test-functional-local-chrome-firefox', gulp.series('prepare-tests', 'test-functional-local-chrome-firefox-run'));

gulp.step('test-functional-local-headless-chrome-run', () => {
    return testFunctional(TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.localHeadlessChrome);
});

gulp.task('test-functional-local-headless-chrome', gulp.series('prepare-tests', 'test-functional-local-headless-chrome-run'));

gulp.step('test-functional-local-headless-firefox-run', () => {
    return testFunctional(TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.localHeadlessFirefox);
});

gulp.task('test-functional-local-headless-firefox', gulp.series('prepare-tests', 'test-functional-local-headless-firefox-run'));
github DevExpress / testcafe / Gulpfile.js View on Github external
gulp.task('clean-website', () => {
    return del('site');
});

gulp.step('fetch-assets-repo', cb => {
    git.clone('https://github.com/DevExpress/testcafe-gh-page-assets.git', { args: 'site' }, cb);
});

gulp.step('put-in-articles', () => {
    return gulp
        .src(['docs/articles/**/*', '!docs/articles/blog/**/*'])
        .pipe(gulp.dest('site/src'));
});

gulp.step('put-in-posts', () => {
    return gulp
        .src('docs/articles/blog/**/*')
        .pipe(gulp.dest('site/src/_posts'));
});

gulp.step('put-in-navigation', () => {
    return gulp
        .src('docs/nav/**/*')
        .pipe(gulp.dest('site/src/_data'));
});

gulp.step('put-in-publications', () => {
    return gulp
        .src('docs/publications/**/*')
        .pipe(gulp.dest('site/src/_data'));
});
github DevExpress / testcafe / Gulpfile.js View on Github external
.pipe(gulp.dest('site/src/_posts'));
});

gulp.step('put-in-navigation', () => {
    return gulp
        .src('docs/nav/**/*')
        .pipe(gulp.dest('site/src/_data'));
});

gulp.step('put-in-publications', () => {
    return gulp
        .src('docs/publications/**/*')
        .pipe(gulp.dest('site/src/_data'));
});

gulp.step('put-in-tweets', () => {
    return gulp
        .src('docs/tweets/**/*')
        .pipe(gulp.dest('site/src/_data'));
});

gulp.step('put-in-website-content', gulp.parallel('put-in-articles', 'put-in-navigation', 'put-in-posts', 'put-in-publications', 'put-in-tweets'));
gulp.step('prepare-website-content', gulp.series('clean-website', 'fetch-assets-repo', 'put-in-website-content'));

gulp.step('prepare-website', gulp.parallel('lint-docs', 'prepare-website-content'));

function buildWebsite (mode, cb) {
    const spawnEnv = process.env;

    if (mode)
        spawnEnv.JEKYLL_ENV = mode;
github DevExpress / testcafe / Gulpfile.js View on Github external
childProcess.execSync(command, { stdio: 'inherit', env: process.env });

    done();
});

gulp.task('docker-test', done => {
    ensureDockerEnvironment();

    childProcess.execSync(`docker build --no-cache --build-arg tag=${packageInfo.version} -t docker-server-tests -f test/docker/Dockerfile .`,
        { stdio: 'inherit', env: process.env });

    done();
});

gulp.step('docker-publish-run', done => {
    PUBLISH_TAGS.forEach(tag => {
        childProcess.execSync(`docker push ${PUBLISH_REPO}:${tag}`, { stdio: 'inherit', env: process.env });
    });

    done();
});

gulp.task('docker-publish', gulp.series('docker-build', 'docker-test', 'docker-publish-run'));

gulp.task('travis', process.env.GULP_TASK ? gulp.series(process.env.GULP_TASK) : () => {});
github DevExpress / testcafe / Gulpfile.js View on Github external
git.clone('https://github.com/DevExpress/testcafe-gh-page-assets.git', { args: 'site' }, cb);
});

gulp.step('put-in-articles', () => {
    return gulp
        .src(['docs/articles/**/*', '!docs/articles/blog/**/*'])
        .pipe(gulp.dest('site/src'));
});

gulp.step('put-in-posts', () => {
    return gulp
        .src('docs/articles/blog/**/*')
        .pipe(gulp.dest('site/src/_posts'));
});

gulp.step('put-in-navigation', () => {
    return gulp
        .src('docs/nav/**/*')
        .pipe(gulp.dest('site/src/_data'));
});

gulp.step('put-in-publications', () => {
    return gulp
        .src('docs/publications/**/*')
        .pipe(gulp.dest('site/src/_data'));
});

gulp.step('put-in-tweets', () => {
    return gulp
        .src('docs/tweets/**/*')
        .pipe(gulp.dest('site/src/_data'));
});
github DevExpress / testcafe-react-selectors / Gulpfile.js View on Github external
.pipe(rename('index.js'))
        .pipe(gulp.dest('lib/tmp'));
});

gulp.step('transpile', gulp.series('build-selectors-script', () => {
    return gulp
        .src('lib/tmp/**/*.js')
        .pipe(babel({ extends: pathJoin(__dirname, './src/.babelrc') }))
        .pipe(gulp.dest('lib'));
}));

gulp.step('clean-build-tmp-resources', cb => {
    del(['lib/tmp'], cb);
});

gulp.step('build-nextjs-app', gulp.series('build-test-app', () => {
    const appPath = pathJoin(__dirname, './test/data/lib/server-render');

    return nextBuild(appPath, require('./next.config.js'));
}));

gulp.task('build', gulp.series('clean', 'lint', 'transpile', 'clean-build-tmp-resources'));

gulp.step('run-tests', cb => {
    glob('test/fixtures/**/*.{js,ts}', (err, files) => {
        if (err) throw err;

        startTestServer()
            .then(() => createTestCafe('localhost', 1337, 1338))
            .then(testCafe => {
                return testCafe.createRunner()
                    .src(files)