@ossy/app 0.1.3 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/app",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "",
5
5
  "source": "./src/index.js",
6
6
  "main": "./src/index.js",
@@ -22,6 +22,7 @@
22
22
  "@babel/register": "^7.25.9",
23
23
  "@rollup/plugin-alias": "^5.1.1",
24
24
  "@rollup/plugin-babel": "6.0.4",
25
+ "@rollup/plugin-commonjs": "^29.0.0",
25
26
  "@rollup/plugin-inject": "^5.0.5",
26
27
  "@rollup/plugin-json": "^6.1.0",
27
28
  "@rollup/plugin-node-resolve": "^16.0.3",
@@ -42,5 +43,9 @@
42
43
  "rollup-plugin-postcss-modules": "^2.1.1",
43
44
  "rollup-plugin-preserve-directives": "^0.4.0"
44
45
  },
45
- "gitHead": "80c0c70120640e7b389d1881a71b2376fd523095"
46
+ "files": [
47
+ "/build",
48
+ "README.md"
49
+ ],
50
+ "gitHead": "a768d71e76cc523f367cd764a403c0960f8d2e93"
46
51
  }
package/CHANGELOG.md DELETED
@@ -1,155 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## 0.1.3 (2025-10-31)
7
-
8
- **Note:** Version bump only for package @ossy/app
9
-
10
-
11
-
12
-
13
-
14
- ## 0.1.2 (2025-10-31)
15
-
16
- **Note:** Version bump only for package @ossy/app
17
-
18
-
19
-
20
-
21
-
22
- ## 0.1.1 (2025-10-31)
23
-
24
- **Note:** Version bump only for package @ossy/app
25
-
26
-
27
-
28
-
29
-
30
- # 0.1.0 (2025-10-30)
31
-
32
-
33
- ### Features
34
-
35
- * **sdk:** get current workspace ([#4](https://github.com/ossy-se/packages/issues/4)) ([afce7d5](https://github.com/ossy-se/packages/commit/afce7d5787af42691f62c9eba672ea1be000e19e))
36
-
37
-
38
-
39
-
40
-
41
- ## 0.0.16 (2025-10-30)
42
-
43
- **Note:** Version bump only for package @ossy/app
44
-
45
-
46
-
47
-
48
-
49
- ## 0.0.15 (2025-10-27)
50
-
51
- **Note:** Version bump only for package @ossy/app
52
-
53
-
54
-
55
-
56
-
57
- ## 0.0.14 (2025-10-27)
58
-
59
- **Note:** Version bump only for package @ossy/app
60
-
61
-
62
-
63
-
64
-
65
- ## 0.0.13 (2025-10-27)
66
-
67
- **Note:** Version bump only for package @ossy/app
68
-
69
-
70
-
71
-
72
-
73
- ## 0.0.12 (2025-10-27)
74
-
75
- **Note:** Version bump only for package @ossy/app
76
-
77
-
78
-
79
-
80
-
81
- ## 0.0.11 (2025-10-27)
82
-
83
- **Note:** Version bump only for package @ossy/app
84
-
85
-
86
-
87
-
88
-
89
- ## 0.0.10 (2025-10-25)
90
-
91
- **Note:** Version bump only for package @ossy/app
92
-
93
-
94
-
95
-
96
-
97
- ## 0.0.9 (2025-10-25)
98
-
99
- **Note:** Version bump only for package @ossy/app
100
-
101
-
102
-
103
-
104
-
105
- ## 0.0.8 (2025-10-25)
106
-
107
- **Note:** Version bump only for package @ossy/app
108
-
109
-
110
-
111
-
112
-
113
- ## 0.0.7 (2025-10-25)
114
-
115
- **Note:** Version bump only for package @ossy/app
116
-
117
-
118
-
119
-
120
-
121
- ## 0.0.6 (2025-10-25)
122
-
123
- **Note:** Version bump only for package @ossy/app
124
-
125
-
126
-
127
-
128
-
129
- ## 0.0.5 (2025-10-25)
130
-
131
- **Note:** Version bump only for package @ossy/app
132
-
133
-
134
-
135
-
136
-
137
- ## 0.0.4 (2025-10-25)
138
-
139
- **Note:** Version bump only for package @ossy/app
140
-
141
-
142
-
143
-
144
-
145
- ## 0.0.3 (2025-10-25)
146
-
147
- **Note:** Version bump only for package @ossy/app
148
-
149
-
150
-
151
-
152
-
153
- ## 0.0.2 (2025-10-25)
154
-
155
- **Note:** Version bump only for package @ossy/app
package/cli/Api.js DELETED
@@ -1,3 +0,0 @@
1
- // dummy file so it can be imported
2
-
3
- export default undefined
package/cli/build.js DELETED
@@ -1,124 +0,0 @@
1
- import path from 'path';
2
- import url from 'url';
3
- import fs from 'fs';
4
- import { rollup } from 'rollup';
5
- import babel from '@rollup/plugin-babel';
6
- import { nodeResolve as resolveDependencies } from '@rollup/plugin-node-resolve'
7
- import resolveCommonJsDependencies from '@rollup/plugin-commonjs'
8
- import removeOwnPeerDependencies from 'rollup-plugin-peer-deps-external'
9
- import minifyJS from '@rollup/plugin-terser'
10
- // import typescript from '@rollup/plugin-typescript'
11
- import preserveDirectives from "rollup-plugin-preserve-directives"
12
- import json from "@rollup/plugin-json"
13
- import copy from 'rollup-plugin-copy';
14
- import replace from '@rollup/plugin-replace';
15
- import remove from 'rollup-plugin-delete';
16
- import arg from 'arg'
17
- // import inject from '@rollup/plugin-inject'
18
-
19
- export const build = async (cliArgs) => {
20
- console.log('[@ossy/cli][app][build] Starting...')
21
-
22
- const options = arg({
23
- '--source': String,
24
- '--s': '--source',
25
-
26
- '--destination': String,
27
- '--d': '--destination',
28
-
29
- '--config': String,
30
- '-c': '--config',
31
- }, { argv: cliArgs })
32
-
33
-
34
- const appSourcePath = path.resolve(options['--source'] || 'src/App.jsx');
35
- let apiSourcePath = path.resolve(options['--api-source'] || 'src/Api.js');
36
- const configPath = path.resolve(options['--config'] || 'src/config.js');
37
- const buildPath = path.resolve(options['--destination'] || 'build');
38
- const publicDir = path.resolve('public')
39
-
40
- const scriptDir = path.dirname(url.fileURLToPath(import.meta.url))
41
- const inputClient = path.resolve(scriptDir, 'client.js')
42
- const inputServer = path.resolve(scriptDir, 'server.js')
43
-
44
- const inputFiles = [inputClient, inputServer]
45
-
46
- if (!fs.existsSync(appSourcePath)) {
47
- throw new Error(`[@ossy/cli][app][build] Source path does not exist: ${appSourcePath}`);
48
- }
49
-
50
- if (!fs.existsSync(apiSourcePath)) {
51
- apiSourcePath = path.resolve(scriptDir, 'Api.js')
52
- }
53
-
54
- if (fs.existsSync(configPath)) {
55
- inputFiles.push(configPath)
56
- }
57
-
58
- const inputOptions = {
59
- input: inputFiles,
60
- plugins: [
61
- remove({ targets: buildPath }),
62
- // inject({ 'React': 'react' }),
63
- replace({
64
- delimiters: ['%%', '%%'],
65
- '@ossy/app/source-file': appSourcePath,
66
- }),
67
- replace({
68
- delimiters: ['%%', '%%'],
69
- '@ossy/api/source-file': apiSourcePath,
70
- }),
71
- replace({
72
- 'process.env.NODE_ENV': JSON.stringify('production')
73
- }),
74
- json(),
75
- // removeOwnPeerDependencies(),
76
- resolveCommonJsDependencies(),
77
- resolveDependencies({ preferBuiltins: true }),
78
- babel({
79
- babelHelpers: 'bundled',
80
- // exclude: ['**/node_modules/**/*'],
81
- presets: ['@babel/preset-env', '@babel/preset-react']
82
- }),
83
- // preserveDirectives(),
84
- minifyJS(),
85
- copy({
86
- targets: [
87
- fs.existsSync(publicDir)
88
- ? { src: `${publicDir}/**/*`, dest: 'build/public' }
89
- : undefined,
90
- ].filter(x => !!x)
91
- })
92
- ],
93
- };
94
-
95
- const outputOptions = [
96
- {
97
- dir: 'build',
98
- // preserveModules: true,
99
- entryFileNames: ({ name }) => {
100
- if (name === 'server') {
101
- return '[name].js'
102
- } else if (name === 'Api') {
103
- return '[name].js'
104
- } else if (name === 'client') {
105
- return 'public/static/main.js'
106
- } else if (name === 'config') {
107
- return 'public/static/[name].js'
108
- } else {
109
- return 'public/static/[name].js'
110
- }
111
- },
112
- chunkFileNames: 'public/static/[name]-[hash].js',
113
- format: 'esm',
114
- }
115
- ];
116
-
117
- const bundle = await rollup(inputOptions);
118
-
119
- for (const options of outputOptions) {
120
- await bundle.write(options);
121
- }
122
-
123
- console.log('[@ossy/cli][app][build] Finished');
124
- };
package/cli/client.js DELETED
@@ -1,6 +0,0 @@
1
- import React, { createElement } from 'react'
2
- import 'react-dom'
3
- import { hydrateRoot } from 'react-dom/client';
4
- import App from '%%@ossy/app/source-file%%'
5
-
6
- hydrateRoot(document, createElement(App))
package/cli/server.js DELETED
@@ -1,57 +0,0 @@
1
- import path from 'path';
2
- import url from 'url'
3
- import React, { createElement } from 'react';
4
- import express from 'express';
5
- import { prerenderToNodeStream } from 'react-dom/static'
6
- import App from '%%@ossy/app/source-file%%'
7
- import ApiRouter from '%%@ossy/api/source-file%%'
8
-
9
- const app = express();
10
-
11
- const currentDir = path.dirname(url.fileURLToPath(import.meta.url))
12
- const ROOT_PATH = path.resolve(currentDir, 'public')
13
-
14
- console.log('[@ossy/cli][app][server] ROOT_PATH: ', ROOT_PATH)
15
-
16
- app.use(express.static(ROOT_PATH));
17
-
18
- ApiRouter && app.use('/api', ApiRouter)
19
-
20
- app.get('*', (req, res) => {
21
-
22
- console.log('[@ossy/cli][app][server] req.url: ', req.url)
23
-
24
- renderToString(App, { url: req.url })
25
- .then(html => { res.send(html) })
26
- .catch(err => { res.send(err) })
27
-
28
- });
29
-
30
- app.listen(3000, () => {
31
- console.log('Server is running on http://localhost:3000');
32
- });
33
-
34
- async function renderToSteam(App, config) {
35
-
36
- return prerenderToNodeStream(createElement(App, config), {
37
- bootstrapModules: ['/static/index.js']
38
- })
39
-
40
- }
41
-
42
- async function renderToString(App, config) {
43
-
44
- const { prelude } = await prerenderToNodeStream(createElement(App, config), {
45
- bootstrapModules: ['/static/main.js']
46
- });
47
-
48
- return new Promise((resolve, reject) => {
49
- let data = '';
50
- prelude.on('data', chunk => {
51
- data += chunk;
52
- });
53
- prelude.on('end', () => resolve(data));
54
- prelude.on('error', reject);
55
- });
56
-
57
- }
package/cli/temp.js DELETED
@@ -1,3 +0,0 @@
1
- import path from 'path';
2
-
3
- console.log(path.resolve('./', 'client.js'))