You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
// bundle-submit.js
|
|
// Copyright (C) 2022 Rob Colbert @[email protected]
|
|
// License: Apache-2.0
|
|
|
|
'use strict';
|
|
|
|
import path, { dirname } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
const __dirname = dirname(fileURLToPath(import.meta.url)); // jshint ignore:line
|
|
|
|
import { createRequire } from "module";
|
|
const require = createRequire(import.meta.url); // jshint ignore:line
|
|
|
|
import fetch, { FormData } from 'node-fetch';
|
|
|
|
/*
|
|
* This script loads the developer's credentials, verifies that a bundle exists,
|
|
* and sends that bundle to the configured hosting environment.
|
|
*/
|
|
|
|
(async ( ) => {
|
|
|
|
try {
|
|
const credentials = require(path.join(__dirname, 'developer-credentials.json'));
|
|
const pkg = require(path.join(__dirname, 'package.json'));
|
|
const formData = new FormData();
|
|
|
|
formData.set('package', pkg);
|
|
formData.set('bundle-file', )
|
|
const response = await fetch('https://arcade.nicecrew.com/submissions', {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-Developer-Id': credentials.developerId,
|
|
'X-Developer-Key': credentials.developerKey,
|
|
},
|
|
body: formData,
|
|
});
|
|
} catch (error) {
|
|
console.log('ERROR:', error.message, error);
|
|
} finally {
|
|
console.log('Nice Arcade bundle submission process complete.');
|
|
}
|
|
})();
|