- Notifications
You must be signed in to change notification settings - Fork 16
feat: Add vue3 sdk base with a build script #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits Select commit Hold shift + click to select a range
af36d0f feat: Add vue3 sdk base with a build script
nirmaoz 2a73716 chore: Use rollup for build
nirmaoz 52d89b7 chore: Remove unneeded comment
nirmaoz 3191b18 feat: Add coverage report
nirmaoz e0d43ea chore: Update test script
nirmaoz 16b6bff feat: Add public folder with sample app
nirmaoz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| !public | ||
| .DS_Store | ||
| node_modules | ||
| /dist | ||
| | ||
| | ||
| # local env files | ||
| .env.local | ||
| .env.*.local | ||
| | ||
| # Log files | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| | ||
| # Editor directories and files | ||
| .idea | ||
| .vscode | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # vue3 | ||
| | ||
| ## Project setup | ||
| ``` | ||
| npm install | ||
| ``` | ||
| | ||
| ### Compiles and hot-reloads for development | ||
| ``` | ||
| npm run serve | ||
| ``` | ||
| | ||
| ### Compiles and minifies for production | ||
| ``` | ||
| npm run build | ||
| ``` | ||
| | ||
| ### Run your unit tests | ||
| ``` | ||
| npm run test:unit | ||
| ``` | ||
| | ||
| ### Lints and fixes files | ||
| ``` | ||
| npm run lint | ||
| ``` | ||
| | ||
| ### Customize configuration | ||
| See [Configuration Reference](https://cli.vuejs.org/config/). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = { | ||
| presets: ["@vue/cli-plugin-babel/preset"], | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| { | ||
| "name": "@cloudinary/vue3", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "scripts": { | ||
| "build": "rm -rf dist && rollup -c && replace-in-files --string='.vue' --replacement='' dist/index.d.ts && npm run copy:dts", | ||
| "copy:dts": "cp dist/index.d.ts dist/index.esm.d.ts && cp dist/index.d.ts dist/index.ssr.d.ts", | ||
| "prepublishOnly": "npm run build", | ||
| "serve": "vue-cli-service serve", | ||
| "build:app": "vue-cli-service build", | ||
| "test": "npm run test:dist && npm run test:src", | ||
| "test:src": "vue-cli-service test:unit --coverage", | ||
| "pretest:src": "replace-in-files --string='dist/index.esm' --replacement='src/index' tests/unit/*.spec.ts", | ||
| "test:dist": "npm run build && vue-cli-service test:unit", | ||
| "pretest:dist": "replace-in-files --string='src/index' --replacement='dist/index.esm' tests/unit/*.spec.ts", | ||
| "serve:coverage": "http-server coverage/lcov-report", | ||
| "lint": "vue-cli-service lint" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/jest": "^27.0.1", | ||
| "@typescript-eslint/eslint-plugin": "^5.4.0", | ||
| "@typescript-eslint/parser": "^5.4.0", | ||
| "@vue/cli-plugin-babel": "~5.0.0", | ||
| "@vue/cli-plugin-eslint": "~5.0.0", | ||
| "@vue/cli-plugin-typescript": "~5.0.0", | ||
| "@vue/cli-plugin-unit-jest": "~5.0.0", | ||
| "@vue/cli-service": "~5.0.0", | ||
| "@vue/eslint-config-typescript": "^9.1.0", | ||
| "@vue/test-utils": "^2.0.0-0", | ||
| "@vue/vue3-jest": "^27.0.0-alpha.1", | ||
| "babel-jest": "^27.0.6", | ||
| "eslint": "^7.32.0", | ||
| "eslint-config-prettier": "^8.3.0", | ||
| "eslint-plugin-prettier": "^4.0.0", | ||
| "eslint-plugin-vue": "^8.0.3", | ||
| "http-server": "^14.1.1", | ||
| "jest": "^27.0.5", | ||
| "prettier": "^2.4.1", | ||
| "replace-in-files-cli": "^2.0.0", | ||
| "rollup": "^2.76.0", | ||
| "rollup-plugin-clear": "^2.0.7", | ||
| "rollup-plugin-typescript2": "^0.32.1", | ||
| "rollup-plugin-vue": "^6.0.0", | ||
| "ts-jest": "^27.0.4", | ||
| "typescript": "^4.7.4", | ||
| "vue": "^3.2.37", | ||
| "vue-tsc": "^0.38.5" | ||
| }, | ||
| "eslintConfig": { | ||
| "root": true, | ||
| "env": { | ||
| "node": true | ||
| }, | ||
| "extends": [ | ||
| "plugin:vue/vue3-essential", | ||
| "eslint:recommended", | ||
| "@vue/typescript/recommended", | ||
| "plugin:prettier/recommended" | ||
| ], | ||
| "parserOptions": { | ||
| "ecmaVersion": 2020 | ||
| }, | ||
| "rules": {}, | ||
| "overrides": [ | ||
| { | ||
| "files": [ | ||
| "**/__tests__/*.{j,t}s?(x)", | ||
| "**/tests/unit/**/*.spec.{j,t}s?(x)" | ||
| ], | ||
| "env": { | ||
| "jest": true | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| "browserslist": [ | ||
| "> 1%", | ||
| "last 2 versions", | ||
| "not dead", | ||
| "not ie 11" | ||
| ], | ||
| "jest": { | ||
| "preset": "@vue/cli-plugin-unit-jest/presets/typescript-and-babel" | ||
| } | ||
| } | ||
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <!DOCTYPE html> | ||
| <html lang=""> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
| <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||
| <title><%= htmlWebpackPlugin.options.title %></title> | ||
| </head> | ||
| <body> | ||
| <noscript> | ||
| <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> | ||
| </noscript> | ||
| <div id="app"></div> | ||
| <!-- built files will be auto injected --> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import typescript from "rollup-plugin-typescript2"; | ||
| import vue from "rollup-plugin-vue"; | ||
| | ||
| export default [ | ||
| // ESM build to be used with webpack/rollup. | ||
| { | ||
| input: "src/index.ts", | ||
| output: { | ||
| format: "esm", | ||
| file: "dist/index.esm.js", | ||
| }, | ||
| plugins: [ | ||
| vue({ target: "browser" }), | ||
| typescript({ | ||
| tsconfigOverride: { | ||
| compilerOptions: { | ||
| declaration: true, | ||
| }, | ||
| include: null, | ||
| }, | ||
| }), | ||
| ], | ||
| }, | ||
| // SSR build. | ||
| { | ||
| input: "src/index.ts", | ||
| output: { | ||
| format: "cjs", | ||
| file: "dist/index.ssr.js", | ||
| }, | ||
| plugins: [ | ||
| vue({ target: "node" }), // use 'node' to compile for SSR | ||
| typescript({ | ||
| tsconfigOverride: { | ||
| compilerOptions: { | ||
| declaration: true, | ||
| }, | ||
| include: null, | ||
| }, | ||
| }), | ||
| ], | ||
| }, | ||
| // Browser build. | ||
| { | ||
| input: "src/index.ts", | ||
| output: { | ||
| format: "iife", | ||
| file: "dist/index.js", | ||
| }, | ||
| plugins: [ | ||
| vue({ target: "browser" }), | ||
| typescript({ | ||
| tsconfigOverride: { | ||
| compilerOptions: { | ||
| declaration: true, | ||
| }, | ||
| include: null, | ||
| }, | ||
| }), | ||
| ], | ||
| }, | ||
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <template> | ||
| <div> | ||
| <AdvancedImage | ||
| url="https://res.cloudinary.com/demo/image/upload/sample.jpg" | ||
| /> | ||
| </div> | ||
| <div> | ||
| <AdvancedVideo url="https://res.cloudinary.com/demo/video/upload/dog.mp4" /> | ||
| </div> | ||
| </template> | ||
| | ||
| <script lang="ts"> | ||
| import { defineComponent } from "vue"; | ||
| import AdvancedImage from "@/components/AdvancedImage.vue"; | ||
| import AdvancedVideo from "@/components/AdvancedVideo.vue"; | ||
| | ||
| export default defineComponent({ | ||
| name: "App", | ||
| components: { | ||
| AdvancedImage, | ||
| AdvancedVideo, | ||
| }, | ||
| }); | ||
| </script> | ||
| | ||
| <style> | ||
| #app { | ||
| font-family: Avenir, Helvetica, Arial, sans-serif; | ||
| -webkit-font-smoothing: antialiased; | ||
| -moz-osx-font-smoothing: grayscale; | ||
| text-align: center; | ||
| color: #2c3e50; | ||
| margin-top: 60px; | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <template> | ||
| <img :src="url" /> | ||
| </template> | ||
| | ||
| <script lang="ts"> | ||
| import { defineComponent } from "vue"; | ||
| | ||
| export default defineComponent({ | ||
| name: "AdvancedImage", | ||
| props: { | ||
| url: String, | ||
strausr marked this conversation as resolved. Show resolved Hide resolved | ||
| }, | ||
| }); | ||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <template> | ||
| <video :src="url" /> | ||
| </template> | ||
| | ||
| <script lang="ts"> | ||
| import { defineComponent } from "vue"; | ||
| | ||
| export default defineComponent({ | ||
| name: "AdvancedVideo", | ||
| props: { | ||
| url: String, | ||
| }, | ||
| }); | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import AdvancedImage from "./components/AdvancedImage.vue"; | ||
| import AdvancedVideo from "./components/AdvancedVideo.vue"; | ||
| | ||
| export { AdvancedImage, AdvancedVideo }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { createApp } from "vue"; | ||
| import App from "./App.vue"; | ||
| | ||
| createApp(App).mount("#app"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| /* eslint-disable */ | ||
| declare module '*.vue' { | ||
| import type { DefineComponent } from 'vue' | ||
| const component: DefineComponent<{}, {}, any> | ||
| export default component | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "compilerOptions": { | ||
strausr marked this conversation as resolved. Show resolved Hide resolved | ||
| /* Set the JavaScript language version for emitted JavaScript and include | ||
| compatible library declarations. */ | ||
| "target": "esnext", | ||
| /* Specify what JSX code is generated. */ | ||
| "jsx": "preserve", | ||
| /* Specify what module code is generated. */ | ||
| "module": "esnext", | ||
| /* Specify how TypeScript looks up a file from a given module specifier. */ | ||
| "moduleResolution": "node", | ||
| /* Specify the base directory to resolve non-relative module names. */ | ||
| "baseUrl": "./src", | ||
| /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ | ||
| "declaration": true, | ||
| /* Create sourcemaps for d.ts files. */ | ||
| "declarationMap": false, | ||
| /* Create source map files for emitted JavaScript files. */ | ||
| "sourceMap": true, | ||
| /* Specify an output folder for all emitted files. */ | ||
| "outDir": "dist", | ||
| /* Emit additional JavaScript to ease support for importing CommonJS modules. | ||
| This enables `allowSyntheticDefaultImports` for type compatibility. */ | ||
| "esModuleInterop": true, | ||
| /* Ensure that casing is correct in imports. */ | ||
| "forceConsistentCasingInFileNames": true, | ||
| /* Enable all strict type-checking options. */ | ||
| "strict": true, | ||
| /* Skip type checking all .d.ts files. */ | ||
| "skipLibCheck": true | ||
| }, | ||
| "types": [ | ||
| "jest" | ||
| ], | ||
| "include": ["../src/**/*.ts", "../src/**/*.vue", "**/*.ts"] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { shallowMount } from "@vue/test-utils"; | ||
| import { AdvancedImage } from "../../src/index"; | ||
| | ||
| describe("AdvancedImage.vue", () => { | ||
| it("renders props.url when passed", () => { | ||
| const url = "https://res.cloudinary.com/demo/image/upload/sample.jpg"; | ||
| const wrapper = shallowMount(AdvancedImage, { | ||
| props: { url }, | ||
| }); | ||
| expect(wrapper.html()).toMatch(url); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { shallowMount } from "@vue/test-utils"; | ||
| import { AdvancedVideo } from "../../src/index"; | ||
| | ||
| describe("AdvancedVideo.vue", () => { | ||
| it("renders props.url when passed", () => { | ||
| const url = "https://res.cloudinary.com/demo/video/upload/dog.mp4"; | ||
| const wrapper = shallowMount(AdvancedVideo, { | ||
| props: { url }, | ||
| }); | ||
| expect(wrapper.html()).toMatch(url); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you leave private on purpose?