Skip to content

Commit f4d5a03

Browse files
Merge pull request #62 from wimpyprogrammer/feature/yarn-workspaces
Separate package and demo with Yarn workspaces
2 parents 53c921a + 50fb337 commit f4d5a03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+119
-93
lines changed

.eslintignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
/coverage/
2-
/demo/lib/
3-
/lib/
1+
coverage/
2+
lib/

.github/README.md

Lines changed: 1 addition & 0 deletions

.github/workflows/tests.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ jobs:
3131
with:
3232
node-version: ${{ matrix.node-version }}
3333

34-
- run: npm install
34+
- run: yarn
3535
- run: npx prettier --check .
36-
- run: npm run lint
37-
- run: npm run build
38-
- run: npm run test
39-
- run: npx testpack-cli --keep=@types/*,ts-jest,typescript jest.config.js tsconfig.json src/e2e.spec.ts src/tsconfig.test.json
36+
- run: yarn run build
37+
- run: yarn run lint
38+
- run: yarn run test
39+
40+
- run: npx testpack-cli --keep=@types/*,ts-jest,typescript jest.config.js tsconfig.test.json src/e2e.spec.ts
41+
working-directory: ./packages/regex-to-strings
4042

4143
- name: Upload test coverage report to Codecov
4244
uses: codecov/[email protected]

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ package-lock.json
22
*.tsbuildinfo
33

44
coverage/
5-
demo/lib/
65
node_modules/
76
lib/

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
package-lock.json
22
package.json
3+
4+
coverage/
5+
lib/

demo/package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "regex-to-strings-demo",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"build": "wp --config webpack.config.js",
7+
"test": "exit 0"
8+
},
9+
"devDependencies": {
10+
"@types/history": "^4.7.3",
11+
"@types/lodash": "^4.14.140",
12+
"clean-webpack-plugin": "^4.0.0",
13+
"css-loader": "^6.1.0",
14+
"node-sass": "^7.0.0",
15+
"sass-loader": "^12.0.0",
16+
"style-loader": "^3.0.0",
17+
"ts-loader": "^9.1.2",
18+
"webpack": "^5.26.0",
19+
"webpack-nano": "^1.1.1",
20+
"worker-loader": "^3.0.8"
21+
},
22+
"dependencies": {
23+
"regex-to-strings": "*",
24+
"regexp-tree": "^0.1.23"
25+
}
26+
}

demo/src/worker/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import './polyfills';
22

3+
import { expand, toRegExp } from 'regex-to-strings';
34
import { optimize } from 'regexp-tree';
45
import {
56
CountResult,
@@ -9,7 +10,6 @@ import {
910
isExpandRequest,
1011
OptimizeResult,
1112
} from './messages';
12-
import { expand, toRegExp } from '../../../src';
1313

1414
function assertNeverRequest(x: never): never {
1515
throw new TypeError(`Unexpected message: ${x}`);

demo/src/worker/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable max-classes-per-file, no-useless-constructor */
2-
import { expand } from '../../../src';
2+
import { expand } from 'regex-to-strings';
33

44
interface WorkerMessage {
55
readonly kind: string;

demo/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"es2016.array.include"
99
],
1010
"noEmit": true,
11-
"outDir": "./lib"
11+
"outDir": "lib"
1212
},
1313
"extends": "../tsconfig.json",
1414
"include": ["src", "webpack.config.js"],
15-
"references": [{ "path": "../src" }]
15+
"references": [{ "path": "../packages/regex-to-strings" }]
1616
}

demo/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { resolve } = require('path');
44
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
55

