feat!: migrate from snowpack to vite

This commit is contained in:
@lukin 2022-09-03 09:00:00 +01:00
parent 49bdda4ca9
commit 0174eeba49
13 changed files with 400 additions and 3106 deletions

View file

@ -1,20 +1,19 @@
{
"$schema": "https://json.schemastore.org/package",
"scripts": {
"build": "snowpack build",
"build": "tsc && vite build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"alpinejs": "^3.9.5"
"alpinejs": "^3.10.3"
},
"devDependencies": {
"@snowpack/plugin-postcss": "^1.4.3",
"@tailwindcss/forms": "^0.5.0",
"@types/tailwindcss": "^3.0.10",
"autoprefixer": "^10.4.4",
"cssnano": "^5.1.7",
"postcss": "^8.4.12",
"snowpack": "^3.8.8",
"tailwindcss": "^3.0.23"
"@tailwindcss/forms": "^0.5.3",
"@types/alpinejs": "^3.7.0",
"autoprefixer": "^10.4.8",
"postcss": "^8.4.16",
"tailwindcss": "^3.1.8",
"typescript": "^4.8.2",
"vite": "^3.0.9"
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,6 @@
module.exports = {
plugins: {
autoprefixer: {},
cssnano: {},
tailwindcss: {},
autoprefixer: {},
},
};

View file

@ -1,21 +0,0 @@
/**
* @type { import("snowpack").SnowpackUserConfig }
*/
module.exports = {
buildOptions: {
out: './theme/keywind/login/resources',
},
devOptions: {
tailwindConfig: './tailwind.config.js',
},
mount: {
src: '/dist',
},
optimize: {
bundle: true,
entrypoints: ['./src/index.js'],
minify: true,
target: 'es2017',
},
plugins: ['@snowpack/plugin-postcss'],
};

7
src/global.d.ts vendored Normal file
View file

@ -0,0 +1,7 @@
import type { Alpine } from 'alpinejs';
declare global {
interface Window {
Alpine: Alpine;
}
}

View file

@ -1,5 +1,7 @@
import Alpine from 'alpinejs';
import './index.css';
window.Alpine = Alpine;
Alpine.start();

View file

@ -1,7 +1,7 @@
const colors = require('tailwindcss/colors');
/**
* @type { import('@types/tailwindcss/tailwind-config').TailwindConfig }
* @type { import('tailwindcss/types').Config }
*/
module.exports = {
content: ['./theme/**/*.ftl'],

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

21
tsconfig.json Normal file
View file

@ -0,0 +1,21 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"esModuleInterop": true,
"isolatedModules": true,
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"moduleResolution": "Node",
"noEmit": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "ESNext",
"useDefineForClassFields": true
},
"include": ["src"]
}

10
tsconfig.node.json Normal file
View file

@ -0,0 +1,10 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"composite": true,
"module": "ESNext",
"moduleResolution": "Node"
},
"include": ["vite.config.ts"]
}

14
vite.config.ts Normal file
View file

@ -0,0 +1,14 @@
import { defineConfig } from 'vite';
export default defineConfig({
build: {
rollupOptions: {
input: 'src/index.ts',
output: {
assetFileNames: '[name][extname]',
dir: 'theme/keywind/login/resources/dist',
entryFileNames: '[name].js',
},
},
},
});