Skip to content

Commit 4114cc4

Browse files
committed
workflow: generate a snapshot of each template before each release
1 parent 5fae06a commit 4114cc4

File tree

156 files changed

+2368
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+2368
-5
lines changed

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import minimist from 'minimist'
88
import prompts from 'prompts'
99
import { red, green, bold } from 'kolorist'
1010

11+
import templateList from './utils/templateList.js'
1112
import renderTemplate from './utils/renderTemplate.js'
1213
import {
1314
postOrderDirectoryTraverse,
@@ -48,11 +49,8 @@ async function init() {
4849
let targetDir = argv._[0]
4950
const defaultProjectName = !targetDir ? 'vue-project' : targetDir
5051

51-
const TEMPLATE_LIST = ['default', 'spa']
52-
.flatMap(x => [x, x + '-ts'])
53-
.flatMap(x => [x, x + '-with-tests'])
5452
let template = argv.template || argv.t
55-
const isValidTemplate = TEMPLATE_LIST.includes(template)
53+
const isValidTemplate = templateList.includes(template)
5654

5755
let result = {}
5856

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"node": "^12.13.0 || ^14.0.0 || >= 16.0.0"
1717
},
1818
"scripts": {
19-
"test": "echo \"Error: no test specified\" && exit 1"
19+
"test": "echo \"Error: no test specified\" && exit 1",
20+
"prepublishOnly": "node snapshot.js"
2021
},
2122
"repository": {
2223
"type": "git",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
*.local
15+
16+
/cypress/videos/
17+
/cypress/screenshots/
18+
19+
# Editor directories and files
20+
.vscode
21+
!.vscode/extensions.json
22+
.idea
23+
*.suo
24+
*.ntvs*
25+
*.njsproj
26+
*.sln
27+
*.sw?
File renamed without changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"baseUrl": "http://localhost:5050",
3+
"component": {
4+
"componentFolder": "src",
5+
"testFiles": "**/__tests__/*.spec.{js,ts,jsx,tsx}"
6+
}
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// https://docs.cypress.io/api/introduction/api.html
2+
3+
describe('My First Test', () => {
4+
it('visits the app root url', () => {
5+
cy.visit('/')
6+
cy.contains('h1', 'Hello Vue 3 + TypeScript + Vite')
7+
})
8+
})
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/// <reference types="cypress" />
2+
// ***********************************************************
3+
// This example plugins/index.js can be used to load plugins
4+
//
5+
// You can change the ___location of this file or turn off loading
6+
// the plugins file with the 'pluginsFile' configuration option.
7+
//
8+
// You can read more here:
9+
// https://on.cypress.io/plugins-guide
10+
// ***********************************************************
11+
12+
// This function is called when a project is opened or re-opened (e.g. due to
13+
// the project's config changing)
14+
15+
const { startDevServer } = require('@cypress/vite-dev-server')
16+
17+
/**
18+
* @type {Cypress.PluginConfig}
19+
*/
20+
// eslint-disable-next-line no-unused-vars
21+
module.exports = (on, config) => {
22+
// `on` is used to hook into various events Cypress emits
23+
// `config` is the resolved Cypress config
24+
on('dev-server:start', (options) => {
25+
return startDevServer({ options })
26+
})
27+
return config
28+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add('login', (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/index.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the ___location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

0 commit comments

Comments
 (0)