Skip to content

Commit

Permalink
vue-standalone (#68)
Browse files Browse the repository at this point in the history
* vue-standalone

* vue-standalone updated

* update vue-standalone readme

* update vue-standalone recipe
  • Loading branch information
isaacplmann authored Oct 20, 2023
1 parent ad19cfc commit 1127fa1
Show file tree
Hide file tree
Showing 70 changed files with 14,450 additions and 0 deletions.
1 change: 1 addition & 0 deletions vue-standalone/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
59 changes: 59 additions & 0 deletions vue-standalone/.eslintrc.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx", "*.vue"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
},
{
"sourceTag": "type:feature",
"onlyDependOnLibsWithTags": ["type:feature", "type:ui"]
},
{
"sourceTag": "type:ui",
"onlyDependOnLibsWithTags": ["type:ui"]
},
{
"sourceTag": "scope:orders",
"onlyDependOnLibsWithTags": [
"scope:orders",
"scope:products",
"scope:shared"
]
},
{
"sourceTag": "scope:products",
"onlyDependOnLibsWithTags": ["scope:products", "scope:shared"]
},
{
"sourceTag": "scope:shared",
"onlyDependOnLibsWithTags": ["scope:shared"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
}
]
}
18 changes: 18 additions & 0 deletions vue-standalone/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx", "*.vue"],
"rules": {
"vue/multi-word-component-names": "off"
}
}
],
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/eslint-config-typescript",
"@vue/eslint-config-prettier/skip-formatting",
"./.eslintrc.base.json"
]
}
41 changes: 41 additions & 0 deletions vue-standalone/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist
tmp
/out-tsc

# dependencies
node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

.nx/cache
4 changes: 4 additions & 0 deletions vue-standalone/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
3 changes: 3 additions & 0 deletions vue-standalone/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
7 changes: 7 additions & 0 deletions vue-standalone/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
}
24 changes: 24 additions & 0 deletions vue-standalone/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Tutorial: Standalone Vue Application

[![standalone application](https://img.shields.io/static/v1?label=Nx%20setup&message=standalone%20app&color=blue)](https://nx.dev/concepts/integrated-vs-package-based#standalone-applications)

Source code for the Vue standalone application tutorial on the Nx docs:
- Tutorial: https://nx.dev/getting-started/vue-standalone-tutorial

## What's inside?

This example contains a single Vue application that has been generated with the `vue-standalone` preset. It contains a single root-level application and local libraries within the `modules` folder.

Follow through the tutorial linked above for more details.

## How to run it

Install all dependencies using `npm install`. You can then run commands Like

- `npx nx serve` to serve the app
- `npx nx build` to build the Vue application
- you can use `npx nx graph` to visualize the structure

## Learn more

- [Video: Standalone Applications with Nx](https://youtu.be/qEaVzh-oBBc)
18 changes: 18 additions & 0 deletions vue-standalone/e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": [
"plugin:cypress/recommended",
"../.eslintrc.json",
"../.eslintrc.base.json"
],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}
8 changes: 8 additions & 0 deletions vue-standalone/e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';

export default defineConfig({
e2e: nxE2EPreset(__dirname, {
bundler: 'vite',
}),
});
33 changes: 33 additions & 0 deletions vue-standalone/e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "e2e",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "e2e/cypress.config.ts",
"devServerTarget": "myvueapp:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "myvueapp:serve:production"
},
"ci": {
"devServerTarget": "myvueapp:serve-static"
}
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["myvueapp"]
}
13 changes: 13 additions & 0 deletions vue-standalone/e2e/src/e2e/app.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';

describe('myvueapp', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('[email protected]', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome');
});
});
4 changes: 4 additions & 0 deletions vue-standalone/e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]"
}
1 change: 1 addition & 0 deletions vue-standalone/e2e/src/support/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
33 changes: 33 additions & 0 deletions vue-standalone/e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************

// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
17 changes: 17 additions & 0 deletions vue-standalone/e2e/src/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';
11 changes: 11 additions & 0 deletions vue-standalone/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"]
}
13 changes: 13 additions & 0 deletions vue-standalone/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>myvueapp</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions vue-standalone/modules/orders/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/eslint-config-typescript",
"@vue/eslint-config-prettier/skip-formatting",
"../../.eslintrc.base.json"
],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx", "*.vue"],
"rules": {
"vue/multi-word-component-names": "off"
}
}
]
}
7 changes: 7 additions & 0 deletions vue-standalone/modules/orders/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# orders

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test orders` to execute the unit tests via [Vitest](https://vitest.dev/).
12 changes: 12 additions & 0 deletions vue-standalone/modules/orders/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@myvueapp/orders",
"version": "0.0.1",
"main": "./index.js",
"types": "./index.d.ts",
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.js"
}
}
}
Loading

0 comments on commit 1127fa1

Please sign in to comment.