proteum 1.0.0 → 1.0.3

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.
Files changed (70) hide show
  1. package/AGENTS.md +9 -0
  2. package/cli/app/config.ts +61 -0
  3. package/cli/app/index.ts +227 -0
  4. package/cli/bin.js +35 -0
  5. package/cli/commands/build.ts +60 -0
  6. package/cli/commands/deploy/app.ts +29 -0
  7. package/cli/commands/deploy/web.ts +60 -0
  8. package/cli/commands/dev.ts +124 -0
  9. package/cli/commands/init.ts +85 -0
  10. package/cli/commands/refresh.ts +18 -0
  11. package/cli/compiler/client/identite.ts +69 -0
  12. package/cli/compiler/client/index.ts +343 -0
  13. package/cli/compiler/common/babel/index.ts +173 -0
  14. package/cli/compiler/common/babel/plugins/index.ts +0 -0
  15. package/cli/compiler/common/babel/plugins/services.ts +586 -0
  16. package/cli/compiler/common/babel/routes/imports.ts +127 -0
  17. package/cli/compiler/common/babel/routes/routes.ts +1170 -0
  18. package/cli/compiler/common/files/autres.ts +39 -0
  19. package/cli/compiler/common/files/images.ts +42 -0
  20. package/cli/compiler/common/files/style.ts +82 -0
  21. package/cli/compiler/common/index.ts +165 -0
  22. package/cli/compiler/index.ts +585 -0
  23. package/cli/compiler/server/index.ts +220 -0
  24. package/cli/index.ts +213 -0
  25. package/cli/paths.ts +165 -0
  26. package/cli/print.ts +12 -0
  27. package/cli/tsconfig.json +42 -0
  28. package/cli/utils/index.ts +22 -0
  29. package/cli/utils/keyboard.ts +78 -0
  30. package/client/app/index.ts +2 -0
  31. package/client/components/Dialog/Manager.tsx +3 -49
  32. package/client/components/Dialog/index.less +3 -1
  33. package/client/components/index.ts +1 -2
  34. package/client/services/router/index.tsx +6 -16
  35. package/common/errors/index.tsx +12 -31
  36. package/package.json +58 -22
  37. package/server/app/container/config.ts +20 -1
  38. package/server/app/container/console/index.ts +1 -1
  39. package/server/services/auth/index.ts +62 -27
  40. package/server/services/auth/router/request.ts +17 -6
  41. package/server/services/router/http/index.ts +3 -3
  42. package/server/services/router/response/index.ts +1 -1
  43. package/server/services/schema/request.ts +28 -10
  44. package/server/utils/slug.ts +0 -3
  45. package/tsconfig.common.json +2 -1
  46. package/types/global/constants.d.ts +12 -0
  47. package/changelog.md +0 -5
  48. package/client/components/Button.tsx +0 -298
  49. package/client/components/Dialog/card.tsx +0 -208
  50. package/client/data/input.ts +0 -32
  51. package/client/pages/bug.tsx.old +0 -60
  52. package/templates/composant.tsx +0 -40
  53. package/templates/form.ts +0 -30
  54. package/templates/modal.tsx +0 -47
  55. package/templates/modele.ts +0 -56
  56. package/templates/page.tsx +0 -74
  57. package/templates/route.ts +0 -43
  58. package/templates/service.ts +0 -75
  59. package/vscode/copyimportationpath/.eslintrc.json +0 -24
  60. package/vscode/copyimportationpath/.vscodeignore +0 -12
  61. package/vscode/copyimportationpath/CHANGELOG.md +0 -9
  62. package/vscode/copyimportationpath/README.md +0 -3
  63. package/vscode/copyimportationpath/copyimportationpath-0.0.1.vsix +0 -0
  64. package/vscode/copyimportationpath/out/extension.js +0 -206
  65. package/vscode/copyimportationpath/out/extension.js.map +0 -1
  66. package/vscode/copyimportationpath/package-lock.json +0 -4536
  67. package/vscode/copyimportationpath/package.json +0 -86
  68. package/vscode/copyimportationpath/src/extension.ts +0 -300
  69. package/vscode/copyimportationpath/tsconfig.json +0 -22
  70. package/vscode/copyimportationpath/vsc-extension-quickstart.md +0 -42
