Skip to content

Commit c533e25

Browse files
committed
Use ESM
1 parent 0b19e0f commit c533e25

27 files changed

Lines changed: 113 additions & 185 deletions

config/index.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
'use strict'
2-
3-
const fs = require('fs')
4-
const path = require('path')
5-
const yaml = require('js-yaml')
1+
import fs from 'fs'
2+
import path from 'path'
3+
import yaml from 'js-yaml'
64

75
// Name of the whole collective.
8-
exports.collective = 'unifiedjs'
6+
export var collective = 'unifiedjs'
97

10-
exports.humans = load('unified-humans')
11-
exports.teams = load('unified-teams')
12-
exports.ghOrgs = load('github-organizations')
13-
exports.ghTeams = load('github-teams')
14-
exports.ghHumans = load('github-humans')
15-
exports.ghLabels = load('github-labels')
8+
export var humans = load('unified-humans')
9+
export var teams = load('unified-teams')
10+
export var ghOrgs = load('github-organizations')
11+
export var ghTeams = load('github-teams')
12+
export var ghHumans = load('github-humans')
13+
export var ghLabels = load('github-labels')
1614

1715
function load(name) {
1816
return yaml.load(fs.readFileSync(path.join('config', name + '.yml')))

index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
'use strict'
2-
3-
const chalk = require('chalk')
4-
const tools = require('./lib')
5-
const config = require('./config')
1+
import chalk from 'chalk'
2+
import {tools} from './lib/index.js'
3+
import * as config from './config/index.js'
64

75
tools.run(
86
{

lib/collective/configure.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
'use strict'
1+
import {Octokit} from '@octokit/rest'
2+
import {graphql} from '@octokit/graphql'
23

3-
const {Octokit} = require('@octokit/rest')
4-
const {graphql} = require('@octokit/graphql')
5-
6-
module.exports = configure
7-
8-
async function configure(ctx) {
4+
export async function configure(ctx) {
95
const {ghToken} = ctx
106

117
if (!ghToken) {

lib/collective/index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
'use strict'
1+
import trough from 'trough'
2+
import {configure} from './configure.js'
3+
import {labels} from './labels.js'
4+
import {orgs} from './orgs.js'
25

3-
const trough = require('trough')
4-
const configure = require('./configure')
5-
const labels = require('./labels')
6-
const orgs = require('./orgs')
7-
8-
module.exports = trough().use(configure).use(labels).use(orgs)
6+
export var collective = trough().use(configure).use(labels).use(orgs)

lib/collective/labels.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
'use strict'
1+
import {scaleLinear} from 'd3-scale'
2+
import d3Color from 'd3-color'
3+
import sort from 'alpha-sort'
4+
import {toLabelSlug} from '../util/to-label-slug.js'
25

3-
const {scaleLinear} = require('d3-scale')
4-
const d3Color = require('d3-color')
5-
const sort = require('alpha-sort')
6-
const toLabelSlug = require('../util/to-label-slug')
7-
8-
module.exports = labels
9-
10-
async function labels(ctx) {
6+
export async function labels(ctx) {
117
const {ghLabels} = ctx
128
const remove = (ghLabels.remove || []).map((d) => toLabelSlug(d))
139
const replace = {}

lib/collective/orgs.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
'use strict'
1+
import {promisify} from 'util'
2+
import pSeries from 'p-series'
3+
import {org} from '../org/index.js'
24

3-
const {promisify} = require('util')
4-
const pSeries = require('p-series')
5-
const run = promisify(require('../org').run)
5+
const run = promisify(org.run)
66

7-
module.exports = orgs
8-
9-
async function orgs(ctx) {
7+
export async function orgs(ctx) {
108
const {ghOrgs} = ctx
119

1210
await pSeries(

lib/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
'use strict'
2-
3-
module.exports = require('./collective')
1+
export {collective as tools} from './collective/index.js'

lib/org/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const trough = require('trough')
2-
const people = require('./people')
3-
const teams = require('./teams')
4-
const repos = require('./repos')
1+
import trough from 'trough'
2+
import {people} from './people.js'
3+
import {teams} from './teams.js'
4+
import {repos} from './repos.js'
55

6-
module.exports = trough().use(people).use(repos).use(teams)
6+
export var org = trough().use(people).use(repos).use(teams)

lib/org/people.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
'use strict'
1+
import chalk from 'chalk'
2+
import pSeries from 'p-series'
3+
import {find} from '../util/find.js'
24

3-
const chalk = require('chalk')
4-
const pSeries = require('p-series')
5-
const find = require('../util/find')
6-
7-
module.exports = people
8-
9-
async function people(ctx) {
5+
export async function people(ctx) {
106
const {ghOrgs, ghTeams, org, ghQuery, ghRequest} = ctx
117
const ghOwners = find(ctx, ghOrgs.owner)
128
const expected = [

lib/org/repos.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
'use strict'
1+
import {promisify} from 'util'
2+
import chalk from 'chalk'
3+
import pSeries from 'p-series'
4+
import {repo} from '../repo/index.js'
25

3-
const {promisify} = require('util')
4-
const chalk = require('chalk')
5-
const pSeries = require('p-series')
6-
const run = promisify(require('../repo').run)
6+
const run = promisify(repo.run)
77

8-
module.exports = repos
9-
10-
async function repos(ctx) {
8+
export async function repos(ctx) {
119
const {org, ghQuery} = ctx
1210
let done
1311
let cursor

0 commit comments

Comments
 (0)