-
Notifications
You must be signed in to change notification settings - Fork 227
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
671ea78
commit b8069f9
Showing
13 changed files
with
1,497 additions
and
71 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 |
---|---|---|
|
@@ -75,3 +75,4 @@ integration-test/transform-tests/output | |
|
||
# generated Sphinx/ReadTheDocs files | ||
/docs/build/ | ||
/foo |
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,8 +1,12 @@ | ||
# New Repo | ||
# Agoric Javascript Smart Contract Platform | ||
|
||
This repository should be a compilation of everything that a new | ||
Agoric repo should have, including ESLint settings, prettier settings, | ||
package.json dependencies and scripts, licenses, sample tests, CircleCI config, and | ||
VSCode testing config. | ||
## Getting Started | ||
|
||
See [SETUP-DELETEME](SETUP-DELETEME.md) for starting steps. | ||
```sh | ||
agoric init dapp | ||
# agoric init --ui=react dapp | ||
cd dapp | ||
agoric start | ||
agoric deploy | ||
# Navigate to http://localhost:8000/ | ||
``` |
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,75 @@ | ||
import parseArgs from 'minimist'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
import templateMain from './template'; | ||
|
||
export default async function initMain(progname, rawArgs, priv) { | ||
const { console, error } = priv; | ||
const { | ||
_: args, | ||
} = parseArgs(rawArgs); | ||
|
||
if (args.length !== 1) { | ||
error(`you must specify exactly one DIR`); | ||
} | ||
const [DIR] = args; | ||
|
||
const { mkdir, stat, lstat, symlink, readdir, readFile, writeFile } = fs.promises; | ||
|
||
console.log(`initializing ${DIR}`); | ||
await mkdir(DIR); | ||
|
||
const templateDir = `${__dirname}/../template`; | ||
const writeTemplate = async stem => { | ||
const template = await readFile(`${templateDir}${stem}`, 'utf-8'); | ||
const content = template.replace(/['"]@DIR@['"]/g, JSON.stringify(DIR)).replace(/@DIR@/g, DIR); | ||
return writeFile(`${DIR}${stem}`, content); | ||
} | ||
|
||
const recursiveTemplate = async (templateDir, suffix = '') => { | ||
const cur = `${templateDir}${suffix}`; | ||
const list = await readdir(cur); | ||
await Promise.all(list.map(async name => { | ||
const stem = `${suffix}/${name}`; | ||
const st = await lstat(`${templateDir}${stem}`); | ||
let target; | ||
try { | ||
target = await stat(`${DIR}${stem}`); | ||
} catch (e) {} | ||
if (target) { | ||
return; | ||
} | ||
if (st.isDirectory()) { | ||
console.log(`mkdir ${DIR}${stem}`); | ||
await mkdir(`${DIR}${stem}`); | ||
await recursiveTemplate(templateDir, `${stem}`) | ||
} else { | ||
console.log(`write ${DIR}${stem}`); | ||
await writeTemplate(stem); | ||
} | ||
})); | ||
}; | ||
await recursiveTemplate(templateDir); | ||
|
||
const agservers = path.join(DIR, '.agservers'); | ||
await mkdir(agservers); | ||
|
||
const solo = path.join(agservers, 'solo'); | ||
const chain = path.join(agservers, 'chain'); | ||
await Promise.all([mkdir(solo), mkdir(chain)]); | ||
const chainSolo = path.join(chain, 'solo'); | ||
const chainCosmos = path.join(chain, 'cosmos'); | ||
await Promise.all([mkdir(chainSolo), mkdir(chainCosmos)]); | ||
|
||
// Create links to all the solo nodes' html directories. | ||
await Promise.all([ | ||
mkdir(`${chainSolo}/html`), | ||
mkdir(`${solo}/html`), | ||
]) | ||
|
||
await Promise.all([ | ||
symlink('../../../ui/build', `${chainSolo}/dapp-html`), | ||
symlink('../../ui/build', `${solo}/dapp-html`), | ||
]); | ||
} |
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
Empty file.
Empty file.
Oops, something went wrong.