1
- var now = new Date ( ) . toISOString ( ) ;
1
+ const childProcess = require ( "child_process" ) ;
2
+ const now = new Date ( ) . toISOString ( ) ;
2
3
3
4
function shallowCopy ( obj ) {
4
5
var result = { } ;
5
- Object . keys ( obj ) . forEach ( function ( key ) {
6
+ Object . keys ( obj ) . forEach ( function ( key ) {
6
7
result [ key ] = obj [ key ] ;
7
8
} ) ;
8
9
return result ;
@@ -11,10 +12,10 @@ function shallowCopy(obj) {
11
12
var travis = process . env [ "TRAVIS" ] ;
12
13
var buildNumber = process . env [ "PACKAGE_VERSION" ] || process . env [ "BUILD_NUMBER" ] || "non-ci" ;
13
14
14
- module . exports = function ( grunt ) {
15
+ module . exports = function ( grunt ) {
15
16
var path = require ( "path" ) ;
16
17
var commonLibNodeModules = path . join ( "lib" , "common" , "node_modules" ) ;
17
- if ( require ( "fs" ) . existsSync ( commonLibNodeModules ) ) {
18
+ if ( require ( "fs" ) . existsSync ( commonLibNodeModules ) ) {
18
19
grunt . file . delete ( commonLibNodeModules ) ;
19
20
}
20
21
grunt . file . write ( path . join ( "lib" , "common" , ".d.ts" ) , "" ) ;
@@ -50,17 +51,6 @@ module.exports = function(grunt) {
50
51
} ,
51
52
} ,
52
53
53
- tslint : {
54
- build : {
55
- files : {
56
- src : [ "lib/**/*.ts" , "test/**/*.ts" , "!lib/common/node_modules/**/*.ts" , "!lib/common/messages/**/*.ts" , "lib/common/test/unit-tests/**/*.ts" , "definitions/**/*.ts" , "!lib/**/*.d.ts" , "!test/**/*.d.ts" ]
57
- } ,
58
- options : {
59
- configuration : grunt . file . readJSON ( "./tslint.json" )
60
- }
61
- }
62
- } ,
63
-
64
54
watch : {
65
55
devall : {
66
56
files : [ "lib/**/*.ts" , 'test/**/*.ts' , "!lib/common/node_modules/**/*.ts" , "!lib/common/messages/**/*.ts" ] ,
@@ -96,7 +86,7 @@ module.exports = function(grunt) {
96
86
command : "npm pack" ,
97
87
options : {
98
88
execOptions : {
99
- env : ( function ( ) {
89
+ env : ( function ( ) {
100
90
var env = shallowCopy ( process . env ) ;
101
91
env [ "NATIVESCRIPT_SKIP_POSTINSTALL_TASKS" ] = "1" ;
102
92
return env ;
@@ -145,7 +135,7 @@ module.exports = function(grunt) {
145
135
grunt . loadNpmTasks ( "grunt-ts" ) ;
146
136
grunt . loadNpmTasks ( "grunt-tslint" ) ;
147
137
148
- grunt . registerTask ( "set_package_version" , function ( version ) {
138
+ grunt . registerTask ( "set_package_version" , function ( version ) {
149
139
var buildVersion = version !== undefined ? version : buildNumber ;
150
140
if ( process . env [ "BUILD_CAUSE_GHPRBCAUSE" ] ) {
151
141
buildVersion = "PR" + buildVersion ;
@@ -154,16 +144,20 @@ module.exports = function(grunt) {
154
144
var packageJson = grunt . file . readJSON ( "package.json" ) ;
155
145
var versionParts = packageJson . version . split ( "-" ) ;
156
146
if ( process . env [ "RELEASE_BUILD" ] ) {
157
- // HACK - excluded until 1.0.0 release or we refactor our project infrastructure (whichever comes first)
158
- // packageJson.version = versionParts[0];
147
+ // HACK - excluded until 1.0.0 release or we refactor our project infrastructure (whichever comes first)
148
+ // packageJson.version = versionParts[0];
159
149
} else {
160
150
versionParts [ 1 ] = buildVersion ;
161
151
packageJson . version = versionParts . join ( "-" ) ;
162
152
}
163
153
grunt . file . write ( "package.json" , JSON . stringify ( packageJson , null , " " ) ) ;
164
154
} ) ;
165
155
166
- grunt . registerTask ( "enableScripts" , function ( enable ) {
156
+ grunt . registerTask ( "tslint:build" , function ( version ) {
157
+ childProcess . execSync ( "npm run tslint" , { stdio : "inherit" } ) ;
158
+ } ) ;
159
+
160
+ grunt . registerTask ( "enableScripts" , function ( enable ) {
167
161
var enableTester = / f a l s e / i;
168
162
var newScriptsAttr = ! enableTester . test ( enable ) ? "scripts" : "skippedScripts" ;
169
163
var packageJson = grunt . file . readJSON ( "package.json" ) ;
0 commit comments