Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
upgrade deps
Browse files Browse the repository at this point in the history
- migrate webpack to v5
- fix typescript typechecks
- remove xtend, and replace with native syntax
  • Loading branch information
jsedlacek committed Sep 25, 2023
1 parent f99f1ec commit f321bdf
Show file tree
Hide file tree
Showing 7 changed files with 4,722 additions and 11,130 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SRC := $(shell find src -name '*')
dist: dist/.touch

dist/.touch: $(SRC) tsconfig.json
$(BIN)/webpack src/index.ts -o dist/index.js
$(BIN)/webpack ./src/index.ts -o dist
touch dist/.touch

clean:
Expand All @@ -14,8 +14,11 @@ storybook:
$(BIN)/start-storybook -p 6006

test:
$(BIN)/webpack src/tests/test.ts -o dist/tests/test.js --display=errors-only
$(BIN)/mocha dist/tests/test.js
$(BIN)/webpack ./src/tests/test.ts -o dist/tests
$(BIN)/mocha dist/tests/index.js

lint:
yarn tsc --noEmit

publish: test clean dist
yarn semantic-release
Expand Down
62 changes: 30 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,38 @@
},
"author": "Jakub Sedlacek",
"dependencies": {
"@types/chai": "^4.1.2",
"@types/cheerio": "^0.22.7",
"@types/escape-html": "^0.0.20",
"@types/express": "^4.11.1",
"@types/is": "^0.0.19",
"@types/jsuri": "^1.3.30",
"@types/marked": "^4",
"@types/mocha": "^5.1.0",
"@types/twemoji": "^12.1.2",
"@types/xtend": "^4.0.2",
"escape-html": "^1.0.1",
"handlebars": "^4.0.11",
"is": "^2.2.1",
"jsuri": "^1.3.0",
"marked": "^4.0.10",
"twemoji": "^13.1.0",
"xss": "^1.0.14",
"xtend": "^4.0.1"
"@types/chai": "^4.3.6",
"@types/cheerio": "^0.22.32",
"@types/escape-html": "^1.0.2",
"@types/express": "^4.17.18",
"@types/is": "^0.0.22",
"@types/jsuri": "^1.3.32",
"@types/marked": "^5.0.1",
"@types/mocha": "^10.0.1",
"@types/twemoji": "^13.1.2",
"escape-html": "^1.0.3",
"handlebars": "^4.7.8",
"is": "^3.3.0",
"jsuri": "^1.3.1",
"marked": "^9.0.3",
"twemoji": "^14.0.2",
"xss": "^1.0.14"
},
"devDependencies": {
"@babel/core": "^7.7.4",
"@storybook/html": "^5.2.8",
"babel-loader": "^8.0.6",
"chai": "^2.0.0",
"cheerio": "^0.22.0",
"express": "^4.17.1",
"handlebars-loader": "^1.7.1",
"mocha": "6.2.2",
"prettier": "^2.6.2",
"semantic-release": "^19.0.3",
"ts-loader": "^6.2.1",
"typescript": "^2.8.1",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
"@babel/core": "^7.23.0",
"@storybook/html": "^7.4.5",
"babel-loader": "^9.1.3",
"chai": "^4.3.8",
"cheerio": "^1.0.0-rc.12",
"express": "^4.18.2",
"handlebars-loader": "^1.7.3",
"mocha": "^10.2.0",
"prettier": "^3.0.3",
"semantic-release": "^22.0.5",
"ts-loader": "^9.4.4",
"typescript": "^5.2.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion src/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe('email', function () {
assert.lengthOf(answerLinks, 11);

for (const link of answerLinks) {
assert.isTrue(link.attribs.href.indexOf('localhost/survey?token=aaa&answers%5BQID%5D=') === 0);
assert.isTrue(link.type === 'tag' && link.attribs.href.indexOf('localhost/survey?token=aaa&answers%5BQID%5D=') === 0);
}
});

Expand Down
11 changes: 5 additions & 6 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { marked } from 'marked';
import messages from './messages';
import Uri from 'jsuri';
import is from 'is';
import xtend from 'xtend';
import { Colors } from './base';
import { SafeString } from 'handlebars/runtime';
import xss from 'xss';
Expand Down Expand Up @@ -45,11 +44,11 @@ export interface TransformOptions {
export default function transform(options: TransformOptions) {
// var user = options.user || {};
var urlParams = options.urlParams;
var colors = xtend(
DEFAULT_COLORS,
options.color ? { primary: options.color } : null,
options.colors
);
var colors = {
...DEFAULT_COLORS,
...(options.color ? { primary: options.color } : null),
...options.colors
};

var translation = options.translation || {};
var preview = is.boolean(options.preview) ? options.preview : false;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ESNext",
"module": "commonjs",
"sourceMap": true,
"outDir": "dist",
Expand Down
6 changes: 4 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const path = require('path');
module.exports = {
mode: 'production',
output: {
libraryTarget: 'commonjs2'
libraryTarget: 'commonjs2',
path: path.resolve(__dirname, 'dist'),
filename: 'index.js'
},
module: {
rules: [
Expand All @@ -13,7 +15,7 @@ module.exports = {
use: [
{
loader: 'handlebars-loader',
query: {
options: {
helperDirs: [path.resolve(__dirname, 'src/helpers')],
partialDirs: [path.resolve(__dirname, 'src/partials')]
}
Expand Down
Loading

0 comments on commit f321bdf

Please sign in to comment.