-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix publish to S3
- Loading branch information
Vasil Chimev
authored
Jun 30, 2017
1 parent
e50a7fc
commit 895e0bf
Showing
2 changed files
with
33 additions
and
37 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
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,25 +1,21 @@ | ||
#!/usr/bin/env node | ||
|
||
var fsModule = require("fs"); | ||
const fsModule = require("fs"); | ||
const path = "./package.json"; | ||
const fileOptions = {encoding: "utf-8"}; | ||
const content = fsModule.readFileSync(path, fileOptions); | ||
|
||
// Adds a publishConfig section to the package.json file | ||
// and sets a tag to it | ||
|
||
var path = "./package.json"; | ||
var fileOptions = {encoding: "utf-8"}; | ||
var content = fsModule.readFileSync(path, fileOptions); | ||
|
||
var packageDef = JSON.parse(content); | ||
const packageDef = JSON.parse(content); | ||
if (!packageDef.publishConfig) { | ||
packageDef.publishConfig = {}; | ||
} | ||
|
||
var branch = process.argv[2]; | ||
const branch = process.argv[2]; | ||
if (!branch) { | ||
console.log("Please pass the branch name as an argument!"); | ||
process.exit(1); | ||
} | ||
packageDef.publishConfig.tag = branch === "release" ? "rc" : "next"; | ||
|
||
var newContent = JSON.stringify(packageDef, null, " "); | ||
const newContent = JSON.stringify(packageDef, null, " "); | ||
fsModule.writeFileSync(path, newContent, fileOptions); |