Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-envpreprocess

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-envpreprocess - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

.idea/.name

0

grunt-text-replace.js

@@ -0,0 +0,0 @@ var grunt = require('grunt');

69

Gruntfile.js
/*
* envpreprocess
* https://github.com/Evan/grunt_plugin_test
* https://github.com/ejfrancis/grunt-envpreprocess
*
* Copyright (c) 2015 evanjf
* Copyright (c) 2015 ejfrancis
* Licensed under the MIT license.

@@ -15,43 +15,29 @@ */

grunt.initConfig({
jshint: {
all: [
'Gruntfile.js',
'tasks/*.js',
'<%= nodeunit.tests %>'
],
options: {
jshintrc: '.jshintrc'
}
},
// Before generating any new files, remove any previously-created files.
clean: {
tests: ['tmp']
},
// Configuration to be run (and then tested).
envpreprocess: {
default_options: {
options: {
dev: {
files:{
src: 'demo/config/env.json'
},
files: {
'tmp/default_options': ['test/fixtures/testing', 'test/fixtures/123']
options:{
//replace ENV variables in demo/build_output dir
replacePath: ['demo/build_output/**/*.*'],
environment: 'dev'
}
},
custom_options: {
options: {
separator: ': ',
punctuation: ' !!!'
},
files: {
'tmp/custom_options': ['test/fixtures/testing', 'test/fixtures/123']
}
}
},
// Unit tests.
nodeunit: {
tests: ['test/*_test.js']
}
copy:{
//copy files to demo/build_output dir
main:{
files:[
{
expand:true,
src: ['demo/test.html'],
dest: 'demo/build_output/'
}
]
}
},
//clean the demo/build_output dir
clean:['demo/build_output/']
});

@@ -63,13 +49,8 @@

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-copy');
// Whenever the "test" task is run, first clean the "tmp" dir, then run this
// plugin's task(s), then test the result.
grunt.registerTask('test', ['clean', 'envpreprocess', 'nodeunit']);
// By default, lint and run all tests.
grunt.registerTask('default', ['jshint', 'test']);
grunt.registerTask('default', ['clean','copy', 'envpreprocess:dev']);
};
{
"name": "grunt-envpreprocess",
"description": "A task for replacing environment-specific variables in a specified file or directory. Environment variables are specified in an external .json file.",
"version": "0.1.01",
"version": "0.1.2",
"homepage": "https://github.com/ejfrancis/grunt-envpreprocess",

@@ -25,11 +25,6 @@ "author": {

},
"scripts": {
"test": "grunt test"
},
"dependencies" : {
},
"dependencies": {},
"devDependencies": {
"grunt-contrib-jshint": "^0.9.2",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-nodeunit": "^0.3.3",
"grunt-contrib-copy": "^0.8.2",
"grunt": "~0.4.5"

@@ -43,2 +38,2 @@ },

]
}
}

@@ -49,2 +49,5 @@ # envpreprocess

```
(note that if you don't specify `dev.options.environment`, it will use the target, which in that case is `dev`)
When the task is run, you'll see a log output like this

@@ -133,2 +136,8 @@ ```

### Demo
You can run a simple demo by cloning this repo and running `grunt`. In the `demo/` directory there is `test.html` and `demo/config/env.json` to demonstrate how to define environment variables and use them in HTML/JS. Running `grunt` will copy `test.html` to `demo/build_output/` and then `envpreprocess` will be run to replace the environment variables inside the build output file.
---

@@ -140,1 +149,3 @@

0.1.0 - Initial release. Functionality is working. Not tested.
0.1.1 - added demo
0.1.2 - accepted PR from nicolasbd to use target as environment if not specified in options

@@ -31,3 +31,3 @@ /*

//default environment to 'dev', and grab destination
var environment = "dev",
var environment = this.target || "dev",
dest = this.data.options.replacePath;

@@ -34,0 +34,0 @@ //dest = this.data.files.dest;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc