create-cn-application 0.0.0

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.
@@ -0,0 +1,190 @@
1
+ import process from 'node:process';
2
+ import os from 'node:os';
3
+ import tty from 'node:tty';
4
+
5
+ // From: https://github.com/sindresorhus/has-flag/blob/main/index.js
6
+ /// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
7
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
8
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
9
+ const position = argv.indexOf(prefix + flag);
10
+ const terminatorPosition = argv.indexOf('--');
11
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
12
+ }
13
+
14
+ const {env} = process;
15
+
16
+ let flagForceColor;
17
+ if (
18
+ hasFlag('no-color')
19
+ || hasFlag('no-colors')
20
+ || hasFlag('color=false')
21
+ || hasFlag('color=never')
22
+ ) {
23
+ flagForceColor = 0;
24
+ } else if (
25
+ hasFlag('color')
26
+ || hasFlag('colors')
27
+ || hasFlag('color=true')
28
+ || hasFlag('color=always')
29
+ ) {
30
+ flagForceColor = 1;
31
+ }
32
+
33
+ function envForceColor() {
34
+ if ('FORCE_COLOR' in env) {
35
+ if (env.FORCE_COLOR === 'true') {
36
+ return 1;
37
+ }
38
+
39
+ if (env.FORCE_COLOR === 'false') {
40
+ return 0;
41
+ }
42
+
43
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
44
+ }
45
+ }
46
+
47
+ function translateLevel(level) {
48
+ if (level === 0) {
49
+ return false;
50
+ }
51
+
52
+ return {
53
+ level,
54
+ hasBasic: true,
55
+ has256: level >= 2,
56
+ has16m: level >= 3,
57
+ };
58
+ }
59
+
60
+ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
61
+ const noFlagForceColor = envForceColor();
62
+ if (noFlagForceColor !== undefined) {
63
+ flagForceColor = noFlagForceColor;
64
+ }
65
+
66
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
67
+
68
+ if (forceColor === 0) {
69
+ return 0;
70
+ }
71
+
72
+ if (sniffFlags) {
73
+ if (hasFlag('color=16m')
74
+ || hasFlag('color=full')
75
+ || hasFlag('color=truecolor')) {
76
+ return 3;
77
+ }
78
+
79
+ if (hasFlag('color=256')) {
80
+ return 2;
81
+ }
82
+ }
83
+
84
+ // Check for Azure DevOps pipelines.
85
+ // Has to be above the `!streamIsTTY` check.
86
+ if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
87
+ return 1;
88
+ }
89
+
90
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
91
+ return 0;
92
+ }
93
+
94
+ const min = forceColor || 0;
95
+
96
+ if (env.TERM === 'dumb') {
97
+ return min;
98
+ }
99
+
100
+ if (process.platform === 'win32') {
101
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
102
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
103
+ const osRelease = os.release().split('.');
104
+ if (
105
+ Number(osRelease[0]) >= 10
106
+ && Number(osRelease[2]) >= 10_586
107
+ ) {
108
+ return Number(osRelease[2]) >= 14_931 ? 3 : 2;
109
+ }
110
+
111
+ return 1;
112
+ }
113
+
114
+ if ('CI' in env) {
115
+ if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {
116
+ return 3;
117
+ }
118
+
119
+ if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
120
+ return 1;
121
+ }
122
+
123
+ return min;
124
+ }
125
+
126
+ if ('TEAMCITY_VERSION' in env) {
127
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
128
+ }
129
+
130
+ if (env.COLORTERM === 'truecolor') {
131
+ return 3;
132
+ }
133
+
134
+ if (env.TERM === 'xterm-kitty') {
135
+ return 3;
136
+ }
137
+
138
+ if (env.TERM === 'xterm-ghostty') {
139
+ return 3;
140
+ }
141
+
142
+ if (env.TERM === 'wezterm') {
143
+ return 3;
144
+ }
145
+
146
+ if ('TERM_PROGRAM' in env) {
147
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
148
+
149
+ switch (env.TERM_PROGRAM) {
150
+ case 'iTerm.app': {
151
+ return version >= 3 ? 3 : 2;
152
+ }
153
+
154
+ case 'Apple_Terminal': {
155
+ return 2;
156
+ }
157
+ // No default
158
+ }
159
+ }
160
+
161
+ if (/-256(color)?$/i.test(env.TERM)) {
162
+ return 2;
163
+ }
164
+
165
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
166
+ return 1;
167
+ }
168
+
169
+ if ('COLORTERM' in env) {
170
+ return 1;
171
+ }
172
+
173
+ return min;
174
+ }
175
+
176
+ export function createSupportsColor(stream, options = {}) {
177
+ const level = _supportsColor(stream, {
178
+ streamIsTTY: stream && stream.isTTY,
179
+ ...options,
180
+ });
181
+
182
+ return translateLevel(level);
183
+ }
184
+
185
+ const supportsColor = {
186
+ stdout: createSupportsColor({isTTY: tty.isatty(1)}),
187
+ stderr: createSupportsColor({isTTY: tty.isatty(2)}),
188
+ };
189
+
190
+ export default supportsColor;
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "create-cn-workspace",
3
+ "version": "1.0.0",
4
+ "description": "Scaffold a new Cnos workspace",
5
+ "bin": {
6
+ "create-cn-workspace": "./bin/index.js"
7
+ },
8
+ "preferGlobal": true,
9
+ "author": "Cloud Natice Systems",
10
+ "license": "MIT",
11
+ "engines": {
12
+ "node": ">=18"
13
+ },
14
+ "dependencies": {
15
+ "chalk": "^5.3.0",
16
+ "fs-extra": "^11.1.1",
17
+ "inquirer": "^9.2.8"
18
+ }
19
+ }
@@ -0,0 +1,22 @@
1
+ # create-cn-workspace
2
+
3
+ **Package Status:** Reserved for Future Use
4
+
5
+ ---
6
+
7
+ This NPM package is currently **reserved for future development** and is not intended for public use at this time.
8
+
9
+ ## Overview
10
+
11
+ create-cn-workspace is planned to serve as a **Cloud Native Installation eXtension** format for distributing components and extensions in the CNOS ecosystem. This package acts as a placeholder to reserve the namespace and will eventually provide tools, manifest schemas, and distribution utilities for CNOS components.
12
+
13
+ ## Current Status
14
+
15
+ - No functionality is implemented yet.
16
+ - The package is **not production-ready**.
17
+ - All attempts to install or use this package will have **no effect**.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install create-cn-workspace
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "create-cn-application",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "description": "Scaffold a new Cnos application",
6
+ "bin": {
7
+ "create-cn-application": "./bin/index.js"
8
+ },
9
+ "preferGlobal": true,
10
+ "author": "CNOS",
11
+ "license": "MIT",
12
+ "engines": {
13
+ "node": ">=18"
14
+ },
15
+ "dependencies": {
16
+ "chalk": "^4.1.2",
17
+ "inquirer": "^9.2.8"
18
+ }
19
+ }
package/readme.md ADDED
@@ -0,0 +1,22 @@
1
+ # create-cn-application
2
+
3
+ **Package Status:** Reserved for Future Use
4
+
5
+ ---
6
+
7
+ This NPM package is currently **reserved for future development** and is not intended for public use at this time.
8
+
9
+ ## Overview
10
+
11
+ create-cn-application is planned to serve as a **Cloud Native Installation application** format for distributing components and applications in the CNOS ecosystem. This package acts as a placeholder to reserve the namespace and will eventually provide tools, manifest schemas, and distribution utilities for CNOS components.
12
+
13
+ ## Current Status
14
+
15
+ - No functionality is implemented yet.
16
+ - The package is **not production-ready**.
17
+ - All attempts to install or use this package will have **no effect**.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install create-cn-application