@docusaurus/remark-plugin-npm2yarn 0.0.0-4208 → 0.0.0-4221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/remark-plugin-npm2yarn",
3
- "version": "0.0.0-4208",
3
+ "version": "0.0.0-4221",
4
4
  "description": "Remark plugin for converting npm commands to Yarn commands as tabs.",
5
5
  "main": "lib/index.js",
6
6
  "publishConfig": {
@@ -33,5 +33,5 @@
33
33
  "engines": {
34
34
  "node": ">=14"
35
35
  },
36
- "gitHead": "33af01cd8eac5d6a22033fa37d6f8a140138346e"
36
+ "gitHead": "e3b17cc04cfcf6f342af26a9e2b3457ebbde202f"
37
37
  }
@@ -10,20 +10,15 @@ import remark from 'remark';
10
10
  // TODO change to `../index` after migrating to ESM
11
11
  import npm2yarn from '../../lib/index';
12
12
  import vfile from 'to-vfile';
13
- import {join, relative} from 'path';
13
+ import path from 'path';
14
14
  import mdx from 'remark-mdx';
15
15
 
16
- const staticDir = `./${relative(process.cwd(), join(__dirname, 'fixtures'))}`;
17
-
18
- const processFixture = async (
19
- name: string,
20
- options: {sync?: boolean; staticDir: string},
21
- ) => {
22
- const path = join(__dirname, 'fixtures', `${name}.md`);
23
- const file = await vfile.read(path);
16
+ const processFixture = async (name: string, options?: {sync?: boolean}) => {
17
+ const filePath = path.join(__dirname, 'fixtures', `${name}.md`);
18
+ const file = await vfile.read(filePath);
24
19
  const result = await remark()
25
20
  .use(mdx)
26
- .use(npm2yarn, {...options, filePath: path})
21
+ .use(npm2yarn, {...options, filePath})
27
22
  .process(file);
28
23
 
29
24
  return result.toString();
@@ -31,41 +26,31 @@ const processFixture = async (
31
26
 
32
27
  describe('npm2yarn plugin', () => {
33
28
  test('test: installation file', async () => {
34
- const result = await processFixture('installation', {
35
- staticDir,
36
- });
29
+ const result = await processFixture('installation');
37
30
 
38
31
  expect(result).toMatchSnapshot();
39
32
  });
40
33
 
41
34
  test('test: plugin file', async () => {
42
- const result = await processFixture('plugin', {
43
- staticDir,
44
- });
35
+ const result = await processFixture('plugin');
45
36
 
46
37
  expect(result).toMatchSnapshot();
47
38
  });
48
39
 
49
40
  test('test: language was not setted', async () => {
50
- const result = await processFixture('syntax-not-properly-set', {
51
- staticDir,
52
- });
41
+ const result = await processFixture('syntax-not-properly-set');
53
42
 
54
43
  expect(result).toMatchSnapshot();
55
44
  });
56
45
 
57
46
  test('test: already imported tabs components above are not re-imported', async () => {
58
- const result = await processFixture('import-tabs-above', {
59
- staticDir,
60
- });
47
+ const result = await processFixture('import-tabs-above');
61
48
 
62
49
  expect(result).toMatchSnapshot();
63
50
  });
64
51
 
65
52
  test('test: already imported tabs components below are not re-imported', async () => {
66
- const result = await processFixture('import-tabs-below', {
67
- staticDir,
68
- });
53
+ const result = await processFixture('import-tabs-below');
69
54
 
70
55
  expect(result).toMatchSnapshot();
71
56
  });