Skip to content

Commit f0f6f5f

Browse files
committed
Initial commit
0 parents  commit f0f6f5f

14 files changed

+1225
-0
lines changed

.d.ts/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder contains definition files for this project.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.gitignore
2+
.idea/
3+
ts/tslint.json
4+
node_modules/

gulpfile.js

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
* Created by Trevor Sears <[email protected]>.
3+
* 8:48 PM -- June 16th, 2019.
4+
* Project: repo-name
5+
*/
6+
7+
const gulp = require("gulp");
8+
const typescript = require("gulp-typescript");
9+
const sourcemaps = require("gulp-sourcemaps");
10+
const uglify = require("gulp-uglify-es").default;
11+
const del = require("del");
12+
13+
const paths = {
14+
15+
typescript: {
16+
17+
dir: "ts/",
18+
allFiles: "ts/**/*.ts",
19+
tsconfig: "ts/tsconfig.json"
20+
21+
},
22+
23+
javascript: {
24+
25+
dir: "js/",
26+
allFiles: "js/**/*.js",
27+
entryPoint: "js/main.js",
28+
entryPointFileName: "main.js"
29+
30+
},
31+
32+
typedefs: {
33+
34+
dir: ".d.ts/",
35+
allFiles: ".d.ts/**/*.d.ts"
36+
37+
}
38+
39+
};
40+
41+
let typescriptProject = typescript.createProject(paths.typescript.tsconfig);
42+
43+
// The default Gulp task.
44+
gulp.task("default", defaultTask);
45+
46+
// Cleans (deletes) all generated/compiled files.
47+
gulp.task("clean", clean);
48+
49+
// Builds the entire project.
50+
gulp.task("build", build);
51+
52+
// Cleans and builds the entire project.
53+
gulp.task("rebuild", rebuild);
54+
55+
// Watch for changes to relevant files and compile-on-change.
56+
gulp.task("watch", watch);
57+
58+
function defaultTask(done) {
59+
60+
return rebuild(done);
61+
62+
}
63+
64+
function clean(done) {
65+
66+
return del([
67+
paths.javascript.dir,
68+
paths.typedefs.dir
69+
]);
70+
71+
}
72+
73+
function build(done) {
74+
75+
return buildJavaScriptPipeline(done);
76+
77+
}
78+
79+
function rebuild(done) {
80+
81+
gulp.series(clean, build)(done);
82+
83+
}
84+
85+
function buildJavaScriptPipeline(done) {
86+
87+
return gulp.series(
88+
compileTypeScript,
89+
uglifyJavaScript
90+
)(done);
91+
92+
}
93+
94+
function compileTypeScript(done) {
95+
96+
let proj =
97+
typescriptProject.src()
98+
.pipe(sourcemaps.init())
99+
.pipe(typescriptProject());
100+
101+
let compileJS = (done) => {
102+
103+
return proj.js
104+
.pipe(sourcemaps.write("."))
105+
.pipe(gulp.dest(paths.javascript.dir));
106+
107+
};
108+
109+
let compileDTS = (done) => {
110+
111+
return proj.dts
112+
.pipe(gulp.dest(paths.typedefs.dir));
113+
114+
};
115+
116+
return gulp.parallel(compileJS, compileDTS)(done);
117+
118+
}
119+
120+
function uglifyJavaScript(done) {
121+
122+
return gulp.src(paths.javascript.allFiles)
123+
.pipe(uglify())
124+
.pipe(gulp.dest(paths.javascript.dir));
125+
126+
}
127+
128+
function watch(done) {
129+
130+
gulp.watch([paths.typescript.allFiles], buildJavaScriptPipeline);
131+
132+
}

init.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
# Stop tracking certain files that were pulled from the template.
4+
git rm --cached ./ts/tslint.json ./.gitignore
5+
6+
# Delete the readmes that were used to track otherwise-empty dirs.
7+
rm ./.d.ts/readme.md ./js/readme.md ./ts/readme.md ./ts/tests/readme.md
8+
9+
# Install the missing packages from our package.json file.
10+
npm install
11+
12+
# Remind the user to update relevant package information from the template and commit the above changes.
13+
echo "Remember to modify the package.json, license.md, and readme.md to correct the relevant package information."
14+
echo "Also remember to commit the changes that this script has made."
15+
16+
echo "All done, bye!"
17+
18+
# Make the script remove itself.
19+
rm -- "$0"

