Skip to content
Permalink
Browse files

chore: fix sync-readmes running on node 6

  • Loading branch information
MarshallOfSound committed Jul 4, 2018
1 parent 4466904 commit 196133886220c641cbb6ab5533fd54e878b3c4a0
Showing with 22 additions and 10 deletions.
  1. +2 −1 package.json
  2. +1 −0 tools/publish.js
  3. +13 −9 tools/{sync-readmes.js → sync-readmes.ts}
  4. +6 −0 yarn.lock
@@ -30,7 +30,7 @@
"docs": "bolt docs:generate && bolt docs:position",
"docs:generate": "bolt ws exec -- node_modules/.bin/typedoc --out doc --excludeExternals --ignoreCompilerErrors --mode file --excludePrivate --excludeProtected --hideGenerator",
"docs:position": "ts-node tools/position-docs.ts",
"docs:deploy": "node tools/sync-readmes.js && bolt docs && ts-node tools/copy-now.ts && cd docs && now && now alias",
"docs:deploy": "ts-node tools/sync-readmes.ts && bolt docs && ts-node tools/copy-now.ts && cd docs && now && now alias",
"lint": "ts-node tools/link-ts.ts && bolt ws exec -- node_modules/.bin/tslint src/**/*.ts test/**/*.ts",
"test": "bolt ws run test"
},
@@ -105,6 +105,7 @@
"@types/glob": "^5.0.35",
"@types/html-webpack-plugin": "^2.30.3",
"@types/inquirer": "^0.0.41",
"@types/listr": "^0.13.0",
"@types/lodash.merge": "^4.6.3",
"@types/lodash.template": "^4.4.3",
"@types/log-symbols": "^2.0.0",
@@ -4,6 +4,7 @@ const fs = require('fs-extra');
const path = require('path');
const spawnPromise = require('cross-spawn-promise');
const Listr = require('listr');
require('ts-node').register();

const BASE_DIR = path.resolve(__dirname, '..');
const PACKAGES_DIR = path.resolve(BASE_DIR, 'packages');
@@ -1,9 +1,9 @@
const fetch = require('node-fetch');
const fs = require('fs-extra');
const Listr = require('listr');
const path = require('path');
import fetch from 'node-fetch';
import * as fs from 'fs-extra';
import Listr from 'listr';
import * as path from 'path';

const workspaceMappings = {
const workspaceMappings: { [space: string]: { [packageName: string]: string | undefined }} = {
maker: {
wix: 'wix-msi',
squirrel: 'squirrel.windows',
@@ -16,15 +16,15 @@ const workspaceMappings = {
const BASE_DIR = path.resolve(__dirname, '..');
const DOCS_BASE = 'https://raw.githubusercontent.com/MarshallOfSound/electron-forge-docs/v6';

const sanitize = (gb) => {
const sanitize = (gb: string) => {
return gb
.replace('{% code-tabs %}', '')
.replace('{% endcode-tabs %}', '')
.replace(/{% code-tabs-item title=".+?" %}/g, '')
.replace('{% endcode-tabs-item %}', '')
.replace('{% endhint %}', '\n--------')
.replace(/{% hint style="(.+?)" %}\n/g, (_, style) => {
const styleMap = {
const styleMap: { [style: string]: string | undefined } = {
warning: '⚠️',
info: 'ℹ️',
danger: '🚨',
@@ -33,11 +33,15 @@ const sanitize = (gb) => {
});
};

interface SyncContext {
packageKeys: [string, string, string, string][];
}

const sync = () => {
return new Listr([
{
title: 'Collecting package keys',
task: async (ctx) => {
task: async (ctx: SyncContext) => {
ctx.packageKeys = [];

for (const workspace of Object.keys(workspaceMappings)) {
@@ -53,7 +57,7 @@ const sync = () => {
},
{
title: 'Fetching READMEs',
task: (ctx) => new Listr(ctx.packageKeys.map(([workspace, workspaceDir, packageKey, packageName]) => ({
task: (ctx: SyncContext) => new Listr(ctx.packageKeys.map(([workspace, workspaceDir, packageKey, packageName]) => ({
title: `Fetching README for ${path.basename(workspaceDir)}/${packageKey}`,
task: async () => {
const r = await fetch(`${DOCS_BASE}/${workspace}s/${packageKey}.md`);
@@ -845,6 +845,12 @@
"@types/rx" "*"
"@types/through" "*"

"@types/listr@^0.13.0":
version "0.13.0"
resolved "https://registry.yarnpkg.com/@types/listr/-/listr-0.13.0.tgz#6250bc4a04123cafa24fc73d1b880653a6ae6721"
dependencies:
"@types/node" "*"

"@types/lodash.merge@^4.6.3":
version "4.6.3"
resolved "https://registry.yarnpkg.com/@types/lodash.merge/-/lodash.merge-4.6.3.tgz#a41c49fe404c4bfb653ae6dda76abeedeace14ff"

0 comments on commit 1961338

Please sign in to comment.
You can’t perform that action at this time.