Skip to content

Commit

Permalink
Improve publish process
Browse files Browse the repository at this point in the history
  • Loading branch information
Legend-Master committed Aug 12, 2024
1 parent ac4086b commit 228564a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "docusaurus-plugin-native-ideal-image",
"version": "0.0.1",
"version": "0.0.2",
"description": "Pre-process images to multiple formats and low quality image placeholders",
"keywords": ["docusaurus"],
"author": "Tony",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/Legend-Master/docusaurus-plugin-native-ideal-image.git"
"url": "git+https://github.com/Legend-Master/docusaurus-plugin-native-ideal-image.git"
},
"homepage": "https://github.com/Legend-Master/docusaurus-plugin-native-ideal-image",
"main": "./lib/index.js",
Expand All @@ -18,7 +18,9 @@
"scripts": {
"build": "tsc -p ./src && npm run copy-css",
"watch": "tsc -p ./src --watch",
"copy-css": "node scripts/copy-css.js"
"copy-css": "node scripts/copy-css.js",
"clean-lib-folder": "node scripts/clean-lib-folder.js",
"publish": "npm run clean-lib-folder && npm run build && npm publish"
},
"devDependencies": {
"@types/loader-utils": "^2.0.6",
Expand Down
8 changes: 8 additions & 0 deletions scripts/clean-lib-folder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { existsSync } from 'node:fs'
import { rm } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'

const libDirectory = fileURLToPath(import.meta.resolve('../lib'))
if (existsSync(libDirectory)) {
await rm(libDirectory, { recursive: true })
}
8 changes: 6 additions & 2 deletions scripts/copy-css.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { copyFile } from 'fs/promises'
import { copyFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'

await copyFile('src/theme/NativeIdealImage.css', 'lib/theme/NativeIdealImage.css')
await copyFile(
fileURLToPath(import.meta.resolve('../src/theme/NativeIdealImage.css')),
fileURLToPath(import.meta.resolve('../lib/theme/NativeIdealImage.css'))
)
7 changes: 7 additions & 0 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"checkJs": true,
"noEmit": true,
}
}

0 comments on commit 228564a

Please sign in to comment.