Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
chore: Updated build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Mar 7, 2022
1 parent 8de697f commit 6e4b7b0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
12 changes: 12 additions & 0 deletions .swcrc
@@ -0,0 +1,12 @@
{
"env": {
"targets": "node >= 16"
},
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": false,
"dynamicImport": true
}
}
}
24 changes: 14 additions & 10 deletions package.json
Expand Up @@ -27,26 +27,30 @@
"typings": "./types/index.d.ts",
"types": "./types/index.d.ts",
"scripts": {
"prebuild": "rm -rf dist types && npm run lint",
"build": "tsc -p . && esm-pkg-add-imports-extensions dist",
"dev": "swc -w -d dist src",
"prebuild": "rm -rf dist types && npm run typecheck && npm run lint",
"build": "swc --delete-dir-on-start -d dist src",
"format": "prettier -w src",
"typecheck": "tsc -p . --emitDeclarationOnly",
"lint": "eslint src",
"ci": "npm run lint",
"ci": "npm run build && npm run lint",
"prepublishOnly": "npm run ci",
"postpublish": "git push origin && git push origin -f --tags"
},
"dependencies": {
"webpack": "^5.51.1"
"webpack": "^5.70.0"
},
"devDependencies": {
"@cowtech/eslint-config": "^8.0.1",
"@cowtech/esm-package-utils": "^0.9.3",
"@types/node": "^17.0.2",
"prettier": "^2.3.2",
"typescript": "^4.3.5"
"@cowtech/eslint-config": "^8.4.0",
"@swc/cli": "^0.1.55",
"@swc/core": "^1.2.150",
"@types/node": "^17.0.21",
"chokidar": "^3.5.3",
"prettier": "^2.5.1",
"typescript": "^4.6.2"
},
"peerDependencies": {
"typescript": "^4.3.5"
"typescript": "^4.6.2"
},
"engines": {
"node": ">=14.15.0"
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
@@ -1,11 +1,11 @@
import { sep } from 'path'
import { sep } from 'node:path'
import { Compilation } from 'webpack'

export const cacheName = '@cowtech/webpack'

export const imagesExtensions = /\.(?:bmp|png|jpg|jpeg|gif|svg|webp)$/

export const scriptUrlSuffix = /-(?:(?:[a-f0-9]+)\.mjs)$/i
export const scriptUrlSuffix = /-[\da-f]+\.mjs$/i

export async function getManifestUrl(compilation: Compilation): Promise<string> {
const url = await compilation.getCache(cacheName).getPromise<string>('html-webpack-tracker-plugin:manifest', null)
Expand All @@ -30,7 +30,7 @@ export function normalizeAssetPath({ filename }: { filename?: string }): string
export function generateVersion(): string {
return new Date()
.toISOString()
.replace(/([-:])|(\.\d+Z$)/g, '')
.replace(/([:-])|(\.\d+Z$)/g, '')
.replace('T', '.')
}

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ES2021",
"module": "ESNext",
"moduleResolution": "node",
"jsx": "preserve",
Expand Down

0 comments on commit 6e4b7b0

Please sign in to comment.