Skip to content

Commit

Permalink
Reformat the whole repo with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-toolkit-automation authored and hunterwerlla committed Aug 16, 2019
1 parent 8f8934b commit e003b28
Show file tree
Hide file tree
Showing 201 changed files with 3,121 additions and 4,041 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"type": "Bug Fix",
"description": "Creating SAM Applications into a different folder than the current VS Code workspaces will now open an application file after app creation (#678)"
}
"type": "Bug Fix",
"description": "Creating SAM Applications into a different folder than the current VS Code workspaces will now open an application file after app creation (#678)"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"type": "Feature",
"description": "Improved the description of the selection item when picking a location for a new SAM Application (#673, #675)"
}
"type": "Feature",
"description": "Improved the description of the selection item when picking a location for a new SAM Application (#673, #675)"
}
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
out
resources/endpoints.json
third-party/**
CHANGELOG.md
src/shared/telemetry/service-2.json
22 changes: 11 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
language: node_js

node_js:
- "lts/*"
node_js:
- 'lts/*'

matrix:
include:
- os: linux
dist: bionic
- os: osx
include:
- os: linux
dist: bionic
- os: osx

services:
- xvfb
- xvfb

script:
- npm install
- npm run vscode:prepublish
- npm test
- npm install
- npm run vscode:prepublish
- npm test

after_success:
- bash <(curl -s https://codecov.io/bash) -s .coverage
- bash <(curl -s https://codecov.io/bash) -s .coverage
18 changes: 5 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "npm: watch"
},
{
Expand All @@ -27,9 +23,7 @@
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/src/test"
],
"outFiles": [
"${workspaceFolder}/out/src/test/**/*.js"
],
"outFiles": ["${workspaceFolder}/out/src/test/**/*.js"],
"preLaunchTask": "npm: watch"
},
{
Expand All @@ -42,10 +36,8 @@
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/src/integrationTest"
],
"outFiles": [
"${workspaceFolder}/out/src/integrationTest/**/*.js"
],
"outFiles": ["${workspaceFolder}/out/src/integrationTest/**/*.js"],
"preLaunchTask": "npm: watch"
}
]
}
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
}
}
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
"problemMatcher": []
}
]
}
}
42 changes: 21 additions & 21 deletions build-scripts/bundleDeps.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
'use strict';
'use strict'
/*
This script is called from npm run compile.
It adds clientside libraries to ./media/libs.
*/
const fs = require('fs-extra');
const path = require('path');
const _ = require('lodash');
const fs = require('fs-extra')
const path = require('path')
const _ = require('lodash')

const JS_DEPS = [
{
name: 'vue.min.js',
path: 'vue/dist/vue.min.js'
}
];
const WORKING_DIR = path.join(__dirname, '..');
const NODE_MODULES_DIR = path.join(WORKING_DIR, 'node_modules');
const LIBRARY_DIR = path.join(WORKING_DIR, 'media', 'libs');
(async () => {
const work = [];
copy(JS_DEPS, LIBRARY_DIR, work);
]
const WORKING_DIR = path.join(__dirname, '..')
const NODE_MODULES_DIR = path.join(WORKING_DIR, 'node_modules')
const LIBRARY_DIR = path.join(WORKING_DIR, 'media', 'libs')
;(async () => {
const work = []
copy(JS_DEPS, LIBRARY_DIR, work)
try {
await Promise.all(work);
console.log('Successfully copied all clientside dependencies.');
await Promise.all(work)
console.log('Successfully copied all clientside dependencies.')
} catch (e) {
console.error('Error when copying clientside dependencies.');
console.error(e);
console.error('Error when copying clientside dependencies.')
console.error(e)
}

function copy(deps, destinationPath, workArr) {
_.forEach(deps, (dep) => {
const depPath = path.join(NODE_MODULES_DIR, dep.path);
console.log(`Copying ${depPath} to ${destinationPath}`);
workArr.push(fs.copy(depPath, path.join(destinationPath, dep.name)));
});
_.forEach(deps, dep => {
const depPath = path.join(NODE_MODULES_DIR, dep.path)
console.log(`Copying ${depPath} to ${destinationPath}`)
workArr.push(fs.copy(depPath, path.join(destinationPath, dep.name)))
})
}
})();
})()
41 changes: 21 additions & 20 deletions build-scripts/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
'use strict'

/*
* This script removes the specified folders.
* This script removes the specified folders.
* Used to perform a clean compile, which is useful for things like:
* - flushing out stale test files.
* - updating dependencies after changing branches
*/

const fs = require('fs');
const _path = require('path');
const fs = require('fs')
const _path = require('path')
const util = require('util')

