three-blocks-login 0.1.10 → 0.1.12
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/LICENSE +199 -74
- package/README.md +75 -51
- package/bin/login.js +52 -157
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
Three.js Blocks Software License Agreement
|
|
2
|
+
Version 2.0 — Effective January 2026
|
|
2
3
|
|
|
3
4
|
Proprietary Software — All Rights Reserved
|
|
4
|
-
Copyright (c)
|
|
5
|
+
Copyright (c) 2026 three-blocks
|
|
6
|
+
|
|
7
|
+
Full License Terms: https://threejs-blocks.com/license
|
|
5
8
|
|
|
6
9
|
================================================================================
|
|
7
10
|
|
|
@@ -9,25 +12,26 @@ LICENSE NOTICE
|
|
|
9
12
|
|
|
10
13
|
This software and all associated packages, including but not limited to:
|
|
11
14
|
- @three-blocks/core
|
|
15
|
+
- @three-blocks/pro
|
|
12
16
|
- @three-blocks/starter
|
|
13
17
|
- create-three-blocks-starter
|
|
14
18
|
- All related tools, examples, and documentation code
|
|
15
19
|
|
|
16
|
-
are licensed exclusively to active, paid subscribers of the
|
|
17
|
-
project. Without a valid and current subscription, you are NOT permitted to
|
|
20
|
+
are licensed exclusively to active, paid subscribers of the Three.js Blocks
|
|
21
|
+
project. Without a valid and current subscription, you are NOT permitted to
|
|
18
22
|
use this software.
|
|
19
23
|
|
|
20
24
|
================================================================================
|
|
21
25
|
|
|
22
26
|
PERMITTED USAGE (Active Subscribers Only)
|
|
23
27
|
|
|
24
|
-
Subject to maintaining an active, paid subscription, you are granted a
|
|
25
|
-
non-exclusive, non-transferable license to:
|
|
28
|
+
Subject to maintaining an active, paid subscription, you are granted a
|
|
29
|
+
non-exclusive, non-transferable, non-sublicensable license to:
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
+ Use the software in personal and commercial projects via the public API
|
|
32
|
+
+ Deploy applications incorporating the software to production environments
|
|
33
|
+
+ Integrate the software into your applications as a functional component
|
|
34
|
+
+ Access updates, bug fixes, and new features during active subscription
|
|
31
35
|
|
|
32
36
|
================================================================================
|
|
33
37
|
|
|
@@ -35,58 +39,112 @@ RESTRICTIONS
|
|
|
35
39
|
|
|
36
40
|
You may NOT:
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
- Reverse engineer, decompile, disassemble, or attempt to derive the source
|
|
39
43
|
code, underlying algorithms, or techniques employed in this software
|
|
40
|
-
|
|
44
|
+
- Study, analyze, inspect, or learn from the implementation details, code
|
|
41
45
|
structure, or internal workings of this software
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
- Modify, adapt, translate, or create derivative works
|
|
47
|
+
- Copy, share, distribute, publish, or resell any part of the software
|
|
48
|
+
- Sublicense or transfer rights to any third party
|
|
49
|
+
- Remove, alter, or obscure this license header or any copyright notices
|
|
50
|
+
- Use this software after your subscription has expired or been terminated
|
|
47
51
|
|
|
48
52
|
================================================================================
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
SUBLICENSING AND REDISTRIBUTION PROHIBITION
|
|
55
|
+
|
|
56
|
+
This license is strictly non-transferable and non-sublicensable. You may NOT:
|
|
57
|
+
|
|
58
|
+
- Sublicense, relicense, or transfer any rights granted herein to any third
|
|
59
|
+
party under any circumstances
|
|
60
|
+
- Create any SDK, library, framework, plugin, extension, or middleware that
|
|
61
|
+
redistributes, bundles, or incorporates this software for use by third
|
|
62
|
+
parties
|
|
63
|
+
- Bundle this software into products, applications, or services where
|
|
64
|
+
end-users do not hold their own valid subscription to Three.js Blocks
|
|
65
|
+
- Offer this software as part of any hosted service, software-as-a-service
|
|
66
|
+
(SaaS), platform-as-a-service (PaaS), or similar cloud-based offering
|
|
67
|
+
where third parties access the software's functionality
|
|
68
|
+
- Create wrapper libraries, abstraction layers, or integration packages that
|
|
69
|
+
obscure, circumvent, or eliminate the subscription requirement from
|
|
70
|
+
downstream users
|
|
71
|
+
- Include this software in any product, template, boilerplate, starter kit,
|
|
72
|
+
code generator, or scaffolding tool intended for distribution to third
|
|
73
|
+
parties
|
|
74
|
+
- Provide access to this software through any API, service endpoint, or
|
|
75
|
+
programmatic interface that enables third-party usage
|
|
76
|
+
- License, sell, rent, lease, or otherwise commercially exploit access to
|
|
77
|
+
this software to any third party
|
|
78
|
+
|
|
79
|
+
THIRD-PARTY INTEGRATION REQUIREMENT:
|
|
80
|
+
If you develop any software, SDK, library, framework, application, or service
|
|
81
|
+
that incorporates, depends upon, or integrates with this software, each
|
|
82
|
+
end-user of your software must independently hold their own valid, active
|
|
83
|
+
subscription to Three.js Blocks. You may not use your subscription to provide,
|
|
84
|
+
enable, or facilitate access to this software to any third party. Any attempt
|
|
85
|
+
to circumvent this requirement through technical or contractual means is
|
|
86
|
+
expressly prohibited and constitutes a material breach of this license.
|
|
54
87
|
|
|
55
|
-
|
|
56
|
-
any artificial intelligence models, machine learning systems, or large
|
|
57
|
-
language models (LLMs)
|
|
58
|
-
|
|
59
|
-
✗ Feed this code into AI-assisted development tools for the purpose of
|
|
60
|
-
generating derivative code or training said tools
|
|
61
|
-
|
|
62
|
-
✗ Use automated transformation tools or AI systems to create modified versions
|
|
63
|
-
or derivatives of this software
|
|
64
|
-
|
|
65
|
-
✗ Extract patterns, algorithms, or techniques from this code using automated
|
|
66
|
-
or AI-assisted analysis for incorporation into other software
|
|
67
|
-
|
|
68
|
-
✗ Use this code as training data for code completion, code generation, or
|
|
69
|
-
code suggestion tools
|
|
88
|
+
================================================================================
|
|
70
89
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
90
|
+
AI, MACHINE LEARNING, AND AUTOMATED ANALYSIS PROHIBITION
|
|
91
|
+
|
|
92
|
+
The use of this software, source code, compiled code, documentation, outputs,
|
|
93
|
+
or any data generated by this software for artificial intelligence, machine
|
|
94
|
+
learning, or automated analysis purposes is strictly prohibited. You may NOT:
|
|
95
|
+
|
|
96
|
+
- Use this code, in whole or in part, to train, fine-tune, pre-train, or
|
|
97
|
+
develop any artificial intelligence models, machine learning systems,
|
|
98
|
+
neural networks, or large language models (LLMs)
|
|
99
|
+
- Use this code for reinforcement learning from human feedback (RLHF),
|
|
100
|
+
constitutional AI training, or any similar AI alignment or training
|
|
101
|
+
methodology
|
|
102
|
+
- Create embeddings, vector representations, semantic indices, or any other
|
|
103
|
+
mathematical or computational representations of this code
|
|
104
|
+
- Store this code in vector databases, retrieval systems, knowledge bases,
|
|
105
|
+
or any storage mechanism intended for AI/ML retrieval-augmented generation
|
|
106
|
+
(RAG) or similar AI-assisted retrieval
|
|
107
|
+
- Generate synthetic data, pseudocode, paraphrased code, or derivative
|
|
108
|
+
representations from this codebase for any purpose
|
|
109
|
+
- Use automated tools, scripts, or AI systems to extract patterns,
|
|
110
|
+
algorithms, architectural knowledge, or implementation techniques from
|
|
111
|
+
this software
|
|
112
|
+
- Input this code into AI coding assistants, code completion tools, or
|
|
113
|
+
any AI-powered development environment for the purpose of analysis,
|
|
114
|
+
learning, pattern extraction, or code generation
|
|
115
|
+
- Use this code as context, examples, few-shot prompts, or reference
|
|
116
|
+
material for AI code generation, code completion, or code suggestion
|
|
117
|
+
- Feed this code into any automated transformation tool, transpiler, or
|
|
118
|
+
code converter that uses AI/ML techniques
|
|
119
|
+
- Use any output, behavior, or data generated by this software to train
|
|
120
|
+
or improve any AI/ML system
|
|
121
|
+
|
|
122
|
+
This prohibition applies to all AI/ML systems including but not limited to:
|
|
123
|
+
large language models (LLMs), code completion tools (e.g., GitHub Copilot,
|
|
124
|
+
Amazon CodeWhisperer, and similar tools), code generation systems, neural
|
|
125
|
+
networks, transformer models, diffusion models, and any future AI technologies
|
|
126
|
+
regardless of their architecture or methodology.
|
|
127
|
+
|
|
128
|
+
This prohibition is perpetual and survives any termination or expiration of
|
|
129
|
+
this license agreement.
|
|
75
130
|
|
|
76
131
|
================================================================================
|
|
77
132
|
|
|
78
133
|
SUBSCRIPTION REQUIREMENT
|
|
79
134
|
|
|
80
135
|
This license is valid only while you maintain an active, paid subscription to
|
|
81
|
-
the
|
|
136
|
+
the Three.js Blocks service. Upon expiration or termination of your
|
|
137
|
+
subscription:
|
|
82
138
|
|
|
83
|
-
1. Your license to use this software immediately terminates
|
|
84
|
-
2. You must cease all use of the software
|
|
85
|
-
3. You must remove the software from all projects and
|
|
86
|
-
4. You must not deploy or
|
|
139
|
+
1. Your license to use this software immediately and automatically terminates
|
|
140
|
+
2. You must immediately cease all use of the software
|
|
141
|
+
3. You must remove the software from all projects, systems, and deployments
|
|
142
|
+
4. You must not deploy, distribute, or make available any applications
|
|
143
|
+
containing this software
|
|
144
|
+
5. You must delete all copies of this software in your possession or control
|
|
87
145
|
|
|
88
146
|
Failure to comply with these requirements constitutes copyright infringement
|
|
89
|
-
and breach of contract.
|
|
147
|
+
and breach of contract, and may result in legal action.
|
|
90
148
|
|
|
91
149
|
================================================================================
|
|
92
150
|
|
|
@@ -95,48 +153,73 @@ PACKAGE-SPECIFIC NOTES
|
|
|
95
153
|
@three-blocks/core:
|
|
96
154
|
- Core library with proprietary algorithms and implementations
|
|
97
155
|
- Protected by code obfuscation and this license
|
|
98
|
-
-
|
|
156
|
+
- Subscription required
|
|
157
|
+
|
|
158
|
+
@three-blocks/pro:
|
|
159
|
+
- Advanced physics engine with proprietary implementations
|
|
160
|
+
- Worker-based architecture with SharedArrayBuffer
|
|
161
|
+
- Protected by code obfuscation and this license
|
|
162
|
+
- Subscription required
|
|
99
163
|
|
|
100
164
|
@three-blocks/starter:
|
|
101
165
|
- Starter template for building Three.js applications
|
|
102
166
|
- Includes licensed code and dependencies on @three-blocks/core
|
|
103
|
-
-
|
|
167
|
+
- Subscription required
|
|
104
168
|
|
|
105
169
|
create-three-blocks-starter:
|
|
106
170
|
- Scaffolding tool for creating new projects
|
|
107
171
|
- Publicly available for convenience but proprietary
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
three-blocks-login:
|
|
111
|
-
- Authentication helper for accessing private packages
|
|
112
|
-
- MIT Licensed - May be used independently
|
|
172
|
+
- Creates projects that require subscription
|
|
113
173
|
|
|
114
174
|
================================================================================
|
|
115
175
|
|
|
116
176
|
ENFORCEMENT
|
|
117
177
|
|
|
118
|
-
Unauthorized use, reproduction, distribution,
|
|
119
|
-
prohibition is strictly prohibited and may result in:
|
|
178
|
+
Unauthorized use, reproduction, distribution, reverse engineering, sublicensing,
|
|
179
|
+
or violation of the AI/ML prohibition is strictly prohibited and may result in:
|
|
120
180
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
181
|
+
* Immediate termination of your license and subscription without refund
|
|
182
|
+
* Legal action for copyright infringement
|
|
183
|
+
* Legal action for breach of contract
|
|
184
|
+
* Claims for damages, including actual damages, lost profits, and statutory
|
|
185
|
+
damages where available
|
|
186
|
+
* Recovery of attorneys' fees and costs of enforcement
|
|
187
|
+
* Injunctive relief to prevent further unauthorized use
|
|
188
|
+
* Civil liability under applicable copyright, trade secret, and contract law
|
|
189
|
+
* Criminal penalties under applicable law, including but not limited to the
|
|
190
|
+
Computer Fraud and Abuse Act (CFAA) and equivalent international statutes
|
|
126
191
|
|
|
127
192
|
We employ various technical and legal measures to detect unauthorized use,
|
|
128
|
-
including but not limited to code fingerprinting,
|
|
129
|
-
regular compliance audits.
|
|
193
|
+
including but not limited to code fingerprinting, license validation, usage
|
|
194
|
+
analytics, and regular compliance audits. We reserve the right to pursue all
|
|
195
|
+
available legal remedies against violators.
|
|
196
|
+
|
|
197
|
+
================================================================================
|
|
198
|
+
|
|
199
|
+
INDEMNIFICATION
|
|
200
|
+
|
|
201
|
+
You agree to indemnify, defend, and hold harmless three-blocks, its affiliates,
|
|
202
|
+
officers, directors, employees, and agents from and against any and all claims,
|
|
203
|
+
damages, obligations, losses, liabilities, costs, and expenses (including
|
|
204
|
+
reasonable attorneys' fees) arising from: (a) your use of the software;
|
|
205
|
+
(b) your violation of any term of this license; (c) your violation of any
|
|
206
|
+
third-party right, including any intellectual property or privacy right; or
|
|
207
|
+
(d) any claim that your use of the software caused damage to a third party.
|
|
130
208
|
|
|
131
209
|
================================================================================
|
|
132
210
|
|
|
133
211
|
ACCEPTANCE OF TERMS
|
|
134
212
|
|
|
135
|
-
By
|
|
136
|
-
|
|
213
|
+
By downloading, installing, copying, accessing, or otherwise using this
|
|
214
|
+
software, you acknowledge that you have read, understood, and agree to be
|
|
215
|
+
bound by the complete terms of this license agreement.
|
|
137
216
|
|
|
138
217
|
If you do not agree to these terms, you are not authorized to use, access,
|
|
139
|
-
or
|
|
218
|
+
download, install, or copy this software.
|
|
219
|
+
|
|
220
|
+
If you are accepting these terms on behalf of an organization, you represent
|
|
221
|
+
and warrant that you have the authority to bind that organization to these
|
|
222
|
+
terms.
|
|
140
223
|
|
|
141
224
|
================================================================================
|
|
142
225
|
|
|
@@ -144,16 +227,56 @@ DISCLAIMER OF WARRANTY
|
|
|
144
227
|
|
|
145
228
|
THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
146
229
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
147
|
-
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
|
|
230
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NONINFRINGEMENT.
|
|
231
|
+
|
|
232
|
+
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU.
|
|
233
|
+
SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
|
|
234
|
+
SERVICING, REPAIR, OR CORRECTION.
|
|
148
235
|
|
|
149
236
|
================================================================================
|
|
150
237
|
|
|
151
238
|
LIMITATION OF LIABILITY
|
|
152
239
|
|
|
153
|
-
IN NO EVENT SHALL
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
240
|
+
IN NO EVENT SHALL THREE-BLOCKS, ITS AFFILIATES, LICENSORS, OR SUPPLIERS BE
|
|
241
|
+
LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, PUNITIVE, OR
|
|
242
|
+
EXEMPLARY DAMAGES, INCLUDING BUT NOT LIMITED TO DAMAGES FOR LOSS OF PROFITS,
|
|
243
|
+
GOODWILL, USE, DATA, OR OTHER INTANGIBLE LOSSES, ARISING OUT OF OR IN
|
|
244
|
+
CONNECTION WITH THIS LICENSE OR THE USE OR INABILITY TO USE THE SOFTWARE,
|
|
245
|
+
EVEN IF THREE-BLOCKS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
246
|
+
|
|
247
|
+
IN NO EVENT SHALL THREE-BLOCKS'S TOTAL CUMULATIVE LIABILITY TO YOU FOR ALL
|
|
248
|
+
CLAIMS ARISING OUT OF OR RELATED TO THIS LICENSE OR THE SOFTWARE EXCEED THE
|
|
249
|
+
AMOUNTS PAID BY YOU TO THREE-BLOCKS FOR THE SOFTWARE DURING THE TWELVE (12)
|
|
250
|
+
MONTHS IMMEDIATELY PRECEDING THE EVENT GIVING RISE TO LIABILITY.
|
|
251
|
+
|
|
252
|
+
SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
|
|
253
|
+
CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
|
|
254
|
+
|
|
255
|
+
================================================================================
|
|
256
|
+
|
|
257
|
+
SEVERABILITY
|
|
258
|
+
|
|
259
|
+
If any provision of this license is held to be unenforceable or invalid, that
|
|
260
|
+
provision shall be enforced to the maximum extent possible, and the other
|
|
261
|
+
provisions shall remain in full force and effect.
|
|
262
|
+
|
|
263
|
+
================================================================================
|
|
264
|
+
|
|
265
|
+
WAIVER
|
|
266
|
+
|
|
267
|
+
The failure of three-blocks to enforce any right or provision of this license
|
|
268
|
+
shall not constitute a waiver of such right or provision. No waiver of any
|
|
269
|
+
term of this license shall be deemed a further or continuing waiver of such
|
|
270
|
+
term or any other term.
|
|
271
|
+
|
|
272
|
+
================================================================================
|
|
273
|
+
|
|
274
|
+
ENTIRE AGREEMENT
|
|
275
|
+
|
|
276
|
+
This license constitutes the entire agreement between you and three-blocks
|
|
277
|
+
regarding the software and supersedes all prior agreements, understandings,
|
|
278
|
+
and communications, whether written or oral, regarding the subject matter
|
|
279
|
+
hereof.
|
|
157
280
|
|
|
158
281
|
================================================================================
|
|
159
282
|
|
|
@@ -169,14 +292,16 @@ For license violations or to report unauthorized use:
|
|
|
169
292
|
|
|
170
293
|
================================================================================
|
|
171
294
|
|
|
172
|
-
GOVERNING LAW
|
|
295
|
+
GOVERNING LAW AND JURISDICTION
|
|
173
296
|
|
|
174
297
|
This license shall be governed by and construed in accordance with the laws
|
|
175
|
-
of
|
|
176
|
-
|
|
298
|
+
of Japan, without regard to its conflict of law provisions. Any dispute arising
|
|
299
|
+
out of or relating to this license or the software shall be subject to the
|
|
300
|
+
exclusive jurisdiction of the courts located in Tokyo, Japan, and you hereby
|
|
301
|
+
consent to the personal jurisdiction of such courts.
|
|
177
302
|
|
|
178
303
|
================================================================================
|
|
179
304
|
|
|
180
|
-
Last Updated: January
|
|
181
|
-
Version:
|
|
305
|
+
Last Updated: January 2026
|
|
306
|
+
Version: 2.0
|
|
182
307
|
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npx -y three-blocks-login@latest@latest
|
|
|
16
16
|
|
|
17
17
|
The CLI supports three modes for storing authentication:
|
|
18
18
|
|
|
19
|
-
### 1. Project Mode (
|
|
19
|
+
### 1. Project Mode (Default)
|
|
20
20
|
|
|
21
21
|
Writes `.npmrc` to the current directory. Best for project-specific authentication.
|
|
22
22
|
|
|
@@ -24,15 +24,7 @@ Writes `.npmrc` to the current directory. Best for project-specific authenticati
|
|
|
24
24
|
npx -y three-blocks-login@latest --mode project --scope @three-blocks --channel stable
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
**
|
|
28
|
-
|
|
29
|
-
```json
|
|
30
|
-
{
|
|
31
|
-
"scripts": {
|
|
32
|
-
"preinstall": "npx -y three-blocks-login@latest"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
```
|
|
27
|
+
**For CI/CD:** Run this command BEFORE `pnpm install`, not as a preinstall hook. See [CI/CD Setup](#cicd-setup) for platform-specific examples.
|
|
36
28
|
|
|
37
29
|
**Note:** Flags are optional - the CLI auto-detects `--mode project` in CI environments, defaults to `--scope @three-blocks`, and `--channel stable`.
|
|
38
30
|
|
|
@@ -79,64 +71,77 @@ npx -y three-blocks-login@latest --mode user
|
|
|
79
71
|
| `THREE_BLOCKS_LOGIN_PRINT_SHELL` | Print shell exports in env mode (`1`) |
|
|
80
72
|
| `CI` | Enable non-interactive mode (`1`) |
|
|
81
73
|
|
|
82
|
-
## CI/CD
|
|
74
|
+
## CI/CD Setup
|
|
83
75
|
|
|
84
|
-
|
|
76
|
+
> ⚠️ **pnpm users:** The preinstall hook approach is unreliable with pnpm because pnpm resolves packages BEFORE running preinstall scripts. Use the **CI Install Override** approach below instead.
|
|
85
77
|
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
@three-blocks:registry=https://three-blocks-196905988268.d.codeartifact.ap-northeast-1.amazonaws.com/npm/core/
|
|
89
|
-
```
|
|
78
|
+
### Recommended: CI Install Override (All CIs)
|
|
90
79
|
|
|
91
|
-
|
|
92
|
-
```json
|
|
93
|
-
{
|
|
94
|
-
"scripts": {
|
|
95
|
-
"preinstall": "npx -y three-blocks-login@latest"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
```
|
|
80
|
+
Run the login command BEFORE `pnpm install`, not as a preinstall hook:
|
|
99
81
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
82
|
+
#### Vercel
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
// vercel.json
|
|
86
|
+
{
|
|
87
|
+
"installCommand": "npx -y three-blocks-login@latest && pnpm install"
|
|
88
|
+
}
|
|
89
|
+
```
|
|
103
90
|
|
|
104
|
-
|
|
91
|
+
Set `THREE_BLOCKS_SECRET_KEY` in Vercel → Project Settings → Environment Variables.
|
|
105
92
|
|
|
106
|
-
|
|
107
|
-
- Preinstall script adds the **AUTH TOKEN** dynamically
|
|
108
|
-
- This solves pnpm's resolution timing issue (it needs to know the registry before running preinstall)
|
|
93
|
+
#### AWS Amplify
|
|
109
94
|
|
|
110
|
-
|
|
95
|
+
```yaml
|
|
96
|
+
# amplify.yml
|
|
97
|
+
version: 1
|
|
98
|
+
frontend:
|
|
99
|
+
phases:
|
|
100
|
+
preBuild:
|
|
101
|
+
commands:
|
|
102
|
+
- npx -y three-blocks-login@latest
|
|
103
|
+
- pnpm install
|
|
104
|
+
build:
|
|
105
|
+
commands:
|
|
106
|
+
- pnpm build
|
|
107
|
+
```
|
|
111
108
|
|
|
112
|
-
|
|
113
|
-
2. Navigate to: Settings → Environment Variables
|
|
114
|
-
3. Add `THREE_BLOCKS_SECRET_KEY` environment variable
|
|
115
|
-
4. Set the value to your license key (starts with `tb_...`)
|
|
116
|
-
5. Make sure it's available in all environments (Production, Preview, Development)
|
|
109
|
+
Set `THREE_BLOCKS_SECRET_KEY` in Amplify Console → App Settings → Environment Variables.
|
|
117
110
|
|
|
118
|
-
|
|
111
|
+
#### GitHub Actions
|
|
119
112
|
|
|
120
113
|
```yaml
|
|
121
|
-
- name:
|
|
114
|
+
- name: Auth three-blocks
|
|
122
115
|
run: npx -y three-blocks-login@latest
|
|
123
116
|
env:
|
|
124
117
|
THREE_BLOCKS_SECRET_KEY: ${{ secrets.THREE_BLOCKS_SECRET_KEY }}
|
|
118
|
+
|
|
119
|
+
- name: Install dependencies
|
|
120
|
+
run: pnpm install
|
|
125
121
|
```
|
|
126
122
|
|
|
127
|
-
|
|
123
|
+
#### Netlify
|
|
128
124
|
|
|
129
|
-
|
|
125
|
+
```toml
|
|
126
|
+
# netlify.toml
|
|
127
|
+
[build]
|
|
128
|
+
command = "npx -y three-blocks-login@latest && pnpm install && pnpm build"
|
|
129
|
+
```
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
Set `THREE_BLOCKS_SECRET_KEY` in Netlify → Site Settings → Environment Variables.
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
#### Generic CI
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
Always run login before install:
|
|
136
|
+
```bash
|
|
137
|
+
npx -y three-blocks-login@latest && pnpm install
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Alternative: Preinstall Hook (npm only)
|
|
136
141
|
|
|
137
|
-
**
|
|
142
|
+
> ⚠️ This approach only works reliably with **npm**, not pnpm. For pnpm, use CI Install Override above.
|
|
138
143
|
|
|
139
|
-
1. **Commit a base `.npmrc`**
|
|
144
|
+
1. **Commit a base `.npmrc`** (no auth token):
|
|
140
145
|
```
|
|
141
146
|
@three-blocks:registry=https://three-blocks-196905988268.d.codeartifact.ap-northeast-1.amazonaws.com/npm/core/
|
|
142
147
|
```
|
|
@@ -150,12 +155,31 @@ npx -y three-blocks-login@latest --mode user
|
|
|
150
155
|
}
|
|
151
156
|
```
|
|
152
157
|
|
|
153
|
-
3. **
|
|
158
|
+
3. **Set `THREE_BLOCKS_SECRET_KEY`** in CI environment variables.
|
|
159
|
+
|
|
160
|
+
## Troubleshooting
|
|
161
|
+
|
|
162
|
+
### 401 Unauthorized on Vercel/Amplify/CI
|
|
163
|
+
|
|
164
|
+
**Problem:** Getting `ERR_PNPM_FETCH_401` or 401 errors in CI.
|
|
165
|
+
|
|
166
|
+
**Root Cause:** pnpm resolves packages BEFORE running preinstall scripts. If you're using a preinstall hook with pnpm, it won't work reliably.
|
|
167
|
+
|
|
168
|
+
**Solution:** Use CI Install Override instead of preinstall hooks.
|
|
169
|
+
|
|
170
|
+
For Vercel, add to `vercel.json`:
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"installCommand": "npx -y three-blocks-login@latest && pnpm install"
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
For other CIs, see the [CI/CD Setup](#cicd-setup) section above.
|
|
154
178
|
|
|
155
|
-
**
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
179
|
+
**Also check:**
|
|
180
|
+
- `THREE_BLOCKS_SECRET_KEY` is set in CI environment variables
|
|
181
|
+
- `.npmrc` does NOT contain an `_authToken` line (tokens expire in 12h)
|
|
182
|
+
- Remove any preinstall hook from `package.json` if using CI override
|
|
159
183
|
|
|
160
184
|
### License Key Format
|
|
161
185
|
|
package/bin/login.js
CHANGED
|
@@ -24,7 +24,6 @@ const bold = ( s ) => ESC( 1 ) + s + reset;
|
|
|
24
24
|
const dim = ( s ) => ESC( 2 ) + s + reset;
|
|
25
25
|
const red = ( s ) => ESC( 31 ) + s + reset;
|
|
26
26
|
const green = ( s ) => ESC( 32 ) + s + reset;
|
|
27
|
-
const yellow = ( s ) => ESC( 33 ) + s + reset;
|
|
28
27
|
const cyan = ( s ) => ESC( 36 ) + s + reset;
|
|
29
28
|
const plainBanner = `[three-blocks-login@${pkg.version}]`;
|
|
30
29
|
const banner = cyan( plainBanner );
|
|
@@ -106,90 +105,6 @@ const quoteArg = ( value ) => {
|
|
|
106
105
|
|
|
107
106
|
const formatCommand = ( cmd, args = [] ) => [ cmd, ...args ].map( quoteArg ).join( " " );
|
|
108
107
|
|
|
109
|
-
const HEADER_WIDTH = 96;
|
|
110
|
-
const LEFT_WIDTH = 60;
|
|
111
|
-
const RIGHT_WIDTH = HEADER_WIDTH - LEFT_WIDTH - 3;
|
|
112
|
-
|
|
113
|
-
const repeatChar = ( ch, len ) => ch.repeat( Math.max( 0, len ) );
|
|
114
|
-
const stripAnsi = ( value ) => String( value ?? '' ).replace( /\u001b\[[0-9;]*m/g, '' );
|
|
115
|
-
const ellipsize = ( value, width ) => {
|
|
116
|
-
|
|
117
|
-
const str = String( value ?? '' );
|
|
118
|
-
const plain = stripAnsi( str );
|
|
119
|
-
if ( plain.length <= width ) return str;
|
|
120
|
-
if ( width <= 1 ) return plain.slice( 0, width );
|
|
121
|
-
const truncated = plain.slice( 0, width - 1 ) + '…';
|
|
122
|
-
return plain === str ? truncated : truncated;
|
|
123
|
-
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const visibleLength = ( value ) => stripAnsi( String( value ?? '' ) ).length;
|
|
127
|
-
const padText = ( value, width, align = 'left' ) => {
|
|
128
|
-
|
|
129
|
-
const text = ellipsize( value, width );
|
|
130
|
-
const current = visibleLength( text );
|
|
131
|
-
const remaining = width - current;
|
|
132
|
-
if ( remaining <= 0 ) return text;
|
|
133
|
-
if ( align === 'center' ) {
|
|
134
|
-
|
|
135
|
-
const left = Math.floor( remaining / 2 );
|
|
136
|
-
const right = remaining - left;
|
|
137
|
-
return `${' '.repeat( left )}${text}${' '.repeat( right )}`;
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if ( align === 'right' ) {
|
|
142
|
-
|
|
143
|
-
return `${' '.repeat( remaining )}${text}`;
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return `${text}${' '.repeat( remaining )}`;
|
|
148
|
-
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const makeHeaderRow = ( left, right = '', leftAlign = 'left', rightAlign = 'left' ) =>
|
|
152
|
-
`│${padText( left, LEFT_WIDTH, leftAlign )}│${padText( right, RIGHT_WIDTH, rightAlign )}│`;
|
|
153
|
-
|
|
154
|
-
const HEADER_COLOR = ESC( 33 );
|
|
155
|
-
const CONTENT_COLOR = ESC( 90 ); // bright black (grey)
|
|
156
|
-
const reapplyColor = ( value, color ) => {
|
|
157
|
-
|
|
158
|
-
const str = String( value ?? '' );
|
|
159
|
-
return `${color}${str.split( reset ).join( `${reset}${color}` )}${reset}`;
|
|
160
|
-
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const applyHeaderColor = ( row, { keepContentYellow = false, tintContent = true } = {} ) => {
|
|
164
|
-
|
|
165
|
-
if ( keepContentYellow ) return reapplyColor( row, HEADER_COLOR );
|
|
166
|
-
if ( ! row.startsWith( '│' ) || ! row.endsWith( '│' ) ) return reapplyColor( row, HEADER_COLOR );
|
|
167
|
-
const match = row.match( /^│(.*)│(.*)│$/ );
|
|
168
|
-
if ( ! match ) return reapplyColor( row, HEADER_COLOR );
|
|
169
|
-
const [ , leftContent, rightContent ] = match;
|
|
170
|
-
const leftSegment = tintContent ? reapplyColor( leftContent, CONTENT_COLOR ) : leftContent;
|
|
171
|
-
const rightSegment = tintContent ? reapplyColor( rightContent, CONTENT_COLOR ) : rightContent;
|
|
172
|
-
return `${HEADER_COLOR}│${reset}${leftSegment}${HEADER_COLOR}│${reset}${rightSegment}${HEADER_COLOR}│${reset}`;
|
|
173
|
-
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
const formatRegistryShort = ( value ) => {
|
|
177
|
-
|
|
178
|
-
if ( ! value ) return '';
|
|
179
|
-
try {
|
|
180
|
-
|
|
181
|
-
const u = new URL( value );
|
|
182
|
-
const pathname = ( u.pathname || '' ).replace( /\/$/, '' );
|
|
183
|
-
return `${u.host}${pathname}`;
|
|
184
|
-
|
|
185
|
-
} catch {
|
|
186
|
-
|
|
187
|
-
return String( value );
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
};
|
|
192
|
-
|
|
193
108
|
const maskLicense = ( s ) => {
|
|
194
109
|
|
|
195
110
|
if ( ! s ) return '••••';
|
|
@@ -269,87 +184,37 @@ const USER_DISPLAY_NAME = getUserDisplayName();
|
|
|
269
184
|
|
|
270
185
|
const renderEnvHeader = ( {
|
|
271
186
|
scope,
|
|
272
|
-
registry,
|
|
273
187
|
expiresAt,
|
|
274
|
-
tmpFile,
|
|
275
188
|
licenseMasked,
|
|
276
|
-
licenseId,
|
|
277
|
-
channel,
|
|
278
189
|
status,
|
|
279
190
|
plan,
|
|
280
|
-
teamName,
|
|
281
|
-
teamId,
|
|
282
|
-
repository,
|
|
283
|
-
domain,
|
|
284
|
-
region,
|
|
285
191
|
userDisplayName,
|
|
286
192
|
} ) => {
|
|
287
193
|
|
|
288
|
-
const title = `─── Three Blocks Login v${CLI_VERSION} `;
|
|
289
|
-
const separatorRow = makeHeaderRow( repeatChar( '─', LEFT_WIDTH ), repeatChar( '─', RIGHT_WIDTH ) );
|
|
290
|
-
const channelDisplay = String( channel || '' ).toUpperCase() || 'STABLE';
|
|
291
|
-
const registryShort = formatRegistryShort( registry );
|
|
292
|
-
|
|
293
194
|
const displayName = userDisplayName || USER_DISPLAY_NAME;
|
|
294
|
-
const welcomeLine = displayName ? `Welcome back ${displayName}!` : 'Welcome back!';
|
|
295
|
-
const scopeLine = `Scope: ${scope}`;
|
|
195
|
+
const welcomeLine = displayName ? `Welcome back, ${displayName}!` : 'Welcome back!';
|
|
296
196
|
|
|
297
197
|
const planLabel = normalizePlan( plan );
|
|
298
|
-
const
|
|
299
|
-
const subscriptionLine = `Plan: ${planLabel}${teamLabel}`;
|
|
300
|
-
const channelLine = `Channel: ${channelDisplay}${region ? ` · Region: ${region}` : ''}`;
|
|
301
|
-
|
|
302
|
-
const repositoryBase = repository ? `Repository: ${repository}` : 'Repository: —';
|
|
303
|
-
const repositoryLine = registryShort ? `${repositoryBase} → ${registryShort}` : repositoryBase;
|
|
304
|
-
const registryLine = `Registry: ${registryShort || ( registry || '—' )}`;
|
|
305
|
-
|
|
306
|
-
let domainValue = domain || '';
|
|
307
|
-
if ( ! domainValue && registry ) {
|
|
308
|
-
|
|
309
|
-
try {
|
|
310
|
-
|
|
311
|
-
domainValue = new URL( registry ).host;
|
|
312
|
-
|
|
313
|
-
} catch {}
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const domainLineText = `Domain: ${domainValue || '—'}`;
|
|
318
|
-
const regionLineText = `Region: ${region || '—'}`;
|
|
198
|
+
const planLine = `${planLabel} · ${scope}`;
|
|
319
199
|
|
|
320
|
-
const licenseLine = `License: ${licenseMasked}${licenseId ? ` · ${licenseId}` : ''}`;
|
|
321
200
|
const expiresLine = formatExpiryLabel( expiresAt );
|
|
201
|
+
const licenseLine = `${licenseMasked} · ${expiresLine}`;
|
|
322
202
|
|
|
323
|
-
const ascii = [
|
|
324
|
-
'THREE.JS',
|
|
325
|
-
' ______ __ ______ ______ __ __ ______ ',
|
|
326
|
-
'/\\ == \\ /\\ \\ /\\ __ \\ /\\ ___\\ /\\ \\/ / /\\ ___\\ ',
|
|
327
|
-
'\\ \\ __< \\ \\ \\____ \\ \\ \\/\\ \\ \\ \\ \\____ \\ \\ _"-. \\ \\___ \\ ',
|
|
328
|
-
' \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\ \\_\\ \\/\\_____\\',
|
|
329
|
-
' \\/_____\/ \\/_____/ \\/_____/ \\/_____/ \\/_/ \/_/ \\/_____/'
|
|
330
|
-
];
|
|
331
203
|
const statusMessage = status?.message || ( status?.ok ? 'access granted' : status ? 'no active access' : 'pending' );
|
|
332
|
-
const
|
|
333
|
-
? green(
|
|
204
|
+
const statusLine = status?.ok
|
|
205
|
+
? green( `✓ Authenticated — ${statusMessage}` )
|
|
334
206
|
: status
|
|
335
|
-
? red(
|
|
336
|
-
: dim(
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
applyHeaderColor( makeHeaderRow( domainLineText, regionLineText, 'left', 'center' ) ),
|
|
347
|
-
applyHeaderColor( makeHeaderRow( licenseLine, expiresLine ) ),
|
|
348
|
-
applyHeaderColor( separatorRow, { keepContentYellow: true } ),
|
|
349
|
-
applyHeaderColor( makeHeaderRow( statusText, '', 'left', 'center' ), { tintContent: false } ),
|
|
350
|
-
applyHeaderColor( `╰${repeatChar( '─', HEADER_WIDTH - 2 )}╯`, { keepContentYellow: true } ),
|
|
351
|
-
];
|
|
352
|
-
for ( const row of lines ) console.log( row );
|
|
207
|
+
? red( `✗ Not authenticated — ${statusMessage}` )
|
|
208
|
+
: dim( `Status: ${statusMessage}` );
|
|
209
|
+
|
|
210
|
+
console.log( '' );
|
|
211
|
+
console.log( `${cyan( '▲' )} ${bold( 'three-blocks-login' )} ${dim( `v${CLI_VERSION}` )}` );
|
|
212
|
+
console.log( '' );
|
|
213
|
+
console.log( welcomeLine );
|
|
214
|
+
console.log( dim( planLine ) );
|
|
215
|
+
console.log( dim( licenseLine ) );
|
|
216
|
+
console.log( statusLine );
|
|
217
|
+
console.log( '' );
|
|
353
218
|
|
|
354
219
|
};
|
|
355
220
|
|
|
@@ -376,6 +241,32 @@ if ( SKIP_LOGIN ) {
|
|
|
376
241
|
|
|
377
242
|
}
|
|
378
243
|
|
|
244
|
+
// Detect pnpm + preinstall timing issue
|
|
245
|
+
const isPnpmPreinstall = () => {
|
|
246
|
+
|
|
247
|
+
const lifecycle = String( process.env.npm_lifecycle_event || '' ).toLowerCase();
|
|
248
|
+
const userAgent = String( process.env.npm_config_user_agent || '' ).toLowerCase();
|
|
249
|
+
return lifecycle === 'preinstall' && userAgent.includes( 'pnpm' );
|
|
250
|
+
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const warnPnpmPreinstall = () => {
|
|
254
|
+
|
|
255
|
+
if ( ! isPnpmPreinstall() || QUIET ) return;
|
|
256
|
+
console.error( '' );
|
|
257
|
+
console.error( cyan( '⚠' ) + ' ' + bold( 'pnpm preinstall timing warning' ) );
|
|
258
|
+
console.error( dim( ' pnpm resolves packages BEFORE running preinstall hooks.' ) );
|
|
259
|
+
console.error( dim( ' If you see 401 errors, use CI install command override instead:' ) );
|
|
260
|
+
console.error( '' );
|
|
261
|
+
console.error( dim( ' Vercel: ' ) + cyan( '"installCommand": "npx -y three-blocks-login@latest && pnpm install"' ) );
|
|
262
|
+
console.error( dim( ' Amplify: ' ) + cyan( 'preBuild: npx -y three-blocks-login@latest && pnpm install' ) );
|
|
263
|
+
console.error( dim( ' Generic: ' ) + cyan( 'npx -y three-blocks-login@latest && pnpm install' ) );
|
|
264
|
+
console.error( '' );
|
|
265
|
+
console.error( dim( ' Docs: https://threejs-blocks.com/auth-guide' ) );
|
|
266
|
+
console.error( '' );
|
|
267
|
+
|
|
268
|
+
};
|
|
269
|
+
|
|
379
270
|
// Load .env from current working directory (no deps)
|
|
380
271
|
loadEnvFromDotfile( process.cwd() );
|
|
381
272
|
|
|
@@ -432,7 +323,7 @@ const openBrowser = async ( url ) => {
|
|
|
432
323
|
const createSpinner = ( { stream = process.stderr } = {} ) => {
|
|
433
324
|
|
|
434
325
|
const enabled = !! ( stream?.isTTY && ! QUIET && ! NON_INTERACTIVE );
|
|
435
|
-
const frames = [ '
|
|
326
|
+
const frames = [ '△', '▲', '▲', '△', '○', '●', '●', '○', '□', '■', '■', '□' ];
|
|
436
327
|
let idx = 0;
|
|
437
328
|
let timer = null;
|
|
438
329
|
let text = '';
|
|
@@ -456,9 +347,9 @@ const createSpinner = ( { stream = process.stderr } = {} ) => {
|
|
|
456
347
|
const render = () => {
|
|
457
348
|
|
|
458
349
|
if ( ! enabled ) return;
|
|
350
|
+
clearLine();
|
|
459
351
|
const frame = frames[ idx ];
|
|
460
352
|
idx = ( idx + 1 ) % frames.length;
|
|
461
|
-
clearLine();
|
|
462
353
|
stream.write( `${cyan( frame )} ${text}` );
|
|
463
354
|
|
|
464
355
|
};
|
|
@@ -474,10 +365,11 @@ const createSpinner = ( { stream = process.stderr } = {} ) => {
|
|
|
474
365
|
const start = ( nextText ) => {
|
|
475
366
|
|
|
476
367
|
if ( ! enabled ) return;
|
|
368
|
+
stop();
|
|
477
369
|
text = String( nextText ?? '' );
|
|
478
370
|
idx = 0;
|
|
479
371
|
render();
|
|
480
|
-
timer = setInterval( render,
|
|
372
|
+
timer = setInterval( render, 60 );
|
|
481
373
|
|
|
482
374
|
};
|
|
483
375
|
|
|
@@ -737,7 +629,7 @@ const browserLogin = async () => {
|
|
|
737
629
|
if ( ! browserOpened ) log.warn( 'Could not open browser automatically.' );
|
|
738
630
|
|
|
739
631
|
console.log( '' );
|
|
740
|
-
log.info(
|
|
632
|
+
log.info( cyan( 'Browser didn\'t open? Use the URL below to sign in:' ) );
|
|
741
633
|
console.log( '' );
|
|
742
634
|
console.log( ` ${cyan( verification_uri_complete || verification_uri )}` );
|
|
743
635
|
console.log( '' );
|
|
@@ -844,7 +736,7 @@ const log = {
|
|
|
844
736
|
},
|
|
845
737
|
warn: ( msg ) => {
|
|
846
738
|
|
|
847
|
-
if ( ! QUIET ) console.error( `${
|
|
739
|
+
if ( ! QUIET ) console.error( `${cyan( "⚠" )} ${msg}` );
|
|
848
740
|
|
|
849
741
|
},
|
|
850
742
|
error: ( msg ) => {
|
|
@@ -856,6 +748,9 @@ const log = {
|
|
|
856
748
|
|
|
857
749
|
( async () => {
|
|
858
750
|
|
|
751
|
+
// Warn about pnpm preinstall timing issue early
|
|
752
|
+
warnPnpmPreinstall();
|
|
753
|
+
|
|
859
754
|
try {
|
|
860
755
|
|
|
861
756
|
let LICENSE = args.license || process.env.THREE_BLOCKS_SECRET_KEY;
|
|
@@ -872,7 +767,7 @@ const log = {
|
|
|
872
767
|
}
|
|
873
768
|
|
|
874
769
|
console.log( '' );
|
|
875
|
-
log.info( bold(
|
|
770
|
+
log.info( bold( cyan( 'Three Blocks Login' ) ) + ' ' + dim( `[mode: ${MODE}]` ) );
|
|
876
771
|
console.log( '' );
|
|
877
772
|
|
|
878
773
|
// Determine login method
|