Skip to content

Commit

Permalink
Use gulp.js
Browse files Browse the repository at this point in the history
* Switch to gulp build

* Working gulp build

* add script

* Remove npm install from gulp build
  • Loading branch information
davidknise authored Jun 15, 2023
1 parent 62416f8 commit 69f9d6c
Show file tree
Hide file tree
Showing 6 changed files with 8,427 additions and 677 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Build output
lib/

# Logs
logs
*.log
Expand Down
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,25 @@ An Azure DevOps javascript library for running the [Microsoft Security DevOps CL

### Preqrequisities:

* Install [dotnet](https://dotnet.microsoft.com/en-us/)
* install [node.js](https://nodejs.org/en) (for npm)

To build, run:
```powershell
dotnet build ./build.proj [/p:NpmInstall=true|false]
* Install [node.js](https://nodejs.org/en) (for npm)
* Install [gulp-cli](https://www.npmjs.com/package/gulp-cli) globally:
```
npm install -g gulp-cli
```
* Install node package dependencies
```
npm install
```

To build, simply run `gulp` in the root of the repo:
```
gulp
```

The build:
1. If `NpmInstall` is true, runs `npm install` at the root of the repo
1. Compiles the typescript in the `./src` directory
1. Outputs javascript to the `./lib` directory
1. Copies the `./package.json` file to the `./lib` folder
1. Outputs javascript to the `./dist` directory
1. Copies the `./package.json` file to the `./dist` folder

## Publish

Expand Down
32 changes: 0 additions & 32 deletions build.proj

This file was deleted.

31 changes: 31 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const gulp = require('gulp');
const shell = require('gulp-shell');
const ts = require('gulp-typescript');

const tsProject = ts.createProject('tsconfig.json');

function clean(cb) {
import('del')
.then((del) => del.deleteSync(['dist']))
.then(() => cb());
}

function compile(cb) {
tsProject
.src()
.pipe(tsProject()).js
.pipe(gulp.dest('dist'));
cb();
}

function copyPackageJson(cb) {
gulp
.src('package.json')
.pipe(gulp.dest('dist'));
cb();
}

exports.clean = clean;
exports.compile = compile;
exports.build = gulp.series(clean, compile, copyPackageJson);
exports.default = exports.build;
Loading

0 comments on commit 69f9d6c

Please sign in to comment.