const readdir = util.promisify(fs.readdir)
Expand All @@ -24,39 +24,40 @@ const unlink = util.promisify(fs.unlink)
// Recursive delete without requiring a third-party library. This allows the script
// to be run before `npm install`.
async function rdelete(path) {
const stats = await stat(path);
const stats = await stat(path)
if (stats.isFile()) {
await unlink(path);
await unlink(path)
} else if (stats.isDirectory()) {
const promises = (await readdir(path))
.map(child => rdelete(_path.join(path, child)));
const promises = (await readdir(path)).map(child => rdelete(_path.join(path, child)))

await Promise.all(promises);
await rmdir(path);
await Promise.all(promises)
await rmdir(path)
} else {
throw new Error(`Could not delete '${path}' because it is neither a file nor directory`);
throw new Error(`Could not delete '${path}' because it is neither a file nor directory`)
}
}

(async () => {
;(async () => {
for (const arg of process.argv.slice(2)) {
try {
const directory = _path.join(__dirname, '..', arg);
const directory = _path.join(__dirname, '..', arg)

try {
fs.accessSync(directory);
fs.accessSync(directory)
} catch (e) {
console.log(`Could not access '${directory}', probably because it does not exist. Skipping clean for this directory.`);
return;
console.log(
`Could not access '${directory}', probably because it does not exist. Skipping clean for this directory.`
)
return
}

console.log(`Removing ${directory} ...`);
console.log(`Removing ${directory} ...`)

await rdelete(directory);
await rdelete(directory)

console.log('Done');
console.log('Done')
} catch (e) {
console.error(`Could not clean '${arg}': ${String(e)}`);
console.error(`Could not clean '${arg}': ${String(e)}`)
}
}
})();
})()
33 changes: 13 additions & 20 deletions build-scripts/copyNonCodeFiles.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
'use strict';
'use strict'

/*
This script is called from npm run compile. It copies the
files and directories listed in `relativePaths` to `out/`.
*/

const fs = require('fs-extra');
const path = require('path');
const fs = require('fs-extra')
const path = require('path')

const repoRoot = path.dirname(__dirname);
const outRoot = path.join(repoRoot, 'out');
const repoRoot = path.dirname(__dirname)
const outRoot = path.join(repoRoot, 'out')

// May be individual files or entire directories.
const relativePaths = [
path.join('src', 'schemas'),
path.join('src', 'test', 'shared', 'cloudformation', 'yaml')
];
const relativePaths = [path.join('src', 'schemas'), path.join('src', 'test', 'shared', 'cloudformation', 'yaml')]

(async () => {
;(async () => {
for (const relativePath of relativePaths) {
await fs.copy(
path.join(repoRoot, relativePath),
path.join(outRoot, relativePath),
{
recursive: true,
overwrite: true,
errorOnExist: false,
}
);
await fs.copy(path.join(repoRoot, relativePath), path.join(outRoot, relativePath), {
recursive: true,
overwrite: true,
errorOnExist: false
})
}
})();
})()
2 changes: 1 addition & 1 deletion build-scripts/createRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for (const changeFile of changeFiles) {
}

// tslint:disable-next-line: no-unsafe-any
changelog.entries.sort((x: {type: string}, y: {type: string}) => x.type.localeCompare(y.type))
changelog.entries.sort((x: { type: string }, y: { type: string }) => x.type.localeCompare(y.type))

// Write changelog file
fs.writeFileSync(changesFile, JSON.stringify(changelog, undefined, '\t'))
Expand Down
22 changes: 11 additions & 11 deletions build-scripts/createWelcomePage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
'use strict'

/*
This script is called from npm run compile.
Expand All @@ -7,21 +7,21 @@
This makes it easier to swap in relative links when the extension loads.
*/

const fs = require('fs-extra');
const path = require('path');
const fs = require('fs-extra')
const path = require('path')
const marked = require('marked')

const repoRoot = path.dirname(__dirname);
const repoRoot = path.dirname(__dirname)

( () => {
const fileText = fs.readFileSync(path.join(repoRoot, 'extension-readme.md')).toString();
;(() => {
const fileText = fs.readFileSync(path.join(repoRoot, 'extension-readme.md')).toString()

// paths are a little more foolproof to find in markdown form than HTML.
// find anything with a relative path and convert it to an easy-to-find token so we can convert to paths relative
const relativePathRegex = /]\(\.\//g;
const transformedText = fileText.replace(relativePathRegex, '](!!EXTENSIONROOT!!/');
// find anything with a relative path and convert it to an easy-to-find token so we can convert to paths relative
const relativePathRegex = /]\(\.\//g
const transformedText = fileText.replace(relativePathRegex, '](!!EXTENSIONROOT!!/')

marked(transformedText, (err, result) => {
fs.writeFileSync(path.join(repoRoot, './welcomePage.html'), result);
fs.writeFileSync(path.join(repoRoot, './welcomePage.html'), result)
})
})();
})()
11 changes: 2 additions & 9 deletions build-scripts/newChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@ import { v4 as uuid } from 'uuid'

const directory = '.changes/next-release'

const changeTypes = [
'Breaking Change',
'Feature',
'Bug Fix',
'Deprecation',
'Removal',
'Test'
]
const changeTypes = ['Breaking Change', 'Feature', 'Bug Fix', 'Deprecation', 'Removal', 'Test']

interface NewChange {
type: string,
type: string
description: string
}

Expand Down
Loading

0 comments on commit e003b28

Please sign in to comment.