@produtype/core 1.8.0 → 1.8.2
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/dist/analyzer/catalogue.js +14 -1
- package/dist/analyzer/detectEnv.js +22 -3
- package/package.json +1 -1
|
@@ -104,7 +104,20 @@ exports.JVM_DATABASES = [
|
|
|
104
104
|
];
|
|
105
105
|
/** Ruby frameworks, read from the Gemfile. */
|
|
106
106
|
exports.RUBY_BACKEND_FRAMEWORKS = [
|
|
107
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Rails is often declared by its parts rather than by its name.
|
|
109
|
+
*
|
|
110
|
+
* Discourse's Gemfile has no `gem "rails"` in it at all: it pins `actionpack`,
|
|
111
|
+
* `actionview`, `activerecord` and `railties` separately, which is what a large
|
|
112
|
+
* application does when it wants to control the pieces. The report said
|
|
113
|
+
* `backend: ruby` — the fallback for a Gemfile with no web framework in it — about
|
|
114
|
+
* the best-known Rails application there is.
|
|
115
|
+
*
|
|
116
|
+
* `railties` is the framework itself and nothing but Rails and its engines depends
|
|
117
|
+
* on it; `actionpack` is the half that handles requests. Both are names the Rails
|
|
118
|
+
* team chose, which is the whole argument.
|
|
119
|
+
*/
|
|
120
|
+
['rails', ['rails', 'railties', 'actionpack']],
|
|
108
121
|
['sinatra', ['sinatra']],
|
|
109
122
|
['hanami', ['hanami']],
|
|
110
123
|
['roda', ['roda']],
|
|
@@ -104,10 +104,29 @@ async function detectEnv(ctx) {
|
|
|
104
104
|
apiKey: [],
|
|
105
105
|
unknown: [],
|
|
106
106
|
};
|
|
107
|
-
|
|
107
|
+
/**
|
|
108
|
+
* The template has more than one spelling, and one exact string knew one of them.
|
|
109
|
+
*
|
|
110
|
+
* immich ships `docker/example.env` — the name reversed, and one directory down,
|
|
111
|
+
* which is where a compose deployment keeps it — and was told at `medium` that it
|
|
112
|
+
* reads environment variables without publishing a template. The check was
|
|
113
|
+
* `files.all.includes('.env.example')`: the right idea matched against a single
|
|
114
|
+
* literal at the root.
|
|
115
|
+
*
|
|
116
|
+
* The vocabulary is small and conventional, so it is written out: `.env` followed
|
|
117
|
+
* by example, sample, template, dist or defaults, the same words in front of `.env`
|
|
118
|
+
* instead, and the `.env.local.example` shape a monorepo uses per application.
|
|
119
|
+
*
|
|
120
|
+
* `.env` itself is deliberately not in it, and neither is `.env.production`: the
|
|
121
|
+
* first is the real file — a different finding when it is committed — and the second
|
|
122
|
+
* is one environment's values rather than a blank somebody fills in.
|
|
123
|
+
*/
|
|
124
|
+
const ENV_TEMPLATE = /(^|\/)(?:\.?env(?:\.[a-z0-9-]+)?\.(?:example|sample|template|dist|defaults)|(?:example|sample|template)\.env)$/i;
|
|
125
|
+
const envTemplates = ctx.files.all.filter((file) => ENV_TEMPLATE.test(file));
|
|
126
|
+
const hasEnvExample = envTemplates.length > 0;
|
|
108
127
|
const hasEnv = ctx.files.all.includes('.env');
|
|
109
|
-
|
|
110
|
-
evidence.push({ type: 'file', value:
|
|
128
|
+
for (const file of envTemplates.slice(0, 3))
|
|
129
|
+
evidence.push({ type: 'file', value: file, file });
|
|
111
130
|
if (hasEnv)
|
|
112
131
|
evidence.push({ type: 'file', value: '.env' });
|
|
113
132
|
const sourceFiles = ctx.files.source;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@produtype/core",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Deterministic CLI and library that analyzes a web application repository and reports how far it is from production-ready for the kind of product it is meant to be.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|