* Replace build.proj with gulpfile

* Install packages
This commit is contained in:
David Knise 2023-06-15 08:45:48 -07:00 коммит произвёл GitHub
Родитель 151428d0cb
Коммит fa9c9d0013
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 9025 добавлений и 42 удалений

Просмотреть файл

@ -15,19 +15,25 @@ A GitHub Actions javascript library for running the [Microsoft Security DevOps C
### Preqrequisities:
* Install [dotnet](https://dotnet.microsoft.com/en-us/)
* install [node.js](https://nodejs.org/en) (for npm)
* 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, run:
```powershell
dotnet build ./build.proj [/p:NpmInstall=true|false]
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

Просмотреть файл

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RepoDirectory Condition=" '$(RepoDirectory)' == '' ">$(MSBuildThisFileDirectory)</RepoDirectory>
<SrcDirectory Condition=" '$(SrcDirectory)' == '' ">$(RepoDirectory)/src</SrcDirectory>
<LibDirectory Condition=" '$(LibDirectory)' == '' ">$(RepoDirectory)/lib</LibDirectory>
<NpmInstall Condition=" '$(NpmInstall)' == ''">false</NpmInstall>
</PropertyGroup>
<Target Name="Clean">
<RemoveDir Directories="$(LibDirectory)" />
</Target>
<Target
Name="NpmInstall"
Inputs="$(RepoDirectory)"
Outputs="$(RepoDirectory)\node_modules"
Condition=" '$(NpmInstall)' == 'true' ">
<Message Text="Installing npm dependencies in: $(RepoDirectory)" />
<Exec Command="npm install" WorkingDirectory="$(RepoDirectory)" />
</Target>
<Target Name="Build" DependsOnTargets="Clean;NpmInstall">
<Message Text="Compiling microsoft-security-devops-actions-toolkit." />
<Exec Command="npx tsc" WorkingDirectory="$(RepoDirectory)" />
<Copy SourceFiles="$(RepoDirectory)/package.json" DestinationFolder="$(LibDirectory)" />
<Copy SourceFiles="$(RepoDirectory)/.npmrc" DestinationFolder="$(LibDirectory)" />
</Target>
</Project>

31
gulpfile.js Normal file
Просмотреть файл

@ -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;

8978
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -14,6 +14,10 @@
},
"devDependencies": {
"@types/node": "^20.3.1",
"del": "^7.0.0",
"gulp": "^4.0.2",
"gulp-shell": "^0.8.0",
"gulp-typescript": "^6.0.0-alpha.1",
"typescript": "^5.1.3"
},
"main": "msdo-client.js"