diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7550e11..313eb49 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,7 @@ jobs: with: node-version: '14.x' - run: npm i + - run: npm run build # Setup .npmrc file to publish to npm registry - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc - run: npm publish \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0433bbc..78ea834 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .idea package-lock.json +dist diff --git a/package.json b/package.json index 6b97bac..8450cbd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,15 @@ "main": "index.js", "author": "Bigcommerce", "license": "BSD-4-Clause", + "files": [ + "dist/", + "helpers/", + "lib/", + "helpers.js", + "index.js" + ], "scripts": { + "build": "webpack", "lint": "eslint .", "lint-and-fix": "eslint . --fix", "test": "lab -v -t 97.4 --ignore FinalizationRegistry,WeakRef,WebAssembly,_time,format,SharedArrayBuffer,Atomics,BigUint64Array,BigInt64Array,BigInt,URL,URLSearchParams,TextEncoder,TextDecoder,queueMicrotask spec", @@ -39,7 +47,11 @@ "eslint": "^7.8.1", "highlight.js": "^11.6.0", "lab": "~13.0.4", - "sinon": "~7.5.0" + "path-browserify": "^1.0.1", + "sinon": "~7.5.0", + "url": "^0.11.0", + "webpack": "^5.74.0", + "webpack-cli": "^4.10.0" }, "engines": { "node": ">=10" diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..151ac35 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,23 @@ +const path = require('path'); + +module.exports = { + entry: './index.js', + mode: 'production', + devtool: false, + output: { + filename: 'blackbird-handlebars.js', + path: path.resolve(__dirname, 'dist'), + library: 'BlackbirdHandlebars', + }, + resolve: + { + fallback: { + "path": require.resolve("path-browserify"), + "url": require.resolve("url/") + }, + alias: { + 'handlebars-v4': 'handlebars-v4/dist/handlebars.js', + 'handlebars': 'handlebars/dist/handlebars.js' + } + }, +}; \ No newline at end of file