Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Apr 7, 2024
1 parent 009f9b7 commit 25f027e
Show file tree
Hide file tree
Showing 20 changed files with 240 additions and 37 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ jobs:
name: "node-${{ matrix.node_version }}, ${{ matrix.os }}"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Required for docs/versions tests
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v3

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: "pnpm"
Expand All @@ -48,5 +48,5 @@ jobs:
- name: Test
run: pnpm run test

- name: Compile
run: pnpm run compile
- name: Build
run: pnpm run build
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# Faker Playground

This repo contains three test playgrounds.
This repo contains multiple test playgrounds:

`cjs`, `esm` and `browser`
- browser
- cjs
- esm
- nextjs
- ts-4.7-nodenext
- vite-cjs
- vite-esm
- webpack-cjs

You should checkout this project beside your `faker` folder, so the pnpm link in [package.json](./package.json) is correctly resolved.
By default, the project uses the latest version of `faker`, but you can switch to the local clone by:

1. editing the `package.json`
2. replacing `"overrides-for-dev"` with `"overrides"`
3. running `pnpm install`

Make sure you have build the `faker` project so there is a `dist` folder.

In the playground project you should run `pnpm install` once.
---

Please run `pnpm install` once before executing any of the following commands.

You can run:

Expand All @@ -16,6 +31,7 @@ You can run:
- `pnpm -r --workspace-concurrency 1 test:ts` to test only **TypeScript** files for `cjs` and `esm`
- `pnpm run test:cjs` to test only `cjs`
- `pnpm run test:esm` to test only `esm`
- `pnpm run build` to build/bundle all playgrounds

---

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"test:cjs": "pnpm -r --workspace-concurrency 1 --filter=./playgrounds/cjs test",
"test:esm": "pnpm -r --workspace-concurrency 1 --filter=./playgrounds/esm test",
"test:nextjs": "pnpm -r --workspace-concurrency 1 --filter=./playgrounds/nextjs test",
"compile": "pnpm -r --workspace-concurrency 1 --filter=./playgrounds/* compile"
"build": "pnpm -r --workspace-concurrency 1 --filter=./playgrounds/* build"
},
"devDependencies": {
"tsx": "~4.7.0",
"typescript": "~5.3.3"
"tsx": "~4.7.2",
"typescript": "~5.4.4"
},
"dependencies": {
"@faker-js/faker": "8.4.1"
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"serve": "vite"
},
"devDependencies": {
"vite": "~5.1.0"
"vite": "~5.2.8"
}
}
2 changes: 1 addition & 1 deletion playgrounds/cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "commonjs",
"scripts": {
"compile": "tsc",
"build": "tsc",
"test:js": "node index.js",
"test:ts": "tsx index.ts",
"test": "pnpm run test:js && pnpm run test:ts"
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"compile": "tsc",
"build": "tsc",
"test:js": "node index.js",
"test:ts": "tsx index.ts",
"test": "pnpm run test:js && pnpm run test:ts"
Expand Down
18 changes: 8 additions & 10 deletions playgrounds/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"compile": "next build",
"test": "cypress run"
"build": "next build",
"test": "cypress install && cypress run"
},
"dependencies": {
"next": "13.5.6",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "20.11.16",
"@types/react": "18.2.55",
"@types/react-dom": "18.2.19",
"cypress": "13.6.4",
"eslint": "8.56.0",
"eslint-config-next": "14.1.0",
"typescript": "5.3.3"
"@types/node": "20.12.5",
"@types/react": "18.2.74",
"@types/react-dom": "18.2.24",
"cypress": "13.7.2",
"eslint": "8.57.0",
"eslint-config-next": "14.1.4"
}
}
2 changes: 1 addition & 1 deletion playgrounds/ts-4.7-nodenext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"compile": "tsc",
"build": "tsc",
"test": "tsx index.ts"
},
"devDependencies": {
Expand Down
11 changes: 5 additions & 6 deletions playgrounds/vite-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
"type": "commonjs",
"scripts": {
"serve": "vite",
"compile": "vue-tsc --noEmit && vite build",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "~3.4.16"
"vue": "~3.4.21"
},
"devDependencies": {
"@vitejs/plugin-vue": "~5.0.3",
"typescript": "~5.3.3",
"vite": "~5.1.0",
"vue-tsc": "~1.8.27"
"@vitejs/plugin-vue": "~5.0.4",
"vite": "~5.2.8",
"vue-tsc": "~2.0.11"
}
}
24 changes: 24 additions & 0 deletions playgrounds/vite-esm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
16 changes: 16 additions & 0 deletions playgrounds/vite-esm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Vue 3 + TypeScript + Vite

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

