Skip to content
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

Typescript all the things #8235

Merged
merged 9 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public-hoist-pattern[]=owncloud-sdk
public-hoist-pattern[]=lodash-es
public-hoist-pattern[]=mark.js
public-hoist-pattern[]=fuse.js
public-hoist-pattern[]=filesize

# @vue/component-compiler-utils
hoist-pattern[]=sass
Expand Down
1 change: 1 addition & 0 deletions Makefile.release
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ build: build-web copy-config
.PHONY: build-web
build-web:
$(PNPM) install
$(PNPM) check-types
$(PNPM) build

.PHONY: copy-config
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "AGPL-3.0",
"author": "ownCloud GmbH <[email protected]>",
"scripts": {
"check-types": "tsc --noEmit",
"build": "vue-demi-fix && pnpm build:tokens && pnpm vite build",
"build:w": "pnpm build --watch",
"build:tokens": "pnpm --filter @ownclouders/design-system tokens",
Expand Down Expand Up @@ -145,7 +146,8 @@
"@adobe/[email protected]": "patches/@[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]"
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]"
}
},
"jestSerializer": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@
</div>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import orderBy from '../../utils/orderBy'

export default {
export default defineComponent({
name: 'ComponentsList',
data() {
return {
Expand All @@ -90,7 +91,7 @@ export default {
return orderBy(data, 'name', 'asc')
}
}
}
})
</script>

<style lang="scss" scoped>
Expand Down
7 changes: 4 additions & 3 deletions packages/design-system/docs/components/tokens/AllTokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
</div>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import designTokens from '../../../src/assets/tokens/ods.json'

/**
Expand All @@ -42,14 +43,14 @@ import designTokens from '../../../src/assets/tokens/ods.json'
* To edit these tokens and add more, see
* [/src/tokens/](https://github.com/owncloud/owncloud-design-system/blob/master/src/tokens).
*/
export default {
export default defineComponent({
name: 'AllTokens',
data() {
return {
tokens: Object.values(designTokens)
}
}
}
})
</script>

<style lang="scss" scoped>
Expand Down
7 changes: 4 additions & 3 deletions packages/design-system/docs/components/tokens/ColorTokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
</div>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import designTokens from '../../../src/assets/tokens/ods.json'

/**
Expand All @@ -29,15 +30,15 @@ import designTokens from '../../../src/assets/tokens/ods.json'
* like destructive actions and error messages. To edit the colors, see
* [/src/tokens/color.yml](https://github.com/owncloud/owncloud-design-system/blob/master/src/tokens/color.yml).
*/
export default {
export default defineComponent({
name: 'ColorTokens',

computed: {
tokens() {
return Object.values(designTokens).filter((token) => token.name.startsWith('oc-color-'))
}
}
}
})
</script>

<style lang="scss" scoped>
Expand Down
9 changes: 5 additions & 4 deletions packages/design-system/docs/components/tokens/FontSize.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
</div>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import designTokens from '../../../src/assets/tokens/ods.json'

/**
Expand All @@ -21,15 +22,15 @@ import designTokens from '../../../src/assets/tokens/ods.json'
* sizes to a minimum. To edit font-sizes, see
* [/src/tokens/font-size.yml](https://github.com/owncloud/web/blob/master/packages/design-system/src/tokens/font-size.yml).
*/
export default {
export default defineComponent({
name: 'FontSize',

computed: {
tokens() {
return Object.values(designTokens).filter((token) => token.name.startsWith('oc-font-size-'))
}
}
}
})
</script>

<style lang="scss" scoped>
Expand Down Expand Up @@ -63,7 +64,7 @@ export default {
</style>

<docs>
```jsx
```
<FontSize/>
```
</docs>
8 changes: 5 additions & 3 deletions packages/design-system/docs/components/tokens/IconList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
</div>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'

import OcIcon from '../../../src/components/OcIcon/OcIcon.vue'
import OcTable from '../../../src/components/OcTable/OcTable.vue'
import OcSearchBar from '../../../src/components/OcSearchBar/OcSearchBar'
Expand All @@ -79,7 +81,7 @@ const req = require.context('../../../src/assets/icons/', true, /^\.\/.*\.svg$/)
* Icons made by <a href="https://remixicon.com/">Remixicon</a> and, in the case of the `resource-type-*` icons, <a href="https://fontawesome.com/">Font Awesome</a> (available under the [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license).
* </p>
*/
export default {
export default defineComponent({
name: 'IconList',
components: { HighlightedText, OcSearchBar, OcIcon, OcTable },
data() {
Expand Down Expand Up @@ -147,7 +149,7 @@ export default {
return filename.split('.').slice(0, -1).join('.').substring(2)
})
}
}
})
</script>

<docs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
</div>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'

import designTokens from '../../../src/assets/tokens/ods.json'

/**
Expand All @@ -22,14 +24,14 @@ import designTokens from '../../../src/assets/tokens/ods.json'
* To edit spacing, see
* [/src/tokens/spacing.yml](https://github.com/owncloud/web/blob/master/packages/design-system/src/tokens/spacing.yml).
*/
export default {
export default defineComponent({
name: 'SpacingTokens',
computed: {
tokens() {
return Object.values(designTokens).filter((token) => token.name.startsWith('oc-space'))
}
}
}
})
</script>

<style lang="scss" scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</component>
</template>

<script>
export default {
<script lang="ts">
export default defineComponent({
name: 'HighlightedText',
props: {
tag: {
Expand Down Expand Up @@ -83,7 +83,7 @@ export default {
]
}
}
}
})
</script>

<style lang="scss">
Expand Down
4 changes: 2 additions & 2 deletions packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"deepmerge": "^4.2.2",
"depcheck": "^1.3.1",
"file-loader": "^6.2.0",
"filesize": "^9.0.9",
"filesize": "^9.0.11",
"focus-trap": "^6.4.0",
"focus-trap-vue": "^1.1.1",
"fuse.js": "^6.4.6",
Expand Down Expand Up @@ -126,7 +126,7 @@
},
"peerDependencies": {
"@popperjs/core": "^2.4.0",
"filesize": "^9.0.9",
"filesize": "^9.0.11",
"focus-trap": "^6.4.0",
"focus-trap-vue": "^1.1.1",
"fuse.js": "^6.4.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
</div>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import OcAccordionItem from '../OcAccordionItem/OcAccordionItem.vue'
export default {
export default defineComponent({
name: 'OcAccordion',
// eslint-disable-next-line vue/no-unused-components
components: { OcAccordionItem },
Expand Down Expand Up @@ -144,7 +145,7 @@ export default {
this.expandedIdsInternal = this.expandedIdsInternal.filter((expandedId) => expandedId !== id)
}
}
}
})
</script>

<style lang="scss">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
/>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'

/**
* Count of avatars which weren't displayed.
*/
export default {
export default defineComponent({
name: 'OcAvatarCount',
status: 'ready',
release: '2.1.0',
Expand All @@ -37,7 +39,7 @@ export default {
return Math.floor(this.size / 2.5) + 'px'
}
}
}
})
</script>

<style lang="scss">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
/>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import OcAvatarItem from '../OcAvatarItem/OcAvatarItem.vue'

export default {
export default defineComponent({
name: 'OcAvatarFederated',
status: 'ready',
release: '10.0.0',
Expand Down Expand Up @@ -55,7 +56,7 @@ export default {
default: 'small'
}
}
}
})
</script>

<docs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
/>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import OcAvatarItem from '../OcAvatarItem/OcAvatarItem.vue'

export default {
export default defineComponent({
name: 'OcAvatarGroup',
status: 'ready',
release: '10.0.0',
Expand Down Expand Up @@ -53,7 +54,7 @@ export default {
default: 'small'
}
}
}
})
</script>

<docs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
/>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import OcAvatarItem from '../OcAvatarItem/OcAvatarItem.vue'

export default {
export default defineComponent({
name: 'OcAvatarGuest',
status: 'ready',
release: '10.0.0',
Expand Down Expand Up @@ -55,7 +56,7 @@ export default {
default: 'small'
}
}
}
})
</script>

<docs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
</div>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import OcIcon from '../OcIcon/OcIcon.vue'

export default {
export default defineComponent({
name: 'OcAvatarItem',
status: 'ready',
release: '10.0.0',
Expand Down Expand Up @@ -130,7 +131,7 @@ export default {
return backgroundColors[Math.floor(Math.random() * backgroundColors.length)]
}
}
}
})
</script>

<style lang="scss">
Expand Down
Loading