@@ -0,0 +1,220 @@
1
+ /*----------------------------------
2
+ - DEPENDANCES
3
+ ----------------------------------*/
4
+
5
+ // Npm
6
+ import webpack from 'webpack';
7
+ import fs from 'fs-extra';
8
+
9
+ // Minimizers
10
+ const TerserPlugin = require("terser-webpack-plugin");
11
+ //var VirtualModulesPlugin = require('webpack-virtual-modules');
12
+
13
+ // Core
14
+ import cli from '@cli';
15
+ import createCommonConfig, { TCompileMode, TCompileOutputTarget, regex } from '../common';
16
+
17
+ // Type
18
+ import type { App } from '../../app';
19
+
20
+ /*const getCorePluginsList = (app: App,) => {
21
+
22
+ const corePlugins: string[] = [];
23
+
24
+ if (fs.existsSync( app.paths.root + '/node_modules' ))
25
+ for (const moduleName of fs.readdirSync( app.paths.root + '/node_modules' ))
26
+ if (moduleName.startsWith('proteum'))
27
+ corePlugins.push(app.paths.root + '/node_modules/' + moduleName + '/src');
28
+
29
+ if (fs.existsSync( cli.paths.core.root + '/node_modules' ))
30
+ for (const moduleName of fs.readdirSync( cli.paths.core.root+ '/node_modules' ))
31
+ if (moduleName.startsWith('proteum'))
32
+ corePlugins.push(cli.paths.core.root + '/node_modules/' + moduleName + '/src');
33
+
34
+ return corePlugins;
35
+ }*/
36
+
37
+ const debug = false;
38
+
39
+ /*----------------------------------
40
+ - CONFIG
41
+ ----------------------------------*/
42
+ export default function createCompiler(
43
+ app: App,
44
+ mode: TCompileMode,
45
+ outputTarget: TCompileOutputTarget = mode === 'dev' ? 'dev' : 'bin'
46
+ ): webpack.Configuration {
47
+
48
+ debug && console.info(`Creating compiler for server (${mode}).`);
49
+ const dev = mode === 'dev';
50
+ const buildDev = dev && outputTarget === 'bin';
51
+ const outputPath = app.outputPath(outputTarget);
52
+
53
+ const commonConfig = createCommonConfig(app, 'server', mode, outputTarget);
54
+ const { aliases } = app.aliases.server.forWebpack({
55
+ modulesPath: app.paths.root + '/node_modules'
56
+ });
57
+
58
+ // We're not supposed in any case to import client services from server
59
+ delete aliases["@client/services"];
60
+ delete aliases["@/client/services"];
61
+
62
+ debug && console.log(`[${mode}] node_modules dirs:`, commonConfig.resolveLoader?.modules,
63
+ '\nModule aliases for webpack:', aliases);
64
+ const config: webpack.Configuration = {
65
+
66
+ ...commonConfig,
67
+
68
+ name: 'server',
69
+ target: 'node',
70
+ entry: {
71
+ server: [
72
+ cli.paths.coreRoot + '/server/index.ts'
73
+ ],
74
+ },
75
+
76
+ output: {
77
+
78
+ pathinfo: dev,
79
+
80
+ libraryTarget: 'commonjs2',
81
+
82
+ path: outputPath,
83
+ filename: '[name].js',
84
+ publicPath: '/',
85
+ assetModuleFilename: 'public/[hash][ext]',
86
+
87
+ chunkFilename: 'chunks/[name].js',
88
+ // HMR
89
+ hotUpdateMainFilename: 'updates/[fullhash].hot-update.json',
90
+ hotUpdateChunkFilename: 'updates/[id].[fullhash].hot-update.js',
91
+
92
+ },
93
+
94
+ externalsPresets: { node: true }, // in order to ignore built-in modules like path, fs, etc.
95
+ externals: [
96
+
97
+ './chunk-manifest.json',
98
+ './asset-manifest.json',
99
+
100
+ // node_modules
101
+ function ({ request }, callback) {
102
+
103
+ const shouldCompile = request !== undefined && (
104
+ // Local files
105
+ request[0] === '.' || request[0] === '/'
106
+ ||
107
+ // Aliased modules
108
+ app.aliases.server.containsAlias(request)
109
+ ||
110
+ // TODO: proteum.conf: compile: include
111
+ // Compile proteum modules
112
+ request.startsWith('proteum')
113
+ ||
114
+ // Compile 5HTP modules
115
+ request.startsWith('@mantine/') ||
116
+ request.startsWith('react-number-format') ||
117
+ request.startsWith('@floating-ui')
118
+ )
119
+
120
+ //console.log('isNodeModule', request, isNodeModule);
121
+
122
+ if (!shouldCompile) {
123
+
124
+ // Externalize to a commonjs module using the request path
125
+ return callback(undefined, 'commonjs ' + request);
126
+ }
127
+
128
+ // Continue without externalizing the import
129
+ callback();
130
+ },
131
+ ],
132
+
133
+ resolve: {
134
+
135
+ ...commonConfig.resolve,
136
+
137
+ alias: aliases,
138
+
139
+ extensions: ['.ts', '.tsx', ".json", ".sql", ".js"],
140
+ },
141
+
142
+ module: {
143
+ // Make missing exports an error instead of warning
144
+ strictExportPresence: true,
145
+
146
+ rules: [
147
+ {
148
+ test: regex.scripts,
149
+ include: [
150
+
151
+ app.paths.root + '/client',
152
+ cli.paths.core.root + '/client',
153
+
154
+ app.paths.root + '/common',
155
+ cli.paths.core.root + '/common',
156
+
157
+ // Dossiers server uniquement pour le bundle server
158
+ app.paths.root + '/server',
159
+ cli.paths.core.root + '/server',
160
+
161
+ // Complle 5HTP modules so they can refer to the framework instance and aliases
162
+ // Temp disabled because compile issue on vercel
163
+ //...getCorePluginsList(app)
164
+ ],
165
+ rules: require('../common/babel')(app, 'server', dev, buildDev)
166
+ },
167
+
168
+ // Les pages étan tà la fois compilées dans le bundle client et serveur
169
+ // On ne compile les ressources (css) qu'une seule fois (coté client)
170
+ {
171
+ test: regex.style,
172
+ loader: 'null-loader'
173
+ },
174
+
175
+ ...require('../common/files/images')(app, dev, false),
176
+
177
+ ...require('../common/files/autres')(app, dev, false),
178
+
179
+ // Exclude dev modules from production build
180
+ /*...(dev ? [] : [
181
+ {
182
+ test: app.paths.root + '/node_modules/react-deep-force-update/lib/index.js'),
183
+ loader: 'null-loader',
184
+ },
185
+ ]),*/
186
+ ],
187
+ },
188
+
189
+ plugins: [
190
+
191
+ ...(commonConfig.plugins || [])
192
+ ],
193
+
194
+ optimization: {
195
+ minimizer: dev ? [] : [
196
+ new TerserPlugin({
197
+ terserOptions: {
198
+ // Consere les classnames
199
+ //keep_classnames: true,
200
+ //keep_fnames: true,
201
+ }
202
+ }),
203
+ ]
204
+ },
205
+
206
+ // https://webpack.js.org/configuration/devtool/#devtool
207
+ devtool: buildDev
208
+ ? false
209
+ : dev
210
+ ? 'eval-source-map' // Recommended choice for development builds with high quality SourceMaps.
211
+ : 'source-map', // Recommended choice for production builds with high quality SourceMaps.
212
+
213
+ // eval-source-map n'est pas précis
214
+ /*devServer: {
215
+ hot: true,
216
+ },*/
217
+ };
218
+
219
+ return config;
220
+ };
package/cli/index.ts ADDED
@@ -0,0 +1,213 @@
1
+ #!/usr/bin/env -S npx ts-node
2
+
3
+ process.traceDeprecation = true;
4
+
5
+ /*----------------------------------
6
+ - DEPENDANCES
7
+ ----------------------------------*/
8
+
9
+ // Npm
10
+ import fs from 'fs-extra';
11
+ import cp from 'child_process';
12
+
13
+ // Libs
14
+ import Paths from './paths';
15
+
16
+ /*----------------------------------
17
+ - TYPES
18
+ ----------------------------------*/
19
+
20
+ type TCliCommand = () => Promise<{
21
+ run: () => Promise<void>
22
+ }>
23
+
24
+ type TArgsObject = {
25
+ [key: string]: string | boolean | string[]
26
+ }
27
+
28
+ /*----------------------------------
29
+ - CLASSE
30
+ ----------------------------------*/
31
+ /*
32
+ IMPORTANT: The CLI must be independant of the app instance and libs
33
+ */
34
+ export class CLI {
35
+
36
+ // Context
37
+ public args: TArgsObject = {};
38
+
39
+ public commandOptionDefaults: { [command: string]: TArgsObject } = {
40
+ dev: {
41
+ port: '',
42
+ },
43
+ build: {
44
+ port: '',
45
+ dev: false,
46
+ prod: false,
47
+ analyze: false,
48
+ cache: false,
49
+ },
50
+ };
51
+
52
+ public debug: boolean = false;
53
+
54
+ public packageJson: {[key: string]: any};
55
+
56
+ public constructor(
57
+ public paths = new Paths( process.cwd() )
58
+ ) {
59
+ this.debug && console.log(`[cli] 5HTP CLI`, process.env.npm_package_version);
60
+
61
+ this.debug && console.log(`[cli] Apply aliases ...`);
62
+ this.paths.applyAliases();
63
+
64
+ this.packageJson = this.loadPkg();
65
+
66
+ this.start();
67
+ }
68
+
69
+ /*----------------------------------
70
+ - COMMANDS
71
+ ----------------------------------*/
72
+ // Les importations asynchrones permettent d'accéder à l'instance de cli via un import
73
+ // WARN: We load commands asynchonously, so the aliases are applied before the file is imported
74
+ public commands: { [name: string]: TCliCommand } = {
75
+ "init": () => import('./commands/init'),
76
+ "dev": () => import('./commands/dev'),
77
+ "refresh": () => import('./commands/refresh'),
78
+ "build": () => import('./commands/build'),
79
+ }
80
+
81
+ private loadPkg() {
82
+ return fs.readJSONSync(this.paths.core.root + '/package.json');
83
+ }
84
+
85
+ public start() {
86
+
87
+ const [, , commandName, ...argv] = process.argv;
88
+
89
+ if (this.commands[commandName] === undefined)
90
+ throw new Error(`Command ${commandName} does not exists.`);
91
+
92
+ this.args = {
93
+ ...(this.commandOptionDefaults[commandName] || {})
94
+ };
95
+ this.args.workdir = process.cwd();
96
+
97
+ let opt: string | null = null;
98
+ for (const a of argv) {
99
+
100
+ if (a.startsWith('-')) {
101
+
102
+ opt = a.replace(/^-+/, '');
103
+ if (opt.length === 0)
104
+ throw new Error(`Unknown option: ${a}`);
105
+ if (!(opt in this.args))
106
+ throw new Error(`Unknown option: ${opt}`);
107
+
108
+ // Init with default value
109
+ if (typeof this.args[opt] === "boolean") {
110
+ this.args[opt] = true;
111
+ opt = null;
112
+ }
113
+
114
+ } else if (opt !== null) {
115
+
116
+ const curVal = this.args[opt];
117
+
118
+ if (Array.isArray( curVal ))
119
+ curVal.push(a);
120
+ else
121
+ this.args[opt] = a;
122
+
123
+ opt = null;
124
+
125
+ } else {
126
+
127
+ this.args[ a ] = true;
128
+
129
+ }
130
+ }
131
+
132
+ if (opt !== null && typeof this.args[opt] !== 'boolean')
133
+ throw new Error(`Missing value for option: ${opt}`);
134
+
135
+ this.runCommand(commandName);
136
+ }
137
+
138
+ public async runCommand(command: string) {
139
+
140
+ this.debug && console.info(`Running command ${command}`, this.args);
141
+
142
+ // Check existance
143
+ if (this.commands[command] === undefined)
144
+ throw new Error(`Command ${command} does not exists.`);
145
+
146
+ const runner = await this.commands[command]();
147
+
148
+ // Running
149
+ runner.run().then(() => {
150
+
151
+ this.debug && console.info(`Command ${command} finished.`);
152
+
153
+ }).catch((e) => {
154
+
155
+ console.error(`Error during execution of ${command}:`, e);
156
+
157
+ }).finally(() => {
158
+
159
+ process.exit(0);
160
+
161
+ })
162
+ }
163
+
164
+
165
+ public shell(...commands: string[]) {
166
+
167
+ return new Promise<void>(async (resolve) => {
168
+
169
+ const fullCommand = commands.map(command => {
170
+
171
+ command = command.trim();
172
+
173
+ if (command.endsWith(';'))
174
+ command = command.substring(0, command.length - 1);
175
+
176
+ return command;
177
+
178
+ }).join(';');
179
+
180
+ console.log('$ ' + fullCommand);
181
+
182
+ /*const tempFile = this.paths.app.root + '/.exec.sh';
183
+ fs.outputFileSync(tempFile, '#! /bin/bash\n' + fullCommand);
184
+ const wrappedCommand = `tilix --new-process -e bash -c 'chmod +x "${tempFile}"; "${tempFile}"; echo "Entrée pour continuer"; read a;'`;*/
185
+ const wrappedCommand = `bash -c '${fullCommand}'`;
186
+ console.log("Running command: " + wrappedCommand)
187
+ //await this.waitForInput('enter');
188
+
189
+ const proc = cp.spawn(wrappedCommand, [], {
190
+ cwd: process.cwd(),
191
+ detached: false,
192
+ // Permer de lancer les commandes via des chaines pures (autrement, il faut separer chaque arg dans un tableau)
193
+ // https://stackoverflow.com/questions/23487363/how-can-i-parse-a-string-into-appropriate-arguments-for-child-process-spawn
194
+ shell: true
195
+ });
196
+
197
+ console.log( proc.exitCode );
198
+
199
+ proc.on('exit', function () {
200
+
201
+ //fs.removeSync(tempFile);
202
+
203
+ console.log("Command finished.");
204
+ resolve();
205
+ })
206
+
207
+ });
208
+
209
+ }
210
+
211
+ }
212
+
213
+ export default new CLI()
package/cli/paths.ts ADDED
@@ -0,0 +1,165 @@
1
+ /*----------------------------------
2
+ - DEPENDANCES
3
+ ----------------------------------*/
4
+
5
+ // Npm
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+ import TsAlias from 'ts-alias';
9
+ import moduleAlias from 'module-alias';
10
+ import { filenameToImportName } from 'babel-plugin-glob-import';
11
+
12
+ // Core
13
+
14
+ /*----------------------------------
15
+ - TYPES
16
+ ----------------------------------*/
17
+
18
+ import type { App } from './app';
19
+ import type { TAppSide } from './app';
20
+
21
+ export type TPathInfosOptions = {
22
+ basePath?: string,
23
+ shortenExtensions: string[],
24
+ // Indexed will be trimed only when the extension can be shorten
25
+ trimIndex: boolean,
26
+ }
27
+
28
+ export type TPathInfos = {
29
+
30
+ original: string,
31
+ absolute: string,
32
+ relative: string,
33
+ //forImport: string,
34
+
35
+ name: string,
36
+ extension: string,
37
+ isIndex: boolean
38
+ }
39
+
40
+ /*----------------------------------
41
+ - CONFIG
42
+ ----------------------------------*/
43
+
44
+ export const staticAssetName = /*isDebug ? '[name].[ext].[hash:8]' :*/ '[hash:8][ext]';
45
+
46
+ const pathInfosDefaultOpts = {
47
+ shortenExtensions: ['ts', 'js', 'tsx', 'jsx'],
48
+ trimIndex: true,
49
+ }
50
+
51
+ const resolveCoreRoot = (appRoot: string) => {
52
+ const localInstall = path.join(appRoot, 'node_modules', 'proteum');
53
+ if (fs.existsSync(localInstall)) return localInstall;
54
+
55
+ // When running `npx`/global installs, there may be no local `node_modules/proteum` yet.
56
+ // Fall back to the installed package root (this file lives in `<root>/cli`).
57
+ return path.resolve(__dirname, '..');
58
+ }
59
+
60
+ /*----------------------------------
61
+ - LIB
62
+ ----------------------------------*/
63
+ export default class Paths {
64
+
65
+ /*----------------------------------
66
+ - LISTE
67
+ ----------------------------------*/
68
+
69
+ public constructor(
70
+ public appRoot: string,
71
+ public coreRoot = resolveCoreRoot(appRoot)
72
+ ) {
73
+
74
+ }
75
+
76
+ public core = {
77
+ cli: path.resolve(__dirname, '.'),
78
+ root: this.coreRoot,
79
+ pages: this.coreRoot + '/client/pages',
80
+ }
81
+
82
+ /*----------------------------------
83
+ - EXTRACTION
84
+ ----------------------------------*/
85
+
86
+ public infos(filename: string, givenOpts: Partial<TPathInfosOptions> = {}): TPathInfos {
87
+
88
+ const opts: TPathInfosOptions = { ...pathInfosDefaultOpts, ...givenOpts }
89
+
90
+ // Extraction élements du chemin
91
+ const decomp = filename.split('/')
92
+ let [nomFichier, extension] = (decomp.pop() as string).split('.');
93
+ const shortenExtension = opts.shortenExtensions && opts.shortenExtensions.includes(extension);
94
+
95
+ // Vire l'index
96
+ const isIndex = nomFichier === 'index'
97
+ let cheminAbsolu: string;
98
+ let nomReel: string;
99
+ if (isIndex && shortenExtension && opts.trimIndex) {
100
+ cheminAbsolu = decomp.join('/');
101
+ nomReel = decomp.pop() as string;
102
+ } else {
103
+ cheminAbsolu = [...decomp, nomFichier].join('/')
104
+ nomReel = nomFichier
105
+ }
106
+
107
+ // Conserve l'extension si nécessaire
108
+ if (!shortenExtension)
109
+ cheminAbsolu += '.' + extension;
110
+
111
+ const relative = opts.basePath === undefined
112
+ ? ''
113
+ : cheminAbsolu.substring( opts.basePath.length + 1 )
114
+
115
+ // Retour
116
+ const retour = {
117
+
118
+ original: filename,
119
+ absolute: cheminAbsolu,
120
+ relative,
121
+
122
+ // Not used anymore, but can be useful in the future
123
+ //forImport: this.withAlias(cheminAbsolu, side),
124
+
125
+ name: nomReel,
126
+ extension,
127
+ isIndex
128
+ }
129
+
130
+ return retour;
131
+ }
132
+
133
+ public getPageChunk( app: App, file: string ) {
134
+
135
+ const infos = this.infos( file, {
136
+ basePath: file.startsWith( app.paths.pages ) ? app.paths.pages : this.core.pages,
137
+ // Avoid potential conflicts between /landing.tsx and /landing/index.tsx
138
+ trimIndex: false,
139
+ });
140
+
141
+ const filepath = infos.relative;
142
+
143
+ // Before: /home/.../src/client/pages/landing/index.tsx
144
+ // After: landing
145
+ let chunkId = filenameToImportName(filepath);
146
+
147
+ // nsure it's non-empty
148
+ if (chunkId.length === 0) // = /index.tsx
149
+ chunkId = "main";
150
+
151
+ return { filepath, chunkId }
152
+
153
+ }
154
+
155
+ public applyAliases() {
156
+
157
+ const aliases = new TsAlias({
158
+ rootDir: this.core.cli
159
+ });
160
+
161
+ //console.log('Applying Aliases ...', aliases.forModuleAlias());
162
+ moduleAlias.addAliases( aliases.forModuleAlias() );
163
+
164
+ }
165
+ }
package/cli/print.ts ADDED
@@ -0,0 +1,12 @@
1
+ export const h1 = (titre: string) => console.log(
2
+ '\n' +
3
+ '######################################################\n' +
4
+ '# ' + titre.toUpperCase() + '\n' +
5
+ '######################################################'
6
+ );
7
+
8
+ export const h2 = (titre: string) => console.log(
9
+ '------------------------------------------------------\n' +
10
+ '> ' + titre.toUpperCase() + '\n' +
11
+ '------------------------------------------------------'
12
+ );
@@ -0,0 +1,42 @@
1
+ {
2
+ "compilerOptions": {
3
+
4
+ // We run the CLI through ts-node in production, so we must use a modern target.
5
+ // In particular, downleveling built-in subclasses (ex: `class extends Map`) to ES5 breaks at runtime.
6
+ "target": "ES2021",
7
+ "module": "CommonJS",
8
+
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "allowJs": true,
12
+ "strict": false,
13
+ "downlevelIteration": true,
14
+
15
+ // Equivalent webpack: resolve.symblinks = false
16
+ "preserveSymlinks": true,
17
+ // Décorateurs
18
+ "experimentalDecorators": true,
19
+
20
+ // React
21
+ "jsx": "react-jsx",
22
+ "jsxImportSource": "preact",
23
+
24
+ "strictPropertyInitialization": true,
25
+ "strictNullChecks": true,
26
+
27
+ "baseUrl": "./",
28
+ "outDir": "./bin",
29
+
30
+ "paths": {
31
+ "@cli/*": [ "./*" ],
32
+ "@cli/app": [ "./app" ],
33
+ "@cli": [ "./" ]
34
+ },
35
+ },
36
+
37
+ "ts-node": {
38
+ "transpileOnly": true,
39
+ },
40
+
41
+ "include": ["./"]
42
+ }
@@ -0,0 +1,22 @@
1
+ /*----------------------------------
2
+ - DEPENDANCES
3
+ ----------------------------------*/
4
+
5
+ // Npm
6
+ import fs from 'fs-extra';
7
+ import path from 'path';
8
+
9
+
10
+ /*----------------------------------
11
+ - TYPES
12
+ ----------------------------------*/
13
+
14
+
15
+ /*----------------------------------
16
+ - UTILS
17
+ ----------------------------------*/
18
+
19
+ export const api = (method: string, path: string, data: object, local: boolean = false) =>
20
+ `curl -X ${method} ${local ? 'http://localhost:3010' : 'https://dopamyn.io'}${path} ` +
21
+ `-H 'Content-Type: application/json' -H 'Accept: application/json' ` +
22
+ `-d '${JSON.stringify(data)}';`;