Adding final files from js to ts.

This commit is contained in:
Alejandro Lembke Barrientos 2022-05-24 14:09:48 +00:00
parent d0259f13b1
commit a05226544f
6 changed files with 9 additions and 5 deletions

View File

@ -1,8 +1,8 @@
module.exports = { module.exports = {
setupFilesAfterEnv: ['<rootDir>/setupTest.js'], setupFilesAfterEnv: ['<rootDir>/setupTest.ts'],
"testEnvironment": "jsdom", "testEnvironment": "jsdom",
moduleNameMapper: { moduleNameMapper: {
"\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.js", "\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.ts",
"\\.(css|sass|less)$": "identity-obj-proxy" "\\.(css|sass|less)$": "identity-obj-proxy"
}, },
}; };

View File

@ -1,6 +1,6 @@
{ {
"name": "@aleleba/create-react-ssr", "name": "@aleleba/create-react-ssr",
"version": "2.0.6", "version": "2.0.7",
"description": "Starter Kit of server side render of react", "description": "Starter Kit of server side render of react",
"bin": "./bin/cli.js", "bin": "./bin/cli.js",
"main": "src/server/index", "main": "src/server/index",

View File

@ -14,12 +14,14 @@ import { StaleWhileRevalidate, NetworkFirst } from 'workbox-strategies';
clientsClaim(); clientsClaim();
// This allows the web app to trigger skipWaiting via // This allows the web app to trigger skipWaiting via
// @ts-ignore:next-line
self.skipWaiting(); self.skipWaiting();
// Precache all of the assets generated by your build process. // Precache all of the assets generated by your build process.
// Their URLs are injected into the manifest variable below. // Their URLs are injected into the manifest variable below.
// This variable must be present somewhere in your service worker file, // This variable must be present somewhere in your service worker file,
// even if you decide not to use precaching. See https://cra.link/PWA // even if you decide not to use precaching. See https://cra.link/PWA
// @ts-ignore:next-line
precacheAndRoute(self.__WB_MANIFEST); precacheAndRoute(self.__WB_MANIFEST);
// An example runtime caching route for requests that aren't handled by the // An example runtime caching route for requests that aren't handled by the
@ -45,8 +47,10 @@ registerRoute(/^https?.*/, new NetworkFirst(), 'GET');
//Wait for Notification. //Wait for Notification.
self.addEventListener('push', function (e) { self.addEventListener('push', function (e) {
// @ts-ignore:next-line
const data = e.data.json(); const data = e.data.json();
// @ts-ignore:next-line
registration.showNotification(data.title, { registration.showNotification(data.title, {
body: data.message, body: data.message,
icon: 'favicon.ico' icon: 'favicon.ico'

View File

@ -109,7 +109,7 @@ const frontendConfig = {
] ]
}), }),
new InjectManifest({ new InjectManifest({
swSrc: './service-worker.js', swSrc: './service-worker.ts',
swDest: 'service-worker.js', swDest: 'service-worker.js',
}), }),
], ],
@ -210,7 +210,7 @@ const serverConfig = {
'process.env.PUBLIC_URL': JSON.stringify(PUBLIC_URL), 'process.env.PUBLIC_URL': JSON.stringify(PUBLIC_URL),
}), }),
new InjectManifest({ new InjectManifest({
swSrc: './service-worker.js', swSrc: './service-worker.ts',
swDest: 'service-worker.js', swDest: 'service-worker.js',
}), }),
], ],