Skip to content

Commit f2a01f1

Browse files
author
Ives van Hoorne
committed
Slugify names of package.json
1 parent 403f82b commit f2a01f1

File tree

2 files changed

+4
-2
lines changed
  • packages
    • app/src/app/store/modules/editor
    • common/templates/configuration/package-json

2 files changed

+4
-2
lines changed

packages/app/src/app/store/modules/editor/actions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { fromPairs, toPairs, sortBy } from 'lodash';
2+
import slugify from 'common/utils/slugify';
23
import { clone } from 'mobx-state-tree';
34

45
function sortObjectByKeys(object) {
@@ -45,7 +46,7 @@ export function updateSandboxPackage({ state }) {
4546
const sandbox = state.get('editor.currentSandbox');
4647

4748
parsed.keywords = sandbox.tags;
48-
parsed.name = sandbox.title || sandbox.id;
49+
parsed.name = slugify(sandbox.title || sandbox.id);
4950
parsed.description = sandbox.description;
5051

5152
return {

packages/common/templates/configuration/package-json/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// @flow
22

33
import type { Sandbox } from 'common/types';
4+
import slugify from 'common/utils/slugify';
45
import type { ConfigurationFile } from '../types';
56

67
export function generateFileFromSandbox(sandbox: Sandbox) {
78
const jsonFile = {};
89

9-
jsonFile.name = sandbox.title || sandbox.id;
10+
jsonFile.name = slugify(sandbox.title || sandbox.id);
1011
jsonFile.version = '1.0.0';
1112
jsonFile.description = sandbox.description || '';
1213
jsonFile.keywords = sandbox.tags;

0 commit comments

Comments
 (0)