-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8cdf19c
commit 29c628f
Showing
14 changed files
with
87 additions
and
26 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,9 @@ | ||
const { removeSync, pathExistsSync, moveSync } = require('fs-extra') | ||
|
||
if (pathExistsSync('./package.json')) { | ||
removeSync('./package.json') | ||
} | ||
|
||
if (pathExistsSync('./package.backup.json')) { | ||
moveSync('./package.backup.json', './package.json') | ||
} |
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,36 @@ | ||
const { writeFileSync, copySync, pathExistsSync } = require('fs-extra') | ||
const yargs = require('yargs/yargs') | ||
const { hideBin } = require('yargs/helpers') | ||
const argv = yargs(hideBin(process.argv)).argv | ||
|
||
let pkg = require('../package.json') | ||
|
||
const development = argv.dev | ||
const production = argv.prod | ||
|
||
if (!development && !production) { | ||
throw new Error('Unknown environment.') | ||
} | ||
|
||
let version = '0.1.' + ~~(Date.now() / 1000) | ||
let name = '@aaron-dev/torchlight-cli' | ||
|
||
if (production) { | ||
// Populated by GitHub actions | ||
version = process.env.PACKAGE_VERSION | ||
name = '@torchlight-api/torchlight-cli' | ||
} | ||
|
||
if (pathExistsSync('./package.backup.json')) { | ||
throw new Error('package.backup.json already exists, not overwriting.') | ||
} | ||
|
||
copySync('./package.json', './package.backup.json') | ||
|
||
pkg = { | ||
...pkg, | ||
name, | ||
version: version | ||
} | ||
|
||
writeFileSync('./package.json', JSON.stringify(pkg, null, 2)) |
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,15 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if [ "$1" != "dev" ] && [ "$1" != "prod" ]; then | ||
echo "The first argument must be 'dev' or 'prod'." | ||
exit | ||
fi | ||
|
||
set -x | ||
|
||
yarn run build | ||
node ./bin/prepublish.js --"$1" | ||
npm publish --access public | ||
node ./bin/postpublish.js --"$1" |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#! /usr/bin/env node | ||
import { makeProgram } from '../cli' | ||
import { makeProgram } from '../cli.js' | ||
|
||
makeProgram().parse() |
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
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
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
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