@ossy/app 0.1.4 → 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.4",
3
+ "version": "0.1.5",
4
4
  "description": "",
5
5
  "source": "./src/index.js",
6
6
  "main": "./src/index.js",
@@ -43,5 +43,9 @@
43
43
  "rollup-plugin-postcss-modules": "^2.1.1",
44
44
  "rollup-plugin-preserve-directives": "^0.4.0"
45
45
  },
46
- "gitHead": "d5cd2ad89b32cdc9cd31a27ff53b71a9c3226799"
46
+ "files": [
47
+ "/build",
48
+ "README.md"
49
+ ],
50
+ "gitHead": "a768d71e76cc523f367cd764a403c0960f8d2e93"
47
51
  }
package/CHANGELOG.md DELETED
@@ -1,166 +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.4 (2025-10-31)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * **app:** add @babel/preset-env ([#7](https://github.com/ossy-se/packages/issues/7)) ([252b41a](https://github.com/ossy-se/packages/commit/252b41a6d4e3d7d3750661091c97186b0d9cdde2))
12
-
13
-
14
-
15
-
16
-
17
- ## 0.1.3 (2025-10-31)
18
-
19
- **Note:** Version bump only for package @ossy/app
20
-
21
-
22
-
23
-
24
-
25
- ## 0.1.2 (2025-10-31)
26
-
27
- **Note:** Version bump only for package @ossy/app
28
-
29
-
30
-
31
-
32
-
33
- ## 0.1.1 (2025-10-31)
34
-
35
- **Note:** Version bump only for package @ossy/app
36
-
37
-
38
-
39
-
40
-
41
- # 0.1.0 (2025-10-30)
42
-
43
-
44
- ### Features
45
-
46
- * **sdk:** get current workspace ([#4](https://github.com/ossy-se/packages/issues/4)) ([afce7d5](https://github.com/ossy-se/packages/commit/afce7d5787af42691f62c9eba672ea1be000e19e))
47
-
48
-
49
-
50
-
51
-
52
- ## 0.0.16 (2025-10-30)
53
-
54
- **Note:** Version bump only for package @ossy/app
55
-
56
-
57
-
58
-
59
-
60
- ## 0.0.15 (2025-10-27)
61
-
62
- **Note:** Version bump only for package @ossy/app
63
-
64
-
65
-
66
-
67
-
68
- ## 0.0.14 (2025-10-27)
69
-
70
- **Note:** Version bump only for package @ossy/app
71
-
72
-
73
-
74
-
75
-
76
- ## 0.0.13 (2025-10-27)
77
-
78
- **Note:** Version bump only for package @ossy/app
79
-
80
-
81
-
82
-
83
-
84
- ## 0.0.12 (2025-10-27)
85
-
86
- **Note:** Version bump only for package @ossy/app
87
-
88
-
89
-
90
-
91
-
92
- ## 0.0.11 (2025-10-27)
93
-
94
- **Note:** Version bump only for package @ossy/app
95
-
96
-
97
-
98
-
99
-
100
- ## 0.0.10 (2025-10-25)
101
-
102
- **Note:** Version bump only for package @ossy/app
103
-
104
-
105
-
106
-
107
-
108
- ## 0.0.9 (2025-10-25)
109
-
110
- **Note:** Version bump only for package @ossy/app
111
-
112
-
113
-
114
-
115
-
116
- ## 0.0.8 (2025-10-25)
117
-
118
- **Note:** Version bump only for package @ossy/app
119
-
120
-
121
-
122
-
123
-
124
- ## 0.0.7 (2025-10-25)
125
-
126
- **Note:** Version bump only for package @ossy/app
127
-
128
-
129
-
130
-
131
-
132
- ## 0.0.6 (2025-10-25)
133
-
134
- **Note:** Version bump only for package @ossy/app
135
-
136
-
137
-
138
-
139
-
140
- ## 0.0.5 (2025-10-25)
141
-
142
- **Note:** Version bump only for package @ossy/app
143
-
144
-
145
-
146
-
147
-
148
- ## 0.0.4 (2025-10-25)
149
-
150
- **Note:** Version bump only for package @ossy/app
151
-
152
-
153
-
154
-
155
-
156
- ## 0.0.3 (2025-10-25)
157
-
158
- **Note:** Version bump only for package @ossy/app
159
-
160
-
161
-
162
-
163
-
164
- ## 0.0.2 (2025-10-25)
165
-
166
- **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'))