Skip to content

Commit

Permalink
Formatting changes after running npm run format
Browse files Browse the repository at this point in the history
  • Loading branch information
dallasjohnson committed Oct 10, 2019
1 parent 5832aca commit f25b3a7
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/cli/lamington-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const run = async () => {
}
// Start compiling smart contracts
if (!args.includes('skip-build')) {
await buildAll();
await buildAll();
}
// Begin running tests
await runTests();
Expand Down
17 changes: 7 additions & 10 deletions src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,21 @@ export const buildImage = async () => {
await rimraf(TEMP_DOCKER_DIRECTORY);
await mkdirp(TEMP_DOCKER_DIRECTORY);
// Write a Dockerfile so Docker knows what to build.
const systemDeps = [
'build-essential',
'ca-certificates',
'cmake',
'curl',
'git',
'wget',
]
const systemDeps = ['build-essential', 'ca-certificates', 'cmake', 'curl', 'git', 'wget'];
await writeFile(
path.join(TEMP_DOCKER_DIRECTORY, 'Dockerfile'),
`
FROM ubuntu:18.04
RUN apt-get update --fix-missing && apt-get install -y --no-install-recommends ${systemDeps.join(' ')}
RUN apt-get update --fix-missing && apt-get install -y --no-install-recommends ${systemDeps.join(
' '
)}
RUN wget ${ConfigManager.cdt} && apt-get install -y ./*.deb && rm -f *.deb
RUN wget ${ConfigManager.eos} && apt-get install -y ./*.deb && rm -f *.deb
RUN eos_ver=$(ls /usr/opt/eosio | head -n 1); \
git clone --depth 1 --branch ${ConfigManager.contracts} https://github.com/EOSIO/eosio.contracts.git /usr/opt/eosio.contracts &&\
git clone --depth 1 --branch ${
ConfigManager.contracts
} https://github.com/EOSIO/eosio.contracts.git /usr/opt/eosio.contracts &&\
cd /usr/opt/eosio.contracts && ./build.sh -e "/usr/opt/eosio/$eos_ver" -c /usr/opt/eosio.cdt
RUN apt-get clean && rm -rf /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/*
`.replace(/\t/gm, '')
Expand Down
16 changes: 10 additions & 6 deletions src/configManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export enum LamingtonDebugLevel {
* values by specifying them in their `.lamingtonrc`
*/
const DEFAULT_CONFIG = {
eos:'',
cdt:'',
contracts:'v1.8.0-rc1',
debug:LamingtonDebugLevel.NONE,
eos: '',
cdt: '',
contracts: 'v1.8.0-rc1',
debug: LamingtonDebugLevel.NONE,
debugTransactions: false,
keepAlive: false,
outDir: CACHE_DIRECTORY,
Expand Down Expand Up @@ -117,7 +117,7 @@ export class ConfigManager {
return asset.browser_download_url as string;
}

public static async isValidConfig(config:object) {
public static async isValidConfig(config: object) {
return true;
}

Expand All @@ -129,7 +129,11 @@ export class ConfigManager {
*/
public static async createConfigIfMissing(atPath = CONFIGURATION_FILE_NAME) {
// Prevent overwriting existing configuration when valid
if (await ConfigManager.configExists(atPath) && await ConfigManager.isValidConfig(ConfigManager.config)) return;
if (
(await ConfigManager.configExists(atPath)) &&
(await ConfigManager.isValidConfig(ConfigManager.config))
)
return;
// Create the config directory
await mkdirp(CACHE_DIRECTORY);
// Fetch the latest repository configuration
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class Contract implements EOSJSContract {
if (options.from && options.from instanceof Account) {
authorization = options.from.active;

// Ensure we have the key to sign with.
// Ensure we have the key to sign with.
EOSManager.addSigningAccountIfMissing(options.from);
} else if (options.auths && options.auths instanceof Array) {
authorization = options.auths;
Expand Down
8 changes: 1 addition & 7 deletions src/contracts/typeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,7 @@ export const generateTypes = async (contractIdentifier: string) => {
'',
];
// Define imports
const imports = [
'Account',
'Contract',
'GetTableRowsOptions',
'ExtendedAsset',
'ExtendedSymbol',
];
const imports = ['Account', 'Contract', 'GetTableRowsOptions', 'ExtendedAsset', 'ExtendedSymbol'];
if (contractTables.length > 0) imports.push('TableRowsResult');
// Generate import definitions
result.push(`import { ${imports.join(', ')} } from 'lamington';`);
Expand Down
49 changes: 27 additions & 22 deletions src/project/projectManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ const DEFAULT_SCRIPTS = {

/** Required project dependencies */
const DEFAULT_DEV_DEPENDENCIES = {
'lamington': 'latest',
'chai':'latest',
'@types/chai':'latest',
'@types/mocha':'latest'
lamington: 'latest',
chai: 'latest',
'@types/chai': 'latest',
'@types/mocha': 'latest',
};

/**
Expand Down Expand Up @@ -149,24 +149,29 @@ export class ProjectManager {
// Ensure tmp directory exists and capture directory path
const tmpPath = await ProjectManager.createDirectoryIfMissing('__tmp__');
// Stream the repo clone and untar
got.stream(cloneUrl).pipe(tar.extract({
cwd: tmpPath,
strip:1
})).on('error', (error:Error) => {
reject(error);
}).on('end', async () => {
// Clone example repository into tmp
const clonedFiles = await readdir(tmpPath);
if (clonedFiles.length <= 0)
throw new Error(`No files cloned from repo ${cloneUrl}`);
// Merge example contracts into current project
await ncp(path.join(tmpPath, 'contracts'), path.join(process.cwd(), 'contracts'));
// Cleanup temporary directory
spinner.update('Cleaning temporary files');
await rimraf(tmpPath);
spinner.end('Created example contracts');
resolve(true);
});
got
.stream(cloneUrl)
.pipe(
tar.extract({
cwd: tmpPath,
strip: 1,
})
)
.on('error', (error: Error) => {
reject(error);
})
.on('end', async () => {
// Clone example repository into tmp
const clonedFiles = await readdir(tmpPath);
if (clonedFiles.length <= 0) throw new Error(`No files cloned from repo ${cloneUrl}`);
// Merge example contracts into current project
await ncp(path.join(tmpPath, 'contracts'), path.join(process.cwd(), 'contracts'));
// Cleanup temporary directory
spinner.update('Cleaning temporary files');
await rimraf(tmpPath);
spinner.end('Created example contracts');
resolve(true);
});
});
} catch (error) {
spinner.fail('Failed to clone repository');
Expand Down

0 comments on commit f25b3a7

Please sign in to comment.