Skip to content

Commit 81ca0a7

Browse files
authored
Package Name Change & Publish Script (#1)
Package Name Change & Publish Script
2 parents 4a7e58f + 14c9814 commit 81ca0a7

File tree

11 files changed

+80
-41
lines changed

11 files changed

+80
-41
lines changed

.github/workflows/nodejs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ jobs:
2424
yarn test:unit
2525
env:
2626
CI: true
27-
REACT_APP_PUBLIC_KEY: ${{ secrets.ik_public_key }}
28-
REACT_APP_PRIVATE_KEY: ${{ secrets.ik_private_key }}
29-
REACT_APP_URL_ENDPOINT: ${{ secrets.ik_url_endopint }}
27+
VUE_APP_PUBLIC_KEY: ${{ secrets.ik_public_key }}
28+
VUE_APP_PRIVATE_KEY: ${{ secrets.ik_private_key }}
29+
VUE_APP_URL_ENDPOINT: ${{ secrets.ik_url_endopint }}

.github/workflows/npmpublish.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ jobs:
2525
npm i -g yarn
2626
yarn install
2727
yarn test
28+
yarn build
2829
env:
2930
CI: true
30-
31-
publish:
31+
VUE_APP_PUBLIC_KEY: ${{ secrets.ik_public_key }}
32+
VUE_APP_PRIVATE_KEY: ${{ secrets.ik_private_key }}
33+
VUE_APP_URL_ENDPOINT: ${{ secrets.ik_url_endopint }}
34+
35+
publish:
3236
needs: build
3337
runs-on: ubuntu-latest
3438
steps:
@@ -41,7 +45,7 @@ jobs:
4145
run: |
4246
npm i -g yarn
4347
yarn config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
44-
yarn publish
48+
yarn publish
4549
env:
4650
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
4751
CI: true

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ImageKit.io Vue SDK
22

3-
[![Node CI](https://github.com/imagekit-developer/imagekit-nodejs/workflows/Node%20CI/badge.svg)](https://github.com/imagekit-developer/imagekit-vuejs/)
4-
[![npm version](https://img.shields.io/npm/v/imagekit-vue)](https://www.npmjs.com/package/imagekit-vuejs)
3+
[![Node CI](https://github.com/imagekit-developer/imagekit-nodejs/workflows/Node%20CI/badge.svg)](https://github.com/imagekit-developer/imagekitio-vuejs/)
4+
[![npm version](https://img.shields.io/npm/v/imagekitio-vue)](https://www.npmjs.com/package/imagekitio-vuejs)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
66
[![Twitter Follow](https://img.shields.io/twitter/follow/imagekitio?label=Follow&style=social)](https://twitter.com/ImagekitIo)
77

@@ -11,11 +11,11 @@ ImageKit is a complete image optimization and transformation solution that comes
1111

1212
## Installation
1313

14-
`npm install --save imagekit-vue`
14+
`npm install --save imagekitio-vue`
1515

1616
Include the components in your code:
1717

18-
`import {IKContext} from "imagekit-vue"`
18+
`import {IKContext} from "imagekitio-vue"`
1919

2020
## Usage
2121

example/sample-app/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Now link it with, npm link
2828
```js
2929
npm link
3030
```
31-
This will create a global repository link for imagekit-vue
31+
This will create a global repository link for imagekitio-vue
3232

3333
### Installing the sample-app
3434

@@ -44,9 +44,9 @@ npm install
4444

4545
Now run,
4646
```
47-
npm link imagekit-vue
47+
npm link imagekitio-vue
4848
```
49-
This should create a copy of `imagekit-vue` library in `node_modules` of `sample-app`
49+
This should create a copy of `imagekitio-vue` library in `node_modules` of `sample-app`
5050

5151
## Setting the environment variable
5252
Create a .env file by renaming the sample.env in examples/sample-app

example/sample-app/src/App.vue

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@
55
<IKImage
66
:publicKey="publicKey"
77
:urlEndpoint="urlEndpoint"
8-
src="https://ik.imagekit.io/gqyojxcwzxj/ABC_BV8lzpfOS"
8+
:src="src"
99
/>
1010
<p>Let's transform this once</p>
1111
<IKImage
1212
:publicKey="publicKey"
1313
:urlEndpoint="urlEndpoint"
14-
src="https://ik.imagekit.io/gqyojxcwzxj/ABC_BV8lzpfOS"
14+
:src="src"
1515
v-bind:transformation="[{height:300,width:400}]"
1616
/>
1717
<p>Let's transform this more than once</p>
1818
<IKImage
1919
:publicKey="publicKey"
2020
:urlEndpoint="urlEndpoint"
21-
path="/ABC_BV8lzpfOS"
21+
:path="path"
2222
v-bind:transformation="[{height:300,width:400},{rotation:90}]"
2323
/>
2424

2525
<p>LQIP</p>
2626
<IKImage
2727
:publicKey="publicKey"
2828
:urlEndpoint="urlEndpoint"
29-
src="https://ik.imagekit.io/gqyojxcwzxj/ABC_BV8lzpfOS"
29+
:src="src"
3030
v-bind:lqip="{active:true,quality:20}"
3131
/>
3232

3333
<p>Adding a Image with Context</p>
3434
<IKContext :publicKey="publicKey" :urlEndpoint="urlEndpoint">
35-
<IKImage path="/ABC_BV8lzpfOS" v-bind:transformation="[{height:300,width:400}]" />
35+
<IKImage :path="path" v-bind:transformation="[{height:300,width:400}]" />
3636
</IKContext>
3737
<p>Upload</p>
3838
<IKContext
@@ -47,7 +47,15 @@
4747
</template>
4848

4949
<script>
50-
import { IKImage, IKContext, IKUpload } from "imagekit-vue";
50+
import { IKImage, IKContext, IKUpload } from "imagekitio-vue";
51+
52+
let urlEndpoint= process.env.VUE_APP_URL_ENDPOINT;
53+
if(urlEndpoint[urlEndpoint.length-1] === "/")
54+
urlEndpoint = urlEndpoint.slice(0,urlEndpoint.length-1);
55+
56+
let path = "/default-image.jpg";
57+
if(path[0] === "/")
58+
path = path.split("/")[1];
5159
5260
export default {
5361
name: "app",
@@ -58,9 +66,11 @@ export default {
5866
},
5967
data() {
6068
return {
61-
urlEndpoint: process.env.VUE_APP_URL_ENDPOINT,
69+
urlEndpoint: urlEndpoint,
6270
publicKey: process.env.VUE_APP_PUBLIC_KEY,
63-
authenticationEndpoint: process.env.VUE_APP_AUTHENTICATION_ENDPOINT
71+
authenticationEndpoint: process.env.VUE_APP_AUTHENTICATION_ENDPOINT,
72+
path: path,
73+
src: `${urlEndpoint}/${path}`
6474
};
6575
}
6676
};

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
{
2-
"name": "imagekit-vue",
2+
"name": "imagekitio-vue",
33
"version": "0.1.0",
4-
"private": true,
54
"scripts": {
65
"build:lib": "vue-cli-service build --target lib src/index.js",
76
"build": "vue-cli-service lint --fix; npm run build:lib",
87
"serve": "vue-cli-service serve",
98
"lint": "vue-cli-service lint",
10-
"test:unit": "rm -f tests/__snapshots__/storyshots.test.js.snap && vue-cli-service test:unit",
9+
"test:unit": "vue-cli-service test:unit -u",
1110
"storybook": "start-storybook -p 6006",
1211
"build-storybook": "build-storybook"
1312
},
14-
"main": "dist/imagekit-vue.common.js",
13+
"main": "dist/imagekitio-vue.common.js",
1514
"browser": "src/index.js",
16-
"unpkg": "dist/imagekit-vue.umd.min.js",
15+
"unpkg": "dist/imagekitio-vue.umd.min.js",
1716
"dependencies": {
1817
"babel-plugin-require-context-hook": "^1.0.0",
1918
"core-js": "^3.4.3",

src/components/IKUpload.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ export default {
99
inject: {configurations: {default:""}},
1010
props: {
1111
fileName: { type: String, default: "", required: false },
12-
useUniqueFileName: {type: Boolean, default:"true", required:false},
12+
useUniqueFileName: {type: Boolean, default:true, required:false},
1313
tags:{type:Array,required:false},
1414
folder:{ type: String, default: "/", required: false },
15-
isPrivateFile: {type: Boolean, default:"false", required:false},
15+
isPrivateFile: {type: Boolean, default:false, required:false},
1616
customCoordinates: { type: String, default: "", required: false },
1717
responseFields: { type: Array, required: false }
1818
},

tests/stories/0-ImageKitContext.stories.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ export default {
44
title: 'IKContext',
55
};
66

7-
8-
const urlEndpoint = process.env.VUE_APP_URL_ENDPOINT;
97
const publicKey = process.env.VUE_APP_PUBLIC_KEY;
108

9+
let urlEndpoint = process.env.VUE_APP_URL_ENDPOINT;
10+
if(urlEndpoint[urlEndpoint.length-1] === "/")
11+
urlEndpoint = urlEndpoint.slice(0,urlEndpoint.length-1);
12+
13+
let path = "/default-image.jpg";
14+
if(path[0] === "/")
15+
path = path.split("/")[1];
16+
17+
const src = `${urlEndpoint}/${path}`;
18+
1119
export const imageWithContext = () => ({
1220
components: { IKImage, IKContext },
13-
template: `<IKContext publicKey="${publicKey}" urlEndpoint=${urlEndpoint}><IKImage src="https://ik.imagekit.io/gqyojxcwzxj/ABC_BV8lzpfOS"/></IKContext>`,
21+
template: `<IKContext publicKey="${publicKey}" urlEndpoint=${urlEndpoint}><IKImage src="${src}"/></IKContext>`,
1422
});
1523

1624

tests/stories/1-ImageKitImage.stories.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,39 @@ export default {
44
title: 'IKImage',
55
};
66

7-
const urlEndpoint = process.env.VUE_APP_URL_ENDPOINT;
87
const publicKey = process.env.VUE_APP_PUBLIC_KEY;
98

9+
let urlEndpoint = process.env.VUE_APP_URL_ENDPOINT;
10+
if(urlEndpoint[urlEndpoint.length-1] === "/")
11+
urlEndpoint = urlEndpoint.slice(0,urlEndpoint.length-1);
12+
13+
let path = "/default-image.jpg";
14+
if(path[0] === "/")
15+
path = path.split("/")[1];
16+
17+
const src = `${urlEndpoint}${path}`;
18+
1019
export const imageWithSrc = () => ({
1120
components: { IKImage },
12-
template: `<IKImage publicKey="${publicKey}" urlEndpoint=${urlEndpoint} src="https://ik.imagekit.io/gqyojxcwzxj/ABC_BV8lzpfOS"/>`,
21+
template: `<IKImage publicKey="${publicKey}" urlEndpoint=${urlEndpoint} src=${src}/>`,
1322
});
1423

1524
export const imageWithPath = () => ({
1625
components: { IKImage },
17-
template: `<IKImage publicKey="${publicKey}" urlEndpoint=${urlEndpoint} path="/ABC_BV8lzpfOS"/>`,
26+
template: `<IKImage publicKey="${publicKey}" urlEndpoint=${urlEndpoint} path=${path}/>`,
1827
});
1928

2029
export const imageWithLQIP = () => ({
2130
components: { IKImage },
22-
template: `<IKImage publicKey="${publicKey}" urlEndpoint=${urlEndpoint} src="https://ik.imagekit.io/gqyojxcwzxj/ABC_BV8lzpfOS" v-bind:lqip="{active:true,threshold:20}"/>`,
31+
template: `<IKImage publicKey="${publicKey}" urlEndpoint=${urlEndpoint} src=${src} v-bind:lqip="{active:true,threshold:20}"/>`,
2332
});
2433

2534
export const imageWithNoPublicKey = () => ({
2635
components: { IKImage },
27-
template: `<IKImage publicKey="" urlEndpoint=${urlEndpoint} src="https://ik.imagekit.io/gqyojxcwzxj/ABC_BV8lzpfOS"/>`,
36+
template: `<IKImage publicKey="" urlEndpoint=${urlEndpoint} src=${src}/>`,
2837
});
2938

3039
export const imageWithNoUrlEndpoint = () => ({
3140
components: { IKImage },
32-
template: `<IKImage publicKey="${publicKey}" urlEndpoint="" src="https://ik.imagekit.io/gqyojxcwzxj/ABC_BV8lzpfOS"/>`,
41+
template: `<IKImage publicKey="${publicKey}" urlEndpoint="" src=${src}/>`,
3342
});

0 commit comments

Comments
 (0)