Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Typescript + npm cleanup #238

Merged
merged 1 commit into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ try {

if ($PSCmdlet.ShouldProcess("$PSScriptRoot\src\nerdbank-gitversioning.npm", "gulp")) {
cd "$PSScriptRoot\src\nerdbank-gitversioning.npm"
.\node_modules\.bin\gulp.cmd
npm run build
if ($LASTEXITCODE -ne 0) {
throw "Node build failed"
}
Expand Down
5 changes: 0 additions & 5 deletions init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ try {
if ($PSCmdlet.ShouldProcess("$PSScriptRoot\src\nerdbank-gitversioning.npm", "npm install")) {
npm install --loglevel error
}

Write-Host "Restoring Typings..." -ForegroundColor Yellow
if ($PSCmdlet.ShouldProcess("$PSScriptRoot\src\nerdbank-gitversioning.npm", "typings install")) {
.\node_modules\.bin\typings install
}
} finally {
Pop-Location
}
Expand Down
27 changes: 15 additions & 12 deletions src/nerdbank-gitversioning.npm/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ var del = require('del');
var path = require('path');

const outDir = 'out';
var tsProject = ts.createProject('tsconfig.json', { declarationFiles: true });
var tsProject = ts.createProject('tsconfig.json', {
declarationFiles: true,
typescript: require('typescript'),
});

gulp.task('tsc', function() {
var tsResult = gulp.src(['*.ts', 'ts/**/*.ts', 'typings/**/*.ts'])
gulp.task('tsc', function () {
var tsResult = gulp.src(['*.ts', 'ts/**/*.ts', 'node_modules/@types/**/index.d.ts'])
// .pipe(tslint())
.pipe(sourcemaps.init())
.pipe(ts(tsProject));
Expand All @@ -25,7 +28,7 @@ gulp.task('tsc', function() {
]);
});

gulp.task('copyPackageContents', ['tsc'], function() {
gulp.task('copyPackageContents', ['tsc'], function () {
return gulp
.src([
'package.json',
Expand All @@ -35,35 +38,35 @@ gulp.task('copyPackageContents', ['tsc'], function() {
.pipe(gulp.dest(outDir));
});

gulp.task('setPackageVersion', ['copyPackageContents'], function() {
gulp.task('setPackageVersion', ['copyPackageContents'], function () {
var nbgv = require(`./${outDir}`);
return nbgv.setPackageVersion(outDir, '.');
});

gulp.task('package', ['setPackageVersion'], function() {
gulp.task('package', ['setPackageVersion'], function () {
var afs = require('./out/asyncio');
var binDir = '../../bin/js';
var binDir = '../../bin/js';
return afs.mkdirIfNotExistAsync(binDir)
.then(function() {
.then(function () {
var ap = require('./out/asyncprocess');
return ap.execAsync(`npm pack "${path.join(__dirname, outDir)}"`, { cwd: binDir });
});
});

gulp.task('clean', function() {
gulp.task('clean', function () {
return del([
outDir
])
});

gulp.task('default', ['package'], function() {
gulp.task('default', ['package'], function () {
});

gulp.task('watch', ['tsc'], function() {
gulp.task('watch', ['tsc'], function () {
return gulp.watch('**/*.ts', ['tsc']);
});

gulp.task('test', ['tsc'], async function() {
gulp.task('test', ['tsc'], async function () {
var nbgv = require('./out');
var v = await nbgv.getVersion();
console.log(v);
Expand Down
7 changes: 5 additions & 2 deletions src/nerdbank-gitversioning.npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,20 @@
"versioning"
],
"devDependencies": {
"@types/node": "^10.12.0",
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-sourcemaps": "1.6.0",
"gulp-typescript": "2.13.6",
"gulp-util": "^3.0.7",
"merge2": "1.0.2",
"path": "^0.12.7",
"typescript": "1.8.10",
"typings": "1.3.3"
"typescript": "^2.9.2"
},
"dependencies": {
"camel-case": "^3.0.0"
},
"scripts": {
"build": "gulp"
}
}
28 changes: 16 additions & 12 deletions src/nerdbank-gitversioning.npm/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"compilerOptions": {
"target": "es6",
"declaration": true,
"module": "commonjs",
"sourceMap": true,
"noImplicitAny": false,
"outDir": "js"
},
"exclude": [
"node_modules",
"js"
]
"compilerOptions": {
"target": "es6",
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"noImplicitAny": false,
"outDir": "js"
},
"types": [
"node"
],
"exclude": [
"node_modules",
"js"
]
}
10 changes: 0 additions & 10 deletions src/nerdbank-gitversioning.npm/typings.json

This file was deleted.