generated from technote-space/gh-actions-template
-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c40c30
commit a8a8e25
Showing
374 changed files
with
7,871 additions
and
16,679 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 @@ | ||
{"owner":"technote-space","repo":"toc-generator","sha":"ee6c4be51de4b847cb936021bfe37701fef354dd","ref":"refs/tags/test/v2.5.2.325127638","tagName":"test/v2.5.2.325127638","branch":"gh-actions","tags":["test/v2.5.2.325127638","test/v2.5.2","test/v2.5","test/v2"],"updated_at":"2020-10-23T23:34:32.685Z"} | ||
{"owner":"technote-space","repo":"toc-generator","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v2.5.2","branch":"gh-actions","tags":["test/v2.5.2","test/v2.5","test/v2"],"updated_at":"2020-10-29T18:54:14.283Z"} |
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,49 +1,19 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.transformWithWrap = exports.normalizeMarkerComment = void 0; | ||
const transform_1 = __importStar(require("doctoc/lib/transform")); | ||
const update_section_1 = __importDefault(require("update-section")); | ||
exports.transformWithWrap = void 0; | ||
const fs_1 = require("fs"); | ||
const doctoc_1 = require("@technote-space/doctoc"); | ||
const github_action_helper_1 = require("@technote-space/github-action-helper"); | ||
const misc_1 = require("./misc"); | ||
const constant_1 = require("../constant"); | ||
const matchesStart = (line) => github_action_helper_1.Utils.getRegExp(constant_1.OPENING_COMMENT).test(line); | ||
const matchesEnd = (line) => github_action_helper_1.Utils.getRegExp(constant_1.CLOSING_COMMENT).test(line); | ||
exports.normalizeMarkerComment = (contents) => { | ||
const replacedOpening = misc_1.getArrayInput('OPENING_COMMENT').reduce((acc, comment) => acc.split('\n').map(line => line.replace(github_action_helper_1.Utils.getPrefixRegExp(comment), constant_1.OPENING_COMMENT)).join('\n'), contents); | ||
return misc_1.getArrayInput('CLOSING_COMMENT').reduce((acc, comment) => acc.split('\n').map(line => line.replace(github_action_helper_1.Utils.getPrefixRegExp(comment), constant_1.CLOSING_COMMENT)).join('\n'), replacedOpening); | ||
}; | ||
exports.transformWithWrap = (path, title) => { | ||
const content = exports.normalizeMarkerComment(fs_1.readFileSync(path, 'utf8')); | ||
const { toc } = transform_1.default(content, undefined, misc_1.getMaxHeaderLevel(), misc_1.wrapTitle(title), misc_1.isNoTitle(title), misc_1.getEntryPrefix()); | ||
// transformed is not working | ||
// https://github.com/thlorenz/doctoc/pull/169 | ||
const data = update_section_1.default(content, `${transform_1.start}\n${misc_1.wrapToc(toc, title)}\n${transform_1.end}`, matchesStart, matchesEnd, true); | ||
const transformed = data !== content; | ||
if (transformed) { | ||
return { path, transformed, data }; | ||
} | ||
return { path, transformed, data: '' }; | ||
const { transformed, data } = doctoc_1.transform(fs_1.readFileSync(path, 'utf8'), { | ||
maxHeaderLevel: misc_1.getMaxHeaderLevel(), | ||
title, | ||
isNotitle: misc_1.isNoTitle(title), | ||
isFolding: misc_1.isFolding(), | ||
entryPrefix: misc_1.getEntryPrefix(), | ||
checkOpeningComments: github_action_helper_1.Utils.uniqueArray(misc_1.getArrayInput('OPENING_COMMENT').concat(doctoc_1.CHECK_OPENING_COMMENT)), | ||
checkClosingComments: github_action_helper_1.Utils.uniqueArray(misc_1.getArrayInput('CLOSING_COMMENT').concat(doctoc_1.CHECK_CLOSING_COMMENT)), | ||
}); | ||
return { path, transformed, data }; | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.