Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: use type=module in generated projects#389

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
cexbrayat wants to merge2 commits intovuejs:mainfromcexbrayat:feat/type-module
Closed
Show file tree
Hide file tree
Changes fromall 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
13 changes: 8 additions & 5 deletionsindex.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -447,17 +447,20 @@ async function init() {

if (needsTypeScript) {
// Convert the JavaScript template to the TypeScript
// Check all the remaining `.js` files:
// - If the corresponding TypeScript version already exists, remove the `.js` version.
// - Otherwise, rename the `.js` file to `.ts`
// Check all the remaining `.js`/`.cjs` files:
// - If the corresponding TypeScript version already exists, remove the `.js`/`.cjs` version.
// - Otherwise, rename the `.js`/`.cjs` file to `.ts`
// Remove `jsconfig.json`, because we already have tsconfig.json
// `jsconfig.json` is not reused, because we use solution-style `tsconfig`s, which are much more complicated.
preOrderDirectoryTraverse(
root,
() => {},
(filepath) => {
if (filepath.endsWith('.js') && !FILES_TO_FILTER.includes(path.basename(filepath))) {
const tsFilePath = filepath.replace(/\.js$/, '.ts')
if (
(filepath.endsWith('.js') || filepath.endsWith('.cjs')) &&
!FILES_TO_FILTER.includes(path.basename(filepath))
) {
const tsFilePath = filepath.replace(/\.c?js$/, '.ts')
if (fs.existsSync(tsFilePath)) {
fs.unlinkSync(filepath)
} else {
Expand Down
53 changes: 10 additions & 43 deletionspnpm-lock.yaml
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

23 changes: 18 additions & 5 deletionsscripts/test.mjs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
#!/usr/bin/env zx
import'zx/globals'

// Vitest would otherwise enable watch mode by default.
process.env.CI='1'

constplaygroundDir=path.resolve(__dirname,'../playground/')
letprojects=fs
.readdirSync(playgroundDir,{withFileTypes:true})
Expand All@@ -21,7 +18,13 @@ for (const projectName of projects) {
cd(path.resolve(playgroundDir,projectName))
constpackageJSON=require(path.resolve(playgroundDir,projectName,'package.json'))

console.log(`Building${projectName}`)
console.log(`
#####
Building${projectName}
#####
`)
await$`pnpm build`

if('@playwright/test'inpackageJSON.devDependencies){
Expand All@@ -35,6 +38,16 @@ for (const projectName of projects) {

if('test:unit'inpackageJSON.scripts){
console.log(`Running unit tests in${projectName}`)
await$`pnpm test:unit`
if(projectName.includes('vitest')||projectName.includes('with-tests')){
// Vitest would otherwise enable watch mode by default.
await$`CI=1 pnpm test:unit`
}else{
await$`pnpm test:unit`
}
}

if('type-check'inpackageJSON.scripts){
console.log(`Running type-check in${projectName}`)
await$`pnpm type-check`
}
}
3 changes: 2 additions & 1 deletiontemplate/base/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
Expand All@@ -10,6 +11,6 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.5.0",
"vite": "^5.0.1"
"vite": "^5.0.2"
}
}
5 changes: 4 additions & 1 deletiontemplate/config/nightwatch-ct/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
{
"scripts": {
"test:unit":"nightwatch src/components/**/__tests__/*"
"test:unit":"nightwatch src/**/__tests__/*"
},
"dependencies": {
"vue":"^3.3.8"
},
"devDependencies": {
"@vue/test-utils":"^2.4.2"
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,10 +30,11 @@ module.exports = {
plugins: ['@nightwatch/vue'],

// See https://nightwatchjs.org/guide/concepts/test-globals.html#external-test-globals
globals_path: 'nightwatch/globals.js',
globals_path: '',

vite_dev_server: {
start_vite: false
start_vite: true,
port: process.env.CI ? 4173 : 5173
},

webdriver: {},
Expand Down
23 changes: 0 additions & 23 deletionstemplate/config/nightwatch/nightwatch/globals.js
View file
Open in desktop

This file was deleted.

6 changes: 3 additions & 3 deletionstemplate/config/nightwatch/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
{
"scripts": {
"test:e2e": "nightwatch tests/e2e"
"test:e2e": "nightwatch tests/e2e/*"
},
"devDependencies": {
"nightwatch": "^3.3.2",
"@nightwatch/vue": "0.4.5",
"@nightwatch/vue": "^0.4.5",
"@vitejs/plugin-vue": "^4.5.0",
"@types/nightwatch": "^2.3.28",
"geckodriver": "^4.2.1",
"chromedriver": "^119.0.0",
"ts-node": "^10.9.1",
"wait-on": "^7.2.0"
"vite-plugin-nightwatch": "^0.4.5"
}
}
5 changes: 1 addition & 4 deletionstemplate/config/nightwatch/tests/e2e/example.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,10 +4,7 @@ describe('My First Test', function () {
})

it('visits the app root url',function(){
browser.assert
.textContains('.green','You did it!')
.assert.elementHasCount('.wrapper nav a',2)
.strictClick('.wrapper nav a:last-child')
browser.assert.textContains('.green','You did it!')
})

after((browser)=>browser.end())
Expand Down
2 changes: 1 addition & 1 deletiontemplate/config/playwright/e2e/vue.spec.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
const { test, expect }= require('@playwright/test');
import { test, expect }from'@playwright/test';

// See here how to get started:
// https://playwright.dev/docs/intro
Expand Down
3 changes: 3 additions & 0 deletionstemplate/tsconfig/cypress-ct/tsconfig.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
{
"files": [],
"compilerOptions": {
"module": "es2015"
},
"references": [
{
"path": "./tsconfig.node.json"
Expand Down
5 changes: 3 additions & 2 deletionstemplate/tsconfig/nightwatch/nightwatch/tsconfig.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,14 +3,15 @@
"compilerOptions": {
"target": "ESNext",
"module": "commonjs",
"moduleResolution": "node",
"composite": true,
"rootDir": "../",
"lib": ["ESNext", "dom"],
"types": ["nightwatch"]
},
"include": ["../node_modules/@nightwatch/**/*", "../src/components/**/*", "../tests/e2e/**/*"],
"include": ["../src/components/**/*", "../tests/e2e/**/*"],
"ts-node": {
"files": true
"transpileOnly": true
},
"files": ["nightwatch.d.ts"]
}
3 changes: 3 additions & 0 deletionstemplate/tsconfig/vitest/tsconfig.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
{
"files": [],
"compilerOptions": {
"module": "es2015"
},
"references": [
{
"path": "./tsconfig.node.json"
Expand Down
6 changes: 1 addition & 5 deletionsutils/filterList.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
export const FILES_TO_FILTER = [
'nightwatch.e2e.conf.js',
'nightwatch.component.conf.js',
'globals.js'
]
export const FILES_TO_FILTER = []

[8]ページ先頭

©2009-2025 Movatter.jp