Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
feat(menu): menu item to create a new copy of the designkit at specif…
Browse files Browse the repository at this point in the history
…ic location
  • Loading branch information
Lasse Küchler authored and lkuechler committed Dec 18, 2017
1 parent f4e0ee0 commit 1144b25
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"start-lsg": "npm run build-lsg && concurrently \"npm run build-lsg -- -w\" \"patternplate start\"",
"clean": "rm -rf build && rm -rf dist && rm -rf designkit",
"clean-build": "npm run clean && npm run build",
"copy-designkit": "cp -r ../designkit/ designkit",
"dist": "standard-version && npm run copy-designkit && npm run clean-build && electron-builder -mwl"
"copy-designkit": "cp -r ../designkit/ build/designkit",
"dist": "standard-version && npm run clean-build && npm run copy-designkit && electron-builder -mwl"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -43,6 +43,9 @@
"buildResources": "src/resources",
"output": "dist"
},
"asarUnpack": [
"build/designkit/**"
],
"nsis": {
"artifactName": "${productName}-${version}.${ext}",
"oneClick": false,
Expand All @@ -60,10 +63,11 @@
"@patternplate/cli": "^2.0.0-4",
"@patternplate/render-styled-components": "^2.0.0-3",
"@types/electron-devtools-installer": "^2.0.2",
"@types/fs-extra": "^5.0.0",
"@types/js-yaml": "^3.10.1",
"@types/node": "^8.0.53",
"@types/react": "^16.0.0",
"@types/react-dom": "^16.0.3",
"@types/react": "^16.0.0",
"concurrently": "^3.5.1",
"cz-conventional-changelog": "^2.1.0",
"electron": "^1.7.9",
Expand All @@ -77,6 +81,7 @@
"dependencies": {
"cli": "^1.0.1",
"electron-updater": "^2.17.6",
"fs-extra": "^5.0.0",
"js-yaml": "^3.10.0",
"mobx": "^3.3.2",
"mobx-react": "^4.3.5",
Expand Down
15 changes: 15 additions & 0 deletions src/electron/menu.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { BrowserWindow, MenuItem, MenuItemConstructorOptions, remote, WebContents } from 'electron';
import * as FileExtraUtils from 'fs-extra';
import { PageElement } from '../store/page/page_element';
import * as PathUtils from 'path';
import { Store } from '../store';
const { Menu, shell, app, dialog } = remote;

Expand All @@ -8,6 +10,19 @@ export function createMenu(store: Store): void {
{
label: '&File',
submenu: [
{
label: '&Create Styleguide',
click: () => {
dialog.showOpenDialog({ properties: ['openDirectory'] }, filePaths => {
FileExtraUtils.copySync(
PathUtils.join('resources', 'app.asar.unpacked', 'build', 'designkit'),
PathUtils.join(filePaths[0], 'designkit')
);
store.openStyleguide(`${filePaths[0]}/designkit`);
store.openFirstPage();
});
}
},
{
label: '&Open Styleguide',
accelerator: 'CmdOrCtrl+O',
Expand Down

0 comments on commit 1144b25

Please sign in to comment.