Skip to content

Commit

Permalink
Merge 6f12b3d into fff2361
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoBrusa committed May 15, 2023
2 parents fff2361 + 6f12b3d commit 46a7517
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 298 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-rats-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'modular-scripts': patch
---

Fix esm-views not starting
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`create-modular-react-app WHEN it sets up a project with prefer Offline SHOULD setup an package.json correctly 1`] = `
{
"author": "?",
"browserslist": {
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
],
"production": [
">0.2%",
"not dead",
"not op_mini all",
],
},
"dependencies": {
"@testing-library/dom": "?",
"@testing-library/jest-dom": "?",
"@testing-library/react": "?",
"@testing-library/user-event": "?",
"@types/jest": "?",
"@types/node": "?",
"@types/react": "?",
"@types/react-dom": "?",
"eslint-config-modular-app": "?",
"modular-scripts": "?",
"prettier": "?",
"react": "?",
"react-dom": "?",
"typescript": "?",
},
"eslintConfig": {
"extends": "modular-app/recommended",
},
"license": "MIT",
"main": "index.js",
"modular": {
"type": "root",
},
"name": "test-repo",
"prettier": {
"printWidth": 80,
"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all",
},
"private": true,
"scripts": {
"build": "modular build",
"lint": "modular lint",
"prettier": "prettier --write .",
"start": "modular start",
"test": "modular test",
},
"version": "1.0.0",
"workspaces": [
"packages/**",
],
}
`;

exports[`create-modular-react-app WHEN it sets up a project with prefer Offline should create a project with prefer offline 1`] = `
"test-repo
├─ .editorconfig
Expand Down Expand Up @@ -42,89 +103,7 @@ exports[`create-modular-react-app WHEN it sets up a project with prefer Offline
└─ yarn.lock"
`;

exports[`create-modular-react-app WHEN setting a project with defaults Sets up an app package.json correctly:
Object {
"author": "?",
"dependencies": Object {},
"modular": Object {
"type": "app",
},
"name": "app",
"private": true,
"version": "0.1.0",
}
1`] = `
{
"author": "?",
"modular": {
"type": "app",
},
"name": "app",
"private": true,
"version": "1.0.0",
}
`;

exports[`create-modular-react-app WHEN setting a project with defaults Sets up the package.json correctly:
Object {
"author": "?",
"browserslist": Object {
"development": Array [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
],
"production": Array [
">0.2%",
"not dead",
"not op_mini all",
],
},
"dependencies": Object {
"@testing-library/dom": "?",
"@testing-library/jest-dom": "?",
"@testing-library/react": "?",
"@testing-library/user-event": "?",
"@types/jest": "?",
"@types/node": "?",
"@types/react": "?",
"@types/react-dom": "?",
"eslint-config-modular-app": "?",
"modular-scripts": "?",
"prettier": "?",
"react": "?",
"react-dom": "?",
"typescript": "?",
},
"eslintConfig": Object {
"extends": "modular-app",
},
"license": "MIT",
"main": "index.js",
"modular": Object {
"type": "root",
},
"name": "test-repo",
"prettier": Object {
"printWidth": 80,
"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all",
},
"private": true,
"scripts": Object {
"build": "modular build",
"lint": "modular lint",
"prettier": "prettier --write .",
"start": "modular start",
"test": "modular test",
},
"version": "1.0.0",
"workspaces": Array [
"packages/**",
],
}
1`] = `
exports[`create-modular-react-app WHEN setting a project with defaults Sets up the package.json correctly 1`] = `
{
"author": "?",
"browserslist": {
Expand All @@ -150,7 +129,6 @@ exports[`create-modular-react-app WHEN setting a project with defaults Sets up t
"@types/react-dom": "?",
"eslint-config-modular-app": "?",
"modular-scripts": "?",
"modular-template-app": "?",
"prettier": "?",
"react": "?",
"react-dom": "?",
Expand Down
154 changes: 17 additions & 137 deletions packages/create-modular-react-app/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,85 +70,25 @@ describe('create-modular-react-app', () => {
it('Sets up the package.json correctly', async () => {
expect(
await readCensoredPackageJson(path.join(destination, 'package.json')),
).toMatchSnapshot(`
Object {
"author": "?",
"browserslist": Object {
"development": Array [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
],
"production": Array [
">0.2%",
"not dead",
"not op_mini all",
],
},
"dependencies": Object {
"@testing-library/dom": "?",
"@testing-library/jest-dom": "?",
"@testing-library/react": "?",
"@testing-library/user-event": "?",
"@types/jest": "?",
"@types/node": "?",
"@types/react": "?",
"@types/react-dom": "?",
"eslint-config-modular-app": "?",
"modular-scripts": "?",
"prettier": "?",
"react": "?",
"react-dom": "?",
"typescript": "?",
},
"eslintConfig": Object {
"extends": "modular-app",
},
"license": "MIT",
"main": "index.js",
"modular": Object {
"type": "root",
},
"name": "test-repo",
"prettier": Object {
"printWidth": 80,
"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all",
},
"private": true,
"scripts": Object {
"build": "modular build",
"lint": "modular lint",
"prettier": "prettier --write .",
"start": "modular start",
"test": "modular test",
},
"version": "1.0.0",
"workspaces": Array [
"packages/**",
],
}
`);
).toMatchSnapshot();
});

it('Sets up an app package.json correctly', async () => {
expect(
await readCensoredPackageJson(
path.join(destination, 'packages', 'app', 'package.json'),
),
).toMatchSnapshot(`
Object {
"author": "?",
"dependencies": Object {},
"modular": Object {
"type": "app",
},
"name": "app",
"private": true,
"version": "0.1.0",
}
`);
).toMatchInlineSnapshot(`
{
"author": "?",
"modular": {
"type": "app",
},
"name": "app",
"private": true,
"version": "1.0.0",
}
`);
});
});