jest.config.js

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// All imported modules in your tests should be mocked automatically
6+
// automock: false,
7+
8+
// Stop running tests after `n` failures
9+
// bail: 0,
10+
11+
// Respect "browser" field in package.json when resolving modules
12+
// browser: false,
13+
14+
// The directory where Jest should store its cached dependency information
15+
// cacheDirectory: "/tmp/jest_rs",
16+
17+
// Automatically clear mock calls and instances between every test
18+
clearMocks: true,
19+
20+
// Indicates whether the coverage information should be collected while executing the test
21+
collectCoverage: true,
22+
23+
// An array of glob patterns indicating a set of files for which coverage information should be collected
24+
// collectCoverageFrom: null,
25+
26+
// The directory where Jest should output its coverage files
27+
coverageDirectory: "ts/tests/coverage",
28+
29+
// An array of regexp pattern strings used to skip coverage collection
30+
// coveragePathIgnorePatterns: [
31+
// "/node_modules/"
32+
// ],
33+
34+
// A list of reporter names that Jest uses when writing coverage reports
35+
// coverageReporters: [
36+
// "json",
37+
// "text",
38+
// "lcov",
39+
// "clover"
40+
// ],
41+
42+
// An object that configures minimum threshold enforcement for coverage results
43+
// coverageThreshold: null,
44+
45+
// A path to a custom dependency extractor
46+
// dependencyExtractor: null,
47+
48+
// Make calling deprecated APIs throw helpful error messages
49+
// errorOnDeprecated: false,
50+
51+
// Force coverage collection from ignored files using an array of glob patterns
52+
// forceCoverageMatch: [],
53+
54+
// A path to a module which exports an async function that is triggered once before all test suites
55+
// globalSetup: null,
56+
57+
// A path to a module which exports an async function that is triggered once after all test suites
58+
// globalTeardown: null,
59+
60+
// A set of global variables that need to be available in all test environments
61+
// globals: {},
62+
63+
// An array of directory names to be searched recursively up from the requiring module's location
64+
// moduleDirectories: [
65+
// "node_modules"
66+
// ],
67+
68+
// An array of file extensions your modules use
69+
// moduleFileExtensions: [
70+
// "js",
71+
// "json",
72+
// "jsx",
73+
// "ts",
74+
// "tsx",
75+
// "node"
76+
// ],
77+
78+
// A map from regular expressions to module names that allow to stub out resources with a single module
79+
// moduleNameMapper: {},
80+
81+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
82+
// modulePathIgnorePatterns: [],
83+
84+
// Activates notifications for test results
85+
// notify: false,
86+
87+
// An enum that specifies notification mode. Requires { notify: true }
88+
// notifyMode: "failure-change",
89+
90+
// A preset that is used as a base for Jest's configuration
91+
// preset: null,
92+
93+
// Run tests from one or more projects
94+
// projects: null,
95+
96+
// Use this configuration option to add custom reporters to Jest
97+
// reporters: undefined,
98+
99+
// Automatically reset mock state between every test
100+
// resetMocks: false,
101+
102+
// Reset the module registry before running each individual test
103+
// resetModules: false,
104+
105+
// A path to a custom resolver
106+
// resolver: null,
107+
108+
// Automatically restore mock state between every test
109+
// restoreMocks: false,
110+
111+
// The root directory that Jest should scan for tests and modules within
112+
// rootDir: null,
113+
114+
// A list of paths to directories that Jest should use to search for files in
115+
roots: [
116+
"<rootDir>/js/tests"
117+
],
118+
119+
// Allows you to use a custom runner instead of Jest's default test runner
120+
// runner: "jest-runner",
121+
122+
// The paths to modules that run some code to configure or set up the testing environment before each test
123+
// setupFiles: [],
124+
125+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
126+
// setupFilesAfterEnv: [],
127+
128+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
129+
// snapshotSerializers: [],
130+
131+
// The test environment that will be used for testing
132+
testEnvironment: "node",
133+
134+
// Options that will be passed to the testEnvironment
135+
// testEnvironmentOptions: {},
136+
137+
// Adds a location field to test results
138+
// testLocationInResults: false,
139+
140+
// The glob patterns Jest uses to detect test files
141+
// testMatch: [
142+
// "**/__tests__/**/*.[jt]s?(x)",
143+
// "**/?(*.)+(spec|test).[tj]s?(x)"
144+
// ],
145+
146+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
147+
// testPathIgnorePatterns: [
148+
// "/node_modules/"
149+
// ],
150+
151+
// The regexp pattern or array of patterns that Jest uses to detect test files
152+
// testRegex: [],
153+
154+
// This option allows the use of a custom results processor
155+
// testResultsProcessor: null,
156+
157+
// This option allows use of a custom test runner
158+
// testRunner: "jasmine2",
159+
160+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
161+
// testURL: "http://localhost",
162+
163+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
164+
// timers: "real",
165+
166+
// A map from regular expressions to paths to transformers
167+
// transform: null,
168+
169+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
170+
// transformIgnorePatterns: [
171+
// "/node_modules/"
172+
// ],
173+
174+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
175+
// unmockedModulePathPatterns: undefined,
176+
177+
// Indicates whether each individual test should be reported during the run
178+
// verbose: null,
179+
180+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
181+
// watchPathIgnorePatterns: [],
182+
183+
// Whether to use watchman for file crawling
184+
// watchman: true,
185+
};

js/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder contains compiled JavaScript files for this project.

0 commit comments

Comments
 (0)