@ossy/cli 0.0.4 → 0.0.11
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/CHANGELOG.md +48 -0
- package/LICENSE +21 -0
- package/README.md +1 -16
- package/package.json +9 -4
- package/src/index.js +0 -1
- package/src/log.js +1 -0
- package/src/app/build.js +0 -95
- package/src/app/cli.js +0 -22
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
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.0.11](https://github.com/ossy-se/packages/compare/@ossy/cli@0.0.10...@ossy/cli@0.0.11) (2025-10-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @ossy/cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 0.0.10 (2025-10-25)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @ossy/cli
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 0.0.9 (2025-10-25)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @ossy/cli
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 0.0.8 (2025-10-25)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @ossy/cli
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 0.0.7 (2025-10-25)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @ossy/cli
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 0.0.6 (2025-10-25)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @ossy/cli
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ossy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
# @ossy/cli
|
|
2
2
|
|
|
3
|
-
Command line tool that makes it easier to interact with our
|
|
4
|
-
|
|
5
|
-
## App
|
|
6
|
-
|
|
7
|
-
### build
|
|
8
|
-
|
|
9
|
-
Builds a production version of the app
|
|
10
|
-
```
|
|
11
|
-
npx @ossy/cli app build
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### serve
|
|
15
|
-
Serves the app
|
|
16
|
-
```
|
|
17
|
-
npx @ossy/cli app serve
|
|
18
|
-
```
|
|
3
|
+
Command line tool that makes it easier to interact with our APIs
|
|
19
4
|
|
|
20
5
|
## Cms
|
|
21
6
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
|
+
"repository": "github:ossy-se/packages",
|
|
4
5
|
"description": "Command line tool that makes it easier to interact with our APIs",
|
|
5
6
|
"source": "./src/index.js",
|
|
6
7
|
"main": "./src/index.js",
|
|
7
8
|
"type": "module",
|
|
8
9
|
"scripts": {
|
|
9
|
-
"test": "echo \"Error: no test specified\" && exit
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 0",
|
|
10
11
|
"build": "echo \"The build step is not required when using JavaScript!\" && exit 0"
|
|
11
12
|
},
|
|
12
13
|
"author": "Ossy",
|
|
13
|
-
"license": "
|
|
14
|
+
"license": "MIT License",
|
|
14
15
|
"bin": "./src/index.js",
|
|
15
16
|
"dependencies": {
|
|
16
17
|
"arg": "^5.0.2",
|
|
17
18
|
"node-fetch": "^2.6.7"
|
|
18
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"gitHead": "95e5daaa8dfce6d58919dd2afe477d9e4335229b"
|
|
19
24
|
}
|
package/src/index.js
CHANGED
package/src/log.js
CHANGED
package/src/app/build.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import { rollup } from 'rollup';
|
|
4
|
-
import babel from '@rollup/plugin-babel';
|
|
5
|
-
import { nodeResolve as resolveDependencies } from '@rollup/plugin-node-resolve'
|
|
6
|
-
import resolveCommonJsDependencies from '@rollup/plugin-commonjs'
|
|
7
|
-
import removeOwnPeerDependencies from 'rollup-plugin-peer-deps-external'
|
|
8
|
-
import minifyJS from '@rollup/plugin-terser'
|
|
9
|
-
// import typescript from '@rollup/plugin-typescript'
|
|
10
|
-
import preserveDirectives from "rollup-plugin-preserve-directives"
|
|
11
|
-
import json from "@rollup/plugin-json"
|
|
12
|
-
import copy from 'rollup-plugin-copy';
|
|
13
|
-
import replace from '@rollup/plugin-replace';
|
|
14
|
-
import remove from 'rollup-plugin-delete';
|
|
15
|
-
|
|
16
|
-
// export const build = async ({
|
|
17
|
-
// source = 'src/index.jsx',
|
|
18
|
-
// destination = 'build',
|
|
19
|
-
// }) => {
|
|
20
|
-
// console.log('[@ossy/app][Build] Starting build...')
|
|
21
|
-
|
|
22
|
-
// const sourcePath = path.resolve(source);
|
|
23
|
-
// const destinationDir = path.resolve(destination);
|
|
24
|
-
|
|
25
|
-
// if (!fs.existsSync(sourcePath)) {
|
|
26
|
-
// throw new Error(`[@ossy/app][Build] Source path does not exist: ${sourcePath}`);
|
|
27
|
-
// }
|
|
28
|
-
|
|
29
|
-
// const sourceData = fs.readFileSync(sourcePath, 'utf8');
|
|
30
|
-
|
|
31
|
-
// fs.mkdirSync(destinationDir, { recursive: true });
|
|
32
|
-
// fs.writeFileSync(path.join(destinationDir, 'index.js'), sourceData, { encoding: 'utf8', flag: 'w' });
|
|
33
|
-
|
|
34
|
-
// console.log('[@ossy/app][Build] Build finished')
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// Build folder structure
|
|
40
|
-
// build/server.js (provided by script)
|
|
41
|
-
// build/pages.js (manifest of pages and their entry points)
|
|
42
|
-
// build/<page-id>.page.js (for each page)
|
|
43
|
-
// build/static/index.js
|
|
44
|
-
// build/static/*.js
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export const build = async ({
|
|
48
|
-
source = 'src/App.jsx',
|
|
49
|
-
destination = 'build',
|
|
50
|
-
} = {}) => {
|
|
51
|
-
console.log('[@ossy/cli][app][build] Starting...')
|
|
52
|
-
|
|
53
|
-
const sourcePath = path.resolve(source);
|
|
54
|
-
const buildPath = path.resolve(destination);
|
|
55
|
-
|
|
56
|
-
if (!fs.existsSync(sourcePath)) {
|
|
57
|
-
throw new Error(`[@ossy/cli][app][build] Source path does not exist: ${sourcePath}`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const inputOptions = {
|
|
61
|
-
input: sourcePath,
|
|
62
|
-
plugins: [
|
|
63
|
-
remove({ targets: buildPath }),
|
|
64
|
-
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
|
|
65
|
-
json(),
|
|
66
|
-
removeOwnPeerDependencies(),
|
|
67
|
-
resolveCommonJsDependencies(),
|
|
68
|
-
resolveDependencies({ preferBuiltins: true }),
|
|
69
|
-
babel({
|
|
70
|
-
babelHelpers: 'bundled',
|
|
71
|
-
exclude: ['**/node_modules/**/*'],
|
|
72
|
-
presets: ['@babel/preset-env', '@babel/preset-react']
|
|
73
|
-
}),
|
|
74
|
-
preserveDirectives(),
|
|
75
|
-
minifyJS(),
|
|
76
|
-
],
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const outputOptions = [
|
|
80
|
-
{
|
|
81
|
-
dir: 'build',
|
|
82
|
-
entryFileNames: ({ name }) => name === 'server' ? '[name].js' : 'static/[name].js',
|
|
83
|
-
chunkFileNames: 'static/[name]-[hash].js',
|
|
84
|
-
format: 'esm',
|
|
85
|
-
}
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
const bundle = await rollup(inputOptions);
|
|
89
|
-
|
|
90
|
-
for (const options of outputOptions) {
|
|
91
|
-
await bundle.write(options);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
console.log('[@ossy/cli][app][build] Finished');
|
|
95
|
-
};
|
package/src/app/cli.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const [_, __, handlerName, ...restArgs] = process.argv
|
|
4
|
-
import { build } from './cli/build.js'
|
|
5
|
-
|
|
6
|
-
export const handler = ([command, ...options]) => {
|
|
7
|
-
|
|
8
|
-
if (!command) {
|
|
9
|
-
logError({ message: '[@ossy/cli][app] No command provided' })
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const commandHandler = {
|
|
13
|
-
'build': build,
|
|
14
|
-
}[command]
|
|
15
|
-
|
|
16
|
-
if (!commandHandler) {
|
|
17
|
-
logError({ message: `[@ossy/cli][app] Unknown command: ${command}` })
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
commandHandler(options)
|
|
21
|
-
|
|
22
|
-
}
|