Skip to content

Commit

Permalink
Build to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Dec 6, 2020
1 parent 667f979 commit 92dab72
Show file tree
Hide file tree
Showing 6 changed files with 5,935 additions and 14 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
# This job runs when a new release is published
release:
types: [ published ]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
- run: npm ci

# Store the name of the release
# See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- run: npm version $RELEASE_VERSION --no-git-tag-version

- name: Compile the source code
run: node esbuild.js

- name: Copy package.json
run: cp package.json dist/package.json

- env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish
run: cd dist && npm publish --access public
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install -g lift
$ lift COMMAND
running command...
$ lift (-v|--version|version)
lift/0.0.1 darwin-x64 node-v14.7.0
lift/0.0.1 darwin-x64 node-v15.3.0
$ lift --help [COMMAND]
USAGE
$ lift COMMAND
Expand Down
24 changes: 24 additions & 0 deletions bin/lift.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node

import '../src/commands/export';
import '../src/commands/permissions';
import '../src/commands/remove';
import '../src/commands/status';
import '../src/commands/up';
import '../src/commands/variables';

require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch((err: any) => {
const oclifHandler = require('@oclif/errors/handle');

// Show errors with stack traces
// try {
// const clean = require("clean-stack");
// console.error(clean(err.stack || '', { pretty: true }));
// } catch (e) {
// console.error(e);
// }

return oclifHandler(err);
})
15 changes: 15 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const fs = require('fs');
const localPkgJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));

require('esbuild').build({
entryPoints: ['bin/lift.ts'],
bundle: true,
platform: 'node',
outfile: 'dist/lift',
minify: true,
external: Object.keys({
...(localPkgJson.dependencies || {}),
...(localPkgJson.devDependencies || {}),
...(localPkgJson.peerDependencies || {})
})
});
Loading

0 comments on commit 92dab72

Please sign in to comment.