Skip to content

Commit 6fd9411

Browse files
committed
Create "prettier:check" npm script
1 parent d94c626 commit 6fd9411

File tree

93 files changed

+2020
-1409
lines changed

Some content is hidden

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

93 files changed

+2020
-1409
lines changed

README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ Then this solution could be helpful for you.
1919

2020
## Concept
2121

22-
2322
## Example
2423

25-
* example 1: image-resizer-lib & image-resizer-cli (this needs bin entrypoints)
26-
* example 2: awesome-logger-adapter, awesome-logger, awesome-logger-adapter-awesome-target
27-
24+
- example 1: image-resizer-lib & image-resizer-cli (this needs bin entrypoints)
25+
- example 2: awesome-logger-adapter, awesome-logger, awesome-logger-adapter-awesome-target
2826

2927
Minimal package:
30-
* no published devDependencies
31-
* no unnecessary files (e.g. ci configs)
28+
29+
- no published devDependencies
30+
- no unnecessary files (e.g. ci configs)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert';
2-
import {test} from 'node:test';
3-
import {bundler} from '../../source/bundler.entry-point.js'
4-
import {loadPackageJson} from '../load-package-json.js'
2+
import { test } from 'node:test';
3+
import { bundler } from '../../source/bundler.entry-point.js';
4+
import { loadPackageJson } from '../load-package-json.js';
55
import path from 'node:path';
66

77
test('correctly detects cyclic dependencies and avoids an infinite loop', async () => {
@@ -10,8 +10,8 @@ test('correctly detects cyclic dependencies and avoids an infinite loop', async
1010
name: 'the-package-name',
1111
version: '42.0.0',
1212
sourcesFolder: path.join(fixture, 'src'),
13-
entryPoints: [ {js: path.join(fixture, 'src/entry.js')} ],
14-
mainPackageJson: await loadPackageJson(fixture)
13+
entryPoints: [{ js: path.join(fixture, 'src/entry.js') }],
14+
mainPackageJson: await loadPackageJson(fixture),
1515
});
1616

1717
assert.deepStrictEqual(result, {
@@ -20,29 +20,29 @@ test('correctly detects cyclic dependencies and avoids an infinite loop', async
2020
main: 'entry.js',
2121
name: 'the-package-name',
2222
version: '42.0.0',
23-
type: 'module'
23+
type: 'module',
2424
},
2525
contents: [
2626
{
2727
kind: 'source',
2828
source: '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js",\n "type": "module"\n}',
29-
targetFilePath: 'package.json'
29+
targetFilePath: 'package.json',
3030
},
3131
{
32-
kind: "reference",
32+
kind: 'reference',
3333
sourceFilePath: path.join(fixture, 'src/entry.js'),
34-
targetFilePath: 'entry.js'
34+
targetFilePath: 'entry.js',
3535
},
3636
{
37-
kind: "reference",
37+
kind: 'reference',
3838
sourceFilePath: path.join(fixture, 'src/foo.js'),
39-
targetFilePath: 'foo.js'
39+
targetFilePath: 'foo.js',
4040
},
4141
{
42-
kind: "reference",
42+
kind: 'reference',
4343
sourceFilePath: path.join(fixture, 'src/bar.js'),
44-
targetFilePath: 'bar.js'
44+
targetFilePath: 'bar.js',
4545
},
46-
]
46+
],
4747
});
4848
});
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert';
2-
import {test} from 'node:test';
3-
import {bundler} from '../../source/bundler.entry-point.js'
4-
import {loadPackageJson} from '../load-package-json.js'
2+
import { test } from 'node:test';
3+
import { bundler } from '../../source/bundler.entry-point.js';
4+
import { loadPackageJson } from '../load-package-json.js';
55
import path from 'node:path';
66

