Skip to content

Commit bd985ff

Browse files
author
Ives van Hoorne
committed
Bump
1 parent db6ca89 commit bd985ff

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

packages/react-sandpack/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-smooshpack",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "",
55
"keywords": [],
66
"license": "SEE LICENSE.MD IN ROOT",
@@ -77,7 +77,7 @@
7777
"react-broadcast": "^0.6.2",
7878
"react-codemirror2": "^4.0.1",
7979
"rollup-plugin-scss": "^0.4.0",
80-
"smooshpack": "^0.0.7"
80+
"smooshpack": "^0.0.9"
8181
},
8282
"peerDependencies": {
8383
"react": "^16.0.0"

packages/sandpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "smooshpack",
3-
"version": "0.0.7",
3+
"version": "0.0.9",
44
"description": "",
55
"keywords": [],
66
"main": "dist/sandpack.umd.js",

packages/sandpack/src/manager/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import { dispatch, listen, registerFrame } from 'codesandbox-api';
33
import { getTemplate } from 'codesandbox-import-utils/lib/create-sandbox/templates';
44

5-
import generatePackageJSON from '../utils/generate-package-json';
5+
import generatePackageJSON, {
6+
getPackageJSON,
7+
} from '../utils/generate-package-json';
68
import version from '../version';
79

810
export interface IManagerOptions {
@@ -133,11 +135,7 @@ export default class PreviewManager {
133135
);
134136

135137
let packageJSON = JSON.parse(
136-
generatePackageJSON(
137-
this.sandboxInfo.files,
138-
this.sandboxInfo.dependencies,
139-
this.sandboxInfo.entry
140-
)['/package.json'].code
138+
getPackageJSON(this.sandboxInfo.dependencies, this.sandboxInfo.entry)
141139
);
142140
try {
143141
packageJSON = JSON.parse(files['/package.json'].code);

packages/sandpack/src/utils/generate-package-json.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
import { IFiles, IFile, IDependencies } from '../manager';
22

3+
export function getPackageJSON(
4+
dependencies: IDependencies = {},
5+
entry: string = '/index.js'
6+
) {
7+
return JSON.stringify(
8+
{
9+
name: 'sandpack-project',
10+
main: entry,
11+
dependencies,
12+
},
13+
null,
14+
2
15+
);
16+
}
17+
318
export default function createMissingPackageJSON(
419
files: IFiles,
520
dependencies?: IDependencies,
@@ -21,15 +36,7 @@ export default function createMissingPackageJSON(
2136
}
2237

2338
newFiles['/package.json'] = {
24-
code: JSON.stringify(
25-
{
26-
name: 'run',
27-
main: entry,
28-
dependencies,
29-
},
30-
null,
31-
2
32-
),
39+
code: getPackageJSON(dependencies, entry),
3340
};
3441
}
3542

0 commit comments

Comments
 (0)