Skip to content

Commit dbe29c7

Browse files
committed
Create default task to zip package
1 parent b79a0a2 commit dbe29c7

File tree

4 files changed

+152
-2
lines changed

4 files changed

+152
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/build/
2+
/dist/
23
/node_modules/

gulpfile.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// noinspection JSUnusedGlobalSymbols
22

3-
import { dest, watch } from 'gulp';
3+
import { dest, series, src, watch } from 'gulp';
44
import * as ts from 'gulp-typescript';
55
import * as del from 'del';
6+
import * as zip from 'gulp-zip';
67

78
const project = ts.createProject('tsconfig.json');
89

@@ -15,7 +16,17 @@ export function monitor(): NodeJS.EventEmitter {
1516
}
1617

1718
export function clean(): Promise<void> {
18-
return del(['build/**/*.js', 'build/**/*.d.ts']).then(paths => {
19+
return del(['build/**/*.js', 'build/**/*.d.ts', 'dist/*.zip']).then(paths => {
1920
paths.forEach(path => console.log(`Deleted ${path}`));
2021
});
2122
}
23+
24+
function createZip(): NodeJS.ReadWriteStream {
25+
return src(['package*.json', 'build/**/*.js', 'build/**/*.d.ts'], {
26+
base: '.',
27+
})
28+
.pipe(zip('typescript-example.zip'))
29+
.pipe(dest('dist'));
30+
}
31+
32+
export default series(compile, createZip);

package-lock.json

Lines changed: 136 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"homepage": "https://github.com/devbanana/typescript-example#readme",
2121
"devDependencies": {
2222
"@types/gulp": "^4.0.9",
23+
"@types/gulp-zip": "^4.0.2",
2324
"@types/node": "^16.10.1",
2425
"@typescript-eslint/eslint-plugin": "^4.31.2",
2526
"@typescript-eslint/parser": "^4.31.2",
@@ -28,6 +29,7 @@
2829
"eslint-config-prettier": "^8.3.0",
2930
"gulp": "^4.0.2",
3031
"gulp-typescript": "^6.0.0-alpha.1",
32+
"gulp-zip": "^5.1.0",
3133
"prettier": "^2.4.1",
3234
"ts-node": "^10.2.1",
3335
"typescript": "^4.4.3"

0 commit comments

Comments
 (0)