## Recommended IDE Setup

- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)

## Type Support For `.vue` Imports in TS

Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:

1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.

You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
12 changes: 12 additions & 0 deletions playgrounds/vite-esm/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Faker Vite CJS App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions playgrounds/vite-esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "faker-vite-esm-test",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"serve": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "~3.4.21"
},
"devDependencies": {
"@vitejs/plugin-vue": "~5.0.4",
"vite": "~5.2.8",
"vue-tsc": "~2.0.11"
}
}
75 changes: 75 additions & 0 deletions playgrounds/vite-esm/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<script setup lang="ts">
import { FakerError } from "@faker-js/faker";
import { faker } from "@faker-js/faker/locale/en";
import { ref } from "vue";
const fullName = ref(`${faker.person.firstName()} ${faker.person.lastName()}`);
const avatarUrl = ref(faker.image.avatar());
const natureImageUrl = ref(
faker.image.urlLoremFlickr({ category: "nature" }) + new FakerError("test")
);
</script>

<template>
<h1>Vite CJS Faker Demo</h1>
<div class="card">
<div class="card__image">
<img :src="natureImageUrl" :alt="'Background image for ' + fullName" />
</div>
<div class="card__profile">
<img :src="avatarUrl" :alt="'Avatar image of ' + fullName" />
</div>
<div class="card__body">
{{ fullName }}
</div>
</div>
</template>

<style>
.card {
border-radius: 4px;
width: 256px;
box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2),
0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
overflow: hidden;
}
.card__body {
padding: 64px 8px 16px;
}
.card__image {
padding-bottom: 100%;
position: relative;
border-bottom: 1px solid #888888;
}
.card__image img {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.card__profile {
position: absolute;
width: 128px;
height: 128px;
top: 256px;
left: 64px;
box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2),
0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
border-radius: 100%;
border: 1px solid #dddddd;
overflow: hidden;
}
.card__profile img {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
</style>
8 changes: 8 additions & 0 deletions playgrounds/vite-esm/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference types="vite/client" />

declare module '*.vue' {
import type { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}
4 changes: 4 additions & 0 deletions playgrounds/vite-esm/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')
18 changes: 18 additions & 0 deletions playgrounds/vite-esm/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "Node10",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
8 changes: 8 additions & 0 deletions playgrounds/vite-esm/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node10"
},
"include": ["vite.config.ts"]
}
7 changes: 7 additions & 0 deletions playgrounds/vite-esm/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()]
})
11 changes: 5 additions & 6 deletions playgrounds/webpack-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
"type": "commonjs",
"scripts": {
"serve": "vue-cli-service serve",
"compile": "vue-cli-service build"
"build": "vue-cli-service build"
},
"dependencies": {
"core-js": "~3.35.1",
"vue": "~3.4.16"
"core-js": "~3.36.1",
"vue": "~3.4.21"
},
"devDependencies": {
"@babel/core": "~7.23.9",
"@babel/core": "~7.24.4",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-typescript": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"typescript": "~5.3.3"
"@vue/cli-service": "~5.0.8"
}
}

0 comments on commit 25f027e

Please sign in to comment.