Skip to content

Commit

Permalink
Merge pull request #21 from st3phhays/typescript
Browse files Browse the repository at this point in the history
(#20) Enable TypeScript
  • Loading branch information
st3phhays authored May 3, 2023
2 parents aa7090a + e3df9c9 commit df19497
Show file tree
Hide file tree
Showing 4 changed files with 637 additions and 358 deletions.
17 changes: 12 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const inlinesource = require('gulp-inline-source');
const bundleconfig = require('./bundleconfig.json');
const zendeskconfig = require('./zendeskconfig.json');
const fs = require('fs');
const ts = require('gulp-typescript');

const editFilePartial = 'Edit this file at https://github.com/chocolatey/choco-theme/partials';
const { series, parallel, src, dest } = require('gulp');
Expand All @@ -36,6 +37,8 @@ const paths = {
theme: 'node_modules/choco-theme/'
};

const tsProject = ts.createProject(`${paths.theme}tsconfig.json`);

const getBundles = regexPattern => {
return bundleconfig.filter(bundle => {
return regexPattern.test(bundle.outputFileName);
Expand Down Expand Up @@ -63,7 +66,7 @@ const copyTheme = () => {
.pipe(rename({ basename: 'themetoggle', extname: '.hbs' }))
.pipe(dest(paths.partials));

const copyChocoThemeJs = src(`${paths.theme}js/**/*.js`)
const copyChocoThemeJs = src(`${paths.theme}js/**/*.*`)
.pipe(dest(`${paths.assets}js/temp`));

return merge(copyThemeToggleHbs, copyChocoThemeJs);
Expand All @@ -75,6 +78,13 @@ const compileSass = () => {
.pipe(dest(`${paths.assets}css`));
};

const compileTs = () => {
const tsResult = src(`${paths.assets}js/temp/ts/**/*.ts`)
.pipe(tsProject());

return tsResult.js.pipe(dest(`${paths.assets}js/temp/ts`));
};

const compileJs = () => {
const tasks = getBundles(regex.js).map(bundle => {
const b = browserify({
Expand Down Expand Up @@ -213,13 +223,10 @@ const delEnd = () => {
.pipe(clean({ force: true }));
};

// Independent tasks
exports.del = del;

// Gulp series
exports.compileSassJs = parallel(compileSass, compileJs);
exports.minCssJs = parallel(minCss, minJs);
exports.compileZendesk = parallel(zendeskCss, inlineFooterAssets, inlineHeadAssets);

// Gulp default
exports.default = series(copyTheme, exports.compileSassJs, compileCss, purgeCss, exports.minCssJs, exports.compileZendesk, delEnd);
exports.default = series(del, copyTheme, compileTs, exports.compileSassJs, compileCss, purgeCss, exports.minCssJs, exports.compileZendesk, delEnd);
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "choco-theme",
"author": "Chocolatey Software",
"version": "101.5.0",
"version": "101.6.0",
"api_version": 2,
"default_locale": "en-us",
"settings": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@semantic-release/changelog": "^5.0.0",
"@semantic-release/exec": "^5.0.0",
"@semantic-release/git": "^9.0.0",
"choco-theme": "0.4.1",
"choco-theme": "0.5.0",
"husky": "^4.2.3",
"js-yaml": "^3.13.1",
"semantic-release": "^17.0.4"
Expand Down
Loading

0 comments on commit df19497

Please sign in to comment.