Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Feat: Generate typescript package types and tests #449

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
4a05248
typescript support using typescript-build
ChangJoo-Park Aug 21, 2019
4bd4f08
Remove trailing comma
ChangJoo-Park Aug 21, 2019
8dbe5ea
Merge branch 'master' into typescript
ChangJoo-Park Aug 28, 2019
e244e81
remove @types/node
ChangJoo-Park Aug 29, 2019
bf7e77c
Add default / ts-runtime for none server + ts
ChangJoo-Park Aug 29, 2019
bf36d5d
set lang="ts" when using typescript
ChangJoo-Park Aug 29, 2019
764cfdb
Remove ts-node
ChangJoo-Park Aug 29, 2019
f06ceea
@nuxt/typescript-build version to 0.1.11
ChangJoo-Park Aug 30, 2019
6d9431d
Update ts script tag
ChangJoo-Park Aug 30, 2019
a28343e
Add typescript nuxt cookbook when completed
ChangJoo-Park Aug 30, 2019
b5df795
Using tsconfig.json using always when selected ts
ChangJoo-Park Aug 30, 2019
9c28d89
only suggestion jsconfig.json when js users
ChangJoo-Park Aug 30, 2019
0f16c8e
fix typo
ChangJoo-Park Aug 30, 2019
abf30c7
using js by default
ChangJoo-Park Aug 30, 2019
4d62b71
tsconfig / jsconfig settings
ChangJoo-Park Aug 30, 2019
4f498f7
add closing tag for ts
ChangJoo-Park Aug 30, 2019
b68b79f
Delete package-lock.json
ChangJoo-Park Aug 30, 2019
d3df5d4
Update template/nuxt/pages/index.vue
ChangJoo-Park Aug 30, 2019
2da1f54
support eslint when TypeScript.
ChangJoo-Park Aug 30, 2019
97a6afd
set false tsRuntime when select TypeScript
ChangJoo-Park Aug 30, 2019
309662c
support jest with typescript
ChangJoo-Park Aug 30, 2019
ffacdd1
Update saofile.js
ChangJoo-Park Sep 2, 2019
8a81cad
Update template/tsconfig.json
ChangJoo-Park Sep 4, 2019
4476bab
Merge branch 'master' into typescript
ChangJoo-Park Oct 23, 2019
55c482a
Add language and runtime to prompts.js
ChangJoo-Park Oct 23, 2019
fa611c6
Update TypeScript relative package versions
ChangJoo-Park Oct 23, 2019
c26e961
@nuxt/core needs eslint-module
ChangJoo-Park Oct 23, 2019
ab8be4a
Update tsconfig.json
ChangJoo-Park Oct 24, 2019
57461b2
Update README for TypeScript
ChangJoo-Park Oct 24, 2019
f2e66a7
Merge branch 'typescript' of https://github.com/ChangJoo-Park/create-…
ChangJoo-Park Oct 24, 2019
aaa09be
standardize generating typescript components
NickBolles Oct 25, 2019
fafe31b
generate nuxt.config.ts instead of nuxt.config.js if typescript runti…
NickBolles Oct 25, 2019
1a428b6
Add ts files to lint-staged if typescript is on
NickBolles Nov 14, 2019
1b4d80e
Remove unused imports
NickBolles Nov 14, 2019
34ecbfd
remove unused imports
NickBolles Nov 14, 2019
403abfd
standardize generating typescript components
NickBolles Oct 25, 2019
e0fd272
generate nuxt.config.ts instead of nuxt.config.js if typescript runti…
NickBolles Oct 25, 2019
5935b7f
Add ts files to lint-staged if typescript is on
NickBolles Nov 14, 2019
9d5a65e
Remove unused imports
NickBolles Nov 14, 2019
8449d54
remove unused imports
NickBolles Nov 14, 2019
c266cbb
fix: only prompt for jsconfig.json if language is js
NickBolles Mar 28, 2020
c67001d
feat(typescript): add vue-shims.d.ts
NickBolles Mar 28, 2020
e67766d
fix: use _ to indicate unused vars and avoid lint issue
NickBolles Mar 28, 2020
76dc688
feat(typescript): add jest typings if typescript is enabled
NickBolles Mar 28, 2020
0f60127
fix: fix typescript generation for framevuerk, vuesax and vuetify
NickBolles Mar 29, 2020
0ffd829
feat(typescript): add typescript files to eslint
NickBolles Mar 29, 2020
84ed1a8
fix: always show jsconfig, but add hint for typescript
NickBolles Mar 29, 2020
4568528
fix: sync up nuxt.config for js and ts
NickBolles Mar 29, 2020
73a814b
test: fix typescript runtime test, reset snapshots
NickBolles Mar 29, 2020
9a44125
style: fix linting issues
NickBolles Mar 29, 2020
c55e86d
fix: disable vue/no-parsing-error
NickBolles Apr 7, 2020
b7edfbe
fix: code stye for PR comments
NickBolles Apr 14, 2020
0cc044a
Merge branch 'master' into typescript
NickBolles Apr 14, 2020
0e0cc70
test: remove old snapshot file
NickBolles Apr 14, 2020
109dc39
test: update snapshots and code style
NickBolles Apr 14, 2020
2cf51a4
style: fix duplicate line break
NickBolles Apr 23, 2020
430be0b
Merge branch 'master' of https://github.com/nuxt/create-nuxt-app into…
NickBolles Apr 23, 2020
5dbe0e5
fix: merge to package.js instead of package.json
NickBolles Apr 23, 2020
2c337d5
fix: merge issues
NickBolles Apr 23, 2020
2dc48dd
update test snapshots
NickBolles Apr 23, 2020
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
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"use": true
},
"rules": {
"no-console": "off"
"no-console": "off",
"vue/no-parsing-error": "off"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
</div>
</template>

<script>
export default {
<%- generateComponent('', `{
props: {
title: {
type: String,
Expand All @@ -38,5 +37,4 @@ export default {
required: true
}
}
}
</script>
}`) %>
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
</div>
</template>

<script>
export default {
<%- generateComponent('', `{
data () {
return {
items: [
Expand All @@ -70,5 +69,4 @@ export default {
]
}
}
}
</script>
}`) %>
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@
</section>
</template>

<script>
import Card from '~/components/Card'

export default {
<%- generateComponent(
`import Card from '~/components/Card'`, `{
name: 'HomePage',

components: {
Card
}
}
</script>
}`) %>
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
</div>
</template>

<script>
export default {
<%- generateComponent('',`{
data () {
return {
isReady: false
Expand All @@ -38,8 +37,7 @@ export default {
this.isReady = true
}, 1000)
}
}
</script>
}`) %>

<style scoped>
.logo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,9 @@
</fvMain>
</template>

<script>
import Logo from '~/components/Logo.vue'
import FramevuerkLogo from '~/components/FramevuerkLogo.vue'

export default {
<%- generateComponent(
`import Logo from '~/components/Logo.vue'
import FramevuerkLogo from '~/components/FramevuerkLogo.vue'`, `{
components: {
Logo,
FramevuerkLogo
Expand Down Expand Up @@ -169,9 +167,7 @@ export default {
})
}
}
}
</script>

}`) %>
<style scoped>
.content {
margin: 0 auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@
</div>
</template>

<script>
import Logo from '~/components/Logo.vue'
export default {
<%- generateComponent(
`import Logo from '~/components/Logo.vue'`,`{
components: {
Logo
}
}
</script>
}`) %>

<style>
.container {
Expand Down
12 changes: 5 additions & 7 deletions packages/cna-template/template/frameworks/vuesax/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,15 @@
</div>
</template>

<script>
import Logo from '~/components/Logo.vue'
import VuesaxLogo from '~/components/VuesaxLogo.vue'

export default {
<%- generateComponent(`
import Logo from '~/components/Logo.vue'
import VuesaxLogo from '~/components/VuesaxLogo.vue'
`,`{
components: {
Logo,
VuesaxLogo
}
}
</script>
}`)%>

<style>
.container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@
</v-app>
</template>

<script>
export default {
<%- generateComponent(``,`{
data () {
return {
clipped: false,
Expand All @@ -113,5 +112,4 @@ export default {
title: 'Vuetify.js'
}
}
}
</script>
}`) %>
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
</v-app>
</template>

<script>
export default {
<%- generateComponent(``,`{
layout: 'empty',
props: {
error: {
Expand All @@ -34,8 +33,7 @@ export default {
title
}
}
}
</script>
}`) %>

<style scoped>
h1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,12 @@
</v-layout>
</template>

<script>
import Logo from '~/components/Logo.vue'
import VuetifyLogo from '~/components/VuetifyLogo.vue'

export default {
<%- generateComponent(`
import Logo from '~/components/Logo.vue'
import VuetifyLogo from '~/components/VuetifyLogo.vue'
`,`{
components: {
Logo,
VuetifyLogo
}
}
</script>
}`) %>
2 changes: 1 addition & 1 deletion packages/cna-template/template/nuxt/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ module.exports = {
/*
** You can extend webpack config here
*/
extend (config, ctx) {
extend (_config, _ctx) {
}
}
}
182 changes: 182 additions & 0 deletions packages/cna-template/template/nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@

import { Configuration } from '@nuxt/types'

<%_ if (ui === 'vuetify') { _%>
import colors from 'vuetify/es5/util/colors'
<%_ } _%>
<%_ if (server === 'adonis') { _%>
import { resolve } from 'path'
<%_ } _%>

const config: Configuration = {
mode: '<%= mode %>',
<%_ if (server === 'adonis') { _%>
dev: process.env.NODE_ENV === 'development',
srcDir: resolve(__dirname, '..', 'resources'),
<%_ } _%>
/*
** Headers of the page
*/
head: {
<%_ if (ui === 'vuetify') { _%>
titleTemplate: '%s - ' + process.env.npm_package_name,
<%_ } _%>
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
],
link: [
<%_ if (ui === 'framevuerk') { _%>
{
rel: 'stylesheet',
href:
'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons'
},
<%_ } _%>
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
<%_ if (ui === 'element-ui') { _%>
'element-ui/lib/theme-chalk/index.css'
<%_ } else if (ui === 'iview') { _%>
'iview/dist/styles/iview.css'
<%_ } else if (ui === 'ant-design-vue') { _%>
'ant-design-vue/dist/antd.css'
<%_ } else if (ui === 'tachyons') { _%>
'tachyons/css/tachyons.css'
<%_ } else if (ui === 'framevuerk') { _%>
'framevuerk/dist/framevuerk-nuxt.min.css'
<%_ } else if (ui === 'vuesax') { _%>
'vuesax/dist/vuesax.css'
<%_ } _%>
],
/*
** Plugins to load before mounting the App
*/
plugins: [
<%_ if (ui === 'element-ui') { _%>
'@/plugins/element-ui'
<%_ } else if (ui === 'iview') { _%>
'@/plugins/iview'
<%_ } else if (ui === 'ant-design-vue') { _%>
'@/plugins/antd-ui'
<%_ } else if (ui === 'framevuerk') { _%>
'@/plugins/framevuerk'
<%_ } else if (ui === 'vuesax') { _%>
'@/plugins/vuesax'
<%_ } _%>
],
/*
** Nuxt.js dev-modules
*/

buildModules: [
<%_ if (typescript) {_%>
'@nuxt/typescript-build',
<%_ } _%>
<%_ if (eslint) { _%>
// Doc: https://github.com/nuxt-community/eslint-module
'@nuxtjs/eslint-module',
<%_ } _%>
<%_ if (stylelint) { _%>
// Doc: https://github.com/nuxt-community/stylelint-module
'@nuxtjs/stylelint-module',
<%_ } _%>
<%_ if (ui === 'tailwind') { _%>
// Doc: https://github.com/nuxt-community/nuxt-tailwindcss
'@nuxtjs/tailwindcss',
<%_ } else if (ui === 'vuetify') { _%>
'@nuxtjs/vuetify',
<%_ } _%>
],
/*
** Nuxt.js modules
*/
modules: [
<%_ if (ui === 'bootstrap') { _%>
// Doc: https://bootstrap-vue.js.org
'bootstrap-vue/nuxt',
<%_ } else if (ui === 'bulma') { _%>
// Doc: https://github.com/nuxt-community/modules/tree/master/packages/bulma
'@nuxtjs/bulma',
<%_ } else if (ui === 'buefy') { _%>
// Doc: https://buefy.github.io/#/documentation
'nuxt-buefy',
<%_ } _%>
<%_ if (axios) { _%>
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
<%_ } _%>
<%_ if (pwa) { _%>
'@nuxtjs/pwa',
<%_ } _%>
<%_ if (dotenv) { _%>
// Doc: https://github.com/nuxt-community/dotenv-module
'@nuxtjs/dotenv',
<%_ } _%>
],
<%_ if (axios) { _%>
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {
},
<%_ } _%>
<%_ if (ui === 'vuetify') { _%>
/*
** vuetify module configuration
** https://github.com/nuxt-community/vuetify-module
*/
vuetify: {
customVariables: ['~/assets/variables.scss'],
theme: {
dark: true,
themes: {
dark: {
primary: colors.blue.darken2,
accent: colors.grey.darken3,
secondary: colors.amber.darken3,
info: colors.teal.lighten1,
warning: colors.amber.base,
error: colors.deepOrange.accent4,
success: colors.green.accent3
}
}
}
},
<%_ } _%>
/*
** Build configuration
*/
build: {
<%_ if (ui === 'bulma') { _%>
postcss: {
preset: {
features: {
customProperties: false
}
}
},
<%_ } else if (ui === 'element-ui') { _%>
transpile: [/^element-ui/],
<%_ } _%>
/*
** You can extend webpack config here
*/
extend (_config, _ctx) {
}
}
}

export default config;
Loading