Skip to content

Commit

Permalink
File reorganization (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
surfinzap authored Oct 4, 2024
1 parent 390952d commit dd288e1
Show file tree
Hide file tree
Showing 51 changed files with 933 additions and 792 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Update the version in typopo.js before committing
gulp updateTypopoJsCopyrightBanner

# Add updated files to the commit
# Add updated file version to the commit
git add src/typopo.js

# run build
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog for Typopo


## 2.5.9 //

### 🔨 Maintenance
- Reorganie the folder structure
- Update NPM packages to their latest versions



## 2.5.8 // 2024-09-22

Expand Down
2 changes: 1 addition & 1 deletion dist/typopo.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/typopo_dist.min.js

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"scripts": {
"dev": "gulp watch",
"build": "gulp build",
"test": "mocha --require @babel/register ./src/test/**/*.test.js -R min --no-colors",
"test:dev": "mocha --require @babel/register ./src/test/**/*.test.js -R min -w",
"test": "mocha --require @babel/register ./tests/**/*.test.js -R min --no-colors",
"test:dev": "mocha --require @babel/register ./tests/**/*.test.js -R min -w",
"lint": "eslint src/",
"prepare": "husky"
},
Expand Down Expand Up @@ -41,14 +41,14 @@
"node": ">=6.9.4"
},
"devDependencies": {
"@babel/cli": "^7.25.6",
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@babel/register": "^7.24.6",
"@babel/cli": "^7.25.7",
"@babel/core": "^7.25.7",
"@babel/preset-env": "^7.25.7",
"@babel/register": "^7.25.7",
"babelify": "^10.0.0",
"browser-sync": "^3.0.2",
"browserify": "^17.0.0",
"eslint": "^9.11.0",
"browser-sync": "^3.0.3",
"browserify": "^17.0.1",
"eslint": "^9.11.1",
"gulp": "^5.0.0",
"gulp-babel": "^8.0.0",
"gulp-cli": "^3.0.0",
Expand Down
1,570 changes: 852 additions & 718 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 20 additions & 20 deletions src/typopo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
* Licensed under MIT (https://github.com/surfinzap/typopo/blob/main/LICENSE.txt)
*/
import Locale from "./locale/locale";
import {removeEmptyLines} from "./lib/whitespace/lines";
import {fixNbsp} from "./lib/whitespace/nbsp";
import {fixSpaces} from "./lib/whitespace/spaces";
import {fixPeriod} from "./lib/punctuation/period";
import {fixEllipsis} from "./lib/punctuation/ellipsis";
import {fixHyphen} from "./lib/punctuation/hyphen";
import {fixDash} from "./lib/punctuation/dash";
import {fixDoubleQuotesAndPrimes} from "./lib/punctuation/double-quotes";
import {fixSingleQuotesPrimesAndApostrophes} from "./lib/punctuation/single-quotes";
import {fixMultiplicationSign} from "./lib/symbols/multiplication-sign";
import {fixSectionSign} from "./lib/symbols/section-sign";
import {fixCopyrights} from "./lib/symbols/copyrights";
import {fixPlusMinus} from "./lib/symbols/plus-minus";
import {fixMarks} from "./lib/symbols/marks";
import {fixExponents} from "./lib/symbols/exponents";
import {fixNumberSign} from "./lib/symbols/number-sign";
import {fixAbbreviations} from "./lib/words/abbreviations";
import {fixCase} from "./lib/words/case";
import {fixPubId} from "./lib/words/pub-id";
import {removeEmptyLines} from "./modules/whitespace/lines";
import {fixNbsp} from "./modules/whitespace/nbsp";
import {fixSpaces} from "./modules/whitespace/spaces";
import {fixPeriod} from "./modules/punctuation/period";
import {fixEllipsis} from "./modules/punctuation/ellipsis";
import {fixHyphen} from "./modules/punctuation/hyphen";
import {fixDash} from "./modules/punctuation/dash";
import {fixDoubleQuotesAndPrimes} from "./modules/punctuation/double-quotes";
import {fixSingleQuotesPrimesAndApostrophes} from "./modules/punctuation/single-quotes";
import {fixMultiplicationSign} from "./modules/symbols/multiplication-sign";
import {fixSectionSign} from "./modules/symbols/section-sign";
import {fixCopyrights} from "./modules/symbols/copyrights";
import {fixPlusMinus} from "./modules/symbols/plus-minus";
import {fixMarks} from "./modules/symbols/marks";
import {fixExponents} from "./modules/symbols/exponents";
import {fixNumberSign} from "./modules/symbols/number-sign";
import {fixAbbreviations} from "./modules/words/abbreviations";
import {fixCase} from "./modules/words/case";
import {fixPubId} from "./modules/words/pub-id";
import {excludeExceptions,
placeExceptions} from "./lib/words/exceptions";
placeExceptions} from "./modules/words/exceptions";


/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {fixTypos} from '../../typopo.js';
import {fixTypos} from '../../src/typopo.js';
import assert from 'assert';

describe('Test consistency of internal variables', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {replaceThreeHyphensWithEmDash,
fixDashBetweenCardinalNumbers,
fixDashBetweenPercentageRange,
fixDashBetweenOrdinalNumbers,
fixDash} from "../../lib/punctuation/dash";
fixDash} from "../../src/modules/punctuation/dash";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";

describe('Replace 3 hyphens with an em dash\n', () => {
let testCase = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {removeExtraPunctuationBeforeQuotes,
addSpaceBeforeLeftDoubleQuote,
addSpaceAfterRightDoubleQuote,
fixDoubleQuotesAndPrimes}
from "../../lib/punctuation/double-quotes";
from "../../src/modules/punctuation/double-quotes";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";


let configIgnoreMarkdownCodeBlocks = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {replaceThreeCharsWithEllipsis,
fixEllipsisBetweenSentences,
fixAposiopesisEndingParagraph,
fixEllipsis,
fixEllipsisAsLastItem} from "../../lib/punctuation/ellipsis";
fixEllipsisAsLastItem} from "../../src/modules/punctuation/ellipsis";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";


describe('Replace periods/ellipses with a single ellipsis:\n', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {fixHyphen,
fixSpaceAroundHyphen} from "../../lib/punctuation/hyphen";
fixSpaceAroundHyphen} from "../../src/modules/punctuation/hyphen";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";



Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {identifyMarkdownCodeTicks,
placeMarkdownCodeTicks}
from "../../lib/punctuation/markdown";
from "../../src/modules/punctuation/markdown";

import assert from 'assert';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {fixPeriod} from "../../lib/punctuation/period";
import {fixPeriod} from "../../src/modules/punctuation/period";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";



Expand All @@ -10,7 +10,7 @@ describe('Replace 2 periods at the end of the sentecne with a single period\n',
"He is a vice president at Apple Inc..": "He is a vice president at Apple Inc.",

//false positives
"../../filename.ext":"../../filename.ext",
"../../src/filename.ext":"../../src/filename.ext",
"..\\..\\filename.ext":"..\\..\\filename.ext",
"../":"../",
"..\\":"..\\",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {identifyContractedAnd,
swapSingleQuotesAndTerminalPunctuation,
removeExtraSpaceAroundSinglePrime,
fixSingleQuotesPrimesAndApostrophes}
from "../../lib/punctuation/single-quotes";
import Locale from "../../locale/locale";
from "../../src/modules/punctuation/single-quotes";
import Locale from "../../src/locale/locale";

import assert from 'assert';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fixCopyrights } from "../../lib/symbols/copyrights";
import { fixCopyrights } from "../../src/modules/symbols/copyrights";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";

const locales = ["en-us", "de-de", "sk", "cs", "rue"];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {fixExponents,
fixSquares,
fixCubes} from "../../lib/symbols/exponents";
fixCubes} from "../../src/modules/symbols/exponents";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";

describe('Fix squares\n', () => {
let testCase = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {replaceMark, fixMarks} from "../../lib/symbols/marks";
import {replaceMark, fixMarks} from "../../src/modules/symbols/marks";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";

const locales = ["en-us", "de-de", "sk", "cs", "rue"];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {fixMultiplicationSignBetweenNumbers,
fixMultiplicationSignBetweenWords,
fixMultiplicationSignBetweenNumberAndWord,
fixNbspAroundMultiplicationSign,
fixMultiplicationSign} from "../../lib/symbols/multiplication-sign";
fixMultiplicationSign} from "../../src/modules/symbols/multiplication-sign";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";



Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {removeExtraSpacesAfterNumberSign,
fixNumberSign} from "../../lib/symbols/number-sign";
fixNumberSign} from "../../src/modules/symbols/number-sign";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";

describe('Remove extra space before number sign\n', () => {
let testCase = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {fixPlusMinus} from "../../lib/symbols/plus-minus";
import {fixPlusMinus} from "../../src/modules/symbols/plus-minus";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";

describe('Fix plus-minus symbol ±\n', () => {
let testCase = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {fixSectionSign} from "../../lib/symbols/section-sign";
import {fixSectionSign} from "../../src/modules/symbols/section-sign";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";

describe('Fix section sign (§)\n', () => {
let testCase = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {removeEmptyLines} from "../../lib/whitespace/lines";
import {removeEmptyLines} from "../../src/modules/whitespace/lines";
import assert from 'assert';

describe('Remove empty lines\n', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {removeNbspBetweenMultiCharWords,
addNbspBeforeSingleLetter,
addNbspAfterSymbol,
replaceSpacesWithNbspAfterSymbol,
fixNbsp} from "../../lib/whitespace/nbsp";
fixNbsp} from "../../src/modules/whitespace/nbsp";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";


describe('Remove non-breaking space between multi-letter words\n', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {removeMultipleSpaces,
addSpaceAfterClosingBrackets,
removeSpacesAtParagraphEnd,
addSpaceBeforeSymbol,
fixSpaces} from "../../lib/whitespace/spaces";
fixSpaces} from "../../src/modules/whitespace/spaces";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";

let configRemoveWhitespacesBeforeParagraphs = {
removeWhitespacesBeforeMarkdownList: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {fixAbbreviations,
fixInitials,
fixMultipleWordAbbreviations,
fixSingleWordAbbreviations} from "../../lib/words/abbreviations";
fixSingleWordAbbreviations} from "../../src/modules/words/abbreviations";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";


describe('Fix Initials (sk, cs, rue, de-de)\n', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/test/words/case.test.js → tests/words/case.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert';
import {fixCase} from "../../lib/words/case";
import Locale from "../../locale/locale";
import {fixCase} from "../../src/modules/words/case";
import Locale from "../../src/locale/locale";

describe('Fix accidental uPPERCASE\n', () => {
let testCase = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from "assert";
import { excludeExceptions, placeExceptions } from "../../lib/words/exceptions";
import Locale from "../../locale/locale";
import { excludeExceptions, placeExceptions } from "../../src/modules/words/exceptions";
import Locale from "../../src/locale/locale";

// Mock locale for URL pattern
const locale = new Locale("en-us");
Expand Down
4 changes: 2 additions & 2 deletions src/test/words/pub-id.test.js → tests/words/pub-id.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {fixPubId,
fixISSN,
fixISBN10,
fixISBN13,
fixISBNnumber} from "../../lib/words/pub-id";
fixISBNnumber} from "../../src/modules/words/pub-id";
import assert from 'assert';
import Locale from "../../locale/locale";
import Locale from "../../src/locale/locale";



Expand Down

0 comments on commit dd288e1

Please sign in to comment.