From 4c01cea6229aae20936dbacb8702d4518f08db0b Mon Sep 17 00:00:00 2001 From: osdevisnot Date: Fri, 12 Mar 2021 11:12:28 -0800 Subject: [PATCH] refactor: refactor examples --- examples/const-enums/package.json | 7 ++ examples/dev-expressions/package.json | 18 +++-- examples/dynamic-imports/package.json | 51 ++++++------- examples/jsx-runtime/package.json | 4 + examples/minimal/package.json | 14 ++-- examples/react-component/package-lock.json | 77 -------------------- examples/react-component/package.json | 51 ++++++------- examples/react-sc-typescript/package.json | 59 ++++++++------- examples/react-typescript/package-lock.json | 77 -------------------- examples/react-typescript/package.json | 52 ++++++------- examples/scaffold-typescript/dist/index.d.ts | 3 + examples/scaffold-typescript/package.json | 47 ++++++------ examples/scaffold/package.json | 43 +++++------ examples/typedefs/package.json | 9 ++- test.sh | 5 +- 15 files changed, 202 insertions(+), 315 deletions(-) delete mode 100644 examples/react-component/package-lock.json delete mode 100644 examples/react-typescript/package-lock.json create mode 100644 examples/scaffold-typescript/dist/index.d.ts diff --git a/examples/const-enums/package.json b/examples/const-enums/package.json index 530ae81..75f65ab 100644 --- a/examples/const-enums/package.json +++ b/examples/const-enums/package.json @@ -2,9 +2,16 @@ "name": "const-enums", "version": "0.0.0", "private": true, + "license": "MIT", "module": "dist/index.esm.js", "source": "src/index.ts", "types": "dist/index.d.ts", + "dependencies": { + "typescript": "*" + }, + "devDependencies": { + "klap": "*" + }, "klap": { "usets": true } diff --git a/examples/dev-expressions/package.json b/examples/dev-expressions/package.json index a324538..a303a51 100644 --- a/examples/dev-expressions/package.json +++ b/examples/dev-expressions/package.json @@ -1,9 +1,13 @@ { - "name": "dev-expressions", - "version": "0.0.0", - "private": true, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "source": "src/index.js", - "browser": "dist/index.js" + "name": "dev-expressions", + "version": "0.0.0", + "private": true, + "license": "MIT", + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "source": "src/index.js", + "browser": "dist/index.js", + "devDependencies": { + "klap": "*" + } } diff --git a/examples/dynamic-imports/package.json b/examples/dynamic-imports/package.json index 43eb309..03e914d 100644 --- a/examples/dynamic-imports/package.json +++ b/examples/dynamic-imports/package.json @@ -1,27 +1,28 @@ { - "name": "dynamic-import", - "version": "0.0.0", - "private": true, - "files": [ - "dist" - ], - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "source": "src/index.js", - "browser": "dist/index.js", - "scripts": { - "build": "klap build", - "start": "klap start", - "watch": "klap watch" - }, - "dependencies": { - "react": "*", - "react-dom": "*" - }, - "devDependencies": { - "klap": "2.1.0" - }, - "klap": { - "example": "public/index.js" - } + "name": "dynamic-import", + "version": "0.0.0", + "private": true, + "license": "MIT", + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "source": "src/index.js", + "browser": "dist/index.js", + "files": [ + "dist" + ], + "scripts": { + "build": "klap build", + "start": "klap start", + "watch": "klap watch" + }, + "dependencies": { + "react": "*", + "react-dom": "*" + }, + "devDependencies": { + "klap": "*" + }, + "klap": { + "example": "public/index.js" + } } diff --git a/examples/jsx-runtime/package.json b/examples/jsx-runtime/package.json index d914954..087749d 100644 --- a/examples/jsx-runtime/package.json +++ b/examples/jsx-runtime/package.json @@ -2,8 +2,12 @@ "name": "jsx-runtime", "version": "0.0.0", "private": true, + "license": "MIT", "module": "dist/index.esm.js", "source": "src/index.js", + "devDependencies": { + "klap": "*" + }, "klap": { "runtime": "preact" } diff --git a/examples/minimal/package.json b/examples/minimal/package.json index ad9ffda..ec08c23 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -1,7 +1,11 @@ { - "name": "minimal", - "version": "0.0.0", - "private": true, - "module": "dist/index.esm.js", - "source": "src/index.js" + "name": "minimal", + "version": "0.0.0", + "private": true, + "license": "MIT", + "module": "dist/index.esm.js", + "source": "src/index.js", + "devDependencies": { + "klap": "*" + } } diff --git a/examples/react-component/package-lock.json b/examples/react-component/package-lock.json deleted file mode 100644 index a3f86b3..0000000 --- a/examples/react-component/package-lock.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "react-component", - "version": "0.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "klap": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/klap/-/klap-0.3.0.tgz", - "integrity": "sha512-JgTlV2psnLTOobuP7mQi0PZUGN+cViQbK3NkN8t0WURyaASN7zgGITExkm0fIi+AZ9Y/kYn1iKGa/BAwpFoLfw==", - "dev": true - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } - }, - "react": { - "version": "16.11.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.11.0.tgz", - "integrity": "sha512-M5Y8yITaLmU0ynd0r1Yvfq98Rmll6q8AxaEe88c8e7LxO8fZ2cNgmFt0aGAS9wzf1Ao32NKXtCl+/tVVtkxq6g==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2" - } - }, - "react-dom": { - "version": "16.11.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.11.0.tgz", - "integrity": "sha512-nrRyIUE1e7j8PaXSPtyRKtz+2y9ubW/ghNgqKFHHAHaeP0fpF5uXR+sq8IMRHC+ZUxw7W9NyCDTBtwWxvkb0iA==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.17.0" - } - }, - "react-is": { - "version": "16.11.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.11.0.tgz", - "integrity": "sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==" - }, - "scheduler": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.17.0.tgz", - "integrity": "sha512-7rro8Io3tnCPuY4la/NuI5F2yfESpnfZyT6TtkXnSWVkcu0BCDJ+8gk5ozUaFaxpIyNuWAPXrH0yFcSi28fnDA==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - } - } -} diff --git a/examples/react-component/package.json b/examples/react-component/package.json index 7bf3425..8b12510 100644 --- a/examples/react-component/package.json +++ b/examples/react-component/package.json @@ -1,27 +1,28 @@ { - "name": "react-component", - "version": "0.0.0", - "private": true, - "files": [ - "dist" - ], - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "source": "src/index.js", - "browser": "dist/index.js", - "scripts": { - "build": "klap build", - "start": "klap start", - "watch": "klap watch" - }, - "dependencies": { - "react": "*", - "react-dom": "*" - }, - "devDependencies": { - "klap": "2.1.0" - }, - "klap": { - "example": "public/index.js" - } + "name": "react-component", + "version": "0.0.0", + "private": true, + "license": "MIT", + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "source": "src/index.js", + "browser": "dist/index.js", + "files": [ + "dist" + ], + "scripts": { + "build": "klap build", + "start": "klap start", + "watch": "klap watch" + }, + "dependencies": { + "react": "*", + "react-dom": "*" + }, + "devDependencies": { + "klap": "*" + }, + "klap": { + "example": "public/index.js" + } } diff --git a/examples/react-sc-typescript/package.json b/examples/react-sc-typescript/package.json index 3d3c07a..1156067 100644 --- a/examples/react-sc-typescript/package.json +++ b/examples/react-sc-typescript/package.json @@ -1,30 +1,33 @@ { - "name": "react-sc-typescript", - "version": "0.0.0", - "files": [ - "dist" - ], - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "source": "src/index.tsx", - "browser": "dist/index.js", - "scripts": { - "build": "klap build", - "start": "klap start", - "watch": "klap watch" - }, - "dependencies": { - "react": "*", - "react-dom": "*", - "styled-components": "*" - }, - "devDependencies": { - "klap": "2.1.0" - }, - "klap": { - "globals": { - "styled-components": "styledComponents" - }, - "example": "public/index.tsx" - } + "name": "react-sc-typescript", + "version": "0.0.0", + "license": "MIT", + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "source": "src/index.tsx", + "browser": "dist/index.js", + "files": [ + "dist" + ], + "scripts": { + "build": "klap build", + "start": "klap start", + "watch": "klap watch" + }, + "dependencies": { + "react": "*", + "react-dom": "*", + "react-is": "*", + "styled-components": "*", + "typescript": "*" + }, + "devDependencies": { + "klap": "*" + }, + "klap": { + "globals": { + "styled-components": "styledComponents" + }, + "example": "public/index.tsx" + } } diff --git a/examples/react-typescript/package-lock.json b/examples/react-typescript/package-lock.json deleted file mode 100644 index 5454fa7..0000000 --- a/examples/react-typescript/package-lock.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "react-typescript", - "version": "0.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "klap": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/klap/-/klap-0.3.0.tgz", - "integrity": "sha512-JgTlV2psnLTOobuP7mQi0PZUGN+cViQbK3NkN8t0WURyaASN7zgGITExkm0fIi+AZ9Y/kYn1iKGa/BAwpFoLfw==", - "dev": true - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } - }, - "react": { - "version": "16.11.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.11.0.tgz", - "integrity": "sha512-M5Y8yITaLmU0ynd0r1Yvfq98Rmll6q8AxaEe88c8e7LxO8fZ2cNgmFt0aGAS9wzf1Ao32NKXtCl+/tVVtkxq6g==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2" - } - }, - "react-dom": { - "version": "16.11.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.11.0.tgz", - "integrity": "sha512-nrRyIUE1e7j8PaXSPtyRKtz+2y9ubW/ghNgqKFHHAHaeP0fpF5uXR+sq8IMRHC+ZUxw7W9NyCDTBtwWxvkb0iA==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.17.0" - } - }, - "react-is": { - "version": "16.11.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.11.0.tgz", - "integrity": "sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==" - }, - "scheduler": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.17.0.tgz", - "integrity": "sha512-7rro8Io3tnCPuY4la/NuI5F2yfESpnfZyT6TtkXnSWVkcu0BCDJ+8gk5ozUaFaxpIyNuWAPXrH0yFcSi28fnDA==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - } - } -} diff --git a/examples/react-typescript/package.json b/examples/react-typescript/package.json index 315ef2a..ac2395f 100644 --- a/examples/react-typescript/package.json +++ b/examples/react-typescript/package.json @@ -1,27 +1,29 @@ { - "name": "react-typescript", - "version": "0.0.0", - "private": true, - "files": [ - "dist" - ], - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "source": "src/index.tsx", - "browser": "dist/index.js", - "scripts": { - "build": "klap build", - "start": "klap start", - "watch": "klap watch" - }, - "dependencies": { - "react": "*", - "react-dom": "*" - }, - "devDependencies": { - "klap": "2.1.0" - }, - "klap": { - "example": "public/index.tsx" - } + "name": "react-typescript", + "version": "0.0.0", + "private": true, + "license": "MIT", + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "source": "src/index.tsx", + "browser": "dist/index.js", + "files": [ + "dist" + ], + "scripts": { + "build": "klap build", + "start": "klap start", + "watch": "klap watch" + }, + "dependencies": { + "react": "*", + "react-dom": "*", + "typescript": "*" + }, + "devDependencies": { + "klap": "*" + }, + "klap": { + "example": "public/index.tsx" + } } diff --git a/examples/scaffold-typescript/dist/index.d.ts b/examples/scaffold-typescript/dist/index.d.ts new file mode 100644 index 0000000..6146575 --- /dev/null +++ b/examples/scaffold-typescript/dist/index.d.ts @@ -0,0 +1,3 @@ +declare const sum: (a: number, b: number) => number; + +export { sum }; diff --git a/examples/scaffold-typescript/package.json b/examples/scaffold-typescript/package.json index cdca43d..d284dcc 100644 --- a/examples/scaffold-typescript/package.json +++ b/examples/scaffold-typescript/package.json @@ -1,23 +1,28 @@ { - "name": "scaffold-typescript", - "version": "0.0.0", - "private": true, - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "source": "src/index.ts", - "browser": "dist/index.js", - "files": [ - "dist" - ], - "scripts": { - "build": "klap build", - "start": "klap start", - "watch": "klap watch" - }, - "devDependencies": { - "klap": "2.1.0" - }, - "klap": { - "example": "public/index.js" - } + "name": "scaffold-typescript", + "version": "0.0.0", + "private": true, + "license": "MIT", + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "source": "src/index.ts", + "browser": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "klap build", + "start": "klap start", + "watch": "klap watch" + }, + "dependencies": { + "typescript": "*" + }, + "devDependencies": { + "klap": "*" + }, + "klap": { + "example": "public/index.js" + } } diff --git a/examples/scaffold/package.json b/examples/scaffold/package.json index 319c49b..14c102d 100644 --- a/examples/scaffold/package.json +++ b/examples/scaffold/package.json @@ -1,23 +1,24 @@ { - "name": "scaffold", - "version": "0.0.0", - "private": true, - "files": [ - "dist" - ], - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "source": "src/index.js", - "browser": "dist/index.js", - "scripts": { - "build": "klap build", - "start": "klap start", - "watch": "klap watch" - }, - "devDependencies": { - "klap": "2.1.0" - }, - "klap": { - "example": "public/index.js" - } + "name": "scaffold", + "version": "0.0.0", + "private": true, + "license": "MIT", + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "source": "src/index.js", + "browser": "dist/index.js", + "files": [ + "dist" + ], + "scripts": { + "build": "klap build", + "start": "klap start", + "watch": "klap watch" + }, + "devDependencies": { + "klap": "*" + }, + "klap": { + "example": "public/index.js" + } } diff --git a/examples/typedefs/package.json b/examples/typedefs/package.json index 620db3b..90161ca 100644 --- a/examples/typedefs/package.json +++ b/examples/typedefs/package.json @@ -2,7 +2,14 @@ "name": "typedefs", "version": "0.0.0", "private": true, + "license": "MIT", "module": "dist/index.esm.js", "source": "src/index.ts", - "types": "dist/index.d.ts" + "types": "dist/index.d.ts", + "dependencies": { + "typescript": "*" + }, + "devDependencies": { + "klap": "*" + } } diff --git a/test.sh b/test.sh index da95811..a86c6ea 100755 --- a/test.sh +++ b/test.sh @@ -1,11 +1,10 @@ #!/usr/bin/env bash - +# set -x git clean -fdX npm link cd examples for dir in $(ls) do - cd ${dir} && klap build && rm -rf dist/*.map && cd .. + cd ${dir} && yarn install --prod --silent && klap build && rm -rf dist/*.map && cd .. done yarn prettier --write "examples/**/dist/*.js" -