66
module.exports = {
7-
entry: './demo/src/demo.ts',
7+
entry: './src/demo.ts',
88
mode: 'production',
99
externals: {
1010
history: 'History',

package.json

Lines changed: 9 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,24 @@
11
{
2-
"name": "regex-to-strings",
3-
"version": "2.1.0",
4-
"repository": {
5-
"type": "git",
6-
"url": "git+https://github.com/wimpyprogrammer/regex-to-strings.git"
7-
},
8-
"publishConfig": {
9-
"registry": "https://registry.npmjs.org/"
10-
},
11-
"bugs": {
12-
"url": "https://github.com/wimpyprogrammer/regex-to-strings/issues"
13-
},
14-
"homepage": "https://github.com/wimpyprogrammer/regex-to-strings#readme",
15-
"description": "Expand a regular expression pattern into a set of words",
16-
"author": "Drew Keller <[email protected]>",
17-
"license": "MIT",
18-
"main": "lib/index.js",
19-
"types": "./lib/index.d.ts",
20-
"files": [
21-
"lib/**/*.js",
22-
"lib/**/*.js.map",
23-
"lib/**/*.d.ts"
24-
],
25-
"sideEffects": [
26-
"demo/**/polyfills.ts",
27-
"*.scss"
2+
"private": true,
3+
"workspaces": [
4+
"packages/*",
5+
"demo"
286
],
29-
"engines": {
30-
"node": ">=12"
31-
},
327
"scripts": {
33-
"build": "run-s build:*",
34-
"build:src": "tsc -b --clean && tsc -b",
35-
"build:demo": "wp --config demo/webpack.config.js",
36-
"changelog": "npx auto-changelog",
37-
"format": "prettier --write '{src,demo/src}/**'",
8+
"build": "yarn workspaces run build",
9+
"format": "prettier --write .",
3810
"lint": "tsc -b ./tsconfig.lint.json && eslint . --report-unused-disable-directives",
39-
"release": "npx release-it --no-increment",
40-
"test": "jest --coverage"
11+
"test": "yarn workspaces run test"
4112
},
4213
"devDependencies": {
43-
"@types/history": "^4.7.3",
44-
"@types/jest": "^27.0.1",
45-
"@types/jest-when": "^3.5.0",
46-
"@types/lodash": "^4.14.140",
4714
"@typescript-eslint/eslint-plugin": "^5.6.0",
4815
"@typescript-eslint/parser": "^5.6.0",
49-
"clean-webpack-plugin": "^4.0.0",
50-
"css-loader": "^6.1.0",
5116
"eslint": "^8.4.0",
5217
"eslint-config-airbnb-base": "^15.0.0",
5318
"eslint-config-prettier": "^8.1.0",
5419
"eslint-import-resolver-typescript": "^2.4.0",
5520
"eslint-plugin-import": "^2.25.3",
5621
"eslint-plugin-jest": "^26.0.0",
57-
"jest": "^27.0.1",
58-
"jest-when": "^3.2.1",
59-
"node-sass": "^7.0.0",
60-
"npm-run-all": "^4.1.5",
61-
"prettier": "2.2.1",
62-
"sass-loader": "^12.0.0",
63-
"style-loader": "^3.0.0",
64-
"ts-jest": "^27.0.1",
65-
"ts-loader": "^9.1.2",
66-
"typescript": "^4.2.3",
67-
"webpack": "^5.26.0",
68-
"webpack-nano": "^1.1.1",
69-
"worker-loader": "^3.0.8"
70-
},
71-
"dependencies": {
72-
"escape-string-regexp": "^4.0.0",
73-
"pandemonium": "^2.0.0",
74-
"regexp-tree": "^0.1.23"
75-
},
76-
"snyk": true
22+
"prettier": "2.2.1"
23+
}
7724
}

jest.config.js renamed to packages/regex-to-strings/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
],
77
globals: {
88
'ts-jest': {
9-
tsconfig: 'src/tsconfig.test.json',
9+
tsconfig: 'tsconfig.test.json',
1010
},
1111
},
1212
preset: 'ts-jest',
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "regex-to-strings",
3+
"version": "2.1.0",
4+
"repository": {
5+
"type": "git",
6+
"url": "git+https://github.com/wimpyprogrammer/regex-to-strings.git"
7+
},
8+
"publishConfig": {
9+
"registry": "https://registry.npmjs.org/"
10+
},
11+
"bugs": {
12+
"url": "https://github.com/wimpyprogrammer/regex-to-strings/issues"
13+
},
14+
"homepage": "https://github.com/wimpyprogrammer/regex-to-strings#readme",
15+
"description": "Expand a regular expression pattern into a set of words",
16+
"author": "Drew Keller <[email protected]>",
17+
"license": "MIT",
18+
"main": "lib/index.js",
19+
"types": "./lib/index.d.ts",
20+
"files": [
21+
"lib/**/*.js",
22+
"lib/**/*.js.map",
23+
"lib/**/*.d.ts"
24+
],
25+
"sideEffects": false,
26+
"engines": {
27+
"node": ">=12"
28+
},
29+
"scripts": {
30+
"build": "tsc -b --clean && tsc -b",
31+
"changelog": "npx auto-changelog",
32+
"release": "npx release-it --no-increment",
33+
"test": "jest --coverage"
34+
},
35+
"devDependencies": {
36+
"@types/jest": "^27.0.1",
37+
"@types/jest-when": "^3.5.0",
38+
"jest": "^27.0.1",
39+
"jest-when": "^3.2.1",
40+
"ts-jest": "^27.0.1",
41+
"typescript": "^4.2.3"
42+
},
43+
"dependencies": {
44+
"escape-string-regexp": "^4.0.0",
45+
"pandemonium": "^2.0.0",
46+
"regexp-tree": "^0.1.23"
47+
},
48+
"snyk": true
49+
}
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.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["es5", "es2015.core", "es2015.iterable", "es2016.array.include"],
4+
"outDir": "lib",
5+
"rootDir": "src"
6+
},
7+
"extends": "../../tsconfig.json",
8+
"exclude": ["**/*.spec.ts", "**/*.config.js"],
9+
"include": ["src"]
10+
}

src/tsconfig.test.json renamed to packages/regex-to-strings/tsconfig.test.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"es2017.string"
99
],
1010
"noEmit": true,
11-
"outDir": "../lib",
12-
"types": ["jest", "regexp-tree", "./types/regexp-tree"]
11+
"outDir": "lib",
12+
"types": ["jest", "regexp-tree", "./src/types/regexp-tree"]
1313
},
14-
"extends": "../tsconfig.json",
15-
"include": ["./**/*.spec.ts", "../jest.config.js"],
14+
"extends": "../../tsconfig.json",
15+
"include": ["src/**/*.spec.ts", "jest.config.js"],
1616
"references": [{ "path": "./" }]
1717
}

src/tsconfig.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"files": [],
2424
"references": [
2525
{ "path": "./demo" },
26-
{ "path": "./src" },
27-
{ "path": "./src/tsconfig.test.json" }
26+
{ "path": "./packages/regex-to-strings" },
27+
{ "path": "./packages/regex-to-strings/tsconfig.test.json" }
2828
]
2929
}

0 commit comments

Comments
 (0)