77
test('adds declaration files correctly to the bundle', async () => {
@@ -10,8 +10,10 @@ test('adds declaration files correctly to the bundle', async () => {
1010
name: 'the-package-name',
1111
version: '42.0.0',
1212
sourcesFolder: path.join(fixture, 'src'),
13-
entryPoints: [ {js: path.join(fixture, 'src/entry.js'), declarationFile: path.join(fixture, 'src/entry.d.ts')} ],
14-
mainPackageJson: await loadPackageJson(fixture)
13+
entryPoints: [
14+
{ js: path.join(fixture, 'src/entry.js'), declarationFile: path.join(fixture, 'src/entry.d.ts') },
15+
],
16+
mainPackageJson: await loadPackageJson(fixture),
1517
});
1618

1719
assert.deepStrictEqual(result, {
@@ -21,44 +23,44 @@ test('adds declaration files correctly to the bundle', async () => {
2123
name: 'the-package-name',
2224
version: '42.0.0',
2325
types: 'entry.d.ts',
24-
type: 'module'
26+
type: 'module',
2527
},
2628
contents: [
2729
{
2830
kind: 'source',
2931
source: '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js",\n "type": "module",\n "types": "entry.d.ts"\n}',
30-
targetFilePath: 'package.json'
32+
targetFilePath: 'package.json',
3133
},
3234
{
33-
kind: "reference",
35+
kind: 'reference',
3436
sourceFilePath: path.join(fixture, 'src/entry.js'),
35-
targetFilePath: 'entry.js'
37+
targetFilePath: 'entry.js',
3638
},
3739
{
38-
kind: "reference",
40+
kind: 'reference',
3941
sourceFilePath: path.join(fixture, 'src/foo.js'),
40-
targetFilePath: 'foo.js'
42+
targetFilePath: 'foo.js',
4143
},
4244
{
43-
kind: "reference",
45+
kind: 'reference',
4446
sourceFilePath: path.join(fixture, 'src/bar.js'),
45-
targetFilePath: 'bar.js'
47+
targetFilePath: 'bar.js',
4648
},
4749
{
48-
kind: "reference",
50+
kind: 'reference',
4951
sourceFilePath: path.join(fixture, 'src/entry.d.ts'),
50-
targetFilePath: 'entry.d.ts'
52+
targetFilePath: 'entry.d.ts',
5153
},
5254
{
53-
kind: "reference",
55+
kind: 'reference',
5456
sourceFilePath: path.join(fixture, 'src/foo.d.ts'),
55-
targetFilePath: 'foo.d.ts'
57+
targetFilePath: 'foo.d.ts',
5658
},
5759
{
58-
kind: "reference",
60+
kind: 'reference',
5961
sourceFilePath: path.join(fixture, 'src/baz.d.ts'),
60-
targetFilePath: 'baz.d.ts'
62+
targetFilePath: 'baz.d.ts',
6163
},
62-
]
64+
],
6365
});
6466
});
+38-38
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert';
2-
import {test} from 'node:test';
3-
import {bundler} from '../../source/bundler.entry-point.js'
4-
import {loadPackageJson} from '../load-package-json.js'
2+
import { test } from 'node:test';
3+
import { bundler } from '../../source/bundler.entry-point.js';
4+
import { loadPackageJson } from '../load-package-json.js';
55
import path from 'node:path';
66

77
test('correctly resolves CommonJS files', async () => {
@@ -10,34 +10,34 @@ test('correctly resolves CommonJS files', async () => {
1010
name: 'the-package-name',
1111
version: '42.0.0',
1212
sourcesFolder: path.join(fixture, 'src'),
13-
entryPoints: [ {js: path.join(fixture, 'src/entry.js')} ],
14-
mainPackageJson: await loadPackageJson(fixture)
13+
entryPoints: [{ js: path.join(fixture, 'src/entry.js') }],
14+
mainPackageJson: await loadPackageJson(fixture),
1515
});
1616

1717
assert.deepStrictEqual(result, {
1818
packageJson: {
1919
dependencies: {},
2020
main: 'entry.js',
2121
name: 'the-package-name',
22-
version: '42.0.0'
22+
version: '42.0.0',
2323
},
2424
contents: [
2525
{
2626
kind: 'source',
2727
source: '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js"\n}',
28-
targetFilePath: 'package.json'
28+
targetFilePath: 'package.json',
2929
},
3030
{
31-
kind: "reference",
31+
kind: 'reference',
3232
sourceFilePath: path.join(fixture, 'src/entry.js'),
33-
targetFilePath: 'entry.js'
33+
targetFilePath: 'entry.js',
3434
},
3535
{
36-
kind: "reference",
36+
kind: 'reference',
3737
sourceFilePath: path.join(fixture, 'src/foo.js'),
38-
targetFilePath: 'foo.js'
38+
targetFilePath: 'foo.js',
3939
},
40-
]
40+
],
4141
});
4242
});
4343

