Skip to content

Commit

Permalink
Merge pull request #345 from whummer/master
Browse files Browse the repository at this point in the history
Move package.json to top level to simplify npm install
  • Loading branch information
iann0036 committed Oct 8, 2023
2 parents 6e14b76 + edaad32 commit 94c52ef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
18 changes: 11 additions & 7 deletions cli/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const cliargs = require('commander');
const cliprogress = require('cli-progress');
const logplease = require('logplease');
const _colors = require('colors');
const pjson = require('./package.json');
const pjson = require('../package.json');
const { openStdin } = require("process");
const CLI = true;

Expand Down Expand Up @@ -41,7 +41,7 @@ async function getResourceTags(arn) {

if (!resource_tag_cache[ service/*+ "." + type*/ ]) {
resource_tag_cache[service] = "PENDING";

await sdkcall("ResourceGroupsTaggingAPI", "getResources", {
ResourceTypeFilters: [ service/* + "." + type*/ ]
}, false).then((data) => {
Expand Down Expand Up @@ -119,12 +119,15 @@ if (!region) {
}

var stack_parameters = [];
eval(fs.readFileSync(path.join(__dirname, 'deepmerge.js'), 'utf8'));
eval(fs.readFileSync(path.join(__dirname, 'mappings.js'), 'utf8'));
eval(fs.readFileSync(path.join(__dirname, 'datatables.js'), 'utf8'));
var items = fs.readdirSync(path.join(__dirname, 'services'));

// note: defining `window` here, as it is being referenced by some of the imported scripts below
const window = undefined;
eval(fs.readFileSync(path.join(__dirname, '../js/deepmerge.js'), 'utf8'));
eval(fs.readFileSync(path.join(__dirname, '../js/mappings.js'), 'utf8'));
eval(fs.readFileSync(path.join(__dirname, '../js/datatables.js'), 'utf8'));
var items = fs.readdirSync(path.join(__dirname, '../js/services'));
for (var i=0; i<items.length; i++) {
eval(fs.readFileSync(path.join(__dirname, 'services', items[i]), 'utf8'));
eval(fs.readFileSync(path.join(__dirname, '../js/services', items[i]), 'utf8'));
};

f2log = function(msg){};
Expand Down Expand Up @@ -214,6 +217,7 @@ async function main(opts) {
try {
await work();
} catch (err) {
// TODO: verify log setup for CLI (errors do not seem to appear when running `former2`)
awslog.warn(util.format('updateDatatable failed: %j', err));
} finally {
b1.increment();
Expand Down
10 changes: 5 additions & 5 deletions js/services/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ async function updateDatatableStorageS3() {
AccountId: accountId
}, true).then(async (data) => {
$('#section-storage-s3-storagelenses-datatable').deferredBootstrapTable('removeAll');

await Promise.all(data.StorageLensConfigurationList.map(config => {
return sdkcall("S3Control", "getStorageLensConfiguration", {
ConfigId: config.Id,
Expand All @@ -671,7 +671,7 @@ async function updateDatatableStorageS3() {
}, false).then(async (data) => {
$('#section-storage-s3-outpostbuckets-datatable').deferredBootstrapTable('removeAll');
$('#section-storage-s3-outpostbucketpolicies-datatable').deferredBootstrapTable('removeAll');

await Promise.all(data.RegionalBucketList.map(async (bucket) => {
await sdkcall("S3Control", "getBucket", {
Bucket: bucket.Bucket,
Expand Down Expand Up @@ -717,7 +717,7 @@ async function updateDatatableStorageS3() {
AccountId: accountId
}, false).then(async (data) => {
$('#section-storage-s3-outpostaccesspoints-datatable').deferredBootstrapTable('removeAll');

await Promise.all(data.AccessPointList.map(async (accesspoint) => {
return sdkcall("S3Control", "getAccessPoint", {
Name: accesspoint.Name,
Expand Down Expand Up @@ -749,7 +749,7 @@ async function updateDatatableStorageS3() {
}, true).then(async (data) => {
$('#section-storage-s3-objectlambdaaccesspoints-datatable').deferredBootstrapTable('removeAll');
$('#section-storage-s3-objectlambdaaccesspointpolicies-datatable').deferredBootstrapTable('removeAll');

await Promise.all(data.ObjectLambdaAccessPointList.map(async (accesspoint) => {
await sdkcall("S3Control", "getAccessPointConfigurationForObjectLambda", {
Name: accesspoint.Name,
Expand Down Expand Up @@ -890,7 +890,7 @@ service_mapping_functions.push(function(reqParams, obj, tracked_resources){
if (rule.Filter && rule.Filter.Prefix) {
lifecyclerule['Prefix'] = rule.Filter.Prefix;
}

if (rule.Transitions) {
lifecyclerule['Transitions'] = [];
rule.Transitions.forEach(transition => {
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions cli/package.json → package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
"type": "git",
"url": "https://github.com/iann0036/former2"
},
"main": "main.js",
"main": "cli/main.js",
"scripts": {
"prepare": "cp -f ../js/deepmerge.js . && cp -f ../js/mappings.js . && cp -f ../js/datatables.js . && cp -r ../js/services .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ian Mckay",
Expand All @@ -30,6 +29,6 @@
"proxy-agent": "^3.1.1"
},
"bin": {
"former2": "main.js"
"former2": "cli/main.js"
}
}

0 comments on commit 94c52ef

Please sign in to comment.