diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 48f7561..2d06c79 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,23 +28,10 @@ jobs: if: ${{ steps.release.outputs.release_created }} - run: wasm-pack pack if: ${{ steps.release.outputs.release_created }} - - name: Update Package Name - if: ${{ steps.release.outputs.release_created }} - run: | - new_name="@scuderia-fe/docx-to-html" - if [ -d "pkg" ]; then - cd pkg || exit - if [ -f "package.json" ]; then - # Update the "name" field in package.json - sed -i "s/\"name\": \".*\",/\"name\": \"$new_name\",/" package.json - echo "Package name updated to $new_name" - else - echo "Error: package.json not found in the pkg folder." - fi - cd .. - else - echo "Error: pkg folder not found." - fi + - uses: oven-sh/setup-bun@v1 + if: ${{ steps.release.outputs.release_created }} + - run: bun rename + if: ${{ steps.release.outputs.release_created }} - run: wasm-pack publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.gitignore b/.gitignore index 70d35ae..f9ad151 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,10 @@ target # WASM -!pkg/package.json +pkg + +# Node +node_modules # NPMJS .npmrc diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..8b02581 Binary files /dev/null and b/bun.lockb differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..83ae75b --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "docx-to-html", + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "simple-git-hooks": { + "commit-msg": "bun commitlint --edit ${1}" + }, + "scripts": { + "rename": "bun scripts/rename.mjs" + }, + "devDependencies": { + "@types/bun": "latest", + "@commitlint/cli": "^18.4.4", + "@commitlint/config-conventional": "^18.4.4", + "simple-git-hooks": "^2.9.0" + } +} diff --git a/scripts/rename.mjs b/scripts/rename.mjs new file mode 100644 index 0000000..a4cde39 --- /dev/null +++ b/scripts/rename.mjs @@ -0,0 +1,16 @@ +import fs from "fs"; +import { join } from "path"; + +const packageJson = fs.readFileSync( + join(process.cwd(), "pkg", "package.json"), + "utf8" +); + +const pkgJson = JSON.parse(packageJson); +pkgJson.name = "@scuderia-fe/docx-to-html"; + +fs.writeFileSync( + join(process.cwd(), "pkg", "package.json"), + JSON.stringify(pkgJson, null, 2), + "utf8" +); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..dcd8fc5 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "lib": ["ESNext"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + /* Linting */ + "skipLibCheck": true, + "strict": true, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true + } +}