@@ -47,8 +47,8 @@ test('correctly resolves ESM files', async () => {
4747
name: 'the-package-name',
4848
version: '42.0.0',
4949
sourcesFolder: path.join(fixture, 'src'),
50-
entryPoints: [ {js: path.join(fixture, 'src/entry.js')} ],
51-
mainPackageJson: await loadPackageJson(fixture)
50+
entryPoints: [{ js: path.join(fixture, 'src/entry.js') }],
51+
mainPackageJson: await loadPackageJson(fixture),
5252
});
5353

5454
assert.deepStrictEqual(result, {
@@ -63,19 +63,19 @@ test('correctly resolves ESM files', async () => {
6363
{
6464
kind: 'source',
6565
source: '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js",\n "type": "module"\n}',
66-
targetFilePath: 'package.json'
66+
targetFilePath: 'package.json',
6767
},
6868
{
69-
kind: "reference",
69+
kind: 'reference',
7070
sourceFilePath: path.join(fixture, 'src/entry.js'),
71-
targetFilePath: 'entry.js'
71+
targetFilePath: 'entry.js',
7272
},
7373
{
74-
kind: "reference",
74+
kind: 'reference',
7575
sourceFilePath: path.join(fixture, 'src/foo.js'),
76-
targetFilePath: 'foo.js'
76+
targetFilePath: 'foo.js',
7777
},
78-
]
78+
],
7979
});
8080
});
8181

@@ -85,8 +85,8 @@ test('correctly resolves ESM files with export from statements', async () => {
8585
name: 'the-package-name',
8686
version: '42.0.0',
8787
sourcesFolder: path.join(fixture, 'src'),
88-
entryPoints: [ {js: path.join(fixture, 'src/entry.js')} ],
89-
mainPackageJson: await loadPackageJson(fixture)
88+
entryPoints: [{ js: path.join(fixture, 'src/entry.js') }],
89+
mainPackageJson: await loadPackageJson(fixture),
9090
});
9191

9292
assert.deepStrictEqual(result, {
@@ -95,25 +95,25 @@ test('correctly resolves ESM files with export from statements', async () => {
9595
main: 'entry.js',
9696
name: 'the-package-name',
9797
version: '42.0.0',
98-
type: 'module'
98+
type: 'module',
9999
},
100100
contents: [
101101
{
102102
kind: 'source',
103103
source: '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js",\n "type": "module"\n}',
104-
targetFilePath: 'package.json'
104+
targetFilePath: 'package.json',
105105
},
106106
{
107-
kind: "reference",
107+
kind: 'reference',
108108
sourceFilePath: path.join(fixture, 'src/entry.js'),
109-
targetFilePath: 'entry.js'
109+
targetFilePath: 'entry.js',
110110
},
111111
{
112-
kind: "reference",
112+
kind: 'reference',
113113
sourceFilePath: path.join(fixture, 'src/foo.js'),
114-
targetFilePath: 'foo.js'
114+
targetFilePath: 'foo.js',
115115
},
116-
]
116+
],
117117
});
118118
});
119119

@@ -123,8 +123,8 @@ test('correctly resolves ESM files with plain import statements', async () => {
123123
name: 'the-package-name',
124124
version: '42.0.0',
125125
sourcesFolder: path.join(fixture, 'src'),
126-
entryPoints: [ {js: path.join(fixture, 'src/entry.js')} ],
127-
mainPackageJson: await loadPackageJson(fixture)
126+
entryPoints: [{ js: path.join(fixture, 'src/entry.js') }],
127+
mainPackageJson: await loadPackageJson(fixture),
128128
});
129129

130130
assert.deepStrictEqual(result, {
@@ -133,24 +133,24 @@ test('correctly resolves ESM files with plain import statements', async () => {
133133
main: 'entry.js',
134134
name: 'the-package-name',
135135
version: '42.0.0',
136-
type: 'module'
136+
type: 'module',
137137
},
138138
contents: [
139139
{
140140
kind: 'source',
141141
source: '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js",\n "type": "module"\n}',
142-
targetFilePath: 'package.json'
142+
targetFilePath: 'package.json',
143143
},
144144
{
145-
kind: "reference",
145+
kind: 'reference',
146146
sourceFilePath: path.join(fixture, 'src/entry.js'),
147-
targetFilePath: 'entry.js'
147+
targetFilePath: 'entry.js',
148148
},
149149
{
150-
kind: "reference",
150+
kind: 'reference',
151151
sourceFilePath: path.join(fixture, 'src/foo.js'),
152-
targetFilePath: 'foo.js'
152+
targetFilePath: 'foo.js',
153153
},
154-
]
154+
],
155155
});
156156
});

0 commit comments

Comments
 (0)