From 80fbd1e6aef408555e95726ced74ed25d04a9d39 Mon Sep 17 00:00:00 2001 From: Krish Date: Tue, 6 Feb 2024 10:34:03 +0530 Subject: [PATCH] feat: gulp zip implemented --- package.json | 2 +- template-alpine-js/package.json | 5 ++++- template-alpine-js/src/zip.js | 10 ++++++++++ template-alpine-ts/package.json | 5 ++++- template-alpine-ts/src/zip.js | 10 ++++++++++ template-inferno-js/package.json | 5 ++++- template-inferno-js/src/zip.js | 10 ++++++++++ template-inferno-ts/package.json | 5 ++++- template-inferno-ts/src/zip.js | 10 ++++++++++ template-lit-js/package.json | 5 ++++- template-lit-js/src/zip.js | 10 ++++++++++ template-lit-ts/package.json | 5 ++++- template-lit-ts/src/zip.js | 10 ++++++++++ template-preact-js/package.json | 5 ++++- template-preact-js/src/zip.js | 10 ++++++++++ template-preact-ts/package.json | 5 ++++- template-preact-ts/src/zip.js | 10 ++++++++++ template-react-js/package.json | 5 ++++- template-react-js/src/zip.js | 10 ++++++++++ template-react-ts/package.json | 5 ++++- template-react-ts/src/zip.js | 10 ++++++++++ template-solid-js/package.json | 5 ++++- template-solid-js/src/zip.js | 10 ++++++++++ template-solid-ts/package.json | 5 ++++- template-solid-ts/src/zip.js | 10 ++++++++++ template-stencil-ts/package.json | 5 ++++- template-stencil-ts/src/zip.js | 10 ++++++++++ template-svelte-js/package.json | 6 ++++-- template-svelte-js/src/zip.js | 10 ++++++++++ template-svelte-ts/package.json | 8 +++++--- template-svelte-ts/src/zip.js | 10 ++++++++++ template-vanilla-js/package.json | 6 ++++-- template-vanilla-js/src/zip.js | 10 ++++++++++ template-vanilla-ts/package.json | 6 ++++-- template-vanilla-ts/src/zip.js | 10 ++++++++++ template-vue-js/package.json | 5 ++++- template-vue-js/src/zip.js | 10 ++++++++++ template-vue-ts/package.json | 5 ++++- template-vue-ts/src/zip.js | 10 ++++++++++ 39 files changed, 268 insertions(+), 25 deletions(-) create mode 100644 template-alpine-js/src/zip.js create mode 100644 template-alpine-ts/src/zip.js create mode 100644 template-inferno-js/src/zip.js create mode 100644 template-inferno-ts/src/zip.js create mode 100644 template-lit-js/src/zip.js create mode 100644 template-lit-ts/src/zip.js create mode 100644 template-preact-js/src/zip.js create mode 100644 template-preact-ts/src/zip.js create mode 100644 template-react-js/src/zip.js create mode 100644 template-react-ts/src/zip.js create mode 100644 template-solid-js/src/zip.js create mode 100644 template-solid-ts/src/zip.js create mode 100644 template-stencil-ts/src/zip.js create mode 100644 template-svelte-js/src/zip.js create mode 100644 template-svelte-ts/src/zip.js create mode 100644 template-vanilla-js/src/zip.js create mode 100644 template-vanilla-ts/src/zip.js create mode 100644 template-vue-js/src/zip.js create mode 100644 template-vue-ts/src/zip.js diff --git a/package.json b/package.json index d8ef641..75eb421 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-chrome-ext", - "version": "0.9.1", + "version": "0.9.2", "type": "module", "description": "Scaffolding your chrome extension, multiple boilerplates supported!", "author": "yalda", diff --git a/template-alpine-js/package.json b/template-alpine-js/package.json index 9e6232b..ee72cb7 100644 --- a/template-alpine-js/package.json +++ b/template-alpine-js/package.json @@ -19,13 +19,16 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "alpinejs": "^3.13.1" }, "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "vite": "^4.4.11" } } diff --git a/template-alpine-js/src/zip.js b/template-alpine-js/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-alpine-js/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-alpine-ts/package.json b/template-alpine-ts/package.json index 9808996..01c508d 100644 --- a/template-alpine-ts/package.json +++ b/template-alpine-ts/package.json @@ -19,7 +19,8 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "alpinejs": "^3.13.1" @@ -28,6 +29,8 @@ "@crxjs/vite-plugin": "^2.0.0-beta.19", "@types/alpinejs": "^3.13.2", "@types/chrome": "^0.0.246", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "typescript": "^5.2.2", "vite": "^4.4.11" } diff --git a/template-alpine-ts/src/zip.js b/template-alpine-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-alpine-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-inferno-js/package.json b/template-inferno-js/package.json index f0cb7d6..ce6948e 100644 --- a/template-inferno-js/package.json +++ b/template-inferno-js/package.json @@ -19,7 +19,8 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "inferno": "^8.2.2" @@ -28,6 +29,8 @@ "@babel/core": "7.23.2", "@babel/parser": "7.23.0", "@crxjs/vite-plugin": "^2.0.0-beta.19", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "vite": "^4.4.11", "vite-plugin-inferno": "0.0.1" } diff --git a/template-inferno-js/src/zip.js b/template-inferno-js/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-inferno-js/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-inferno-ts/package.json b/template-inferno-ts/package.json index fca9b07..aa5d044 100644 --- a/template-inferno-ts/package.json +++ b/template-inferno-ts/package.json @@ -19,7 +19,8 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "inferno": "^8.2.2" @@ -29,6 +30,8 @@ "@babel/parser": "7.23.0", "@crxjs/vite-plugin": "^2.0.0-beta.19", "@types/chrome": "^0.0.246", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "typescript": "^5.2.2", "vite": "^4.4.11", "vite-plugin-inferno": "0.0.1" diff --git a/template-inferno-ts/src/zip.js b/template-inferno-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-inferno-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-lit-js/package.json b/template-lit-js/package.json index 65d6f9e..c5a2ae2 100644 --- a/template-lit-js/package.json +++ b/template-lit-js/package.json @@ -19,13 +19,16 @@ "scripts": { "dev": "vite", "build": "vite build", - "fmt": "prettier --write '**/*.{js,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{js,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "lit": "^2.8.0" }, "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "vite": "^3.2.7" } diff --git a/template-lit-js/src/zip.js b/template-lit-js/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-lit-js/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-lit-ts/package.json b/template-lit-ts/package.json index b32a094..d3f56e2 100644 --- a/template-lit-ts/package.json +++ b/template-lit-ts/package.json @@ -19,7 +19,8 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", - "fmt": "prettier --write '**/*.{ts,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{ts,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "lit": "^3.0.0" @@ -27,6 +28,8 @@ "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", "@types/chrome": "^0.0.246", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "path": "^0.12.7", "prettier": "^3.0.3", "typescript": "^5.2.2", diff --git a/template-lit-ts/src/zip.js b/template-lit-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-lit-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-preact-js/package.json b/template-preact-js/package.json index fcbe727..30d7e50 100644 --- a/template-preact-js/package.json +++ b/template-preact-js/package.json @@ -19,7 +19,8 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{jsx,js,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{jsx,js,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "preact": "^10.18.1" @@ -27,6 +28,8 @@ "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", "@preact/preset-vite": "^2.6.0", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "vite": "^4.4.11" } diff --git a/template-preact-js/src/zip.js b/template-preact-js/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-preact-js/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-preact-ts/package.json b/template-preact-ts/package.json index 3dfd682..78634c6 100644 --- a/template-preact-ts/package.json +++ b/template-preact-ts/package.json @@ -19,7 +19,8 @@ "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{tsx,ts,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{tsx,ts,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "preact": "^10.18.1" @@ -28,6 +29,8 @@ "@crxjs/vite-plugin": "^2.0.0-beta.19", "@preact/preset-vite": "^2.6.0", "@types/chrome": "^0.0.246", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "typescript": "^5.2.2", "vite": "^4.4.11" diff --git a/template-preact-ts/src/zip.js b/template-preact-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-preact-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-react-js/package.json b/template-react-js/package.json index 12f40ed..e25ff66 100644 --- a/template-react-js/package.json +++ b/template-react-js/package.json @@ -19,7 +19,8 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{jsx,js,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{jsx,js,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "react": "^18.2.0", @@ -31,6 +32,8 @@ "@types/react-dom": "^18.2.13", "@vitejs/plugin-react": "^4.1.0", "glob": "^10.3.10", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "vite": "^4.4.11" } diff --git a/template-react-js/src/zip.js b/template-react-js/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-react-js/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-react-ts/package.json b/template-react-ts/package.json index 7aea5c3..ba1c65c 100644 --- a/template-react-ts/package.json +++ b/template-react-ts/package.json @@ -19,7 +19,8 @@ "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{tsx,ts,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{tsx,ts,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "react": "^18.2.0", @@ -31,6 +32,8 @@ "@types/react": "^18.2.28", "@types/react-dom": "^18.2.13", "@vitejs/plugin-react": "^4.1.0", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "typescript": "^5.2.2", "vite": "^4.4.11" diff --git a/template-react-ts/src/zip.js b/template-react-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-react-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-solid-js/package.json b/template-solid-js/package.json index 02300d1..d451a6e 100644 --- a/template-solid-js/package.json +++ b/template-solid-js/package.json @@ -20,10 +20,13 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{tsx,ts,json,css,md}'" + "fmt": "prettier --write '**/*.{tsx,ts,json,css,md}'", + "zip": "npm run build && node src/zip.js" }, "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "vite": "^4.4.11", "vite-plugin-solid": "^2.7.1" diff --git a/template-solid-js/src/zip.js b/template-solid-js/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-solid-js/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-solid-ts/package.json b/template-solid-ts/package.json index 19d9483..2c373e6 100644 --- a/template-solid-ts/package.json +++ b/template-solid-ts/package.json @@ -20,11 +20,14 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{tsx,ts,json,css,md}'" + "fmt": "prettier --write '**/*.{tsx,ts,json,css,md}'", + "zip": "npm run build && node src/zip.js" }, "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", "@types/chrome": "^0.0.246", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "typescript": "^5.2.2", "vite": "^4.4.11", diff --git a/template-solid-ts/src/zip.js b/template-solid-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-solid-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-stencil-ts/package.json b/template-stencil-ts/package.json index 35a0af6..e34e566 100644 --- a/template-stencil-ts/package.json +++ b/template-stencil-ts/package.json @@ -18,13 +18,16 @@ "build": "stencil build", "start": "stencil build --dev --watch --serve", "generate": "stencil generate", - "fmt": "prettier --write '**/*.{jsx,js,json,css,md}'" + "fmt": "prettier --write '**/*.{jsx,js,json,css,md}'", + "zip": "npm run build && node src/zip.js" }, "devDependencies": { "@stencil/core": "^4.4.0", "@types/chrome": "^0.0.246", "@types/node": "^20.8.3", "express": "^4.18.2", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "typescript": "^5.2.2" } diff --git a/template-stencil-ts/src/zip.js b/template-stencil-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-stencil-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-svelte-js/package.json b/template-svelte-js/package.json index 4b52486..6f862c9 100755 --- a/template-svelte-js/package.json +++ b/template-svelte-js/package.json @@ -19,12 +19,14 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{svelte,js,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{svelte,js,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, - "dependencies": {}, "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", "@sveltejs/vite-plugin-svelte": "2.4.6", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "prettier-plugin-svelte": "^3.0.3", "svelte": "^4.2.1", diff --git a/template-svelte-js/src/zip.js b/template-svelte-js/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-svelte-js/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-svelte-ts/package.json b/template-svelte-ts/package.json index 0a5a3ec..48e203a 100755 --- a/template-svelte-ts/package.json +++ b/template-svelte-ts/package.json @@ -19,13 +19,15 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{svelte,ts,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{svelte,ts,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, - "dependencies": {}, "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", - "@types/chrome": "^0.0.246", "@sveltejs/vite-plugin-svelte": "2.4.6", + "@types/chrome": "^0.0.246", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "prettier-plugin-svelte": "^3.0.3", "svelte": "^4.2.1", diff --git a/template-svelte-ts/src/zip.js b/template-svelte-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-svelte-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-vanilla-js/package.json b/template-vanilla-js/package.json index 0bc4de1..862c624 100644 --- a/template-vanilla-js/package.json +++ b/template-vanilla-js/package.json @@ -19,11 +19,13 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{js,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{js,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, - "dependencies": {}, "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "vite": "^4.4.11" } diff --git a/template-vanilla-js/src/zip.js b/template-vanilla-js/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-vanilla-js/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-vanilla-ts/package.json b/template-vanilla-ts/package.json index 18b8bcc..cb66be6 100644 --- a/template-vanilla-ts/package.json +++ b/template-vanilla-ts/package.json @@ -19,12 +19,14 @@ "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{ts,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{ts,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, - "dependencies": {}, "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", "@types/chrome": "^0.0.246", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "typescript": "^5.2.2", "vite": "^4.4.11" diff --git a/template-vanilla-ts/src/zip.js b/template-vanilla-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-vanilla-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-vue-js/package.json b/template-vue-js/package.json index 86bc8fd..371426e 100644 --- a/template-vue-js/package.json +++ b/template-vue-js/package.json @@ -19,7 +19,8 @@ "dev": "vite", "build": "vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{vue,js,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{vue,js,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "vue": "^3.2.37" @@ -27,6 +28,8 @@ "devDependencies": { "@crxjs/vite-plugin": "^2.0.0-beta.19", "@vitejs/plugin-vue": "^4.4.0", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "vite": "^4.4.11" } diff --git a/template-vue-js/src/zip.js b/template-vue-js/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-vue-js/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package')) diff --git a/template-vue-ts/package.json b/template-vue-ts/package.json index c1b06c3..84f09b6 100644 --- a/template-vue-ts/package.json +++ b/template-vue-ts/package.json @@ -19,7 +19,8 @@ "dev": "vite", "build": "vue-tsc --noEmit && vite build", "preview": "vite preview", - "fmt": "prettier --write '**/*.{vue,ts,json,css,scss,md}'" + "fmt": "prettier --write '**/*.{vue,ts,json,css,scss,md}'", + "zip": "npm run build && node src/zip.js" }, "dependencies": { "vue": "^3.3.4" @@ -28,6 +29,8 @@ "@crxjs/vite-plugin": "^2.0.0-beta.19", "@types/chrome": "^0.0.246", "@vitejs/plugin-vue": "^4.4.0", + "gulp": "^4.0.2", + "gulp-zip": "^6.0.0", "prettier": "^3.0.3", "typescript": "^5.2.2", "vite": "^4.4.11", diff --git a/template-vue-ts/src/zip.js b/template-vue-ts/src/zip.js new file mode 100644 index 0000000..c8b0b7d --- /dev/null +++ b/template-vue-ts/src/zip.js @@ -0,0 +1,10 @@ +import gulp from 'gulp' +import zip from 'gulp-zip' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const manifest = require('../build/manifest.json') + +gulp + .src('build/*') + .pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) + .pipe(gulp.dest('package'))