From d61e4fa7196f20717166a2744f8ea3a77cc4addb Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 5 May 2023 08:35:28 -0300 Subject: [PATCH] upgrade to now build from web-utils --- packages/anastasis-webui/build.mjs | 160 +----------------- packages/anastasis-webui/dev.mjs | 29 ++-- packages/anastasis-webui/package.json | 7 +- .../src/components/menu/index.tsx | 2 +- .../picker/DurationPicker.stories.tsx | 2 +- packages/anastasis-webui/src/index.test.ts | 3 +- .../home/AddingProviderScreen/stories.tsx | 2 +- .../pages/home/AddingProviderScreen/test.ts | 2 +- .../home/AttributeEntryScreen.stories.tsx | 2 +- .../AuthenticationEditorScreen.stories.tsx | 2 +- .../home/BackupFinishedScreen.stories.tsx | 2 +- .../home/ChallengeOverviewScreen.stories.tsx | 2 +- .../home/ChallengePayingScreen.stories.tsx | 2 +- .../home/ContinentSelectionScreen.stories.tsx | 2 +- .../pages/home/EditPoliciesScreen.stories.tsx | 2 +- .../home/PoliciesPayingScreen.stories.tsx | 2 +- .../home/RecoveryFinishedScreen.stories.tsx | 2 +- .../home/ReviewPoliciesScreen.stories.tsx | 2 +- .../pages/home/SecretEditorScreen.stories.tsx | 2 +- .../home/SecretSelectionScreen.stories.tsx | 2 +- .../src/pages/home/SolveScreen.stories.tsx | 2 +- .../src/pages/home/StartScreen.stories.tsx | 2 +- .../pages/home/TruthsPayingScreen.stories.tsx | 2 +- .../AuthMethodEmailSetup.stories.tsx | 2 +- .../AuthMethodEmailSolve.stories.tsx | 2 +- .../AuthMethodIbanSetup.stories.tsx | 2 +- .../AuthMethodIbanSolve.stories.tsx | 2 +- .../AuthMethodPostSetup.stories.tsx | 2 +- .../AuthMethodPostSolve.stories.tsx | 2 +- .../AuthMethodQuestionSetup.stories.tsx | 2 +- .../AuthMethodQuestionSolve.stories.tsx | 2 +- .../authMethod/AuthMethodSmsSetup.stories.tsx | 2 +- .../authMethod/AuthMethodSmsSolve.stories.tsx | 2 +- .../AuthMethodTotpSetup.stories.tsx | 2 +- .../AuthMethodTotpSolve.stories.tsx | 2 +- .../src/pages/home/authMethod/totp.ts | 2 + packages/anastasis-webui/src/stories.tsx | 2 +- packages/anastasis-webui/tsconfig.json | 43 ++--- 38 files changed, 79 insertions(+), 229 deletions(-) diff --git a/packages/anastasis-webui/build.mjs b/packages/anastasis-webui/build.mjs index def8b1050..9d49a63ee 100755 --- a/packages/anastasis-webui/build.mjs +++ b/packages/anastasis-webui/build.mjs @@ -14,157 +14,13 @@ You should have received a copy of the GNU Affero General Public License along with GNU Anastasis; see the file COPYING. If not, see */ -/* eslint-disable no-undef */ -import esbuild from 'esbuild' -import fs from 'fs'; -import path from "path" -import sass from "sass"; +import { build } from "@gnu-taler/web-util/build"; -// eslint-disable-next-line no-undef -const BASE = process.cwd(); - -const preact = path.join( - BASE, - "node_modules", - "preact", - "compat", - "dist", - "compat.module.js", -); - -const preactCompatPlugin = { - name: "preact-compat", - setup(build) { - build.onResolve({ filter: /^(react-dom|react)$/ }, (args) => { - return { - path: preact, - }; - }); +await build({ + source: { + js: ["src/index.ts"], + assets: ["src/index.html"], }, -}; - - -let GIT_ROOT = BASE -while (!fs.existsSync(path.join(GIT_ROOT, '.git')) && GIT_ROOT !== '/') { - GIT_ROOT = path.join(GIT_ROOT, '../') -} -if (GIT_ROOT === '/') { - // eslint-disable-next-line no-undef - console.log("not found") - // eslint-disable-next-line no-undef - process.exit(1); -} -const GIT_HASH = GIT_ROOT === '/' ? undefined : git_hash() - - -let _package = JSON.parse(fs.readFileSync(path.join(BASE, 'package.json'))); - -function git_hash() { - const rev = fs.readFileSync(path.join(GIT_ROOT, '.git', 'HEAD')).toString().trim().split(/.*[: ]/).slice(-1)[0]; - if (rev.indexOf('/') === -1) { - return rev; - } else { - return fs.readFileSync(path.join(GIT_ROOT, '.git', rev)).toString().trim(); - } -} - -const DEFAULT_SASS_FILTER = /\.(s[ac]ss|css)$/ - -const buildSassPlugin = { - name: "custom-build-sass", - setup(build) { - - build.onLoad({ filter: DEFAULT_SASS_FILTER }, ({ path: file }) => { - const resolveDir = path.dirname(file) - const { css: contents } = sass.compile(file, { loadPaths: ["./"] }) - - return { - resolveDir, - loader: 'css', - contents - } - }); - - }, -}; - -function copyFilesPlugin(options) { - if (!options.basedir) { - options.basedir = process.cwd() - } - return { - name: "copy-files", - setup(build) { - build.onEnd(() => { - for (const fop of options) { - fs.copyFileSync(path.join(options.basedir, fop.src), path.join(options.basedir, fop.dest)); - } - }); - }, - }; -} - -function getFilesInDirectory(startPath, regex) { - if (!fs.existsSync(startPath)) { - return; - } - const files = fs.readdirSync(startPath); - const result = files.flatMap(file => { - const filename = path.join(startPath, file); - - const stat = fs.lstatSync(filename); - if (stat.isDirectory()) { - return getFilesInDirectory(filename, regex); - } - else if (regex.test(filename)) { - return filename - } - }).filter(x => !!x) - - return result -} - -const allTestFiles = getFilesInDirectory(path.join(BASE, 'src'), /test.tsx?$/) -const entryPoints = ["src/index.ts", "src/stories.tsx", ...allTestFiles]; - -export const buildConfig = { - entryPoints: [...entryPoints], - bundle: true, - outdir: 'dist', - minify: false, - loader: { - '.svg': 'dataurl', - '.ttf': 'file', - '.woff': 'file', - '.woff2': 'file', - '.eot': 'file', - }, - target: [ - 'es6' - ], - format: 'esm', - platform: 'browser', - sourcemap: true, - jsxFactory: 'h', - jsxFragment: 'Fragment', - define: { - '__VERSION__': `"${_package.version}"`, - '__GIT_HASH__': `"${GIT_HASH}"`, - }, - plugins: [ - preactCompatPlugin, - copyFilesPlugin([ - { - src: "./src/index.html", - dest: "./dist/index.html", - }, - ]), - buildSassPlugin - ], -} - -await esbuild.build(buildConfig) - - - - + destination: "./dist/prod", + css: "sass", +}); diff --git a/packages/anastasis-webui/dev.mjs b/packages/anastasis-webui/dev.mjs index 0446603dc..f5f66c77f 100755 --- a/packages/anastasis-webui/dev.mjs +++ b/packages/anastasis-webui/dev.mjs @@ -15,17 +15,26 @@ GNU Anastasis; see the file COPYING. If not, see */ -import { serve } from "@gnu-taler/web-util/lib/index.node"; -import esbuild from 'esbuild'; -import { buildConfig } from "./build.mjs"; +import { serve } from "@gnu-taler/web-util/node"; +import { initializeDev, getFilesInDirectory } from "@gnu-taler/web-util/build"; -buildConfig.inject = ['./node_modules/@gnu-taler/web-util/lib/live-reload.mjs'] +const allTestFiles = getFilesInDirectory("src", /.test.tsx?$/); +const devEntryPoints = ["src/stories.tsx", "src/index.ts", ...allTestFiles]; + +const build = initializeDev({ + source: { + js: devEntryPoints, + assets: ["src/index.html"], + }, + css: "sass", + destination: "./dist/dev", +}); + +await build(); serve({ - folder: './dist', + folder: "./dist/dev", port: 8080, - source: './src', - development: true, - onUpdate: async () => esbuild.build(buildConfig) -}) - + source: "./src", + onSourceUpdate: build, +}); diff --git a/packages/anastasis-webui/package.json b/packages/anastasis-webui/package.json index a390a2fa8..69707b137 100644 --- a/packages/anastasis-webui/package.json +++ b/packages/anastasis-webui/package.json @@ -17,12 +17,10 @@ "@gnu-taler/anastasis-core": "workspace:*", "@gnu-taler/taler-util": "workspace:*", "@gnu-taler/web-util": "workspace:*", - "@types/chai": "^4.3.0", - "chai": "^4.3.6", "date-fns": "2.29.2", + "jssha": "^3.3.0", "jed": "1.1.1", "preact": "10.11.3", - "preact-render-to-string": "^5.1.19", "preact-router": "^3.2.1", "qrcode-generator": "^1.4.4" }, @@ -40,10 +38,11 @@ "devDependencies": { "@creativebulma/bulma-tooltip": "^1.2.0", "@types/mocha": "^9.0.0", + "@types/chai": "^4.3.0", + "chai": "^4.3.6", "bulma": "^0.9.3", "bulma-checkbox": "^1.1.1", "bulma-radio": "^1.1.1", - "jssha": "^3.2.0", "mocha": "^9.2.0", "sass": "1.56.1", "typescript": "^4.9.4" diff --git a/packages/anastasis-webui/src/components/menu/index.tsx b/packages/anastasis-webui/src/components/menu/index.tsx index b1d22eeb4..957ab2977 100644 --- a/packages/anastasis-webui/src/components/menu/index.tsx +++ b/packages/anastasis-webui/src/components/menu/index.tsx @@ -15,7 +15,7 @@ */ import { ComponentChildren, Fragment, h, VNode } from "preact"; -import Match from "preact-router/match"; +import { Match } from "preact-router/match.js"; import { useEffect, useState } from "preact/hooks"; import { NavigationBar } from "./NavigationBar.js"; import { Sidebar } from "./SideBar.js"; diff --git a/packages/anastasis-webui/src/components/picker/DurationPicker.stories.tsx b/packages/anastasis-webui/src/components/picker/DurationPicker.stories.tsx index b4844c706..94bce4038 100644 --- a/packages/anastasis-webui/src/components/picker/DurationPicker.stories.tsx +++ b/packages/anastasis-webui/src/components/picker/DurationPicker.stories.tsx @@ -22,7 +22,7 @@ import { h, FunctionalComponent } from "preact"; import { useState } from "preact/hooks"; import { DurationPicker as TestedComponent } from "./DurationPicker.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { component: TestedComponent, diff --git a/packages/anastasis-webui/src/index.test.ts b/packages/anastasis-webui/src/index.test.ts index f5873f540..2f865bc1d 100644 --- a/packages/anastasis-webui/src/index.test.ts +++ b/packages/anastasis-webui/src/index.test.ts @@ -19,7 +19,8 @@ * @author Sebastian Javier Marchano (sebasjm) */ import { setupI18n } from "@gnu-taler/taler-util"; -import { parseGroupImport, tests } from "@gnu-taler/web-util/lib/index.browser"; +import { parseGroupImport } from "@gnu-taler/web-util/browser"; +import * as tests from "@gnu-taler/web-util/testing"; import * as pages from "./pages/home/index.stories.js"; import { ComponentChildren, VNode, h as create } from "preact"; import { AnastasisProvider } from "./context/anastasis.js"; diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/stories.tsx b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/stories.tsx index 6ce22e56c..548fc01a5 100644 --- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/stories.tsx +++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/stories.tsx @@ -20,7 +20,7 @@ */ import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { WithoutProviderType, WithProviderType } from "./views.jsx"; export default { diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/test.ts b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/test.ts index 8d0e69111..0aebbdc6c 100644 --- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen/test.ts +++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen/test.ts @@ -21,7 +21,7 @@ import { expect } from "chai"; import useComponentState from "./state.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; describe("AddingProviderScreen states", () => { it("should not load more if has reach the end", async () => { diff --git a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx index bc62961a5..e6bc5f340 100644 --- a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx @@ -20,7 +20,7 @@ */ import { ReducerState } from "@gnu-taler/anastasis-core"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../utils/index.js"; import { AttributeEntryScreen as TestedComponent } from "./AttributeEntryScreen.js"; diff --git a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.stories.tsx index 23212c184..22f8dd697 100644 --- a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.stories.tsx @@ -20,7 +20,7 @@ */ import { ReducerState } from "@gnu-taler/anastasis-core"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../utils/index.js"; import { AuthenticationEditorScreen as TestedComponent } from "./AuthenticationEditorScreen.js"; diff --git a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx index fce823bec..a51940615 100644 --- a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx @@ -22,7 +22,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../utils/index.js"; import { BackupFinishedScreen as TestedComponent } from "./BackupFinishedScreen.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Backup finish", diff --git a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx index f41f894e8..1d35c0e91 100644 --- a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx @@ -26,7 +26,7 @@ import { } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../utils/index.js"; import { ChallengeOverviewScreen as TestedComponent } from "./ChallengeOverviewScreen.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Challenge overview", diff --git a/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.stories.tsx index 086647791..0489e5a11 100644 --- a/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../utils/index.js"; import { ChallengePayingScreen as TestedComponent } from "./ChallengePayingScreen.js"; diff --git a/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.stories.tsx index 524b673a9..646165341 100644 --- a/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.stories.tsx @@ -22,7 +22,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../utils/index.js"; import { ContinentSelectionScreen as TestedComponent } from "./ContinentSelectionScreen.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Continent selection", diff --git a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.stories.tsx index e43996222..3c9fd7f50 100644 --- a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.stories.tsx @@ -20,7 +20,7 @@ */ import { ReducerState } from "@gnu-taler/anastasis-core"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../utils/index.js"; import { EditPoliciesScreen as TestedComponent } from "./EditPoliciesScreen.js"; diff --git a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.stories.tsx index aaaae25c9..ea88b74a0 100644 --- a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.stories.tsx @@ -22,7 +22,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../utils/index.js"; import { PoliciesPayingScreen as TestedComponent } from "./PoliciesPayingScreen.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Policies paying", diff --git a/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.stories.tsx index 1a5c41f94..97e0821fd 100644 --- a/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.stories.tsx @@ -23,7 +23,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util"; import { reducerStatesExample } from "../../utils/index.js"; import { RecoveryFinishedScreen as TestedComponent } from "./RecoveryFinishedScreen.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Recovery Finished", diff --git a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.stories.tsx index 7cde84e0f..71144917a 100644 --- a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.stories.tsx @@ -22,7 +22,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../utils/index.js"; import { ReviewPoliciesScreen as TestedComponent } from "./ReviewPoliciesScreen.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Reviewing Policies", diff --git a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.stories.tsx index b0e32258b..24bbb2927 100644 --- a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.stories.tsx @@ -22,7 +22,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../utils/index.js"; import { SecretEditorScreen as TestedComponent } from "./SecretEditorScreen.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Secret editor", diff --git a/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.stories.tsx index 2da80a8bb..fb3b26e15 100644 --- a/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.stories.tsx @@ -20,7 +20,7 @@ */ import { ReducerState } from "@gnu-taler/anastasis-core"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../utils/index.js"; import { SecretSelectionScreen, diff --git a/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx index b6d891fdd..dc707a052 100644 --- a/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx @@ -22,7 +22,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../utils/index.js"; import { SolveScreen as TestedComponent } from "./SolveScreen.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Solve Screen", diff --git a/packages/anastasis-webui/src/pages/home/StartScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/StartScreen.stories.tsx index 3745c834b..1f6145345 100644 --- a/packages/anastasis-webui/src/pages/home/StartScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/StartScreen.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../utils/index.js"; import { StartScreen as TestedComponent } from "./StartScreen.js"; diff --git a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.stories.tsx index dafb4bc58..424c4884a 100644 --- a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.stories.tsx @@ -22,7 +22,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../utils/index.js"; import { TruthsPayingScreen as TestedComponent } from "./TruthsPayingScreen.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Truths Paying", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.stories.tsx index 98119700a..aee7829ff 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx index 6bf6c2e30..075bab2a7 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx @@ -25,7 +25,7 @@ import { } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Auth method: Email solve", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.stories.tsx index 8dd141b61..d571093f7 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.stories.tsx index 1aa257259..2a16c8456 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.stories.tsx @@ -20,7 +20,7 @@ */ import { ReducerState } from "@gnu-taler/anastasis-core"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../../utils/index.js"; import { KnownAuthMethods, authMethods as TestedComponent } from "./index.js"; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.stories.tsx index 9a92ae109..a893c923e 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.stories.tsx index d28680801..3495f7f63 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.stories.tsx @@ -22,7 +22,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Auth method: Post solve", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.stories.tsx index c365a7e06..c9bc127f7 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx index b9dff6363..fe2cfbebb 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx @@ -25,7 +25,7 @@ import { } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Auth method: Question solve", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.stories.tsx index d98a7ec89..fbf345779 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx index 1fb20b6d2..8e3fb1a16 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx @@ -22,7 +22,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; export default { title: "Auth method: SMS solve", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.stories.tsx index bb2fa1aeb..ee66fcee1 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../../utils/index.js"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js"; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.stories.tsx index 5f1022247..c120aaadc 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.stories.tsx @@ -20,7 +20,7 @@ */ import { ReducerState } from "@gnu-taler/anastasis-core"; -import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import * as tests from "@gnu-taler/web-util/testing"; import { reducerStatesExample } from "../../../utils/index.js"; import { KnownAuthMethods, authMethods as TestedComponent } from "./index.js"; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/totp.ts b/packages/anastasis-webui/src/pages/home/authMethod/totp.ts index 434dd92fc..ff8027ced 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/totp.ts +++ b/packages/anastasis-webui/src/pages/home/authMethod/totp.ts @@ -13,6 +13,8 @@ You should have received a copy of the GNU Affero General Public License along with GNU Anastasis; see the file COPYING. If not, see */ + +//@ts-ignore import jssha from "jssha"; const SEARCH_RANGE = 16; diff --git a/packages/anastasis-webui/src/stories.tsx b/packages/anastasis-webui/src/stories.tsx index 52d42577d..cdaa4022f 100644 --- a/packages/anastasis-webui/src/stories.tsx +++ b/packages/anastasis-webui/src/stories.tsx @@ -22,7 +22,7 @@ import { strings } from "./i18n/strings.js"; import * as pages from "./pages/home/index.stories.js"; -import { renderStories } from "@gnu-taler/web-util/lib/index.browser"; +import { renderStories } from "@gnu-taler/web-util/browser"; import "./scss/main.scss"; diff --git a/packages/anastasis-webui/tsconfig.json b/packages/anastasis-webui/tsconfig.json index 2d60fd47a..642c34f5a 100644 --- a/packages/anastasis-webui/tsconfig.json +++ b/packages/anastasis-webui/tsconfig.json @@ -1,46 +1,38 @@ { "compilerOptions": { /* Basic Options */ - "target": "ES6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */, - "module": "ESNext" /* Specify module code generation: 'none', commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, + "target": "ES5", + "module": "ES6", "lib": [ - "es2021", - "dom" - ], /* Specify library files to be included in the compilation: */ - // "allowJs": true /* Allow javascript files to be compiled. */, + "DOM", + "ES2017" + ], + "allowJs": true /* Allow javascript files to be compiled. */, // "checkJs": true, /* Report errors in .js files. */ "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, - "jsxFactory": "h" /* Specify the JSX factory function to use when targeting react JSX emit, e.g. React.createElement or h. */, - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "removeComments": true, /* Do not emit comments to output. */ + "jsxFactory": "h", + "jsxFragmentFactory": "Fragment", "noEmit": true /* Do not emit outputs. */, // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */ "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, /* Additional Checks */ // "noUnusedLocals": true, /* Report errors on unused locals. */ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ /* Module Resolution Options */ - "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, + "moduleResolution": "Node16" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, "esModuleInterop": true /* */, // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */, // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ /* Source Map Options */ // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ @@ -53,16 +45,7 @@ /* Advanced Options */ "skipLibCheck": true /* Skip type checking of declaration files. */ }, - "references": [ - { - "path": "../taler-util/" - }, - { - "path": "../anastasis-core/" - } - ], "include": [ - "src/**/*", - "tests/**/*" + "src/**/*" ] -} \ No newline at end of file +}