Expand All @@ -168,83 +108,23 @@ describe('create-modular-react-app', () => {
it('SHOULD setup an package.json correctly', async () => {
expect(
await readCensoredPackageJson(path.join(destination, 'package.json')),
).toMatchSnapshot(`
Object {
"author": "?",
"browserslist": Object {
"development": Array [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
],
"production": Array [
">0.2%",
"not dead",
"not op_mini all",
],
},
"dependencies": Object {
"@testing-library/dom": "?",
"@testing-library/jest-dom": "?",
"@testing-library/react": "?",
"@testing-library/user-event": "?",
"@types/jest": "?",
"@types/node": "?",
"@types/react": "?",
"@types/react-dom": "?",
"eslint-config-modular-app": "?",
"modular-scripts": "?",
"prettier": "?",
"react": "?",
"react-dom": "?",
"typescript": "?",
},
"eslintConfig": Object {
"extends": "modular-app",
},
"license": "MIT",
"main": "index.js",
"modular": Object {
"type": "root",
},
"name": "test-repo",
"prettier": Object {
"printWidth": 80,
"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all",
},
"private": true,
"scripts": Object {
"build": "modular build",
"lint": "modular lint",
"prettier": "prettier --write .",
"start": "modular start",
"test": "modular test",
},
"version": "1.0.0",
"workspaces": Array [
"packages/**",
],
}
`);
).toMatchSnapshot();
});

it('SHOULD setup an app package.json correctly', async () => {
expect(
await readCensoredPackageJson(
path.join(destination, 'packages', 'app', 'package.json'),
),
).toMatchSnapshot(`
Object {
).toMatchInlineSnapshot(`
{
"author": "?",
"dependencies": Object {},
"modular": Object {
"modular": {
"type": "app",
},
"name": "app",
"private": true,
"version": "0.1.0",
"version": "1.0.0",
}
`);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/modular-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"dotenv": "16.0.2",
"dotenv-expand": "8.0.3",
"esbuild": "0.17.14",
"esbuild-loader": "3.0.1",
"esbuild-loader": "^2.16.0",
"escape-string-regexp": "2.0.0",
"eslint": "8.28.0",
"execa": "5.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ exports[`when working with a NODE_ENV app WHEN building with esbuild can generat
"
`;

exports[`when working with a NODE_ENV app WHEN building with webpack can generate a js/main.5d879077.js 1`] = `
exports[`when working with a NODE_ENV app WHEN building with webpack can generate a js/main.a482480b.js 1`] = `
""use strict";
(self.webpackChunknode_env_app = self.webpackChunknode_env_app || []).push([
[179],
{
560: () => {
908: () => {
console.log("production");
},
},
(e) => {
var n;
(n = 560), e((e.s = n));
(n = 908), e((e.s = n));
},
]);
//# sourceMappingURL=main.6f2657b7.js.map
//# sourceMappingURL=main.a482480b.js.map
"
`;

0 comments on commit 46a7517

Please sign in to comment.