File tree Expand file tree Collapse file tree 6 files changed +43
-13
lines changed Expand file tree Collapse file tree 6 files changed +43
-13
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ define(['exports'], function (exports) {
24
24
25
25
var _options = Object . assign ( { } , options , defaultOptions ) ;
26
26
var envFile = new XMLHttpRequest ( ) ;
27
- envFile . open ( " GET" , _options . path + _options . file , false ) ;
27
+ envFile . open ( ' GET' , _options . path + _options . file , true ) ;
28
28
envFile . send ( ) ;
29
29
}
30
30
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ exports.__esModule = true;
4
4
exports . load = load ;
5
5
exports . parse = parse ;
6
6
var defaultOptions = {
7
- path : './src/ ' ,
8
- file : '.env '
7
+ path : './' ,
8
+ file : 'package.json '
9
9
} ;
10
10
11
11
function isFileApiAvailable ( ) {
@@ -23,7 +23,7 @@ function load(options) {
23
23
24
24
var _options = Object . assign ( { } , options , defaultOptions ) ;
25
25
var envFile = new XMLHttpRequest ( ) ;
26
- envFile . open ( " GET" , _options . path + _options . file , false ) ;
26
+ envFile . open ( ' GET' , _options . path + _options . file , true ) ;
27
27
envFile . send ( ) ;
28
28
}
29
29
Original file line number Diff line number Diff line change 1
1
let defaultOptions = {
2
- path : './src/ ' ,
3
- file : '.env '
2
+ path : './' ,
3
+ file : 'package.json '
4
4
} ;
5
5
6
6
function isFileApiAvailable ( ) {
@@ -18,7 +18,7 @@ export function load(options : any) {
18
18
19
19
let _options = Object . assign ( { } , options , defaultOptions ) ;
20
20
let envFile = new XMLHttpRequest ( ) ;
21
- envFile . open ( " GET" , _options . path + _options . file , false ) ;
21
+ envFile . open ( ' GET' , _options . path + _options . file , true ) ;
22
22
envFile . send ( ) ;
23
23
}
24
24
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ System.register([], function (_export) {
22
22
23
23
var _options = Object . assign ( { } , options , defaultOptions ) ;
24
24
var envFile = new XMLHttpRequest ( ) ;
25
- envFile . open ( " GET" , _options . path + _options . file , false ) ;
25
+ envFile . open ( ' GET' , _options . path + _options . file , true ) ;
26
26
envFile . send ( ) ;
27
27
}
28
28
@@ -32,8 +32,8 @@ System.register([], function (_export) {
32
32
setters : [ ] ,
33
33
execute : function ( ) {
34
34
defaultOptions = {
35
- path : './src/ ' ,
36
- file : '.env '
35
+ path : './' ,
36
+ file : 'package.json '
37
37
} ;
38
38
}
39
39
} ;
Original file line number Diff line number Diff line change
1
+ let defaultOptions = {
2
+ path : './' ,
3
+ file : 'package.json'
4
+ } ;
5
+
6
+ function isFileApiAvailable ( ) {
7
+ if ( window . File && window . FileReader && window . FileList && window . Blob ) {
8
+ return true ;
9
+ }
10
+
11
+ return false ;
12
+ }
13
+
14
+ export function load ( options : any ) {
15
+ if ( isFileApiAvailable ( ) === false ) {
16
+ console . log ( 'File api is not available to load the aurelia environment.' ) ;
17
+ }
18
+
19
+ let _options = Object . assign ( { } , options , defaultOptions ) ;
20
+ let envFile = new XMLHttpRequest ( ) ;
21
+ envFile . open ( 'GET' , _options . path + _options . file , true ) ;
22
+ envFile . send ( ) ;
23
+ }
24
+
25
+ export function parse ( content : string ) {
26
+ return content ;
27
+ }
Original file line number Diff line number Diff line change 1
- describe ( 'testing configure routine' , ( ) => {
2
- it ( 'should export configure function' , ( ) => {
3
- expect ( true ) . toBe ( true ) ;
1
+ import { parse } from '../../src/index' ;
2
+
3
+ describe ( 'testing load routine' , ( ) => {
4
+ it ( 'should parse the string input configure function' , ( ) => {
5
+ let content = 'test' ;
6
+ expect ( parse ( content ) ) . toEqual ( content ) ;
4
7
} ) ;
5
8
} ) ;
You can’t perform that action at this time.
0 commit comments