Skip to content

Commit

Permalink
fix(engines): remove old engines (vue, arc, marko)
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Oct 26, 2023
1 parent fb1409f commit 0d1f282
Show file tree
Hide file tree
Showing 15 changed files with 1,034 additions and 4,644 deletions.
1 change: 0 additions & 1 deletion docs/docs/templating.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ If `dustjs-helpers` is installed, `dustjs-linkedin` will not be used by consolid
| [velocityjs](https://github.com/julianshapiro/velocity) | [BETA](https://www.npmjs.com/package/velocity-animate) | [(website)](http://velocityjs.org/) |
| [walrus](https://github.com/jeremyruppel/walrus) | [`npm install walrus`](https://www.npmjs.com/package/walrus) | [(website)](http://documentup.com/jeremyruppel/walrus/) |
| [whiskers](https://github.com/gsf/whiskers.js) | [`npm install whiskers`](https://www.npmjs.com/package/whiskers) | - |
| [vue](https://github.com/vuejs/vue) | `npm install vue vue-pronto` | [(website)](https://vuejs.org/) |

::: tip Note
You must still install the engines you wish to use, add them to your package.json dependencies.
Expand Down
8 changes: 4 additions & 4 deletions packages/core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module.exports = {
...require("@tsed/jest-config"),
coverageThreshold: {
global: {
statements: 98.99,
branches: 94.93,
functions: 95.81,
lines: 98.99
statements: 98.75,
branches: 94.67,
functions: 95.41,
lines: 98.41
}
}
};
40 changes: 35 additions & 5 deletions packages/core/src/decorators/deprecated.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,47 @@
import {Deprecated} from "./deprecated";
import {deprecate} from "util";

jest.mock("util");

describe("Deprecated", () => {
beforeEach(() => {
jest.spyOn(console, "error").mockReturnValue();
jest.spyOn(console, "warn").mockReturnValue();
});
it("should wrap method as deprecated", () => {
class Test {
@Deprecated("test")
test() {}
}

new Test();
new Test().test();

expect(console.error).toHaveBeenCalledWith("test");
});
it("should wrap method as deprecated (throwDeprecation)", () => {
class Test {
@Deprecated("test")
test() {}
}

(process as any).throwDeprecation = true;

try {
new Test().test();
} catch (er) {
expect(er.message).toEqual("test");
} finally {
(process as any).throwDeprecation = false;
}
});
it("should wrap method as deprecated (traceDeprecation)", () => {
class Test {
@Deprecated("test")
test() {}
}

(process as any).traceDeprecation = true;
new Test().test();

expect(console.error).toHaveBeenCalled();

expect(deprecate).toHaveBeenCalledWith(expect.any(Function), "test");
(process as any).traceDeprecation = false;
});
});
33 changes: 32 additions & 1 deletion packages/core/src/decorators/deprecated.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
import {deprecate} from "util";
import {Type} from "../domain/Type";

function deprecate(fn: any, msg: string) {
if (typeof process !== "undefined" && (process as any).noDeprecation === true) {
return fn;
}

// Allow for deprecating things in the process of starting up.
if (typeof process === "undefined") {
return function (...args: any[]) {
return deprecate(fn, msg).apply(this, args);
};
}

let warned = false;

function deprecated(...args: any[]) {
if (!warned) {
if ((process as any).throwDeprecation) {
throw new Error(msg);
} else if (process.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, args);
}

return deprecated;
}

/**
* The `@Deprecated()` decorators wraps the given method in such a way that it is marked as deprecated.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/engines/.nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"check-coverage": true,
"statements": 96.38,
"branches": 75.14,
"branches": 72.9,
"functions": 96.26,
"lines": 96.32
}
14 changes: 5 additions & 9 deletions packages/engines/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@
"@tsed/typescript": "7.39.1",
"@types/fs-extra": "^11.0.3",
"@types/semver": "^7.3.9",
"arc-templates": "^0.5.3",
"atpl": "^0.9.3",
"babel-core": "^6.26.3",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"@babel/core": "7.23.2",
"@babel/plugin-transform-runtime": "7.23.2",
"@babel/preset-env": "7.23.2",
"@babel/preset-react": "7.22.15",
"atpl": "0.9.3",
"bracket-template": "^1.1.5",
"coffee-script": "^1.12.7",
"dot": "^1.1.3",
Expand All @@ -60,7 +59,6 @@
"liquid-node": "^3.0.1",
"liquor": "^0.0.5",
"lodash": "^4.17.21",
"marko": "^5.20.3",
"mote": "^0.2.0",
"mustache": "^4.2.0",
"nunjucks": "^3.2.3",
Expand All @@ -73,7 +71,6 @@
"semver": "^7.3.2",
"slm": "^2.0.0",
"squirrelly": "^5.1.0",
"swig": "^1.4.2",
"swig-templates": "^2.0.3",
"teacup": "^2.0.0",
"templayed": ">=0.2.3",
Expand All @@ -84,7 +81,6 @@
"underscore": "^1.11.0",
"vash": "^0.13.0",
"velocityjs": "^2.0.1",
"vue-pronto": "^2.4.0",
"walrus": "^0.10.1",
"whiskers": "^0.4.0"
},
Expand Down
1 change: 0 additions & 1 deletion packages/engines/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ If `dustjs-helpers` is installed, `dustjs-linkedin` will not be used by consolid
| [velocityjs](https://github.com/julianshapiro/velocity) | [BETA](https://www.npmjs.com/package/velocity-animate) | [(website)](http://velocityjs.org/) |
| [walrus](https://github.com/jeremyruppel/walrus) | [`npm install walrus`](https://www.npmjs.com/package/walrus) | [(website)](http://documentup.com/jeremyruppel/walrus/) |
| [whiskers](https://github.com/gsf/whiskers.js) | [`npm install whiskers`](https://www.npmjs.com/package/whiskers) | - |
| [vue](https://github.com/vuejs/vue) | `npm install vue vue-pronto` | [(website)](https://vuejs.org/) |

> **NOTE**: you must still install the engines you wish to use, add them to your package.json dependencies.
Expand Down
28 changes: 0 additions & 28 deletions packages/engines/src/components/MarkoEngine.ts

This file was deleted.

40 changes: 0 additions & 40 deletions packages/engines/src/components/VueEngine.spec.ts

This file was deleted.

156 changes: 0 additions & 156 deletions packages/engines/src/components/VueEngine.ts

This file was deleted.

Loading

0 comments on commit 0d1f282

Please sign in to comment.