<commit_before>PATH := ./node_modules/.bin:./bin/:$(PATH)
SHELL := /bin/bash
BABEL := babel --retain-lines
JPM := $(shell pwd)/node_modules/.bin/jpm
.DEFAULT_GOAL := help

.PHONY: all clean server addon xpi homepage npm

# This forces bin/_write_ga_id to be run before anything else, which
# writes the configured Google Analytics ID to build/ga-id.txt
_dummy := $(shell ./bin/_write_ga_id)

# Here we have source/dest variables for many files and their destinations;
# we use these each to enumerate categories of source files, and translate
# them into the destination locations.  These destination locations are the
# requirements for the other rules

data_source := $(shell find addon/data -path addon/data/vendor -prune -o -name '*.js')
data_dest := $(data_source:%.js=build/%.js)

vendor_source := $(shell find addon/data/vendor -type f)
vendor_dest := $(vendor_source:%=build/%)

# Note shared/ gets copied into two locations (server and addon)
shared_source := $(wildcard shared/*.js)
shared_server_dest := $(shared_source:%.js=build/%.js)
shared_addon_dest := $(shared_source:shared/%.js=build/addon/lib/shared/%.js)

static_addon_source := $(shell find addon -type f -name '*.png' -o -name '*.svg' -o -name '*.html')
static_addon_dest := $(static_addon_source:%=build/%)

# static/js only gets copied to the server
static_js_source := $(wildcard static/js/*.js)
static_js_dest := $(static_js_source:%.js=build/server/%.js)

static_vendor_source := $(shell find static/vendor -type f)
static_vendor_dest := $(static_vendor_source:%=build/server/%)

lib_source := $(wildcard addon/lib/*.js)
lib_dest := $(lib_source:%.js=build/%.js)

server_source := $(shell find server/src -name '*.js')
server_dest := $(server_source:server/src/%.js=build/server/%.js)

# Also scss gets put into two locations:
sass_source := $(wildcard static/css/*.scss)
sass_server_dest := $(sass_source:%.scss=build/server/%.css)
sass_addon_dest := $(sass_source:static/css/%.scss=build/addon/data/%.css)

# And static images get placed somewhat eclectically:
imgs_source := $(wildcard static/img/*)
imgs_server_dest := $(imgs_source:%=build/server/%)
imgs_addon_dest := $(imgs_source:static/img/%=build/addon/data/icons/%)

addon_js_source := $(shell find addon -name '*.js')
addon_js_dest := $(addon_js_source:%=build/%)

# These .txt files are generated by browserify --list, and represent
# all the dependencies of the two bundles that are created.  We generated
# the .txt files at the same time we build the bundles themselves.  When
# doing a clean build, these files will not be present, and hopefully the
# bundles will also not be present.  (Possibly we should delete the bundles
# if their dependencies are unknown)
#
# To keep these commands from failing we touch the files just to be sure
# they exist:
shoot_panel_dependencies := $(shell touch build/shoot-panel-dependencies.txt ; cat build/shoot-panel-dependencies.txt)
clientglue_dependencies = $(shell touch build/clientglue-dependencies.txt ; cat build/clientglue-dependencies.txt)

## General transforms:
# These cover standard ways of building files given a source

# Need to put these two rules before the later general rule, so that we don't
# run babel on vendor libraries or the homepage libraries:
build/addon/data/vendor/%.js: addon/data/vendor/%.js
	@mkdir -p $(@D)
	cp $< $@

build/server/static/vendor/%: static/vendor/%
	@mkdir -p $(@D)
	cp $< $@

build/server/static/homepage/%.js: static/homepage/%.js
	@mkdir -p $(@D)
	cp $< $@

build/server/static/js/%.js: build/static/js/%.js
	@mkdir -p $(@D)
	cp $< $@

build/%.js: %.js
	@mkdir -p $(@D)
	$(BABEL) $< > $@

build/server/%.js: server/src/%.js
	@mkdir -p $(@D)
	$(BABEL) $< > $@

build/%.css: %.scss
	@mkdir -p $(@D)
	node-sass $< $@

## Static files to be copied:

build/%.png: %.png
	@mkdir -p $(@D)
	cp $< $@

build/%.css: %.css
	@mkdir -p $(@D)
	cp $< $@

build/%.svg: %.svg
	@mkdir -p $(@D)
	cp $< $@

build/%.sql: %.sql
	@mkdir -p $(@D)
	cp $< $@

build/%.ttf: %.ttf
	@mkdir -p $(@D)
	cp $< $@

build/%.html: %.html
	@mkdir -p $(@D)
	cp $< $@

## Addon related rules:

build/addon/data/panel-bundle.js: $(shoot_panel_dependencies)
	@mkdir -p $(@D)
	# Save the bundle dependencies:
	browserify --list -e ./build/addon/data/shoot-panel.js | sed "s!$(shell pwd)/!!g" > build/shoot-panel-dependencies.txt
	browserify -e ./build/addon/data/shoot-panel.js | ./bin/_fixup_panel_js > $@<commit_msg>Fix issues that were preventing the extension from passing automated review.<commit_after>PATH := ./node_modules/.bin:./bin/:$(PATH)
SHELL := /bin/bash
BABEL := babel --retain-lines
JPM := $(shell pwd)/node_modules/.bin/jpm
.DEFAULT_GOAL := help

.PHONY: all clean server addon xpi homepage npm

# This forces bin/_write_ga_id to be run before anything else, which
# writes the configured Google Analytics ID to build/ga-id.txt
_dummy := $(shell ./bin/_write_ga_id)

# Here we have source/dest variables for many files and their destinations;
# we use these each to enumerate categories of source files, and translate
# them into the destination locations.  These destination locations are the
# requirements for the other rules

data_source := $(shell find addon/data -path addon/data/vendor -prune -o -name '*.js')
data_dest := $(data_source:%.js=build/%.js)

vendor_source := $(shell find addon/data/vendor -path addon/data/vendor/readability/test -prune -name addon/data/vendor/readability/test -prune -o -type f)
vendor_dest := $(vendor_source:%=build/%)

# Note shared/ gets copied into two locations (server and addon)
shared_source := $(wildcard shared/*.js)
shared_server_dest := $(shared_source:%.js=build/%.js)
shared_addon_dest := $(shared_source:shared/%.js=build/addon/lib/shared/%.js)

static_addon_source := $(shell find addon -path addon/data/vendor/readability/test -prune -type f -o -name '*.png' -o -name '*.svg' -o -name '*.html')
static_addon_dest := $(static_addon_source:%=build/%)

# static/js only gets copied to the server
static_js_source := $(wildcard static/js/*.js)
static_js_dest := $(static_js_source:%.js=build/server/%.js)

static_vendor_source := $(shell find static/vendor -type f)
static_vendor_dest := $(static_vendor_source:%=build/server/%)

lib_source := $(wildcard addon/lib/*.js)
lib_dest := $(lib_source:%.js=build/%.js)

server_source := $(shell find server/src -name '*.js')
server_dest := $(server_source:server/src/%.js=build/server/%.js)

# Also scss gets put into two locations:
sass_source := $(wildcard static/css/*.scss)
sass_server_dest := $(sass_source:%.scss=build/server/%.css)
sass_addon_dest := $(sass_source:static/css/%.scss=build/addon/data/%.css)

# And static images get placed somewhat eclectically:
imgs_source := $(wildcard static/img/*)
imgs_server_dest := $(imgs_source:%=build/server/%)
imgs_addon_dest := $(imgs_source:static/img/%=build/addon/data/icons/%)

addon_js_source := $(shell find addon -name '*.js')
addon_js_dest := $(addon_js_source:%=build/%)

# These .txt files are generated by browserify --list, and represent
# all the dependencies of the two bundles that are created.  We generated
# the .txt files at the same time we build the bundles themselves.  When
# doing a clean build, these files will not be present, and hopefully the
# bundles will also not be present.  (Possibly we should delete the bundles
# if their dependencies are unknown)
#
# To keep these commands from failing we touch the files just to be sure
# they exist:
shoot_panel_dependencies := $(shell touch build/shoot-panel-dependencies.txt ; cat build/shoot-panel-dependencies.txt)
clientglue_dependencies = $(shell touch build/clientglue-dependencies.txt ; cat build/clientglue-dependencies.txt)

## General transforms:
# These cover standard ways of building files given a source

# Need to put these two rules before the later general rule, so that we don't
# run babel on vendor libraries or the homepage libraries:
build/addon/data/vendor/%.js: addon/data/vendor/%.js
	@mkdir -p $(@D)
	cp $< $@

build/server/static/vendor/%: static/vendor/%
	@mkdir -p $(@D)
	cp $< $@

build/server/static/homepage/%.js: static/homepage/%.js
	@mkdir -p $(@D)
	cp $< $@

build/server/static/js/%.js: build/static/js/%.js
	@mkdir -p $(@D)
	cp $< $@

build/%.js: %.js
	@mkdir -p $(@D)
	$(BABEL) $< > $@

build/server/%.js: server/src/%.js
	@mkdir -p $(@D)
	$(BABEL) $< > $@

build/%.css: %.scss
	@mkdir -p $(@D)
	node-sass $< $@

## Static files to be copied:

build/%.png: %.png
	@mkdir -p $(@D)
	cp $< $@

build/%.css: %.css
	@mkdir -p $(@D)
	cp $< $@

build/%.svg: %.svg
	@mkdir -p $(@D)
	cp $< $@

build/%.sql: %.sql
	@mkdir -p $(@D)
	cp $< $@

build/%.ttf: %.ttf
	@mkdir -p $(@D)
	cp $< $@

build/%.html: %.html
	@mkdir -p $(@D)
	cp $< $@

## Addon related rules:

build/addon/data/panel-bundle.js: $(shoot_panel_dependencies)
	@mkdir -p $(@D)
	# Save the bundle dependencies:
	browserify --list -e ./build/addon/data/shoot-panel.js | sed "s!$(shell pwd)/!!g" > build/shoot-panel-dependencies.txt
	cat ./build/addon/lib/shooter.js | ./bin/_fixup_panel_js > ./build/addon/lib/shooter-new.js
	mv ./build/addon/lib/shooter-new.js ./build/addon/lib/shooter.js
	cat ./build/addon/data/shoot-panel.js | ./bin/_fixup_panel_js > ./build/addon/data/shoot-panel-new.js
	mv ./build/addon/data/shoot-panel-new.js ./build/addon/data/shoot-panel.js
	browserify -e ./build/addon/data/shoot-panel.js | ./bin/_fixup_panel_js > $@
{'fraction_non_alphanumeric': 0.16419502827269816, 'fraction_numerical': 0.0, 'mean_word_length': 4.16473829201102, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7495137', 'n_tokens_mistral': 3409, 'n_tokens_neox': 3250, 'n_words': 909}