-
-
Notifications
You must be signed in to change notification settings - Fork 427
Feat: Generate typescript package types and tests #449
Conversation
Co-Authored-By: Kevin Marrec <[email protected]>
Co-Authored-By: Louis-Marie Michelin <[email protected]>
That's just a 3 line patch to make the ejs lib do the work. |
@NickBolles Did you understand why we have Edit: {
"plugins": ["ejs"],
"extends": ["@nuxtjs"],
"globals": {
"use": true
},
"rules": {
"no-console": "off",
"vue/comment-directive": "off"
}
} At least it's not as bad as having no linter at all. @NickBolles What do you think about that? |
@NickBolles ping |
@mtltechtemp If you want to put a pull request together, either to follow up this one, or to merge into this branch I'd be fine with that. Although IMO a better fix would be to update eslint-plugin-ejs to register a pre-processor ID (https://eslint.org/docs/developer-guide/working-with-plugins#processors-in-plugins) and then allow users to configure it via the processor config, or overrides configs: https://eslint.org/docs/user-guide/configuring#specifying-processor I hate doing one time patches of modules when with a little bit more work everyone can benefit. |
@@ -61,6 +61,15 @@ | |||
</div> | |||
</template> | |||
|
|||
<%- generateComponent(` |
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.
Sounds like the script
section hasn't been removed from this file
template/nuxt/nuxt.config.js
Outdated
@@ -86,6 +86,7 @@ module.exports = { | |||
/* | |||
** Nuxt.js dev-modules | |||
*/ | |||
|
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.
Don't think this carriage return is needed as it's not done for the other comments on top of properties.
template/nuxt/nuxt.config.ts
Outdated
/* | ||
** Nuxt.js dev-modules | ||
*/ | ||
|
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.
Don't think this carriage return is needed as it's not done for the other comments on top of properties.
template/nuxt/nuxt.config.ts
Outdated
@@ -0,0 +1,182 @@ | |||
|
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.
Useless carriage return at beginning of file
template/tsconfig.json
Outdated
@@ -25,7 +25,9 @@ | |||
}, | |||
"types": [ | |||
"@types/node", | |||
"@nuxt/types" | |||
"@nuxt/types"<%_ if (ui === 'vuetify') { _%>, | |||
"vuetify" |
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.
"vuetify" | |
"@nuxtjs/vuetify" |
test/index.test.js
Outdated
let configFile | ||
if (answers.server === 'adonis') { | ||
configFile = 'config/nuxt.js' | ||
} else if (typescript) { | ||
configFile = 'nuxt.config.ts' | ||
} else { | ||
configFile = 'nuxt.config.js' | ||
} |
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.
let configFile | |
if (answers.server === 'adonis') { | |
configFile = 'config/nuxt.js' | |
} else if (typescript) { | |
configFile = 'nuxt.config.ts' | |
} else { | |
configFile = 'nuxt.config.js' | |
} | |
const configFile = answers.server === 'adonis' ? 'config/nuxt.js' : `nuxt.config.${typescript ? 'ts' : 'js'}` |
saofile.js
Outdated
const tsRuntime = | ||
this.answers.runtime && this.answers.runtime.includes('ts-runtime') |
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.
IMO Unnecessary change
saofile.js
Outdated
return ` | ||
<script ${ifTrue(typescript, 'lang="ts"')}> | ||
${ifTrue(typescript, 'import Vue from \'vue\'')} | ||
${ifTrue(!!imports, imports)} |
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.
I think that is there are imports, a carriage return should be ensured between imports and export.
@NickBolles Could you take into account my requested changes ? then make your PR compatible with new monorepo (that's why you get lot of conflicts) |
@NickBolles Can you fix conflicts & tests ? Thanks :) |
@kevinmarrec updated. Could you take a look at this today? It's getting kinda difficult to keep this up to date with all of the other changes going on. :/ Edit: also looks like there are some timeout requests on the CI checks |
Great feature and nice work @NickBolles |
@NickBolles fo you mind resolving the conflicts one last time? |
Is there any plan to continue working on this, or will it be changed after Nuxt 3 anyway? |
Resubmitting as a pr to the base repo.
Original PR: https://github.com/ChangJoo-Park/create-nuxt-app/pull/1
But it didn't make it into the initial typescript support here: #449
List of changes
Create nuxt.config.ts
Update nuxt.config.ts with changes from nuxt.config.js
Create a generate component template helper to switch between javascript and typescript
Update the following components to generate typescript components using the generateComponent template helper
Add typescript files to eslint and lint-staged configs
fix tests for typescript runtime
Add vue-shims.d.ts file
Issues from #448 - @davelsan
_
, which is the standard way to declare an unused var