Skip to content

Commit f5b2d09

Browse files
committed
Added proper exclusion of test directory from builds
1 parent fe9da40 commit f5b2d09

File tree

3 files changed

+13
-68
lines changed

3 files changed

+13
-68
lines changed

Makefile

+6-35
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,16 @@
44
#
55

66

7-
PACKAGE_NAME = markdown-here
8-
MOZILLA_PACKAGE_NAME = $(PACKAGE_NAME)-mozilla.xpi
9-
CHROME_PACKAGE_NAME = $(PACKAGE_NAME)-chrome.zip
10-
POSTBOX_PACKAGE_NAME = $(PACKAGE_NAME)-postbox.xpi
117
DIST_DIR = dist
12-
SRC_DIR = src
13-
TEST_DIR = $(SRC_DIR)/common/test
8+
UTILS_DIR = utils
149

15-
ZIP_ARGS = -r -1
10+
.PHONY: all clean build
1611

17-
MOZILLA_INPUT = chrome.manifest install.rdf common firefox
18-
CHROME_INPUT = manifest.json common chrome _locales
19-
20-
.PHONY: all dirs chrome mozilla clean
21-
22-
# Targets for creating directories
23-
dirs: $(DIST_DIR)
24-
rm -rf $(TEST_DIR)
25-
$(DIST_DIR):
26-
mkdir $(DIST_DIR)
27-
28-
chrome: | dirs
29-
rm -f $(DIST_DIR)/$(CHROME_PACKAGE_NAME); \
30-
cd $(SRC_DIR); \
31-
zip $(ZIP_ARGS) "../$(DIST_DIR)/$(CHROME_PACKAGE_NAME)" $(CHROME_INPUT)
32-
33-
mozilla: | dirs
34-
rm -f $(DIST_DIR)/$(MOZILLA_PACKAGE_NAME); \
35-
cd $(SRC_DIR); \
36-
zip $(ZIP_ARGS) "../$(DIST_DIR)/$(MOZILLA_PACKAGE_NAME)" $(MOZILLA_INPUT)
37-
38-
#postbox: mozilla
39-
# cp -f $(DIST_DIR)/$(MOZILLA_PACKAGE_NAME) $(DIST_DIR)/$(POSTBOX_PACKAGE_NAME)
40-
# cd $(SRC_DIR)/postbox; \
41-
# zip $(ZIP_ARGS) ../../$(DIST_DIR)/$(POSTBOX_PACKAGE_NAME) common/*
12+
build: | clean
13+
cd $(UTILS_DIR); \
14+
node "build.js";
4215

4316
clean:
4417
rm -rf $(DIST_DIR)
45-
find . -name "desktop.ini" -or -name ".*" -and -not -name "." -and -not -name ".git*" -print0 | xargs -0 rm -rf
46-
git checkout -- $(TEST_DIR)
4718

48-
all: clean chrome mozilla
19+
all: clean build

make.sh

-29
This file was deleted.

utils/build.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"use strict";
88

99
var fs = require('fs');
10+
var path = require('path');
1011
var file = require('file');
1112
var archiver = require('archiver');
1213
var MetaScript = require('MetaScript');
@@ -17,11 +18,13 @@ var SRC_DIR = file.path.join(BASE_DIR, 'src');
1718
var DIST_DIR = file.path.join(BASE_DIR, 'dist');
1819
var CHROME_EXTENSION = file.path.join(DIST_DIR, 'chrome.zip');
1920
var FIREFOX_EXTENSION = file.path.join(DIST_DIR, 'firefox.xpi');
20-
var CHROME_INPUT = ['manifest.json', 'common/', 'chrome/', '_locales/'];
21-
var FIREFOX_INPUT = ['chrome.manifest', 'install.rdf', 'common/', 'firefox/'];
21+
var CHROME_INPUT = [/^manifest\.json$/, /^common(\\|\/)/, /^chrome(\\|\/)/, /^_locales(\\|\/)/];
22+
var FIREFOX_INPUT = [/^chrome.manifest$/, /^install.rdf$/, /^common(\\|\/)/, /^firefox(\\|\/)/];
2223
var FIREFOX_PLATFORM = 'mozilla';
2324

24-
var skipFileRegexes = [/\.DS_Store$/, /.+\.bts$/];
25+
var skipFileRegexes = [/^common(\\|\/)test(\\|\/)/,
26+
// OS files and temp files
27+
/\.DS_Store$/, /.+\.bts$/, /desktop\.ini$/];
2528
var javascriptFileRegex = /.+\.js$/;
2629

2730

@@ -38,7 +41,7 @@ function fnameMatch(fpath, inputArray) {
3841
}
3942

4043
for (i = 0; i < inputArray.length; i++) {
41-
if (fname === inputArray[i] || fname.indexOf(inputArray[i]) === 0) {
44+
if (inputArray[i].test(fname)) {
4245
return fname;
4346
}
4447
}

0 commit comments

Comments
 (0)