lincd-cli 0.2.41 → 0.2.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/post-merge +4 -0
- package/.husky/pre-commit +4 -0
- package/.prettierignore +4 -0
- package/.prettierrc.json +24 -0
- package/defaults/app-static/capacitor.config.ts +31 -81
- package/defaults/app-static/src/index-static.tsx +28 -0
- package/defaults/app-with-backend/.run/start.run.xml +12 -0
- package/defaults/app-with-backend/package.json +1 -0
- package/defaults/app-with-backend/src/layout/Header.tsx +7 -2
- package/defaults/app-with-backend/src/pages/PageNotFound.tsx +11 -0
- package/defaults/app-with-backend/src/pages/Signin.tsx +12 -0
- package/defaults/app-with-backend/src/routes.tsx +38 -8
- package/defaults/capacitor/scripts/fix-namespace.js +41 -0
- package/lib/cli-methods.js +1468 -1198
- package/lib/cli.js +98 -85
- package/lib/config-grunt.js +298 -229
- package/lib/config-webpack.js +358 -344
- package/lib/index.js +67 -29
- package/lib/interfaces.js +2 -2
- package/lib/plugins/declaration-plugin.js +209 -193
- package/lib/plugins/externalise-modules.js +167 -163
- package/lib/plugins/watch-run.js +16 -14
- package/lib/utils.js +326 -274
- package/package.json +17 -3
- package/defaults/app-static/frontend/src/index-static.tsx +0 -16
- /package/defaults/app-static/{frontend/web → web}/apple-touch-icon-144x144.png +0 -0
- /package/defaults/app-static/{frontend/web → web}/apple-touch-icon-57x57.png +0 -0
- /package/defaults/app-static/{frontend/web → web}/apple-touch-icon-72x72.png +0 -0
- /package/defaults/app-static/{frontend/web → web}/index.html +0 -0
package/.prettierignore
ADDED
package/.prettierrc.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"printWidth": 80,
|
|
3
|
+
"tabWidth": 2,
|
|
4
|
+
"bracketSpacing": false,
|
|
5
|
+
"useTabs": false,
|
|
6
|
+
"semi": true,
|
|
7
|
+
"singleQuote": true,
|
|
8
|
+
"trailingComma": "all",
|
|
9
|
+
"endOfLine": "auto",
|
|
10
|
+
"overrides": [
|
|
11
|
+
{
|
|
12
|
+
"files": "*.json",
|
|
13
|
+
"options": {
|
|
14
|
+
"printWidth": 200
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"files": "*.jsonld",
|
|
19
|
+
"options": {
|
|
20
|
+
"parser": "json"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -3,9 +3,9 @@ import { CapacitorConfig } from '@capacitor/cli';
|
|
|
3
3
|
const config: CapacitorConfig = {
|
|
4
4
|
appId: 'com.mydomain.FILL_IN_YOUR_OWN',
|
|
5
5
|
appName: 'FILL_IN_YOUR_OWN',
|
|
6
|
-
webDir: '
|
|
6
|
+
webDir: 'web',
|
|
7
7
|
server: {
|
|
8
|
-
allowNavigation: ['
|
|
8
|
+
allowNavigation: ['yourdomain.com', 'sub.yourdomain.com'],
|
|
9
9
|
},
|
|
10
10
|
bundledWebRuntime: false,
|
|
11
11
|
//Add or remove plugins that you need. Here is a starter list
|
|
@@ -13,85 +13,35 @@ const config: CapacitorConfig = {
|
|
|
13
13
|
CapacitorHttp: {
|
|
14
14
|
enabled: true,
|
|
15
15
|
},
|
|
16
|
-
FirebaseMessaging: {
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
GoogleAuth: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
SplashScreen: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default config;
|
|
49
|
-
|
|
50
|
-
import {CapacitorConfig} from '@capacitor/cli';
|
|
51
|
-
|
|
52
|
-
const config: CapacitorConfig = {
|
|
53
|
-
appId: 'com.spiritualplaymates.app',
|
|
54
|
-
appName: 'Spiritual Playmates',
|
|
55
|
-
webDir: 'frontend/web',
|
|
56
|
-
server: {
|
|
57
|
-
allowNavigation: ['spiritualplaymates.com', 'app.spiritualplaymates.com', 'http://reborn-pro.local:4000'],
|
|
58
|
-
},
|
|
59
|
-
cordova: {},
|
|
60
|
-
plugins: {
|
|
61
|
-
FirebaseMessaging: {
|
|
62
|
-
presentationOptions: ['badge', 'sound', 'alert'],
|
|
63
|
-
},
|
|
64
|
-
GoogleAuth: {
|
|
65
|
-
scopes: ['profile', 'email'],
|
|
66
|
-
//self created production web client
|
|
67
|
-
clientId: '734627482469-37q563qta2jt6bmhksemmvco8si0pmai.apps.googleusercontent.com',
|
|
68
|
-
serverClientId: '580968717451-68kpj51ulab8q7drbd3sr7imodai81lp.apps.googleusercontent.com',
|
|
69
|
-
//auto generated web client
|
|
70
|
-
//clientId: '580968717451-68kpj51ulab8q7drbd3sr7imodai81lp.apps.googleusercontent.com ',
|
|
71
|
-
androidClientId: '580968717451-68kpj51ulab8q7drbd3sr7imodai81lp.apps.googleusercontent.com',
|
|
72
|
-
|
|
73
|
-
iosClientId: '580968717451-aoj80o3e8qfjlmbrgabf916mfk4t3ntr.apps.googleusercontent.com',
|
|
74
|
-
forceCodeForRefreshToken: true,
|
|
75
|
-
},
|
|
76
|
-
CapacitorHttp: {
|
|
77
|
-
enabled: true,
|
|
78
|
-
},
|
|
79
|
-
SplashScreen: {
|
|
80
|
-
launchShowDuration: 400,
|
|
81
|
-
launchAutoHide: true,
|
|
82
|
-
// launchFadeOutDuration: 500,
|
|
83
|
-
backgroundColor: '#F7E5FF',
|
|
84
|
-
androidSplashResourceName: 'splash',
|
|
85
|
-
// androidScaleType: 'CENTER',
|
|
86
|
-
showSpinner: false,
|
|
87
|
-
// androidSpinnerStyle: 'large',
|
|
88
|
-
// iosSpinnerStyle: 'small',
|
|
89
|
-
// spinnerColor: '#999999',
|
|
90
|
-
splashFullScreen: true,
|
|
91
|
-
splashImmersive: true,
|
|
92
|
-
// layoutName: 'launch_screen',
|
|
93
|
-
// useDialog: true,
|
|
94
|
-
},
|
|
16
|
+
// FirebaseMessaging: {
|
|
17
|
+
// presentationOptions: ['badge', 'sound', 'alert'],
|
|
18
|
+
// },
|
|
19
|
+
// GoogleAuth: {
|
|
20
|
+
// scopes: ['profile', 'email'],
|
|
21
|
+
// //self created production web client
|
|
22
|
+
// clientId: '...',
|
|
23
|
+
// //For these lines use the auto generated web client "Web client (auto created by Google Service)"
|
|
24
|
+
// serverClientId: '....',
|
|
25
|
+
// androidClientId: '...',
|
|
26
|
+
// iosClientId: '...',
|
|
27
|
+
// forceCodeForRefreshToken: true,
|
|
28
|
+
// },
|
|
29
|
+
// SplashScreen: {
|
|
30
|
+
// launchShowDuration: 400,
|
|
31
|
+
// launchAutoHide: true,
|
|
32
|
+
// backgroundColor: '#F7E5FF',
|
|
33
|
+
// androidSplashResourceName: 'splash',
|
|
34
|
+
// showSpinner: false,
|
|
35
|
+
// splashFullScreen: true,
|
|
36
|
+
// splashImmersive: true,
|
|
37
|
+
// // launchFadeOutDuration: 500,
|
|
38
|
+
// // androidScaleType: 'CENTER',
|
|
39
|
+
// // androidSpinnerStyle: 'large',
|
|
40
|
+
// // iosSpinnerStyle: 'small',
|
|
41
|
+
// // spinnerColor: '#999999',
|
|
42
|
+
// // layoutName: 'launch_screen',
|
|
43
|
+
// // useDialog: true,
|
|
44
|
+
// },
|
|
95
45
|
},
|
|
96
46
|
};
|
|
97
47
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom/client';
|
|
3
|
+
import {BrowserRouter} from 'react-router-dom';
|
|
4
|
+
import App from './App';
|
|
5
|
+
import {BackendAPIStore} from 'lincd-server/lib/shapes/BackendAPIStore';
|
|
6
|
+
import {Storage} from 'lincd/lib/utils/Storage';
|
|
7
|
+
import {AppContextProvider} from 'lincd-server-utils/lib/components/AppContext';
|
|
8
|
+
|
|
9
|
+
const root = ReactDOM.createRoot(
|
|
10
|
+
// document
|
|
11
|
+
// document.body
|
|
12
|
+
document.getElementById('root') as HTMLElement
|
|
13
|
+
);
|
|
14
|
+
//store all quads in a file on the backend named 'main'
|
|
15
|
+
// export const store = new BackendFileStore('main');
|
|
16
|
+
export const store = new BackendAPIStore();
|
|
17
|
+
Storage.setDefaultStore(store);
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
root.render(
|
|
21
|
+
<React.StrictMode>
|
|
22
|
+
<BrowserRouter>
|
|
23
|
+
<AppContextProvider isNativeApp={true}>
|
|
24
|
+
<App />
|
|
25
|
+
</AppContextProvider>
|
|
26
|
+
</BrowserRouter>
|
|
27
|
+
</React.StrictMode>
|
|
28
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="start" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="start" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<envs />
|
|
10
|
+
<method v="2" />
|
|
11
|
+
</configuration>
|
|
12
|
+
</component>
|
|
@@ -9,8 +9,13 @@ export function Header() {
|
|
|
9
9
|
<header className={style.header}>
|
|
10
10
|
<h1>${name}</h1>
|
|
11
11
|
<nav className={style.menu}>
|
|
12
|
-
{Object.keys(ROUTES).map(key => {
|
|
13
|
-
|
|
12
|
+
{Object.keys(ROUTES).map((key) => {
|
|
13
|
+
if (ROUTES[key].excludeFromMenu) return null;
|
|
14
|
+
return (
|
|
15
|
+
<Link key={key} to={ROUTES[key].path}>
|
|
16
|
+
{ROUTES[key].label || key}
|
|
17
|
+
</Link>
|
|
18
|
+
);
|
|
14
19
|
})}
|
|
15
20
|
</nav>
|
|
16
21
|
</header>
|
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
import React, {lazy, Suspense} from 'react';
|
|
2
2
|
import {Route, Routes} from 'react-router-dom';
|
|
3
3
|
import {Spinner} from './components/Spinner';
|
|
4
|
+
import {RequireAuth} from 'lincd-auth/lib/components/RequireAuth';
|
|
5
|
+
import PageNotFound from './pages/PageNotFound';
|
|
4
6
|
|
|
5
7
|
//In React 18 you can use 'lazy' to import pages only when you need them.
|
|
6
8
|
//This will cause webpack to create multiple bundles, and the right bundles are automatically loaded
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
interface RouteObj {
|
|
10
|
+
path: string;
|
|
11
|
+
component?: React.LazyExoticComponent<() => JSX.Element>;
|
|
12
|
+
render?: () => JSX.Element;
|
|
13
|
+
requireAuth?: boolean;
|
|
14
|
+
excludeFromMenu?: boolean;
|
|
15
|
+
label?: string;
|
|
16
|
+
}
|
|
17
|
+
export const ROUTES: {[key: string]: RouteObj} = {
|
|
9
18
|
index: {
|
|
10
19
|
path: '/',
|
|
11
20
|
component: lazy(() => import('./pages/Home' /* webpackPrefetch: true */)),
|
|
12
|
-
|
|
13
|
-
label:"Home",
|
|
21
|
+
label: 'Home',
|
|
14
22
|
},
|
|
15
23
|
page1: {
|
|
16
24
|
path: '/page1',
|
|
17
25
|
component: lazy(() => import('./pages/Page1' /* webpackPrefetch: true */)),
|
|
18
|
-
label:
|
|
26
|
+
label: 'Protected page',
|
|
27
|
+
requireAuth: true,
|
|
28
|
+
},
|
|
29
|
+
signin: {
|
|
30
|
+
path: '/signin',
|
|
31
|
+
component: lazy(() => import('./pages/Signin' /* webpackPrefetch: true */)),
|
|
32
|
+
label: 'Sign In',
|
|
33
|
+
excludeFromMenu: true,
|
|
19
34
|
},
|
|
20
35
|
};
|
|
21
36
|
|
|
@@ -25,18 +40,33 @@ export default function AppRoutes() {
|
|
|
25
40
|
{Object.keys(ROUTES).map((routeName) => {
|
|
26
41
|
const route = ROUTES[routeName];
|
|
27
42
|
const Component = route.component;
|
|
43
|
+
|
|
44
|
+
//if a route is marked as requireAuth, wrap it in the RequireAuth component and pass the signinRoute
|
|
45
|
+
const AuthGuard = route.requireAuth ? RequireAuth : React.Fragment;
|
|
46
|
+
const authProps = route.requireAuth
|
|
47
|
+
? {signinRoute: ROUTES.signin.path}
|
|
48
|
+
: {};
|
|
49
|
+
|
|
50
|
+
// define a render function that determines what to render based on the component and route.render
|
|
51
|
+
const renderRoute = () =>
|
|
52
|
+
// if a Component is defined, render it using JSX syntax (<Component />)
|
|
53
|
+
// if not, check if a route.render function is defined and call that render function if available.
|
|
54
|
+
// if neither Component nor route.render is defined, return null
|
|
55
|
+
Component ? <Component /> : route.render ? route.render() : null;
|
|
56
|
+
|
|
28
57
|
return (
|
|
29
58
|
<Route
|
|
30
59
|
key={route.path}
|
|
31
60
|
path={route.path}
|
|
32
61
|
element={
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
</
|
|
62
|
+
<AuthGuard {...authProps}>
|
|
63
|
+
<Suspense fallback={<Spinner />}>{renderRoute()}</Suspense>
|
|
64
|
+
</AuthGuard>
|
|
36
65
|
}
|
|
37
66
|
/>
|
|
38
67
|
);
|
|
39
68
|
})}
|
|
69
|
+
<Route path="*" element={<PageNotFound />} />
|
|
40
70
|
</Routes>
|
|
41
71
|
);
|
|
42
72
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
fs = require('fs');
|
|
2
|
+
|
|
3
|
+
let file = 'android/capacitor-cordova-android-plugins/build.gradle';
|
|
4
|
+
|
|
5
|
+
//check if file exists
|
|
6
|
+
if (!fs.existsSync(file)) {
|
|
7
|
+
console.log('File does not exist.', file);
|
|
8
|
+
} else {
|
|
9
|
+
//read contents of "android/capacitor-cordova-android-plugins/build.gradle"
|
|
10
|
+
let contents = fs.readFileSync(file, 'utf8');
|
|
11
|
+
|
|
12
|
+
if (!contents.includes('namespace')) {
|
|
13
|
+
//insert text on line 19
|
|
14
|
+
contents = contents.replace(
|
|
15
|
+
/android \{/,
|
|
16
|
+
`android {
|
|
17
|
+
namespace 'capacitor.android.plugins'`,
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
//write back to file
|
|
21
|
+
fs.writeFileSync(file, contents, 'utf8');
|
|
22
|
+
|
|
23
|
+
console.log('Added namespace to ' + file);
|
|
24
|
+
} else {
|
|
25
|
+
console.log('Namespace already present in ' + file);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let file2 = 'ios/App/Pods/Pods.xcodeproj/project.pbxproj';
|
|
30
|
+
if (!fs.existsSync(file2)) {
|
|
31
|
+
console.log('File does not exist.', file2);
|
|
32
|
+
} else {
|
|
33
|
+
let contents2 = fs.readFileSync(file2, 'utf8');
|
|
34
|
+
if (contents2.includes('IPHONEOS_DEPLOYMENT_TARGET = 12.0')) {
|
|
35
|
+
contents2 = contents2.replace(/IPHONEOS_DEPLOYMENT_TARGET \= 12\.0/g, `IPHONEOS_DEPLOYMENT_TARGET = 13.0`);
|
|
36
|
+
fs.writeFileSync(file2, contents2, 'utf8');
|
|
37
|
+
console.log('Fixed IOS target version for codetrix google oauth plugin');
|
|
38
|
+
} else {
|
|
39
|
+
console.log("Didn't need to fix IOS target version");
|
|
40
|
+
}
|
|
41
|
+
}
|