mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 16:43:56 +03:00
1 parent
09a479b279
commit
7ab8b321c7
5 files changed
+39
-29
No files matched your search
+17
-17
@@ -28,23 +28,23 @@ module.exports = {
|
||||
"babel-core": "babel-standalone"
|
||||
};
|
||||
|
||||
if (!dev) {
|
||||
config.plugins.push(
|
||||
new SWPrecacheWebpackPlugin({
|
||||
minify: true,
|
||||
staticFileGlobsIgnorePatterns: [/\.next\//],
|
||||
staticFileGlobs: [
|
||||
"static/**/*" // Precache all static files by default
|
||||
],
|
||||
runtimeCaching: [
|
||||
{
|
||||
handler: "networkFirst",
|
||||
urlPattern: /^https?.*/
|
||||
}
|
||||
]
|
||||
})
|
||||
);
|
||||
}
|
||||
// if (!dev) {
|
||||
// config.plugins.push(
|
||||
// new SWPrecacheWebpackPlugin({
|
||||
// minify: true,
|
||||
// staticFileGlobsIgnorePatterns: [/\.next\//],
|
||||
// staticFileGlobs: [
|
||||
// "static/**/*" // Precache all static files by default
|
||||
// ],
|
||||
// runtimeCaching: [
|
||||
// {
|
||||
// handler: "networkFirst",
|
||||
// urlPattern: /^https?.*/
|
||||
// }
|
||||
// ]
|
||||
// })
|
||||
// );
|
||||
// }
|
||||
|
||||
if (ANALYZE) {
|
||||
config.plugins.push(
|
||||
|
||||
+1
-2
@@ -5,8 +5,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "next start",
|
||||
"build":
|
||||
"rm -rf out && next build && next export -o transform && cp ./.next/service-worker.js ./transform/service-worker.js",
|
||||
"build": "rm -rf out && next build && next export -o transform",
|
||||
"dev": "next dev",
|
||||
"addContributor": "all-contributors add",
|
||||
"analyze": "cross-env ANALYZE=1 next build",
|
||||
|
||||
+14
-8
@@ -26,14 +26,20 @@ export default class Main extends PureComponent {
|
||||
|
||||
componentDidMount() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register("/service-worker.js")
|
||||
.then(registration => {
|
||||
console.log("service worker registration successful");
|
||||
})
|
||||
.catch(err => {
|
||||
console.warn("service worker registration failed");
|
||||
});
|
||||
// navigator.serviceWorker
|
||||
// .register("/service-worker.js")
|
||||
// .then(registration => {
|
||||
// console.log("service worker registration successful");
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.warn("service worker registration failed");
|
||||
// });
|
||||
|
||||
navigator.serviceWorker.getRegistrations().then(function(registrations) {
|
||||
for (let registration of registrations) {
|
||||
registration.unregister();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@ import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
import { json2ts } from "json-ts";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
|
||||
export default class Json2Ts extends PureComponent {
|
||||
getTransformedValue = code => window.json2ts(code, { flow: true });
|
||||
getTransformedValue = code => json2ts(code, { flow: true, prefix: "" });
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
||||
@@ -2,10 +2,14 @@ import React, { PureComponent } from "react";
|
||||
import Layout from "../components/Layout";
|
||||
import ConversionPanel from "../components/ConversionPanel";
|
||||
import defaultText from "../utils/dummy-json";
|
||||
import { json2ts } from "json-ts";
|
||||
import PoweredBy from "../components/PoweredBy";
|
||||
|
||||
export default class Json2Ts extends PureComponent {
|
||||
getTransformedValue = code => window.json2ts(code);
|
||||
getTransformedValue = code =>
|
||||
json2ts(code, {
|
||||
prefix: ""
|
||||
});
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user