forked from electron/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update to es module (electron#1869)
* update to es module * fix script * fix wizard
- Loading branch information
Showing
31 changed files
with
8,938 additions
and
592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
module.exports = require('./meta/categories.json') | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { _dirname } from './lib/dirname.js' | ||
|
||
const categories = JSON.parse( | ||
fs.readFileSync(path.join(_dirname(import.meta), './meta/categories.json')) | ||
) | ||
|
||
export default categories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = [ | ||
export default [ | ||
'Books', | ||
'Business', | ||
'Catalogs', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { fileURLToPath } from 'url' | ||
import { dirname } from 'path' | ||
|
||
export const _dirname = (importMeta) => dirname(_filename(importMeta)) | ||
export const _filename = (importMeta) => | ||
importMeta.url ? fileURLToPath(importMeta.url) : '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
if (!process.env.GH_TOKEN) { | ||
require('dotenv-safe').config() | ||
await import('dotenv-safe/config.js') | ||
} | ||
|
||
const { Octokit } = require('@octokit/rest') | ||
import { Octokit } from '@octokit/rest' | ||
const github = new Octokit({ | ||
auth: process.env.GH_TOKEN, | ||
}) | ||
|
||
module.exports = github | ||
export default github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const yaml = require('js-yaml') | ||
import fs from 'fs' | ||
import yaml from 'js-yaml' | ||
import path from 'path' | ||
import { _dirname } from './dirname.js' | ||
|
||
module.exports = function getSlugs() { | ||
return fs | ||
.readdirSync(path.join(__dirname, '../apps')) | ||
.filter((filename) => { | ||
return fs | ||
.statSync(path.join(__dirname, `../apps/${filename}`)) | ||
.isDirectory() | ||
}) | ||
.sort() | ||
.reduce((slugs, slug) => { | ||
const yamlFile = path.join(__dirname, `../apps/${slug}/${slug}.yml`) | ||
const meta = yaml.load(fs.readFileSync(yamlFile)) | ||
export default fs | ||
.readdirSync(path.join(_dirname(import.meta), '../apps')) | ||
.filter((filename) => { | ||
return fs | ||
.statSync(path.join(_dirname(import.meta), `../apps/${filename}`)) | ||
.isDirectory() | ||
}) | ||
.sort() | ||
.reduce((slugs, slug) => { | ||
const yamlFile = path.join( | ||
_dirname(import.meta), | ||
`../apps/${slug}/${slug}.yml` | ||
) | ||
const meta = yaml.load(fs.readFileSync(yamlFile)) | ||
|
||
if (meta.disabled) { | ||
return slugs | ||
} else { | ||
const app = { | ||
slug: slug, | ||
iconPath: path.join(__dirname, `../apps/${slug}/${slug}-icon.png`), | ||
...meta | ||
} | ||
return [...slugs, app] | ||
if (meta.disabled) { | ||
return slugs | ||
} else { | ||
const app = { | ||
slug: slug, | ||
iconPath: path.join( | ||
_dirname(import.meta), | ||
`../apps/${slug}/${slug}-icon.png` | ||
), | ||
...meta, | ||
} | ||
|
||
}, []) | ||
} | ||
return [...slugs, app] | ||
} | ||
}, []) |
Oops, something went wrong.