Skip to content

Commit

Permalink
script: fix path
Browse files Browse the repository at this point in the history
  • Loading branch information
sylingd committed Dec 20, 2019
1 parent f74b7ee commit 822e220
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions build/pack.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const package = require('../package.json');
const config = require('./extension-config').config;
const arg = require('arg');
const path = require('path');
const check = require('./pack-utils/pack-check');
Expand All @@ -20,31 +20,31 @@ const isAuto = args["--platform"] ? false : true;

if (isAuto) {
function XPI() {
if (package.webextension.autobuild.xpi) {
if (config.autobuild.xpi) {
console.log("Building XPI");
return buildXpi(manifest, output);
} else {
return Promise.resolve();
}
}
function AMO() {
if (package.webextension.autobuild.amo) {
if (config.autobuild.amo) {
console.log("Building AMO");
return buildAmo(manifest);
} else {
return Promise.resolve();
}
}
function CWS() {
if (package.webextension.autobuild.cwx) {
if (config.autobuild.cwx) {
console.log("Building Chrome Web Store");
return buildCws();
} else {
return Promise.resolve();
}
}
function CRX() {
if (package.webextension.autobuild.crx) {
if (config.autobuild.crx) {
console.log("Building CRX");
return buildCrx(manifest, output);
} else {
Expand Down
13 changes: 7 additions & 6 deletions build/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ const path = require('path');
const crypto = require('crypto');
const publishRelease = require('publish-release');
const rootDir = path.resolve(__dirname, '..');
const package = require('../package.json');
const common = require('./extension-config');
const output = path.resolve(rootDir, 'dist-pack');
const config = require('./extension-config').config;

if (!package.webextension.github.enable) {
const { config } = common;

if (!config.github.enable) {
console.log("GitHub not enabled");
process.exit(0);
}

const assets = [];
let content = "";

const assetName = package.webextension.dist.replace('{VER}', package.version);
const assetName = config.dist.replace('{VER}', common.version);

['crx', 'xpi'].forEach(extName => {
const outputPath = path.resolve(output, assetName + '.' + extName);
Expand All @@ -31,14 +32,14 @@ const assetName = package.webextension.dist.replace('{VER}', package.version);

// Get git names
const gitName = package.repository.url.match(/(\w+)\/(\w+)\.git/);
const tagName = package.webextension.github.tag.replace('{VER}', package.version);
const tagName = config.github.tag.replace('{VER}', common.version);

publishRelease({
token: process.env[config.github.token],
owner: gitName[1],
repo: gitName[2],
tag: tagName,
name: package.version,
name: common.version,
notes: content,
draft: false,
prerelease: false,
Expand Down

0 comments on commit 822e220

Please sign in to comment.