-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip: good-id modal * remove children * wip: user can delete faceId * temp: disable login-sdk for dev-release * fully disable login-sdk from dev-release * Dev version beta.3c0c9bd released * fix eslint undef not triggering, some minor requested ui changes * Dev version beta.731cdbb released * apply review requests * add flag handler for skipping loginsdk for dev-release * fix: apply requested ui changes
- Loading branch information
Showing
12 changed files
with
393 additions
and
223 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,74 +1,91 @@ | ||
#!/usr/bin/env node | ||
|
||
const { exec } = require('child_process') | ||
const { writeFile } = require('fs') | ||
const { promisify } = require('util') | ||
const { exec } = require("child_process"); | ||
const { writeFile } = require("fs"); | ||
const { promisify } = require("util"); | ||
|
||
const pkgDir = pkg => `./packages/${pkg}` | ||
const pkgPath = pkg => `${pkgDir(pkg)}/package.json` | ||
const pkgDir = pkg => `./packages/${pkg}`; | ||
const pkgPath = pkg => `${pkgDir(pkg)}/package.json`; | ||
|
||
const v2pkg = require(pkgPath('sdk-v2')) | ||
const loginpkg = require(pkgPath('login-sdk')) | ||
const designpkg = require(pkgPath('good-design')) | ||
const v2pkg = require(pkgPath("sdk-v2")); | ||
const loginpkg = require(pkgPath("login-sdk")); | ||
const designpkg = require(pkgPath("good-design")); | ||
|
||
const execAsync = promisify(exec) | ||
const writeFileAsync = promisify(writeFile) | ||
const execAsync = promisify(exec); | ||
const writeFileAsync = promisify(writeFile); | ||
|
||
const run = (cmd, opts = {}) => execAsync(cmd, opts).then(({ stdout }) => stdout) | ||
const run = (cmd, opts = {}) => execAsync(cmd, opts).then(({ stdout }) => stdout); | ||
const updateVersion = (version, suffix) => { | ||
let [full, major, minor, patch, flags] = version.match(/^(\d+)\.(\d+)\.(\d+)(-beta)?.*$/); | ||
|
||
if (!flags) { | ||
patch = Number(patch) + 1; | ||
} | ||
return [major, minor, patch].join('.') + suffix; | ||
|
||
return [major, minor, patch].join(".") + suffix; | ||
}; | ||
|
||
const writePkg = async (pkg, json) => { | ||
const contents = JSON.stringify(json, null, 2) | ||
const path = pkgPath(pkg) | ||
|
||
await writeFileAsync(path, contents) | ||
} | ||
|
||
;(async () => { | ||
const commit = await run("git rev-parse --short HEAD") | ||
const suffix = `-beta.${commit.trimEnd()}` | ||
|
||
console.log('1. Update sdk-v2 version') | ||
v2pkg.version = updateVersion(v2pkg.version, suffix) | ||
await writePkg('sdk-v2', v2pkg) | ||
|
||
console.log('2. Build sdk-v2') | ||
await run('yarn workspace @gooddollar/web3sdk-v2 install') | ||
await run('yarn workspace @gooddollar/web3sdk-v2 build') | ||
|
||
console.log('3. Publish sdk-v2') | ||
await run('npm publish --access public --tag beta', { cwd: pkgDir('sdk-v2') }) | ||
|
||
console.log('4. Update design/login versions & deps') | ||
;[designpkg, loginpkg].forEach(pkg => { | ||
pkg.version = updateVersion(pkg.version, suffix) | ||
pkg.devDependencies["@gooddollar/web3sdk-v2"] = v2pkg.version | ||
}) | ||
await writePkg('good-design', designpkg) | ||
await writePkg('login-sdk', loginpkg) | ||
|
||
console.log('5. Build design & login SDKs') | ||
await run('yarn workspace @gooddollar/good-design install') | ||
await run('yarn workspace @gooddollar/good-design build') | ||
await run('yarn workspace @gooddollar/goodlogin-sdk install') | ||
await run('yarn workspace @gooddollar/goodlogin-sdk build') | ||
|
||
console.log('6. Publish design & login SDKs') | ||
await run('npm publish --access public --tag beta', { cwd: pkgDir('good-design') }) | ||
await run('npm publish --access public --tag beta', { cwd: pkgDir('login-sdk') }) | ||
|
||
console.log('7. Commit changes') | ||
const msg = `Dev version ${suffix.substring(1)} released` | ||
await run('git add .') | ||
await run(`git commit -m '${msg}' -n`) | ||
await run('git push') | ||
console.log(msg) | ||
})() | ||
const contents = JSON.stringify(json, null, 2); | ||
const path = pkgPath(pkg); | ||
|
||
await writeFileAsync(path, contents); | ||
}; | ||
|
||
const args = process.argv.slice(2); | ||
|
||
(async () => { | ||
const commit = await run("git rev-parse --short HEAD"); | ||
const suffix = `-beta.${commit.trimEnd()}`; | ||
|
||
console.log("1. Update sdk-v2 version"); | ||
v2pkg.version = updateVersion(v2pkg.version, suffix); | ||
await writePkg("sdk-v2", v2pkg); | ||
|
||
console.log("2. Build sdk-v2"); | ||
await run("yarn workspace @gooddollar/web3sdk-v2 install"); | ||
await run("yarn workspace @gooddollar/web3sdk-v2 build"); | ||
|
||
console.log("3. Publish sdk-v2"); | ||
await run("npm publish --access public --tag beta", { cwd: pkgDir("sdk-v2") }); | ||
|
||
const skipLogin = args.includes("--skip-login"); | ||
|
||
console.log("4. Update design/login versions & deps"); | ||
const pkgToUpdate = [designpkg]; | ||
|
||
if (!skipLogin) { | ||
pkgToUpdate.push(loginpkg); | ||
} | ||
|
||
pkgToUpdate.forEach(pkg => { | ||
pkg.version = updateVersion(pkg.version, suffix); | ||
pkg.devDependencies["@gooddollar/web3sdk-v2"] = v2pkg.version; | ||
}); | ||
|
||
console.log("4.1. Write updated package.json"); | ||
|
||
await writePkg("good-design", designpkg); | ||
if (!skipLogin) await writePkg("login-sdk", loginpkg); | ||
|
||
console.log("5. Build design & login SDKs"); | ||
await run("yarn workspace @gooddollar/good-design install"); | ||
await run("yarn workspace @gooddollar/good-design build"); | ||
|
||
if (!skipLogin) { | ||
await run("yarn workspace @gooddollar/goodlogin-sdk install"); | ||
await run("yarn workspace @gooddollar/goodlogin-sdk build"); | ||
} | ||
|
||
console.log("6. Publish design & login SDKs"); | ||
await run("npm publish --access public --tag beta", { cwd: pkgDir("good-design") }); | ||
|
||
if (!skipLogin) await run("npm publish --access public --tag beta", { cwd: pkgDir("login-sdk") }); | ||
|
||
console.log("7. Commit changes"); | ||
const msg = `Dev version ${suffix.substring(1)} released`; | ||
await run("git add ."); | ||
await run(`git commit -m '${msg}' -n`); | ||
await run("git push"); | ||
console.log(msg); | ||
})(); |
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
Oops, something went wrong.