Skip to content

Commit

Permalink
Merge pull request #27 from firecamp-io/feat/platform
Browse files Browse the repository at this point in the history
Feat/platform
  • Loading branch information
Nishchit14 committed Oct 8, 2022
2 parents 6959a4c + 9b7c18d commit c7dff16
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 194 deletions.
2 changes: 2 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[context.deploy-preview]
command = "yarn dlx dotenv-vault@latest pull --dotenvMe $STAGING_DOTENV_IT -y && yarn release:web-app:staging"
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
"scripts": {
"build:monorepo": "lerna run build --scope=@firecamp/js-executor --scope=@firecamp/rest-executor",
"start": "npx webpack serve --config ./webpack.dev.js",
"dev": "APP_VERSION=$npm_package_version AppFormat=webapp && node scripts/build && npm run build:monorepo && yarn start",
"dev": "APP_VERSION=$npm_package_version AppFormat=webapp && node scripts/build && yarn build:monorepo && yarn start",
"electron": "npx electron .",
"release:web-app": "AppFormat=webapp && node scripts/release production",
"release:web-app:staging": "AppFormat=webapp && node scripts/release staging",
"release:extension": "export AppFormat=extension && node scripts/release production",
"release:prod:mac-dmg": "export AppFormat=dmg && node scripts/release production p",
"release:prod:linux-appImage": "export AppFormat=appImage && node scripts/release production",
"release:prod:linux-snap": "export AppFormatode scripts/release production p",
"release:prod:win32-nsis": "export AppFormat=nsis && node scripts/release production p",
"release:canary:mac-dmg": "export AppFormatdmg && node scripts/release canary p",
"release:canary:linux-appImage": "export AppFormatappImage && node scripts/release canary p",
"release:canary:win32-nsis": "export AppFormat=nsis && node scripts/release canary p",
"release:web-app:staging": "AppFormat=webapp && yarn build:monorepo && node scripts/release staging",
"release:prod:mac-dmg": "AppFormat=dmg && node scripts/release production p",
"release:prod:linux-appImage": "AppFormat=appImage && node scripts/release production",
"release:prod:linux-snap": "AppFormat=snap scripts/release production p",
"release:prod:win32-nsis": "AppFormat=nsis && node scripts/release production p",
"release:canary:mac-dmg": "AppFormat=dmg && node scripts/release canary p",
"release:canary:linux-appImage": "AppFormat=appImage && node scripts/release canary p",
"release:canary:win32-nsis": "AppFormat=nsis && node scripts/release canary p",
"clean": "rimraf build/ development/ *.zip* .crx",
"lint": "eslint packages/firecamp-rest/src/**/*.{ts|tsx} packages/*.js packages-clients/*.js scripts webpack/*.js",
"test-e2e": "cross-env NODE_ENV=test mocha -r ./test/setup-app test/e2e",
Expand Down
1 change: 0 additions & 1 deletion packages/firecamp-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"fuzzysort": "^2.0.1",
"javascript-stringify": "^2.0.0",
"js-yaml": "^4.1.0",
"json-as-form": "^0.0.22",
"json-templates": "^3.0.0",
"markdown-it": "^13.0.1",
"marked": "^0.7.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC } from 'react';
import JSONForm from 'json-as-form';
// import JSONForm from 'json-as-form';

const Files: FC<any> = ({}) => {
return <span>coming soon</span>;
Expand Down
25 changes: 13 additions & 12 deletions packages/ui-kit/src/components/smart-json-table/SmartJSONTable.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-nocheck

import { memo, useState } from 'react';
import JSONForm from 'json-as-form';
// import JSONForm from 'json-as-form';
import './SmartJSONTable.sass';
import {
Dropdown,
Expand Down Expand Up @@ -140,17 +140,18 @@ const SmartJSONTable = ({
case SMART_JSON_TABLE_TYPES.FORM:
// console.log(title, SMART_JSON_TABLE_TYPES.FORM, `jsonState`, jsonState);
// console.log(title, `FORM`, meta[SMART_JSON_TABLE_TYPES.FORM]);
return (
<JSONForm
json={jsonState}
onChange={(row) => {
_onChange(row);
}}
debug={false}
autoAddRow={true}
{...(meta[SMART_JSON_TABLE_TYPES.FORM] || {})}
/>
);
return <></>
// return (
// <JSONForm
// json={jsonState}
// onChange={(row) => {
// _onChange(row);
// }}
// debug={false}
// autoAddRow={true}
// {...(meta[SMART_JSON_TABLE_TYPES.FORM] || {})}
// />
// );
break;

case SMART_JSON_TABLE_TYPES.TABLE:
Expand Down
6 changes: 3 additions & 3 deletions packages/ui-kit/src/scss/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,9 @@ body .ace_editor .ace_scrollbar{
user-select: text;
}

.json-as-form input.json_row--key, .json-as-form input.json_row--value{
background: transparent;
}
// .json-as-form input.json_row--key, .json-as-form input.json_row--value{
// background: transparent;
// }
/*----------other css end--------*/

/*---code mirror css starts -------*/
Expand Down
119 changes: 35 additions & 84 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,33 @@
require('dotenv').config();
const fs = require('fs');
const path = require('path');
const colors = require('colors');
// const colors = require('colors');
const { Environment, AppFormat } = require('./constants');
const build = require('../webpack.prod');
require('shelljs/global');

const env = process.env.NODE_ENV;

module.exports = async () => {
try {
// const replaceTasks = [
// {
// from: path.join(
// __dirname,
// '../webpack/replace/JsonpMainTemplate.runtime.js'
// ),
// to: path.join(
// __dirname,
// '../node_modules/webpack/lib/JsonpMainTemplate.runtime.js'
// ),
// },
// {
// from: path.join(__dirname, '../webpack/replace/process-update.js'),
// to: path.join(
// __dirname,
// '../node_modules/webpack-hot-middleware/process-update.js'
// ),
// },
// ];

// // Replace webpack config path
// replaceTasks.forEach((task) => cp(task.from, task.to));

// Copy project assets and generate config.
const directoryPaths = [
path.join(`${__dirname}/../build`),
path.join(`${__dirname}/../build/development`),
path.join(`${__dirname}/../build/production`),
path.join(`${__dirname}/../build/development/build-scripts`),
path.join(`${__dirname}/../build/production/build-scripts`),
path.join(`${__dirname}/../build/production/services`),
path.join(`${__dirname}/../build/production/packages-executors`),
];

// Hold the build path as per the environment mode
const buildPath =
process.env.NODE_ENV === Environment.Development
? directoryPaths[1]
: directoryPaths[2];

// Remove all builds before start bundle
// hold the build path as per the environment mode
const buildPath = path.join(`${__dirname}/../build/${env}`);
// copy project assets and generate config.
const directoryPaths = [path.join(`${__dirname}/../build`), buildPath];
if (env === Environment.Development) {
directoryPaths.push(
path.join(`${__dirname}/../build/${env}/build-scripts`)
);
}
if (env === Environment.Production) {
directoryPaths.push(
path.join(`${__dirname}/../build/${env}/build-scripts`),
path.join(`${__dirname}/../build/${env}/services`),
path.join(`${__dirname}/../build/${env}/packages-executors`)
);
}

// Remove build before start bundle
rm('-rf', buildPath);

// Create build directories
Expand All @@ -74,29 +53,27 @@ module.exports = async () => {
);

// generate package.json and manifest based on app environment
if (process.env.NODE_ENV === Environment.Development)
exec(`node ${buildPath}/build-scripts/init-package.js`);
else exec(`node ${buildPath}/build-scripts/init-package.js`);
// exec(`node ${buildPath}/build-scripts/init-package.js`);

// Generate .html
exec(
`pug -O "{ env: '${process.env.NODE_ENV}' }" -o ${buildPath} ${path.join(
`pug -O "{ env: '${env}' }" -o ${buildPath} ${path.join(
__dirname,
'../packages/firecamp-core/public/views/'
)}`
);

cp(
'-R',
path.join(
`${__dirname}/../packages/firecamp-desktop-app/public/splashscreen.html`
),
`${buildPath}`
);
// cp(
// '-R',
// path.join(
// `${__dirname}/../packages/firecamp-desktop-app/public/splashscreen.html`
// ),
// `${buildPath}`
// );

// Copy electron agent assets, config and services
if (
process.env.NODE_ENV === Environment.Production &&
env === Environment.Production &&
process.env.AppFormat !== AppFormat.WebApp
) {
// Copy electron agent services
Expand All @@ -122,7 +99,7 @@ module.exports = async () => {
cp(
'-R',
path.join(
`${__dirname}/../packages/firecamp-desktop-app/public/assets/${process.env.NODE_ENV}/mac/*`
`${__dirname}/../packages/firecamp-desktop-app/public/assets/${env}/mac/*`
),
`${buildPath}/build`
);
Expand All @@ -133,7 +110,7 @@ module.exports = async () => {
'-R',
path.join(
`${__dirname}/../packages/firecamp-desktop-app/public/assets/${
[...Object.values(Environment)].includes(process.env.NODE_ENV)
[...Object.values(Environment)].includes(env)
? 'production'
: 'canary'
}`
Expand All @@ -142,7 +119,7 @@ module.exports = async () => {
);
}

if (process.env.NODE_ENV === 'production') {
if (env === Environment.Production || env === Environment.Staging) {
await build();
}

Expand All @@ -152,30 +129,4 @@ module.exports = async () => {
}
};

if (process.env.NODE_ENV === 'development') {
if (process.env.NODE_ENV === Environment.Production) {
console.log(
`${colors.red(
'Error:'
)} Invalid value set for env. variable (NODE_ENV: ${colors.yellow(
process.env.NODE_ENV
)})`
);
process.exit();
}

if (process.env.NODE_ENV === Environment.Development) module.exports();
}

if (process.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV === Environment.Development) {
console.log(
`${colors.red(
'Error:'
)} Invalid value set for env. variable (NODE_ENV: ${colors.yellow(
process.env.NODE_ENV
)})`
);
process.exit();
}
}
if (env === Environment.Development) module.exports();
Loading

0 comments on commit c7dff16

Please sign in to comment.