layero 0.11.24 → 0.11.25
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/README.md +6 -0
- package/dist/pack.js +43 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -368,6 +368,12 @@ Full reference: <https://docs.layero.ru/cli/json-events>
|
|
|
368
368
|
`node_modules`, `.git`, `dist`, `build`, `.next`, `.env*`, `.DS_Store`, and
|
|
369
369
|
the rule files themselves. Maximum archive size is 500 MB.
|
|
370
370
|
|
|
371
|
+
Env files (`.env`, `.env.*`) stay out even if `.gitignore` un-ignores them
|
|
372
|
+
(`!.env.example`, `!.env`): those rules are written for git, not for a
|
|
373
|
+
deploy. To upload an env file on purpose, name it in `.layeroignore`:
|
|
374
|
+
`!.env.production`. Broad negations like `!*` do not bring env files back,
|
|
375
|
+
and nothing brings back `.git`, `.layero` or the rule files.
|
|
376
|
+
|
|
371
377
|
## Config
|
|
372
378
|
|
|
373
379
|
- Auth token: `~/.layero/config.json` (chmod 600). Claim tokens of temporary
|
package/dist/pack.js
CHANGED
|
@@ -60,11 +60,50 @@ const FORCE_INCLUDE_LOCKFILES = [
|
|
|
60
60
|
"pnpm-lock.yaml",
|
|
61
61
|
"npm-shrinkwrap.json",
|
|
62
62
|
];
|
|
63
|
-
|
|
63
|
+
// Env files carry secrets. In the `ignore` package the last matching rule
|
|
64
|
+
// wins, so a `.gitignore` written for git — `!.env.example`, or `!.env` in a
|
|
65
|
+
// monorepo that commits a shared one — used to pull env files back into the
|
|
66
|
+
// archive. A static site without a build serves the archive as-is, so that
|
|
67
|
+
// `.env` ended up readable at the site's address.
|
|
68
|
+
//
|
|
69
|
+
// The exclusion is therefore re-applied after each user layer. The only way
|
|
70
|
+
// back in is an explicit negation in `.layeroignore` that names an env file
|
|
71
|
+
// (`!.env.production`): a deliberate, Layero-specific choice. `.gitignore`
|
|
72
|
+
// never overrides it, and neither do broad `.layeroignore` negations such as
|
|
73
|
+
// `!*`.
|
|
74
|
+
//
|
|
75
|
+
// The same broad negation would also have pulled back the other things that
|
|
76
|
+
// must never reach a site: VCS metadata (remote credentials live in
|
|
77
|
+
// `.git/config`), the CLI's own `.layero/` (claim tokens) and the rule files
|
|
78
|
+
// themselves. They get the same treatment, with no way back in at all.
|
|
79
|
+
const ENV_EXCLUDE = [".env", ".env.*"];
|
|
80
|
+
const ALWAYS_EXCLUDE = [
|
|
81
|
+
...ENV_EXCLUDE,
|
|
82
|
+
".git",
|
|
83
|
+
".svn",
|
|
84
|
+
".hg",
|
|
85
|
+
".layero",
|
|
86
|
+
".gitignore",
|
|
87
|
+
".layeroignore",
|
|
88
|
+
];
|
|
89
|
+
/** Negations from `.layeroignore` that explicitly name an env file. */
|
|
90
|
+
function explicitEnvNegations(lines) {
|
|
91
|
+
return lines.filter((l) => l.startsWith("!") && l.includes(".env"));
|
|
92
|
+
}
|
|
93
|
+
async function userLayers(cwd) {
|
|
94
|
+
const gitignore = await readIgnoreFile(path.join(cwd, ".gitignore"));
|
|
95
|
+
const layeroignore = await readIgnoreFile(path.join(cwd, ".layeroignore"));
|
|
64
96
|
const ig = ignore();
|
|
65
97
|
ig.add(DEFAULT_IGNORE);
|
|
66
|
-
ig.add(
|
|
67
|
-
ig.add(
|
|
98
|
+
ig.add(gitignore);
|
|
99
|
+
ig.add(ALWAYS_EXCLUDE);
|
|
100
|
+
ig.add(layeroignore);
|
|
101
|
+
ig.add(ALWAYS_EXCLUDE);
|
|
102
|
+
ig.add(explicitEnvNegations(layeroignore));
|
|
103
|
+
return ig;
|
|
104
|
+
}
|
|
105
|
+
async function buildIgnore(cwd) {
|
|
106
|
+
const ig = await userLayers(cwd);
|
|
68
107
|
// Negations last so they win over any ignore rule above.
|
|
69
108
|
ig.add(FORCE_INCLUDE_LOCKFILES.map((f) => `!/${f}`));
|
|
70
109
|
return ig;
|
|
@@ -106,10 +145,7 @@ async function sha256OfFile(p) {
|
|
|
106
145
|
* negations, so it reflects exactly what the user's .gitignore/.layeroignore
|
|
107
146
|
* would have excluded. */
|
|
108
147
|
async function detectForcedLockfiles(cwd) {
|
|
109
|
-
const probe =
|
|
110
|
-
probe.add(DEFAULT_IGNORE);
|
|
111
|
-
probe.add(await readIgnoreFile(path.join(cwd, ".gitignore")));
|
|
112
|
-
probe.add(await readIgnoreFile(path.join(cwd, ".layeroignore")));
|
|
148
|
+
const probe = await userLayers(cwd);
|
|
113
149
|
const forced = [];
|
|
114
150
|
for (const lf of FORCE_INCLUDE_LOCKFILES) {
|
|
115
151
|
if (!probe.ignores(lf))
|
package/package.json
CHANGED