mirror of
https://github.com/BradNut/awesome-uses
synced 2025-09-08 17:40:31 +00:00
chore: downgrade scripts support to node 12 (#473)
From start scripts needed to be run with node 13 (esm support) Because data.js was a esm export, and needed to be compiled Moved all scripts to commontjs, and data.js file So can be imported by scripts without compiling
This commit is contained in:
parent
2c1e9a5d5b
commit
7893bc510c
8 changed files with 27 additions and 25 deletions
|
|
@ -3,7 +3,7 @@ module.exports = {
|
|||
title: `/uses`,
|
||||
description: `A list of /uses pages detailing developer setups.`,
|
||||
author: `@wesbos`,
|
||||
siteUrl: "https://uses.tech",
|
||||
siteUrl: 'https://uses.tech',
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@
|
|||
"description": "What do you uses",
|
||||
"version": "7.7.7",
|
||||
"author": "Wes Bos",
|
||||
"type": "module",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"wesbos"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.1",
|
||||
"@actions/exec": "^1.0.3",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import core from '@actions/core';
|
||||
import { getMasterData, Schema, getStatusCode } from './utils.js';
|
||||
import srcData from '../src/data.js';
|
||||
const core = require('@actions/core');
|
||||
const { getMasterData, Schema, getStatusCode } = require('./utils.js');
|
||||
const srcData = require('../src/data.js');
|
||||
|
||||
(async () => {
|
||||
// on master branch will be empty array
|
||||
|
|
@ -19,7 +19,7 @@ import srcData from '../src/data.js';
|
|||
});
|
||||
|
||||
let failedUrlsCount = 0;
|
||||
for await (const { url } of data) {
|
||||
for (const { url } of data) {
|
||||
try {
|
||||
const statusCode = await getStatusCode(url);
|
||||
if (statusCode < 200 || statusCode >= 400) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const flags = [
|
||||
module.exports = [
|
||||
'🇦🇫',
|
||||
'🇦🇱',
|
||||
'🇩🇿',
|
||||
|
|
@ -236,5 +236,3 @@ const flags = [
|
|||
'🏳️🌈',
|
||||
'🇪🇺',
|
||||
];
|
||||
|
||||
export default flags;
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
* this is a stub file, do not edit it
|
||||
* see `scripts/utils.js` -> `getMasterData`
|
||||
*/
|
||||
export default [];
|
||||
module.exports = [];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import fs from 'fs';
|
||||
import data from '../src/data.js';
|
||||
const fs = require('fs');
|
||||
const data = require('../src/data.js');
|
||||
|
||||
/** @type {string} */
|
||||
const readmeTemplate = fs.readFileSync('./scripts/readme-template.md', 'utf8');
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import exec from '@actions/exec';
|
||||
import core from '@actions/core';
|
||||
import Joi from '@hapi/joi';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import flags from './flags.js';
|
||||
const exec = require('@actions/exec');
|
||||
const core = require('@actions/core');
|
||||
const Joi = require('@hapi/joi');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const flags = require('./flags.js');
|
||||
|
||||
async function getCurrentBranchName() {
|
||||
let myOutput = '';
|
||||
|
|
@ -22,7 +22,7 @@ async function getCurrentBranchName() {
|
|||
}
|
||||
|
||||
/** on master branch will return an empty array */
|
||||
export async function getMasterData() {
|
||||
module.exports.getMasterData = async function() {
|
||||
const options = { silent: true };
|
||||
const curentBranchName = await getCurrentBranchName();
|
||||
// when on a branch/PR different from master
|
||||
|
|
@ -38,7 +38,8 @@ export async function getMasterData() {
|
|||
core.info('Executing action on master branch');
|
||||
}
|
||||
|
||||
const masterData = await import('./masterData.js').then(m => m.default);
|
||||
// eslint-disable-next-line global-require
|
||||
const masterData = require('./masterData.js');
|
||||
|
||||
// restore `scripts/masterData.js` after was loaded
|
||||
if (curentBranchName !== 'master') {
|
||||
|
|
@ -46,9 +47,9 @@ export async function getMasterData() {
|
|||
}
|
||||
|
||||
return masterData;
|
||||
}
|
||||
};
|
||||
|
||||
export const Schema = Joi.object({
|
||||
module.exports.Schema = Joi.object({
|
||||
name: Joi.string().required(),
|
||||
description: Joi.string().required(),
|
||||
url: Joi.string()
|
||||
|
|
@ -65,7 +66,7 @@ export const Schema = Joi.object({
|
|||
tags: Joi.array().items(Joi.string()),
|
||||
});
|
||||
|
||||
export function getStatusCode(url) {
|
||||
module.exports.getStatusCode = function(url) {
|
||||
const client = url.startsWith('https') ? https : http;
|
||||
return new Promise((resolve, reject) => {
|
||||
const REQUEST_TIMEOUT = 10000;
|
||||
|
|
@ -82,4 +83,4 @@ export function getStatusCode(url) {
|
|||
})
|
||||
.on('error', err => reject(err));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
export default [
|
||||
// keep it commonjs export
|
||||
module.exports = [
|
||||
{
|
||||
name: 'Wes Bos',
|
||||
description:
|
||||
|
|
|
|||
Loading…
Reference in a new issue