create-nuxt-base 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +21 -0
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/index.js +115 -0
- package/nuxt-base-template/.eslintrc +4 -0
- package/nuxt-base-template/.storybook/main.ts +17 -0
- package/nuxt-base-template/.storybook/preview-head.html +3 -0
- package/nuxt-base-template/.storybook/preview.ts +15 -0
- package/nuxt-base-template/.vscode/settings.json +27 -0
- package/nuxt-base-template/README.md +42 -0
- package/nuxt-base-template/cypress/e2e/spec.cy.ts +5 -0
- package/nuxt-base-template/cypress/fixtures/example.json +5 -0
- package/nuxt-base-template/cypress/integrations/Test/Test.feature +8 -0
- package/nuxt-base-template/cypress/integrations/Test/test.spec.js +13 -0
- package/nuxt-base-template/cypress/support/commands.ts +37 -0
- package/nuxt-base-template/cypress/support/e2e.ts +20 -0
- package/nuxt-base-template/cypress.config.ts +54 -0
- package/nuxt-base-template/nuxt.config.ts +8 -0
- package/nuxt-base-template/package-lock.json +27290 -0
- package/nuxt-base-template/package.json +62 -0
- package/nuxt-base-template/plugins/index.js +5 -0
- package/nuxt-base-template/public/favicon.ico +0 -0
- package/nuxt-base-template/src/assets/css/tailwind.css +5 -0
- package/nuxt-base-template/src/components/.gitkeep +0 -0
- package/nuxt-base-template/src/components/hello-world.vue +10 -0
- package/nuxt-base-template/src/composables/.gitkeep +0 -0
- package/nuxt-base-template/src/pages/.gitkeep +0 -0
- package/nuxt-base-template/src/pages/index.vue +10 -0
- package/nuxt-base-template/src/stories/Button.stories.ts +52 -0
- package/nuxt-base-template/src/stories/Button.vue +49 -0
- package/nuxt-base-template/src/stories/Header.stories.ts +42 -0
- package/nuxt-base-template/src/stories/Header.vue +35 -0
- package/nuxt-base-template/src/stories/Introduction.mdx +213 -0
- package/nuxt-base-template/src/stories/Page.stories.ts +34 -0
- package/nuxt-base-template/src/stories/Page.vue +69 -0
- package/nuxt-base-template/src/stories/assets/code-brackets.svg +1 -0
- package/nuxt-base-template/src/stories/assets/colors.svg +1 -0
- package/nuxt-base-template/src/stories/assets/comments.svg +1 -0
- package/nuxt-base-template/src/stories/assets/direction.svg +1 -0
- package/nuxt-base-template/src/stories/assets/flow.svg +1 -0
- package/nuxt-base-template/src/stories/assets/plugin.svg +1 -0
- package/nuxt-base-template/src/stories/assets/repo.svg +1 -0
- package/nuxt-base-template/src/stories/assets/stackalt.svg +1 -0
- package/nuxt-base-template/src/stories/button.css +30 -0
- package/nuxt-base-template/src/stories/header.css +32 -0
- package/nuxt-base-template/src/stories/page.css +69 -0
- package/nuxt-base-template/src/tests/.gitkeep +0 -0
- package/nuxt-base-template/src/tests/hello-world.spec.ts +11 -0
- package/nuxt-base-template/tailwind.config.js +8 -0
- package/nuxt-base-template/tsconfig.json +4 -0
- package/nuxt-base-template/vitest.config.js +10 -0
- package/package.json +18 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v1
|
|
13
|
+
- name: Use Node.js 18
|
|
14
|
+
uses: actions/setup-node@v1
|
|
15
|
+
with:
|
|
16
|
+
node-version: 18.14.1
|
|
17
|
+
- run: npm install
|
|
18
|
+
- uses: JS-DevTools/npm-publish@v1
|
|
19
|
+
with:
|
|
20
|
+
access: public
|
|
21
|
+
token: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 lenne.Tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Nuxt Starter
|
|
2
|
+
This is a starter template to create a Nuxt 3 development environment including Tailwind, Pinia, VueUse, Nuxt Base, Eslint and optionally Cypress, Unit Tests and Storybook.
|
|
3
|
+
|
|
4
|
+
Just run the following command to create your Nuxt environment:
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npx @lenne.tech/nuxt-base-starter my-awesome-project
|
|
8
|
+
```
|
|
9
|
+
## Options
|
|
10
|
+
To add Tests and storybook to your environment you can add the following flags:
|
|
11
|
+
```bash
|
|
12
|
+
npx @lenne.tech/nuxt-base-starter --tests --storybook my-awesome-project
|
|
13
|
+
```
|
package/index.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
async function create() {
|
|
4
|
+
const spawn = require("cross-spawn");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const childProcess = require("child_process");
|
|
8
|
+
|
|
9
|
+
const projectName = process.argv[2];
|
|
10
|
+
|
|
11
|
+
if (!projectName) {
|
|
12
|
+
console.error("Please provide a valid project name.");
|
|
13
|
+
process.exit(-1);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const currentDir = process.cwd();
|
|
18
|
+
const projectDir = path.resolve(currentDir, projectName);
|
|
19
|
+
|
|
20
|
+
if (fs.existsSync(projectDir)) {
|
|
21
|
+
console.log(`❌ Directory with name ${projectName} already exists.`);
|
|
22
|
+
process.exit(-1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
await copyFiles("./nuxt-base-template", projectDir);
|
|
26
|
+
|
|
27
|
+
const projectPackageJson = require(path.join(projectDir, "package.json"));
|
|
28
|
+
|
|
29
|
+
// Update the project's package.json with the new project name
|
|
30
|
+
projectPackageJson.name = projectName;
|
|
31
|
+
|
|
32
|
+
fs.writeFileSync(
|
|
33
|
+
path.join(projectDir, "package.json"),
|
|
34
|
+
JSON.stringify(projectPackageJson, null, 2)
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
process.chdir(projectName);
|
|
38
|
+
|
|
39
|
+
const gitInit = childProcess.exec("git init");
|
|
40
|
+
await waitForChildProcess(gitInit);
|
|
41
|
+
|
|
42
|
+
console.log("Installing dependencies ...");
|
|
43
|
+
const npmInstall = spawn("npm", ["install"], { stdio: "inherit" });
|
|
44
|
+
await waitForSpawn(npmInstall);
|
|
45
|
+
|
|
46
|
+
const preCommitHook = spawn("npx", [
|
|
47
|
+
"npx",
|
|
48
|
+
"husky",
|
|
49
|
+
"add",
|
|
50
|
+
".husky/pre-commit",
|
|
51
|
+
'"npm run lint"',
|
|
52
|
+
]);
|
|
53
|
+
await waitForSpawn(preCommitHook);
|
|
54
|
+
|
|
55
|
+
const gitAdd = childProcess.exec("git add .husky/pre-commit");
|
|
56
|
+
await waitForChildProcess(gitAdd);
|
|
57
|
+
|
|
58
|
+
console.log("Building Project ...");
|
|
59
|
+
const npmRunBuild = spawn("npm", ["run", "build"], { stdio: "inherit" });
|
|
60
|
+
await waitForSpawn(npmRunBuild)
|
|
61
|
+
.then(() => console.log("✅ Project was successfully built"))
|
|
62
|
+
.catch(() => console.log("❌ Error while building the project"));
|
|
63
|
+
|
|
64
|
+
console.log("Success! Your new project is ready. 🎉");
|
|
65
|
+
console.log(`Created ${projectName} at ${projectDir} 💾`);
|
|
66
|
+
console.log(`Launching ${projectName} in: 3 💥`);
|
|
67
|
+
await waitForMS(1000);
|
|
68
|
+
console.log(`Launching ${projectName} in: 2 🔥`);
|
|
69
|
+
await waitForMS(1000);
|
|
70
|
+
console.log(`Launching ${projectName} in: 1 🧨`);
|
|
71
|
+
await waitForMS(1000);
|
|
72
|
+
console.log(`Launching ${projectName} ... 🚀`);
|
|
73
|
+
await waitForMS(1000);
|
|
74
|
+
const npmRunDev = spawn("npm", ["run", "dev"], { stdio: "inherit" });
|
|
75
|
+
await waitForSpawn(npmRunDev);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function waitForSpawn(spawn) {
|
|
79
|
+
return new Promise((resolve, reject) => {
|
|
80
|
+
spawn.on("exit", () => resolve(true));
|
|
81
|
+
spawn.on("error", () => reject());
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function waitForMS(ms) {
|
|
86
|
+
return new Promise((resolve) => {
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
resolve(true);
|
|
89
|
+
}, ms);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function waitForChildProcess(process) {
|
|
94
|
+
return new Promise((resolve, reject) => {
|
|
95
|
+
process.stdout.on("data", (data) => {
|
|
96
|
+
resolve(data);
|
|
97
|
+
});
|
|
98
|
+
process.stdout.on("error", (err) => {
|
|
99
|
+
reject(err);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function copyFiles(from, to) {
|
|
105
|
+
const fse = require("fs-extra");
|
|
106
|
+
try {
|
|
107
|
+
await fse.copy(from, to);
|
|
108
|
+
console.log("Copied nuxt base template successfully!");
|
|
109
|
+
} catch (err) {
|
|
110
|
+
console.error(err);
|
|
111
|
+
process.exit(-1);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
create();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/vue3-vite";
|
|
2
|
+
const config: StorybookConfig = {
|
|
3
|
+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
4
|
+
addons: [
|
|
5
|
+
"@storybook/addon-links",
|
|
6
|
+
"@storybook/addon-essentials",
|
|
7
|
+
"@storybook/addon-interactions",
|
|
8
|
+
],
|
|
9
|
+
framework: {
|
|
10
|
+
name: "@storybook/vue3-vite",
|
|
11
|
+
options: {},
|
|
12
|
+
},
|
|
13
|
+
docs: {
|
|
14
|
+
autodocs: "tag",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default config;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Preview } from "@storybook/vue3";
|
|
2
|
+
|
|
3
|
+
const preview: Preview = {
|
|
4
|
+
parameters: {
|
|
5
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
6
|
+
controls: {
|
|
7
|
+
matchers: {
|
|
8
|
+
color: /(background|color)$/i,
|
|
9
|
+
date: /Date$/,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default preview;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nuxt.isNuxtApp": true,
|
|
3
|
+
"editor.formatOnSave": true,
|
|
4
|
+
"eslint.alwaysShowStatus": true,
|
|
5
|
+
"eslint.options": {
|
|
6
|
+
"extensions": [
|
|
7
|
+
".html",
|
|
8
|
+
".js",
|
|
9
|
+
".vue",
|
|
10
|
+
".jsx"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"eslint.validate": [
|
|
14
|
+
"html",
|
|
15
|
+
"vue",
|
|
16
|
+
"javascript",
|
|
17
|
+
"javascriptreact",
|
|
18
|
+
],
|
|
19
|
+
"editor.codeActionsOnSave": {
|
|
20
|
+
"source.fixAll.eslint": true
|
|
21
|
+
},
|
|
22
|
+
"[javascript]": {
|
|
23
|
+
"editor.formatOnSave": false
|
|
24
|
+
},
|
|
25
|
+
"eslint.format.enable": true,
|
|
26
|
+
"css.validate": false,
|
|
27
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Nuxt 3 Minimal Starter
|
|
2
|
+
|
|
3
|
+
Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Make sure to install the dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# yarn
|
|
11
|
+
yarn install
|
|
12
|
+
|
|
13
|
+
# npm
|
|
14
|
+
npm install
|
|
15
|
+
|
|
16
|
+
# pnpm
|
|
17
|
+
pnpm install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Development Server
|
|
21
|
+
|
|
22
|
+
Start the development server on http://localhost:3000
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm run dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Production
|
|
29
|
+
|
|
30
|
+
Build the application for production:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm run build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Locally preview production build:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm run preview
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
2
|
+
/* eslint-disable no-undef */
|
|
3
|
+
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor'
|
|
4
|
+
|
|
5
|
+
Given('I navigate to the website', () => {
|
|
6
|
+
cy.visit('localhost:3000')
|
|
7
|
+
})
|
|
8
|
+
When('I enter site', () => {
|
|
9
|
+
cy.url().should('include', 'localhost')
|
|
10
|
+
})
|
|
11
|
+
Then('Check title', () => {
|
|
12
|
+
cy.get('h1').contains('Nuxt Starter')
|
|
13
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
// ***********************************************
|
|
3
|
+
// This example commands.ts shows you how to
|
|
4
|
+
// create various custom commands and overwrite
|
|
5
|
+
// existing commands.
|
|
6
|
+
//
|
|
7
|
+
// For more comprehensive examples of custom
|
|
8
|
+
// commands please read more here:
|
|
9
|
+
// https://on.cypress.io/custom-commands
|
|
10
|
+
// ***********************************************
|
|
11
|
+
//
|
|
12
|
+
//
|
|
13
|
+
// -- This is a parent command --
|
|
14
|
+
// Cypress.Commands.add('login', (email, password) => { ... })
|
|
15
|
+
//
|
|
16
|
+
//
|
|
17
|
+
// -- This is a child command --
|
|
18
|
+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
|
19
|
+
//
|
|
20
|
+
//
|
|
21
|
+
// -- This is a dual command --
|
|
22
|
+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
|
23
|
+
//
|
|
24
|
+
//
|
|
25
|
+
// -- This will overwrite an existing command --
|
|
26
|
+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
|
27
|
+
//
|
|
28
|
+
// declare global {
|
|
29
|
+
// namespace Cypress {
|
|
30
|
+
// interface Chainable {
|
|
31
|
+
// login(email: string, password: string): Chainable<void>
|
|
32
|
+
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
|
33
|
+
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
|
34
|
+
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
|
|
35
|
+
// }
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// ***********************************************************
|
|
2
|
+
// This example support/e2e.ts 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,0 +1,54 @@
|
|
|
1
|
+
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor'
|
|
2
|
+
import * as webpack from '@cypress/webpack-preprocessor'
|
|
3
|
+
import { defineConfig } from 'cypress'
|
|
4
|
+
|
|
5
|
+
async function setupNodeEvents(
|
|
6
|
+
on: Cypress.PluginEvents,
|
|
7
|
+
config: Cypress.PluginConfigOptions,
|
|
8
|
+
): Promise<Cypress.PluginConfigOptions> {
|
|
9
|
+
await addCucumberPreprocessorPlugin(on, config)
|
|
10
|
+
|
|
11
|
+
on(
|
|
12
|
+
'file:preprocessor',
|
|
13
|
+
webpack({
|
|
14
|
+
webpackOptions: {
|
|
15
|
+
resolve: {
|
|
16
|
+
extensions: ['.ts', '.js'],
|
|
17
|
+
},
|
|
18
|
+
module: {
|
|
19
|
+
rules: [
|
|
20
|
+
{
|
|
21
|
+
test: /\.ts$/,
|
|
22
|
+
exclude: [/node_modules/],
|
|
23
|
+
use: [
|
|
24
|
+
{
|
|
25
|
+
loader: 'ts-loader',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
test: /\.feature$/,
|
|
31
|
+
use: [
|
|
32
|
+
{
|
|
33
|
+
loader: '@badeball/cypress-cucumber-preprocessor/webpack',
|
|
34
|
+
options: config,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
// Make sure to return the config object as it might have been modified by the plugin.
|
|
45
|
+
return config
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default defineConfig({
|
|
49
|
+
e2e: {
|
|
50
|
+
setupNodeEvents,
|
|
51
|
+
supportFile: false,
|
|
52
|
+
specPattern: ['cypress/e2e/**/*.cy.{js,ts}', 'cypress/integrations/**/*.feature'],
|
|
53
|
+
},
|
|
54
|
+
})
|