Skip to content

Commit 814be22

Browse files
committed
repo init and first lib draft
1 parent f9a2e1a commit 814be22

27 files changed

+390
-229
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
node_modules
3-
/dist
3+
/package/dist
4+
45

56
/tests/e2e/videos/
67
/tests/e2e/screenshots/

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"useTabs": false,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"semi": false
6+
}

babel.config.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
module.exports = {
2-
presets: ["@vue/app"]
3-
};
2+
presets: [
3+
[
4+
'@vue/app',
5+
{
6+
useBuiltIns: false,
7+
ployfills: false,
8+
},
9+
],
10+
],
11+
}

demo/App.vue

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<div id="app">
3+
<img width="25%" src="./assets/logo.png" /> <br />
4+
<button @click="showPortal = !showPortal">Toggle Render</button>
5+
<button @click="disablePortal = !disablePortal">Toggle disabled</button>
6+
<portal v-if="showPortal" :disabled="disablePortal">
7+
<p>Test</p>
8+
<Test />
9+
</portal>
10+
<hr />
11+
</div>
12+
</template>
13+
14+
<script>
15+
import Test from './components/TestComponent'
16+
export default {
17+
name: 'App',
18+
components: {
19+
Test,
20+
},
21+
data: () => ({
22+
showPortal: true,
23+
disablePortal: false,
24+
}),
25+
}
26+
</script>
27+
28+
<style>
29+
#app {
30+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
31+
-webkit-font-smoothing: antialiased;
32+
-moz-osx-font-smoothing: grayscale;
33+
text-align: center;
34+
color: #2c3e50;
35+
margin-top: 60px;
36+
}
37+
</style>

demo/components/TestComponent.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<div>
3+
<h3>This is just a Test Component</h3>
4+
<p>
5+
Its purpose is to check the behaviour of components inside of the Simple
6+
Portal
7+
</p>
8+
</div>
9+
</template>
10+
11+
<script>
12+
export default {
13+
name: 'TestComponent',
14+
/*mounted() {
15+
console.log('TC:mounted')
16+
},
17+
updated() {
18+
console.log('TC:updated')
19+
},
20+
beforeDestroy() {
21+
console.log('TC:beforeDestroy')
22+
},*/
23+
}
24+
</script>

demo/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Vue from 'vue'
2+
import App from './App.vue'
3+
4+
Vue.config.productionTip = false
5+
6+
new Vue({
7+
render: h => h(App),
8+
}).$mount('#app')

jest.config.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
module.exports = {
2-
moduleFileExtensions: ["js", "jsx", "json", "vue"],
2+
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
33
transform: {
4-
"^.+\\.vue$": "vue-jest",
5-
".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$":
6-
"jest-transform-stub",
7-
"^.+\\.jsx?$": "babel-jest"
4+
'^.+\\.vue$': 'vue-jest',
5+
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
6+
'jest-transform-stub',
7+
'^.+\\.jsx?$': 'babel-jest',
88
},
99
moduleNameMapper: {
10-
"^@/(.*)$": "<rootDir>/src/$1"
10+
'^@/(.*)$': '<rootDir>/src/$1',
1111
},
12-
snapshotSerializers: ["jest-serializer-vue"],
12+
snapshotSerializers: ['jest-serializer-vue'],
1313
testMatch: [
14-
"**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
14+
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)',
1515
],
16-
testURL: "http://localhost/"
17-
};
16+
testURL: 'http://localhost/',
17+
}

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"serve": "vue-cli-service serve",
7-
"build": "vue-cli-service build",
8-
"lint": "vue-cli-service lint",
6+
"serve": "vue-cli-service serve demo/main.js",
7+
"build:demo": "vue-cli-service build demo/main.js",
8+
"build": "vue-cli-service build --target lib --name VueSimplePortal --dest package/dist src/index.js",
9+
"lint": "vue-cli-service lint src/**/*.js demo/**/*.js tests/**/*.js ./*.js",
910
"test:e2e": "vue-cli-service test:e2e",
1011
"test:unit": "vue-cli-service test:unit"
1112
},
12-
"dependencies": {
13-
"vue": "^2.6.6"
14-
},
1513
"devDependencies": {
1614
"@vue/cli-plugin-babel": "^3.4.0",
1715
"@vue/cli-plugin-e2e-cypress": "^3.4.0",
@@ -26,6 +24,7 @@
2624
"eslint": "^5.8.0",
2725
"eslint-plugin-vue": "^5.0.0",
2826
"lint-staged": "^8.1.0",
27+
"prettier-eslint": "^8.8.2",
2928
"vue-template-compiler": "^2.5.21"
3029
},
3130
"gitHooks": {

package/package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "vue-simple-portal",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint",
9+
"test:e2e": "vue-cli-service test:e2e",
10+
"test:unit": "vue-cli-service test:unit"
11+
},
12+
"main": "./dist/VuePortal.umd.js",
13+
"browser": "./dist/VuePortal.common.js",
14+
"unpkg": "./dist/VuePortal.umd.min.js",
15+
"jsDelivr": "./dist/VuePortal.umd.min.js",
16+
"files": [
17+
"dist",
18+
"src",
19+
"types"
20+
],
21+
"dependencies": {
22+
"nanoid": "^2.0.1"
23+
},
24+
"peerDependencies": {
25+
"vue": "^2.6.6"
26+
},
27+
"gitHooks": {
28+
"pre-commit": "lint-staged"
29+
},
30+
"lint-staged": {
31+
"*.js": [
32+
"vue-cli-service lint",
33+
"git add"
34+
],
35+
"*.vue": [
36+
"vue-cli-service lint",
37+
"git add"
38+
]
39+
}
40+
}

0 commit comments

Comments
 (0)