Skip to content

Commit 7428707

Browse files
committed
fix(deps): favor native mkdir over the previous dependency
1 parent 30ec5e6 commit 7428707

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
"filedirname": "^3.0.0",
7878
"ini": "^5.0.0",
7979
"joi": "^17.5.0",
80-
"make-dir": "^4.0.0",
8180
"mustache": "^4.2.0",
8281
"npm-conf": "^1.1.3",
8382
"sort-object-keys": "^1.1.3",

src/project-type/package/build-details.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {promises as fs} from 'fs';
22
import deepmerge from 'deepmerge';
33
import mustache from 'mustache';
4-
import mkdir from 'make-dir';
54
import touch from 'touch';
65
import camelcase from 'camelcase';
76
import {dialects, projectTypes} from '@form8ion/javascript-core';
@@ -44,11 +43,11 @@ export default async function ({
4443
}) {
4544
if (dialects.COMMON_JS === dialect) return buildDetailsForCommonJsProject({projectRoot, projectName, provideExample});
4645

47-
const pathToCreatedSrcDirectory = await mkdir(`${projectRoot}/src`);
46+
await fs.mkdir(`${projectRoot}/src`, {recursive: true});
4847
const [bundlerResults] = await Promise.all([
4948
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType: projectTypes.PACKAGE}),
5049
provideExample ? await createExample(projectRoot, projectName, dialect) : Promise.resolve,
51-
touch(`${pathToCreatedSrcDirectory}/index.js`)
50+
touch(`${projectRoot}/src/index.js`)
5251
]);
5352

5453
return deepmerge(

src/project-type/package/build-details.test.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {promises as fs} from 'fs';
2-
import makeDir from 'make-dir';
32
import touch from 'touch';
43
import camelcase from 'camelcase';
54
import mustache from 'mustache';
@@ -25,7 +24,6 @@ describe('package build details', () => {
2524
const projectRoot = any.string();
2625
const projectName = any.word();
2726
const pathToExample = `${projectRoot}/example.js`;
28-
const pathToCreatedSrcDirectory = any.string();
2927
const bundlerResults = any.simpleObject();
3028
const exampleContent = any.string();
3129
const pathToExampleTemplate = any.string();
@@ -35,7 +33,6 @@ describe('package build details', () => {
3533
const decisions = any.simpleObject();
3634

3735
beforeEach(() => {
38-
when(makeDir).calledWith(`${projectRoot}/src`).mockResolvedValue(pathToCreatedSrcDirectory);
3936
when(templatePath).calledWith('example.mustache').mockReturnValue(pathToExampleTemplate);
4037
when(fs.readFile).calledWith(pathToExampleTemplate, 'utf8').mockResolvedValue(exampleTemplateContent);
4138
when(camelcase).calledWith(projectName).mockReturnValue(camelizedProjectName);
@@ -101,7 +98,8 @@ describe('package build details', () => {
10198
buildDirectory: 'lib',
10299
badges: {consumer: {}}
103100
});
104-
expect(touch).toHaveBeenCalledWith(`${pathToCreatedSrcDirectory}/index.js`);
101+
expect(fs.mkdir).toHaveBeenCalledWith(`${projectRoot}/src`, {recursive: true});
102+
expect(touch).toHaveBeenCalledWith(`${projectRoot}/src/index.js`);
105103
expect(fs.writeFile).toHaveBeenCalledWith(pathToExample, exampleContent);
106104
});
107105

0 commit comments

Comments
 (0)