mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2025-06-11 02:23:22 +02:00
Configure typescript support for jets
This commit is contained in:
@ -7,8 +7,12 @@
|
||||
"targets": {
|
||||
"esmodules": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/preset-typescript"
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-proposal-class-properties"
|
||||
],
|
||||
"sourceType": "module"
|
||||
}
|
||||
|
@ -1,23 +1,11 @@
|
||||
// Sync object
|
||||
/** @type {import('@jest/types').Config.InitialOptions} */
|
||||
const config = {
|
||||
testEnvironment: 'jsdom',
|
||||
verbose: true,
|
||||
moduleFileExtensions: ['js'],
|
||||
preset: 'ts-jest',
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
transform: {
|
||||
'^.+\\.js?$': 'babel-jest',
|
||||
},
|
||||
moduleNameMapper: {
|
||||
'^@libraries(.*)$': '<rootDir>../../libraries$1',
|
||||
'^@commands(.*)$': '<rootDir>/src/components/commands$1',
|
||||
'^@layout(.*)$': '<rootDir>/src/components/layout$1',
|
||||
'^@libs(.*)$': '<rootDir>/src/components/libraries$1',
|
||||
'^@model(.*)$': '<rootDir>/src/components/model$1',
|
||||
'^@persistence(.*)$': '<rootDir>/src/components/persistence$1',
|
||||
'^@util(.*)$': '<rootDir>/src/components/util$1',
|
||||
'^@widget(.*)$': '<rootDir>/src/components/widget$1',
|
||||
'^@components(.*)$': '<rootDir>/src/components$1',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
|
@ -26,7 +26,7 @@
|
||||
"lint": "eslint src",
|
||||
"playground": "webpack serve --config webpack.playground.js",
|
||||
"cy:run": "cypress run",
|
||||
"test:unit": "jest ./test/unit/*.js",
|
||||
"test:unit": "jest ./test/unit/*.ts ./test/unit/*.js",
|
||||
"test:integration": "start-server-and-test playground http-get://localhost:8081 cy:run",
|
||||
"test": "yarn test:unit && yarn test:integration"
|
||||
},
|
||||
@ -41,7 +41,9 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/preset-env": "^7.14.7",
|
||||
"@babel/preset-typescript": "^7.16.5",
|
||||
"@babel/register": "^7.16.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"babel-loader": "^8.2.2",
|
||||
"clean-webpack-plugin": "^4.0.0-alpha.0",
|
||||
"compression-webpack-plugin": "^9.2.0",
|
||||
@ -62,6 +64,8 @@
|
||||
"mocha": "^9.1.3",
|
||||
"nodemon": "^2.0.12",
|
||||
"start-server-and-test": "^1.14.0",
|
||||
"ts-jest": "^27.1.2",
|
||||
"ts-loader": "^9.2.6",
|
||||
"webpack": "^5.44.0",
|
||||
"webpack-bundle-analyzer": "^4.5.0",
|
||||
"webpack-cli": "^4.7.2",
|
||||
|
7
packages/mindplot/src/components/export/Exporter.ts
Normal file
7
packages/mindplot/src/components/export/Exporter.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import Mindmap from '../model/Mindmap';
|
||||
|
||||
interface Exporter {
|
||||
export(mindplot: Mindmap): string;
|
||||
}
|
||||
|
||||
export default Exporter;
|
13
packages/mindplot/src/components/export/TxtExporter.ts
Normal file
13
packages/mindplot/src/components/export/TxtExporter.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import Exporter from "src/components/export/Exporter";
|
||||
import Mindmap from "src/components/model/Mindmap";
|
||||
|
||||
|
||||
class TextExporter implements Exporter {
|
||||
export(mindplot: Mindmap): string {
|
||||
|
||||
|
||||
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}
|
||||
export default TextExporter;
|
5
packages/mindplot/test/unit/TxTExportTestSuite.test.ts
Normal file
5
packages/mindplot/test/unit/TxTExportTestSuite.test.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import TxtExporter from '../../src/components/export/TxtExporter';
|
||||
|
||||
test('adds 1 + 2 to equal 3', () => {
|
||||
|
||||
});
|
12
packages/mindplot/tsconfig.json
Normal file
12
packages/mindplot/tsconfig.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/",
|
||||
"sourceMap": true,
|
||||
"noImplicitAny": false,
|
||||
"module": "es6",
|
||||
"target": "es6",
|
||||
"allowJs": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
@ -22,11 +22,17 @@ module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
use: ['babel-loader'],
|
||||
test: /.(js$)/,
|
||||
use: ['babel-loader'],
|
||||
exclude: [
|
||||
/node_modules/,
|
||||
],
|
||||
enforce: 'pre',
|
||||
},
|
||||
{
|
||||
test: /\.(ts)$/,
|
||||
use: 'ts-loader',
|
||||
exclude: '/node_modules/',
|
||||
},
|
||||
{
|
||||
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
||||
@ -38,7 +44,7 @@ module.exports = {
|
||||
alias: {
|
||||
'@libraries': path.resolve(__dirname, '../../libraries/'),
|
||||
},
|
||||
extensions: ['.js', '.json'],
|
||||
extensions: ['.js', '.ts', '.json'],
|
||||
},
|
||||
plugins: [new CleanWebpackPlugin()],
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ const prodConfig = {
|
||||
},
|
||||
plugins: [
|
||||
new CompressionPlugin({
|
||||
test: /\.js(\?.*)?$/i
|
||||
test: /\.js(\?.*)?$/i,
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
Reference in New Issue
Block a user