Giter Club home page Giter Club logo

gulp-env's People

Contributors

russmatney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-env's Issues

Rename

Why is this called gulp-env? It has nothing to do with gulp!

Crash on comments in .env files

I have a .env file which uses comments:

.env

# Here is a comment
DB_HOST=localhost
DB_USER=root

This leads to a crash when using gulp-env because it cannot parse comments:

[23:29:04] Using gulpfile D:\dev\projects\bennyn\mondlandung\gulpfile.js
[23:29:04] Starting 'set-env'...
[23:29:04] 'set-env' errored after 7.08 ms
[23:29:04] D:\dev\projects\bennyn\mondlandung\.env:1
(function (exports, require, module, __filename, __dirname) { # Here is a comment
                                                              ^

SyntaxError: Invalid or unexpected token
    at new Script (vm.js:73:7)
    at createScript (vm.js:245:10)
    at Object.runInThisContext (vm.js:297:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)

gulpfile.js

const env = require('gulp-env');
const gulp = require('gulp');

gulp.task('default', ['set-env'], () => {
  console.log('Hello World', process.env.NODE_DEBUG);
});

gulp.task('set-env', function () {
  env({
    file: '.env',
    vars: {
      FORCE_COLOR: 1,
      NODE_DEBUG: 'moon:*',
      NTBA_FIX_319: 1,
    }
  });
});

type: string doesn't work

plugins.env({
      file: '.env.json',
      type: string,
      vars: {}
    });
[11:49:18] Starting 'set-env'...
error with set-env:  ReferenceError: string is not defined

env.reset is changing the return value of gulp

I have this test task:

gulp.task('test', () => {
  const testEnv = gulpEnv.set({NODE_ENV: 'test'});
  return gulp.src(paths.js.test)
    .pipe(testEnv)
    .pipe(ava({nyc: true}))
    .pipe(testEnv.reset);
});

If I run gulp test the process return value ($?) is zero, regardless of the outcome of my tests.
This is bad and makes this module unusable for CI purposes.

Publish 0.4.0 to npm?

Currently, npm has this at 0.2.0, and that version doesn't behave as expected based on the current README here. Please publish 0.4.0 to npm, so it matches current master.

fails to parse typical .env file format

➜  benchmark-client git:(51_split_sites) ✗ gulp load-envs
[19:22:17] Using gulpfile ~/Projects/benchmark-client/gulpfile.js
[19:22:17] Starting 'load-envs'...

/Users/kenneth/Projects/benchmark-client/.env:1
ts, require, module, __filename, __dirname) { BENCHMARK_API_URL=http://localho
                                                                    ^
[19:22:17] 'load-envs' errored after 969 μs
[19:22:17] SyntaxError: Unexpected token :
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at module.exports (/Users/kenneth/Projects/benchmark-client/node_modules/gulp-env/index.js:5:15)
    at Gulp.gulp.task.gulp.src.pipe.plugins.angularTemplatecache.root (/Users/kenneth/Projects/benchmark-client/gulpfile.js:28:5)
    at module.exports (/Users/kenneth/Projects/benchmark-client/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/kenneth/Projects/benchmark-client/node_modules/gulp/node_modules/orchestrator/index.js:273:3)

My .env file is setup like:

➜  benchmark-client git:(51_split_sites) ✗ cat .env
BENCHMARK_API_URL=http://localhost:8000

Thoughts on supporting this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.