-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from SDFIdk/npm-setup
Setup for NPM publish
- Loading branch information
Showing
23 changed files
with
265 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- run: npm ci | ||
- run: npm test | ||
|
||
# Important note: | ||
# This only works in github actions when you've added an "automation token" by the name of "NPM_TOKEN" to "repository secrets" | ||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: https://registry.npmjs.org | ||
- run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import esbuild from 'esbuild' | ||
import { stylusLoader } from 'esbuild-stylus-loader' | ||
|
||
const entry_points = { | ||
index: 'src/Index.js' | ||
} | ||
|
||
console.log('--------------------------') | ||
console.log('Building ES module') | ||
|
||
// Production build | ||
|
||
esbuild.build({ | ||
entryPoints: ['src/Index.js'], | ||
outfile: 'dist/index.js', | ||
bundle: true, | ||
minify: true, | ||
format: 'esm', | ||
sourcemap: true, | ||
loader: { | ||
'.png': 'dataurl' | ||
}, | ||
plugins: [ | ||
stylusLoader() | ||
] | ||
}) | ||
.then((response) => { | ||
console.log('Build finished. `dist` updated 👍') | ||
}) | ||
.catch(() => process.exit(1)) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.