Skip to content

Commit f7524b4

Browse files
committed
fix(template): add private: true
1 parent 02d388a commit f7524b4

File tree

6 files changed

+45
-0
lines changed

6 files changed

+45
-0
lines changed

packages/api/core/spec/slow/init.slow.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ describe('init', () => {
3939
fs.existsSync(path.resolve(dir, 'node_modules/@electron-forge/cli')),
4040
).toEqual(true);
4141
expect(fs.existsSync(path.join(dir, 'forge.config.js'))).toEqual(true);
42+
43+
// init should create a `private: true` npm package
44+
const packageJSONString = await fs.promises.readFile(
45+
path.join(dir, 'package.json'),
46+
'utf-8',
47+
);
48+
const packageJSON = JSON.parse(packageJSONString);
49+
expect(packageJSON).toHaveProperty('private', true);
4250
});
4351

4452
describe('with electronVersion', () => {

packages/template/base/tmpl/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"version": "1.0.0",
55
"description": "My Electron application description",
66
"main": "src/index.js",
7+
"private": true,
78
"scripts": {
89
"start": "electron-forge start",
910
"package": "electron-forge package",

packages/template/vite-typescript/spec/ViteTypeScriptTemplate.slow.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ describe('ViteTypeScriptTemplate', () => {
5959
const jsFiles = await glob(path.join(dir, 'src', '**', '*.js'));
6060
expect(jsFiles.length).toEqual(0);
6161
});
62+
63+
it('should contain `private:true` in package.json', async () => {
64+
const packageJSONString = await fs.promises.readFile(
65+
path.join(dir, 'package.json'),
66+
'utf-8',
67+
);
68+
const packageJSON = JSON.parse(packageJSONString);
69+
expect(packageJSON).toHaveProperty('private', true);
70+
});
6271
});
6372

6473
describe('lint', () => {

packages/template/vite/spec/ViteTemplate.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,13 @@ describe('ViteTemplate', () => {
6969
(await fs.promises.readFile(path.join(dir, 'index.html'))).toString(),
7070
).toMatch(/src="\/src\/renderer\.js"/);
7171
});
72+
73+
it('should contain `private:true` in package.json', async () => {
74+
const packageJSONString = await fs.promises.readFile(
75+
path.join(dir, 'package.json'),
76+
'utf-8',
77+
);
78+
const packageJSON = JSON.parse(packageJSONString);
79+
expect(packageJSON).toHaveProperty('private', true);
80+
});
7281
});

packages/template/webpack-typescript/spec/WebpackTypeScript.slow.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ describe('WebpackTypeScriptTemplate', () => {
5151
expect(jsFiles.length).toEqual(0);
5252
});
5353

54+
it('should contain `private:true` in package.json', async () => {
55+
const packageJSONString = await fs.promises.readFile(
56+
path.join(dir, 'package.json'),
57+
'utf-8',
58+
);
59+
const packageJSON = JSON.parse(packageJSONString);
60+
expect(packageJSON).toHaveProperty('private', true);
61+
});
62+
5463
describe('lint', () => {
5564
it('should initially pass the linting process', async () => {
5665
delete process.env.TS_NODE_PROJECT;

packages/template/webpack/spec/WebpackTemplate.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,13 @@ describe('WebpackTemplate', () => {
6161
).toString(),
6262
).not.toMatch(/link rel="stylesheet"/);
6363
});
64+
65+
it('should contain `private:true` in package.json', async () => {
66+
const packageJSONString = await fs.promises.readFile(
67+
path.join(dir, 'package.json'),
68+
'utf-8',
69+
);
70+
const packageJSON = JSON.parse(packageJSONString);
71+
expect(packageJSON).toHaveProperty('private', true);
72+
});
6473
});

0 commit comments

Comments
 (0)